domain
stringclasses
1 value
text
stringlengths
42.5k
564k
length
int64
41.5k
168k
thestackv1_concat_by_repo-long/65536-65536
ANCIATE_CONTAINER(multiset); #endif //Function to test pointer to function support: void FTypeInstance() {} //Class to test pointer to member method support: class AClass { public: void func() {} }; // // tests implementation // void PtrSpecTest::ptr_specialization_test() { int *int_array[] = {0, 0, 0}; int const* cint_array[] = {0, 0, 0}; { vector<void*> void_vect; deque<void*> void_deque; list<void*> void_list; #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) slist<void*> void_slist; #endif } { typedef void (*FType)(); vector<FType> func_vector; func_vector.push_back(&FTypeInstance); } #if!defined(__GNUC__) || (__GNUC__ > 2) { typedef void (AClass::*MFType)(); vector<MFType> mem_func_vector; mem_func_vector.push_back(&AClass::func); } #endif vector<int*> pint_vect; vector<int*> pint_vect2; vector<int const*> pcint_vect; list<int*> pint_list; list<int*> pint_list2; list<int const*> pcint_list; #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) slist<int*> pint_slist; slist<int*> pint_slist2; slist<int const*> pcint_slist; #endif deque<int*> pint_deque; deque<int*> pint_deque2; deque<int const*> pcint_deque; #if!defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) vector<int*> pint_vect_from_list(pint_list.begin(), pint_list.end()); #endif pint_vect.insert(pint_vect.end(), pint_vect2.begin(), pint_vect2.end()); pint_vect.insert(pint_vect.end(), int_array, int_array + 3); pint_vect2.insert(pint_vect2.end(), int_array, int_array + 3); pcint_vect.insert(pcint_vect.end(), int_array, int_array + 3); pcint_vect.insert(pcint_vect.end(), cint_array, cint_array + 3); #if!defined (STLPORT) ||!defined(_STLP_DEBUG) || defined(_STLP_MEMBER_TEMPLATES) pcint_vect.insert(pcint_vect.end(), pint_vect2.begin(), pint_vect2.end()); #endif pcint_vect.insert(pcint_vect.end(), int_array, int_array + 3); #if!defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) pint_vect.insert(pint_vect.end(), pint_list.begin(), pint_list.end()); pcint_vect.insert(pcint_vect.end(), pint_list.begin(), pint_list.end()); pcint_vect.insert(pcint_vect.end(), pcint_list.begin(), pcint_list.end()); pint_vect.assign(pint_list.begin(), pint_list.end()); pcint_vect.assign(pint_list.begin(), pint_list.end()); #endif pint_vect.assign(int_array, int_array + 3); pcint_vect.assign(int_array, int_array + 3); pcint_vect.assign(cint_array, cint_array + 3); copy(int_array, int_array + 3, back_inserter(pint_vect)); #if!defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) pint_list.sort(binary_pred<int>()); pcint_list.sort(binary_pred<int const>()); pint_list.unique(binary_pred<int>()); pcint_list.unique(binary_pred<int const>()); pint_list.merge(pint_list, binary_pred<int>()); pcint_list.merge(pcint_list, binary_pred<int const>()); pint_list.remove_if(unary_pred<int>()); pcint_list.remove_if(unary_pred<int const>()); #endif copy(int_array, int_array + 3, back_inserter(pint_list)); copy(int_array, int_array + 3, back_inserter(pint_list2)); pint_list.insert(pint_list.end(), pint_list2.begin(), pint_list2.end()); #if!defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) pcint_list.insert(pcint_list.end(), pint_list.begin(), pint_list.end()); #endif #if!defined (STLPORT) ||!defined(_STLP_DEBUG) || defined(_STLP_MEMBER_TEMPLATES) pint_list.insert(pint_list.end(), pint_vect.begin(), pint_vect.end()); pcint_list.insert(pcint_list.end(), pint_vect.begin(), pint_vect.end()); pcint_list.insert(pcint_list.end(), pcint_vect.begin(), pcint_vect.end()); list<int*> pint_list_from_vect(pint_vect.begin(), pint_vect.end()); pint_list.assign(pint_vect.begin(), pint_vect.end()); pcint_list.assign(pint_vect.begin(), pint_vect.end()); #endif pint_list.insert(pint_list.begin(), int_array, int_array + 3); pint_list.insert(pint_list.end(), int_array, int_array + 3); pcint_list.insert(pcint_list.end(), int_array, int_array + 3); pcint_list.insert(pcint_list.end(), cint_array, cint_array + 3); pint_list.assign(int_array, int_array + 3); pcint_list.assign(int_array, int_array + 3); pcint_list.assign(cint_array, cint_array + 3); //pint_list.assign(pcint_vect.begin(), pcint_vect.end()); #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) copy(int_array, int_array + 3, front_inserter(pint_slist)); copy(int_array, int_array + 3, front_inserter(pint_slist2)); pint_slist.insert(pint_slist.end(), pint_slist2.begin(), pint_slist2.end()); # if defined (_STLP_MEMBER_TEMPLATES) pcint_slist.insert(pcint_slist.end(), pint_slist.begin(), pint_slist.end()); # endif # if!defined (_STLP_DEBUG) || defined (_STLP_MEMBER_TEMPLATES) pint_slist.insert(pint_slist.end(), pint_vect.begin(), pint_vect.end()); pcint_slist.insert(pcint_slist.end(), pint_vect.begin(), pint_vect.end()); pcint_slist.insert(pcint_slist.end(), pcint_vect.begin(), pcint_vect.end()); slist<int*> pint_slist_from_vect(pint_vect.begin(), pint_vect.end()); pint_slist.assign(pint_vect.begin(), pint_vect.end()); pcint_slist.assign(pint_vect.begin(), pint_vect.end()); # endif pint_slist.insert(pint_slist.end(), int_array, int_array + 3); pcint_slist.insert(pcint_slist.end(), int_array, int_array + 3); pcint_slist.insert(pcint_slist.end(), cint_array, cint_array + 3); pint_slist.assign(int_array, int_array + 3); pcint_slist.assign(int_array, int_array + 3); pcint_slist.assign(cint_array, cint_array + 3); //pint_slist.assign(pcint_vect.begin(), pcint_vect.end()); #endif copy(int_array, int_array + 3, back_inserter(pint_deque)); copy(int_array, int_array + 3, back_inserter(pint_deque2)); pint_deque.insert(pint_deque.end(), pint_deque2.begin(), pint_deque2.end()); #if!defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) pcint_deque.insert(pcint_deque.end(), pint_deque.begin(), pint_deque.end()); #endif #if!defined (STLPORT) ||!defined(_STLP_DEBUG) || defined(_STLP_MEMBER_TEMPLATES) pint_deque.insert(pint_deque.end(), pint_vect.begin(), pint_vect.end()); pcint_deque.insert(pcint_deque.end(), pint_vect.begin(), pint_vect.end()); pcint_deque.insert(pcint_deque.end(), pcint_vect.begin(), pcint_vect.end()); deque<int*> pint_deque_from_vect(pint_vect.begin(), pint_vect.end()); pint_deque.assign(pint_vect.begin(), pint_vect.end()); pcint_deque.assign(pint_vect.begin(), pint_vect.end()); #endif pint_deque.insert(pint_deque.end(), int_array, int_array + 3); pcint_deque.insert(pcint_deque.end(), int_array, int_array + 3); pcint_deque.insert(pcint_deque.end(), cint_array, cint_array + 3); pint_deque.assign(int_array, int_array + 3); pcint_deque.assign(int_array, int_array + 3); pcint_deque.assign(cint_array, cint_array + 3); } typedef void (*Func)(int); void f1(int) {} void PtrSpecTest::function_pointer() { vector<Func> fs; fs.push_back(&f1); CPPUNIT_ASSERT(!fs.empty() ); } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/multiset_test.cpp ======================= <gh_stars>100-1000 #include <set> #include <functional> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class MultisetTest : public CPPUNIT_NS::TestCase { typedef multiset<int, less<int> > mset; CPPUNIT_TEST_SUITE(MultisetTest); CPPUNIT_TEST(mset1); CPPUNIT_TEST(mset3); CPPUNIT_TEST(mset5); CPPUNIT_TEST_SUITE_END(); protected: void mset1(); void mset3(); void mset5(); static bool less_than(int a_, int b_) { return a_ < b_; } static bool greater_than(int a_, int b_) { return a_ > b_; } }; CPPUNIT_TEST_SUITE_REGISTRATION(MultisetTest); // // tests implementation // void MultisetTest::mset1() { mset s; CPPUNIT_ASSERT(s.count(42) == 0); s.insert(42); CPPUNIT_ASSERT(s.count(42) == 1); s.insert(42); CPPUNIT_ASSERT(s.count(42) == 2); mset::iterator i = s.find(40); CPPUNIT_ASSERT(i == s.end()); i = s.find(42); CPPUNIT_ASSERT(i!= s.end()); size_t count = s.erase(42); CPPUNIT_ASSERT(count == 2); } void MultisetTest::mset3() { int array [] = { 3, 6, 1, 2, 3, 2, 6, 7, 9 }; //Check iterator on a mutable set mset s(array, array + 9); mset::iterator i; i = s.lower_bound(3); CPPUNIT_ASSERT(*i == 3); i = s.upper_bound(3); CPPUNIT_ASSERT(*i == 6); pair<mset::iterator, mset::iterator> p = s.equal_range(5); CPPUNIT_ASSERT(*(p.first) == 6); CPPUNIT_ASSERT(*(p.second) == 6); //Check const_iterator on a mutable multiset mset::const_iterator ci; ci = s.lower_bound(3); CPPUNIT_ASSERT(*ci == 3); ci = s.upper_bound(3); CPPUNIT_ASSERT(*ci == 6); pair<mset::const_iterator, mset::const_iterator> cp; #ifdef _STLP_MEMBER_TEMPLATES cp = s.equal_range(5); CPPUNIT_ASSERT(*(cp.first) == 6); CPPUNIT_ASSERT(*(cp.second) == 6); #endif //Check const_iterator on a const multiset mset const& crs = s; ci = crs.lower_bound(3); CPPUNIT_ASSERT(*ci == 3); ci = crs.upper_bound(3); CPPUNIT_ASSERT(*ci == 6); cp = crs.equal_range(5); CPPUNIT_ASSERT(*(cp.first) == 6); CPPUNIT_ASSERT(*(cp.second) == 6); } void MultisetTest::mset5() { int array [] = { 3, 6, 1, 9 }; int j; typedef pointer_to_binary_function<int, int, bool> fn_type; typedef multiset<int, fn_type, allocator<int> > fn_mset; fn_type f(less_than); fn_mset s1(array+0, array + 4, f ); fn_mset::const_iterator i = s1.begin(); for (j = 0; i!= s1.end(); ++i, ++j) { CPPUNIT_ASSERT(j!= 0 || *i == 1); CPPUNIT_ASSERT(j!= 1 || *i == 3); CPPUNIT_ASSERT(j!= 2 || *i == 6); CPPUNIT_ASSERT(j!= 3 || *i == 9); } fn_type g(greater_than); fn_mset s2(array, array + 4, g); i = s2.begin(); for (j = 0; i!= s2.end(); ++i, ++j) { CPPUNIT_ASSERT(j!= 0 || *i == 9); CPPUNIT_ASSERT(j!= 1 || *i == 6); CPPUNIT_ASSERT(j!= 2 || *i == 3); CPPUNIT_ASSERT(j!= 3 || *i == 1); } } ======================= File: android-ndk-r10b/tests/abcc/jni/device/main.cpp ======================= /* * Copyright 2013, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <memory> #include <jni.h> #include "Abcc_device.h" using namespace abcc; #if VERBOSE long long abcc::llc_usec; #endif #ifdef __cplusplus extern "C" { #endif JNIEXPORT jint JNICALL Java_compiler_abcc_AbccService_genLibs(JNIEnv *env, jobject thiz, jstring j_lib_dir, jstring j_sysroot) { const char *lib_dir = env->GetStringUTFChars(j_lib_dir, 0); LOGV("Working directory: %s", lib_dir); const char *sysroot = env->GetStringUTFChars(j_sysroot, 0); LOGV("Sysroot: %s", sysroot); std::auto_ptr<BitcodeCompiler> compiler(new DeviceBitcodeCompiler(lib_dir, sysroot)); compiler->prepare(); if (compiler->returnCode()!= RET_OK) { LOGE("prepare failed"); return -1; } compiler->cleanupPre(); if (compiler->returnCode()!= RET_OK) { LOGE("cleanupPre failed"); return -1; } #if VERBOSE Timer t; t.start(); llc_usec = 0; #endif compiler->execute(); #if VERBOSE long long elapsed_msec = (t.stop() + 500) / 1000; long long llc_msec = (llc_usec + 500) / 1000; LOGV("Elapsed time: %lld.%03ds (llc = %lld.%03ds)", elapsed_msec/1000, (int)elapsed_msec%1000, llc_msec/1000, (int)llc_msec%1000); #endif compiler->cleanupPost(); if (compiler->returnCode()!= RET_OK) { LOGE("execution failed"); return -1; } return 0; } #ifdef __cplusplus } // extern "C" #endif ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/strstream_test.cpp ======================= #include <string> #if!defined (STLPORT) ||!defined (_STLP_USE_NO_IOSTREAMS) # include <strstream> # include <limits> # include "cppunit/cppunit_proxy.h" # if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; # endif // // TestCase class // class StrstreamTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(StrstreamTest); CPPUNIT_TEST(input); CPPUNIT_TEST_SUITE_END(); private: void input(); }; CPPUNIT_TEST_SUITE_REGISTRATION(StrstreamTest); // // tests implementation // void StrstreamTest::input() { # if defined (STLPORT) && defined (_STLP_LONG_LONG) { istrstream is("652208307"); _STLP_LONG_LONG rval = 0; is >> rval; CPPUNIT_ASSERT( rval == 652208307 ); } { istrstream is("-652208307"); _STLP_LONG_LONG rval = 0; is >> rval; CPPUNIT_ASSERT( rval == -652208307 ); } } # endif #endif ======================= File: android-ndk-r10b/tests/build/issue66668-libc++-std-feof/jni/issue66668-libc++-std-feof.cpp ======================= <reponame>perezite/Boost4Android #include <cstdio> int main() { std::FILE* fp; int a = std::getchar(); int b = std::putchar(a); std::clearerr(fp); int c = std::feof(fp); int d = std::ferror(fp); return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/resolve_name.cpp ======================= <gh_stars>100-1000 #define _STLP_DO_IMPORT_CSTD_FUNCTIONS #include <cmath> #if!defined (STLPORT) || defined (_STLP_USE_NAMESPACES) namespace NS1 { bool f() { double d( 1.0 ); d = sqrt( d ); d = ::sqrt( d ); d = std::sqrt( d ); return d == 1.0; } } namespace { bool g() { double d( 1.0 ); d = sqrt( d ); d = ::sqrt( d ); d = std::sqrt( d ); return d == 1.0; } } // VC6 consider call to sqrt ambiguous as soon as using namespace std has // been invoked. #if!defined (STLPORT) ||!defined (_STLP_MSVC) || (_STLP_MSVC >= 1300) using namespace std; #endif bool h() { double d( 1.0 ); d = sqrt( d ); d = ::sqrt( d ); d = std::sqrt( d ); return d == 1.0; } struct sq { sq() {} double sqroot( double x ) { using std::sqrt; return sqrt(x); } }; #endif #if 0 // Do nothing, this should be compiled only #include "cppunit/cppunit_proxy.h" class ResolveNameTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(ResolveNameTest); CPPUNIT_TEST(cstyle); CPPUNIT_TEST_SUITE_END(); protected: void cstyle(); }; CPPUNIT_TEST_SUITE_REGISTRATION(ResolveNameTest); void ResolveNameTest::cstyle() { } #endif ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/loop2.cpp ======================= // Test that breaking out of a handler works. // { dg-do run } int main () { while (1) { try { throw 1; } catch (...) { break; } } } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-1.cpp ======================= // { dg-do "run" } #include <cassert> struct A { double a; double b; }; struct B { A a; }; struct C : public A { }; struct D { D(const D&) throw() { } }; struct E { E(const E&) throw(int) { } }; struct E1 { E1(const E1&) throw(int) { throw int(); } }; struct F { F() throw() { } }; struct G { G() throw(int) { throw int(); } }; struct H { H(H&) throw(int) { } }; struct H1 { H1(H1&) throw(int) { throw int(); } }; struct I { I(I&) throw(int) { } I(const I&) throw() { } }; struct I1 { I1(I1&) throw(int) { throw int(); } I1(const I1&) throw() { } }; struct J { J(J&) throw() { } J(const J&) throw() { } J(volatile J&) throw() { } J(const volatile J&) throw() { } }; template<typename T> bool f() { return __has_nothrow_copy(T); } template<typename T> class My { public: bool f() { return!!__has_nothrow_copy(T); } }; template<typename T> class My2 { public: static const bool trait = __has_nothrow_copy(T); }; template<typename T> const bool My2<T>::trait; template<typename T, bool b = __has_nothrow_copy(T)> struct My3_help { static const bool trait = b; }; template<typename T, bool b> const bool My3_help<T, b>::trait; template<typename T> class My3 { public: bool f() { return My3_help<T>::trait; } }; #define PTEST(T) (__has_nothrow_copy(T) && f<T>() \ && My<T>().f() && My2<T>::trait && My3<T>().f()) #define NTEST(T) (!__has_nothrow_copy(T) &&!f<T>() \ &&!My<T>().f() &&!My2<T>::trait &&!My3<T>().f()) int main() { assert (PTEST (int)); assert (NTEST (int (int))); assert (NTEST (void)); assert (PTEST (A)); assert (PTEST (B)); assert (PTEST (C)); assert (NTEST (C[])); assert (PTEST (D)); assert (NTEST (E)); assert (NTEST (E1)); assert (PTEST (F)); assert (PTEST (G)); assert (NTEST (H)); assert (NTEST (H1)); assert (NTEST (I)); assert (NTEST (I1)); assert (PTEST (J)); return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/messages_facets_test.cpp ======================= #include "locale_test.h" #if!defined (STLPORT) ||!defined (_STLP_USE_NO_IOSTREAMS) # include <locale> # include <stdexcept> # if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; # endif // // tests implementation // void LocaleTest::messages_by_name() { /* * Check of the 22.1.1.2.7 standard point. Construction of a locale * instance from a null pointer or an unknown name should result in * a runtime_error exception. */ # if!defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) # if defined (STLPORT) ||!defined (__GNUC__) try { locale loc(locale::classic(), new messages_byname<char>(static_cast<char const*>(0))); CPPUNIT_FAIL; } catch (runtime_error const& /* e */) { //CPPUNIT_MESSAGE( e.what() ); } catch (...) { CPPUNIT_FAIL; } # endif try { locale loc(locale::classic(), new messages_byname<char>("yasli_language")); CPPUNIT_FAIL; } catch (runtime_error const& /* e */) { //CPPUNIT_MESSAGE( e.what() ); } catch (...) { CPPUNIT_FAIL; } /* try { locale loc(locale::classic(), new messages_byname<char>("")); CPPUNIT_FAIL; } catch (runtime_error const& e) { CPPUNIT_MESSAGE( e.what() ); } catch (...) { CPPUNIT_FAIL; } */ # if!defined (STLPORT) ||!defined (_STLP_NO_WCHAR_T) # if defined (STLPORT) ||!defined (__GNUC__) try { locale loc(locale::classic(), new messages_byname<wchar_t>(static_cast<char const*>(0))); CPPUNIT_FAIL; } catch (runtime_error const&) { } catch (...) { CPPUNIT_FAIL; } # endif try { locale loc(locale::classic(), new messages_byname<wchar_t>("yasli_language")); CPPUNIT_FAIL; } catch (runtime_error const&) { } catch (...) { CPPUNIT_FAIL; } # endif # endif } #endif ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/ioiter_test.cpp ======================= <gh_stars>1-10 #include <string> #if!defined (STLPORT) ||!defined (_STLP_USE_NO_IOSTREAMS) #include <sstream> #include <vector> #include <iterator> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif class IoiterTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(IoiterTest); CPPUNIT_TEST(ioiter_test); CPPUNIT_TEST(assign_test); CPPUNIT_TEST(assign2_test); CPPUNIT_TEST_SUITE_END(); protected: void ioiter_test(); void assign_test(); void assign2_test(); }; CPPUNIT_TEST_SUITE_REGISTRATION(IoiterTest); void IoiterTest::ioiter_test() { char c; const char *pc; const char *strorg = "abcd"; string tmp; string objStr(strorg); istringstream objIStrStrm1(objStr); istringstream objIStrStrm2(objStr); istringstream objIStrStrm3(objStr); pc = strorg; string::size_type sz = strlen(strorg); string::size_type i; for ( i = 0; i < sz; ++i ) { c = *pc++; tmp += c; } CPPUNIT_ASSERT( tmp == "abcd" ); istreambuf_iterator<char, char_traits<char> > objIStrmbIt1( objIStrStrm1.rdbuf() ); istreambuf_iterator<char, char_traits<char> > end; tmp.clear(); for ( i = 0; i < sz /* objIStrmbIt1!= end */; ++i ) { c = *objIStrmbIt1++; tmp += c; } CPPUNIT_ASSERT( tmp == "abcd" ); tmp.clear(); istreambuf_iterator<char, char_traits<char> > objIStrmbIt2( objIStrStrm2.rdbuf() ); for ( i = 0; i < sz; ++i ) { c = *objIStrmbIt2; tmp += c; objIStrmbIt2++; } CPPUNIT_ASSERT( tmp == "abcd" ); tmp.clear(); istreambuf_iterator<char, char_traits<char> > objIStrmbIt3( objIStrStrm3.rdbuf() ); while ( objIStrmbIt3!= end ) { c = *objIStrmbIt3++; tmp += c; } CPPUNIT_ASSERT( tmp == "abcd" ); } void IoiterTest::assign_test() { stringstream s( "1234567890" ); vector<char> v; v.assign( istreambuf_iterator<char>(s), istreambuf_iterator<char>() ); CPPUNIT_CHECK( v.size() == 10 ); if ( v.size() == 10 ) { CPPUNIT_CHECK( v[0] == '1' ); CPPUNIT_CHECK( v[9] == '0' ); } } void IoiterTest::assign2_test() { stringstream s( "1234567890" ); vector<char> v; v.assign( istreambuf_iterator<char>(s.rdbuf()), istreambuf_iterator<char>() ); CPPUNIT_CHECK( v.size() == 10 ); if ( v.size() == 10 ) { CPPUNIT_CHECK( v[0] == '1' ); CPPUNIT_CHECK( v[9] == '0' ); } } #endif ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/queue_test.cpp ======================= #include <vector> #include <algorithm> #include <list> #include <deque> #include <queue> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class QueueTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(QueueTest); CPPUNIT_TEST(pqueue1); CPPUNIT_TEST(queue1); CPPUNIT_TEST_SUITE_END(); protected: void pqueue1(); void queue1(); }; CPPUNIT_TEST_SUITE_REGISTRATION(QueueTest); // // tests implementation // void QueueTest::pqueue1() { priority_queue<int, deque<int>, less<int> > q; q.push(42); q.push(101); q.push(69); CPPUNIT_ASSERT( q.top()==101 ); q.pop(); CPPUNIT_ASSERT( q.top()==69 ); q.pop(); CPPUNIT_ASSERT( q.top()==42 ); q.pop(); CPPUNIT_ASSERT(q.empty()); } void QueueTest::queue1() { queue<int, list<int> > q; q.push(42); q.push(101); q.push(69); CPPUNIT_ASSERT( q.front()==42 ); q.pop(); CPPUNIT_ASSERT( q.front()==101 ); q.pop(); CPPUNIT_ASSERT( q.front()==69 ); q.pop(); CPPUNIT_ASSERT(q.empty()); } ======================= File: android-ndk-r10b/tests/build/multiple-static-const/jni/main.cpp ======================= <gh_stars>1-10 #include "main.h" const int Foo::CONST_1 = 42; const double Foo::CONST_2 = 3.14159265; extern void foo(void); int main(void) { foo(); return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/memory_test.cpp ======================= #include <memory> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class MemoryTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(MemoryTest); #if defined (_STLP_MSVC) && (_STLP_MSVC < 1310) CPPUNIT_IGNORE; #endif CPPUNIT_TEST(auto_ptr_test); CPPUNIT_TEST_SUITE_END(); protected: void auto_ptr_test(); }; CPPUNIT_TEST_SUITE_REGISTRATION(MemoryTest); #if!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310) auto_ptr<int> CreateAutoPtr(int val) { return auto_ptr<int>(new int(val)); } bool CheckEquality(auto_ptr<int> pint, int val) { return *pint == val; } #endif // // tests implementation // void MemoryTest::auto_ptr_test() { #if!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310) { auto_ptr<int> pint(new int(1)); CPPUNIT_ASSERT( *pint == 1 ); *pint = 2; CPPUNIT_ASSERT( *pint == 2 ); } { auto_ptr<int> pint(CreateAutoPtr(3)); CPPUNIT_ASSERT( *pint == 3 ); CPPUNIT_ASSERT( CheckEquality(pint, 3) ); } { auto_ptr<const int> pint(new int(2)); CPPUNIT_ASSERT( *pint == 2 ); } { auto_ptr<volatile int> pint(new int(2)); CPPUNIT_ASSERT( *pint == 2 ); } { auto_ptr<const volatile int> pint(new int(2)); CPPUNIT_ASSERT( *pint == 2 ); } #endif } ======================= File: android-ndk-r10b/tests/device/issue62910-gcc4.8.2-libstdc++-nth-element-segfault/jni/issue62910-gcc4.8.2-libstdc++-nth-element-segfault.cpp ======================= #include <algorithm> #include <stdint.h> #include <iostream> double to_double(uint64_t x) { union {double d; uint64_t x;} u; u.x = x; return u.d; } int main() { std::vector<double> v = { to_double(4606672070890243784), to_double(4606672025854247510), to_double(4606671800674266141), to_double(4606671575494284772), to_double(4606672115926240057), to_double(4606672160962236330), to_double(4606672070890243784), }; for (auto i : v) std::cout << i << std::endl; std::nth_element(v.begin(), v.begin() + 3, v.end()); return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/p7912.cpp ======================= <gh_stars>1-10 // { dg-do run { xfail sparc64-*-elf arm-*-pe } } // { dg-options "-fexceptions" } // prms-id: 7912 int count = 0; class Foo { public: Foo() { ++count; }; Foo(const Foo&) { ++count; }; ~Foo() { --count; }; }; int main() { try { throw Foo(); } catch (Foo object) { } return count; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/partition_test.cpp ======================= <reponame>perezite/Boost4Android #include <algorithm> #include <vector> #include <cstdlib> #include <iterator> #include <functional> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class PartitionTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(PartitionTest); CPPUNIT_TEST(ptition0); CPPUNIT_TEST(ptition1); CPPUNIT_TEST(stblptn0); CPPUNIT_TEST(stblptn1); CPPUNIT_TEST_SUITE_END(); protected: void ptition0(); void ptition1(); void stblptn0(); void stblptn1(); struct less_n { less_n(int limit, size_t &nb_calls) : _limit(limit), _nb_calls(nb_calls) {} bool operator() (int a_) const { ++_nb_calls; return a_ < _limit; } int _limit; size_t &_nb_calls; private: //explicitely defined as private to avoid warnings: less_n& operator = (less_n const&); }; }; CPPUNIT_TEST_SUITE_REGISTRATION(PartitionTest); // // tests implementation // void PartitionTest::stblptn0() { int numbers[6] = { 10, 5, 11, 20, 6, -2 }; size_t nb_pred_calls = 0; stable_partition((int*)numbers, (int*)numbers + 6, less_n(10, nb_pred_calls)); // 5 6 -2 10 11 20 CPPUNIT_ASSERT(numbers[0]==5); CPPUNIT_ASSERT(numbers[1]==6); CPPUNIT_ASSERT(numbers[2]==-2); CPPUNIT_ASSERT(numbers[3]==10); CPPUNIT_ASSERT(numbers[4]==11); CPPUNIT_ASSERT(numbers[5]==20); //Complexity check: CPPUNIT_ASSERT( nb_pred_calls == sizeof(numbers) / sizeof(numbers[0]) ); } void PartitionTest::stblptn1() { //5 5 2 10 0 12 5 0 0 19 //5 5 2 10 0 5 0 0 12 19 int numbers[] = { 5, 5, 2, 10, 0, 12, 5, 0, 0, 19 }; vector <int> v1(numbers, numbers+10); size_t nb_pred_calls = 0; stable_partition(v1.begin(), v1.end(), less_n(11, nb_pred_calls)); CPPUNIT_ASSERT(v1[0]==5); CPPUNIT_ASSERT(v1[1]==5); CPPUNIT_ASSERT(v1[2]==2); CPPUNIT_ASSERT(v1[3]==10); CPPUNIT_ASSERT(v1[4]==0); CPPUNIT_ASSERT(v1[5]==5); CPPUNIT_ASSERT(v1[6]==0); CPPUNIT_ASSERT(v1[7]==0); CPPUNIT_ASSERT(v1[8]==12); CPPUNIT_ASSERT(v1[9]==19); CPPUNIT_ASSERT( nb_pred_calls == v1.size() ); } void PartitionTest::ptition0() { int numbers[6] = { 6, 12, 3, 10, 1, 20 }; size_t nb_pred_calls = 0; // 6 1 3 10 12 20 partition((int*)numbers, (int*)numbers + 6, less_n(10, nb_pred_calls)); CPPUNIT_ASSERT(numbers[0]==6); CPPUNIT_ASSERT(numbers[1]==1); CPPUNIT_ASSERT(numbers[2]==3); CPPUNIT_ASSERT(numbers[3]==10); CPPUNIT_ASSERT(numbers[4]==12); CPPUNIT_ASSERT(numbers[5]==20); CPPUNIT_ASSERT( nb_pred_calls == sizeof(numbers) / sizeof(numbers[0]) ); } void PartitionTest::ptition1() { // 19 3 11 14 10 19 8 17 9 6 // 6 3 9 8 10 19 14 17 11 19 int numbers[10] ={ 19, 3, 11, 14, 10, 19, 8, 17, 9, 6 }; vector <int> v1(numbers, numbers+10); size_t nb_pred_calls = 0; partition(v1.begin(), v1.end(), less_n(11, nb_pred_calls)); CPPUNIT_ASSERT(v1[0]==6); CPPUNIT_ASSERT(v1[1]==3); CPPUNIT_ASSERT(v1[2]==9); CPPUNIT_ASSERT(v1[3]==8); CPPUNIT_ASSERT(v1[4]==10); CPPUNIT_ASSERT(v1[5]==19); CPPUNIT_ASSERT(v1[6]==14); CPPUNIT_ASSERT(v1[7]==17); CPPUNIT_ASSERT(v1[8]==11); CPPUNIT_ASSERT(v1[9]==19); CPPUNIT_ASSERT( nb_pred_calls == v1.size() ); } ======================= File: android-ndk-r10b/tests/rs/latency/jni/test-latency.cpp ======================= #include "RenderScript.h" #include <sys/time.h> #include "ScriptC_latency.h" using namespace android; using namespace RSC; int main(int argc, char** argv) { int iters = 100; int numElems = 1000; bool forceCpu = false; bool synchronous = false; if (argc >= 2) { iters = atoi(argv[1]); if (iters <= 0) { printf("iters must be positive\n"); return 1; } } printf("iters = %d\n", iters); if (argc >= 3) { numElems = atoi(argv[2]); if (numElems <= 0) { printf("numElems must be positive\n"); return 1; } } if (argc >= 4) { int temp = atoi(argv[3]); if (temp!= 0) forceCpu = true; } if (argc >= 5) { int temp = atoi(argv[4]); if (temp!= 0) synchronous = true; } if (forceCpu) printf("forcing CPU\n"); if (synchronous) printf("forcing synchronous\n"); printf("numElems = %d\n", numElems); sp<RS> rs = new RS(); uint32_t flags = 0; if (forceCpu) flags |= RS_INIT_LOW_LATENCY; if (synchronous) flags |= RS_INIT_SYNCHRONOUS; bool r = rs->init("/system/bin", flags); sp<const Element> e = Element::U32(rs); Type::Builder tb(rs, e); tb.setX(numElems); sp<const Type> t = tb.create(); uint32_t *buf = new uint32_t[numElems]; sp<Allocation> ain = Allocation::createTyped(rs, t); sp<Allocation> aout = Allocation::createTyped(rs, t); sp<ScriptC_latency> sc = new ScriptC_latency(rs); struct timeval start, stop; gettimeofday(&start, NULL); for (int i = 0; i < iters; i++) { sc->forEach_root(ain, aout); } rs->finish(); gettimeofday(&stop, NULL); long long elapsed = (stop.tv_sec * 1000000) - (start.tv_sec * 1000000) + (stop.tv_usec - start.tv_usec); printf("elapsed time : %lld microseconds\n", elapsed); printf("time per iter: %f microseconds\n", (double)elapsed / iters); gettimeofday(&start, NULL); for (int i = 0; i < iters; i++) { ain->copy1DFrom(buf); sc->forEach_root(ain, aout); aout->copy1DTo(buf); } rs->finish(); gettimeofday(&stop, NULL); elapsed = (stop.tv_sec * 1000000) - (start.tv_sec * 1000000) + (stop.tv_usec - start.tv_usec); printf("elapsed time with copy : %lld microseconds\n", elapsed); printf("time per iter with copy: %f microseconds\n", (double)elapsed / iters); sc.clear(); t.clear(); e.clear(); ain.clear(); aout.clear(); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/pr36449.cpp ======================= <filename>android-ndk-r10b/tests/device/test-stlport_static-exception/jni/pr36449.cpp // PR middle-end/36449 // { dg-do run } // { dg-options "-O3" } extern "C" void exit (int); extern "C" void abort (); struct R { short a; short b; }; struct S { R e; long f; long g; }; struct T { short c; short d; }; struct U { long h[0x1ffffff + 1]; T i; }; U *j; void __attribute__((noinline)) bar () { exit (0); } void __attribute__((noinline)) foo () { S s; s.e.a = 36; s.e.b = 38; if (s.e.a == j->i.c && s.e.b == j->i.d) bar (); } int main () { try { j = new U; } catch (...) { return 0; } j->i.c = 36; j->i.d = 38; j->h[0] = 1; j->h[1] = 2; j->h[2] = 3; foo (); abort (); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/new6.cpp ======================= // { dg-do run } // Test that we properly default-initialize the new int when () is given. #include <new> using namespace std; extern "C" void *malloc (size_t); int special; int space = 0xdeadbeef; void *operator new (size_t size) throw (bad_alloc) { if (special) return &space; return malloc (size); } int main () { special = 1; int *p = new int(); special = 0; return *p!= 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/bcompos_test.cpp ======================= <gh_stars>100-1000 #include <algorithm> #include "unary.h" #include "cppunit/cppunit_proxy.h" #if defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class BcomposTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(BcomposTest); #if!defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) CPPUNIT_IGNORE; #endif CPPUNIT_TEST(bcompos1); CPPUNIT_TEST(bcompos2); CPPUNIT_TEST_SUITE_END(); protected: void bcompos1(); void bcompos2(); }; CPPUNIT_TEST_SUITE_REGISTRATION(BcomposTest); // // tests implementation // void BcomposTest::bcompos1() { #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) int array [6] = { -2, -1, 0, 1, 2, 3 }; binary_compose<logical_and<bool>, odd, positive> b = binary_compose<logical_and<bool>, odd, positive>(logical_and<bool>(), odd(), positive()); int* p = find_if((int*)array, (int*)array + 6, b); CPPUNIT_ASSERT(p!= array + 6); #endif } void BcomposTest::bcompos2() { #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) int array [6] = { -2, -1, 0, 1, 2, 3 }; int* p = find_if((int*)array, (int*)array + 6, compose2(logical_and<bool>(), odd(), positive())); CPPUNIT_ASSERT(p!= array + 6); #endif } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh38.cpp ======================= // { dg-do run { xfail sparc64-*-elf arm-*-pe } } // { dg-options "-fexceptions" } #include <typeinfo> class B { public: int data; B(int i) : data(i) { } } b(42); int main() { try { throw &b; } catch (const B* bptr) { if (bptr->data == 42) { try { throw &b; } catch (void *bptr) { if (((B*)bptr)->data == 42) return 0; } } } return 1; } ======================= File: android-ndk-r10b/samples/test-libstdc++/jni/test-libstl.cpp ======================= #include <cerrno> #include <cstddef> int main(void) { return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh48.cpp ======================= <reponame>perezite/Boost4Android<gh_stars>1-10 // { dg-do run { xfail sparc64-*-elf arm-*-pe } } // { dg-options "-fexceptions" } #include <exception> #include <stdlib.h> using std::uncaught_exception; class A { public: ~A() { if (uncaught_exception ()) exit (0); } }; int main() { if (uncaught_exception ()) return 1; try { throw ""; } catch (...) { if (uncaught_exception ()) return 1; } if (uncaught_exception ()) return 1; try { A a; throw ""; } catch (...) { return 1; } return 1; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/copy_test.cpp ======================= #include <algorithm> #include <cstring> #include <vector> #include <iterator> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class CopyTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(CopyTest); CPPUNIT_TEST(copy_array); CPPUNIT_TEST(copy_volatile); CPPUNIT_TEST(copy_vector); CPPUNIT_TEST(copy_insert); CPPUNIT_TEST(copy_back); CPPUNIT_TEST(copy_back_array); CPPUNIT_TEST_SUITE_END(); protected: void copy_array(); void copy_volatile(); void copy_vector(); void copy_insert(); void copy_back(); void copy_back_array(); }; CPPUNIT_TEST_SUITE_REGISTRATION(CopyTest); // // tests implementation // void CopyTest::copy_array() { char string[23] = "A string to be copied."; char result[23]; copy(string, string + 23, result); CPPUNIT_ASSERT(!strncmp(string, result, 23)); } void CopyTest::copy_volatile() { { int a[] = {0, 1, 2, 3, 4, 5}; const size_t size = sizeof(a) / sizeof(a[0]); volatile int va[size]; copy(a, a + size, va); for (size_t i = 0; i!= size; ++i) { CPPUNIT_ASSERT( a[i] == va[i] ); } } { const int a[] = {0, 1, 2, 3, 4, 5}; const size_t size = sizeof(a) / sizeof(a[0]); volatile int va[size]; copy(a, a + size, va); for (size_t i = 0; i!= size; ++i) { CPPUNIT_ASSERT( a[i] == va[i] ); } } // Following code can be activated to check that it doesn't compiled #if 0 { int a[] = {0, 1, 2, 3, 4, 5}; const size_t size = sizeof(a) / sizeof(a[0]); const volatile int va[size] = {5, 4, 3, 2, 1, 0}; copy(a, a + size, va); for (size_t i = 0; i!= size; ++i) { CPPUNIT_ASSERT( a[i] == va[i] ); } } #endif } void CopyTest::copy_vector() { vector<int> v1(10); for (int i = 0; (size_t)i < v1.size(); ++i) v1[i] = i; vector<int> v2(v1.size()); copy(v1.begin(), v1.end(), v2.begin()); CPPUNIT_ASSERT( v2 == v1 ); } void CopyTest::copy_insert() { vector<int> v1(10); for (int loc = 0; (size_t)loc < v1.size(); ++loc) v1[loc] = loc; vector<int> v2; insert_iterator<vector<int> > i(v2, v2.begin()); copy(v1.begin(), v1.end(), i); CPPUNIT_ASSERT( v2 == v1 ); } void CopyTest::copy_back() { vector<int> v1(10); for (int i = 0; (size_t)i < v1.size(); ++i) v1[i] = i; vector<int> v2(v1.size()); copy_backward(v1.begin(), v1.end(), v2.end()); CPPUNIT_ASSERT( v2 == v1 ); } void CopyTest::copy_back_array() { int numbers[5] = { 1, 2, 3, 4, 5 }; int result[5]; copy_backward(numbers, numbers + 5, (int*)result + 5); CPPUNIT_ASSERT(result[0]==numbers[0]); CPPUNIT_ASSERT(result[1]==numbers[1]); CPPUNIT_ASSERT(result[2]==numbers[2]); CPPUNIT_ASSERT(result[3]==numbers[3]); CPPUNIT_ASSERT(result[4]==numbers[4]); } ======================= File: android-ndk-r10b/tests/device/static-executable/jni/main.cxx ======================= #include <stdio.h> int main() { printf ("Hello 1\n"); try { throw 20; } catch(...) { printf ("catch\n"); } printf ("Hello 2\n"); return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/fill_test.cpp ======================= #include <vector> #include <algorithm> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class FillTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(FillTest); CPPUNIT_TEST(fill1); CPPUNIT_TEST(filln1); CPPUNIT_TEST_SUITE_END(); protected: void fill1(); void filln1(); }; CPPUNIT_TEST_SUITE_REGISTRATION(FillTest); // // tests implementation // void FillTest::fill1() { vector <int> v(10); fill(v.begin(), v.end(), 42); CPPUNIT_ASSERT(v[0]==42); CPPUNIT_ASSERT(v[1]==42); CPPUNIT_ASSERT(v[2]==42); CPPUNIT_ASSERT(v[3]==42); CPPUNIT_ASSERT(v[4]==42); CPPUNIT_ASSERT(v[5]==42); CPPUNIT_ASSERT(v[6]==42); CPPUNIT_ASSERT(v[7]==42); CPPUNIT_ASSERT(v[8]==42); CPPUNIT_ASSERT(v[9]==42); } void FillTest::filln1() { vector <int> v(10); fill_n(v.begin(), v.size(), 42); CPPUNIT_ASSERT(v[0]==42); CPPUNIT_ASSERT(v[1]==42); CPPUNIT_ASSERT(v[2]==42); CPPUNIT_ASSERT(v[3]==42); CPPUNIT_ASSERT(v[4]==42); CPPUNIT_ASSERT(v[5]==42); CPPUNIT_ASSERT(v[6]==42); CPPUNIT_ASSERT(v[7]==42); CPPUNIT_ASSERT(v[8]==42); CPPUNIT_ASSERT(v[9]==42); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/unroll1.cpp ======================= <filename>android-ndk-r10b/tests/device/test-stlport_static-exception/jni/unroll1.cpp<gh_stars>1-10 // PR optimization/12340 // Origin: <NAME> <<EMAIL>> // Testcase by <NAME> <<EMAIL>> // This used to segfault on x86 because the loop optimizer wrongly // interpreted a double assignment to a biv as a double increment, // which subsequently fooled the unroller. // { dg-do run } // { dg-options "-O2 -fno-exceptions -funroll-loops" } typedef __SIZE_TYPE__ size_t; inline void* operator new(size_t, void* __p) throw() { return __p; } inline void operator delete (void*, void*) throw() { }; class Loc; class Interval; template<class DT> class DomainBase { public: typedef typename DT::Domain_t Domain_t; typedef typename DT::Storage_t Storage_t; Domain_t &unwrap() { return *static_cast<Domain_t *>(this); } const Domain_t &unwrap() const { return *static_cast<Domain_t *>(const_cast<DomainBase<DT> *>(this)); } protected: Storage_t domain_m; }; template<class DT> class Domain : public DomainBase<DT> { typedef DomainBase<DT> Base_t; public: typedef typename DT::Size_t Size_t; typedef typename DT::Element_t Element_t; typedef typename Base_t::Domain_t Domain_t; typedef typename Base_t::Storage_t Storage_t; Domain_t &operator[](int) { return this->unwrap(); } const Domain_t &operator[](int) const { return this->unwrap(); } template<class T> void setDomain(const T &newdom) { DT::setDomain(this->domain_m, newdom); } Element_t first() const { return DT::first(this->domain_m); } Size_t length() const { return DT::length(this->domain_m); } Size_t size() const { return length(); } }; template<class T> struct DomainTraits; template<> struct DomainTraits<Interval> { typedef int Size_t; typedef int Element_t; typedef Interval Domain_t; typedef Interval OneDomain_t; typedef Loc AskDomain_t; typedef int Storage_t[2]; enum { dimensions = 1 }; enum { wildcard = false }; static int first(const Storage_t &d) { return d[0]; } static int length(const Storage_t &d) { return d[1]; } static OneDomain_t &getDomain(Domain_t &d, int) { return d; } static const OneDomain_t &getDomain(const Domain_t &d, int) { return d; } template<class T> static void setDomain(Storage_t &dom, const T &newdom) { dom[0] = newdom.first(); dom[1] = newdom.length(); } template<class T1, class T2> static void setDomain(Storage_t &dom, const T1 &begval, const T2 &endval) { dom[0] = begval; dom[1] = (endval - begval + 1); } }; class Interval : public Domain<DomainTraits<Interval> > { public: Interval(const Interval &a) : Domain<DomainTraits<Interval> >() { for (int i=0; i < DomainTraits<Interval>::dimensions; ++i) DomainTraits<Interval>::getDomain(*this, i).setDomain( DomainTraits<Interval>::getDomain(a, i)); } Interval(int a) : Domain<DomainTraits<Interval> >() { DomainTraits<Interval>::setDomain(domain_m, 0, a - 1); } }; template<> struct DomainTraits<Loc> { typedef int Size_t; typedef int Element_t; typedef Loc Domain_t; typedef Loc AskDomain_t; typedef Loc MultResult_t; typedef int Storage_t; static int first(int d) { return d; } template<class T> static void setDomain(int &dom, const T &newdom) { dom = DomainTraits<T>::getFirst(newdom); } }; template<> struct DomainTraits<int> { enum { dimensions = 1 }; enum { wildcard = false }; static int getPointDomain(int d, int) { return d; } static int getFirst(const int &d) { return d; } }; class Loc : public Domain<DomainTraits<Loc> > { public: explicit Loc(const int &a) : Domain<DomainTraits<Loc> >() { for (int i=0; i < 1; ++i) (*this)[i].setDomain(DomainTraits<int>::getPointDomain(a, 0)); } }; struct ElementProperties { enum { hasTrivialDefaultConstructor = false }; enum { hasTrivialDestructor = false }; static void construct(double* addr) { new (addr) double(); } static void construct(double* addr, const double& model) { new (addr) double(model); } static void destruct(double *addr) {} }; class RefCounted { public: RefCounted() : count_m(0) {} void addReference() { ++count_m; } bool removeRefAndCheckGarbage() { return (--count_m == 0); } private: int count_m; }; class RefBlockController : public RefCounted { public: explicit RefBlockController(unsigned int size) : pBegin_m(0), pEnd_m(0), pEndOfStorage_m(0), dealloc_m(false) { reallocateStorage(size, false); if (!ElementProperties::hasTrivialDefaultConstructor) { for (double * pt = begin(); pt!= end(); ++pt) ElementProperties::construct(pt); } } ~RefBlockController() { deleteStorage(); } double *begin() const { return pBegin_m; } double *end() const { return pEnd_m; } bool isMine() const { return dealloc_m; } private: void deleteStorage() { if (isMine() && pBegin_m!= 0) { if (!ElementProperties::hasTrivialDestructor) for (double *pt = begin(); pt!= end(); ++pt) ElementProperties::destruct(pt); char *tmp = reinterpret_cast<char *>(pBegin_m); delete [] tmp; } } void reallocateStorage(unsigned int newsize, bool copyold = false) { double *pBeginNew = 0; double *pEndNew = 0; double *pEndOfStorageNew = 0; if (newsize > 0) { int nsize = newsize * sizeof(double); char *tmp = new char[nsize]; pBeginNew = reinterpret_cast<double *>(tmp); pEndNew = pBeginNew + newsize; pEndOfStorageNew = pBeginNew + (nsize / sizeof(double)); if (copyold) { double * pOld = begin(); double * pNew = pBeginNew; while (pOld!= end() && pNew!= pEndNew) ElementProperties::construct(pNew++,*pOld++); } } deleteStorage(); pBegin_m = pBeginNew; pEnd_m = pEndNew; pEndOfStorage_m = pEndOfStorageNew; dealloc_m = true; } double *pBegin_m; double *pEnd_m; double *pEndOfStorage_m; bool dealloc_m; }; class DataBlockController : public RefBlockController { public: explicit DataBlockController(unsigned int size) : RefBlockController(size), dataObjectPtr_m(new char), owned_m(true) {} ~DataBlockController() { if (owned_m) delete dataObjectPtr_m; } private: mutable char *dataObjectPtr_m; bool owned_m; }; class RefCountedPtr { public: RefCountedPtr(DataBlockController * const pT) : ptr_m(pT) { if (isValid()) ptr_m->addReference(); } ~RefCountedPtr() { invalidate(); } DataBlockController* operator->() const { return ptr_m; } void invalidate(); bool isValid() const { return ptr_m!= 0; } private: friend class RefCountedBlockPtr; DataBlockController * ptr_m; }; inline void RefCountedPtr::invalidate() { if ( isValid() && ptr_m->removeRefAndCheckGarbage() ) delete ptr_m; ptr_m = 0; } class RefCountedBlockPtr { public: explicit RefCountedBlockPtr(unsigned int size) : offset_m(0), blockControllerPtr_m(new DataBlockController(size)) {} int offset() const { return offset_m; } double *beginPointer() const { return blockControllerPtr_m->begin(); } double *currentPointer() const { return beginPointer() + offset(); } protected: int offset_m; RefCountedPtr blockControllerPtr_m; }; class DataBlockPtr : public RefCountedBlockPtr { public: explicit DataBlockPtr(unsigned int size) : RefCountedBlockPtr(size) {} }; class Node { public: Node(const Interval &owned, const Interval &allocated) : domain_m(owned), allocated_m(allocated) {} const Interval &allocated() const { return allocated_m; } private: Interval domain_m; Interval allocated_m; }; class DomainLayout { public: explicit DomainLayout(const Interval &dom) : node_m(0, dom) {} const Interval &domain() const { return node_m.allocated(); } private: Node node_m; }; class BrickBase { public: explicit BrickBase(const Interval &domain); int offset(const Loc &dom) const { return off_m + dom[0].first(); } protected: DomainLayout layout_m; int firsts_m; int off_m; }; BrickBase::BrickBase(const Interval &dom) : layout_m(dom) { firsts_m = layout_m.domain()[0].first(); off_m = -firsts_m; } class Engine : public BrickBase { public: explicit Engine(const Interval &dom) : BrickBase(dom), dataBlock_m(dom.size()), data_m(dataBlock_m.currentPointer()) {} double& operator()(const Loc &loc) const { return data_m[this->offset(loc)]; } private: DataBlockPtr dataBlock_m; double *data_m; }; int main() { Interval I(10); Engine A(I); for (int i = 0; i < 10; i++) A(Loc(i)) = 2.0 + i - i*i; return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/rope_test.cpp ======================= //Small header to get STLport numerous defines: #include <utility> #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) # include <rope> # if!defined (_STLP_USE_NO_IOSTREAMS) # include <sstream> # endif #endif #include "cppunit/cppunit_proxy.h" // #include <stdlib.h> // for rand etc #if defined (_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class RopeTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(RopeTest); #if!defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) || defined (_STLP_USE_NO_IOSTREAMS) CPPUNIT_IGNORE; #endif CPPUNIT_TEST(io); #if defined (_STLP_USE_NO_IOSTREAMS) CPPUNIT_STOP_IGNORE; #endif CPPUNIT_TEST(find1); CPPUNIT_TEST(find2); CPPUNIT_TEST(construct_from_char); CPPUNIT_TEST(bug_report); #if!defined (_STLP_MEMBER_TEMPLATES) CPPUNIT_IGNORE; #endif CPPUNIT_TEST(test_saved_rope_iterators); CPPUNIT_TEST_SUITE_END(); protected: void io(); void find1(); void find2(); void construct_from_char(); void bug_report(); void test_saved_rope_iterators(); }; CPPUNIT_TEST_SUITE_REGISTRATION(RopeTest); // // tests implementation // void RopeTest::io() { #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) &&!defined (_STLP_USE_NO_IOSTREAMS) char const* cstr = "rope test string"; crope rstr(cstr); { ostringstream ostr; ostr << rstr; CPPUNIT_ASSERT( ostr ); CPPUNIT_ASSERT( ostr.str() == cstr ); } #endif } void RopeTest::find1() { #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) crope r("Fuzzy Wuzzy was a bear"); crope::size_type n = r.find( "hair" ); CPPUNIT_ASSERT( n == crope::npos ); n = r.find("ear"); CPPUNIT_ASSERT( n == (r.size() - 3) ); #endif } void RopeTest::find2() { #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) crope r("Fuzzy Wuzzy was a bear"); crope::size_type n = r.find( 'e' ); CPPUNIT_ASSERT( n == (r.size() - 3) ); #endif } void RopeTest::construct_from_char() { #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) crope r('1'); char const* s = r.c_str(); CPPUNIT_ASSERT( '1' == s[0] && '\0' == s[1] ); #endif } // Test used for a bug report from <NAME> void RopeTest::bug_report() { #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) //first create a rope bigger than crope::_S_copy_max = 23 // so that any string addition is added to a new leaf crope evilRope("12345678901234567890123_"); //crope* pSevenCharRope( new TRope("1234567") ); crope sevenCharRope0("12345678"); crope sevenCharRope1("1234567"); // add _Rope_RopeRep<c,a>::_S_alloc_granularity-1 = 7 characters evilRope += "1234567"; // creates a new leaf crope sevenCharRope2("1234567"); // add one more character to the leaf evilRope += '8'; // here is the write beyond the allocated memory CPPUNIT_ASSERT( strcmp(sevenCharRope2.c_str(), "1234567") == 0 ); #endif } #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) const char str[] = "ilcpsklryvmcpjnbpbwllsrehfmxrkecwitrsglrexvtjmxypu\ nbqfgxmuvgfajclfvenhyuhuorjosamibdnjdbeyhkbsomblto\ uujdrbwcrrcgbflqpottpegrwvgajcrgwdlpgitydvhedtusip\ pyvxsuvbvfenodqasajoyomgsqcpjlhbmdahyviuemkssdslde\ besnnngpesdntrrvysuipywatpfoelthrowhfexlwdysvspwlk\ fblfdf"; crope create_rope( int len ) { int l = len/2; crope result; if(l <= 2) { static int j = 0; for(int i = 0; i < len; ++i) { // char c = 'a' + rand() % ('z' - 'a'); result.append(1, /* c */ str[j++] ); j %= sizeof(str); } } else { result = create_rope(len/2); result.append(create_rope(len/2)); } return result; } #endif void RopeTest::test_saved_rope_iterators() { #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) && \ defined (_STLP_MEMBER_TEMPLATES) // // Try and create a rope with a complex tree structure: // // srand(0); crope r = create_rope(300); string expected(r.begin(), r.end()); CPPUNIT_ASSERT(expected.size() == r.size()); CPPUNIT_ASSERT(equal(expected.begin(), expected.end(), r.begin())); crope::const_iterator i(r.begin()), j(r.end()); int pos = 0; while(i!= j) { crope::const_iterator k; // This initial read triggers the bug: CPPUNIT_ASSERT(*i); k = i; int newpos = pos; // Now make sure that i is incremented into the next leaf: while(i!= j) { CPPUNIT_ASSERT(*i == expected[newpos]); ++i; ++newpos; } // Back up from stored value and continue: i = k; ++i; ++pos; } #endif } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/strstream_buffer_read_test.cpp ======================= <filename>android-ndk-r10b/tests/device/test-stlport/unit/strstream_buffer_read_test.cpp /* * Note: Strstreams are really broken in STLport. But strstreams are * obsolete, and even if ones was mentioned in D7.1--D7.4 of * Standard, we have no wish to spent time with repair ones. */ #if!defined (_STLP_NO_IOSTREAMS) # include <strstream> # include "cppunit/cppunit_proxy.h" # if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; # endif class StrstreamBufferTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(StrstreamBufferTest); CPPUNIT_TEST(read_from_buffer); CPPUNIT_TEST_SUITE_END(); protected: void read_from_buffer(); }; CPPUNIT_TEST_SUITE_REGISTRATION(StrstreamBufferTest); void StrstreamBufferTest::read_from_buffer() { char hello[] = "Hello"; strstream stream(hello, sizeof(hello), ios_base::in); char cur; stream >> cur; CPPUNIT_ASSERT(cur == 'H'); } #endif ======================= File: android-ndk-r10b/sources/android/support/tests/math_unittest.cc ======================= #include <math.h> #include <minitest/minitest.h> TEST(math, sizeof_long_double) { #ifdef __ANDROID__ # ifdef __LP64__ EXPECT_EQ(16U, sizeof(long double)); # else EXPECT_EQ(8U, sizeof(long double)); # endif #endif } TEST(math, nexttoward) { double x = 2.0; EXPECT_EQ(x, nexttoward(x, (long double)x)); EXPECT_GT(x, nexttoward(x, (long double)(x * 2.))); EXPECT_LT(x, nexttoward(x, (long double)(x - 1.0))); } TEST(math, nexttowardf) { float x = 2.0; EXPECT_EQ(x, nexttowardf(x, (long double)x)); EXPECT_GT(x, nexttowardf(x, (long double)(x * 2.))); EXPECT_LT(x, nexttowardf(x, (long double)(x - 1.0))); } TEST(math, nexttowardl) { long double x = 2.0; EXPECT_EQ(x, nexttowardl(x, x)); EXPECT_GT(x, nexttowardl(x, x * 2.)); EXPECT_LT(x, nexttowardl(x, x - 1.0)); } // These functions are not exported on x86 before API level 18! TEST(math, scalbln) { EXPECT_EQ(16., scalbln(2.0, (long int)3)); } TEST(math, scalblnf) { EXPECT_EQ((float)16., scalblnf((float)2.0, (long int)3)); } TEST(math, scalblnl) { EXPECT_EQ((long double)16., scalblnl((long double)2.0, (long int)3)); } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/divides_test.cpp ======================= #include <numeric> #include <functional> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class DivideTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(DivideTest); CPPUNIT_TEST(div); CPPUNIT_TEST_SUITE_END(); protected: void div(); }; CPPUNIT_TEST_SUITE_REGISTRATION(DivideTest); // // tests implementation // void DivideTest::div() { int input [3] = { 2, 3, 4 }; int result = accumulate(input, input + 3, 48, divides<int>()); CPPUNIT_ASSERT(result==2); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh990323-1.cpp ======================= <filename>android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh990323-1.cpp // { dg-do run } // check cleanup of template temporaries extern "C" void abort (); extern "C" void exit (int); int ctor = 0; int dtor = 0; template <class T> struct A { A() {ctor++;} A(int) {ctor++;} A(const A&) {ctor++;} ~A() {dtor++;} operator int() {return 0;} }; template <class T> void ff(T); template <class T> void ff(T) { } void g(int) { } void f() { int x; A<int> a1; A<double> a2(37); A<long> a3 = A<long>(47); A<short> a4 = 97; g(A<char*>()); A<char**>(); x? A<char*>() : A<char*>(); x = 47, A<double*>(), A<int>(39), A<void>(23), -17; while (A<short>()) ; for (;A<unsigned>(3);) ; if (A<A<double> >()) ; ff(A<double>()); throw 59; } int main() { int flag = 0; try { A<unsigned long>(); f(); } catch (int) { A<float>(34); flag = 1; } if (!flag) abort(); if (!ctor || ctor!= dtor) abort(); exit(0); } ======================= File: android-ndk-r10b/sources/android/crazy_linker/src/crazy_linker_ashmem.cpp ======================= <reponame>perezite/Boost4Android<filename>android-ndk-r10b/sources/android/crazy_linker/src/crazy_linker_ashmem.cpp // Copyright (c) 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 "crazy_linker_ashmem.h" #include <fcntl.h> #include <string.h> #include <sys/ioctl.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <linux/ashmem.h> #include "crazy_linker_system.h" #include "crazy_linker_memory_mapping.h" namespace crazy { bool AshmemRegion::Allocate(size_t region_size, const char* region_name) { int fd = TEMP_FAILURE_RETRY(open("/dev/ashmem", O_RDWR)); if (fd < 0) return false; if (ioctl(fd, ASHMEM_SET_SIZE, region_size) < 0) goto ERROR; if (region_name) { char buf[256]; strlcpy(buf, region_name, sizeof(buf)); if (ioctl(fd, ASHMEM_SET_NAME, buf) < 0) goto ERROR; } Reset(fd); return true; ERROR: ::close(fd); return false; } bool AshmemRegion::SetProtectionFlags(int prot) { return ioctl(fd_, ASHMEM_SET_PROT_MASK, prot) == 0; } // static bool AshmemRegion::CheckFileDescriptorIsReadOnly(int fd) { const size_t map_size = PAGE_SIZE; ScopedMemoryMapping map; // First, check that trying to map a page of the region with PROT_WRITE // fails with EPERM. if (map.Allocate(NULL, map_size, MemoryMapping::CAN_WRITE, fd)) { LOG("%s: Region could be mapped writable. Should not happen.\n", __FUNCTION__); errno = EPERM; return false; } if (errno!= EPERM) { LOG_ERRNO("%s: Region failed writable mapping with unexpected error", __FUNCTION__); return false; } // Second, check that it can be mapped PROT_READ, but cannot be remapped // with PROT_READ | PROT_WRITE through mprotect(). if (!map.Allocate(NULL, map_size, MemoryMapping::CAN_READ, fd)) { LOG_ERRNO("%s: Failed to map region read-only", __FUNCTION__); return false; } if (map.SetProtection(MemoryMapping::CAN_READ_WRITE)) { LOG_ERRNO("%s: Region could be remapped read-write. Should not happen.\n", __FUNCTION__); return false; } if (errno!= EACCES) { LOG_ERRNO( "%s: Region failed to be remapped read-write with unexpected error", __FUNCTION__); return false; } // Everything's good. return true; } } // namespace crazy ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/vbase1_1.cpp ======================= <reponame>perezite/Boost4Android // { dg-do run } // Origin: <NAME> <<EMAIL>> int i; int j; struct B { B() { i = 1; } ~B() { j = 7; } }; struct D : virtual public B { D () { throw 3; } }; int main () { try { D d; } catch (int) { if (i!= 1 || j!= 7) return 1; } } ======================= File: android-ndk-r10b/sources/android/support/tests/ctype_unittest.cc ======================= <filename>android-ndk-r10b/sources/android/support/tests/ctype_unittest.cc #include <ctype.h> #include <minitest/minitest.h> TEST(ctype, isblank) { EXPECT_TRUE(isblank(' ')); EXPECT_TRUE(isblank('\t')); EXPECT_FALSE(isblank('\n')); EXPECT_FALSE(isblank('\f')); EXPECT_FALSE(isblank('\r')); } TEST(ctype, isprint) { EXPECT_TRUE(isprint('a')); EXPECT_TRUE(isprint(' ')); EXPECT_FALSE(isprint('\t')); EXPECT_FALSE(isprint('\n')); EXPECT_FALSE(isprint('\f')); EXPECT_FALSE(isprint('\r')); } ======================= File: android-ndk-r10b/tests/build/issue54623-dcraw_common-x86-segfault/jni/issue54623-dcraw_common-x86-segfault.cpp ======================= <filename>android-ndk-r10b/tests/build/issue54623-dcraw_common-x86-segfault/jni/issue54623-dcraw_common-x86-segfault.cpp int c; void foo(int f) { int wbi=-100000000; c = (f? "012346000000000000":"01345:000000006008")[wbi]-'0'+ 2; } int main() { return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/neq_test.cpp ======================= #include <vector> #include <algorithm> #include <functional> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class NeqTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(NeqTest); CPPUNIT_TEST(negate0); CPPUNIT_TEST(nequal0); CPPUNIT_TEST_SUITE_END(); protected: void negate0(); void nequal0(); }; CPPUNIT_TEST_SUITE_REGISTRATION(NeqTest); // // tests implementation // void NeqTest::negate0() { int input [3] = { 1, 2, 3 }; int output[3]; transform((int*)input, (int*)input + 3, (int*)output, negate<int>()); CPPUNIT_ASSERT(output[0]==-1); CPPUNIT_ASSERT(output[1]==-2); CPPUNIT_ASSERT(output[2]==-3); } void NeqTest::nequal0() { int input1 [4] = { 1, 7, 2, 2 }; int input2 [4] = { 1, 6, 2, 3 }; int output [4]; transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, not_equal_to<int>()); CPPUNIT_ASSERT(output[0]==0); CPPUNIT_ASSERT(output[1]==1); CPPUNIT_ASSERT(output[2]==0); CPPUNIT_ASSERT(output[3]==1); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh18.cpp ======================= // { dg-do run { xfail sparc64-*-elf arm-*-pe } } // { dg-options "-fexceptions" } class VB { public: int n; VB (int v) { n = v; } VB (const VB& o) { n = o.n; // printf("copying VB from %d to %d\n", &o, this); } }; class D : public virtual VB { int j; public: D(int i1, int i2) : VB(i2) { j = i1; } VB& vb() { return *(VB*)this; } const VB& vb() const { return *(const VB*)this; } }; class pD : private virtual VB { int j; public: pD(int i1, int i2) : VB(i2) { j = i1; } VB& vb() { return *(VB*)this; } const VB& vb() const { return *(const VB*)this; } }; int main () { D d(1943, 4279); pD pd(3621, 9527); VB *vb = &d.vb(); VB *pvb = &pd.vb(); // A catch of a public virtual base. try { // printf("Throwing D at %d (VB at %d)\n", &d, vb); throw d; } catch (VB& vb) { // printf("Catching VB at %d\n", &vb); if (vb.n!= 4279) return 1; } catch (...) { return 1; } // A catch of a private virtual base. try { // printf("Throwing D at %d (VB at %d)\n", &pd, pvb); throw pd; } catch (VB& vb) { // printf("Catching VB at %d\n", &vb); // This was a private base of the throw object, don't catch it. return 1; } catch (...) { } } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/new3.cpp ======================= <reponame>perezite/Boost4Android<filename>android-ndk-r10b/tests/device/test-stlport_static-exception/jni/new3.cpp // { dg-do run } // { dg-options "-fcheck-new -pedantic -Wno-long-long" } // PRMS Id: 6037 extern "C" void * malloc (__SIZE_TYPE__); int ena = 0; struct A { int i; A () { i = 2; } void * operator new (__SIZE_TYPE__ s) { if (ena) return 0; return malloc (s); } }; struct B { int i; B () { i = 2; } void * operator new (__SIZE_TYPE__ s) throw() { if (ena) return 0; return malloc (s); } }; int main () { ena = 1; A *ap = new A; B *bp = new B; return ap || bp ; } ======================= File: android-ndk-r10b/tests/build/issue34613-neon/jni/issue34613-neon.cpp ======================= #include <vector> #include <arm_neon.h> void x(float32x4_t v0, float32_t f) { float32x4_t vv = vmulq_n_f32( v0, f); } int main() { std::vector<float32_t> my_vector; return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/rethrow1.cpp ======================= // { dg-do run } // Testcase for proper handling of rethrow. #include <stdio.h> int c, d; struct A { int i; A () { i = ++c; printf ("A() %d\n", i); } A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); } ~A() { printf ("~A() %d\n", i); ++d; } }; int main () { try { try { printf ("Throwing 1...\n"); throw A(); } catch (A) { try { printf ("Throwing 2...\n"); throw A(); } catch (A) { printf ("Throwing 3...\n"); throw; } } } catch (A) { printf ("Caught.\n"); } printf ("c == %d, d == %d\n", c, d); return c!= d; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/has_nothrow_assign.cpp ======================= <filename>android-ndk-r10b/tests/device/test-stlport_static-exception/jni/has_nothrow_assign.cpp<gh_stars>1-10 // { dg-do "run" } #include <cassert> struct A { double a; double b; }; struct B { A a; }; struct C : public A { }; struct D { D& operator=(const D&) throw() { return *this; } }; struct E { E& operator=(const E&) throw(int) { return *this; } }; struct E1 { E1& operator=(const E1&) throw(int) { throw int(); return *this; } }; struct F { F() throw(int) { } }; struct G { G() throw(int) { throw int(); } }; struct H { H& operator=(H&) throw(int) { return *this; } }; struct H1 { H1& operator=(H1&) throw(int) { throw int(); return *this; } }; struct I { I& operator=(I&) throw(int) { return *this; } I& operator=(const I&) throw() { return *this; } }; struct I1 { I1& operator=(I1&) throw(int) { throw int(); return *this; } I1& operator=(const I1&) throw() { return *this; } }; struct J { J& operator=(J&) throw() { return *this; } J& operator=(const J&) throw() { return *this; } J& operator=(volatile J&) throw() { return *this; } J& operator=(const volatile J&) throw() { return *this; } }; struct K { K& operator=(K&) throw() { return *this; } }; struct L { L& operator=(const L&) throw() { return *this; } }; template<typename T> bool f() { return __has_nothrow_assign(T); } template<typename T> class My { public: bool f() { return!!__has_nothrow_assign(T); } }; template<typename T> class My2 { public: static const bool trait = __has_nothrow_assign(T); }; template<typename T> const bool My2<T>::trait; template<typename T, bool b = __has_nothrow_assign(T)> struct My3_help { static const bool trait = b; }; template<typename T, bool b> const bool My3_help<T, b>::trait; template<typename T> class My3 { public: bool f() { return My3_help<T>::trait; } }; #define PTEST(T) (__has_nothrow_assign(T) && f<T>() \ && My<T>().f() && My2<T>::trait && My3<T>().f()) #define NTEST(T) (!__has_nothrow_assign(T) &&!f<T>() \ &&!My<T>().f() &&!My2<T>::trait &&!My3<T>().f()) int main() { assert (PTEST (int)); assert (NTEST (int (int))); assert (NTEST (void)); assert (PTEST (A)); assert (PTEST (B)); assert (PTEST (C)); assert (NTEST (C[])); assert (PTEST (D)); assert (NTEST (E)); assert (NTEST (E1)); assert (PTEST (F)); assert (PTEST (G)); assert (NTEST (H)); assert (NTEST (H1)); assert (NTEST (I)); assert (NTEST (I1)); assert (PTEST (J)); assert (NTEST (const K)); assert (NTEST (const L)); return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/nthelm_test.cpp ======================= <filename>android-ndk-r10b/tests/device/test-stlport/unit/nthelm_test.cpp #include <vector> #include <algorithm> #include <functional> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class NthElemTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(NthElemTest); CPPUNIT_TEST(nthelem0); CPPUNIT_TEST(nthelem1); CPPUNIT_TEST(nthelem2); CPPUNIT_TEST_SUITE_END(); protected: void nthelem0(); void nthelem1(); void nthelem2(); }; CPPUNIT_TEST_SUITE_REGISTRATION(NthElemTest); // // tests implementation // void NthElemTest::nthelem0() { int numbers[7] = { 5, 2, 4, 1, 0, 3,77}; nth_element(numbers, numbers + 3, numbers + 6); CPPUNIT_ASSERT(numbers[0]==1); CPPUNIT_ASSERT(numbers[1]==0); CPPUNIT_ASSERT(numbers[2]==2); CPPUNIT_ASSERT(numbers[3]==3); CPPUNIT_ASSERT(numbers[4]==4); CPPUNIT_ASSERT(numbers[5]==5); } void NthElemTest::nthelem1() { //6 8 5 1 7 4 1 5 2 6 //1 1 4 2 5 5 6 7 8 6 int numbers[10] = { 6, 8, 5, 1, 7, 4, 1, 5, 2, 6 }; vector <int> v1(numbers, numbers+10); nth_element(v1.begin(), v1.begin() + v1.size() / 2, v1.end()); CPPUNIT_ASSERT(v1[0]==1); CPPUNIT_ASSERT(v1[1]==1); CPPUNIT_ASSERT(v1[2]==4); CPPUNIT_ASSERT(v1[3]==2); CPPUNIT_ASSERT(v1[4]==5); CPPUNIT_ASSERT(v1[5]==5); CPPUNIT_ASSERT(v1[6]==6); CPPUNIT_ASSERT(v1[7]==7); CPPUNIT_ASSERT(v1[8]==8); CPPUNIT_ASSERT(v1[9]==6); } void NthElemTest::nthelem2() { //4 5 4 2 1 7 4 3 1 6 //6 7 4 4 5 4 3 2 1 1 int numbers[10] = { 4, 5, 4, 2, 1, 7, 4, 3, 1, 6 }; vector <int> v1(numbers, numbers+10); nth_element(v1.begin(), v1.begin() + v1.size() / 2, v1.end(), greater<int>()); CPPUNIT_ASSERT(v1[0]==6); CPPUNIT_ASSERT(v1[1]==7); CPPUNIT_ASSERT(v1[2]==4); CPPUNIT_ASSERT(v1[3]==4); CPPUNIT_ASSERT(v1[4]==5); CPPUNIT_ASSERT(v1[5]==4); CPPUNIT_ASSERT(v1[6]==3); CPPUNIT_ASSERT(v1[7]==2); CPPUNIT_ASSERT(v1[8]==1); CPPUNIT_ASSERT(v1[9]==1); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/delete3_1.cpp ======================= // { dg-do run } #include <new> #include <stddef.h> int i; extern "C" int printf (const char *,...); template <class T, class U> struct map { ~map (); }; template <class T, class U> map<T, U>::~map () {} struct SomeClass { }; void* operator new(size_t numBytes, SomeClass&, const std::nothrow_t&) throw() { return operator new(numBytes, std::nothrow); } void operator delete(void* pMemory, SomeClass&, const std::nothrow_t&) throw() { i = 7; return operator delete(pMemory); } int main() { map< int, int>* pMap = new map< int, int>; delete pMap; if (i == 7) return 1; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/cleanup1_1.cpp ======================= <filename>android-ndk-r10b/tests/device/test-stlport_static-exception/jni/cleanup1_1.cpp // { dg-do run } // Bug: obj gets destroyed twice because the fixups for the return are // inside its cleanup region. extern "C" int printf (const char *,...); int d; struct myExc { }; struct myExcRaiser { ~myExcRaiser() { throw myExc(); } }; struct stackObj { ~stackObj() { ++d; printf ("stackObj::~stackObj()\n"); } }; int test() { myExcRaiser rais; stackObj obj; return 0; } int main() { try { test(); } catch (myExc &) { return d!= 1; } return 1; } ======================= File: android-ndk-r10b/tests/build/cpp-extensions/jni/foo1.cc ======================= <filename>android-ndk-r10b/tests/build/cpp-extensions/jni/foo1.cc namespace cpp { extern int foo1(int x) { return x + 1; } } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh2.cpp ======================= // PR 6764 // { dg-do run } // { dg-options "-O -fomit-frame-pointer" } extern "C" void abort (); class test { public: test * const me; test () : me(this) { } ~test () { if (me!= this) abort (); } }; void x1 () { test w1; throw 1; } void x2 () { test w2; x1 (); } int main (void) { try { x2 (); } catch (...) { } return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/fntry1_1.cpp ======================= // { dg-do run } // Bug: g++ silently ignores function-try-blocks in templates. // Submitted by <NAME> <<EMAIL>> template <class T> void f (T) try { throw 1; } catch (...) { } int main () { f (1); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/singleton.cpp ======================= // { dg-do run } // This tests two things: // 1. there is an annoying warning. // singleton.C:26: warning: `class singleton' only defines private constructors and has no friends // egcs fails to see that there is a public static accessor function. // 2. the program crashes, because apparently the static variable s in // singleton::instance() is considered constructed although the ctor // exited via an exception. (crash changed to nonzero return here) class singleton { public: static singleton& instance() { static singleton s; return s; } int check() {return initialized;} private: singleton() : initialized(1) { if ( counter++ == 0 ) throw "just for the heck of it"; initialized = 2; } singleton( const singleton& rhs ); void operator=( const singleton& rhs ); int initialized; static int counter; }; int singleton::counter; int main() { while (1) { try { return singleton::instance().check()-2; } catch (...) { } } } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh25.cpp ======================= <reponame>perezite/Boost4Android<filename>android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh25.cpp // { dg-do run { xfail sparc64-*-elf arm-*-pe } } // { dg-options "-fexceptions" } #include <exception> #include <stdlib.h> void my_terminate() { exit (0); // Double faults should call terminate } struct A { A() { } ~A() { std::set_terminate (my_terminate); throw 1; // This throws from EH dtor, should call my_terminate } }; int main() { try { try { throw 1; } catch (int i) { A a; // A hit on this EH dtor went to the wrong place throw 1; } } catch (...) { return 1; } return 1; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh10.cpp ======================= // { dg-do run { xfail sparc64-*-elf arm-*-pe } } // { dg-options "-fexceptions" } void foo() { int i; i = 42; throw i; } void ee(int *); void bar() { int i = 2; ee(&i); } void ee(int *) { } int main() { try { foo(); return 3; } catch (int& i) { bar(); return i!= 42; } return 2; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/new11.cpp ======================= <reponame>perezite/Boost4Android // PR c++/17670 // { dg-do run } #include <cstdlib> #include <new> bool abort_new; void *operator new[](size_t bytes) throw (std::bad_alloc) { if (abort_new) abort(); return operator new (bytes); } struct X {}; int main () { // Do not abort until int main is running in case startup code uses // operator new[]. abort_new = true; new (X); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-6.cpp ======================= // { dg-do "run" } #include <cassert> struct S { S (S&) throw (); S (const S&, int) throw (int); }; int main () { assert (__has_nothrow_copy (S)); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh14.cpp ======================= // { dg-do run { xfail sparc64-*-elf arm-*-pe } } // { dg-options "-fexceptions" } class arghh { public: int n; arghh (int v) { n = v; } }; int main () { try { throw arghh (11); } catch (arghh& a) { if (a.n!= 11) return 1; } try { throw arghh (22); } catch (arghh& a) { if (a.n!= 22) return 2; } } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/gcsec1.cpp ======================= <gh_stars>1-10 /* PR other/29639 */ /* AIX gld supports garbage collection. But AIX gcc does not support -ffunction-sections or -fdata-sections. */ /* { dg-do run { xfail rs6000-*-aix* powerpc*-*-aix* } } */ /* { dg-require-gc-sections "" } */ /* { dg-options "-ffunction-sections -Wl,--gc-sections" } */ extern "C" void abort (void); int g = 0; void raise_exception() { throw 1; } void used() { try { raise_exception (); } catch (int) { g = 1; } } void unused() { try { raise_exception (); } catch (int) { g = 1; } } int main() { used (); if (g!= 1) abort (); return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/stack_test.cpp ======================= #include <algorithm> #include <list> #include <queue> #include <deque> #include <stack> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class StackTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(StackTest); CPPUNIT_TEST(stack1); CPPUNIT_TEST(stack2); CPPUNIT_TEST_SUITE_END(); protected: void stack1(); void stack2(); }; CPPUNIT_TEST_SUITE_REGISTRATION(StackTest); // // tests implementation // void StackTest::stack1() { stack<int, deque<int> > s; s.push(42); s.push(101); s.push(69); CPPUNIT_ASSERT(s.top()==69); s.pop(); CPPUNIT_ASSERT(s.top()==101); s.pop(); CPPUNIT_ASSERT(s.top()==42); s.pop(); CPPUNIT_ASSERT(s.empty()); } void StackTest::stack2() { stack<int, list<int> > s; s.push(42); s.push(101); s.push(69); CPPUNIT_ASSERT(s.top()==69); s.pop(); CPPUNIT_ASSERT(s.top()==101); s.pop(); CPPUNIT_ASSERT(s.top()==42); s.pop(); CPPUNIT_ASSERT(s.empty()); } ======================= File: android-ndk-r10b/tests/build/stdint-c++/jni/test_all_macros.cpp ======================= /* AUTO-GENERATED FILE - DO NOT MODIFY! */ #define __STDC_LIMIT_MACROS 1 #define __STDC_CONSTANT_MACROS 1 #include <stdint.h> #ifndef INT8_MIN #error INT8_MIN defined! #endif #ifndef INT8_MAX #error INT8_MAX defined! #endif #ifndef INT_LEAST8_MIN #error INT_LEAST8_MIN defined! #endif #ifndef INT_LEAST8_MAX #error INT_LEAST8_MAX defined! #endif #ifndef INT_FAST8_MIN #error INT_FAST8_MIN defined! #endif #ifndef INT_FAST8_MAX #error INT_FAST8_MAX defined! #endif #ifndef UINT8_MAX #error UINT8_MAX defined! #endif #ifndef UINT_LEAST8_MAX #error UINT_LEAST8_MAX defined! #endif #ifndef UINT_FAST8_MAX #error UINT_FAST8_MAX defined! #endif #ifndef INT16_MIN #error INT16_MIN defined! #endif #ifndef INT16_MAX #error INT16_MAX defined! #endif #ifndef INT_LEAST16_MIN #error INT_LEAST16_MIN defined! #endif #ifndef INT_LEAST16_MAX #error INT_LEAST16_MAX defined! #endif #ifndef INT_FAST16_MIN #error INT_FAST16_MIN defined! #endif #ifndef INT_FAST16_MAX #error INT_FAST16_MAX defined! #endif #ifndef UINT16_MAX #error UINT16_MAX defined! #endif #ifndef UINT_LEAST16_MAX #error UINT_LEAST16_MAX defined! #endif #ifndef UINT_FAST16_MAX #error UINT_FAST16_MAX defined! #endif #ifndef INT32_MIN #error INT32_MIN defined! #endif #ifndef INT32_MAX #error INT32_MAX defined! #endif #ifndef INT_LEAST32_MIN #error INT_LEAST32_MIN defined! #endif #ifndef INT_LEAST32_MAX #error INT_LEAST32_MAX defined! #endif #ifndef INT_FAST32_MIN #error INT_FAST32_MIN defined! #endif #ifndef INT_FAST32_MAX #error INT_FAST32_MAX defined! #endif #ifndef UINT32_MAX #error UINT32_MAX defined! #endif #ifndef UINT_LEAST32_MAX #error UINT_LEAST32_MAX defined! #endif #ifndef UINT_FAST32_MAX #error UINT_FAST32_MAX defined! #endif #ifndef INT64_MIN #error INT64_MIN defined! #endif #ifndef INT64_MAX #error INT64_MAX defined! #endif #ifndef INT_LEAST64_MIN #error INT_LEAST64_MIN defined! #endif #ifndef INT_LEAST64_MAX #error INT_LEAST64_MAX defined! #endif #ifndef INT_FAST64_MIN #error INT_FAST64_MIN defined! #endif #ifndef INT_FAST64_MAX #error INT_FAST64_MAX defined! #endif #ifndef UINT64_MAX #error UINT64_MAX defined! #endif #ifndef UINT_LEAST64_MAX #error UINT_LEAST64_MAX defined! #endif #ifndef UINT_FAST64_MAX #error UINT_FAST64_MAX defined! #endif #ifndef INTMAX_MIN #error INTMAX_MIN defined! #endif #ifndef INTMAX_MAX #error INTMAX_MAX defined! #endif #ifndef UINTMAX_MAX #error UINTMAX_MAX defined! #endif #ifndef INTPTR_MIN #error INTPTR_MIN defined! #endif #ifndef INTPTR_MAX #error INTPTR_MAX defined! #endif #ifndef PTRDIFF_MIN #error PTRDIFF_MIN defined! #endif #ifndef PTRDIFF_MAX #error PTRDIFF_MAX defined! #endif #ifndef UINTPTR_MAX #error UINTPTR_MAX defined! #endif #ifndef INT8_C #error INT8_C defined! #endif #ifndef INT_LEAST8_C #error INT_LEAST8_C defined! #endif #ifndef INT_FAST8_C #error INT_FAST8_C defined! #endif #ifndef UINT8_C #error UINT8_C defined! #endif #ifndef UINT_LEAST8_C #error UINT_LEAST8_C defined! #endif #ifndef UINT_FAST8_C #error UINT_FAST8_C defined! #endif #ifndef INT16_C #error INT16_C defined! #endif #ifndef INT_LEAST16_C #error INT_LEAST16_C defined! #endif #ifndef INT_FAST16_C #error INT_FAST16_C defined! #endif #ifndef UINT16_C #error UINT16_C defined! #endif #ifndef UINT_LEAST16_C #error UINT_LEAST16_C defined! #endif #ifndef UINT_FAST16_C #error UINT_FAST16_C defined! #endif #ifndef INT32_C #error INT32_C defined! #endif #ifndef INT_LEAST32_C #error INT_LEAST32_C defined! #endif #ifndef INT_FAST32_C #error INT_FAST32_C defined! #endif #ifndef UINT32_C #error UINT32_C defined! #endif #ifndef UINT_LEAST32_C #error UINT_LEAST32_C defined! #endif #ifndef UINT_FAST32_C #error UINT_FAST32_C defined! #endif #ifndef INT64_C #error INT64_C defined! #endif #ifndef INT_LEAST64_C #error INT_LEAST64_C defined! #endif #ifndef INT_FAST64_C #error INT_FAST64_C defined! #endif #ifndef UINT64_C #error UINT64_C defined! #endif #ifndef UINT_LEAST64_C #error UINT_LEAST64_C defined! #endif #ifndef UINT_FAST64_C #error UINT_FAST64_C defined! #endif #ifndef INTMAX_C #error INTMAX_C defined! #endif #ifndef UINTMAX_C #error UINTMAX_C defined! #endif #ifndef INTPTR_C #error INTPTR_C defined! #endif #ifndef PTRDIFF_C #error PTRDIFF_C defined! #endif #ifndef UINTPTR_C #error UINTPTR_C defined! #endif ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh-vararg-1.cpp ======================= <gh_stars>1-10 /* { dg-do run } */ #include <stdarg.h> #include "check.h" #ifndef ALIGNMENT #define ALIGNMENT 64 #endif typedef int aligned __attribute__((aligned(ALIGNMENT))); int global; void bar (char *p, int size) { __builtin_strncpy (p, "good", size); } class Base {}; struct A : virtual public Base { A() {} }; struct B {}; void foo (const char *fmt,...) throw (B,A) { va_list arg; char *p; aligned i; int size; double x; va_start (arg, fmt); size = va_arg (arg, int); if (size!= 5) abort (); p = (char *) __builtin_alloca (size + 1); x = va_arg (arg, double); if (x!= 5.0) abort (); bar (p, size); if (__builtin_strncmp (p, "good", size)!= 0) { #ifdef DEBUG p[size] = '\0'; printf ("Failed: %s!= good\n", p); #endif abort (); } if (check_int (&i, __alignof__(i))!= i) abort (); throw A(); va_end (arg); } int main() { try { foo ("foo", 5, 5.0); } catch (A& a) { } return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/cleanup2.cpp ======================= // { dg-do run } // Copyright (C) 1999 Free Software Foundation, Inc. // Contributed by <NAME> 21 Nov 1999 <<EMAIL>> // make sure we don't call base dtors, if we failed to call the // base ctor due to exception throwing #include <stdio.h> static bool bad = false; static int thrower () { printf ("in %s\n", __PRETTY_FUNCTION__); throw 0; return 0; } struct X { X (int) throw (int); ~X () throw (); }; X::X (int) throw (int) {printf ("in ctor X %s\n", __PRETTY_FUNCTION__); bad = true;} X::~X () throw () {printf ("in dtor X %s\n", __PRETTY_FUNCTION__); bad = true;} struct X1 {}; struct Y : X { Y() throw (int); ~Y() throw (); }; Y::Y() throw (int) : X(thrower ()) // throws, so X::X is never called {printf ("in ctor Y%s\n", __PRETTY_FUNCTION__); bad = true;} Y::~Y() throw () {printf ("in dtor Y%s\n", __PRETTY_FUNCTION__); bad = true;} int main () { try { Y y; } catch (...) { printf ("caught\n"); } return bad; } ======================= File: android-ndk-r10b/sources/android/crazy_linker/src/crazy_linker_system_mock.cpp ======================= <reponame>perezite/Boost4Android<gh_stars>1-10 // Copyright (c) 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 "crazy_linker_system_mock.h" #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include "crazy_linker_util.h" #include "crazy_linker_system.h" // Unit-testing support code. This should never be compiled into // the production code. namespace { using crazy::String; using crazy::Vector; void Panic(const char* msg,...) { va_list args; fprintf(stderr, "PANIC: "); va_start(args, msg); vfprintf(stderr, msg, args); va_end(args); fprintf(stderr, "\n"); exit(1); } // Models a simple list of pointers to objects, which are owned by the // list itself. template <class T> class List { public: List() : entries_() {} ~List() { Reset(); } void Reset() { for (size_t n = 0; n < entries_.GetCount(); ++n) { T* entry = entries_[n]; delete entry; entries_[n] = NULL; } entries_.Resize(0); } // Add an item to the list, transfer ownership to it. void PushBack(T* item) { entries_.PushBack(item); } size_t GetCount() const { return entries_.GetCount(); } T* operator[](size_t index) { return entries_[index]; } private: crazy::Vector<T*> entries_; }; // Models a single file entry in a mock file system. class MockFileEntry { public: MockFileEntry() : path_(), data_() {} ~MockFileEntry() {} const char* GetPath() const { return path_.c_str(); } const char* GetData() const { return data_.c_str(); } size_t GetDataSize() const { return data_.size(); } void SetPath(const char* path) { path_.Assign(path); } void SetData(const char* data, size_t data_size) { data_.Assign(data, data_size); } private: crazy::String path_; crazy::String data_; }; // Models a single mock environment variable value. class MockEnvEntry { public: MockEnvEntry(const char* var_name, const char* var_value) : var_name_(var_name), var_value_(var_value) {} const String& GetName() const { return var_name_; } const String& GetValue() const { return var_value_; } private: crazy::String var_name_; crazy::String var_value_; }; class MockSystem { public: MockSystem() : files_(), environment_() {} ~MockSystem() { Reset(); } void SetCurrentDir(const char* path) { current_dir_ = path; } String GetCurrentDir() const { return current_dir_; } void AddFileEntry(MockFileEntry* entry) { files_.PushBack(entry); } void AddEnvEntry(MockEnvEntry* entry) { environment_.PushBack(entry); } MockFileEntry* FindFileEntry(const char* path) { for (size_t n = 0; n < files_.GetCount(); ++n) { MockFileEntry* entry = files_[n]; if (entry->GetPath() &&!strcmp(path, entry->GetPath())) return entry; } return NULL; } MockEnvEntry* FindEnvEntry(const char* var_name) { for (size_t n = 0; n < environment_.GetCount(); ++n) { MockEnvEntry* entry = environment_[n]; if (!strcmp(entry->GetName().c_str(), var_name)) return entry; } return NULL; } void Reset() { files_.Reset(); environment_.Reset(); current_dir_ = "/"; } void Check() { if (!active_) Panic("No mock file system setup!"); } void Activate() { if (active_) Panic("Double mock file system activation!"); active_ = true; } void Deactivate() { if (!active_) Panic("Double mock file system deactivation!"); active_ = false; } private: List<MockFileEntry> files_; List<MockEnvEntry> environment_; String current_dir_; bool active_; }; static MockSystem s_mock_fs; class MockFileHandle { public: MockFileHandle(MockFileEntry* entry) : entry_(entry), offset_(0) {} ~MockFileHandle() {} bool IsEof() const { return offset_ >= entry_->GetDataSize(); } bool GetString(char* buffer, size_t buffer_size) { const char* data = entry_->GetData(); size_t data_size = entry_->GetDataSize(); if (offset_ >= data_size || buffer_size == 0) return false; while (buffer_size > 1) { char ch = data[offset_++]; *buffer++ = ch; buffer_size--; if (ch == '\n') break; } *buffer = '\0'; return true; } int Read(void* buffer, size_t buffer_size) { if (buffer_size == 0) return 0; const char* data = entry_->GetData(); size_t data_size = entry_->GetDataSize(); size_t avail = data_size - offset_; if (avail == 0) return 0; if (buffer_size > avail) buffer_size = avail; ::memcpy(buffer, data + offset_, buffer_size); offset_ += buffer_size; return static_cast<int>(buffer_size); } int SeekTo(off_t offset) { if (offset < 0) { errno = EINVAL; return -1; } const char* data = entry_->GetData(); size_t data_size = entry_->GetDataSize(); if (offset > static_cast<off_t>(data_size)) { errno = EINVAL; return -1; } offset_ = static_cast<size_t>(offset); return 0; } void* Map(void* address, size_t length, int prot, int flags, off_t offset) { const char* data = entry_->GetData(); size_t data_size = entry_->GetDataSize(); if (offset_ >= data_size) { errno = EINVAL; return MAP_FAILED; } // Allocate an anonymous memory mapping, then copy the file contents // into it. void* map = mmap(address, length, PROT_WRITE, MAP_ANONYMOUS, -1, 0); if (map == MAP_FAILED) { return map; } size_t avail = data_size - offset_; if (avail > length) avail = length; ::memcpy(map, data + offset_, avail); // Restore desired protection after the write. mprotect(map, length, prot); // Done. return map; } private: MockFileEntry* entry_; size_t offset_; }; MockFileHandle* NewMockFileHandle(const char* path, crazy::FileOpenMode open_mode) { // Check that a mock file system instance is active. s_mock_fs.Check(); // TODO(digit): Add write support. if (open_mode!= crazy::FILE_OPEN_READ_ONLY) Panic("Unsupported open mode (%d): %s", open_mode, path); MockFileEntry* entry = s_mock_fs.FindFileEntry(path); if (!entry) Panic("Missing mock file entry: %s", path); return new MockFileHandle(entry); } } // namespace namespace crazy { #ifdef UNIT_TESTS bool PathExists(const char* path) { s_mock_fs.Check(); return s_mock_fs.FindFileEntry(path)!= NULL; } bool PathIsFile(const char* path) { // TODO(digit): Change this when support for mock directories is added. return PathExists(path); } String GetCurrentDirectory() { s_mock_fs.Check(); return s_mock_fs.GetCurrentDir(); } const char* GetEnv(const char* var_name) { s_mock_fs.Check(); MockEnvEntry* entry = s_mock_fs.FindEnvEntry(var_name); if (!entry) return NULL; else return entry->GetValue().c_str(); } bool FileDescriptor::OpenReadOnly(const char* path) { fd_ = NewMockFileHandle(path, FILE_OPEN_READ_ONLY); return fd_!= NULL; } bool FileDescriptor::OpenReadWrite(const char* path) { // NOT IMPLEMENTED ON PURPOSE. return false; } void FileDescriptor::Close() { if (fd_) { MockFileHandle* handle = reinterpret_cast<MockFileHandle*>(fd_); delete handle; fd_ = NULL; } } int FileDescriptor::Read(void* buffer, size_t buffer_size) { if (!fd_) { errno = EBADF; return -1; } MockFileHandle* handle = reinterpret_cast<MockFileHandle*>(fd_); return handle->Read(buffer, buffer_size); } int FileDescriptor::SeekTo(off_t offset) { if (!fd_) { errno = EBADF; return -1; } MockFileHandle* handle = reinterpret_cast<MockFileHandle*>(fd_); return handle->SeekTo(offset); } void* FileDescriptor::Map(void* address, size_t length, int prot, int flags, off_t offset) { if (!fd_ || (offset & 4095)!= 0) { errno = EINVAL; return MAP_FAILED; } MockFileHandle* handle = reinterpret_cast<MockFileHandle*>(fd_); return handle->Map(address, length, prot, flags, offset); } SystemMock::SystemMock() { s_mock_fs.Activate(); } SystemMock::~SystemMock() { s_mock_fs.Deactivate(); s_mock_fs.Reset(); } void SystemMock::AddRegularFile(const char* path, const char* data, size_t data_size) { s_mock_fs.Check(); MockFileEntry* entry = new MockFileEntry(); entry->SetPath(path); entry->SetData(data, data_size); s_mock_fs.AddFileEntry(entry); } void SystemMock::AddEnvVariable(const char* var_name, const char* var_value) { s_mock_fs.Check(); MockEnvEntry* env = new MockEnvEntry(var_name, var_value); s_mock_fs.AddEnvEntry(env); } void SystemMock::SetCurrentDir(const char* path) { s_mock_fs.Check(); s_mock_fs.SetCurrentDir(path); } #endif // UNIT_TESTS } // namespace crazy ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh47.cpp ======================= <filename>android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh47.cpp // { dg-do run { xfail sparc64-*-elf arm-*-pe } } // { dg-options "-fexceptions" } #include <cstdlib> #include <exception> void myterm() { exit (0); } int main() { try { throw ""; } catch (...) { } try { std::set_terminate (myterm); throw; } catch (...) { return 1; } return 1; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/mismatch_test.cpp ======================= #include <numeric> #include <vector> #include <algorithm> #include "iota.h" #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class MismatchTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(MismatchTest); CPPUNIT_TEST(mismatch0); CPPUNIT_TEST(mismatch1); CPPUNIT_TEST(mismatch2); CPPUNIT_TEST_SUITE_END(); protected: void mismatch0(); void mismatch1(); void mismatch2(); }; CPPUNIT_TEST_SUITE_REGISTRATION(MismatchTest); // // tests implementation // bool str_equal(const char* a_, const char* b_) { return strcmp(a_, b_) == 0? 1 : 0; } void MismatchTest::mismatch0() { int n1[5] = { 1, 2, 3, 4, 5 }; int n2[5] = { 1, 2, 3, 4, 5 }; int n3[5] = { 1, 2, 3, 2, 1 }; pair <int*, int*> result = mismatch((int*)n1, (int*)n1 + 5, (int*)n2); CPPUNIT_ASSERT(result.first ==(n1 + 5) && result.second ==(n2 + 5)); result = mismatch((int*)n1, (int*)n1 + 5, (int*)n3); CPPUNIT_ASSERT(!(result.first ==(n1 + 5) && result.second ==(n3 + 5))); CPPUNIT_ASSERT((result.first - n1)==3); } void MismatchTest::mismatch1() { typedef vector<int> IntVec; IntVec v1(10); __iota(v1.begin(), v1.end(), 0); IntVec v2(v1); pair <IntVec::iterator, IntVec::iterator> result = mismatch(v1.begin(), v1.end(), v2.begin()); CPPUNIT_ASSERT(result.first == v1.end() && result.second == v2.end()); v2[v2.size()/2] = 42; result = mismatch(v1.begin(), v1.end(), v2.begin()); CPPUNIT_ASSERT(!(result.first == v1.end() && result.second == v2.end())); CPPUNIT_ASSERT((result.first - v1.begin())==5); } void MismatchTest::mismatch2() { const unsigned size = 5; char const* n1[size] = { "Brett", "Graham", "Jack", "Mike", "Todd" }; char const* n2[size]; copy(n1, n1 + 5, (char const**)n2); pair <char const**, char const**> result = mismatch((char const**)n1, (char const**)n1 + size, (char const**)n2, str_equal); CPPUNIT_ASSERT(result.first == n1 + size && result.second == n2 + size); n2[2] = "QED"; result = mismatch((char const**)n1, (char const**)n1 + size, (char const**)n2, str_equal); CPPUNIT_ASSERT(!(result.first == n2 + size && result.second == n2 + size)); CPPUNIT_ASSERT((result.first - n1)==2); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/ia64-2.cpp ======================= // PR target/30230 // This testcase failed on IA-64, where end of an EH region ended // in the middle of a bundle (with br.call insn in first or second // slot of.bbb/.mbb bundles and EH region end right after it). // But br.call returns to the start of the next bundlem so during // unwinding the call was considered to be outside of the EH region // while it should have been inside. // { dg-do run } // { dg-require-weak "" } // { dg-options "-O2" } struct A {}; struct B { virtual ~B(); }; B::~B () {} struct C { void foo (short &, B &); }; struct D { void *d1; C *d2; virtual void virt (void) {} }; struct E { D *e1; B *e2; }; struct F { void bar (void *, B &); }; F *p __attribute__((weak)); volatile int r; void C::foo (short &x, B &) { if (r) throw A (); x = 1; } void F::bar (void *, B &) { throw A (); } void baz (E &x) { short g = 0; B b = *x.e2; x.e1->d2->foo (g, b); if (g) p->bar(x.e1->d1, b); } int main () { F g; D s; E h; p = &g; h.e1 = &s; try { baz (h); } catch (A &) { } return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eb88.cpp ======================= // { dg-do run } // { dg-options "-w" } // Another magic NULL problem. #include <stddef.h> int main() { try { throw(NULL); } catch (...) { } } ======================= File: android-ndk-r10b/sources/android/crazy_linker/src/crazy_linker_system.cpp ======================= <reponame>perezite/Boost4Android // Copyright (c) 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 "crazy_linker_system.h" #include <errno.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <unistd.h> #include "crazy_linker_util.h" // Note: unit-testing support files are in crazy_linker_files_mock.cpp namespace crazy { #ifndef UNIT_TESTS bool FileDescriptor::OpenReadOnly(const char* path) { Close(); fd_ = TEMP_FAILURE_RETRY(::open(path, O_RDONLY)); return (fd_!= -1); } bool FileDescriptor::OpenReadWrite(const char* path) { Close(); fd_ = TEMP_FAILURE_RETRY(::open(path, O_RDWR)); return (fd_!= -1); } int FileDescriptor::Read(void* buffer, size_t buffer_size) { return TEMP_FAILURE_RETRY(::read(fd_, buffer, buffer_size)); } int FileDescriptor::SeekTo(off_t offset) { return ::lseek(fd_, offset, SEEK_SET); } void* FileDescriptor::Map(void* address, size_t length, int prot, int flags, off_t offset) { return ::mmap(address, length, prot, flags, fd_, offset); } void FileDescriptor::Close() { if (fd_!= -1) { int old_errno = errno; TEMP_FAILURE_RETRY(close(fd_)); errno = old_errno; fd_ = -1; } } const char* GetEnv(const char* var_name) { return ::getenv(var_name); } String GetCurrentDirectory() { String result; size_t capacity = 128; for (;;) { result.Resize(capacity); if (getcwd(&result[0], capacity)) break; capacity *= 2; } return result; } bool PathExists(const char* path) { struct stat st; if (TEMP_FAILURE_RETRY(stat(path, &st)) < 0) return false; return S_ISREG(st.st_mode) || S_ISDIR(st.st_mode); } bool PathIsFile(const char* path) { struct stat st; if (TEMP_FAILURE_RETRY(stat(path, &st)) < 0) return false; return S_ISREG(st.st_mode); } #endif //!UNIT_TESTS // Returns true iff |lib_name| corresponds to one of the NDK-exposed // system libraries. bool IsSystemLibrary(const char* lib_name) { static const char* const kSystemLibs[] = { "libandroid.so", "libc.so", "libdl.so", "libjnigraphics.so", "liblog.so", "libm.so", "libstdc++.so", "libz.so", "libEGL.so", "libGLESv1_CM.so", "libGLESv2.so", "libGLESv3.so", "libOpenMAXAL.so", "libOpenSLES.so", }; const size_t kSize = sizeof(kSystemLibs) / sizeof(kSystemLibs[0]); const char* base_name = ::strrchr(lib_name, '/'); if (!base_name) base_name = lib_name; else base_name += 1; for (size_t n = 0; n < kSize; ++n) { if (!strcmp(kSystemLibs[n], base_name)) return true; } return false; } } // namespace crazy ======================= File: android-ndk-r10b/tests/device/issue46718-iostream-crash-stlport/jni/issue46718-iostream-crash.cpp ======================= <filename>android-ndk-r10b/tests/device/issue46718-iostream-crash-stlport/jni/issue46718-iostream-crash.cpp #include <cerrno> #include <cstddef> #include <cstdio> #include <sstream> int main(void) { const char* inputTest = "0"; double f = 6; std::istringstream ss(inputTest); printf ("Doing the read\n"); ss >> f; //Crash in 4.7, fine in 4.6 printf ("Here it is %f\n", f); } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/min_test.cpp ======================= <gh_stars>100-1000 #include <vector> #include <algorithm> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class MinTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(MinTest); CPPUNIT_TEST(min1); CPPUNIT_TEST(min2); CPPUNIT_TEST(minelem1); CPPUNIT_TEST(minelem2); CPPUNIT_TEST_SUITE_END(); protected: void min1(); void min2(); void minelem1(); void minelem2(); static bool str_compare(const char* a_, const char* b_) { return strcmp(a_, b_) < 0? 1 : 0; } }; CPPUNIT_TEST_SUITE_REGISTRATION(MinTest); // // tests implementation // void MinTest::min1() { int r = min(42, 100); CPPUNIT_ASSERT( r == 42 ); r = min(--r, r); CPPUNIT_ASSERT( r == 41 ); } void MinTest::min2() { const char* r = min((const char*)"shoe", (const char*)"shine", str_compare); CPPUNIT_ASSERT(!strcmp(r, "shine")); } void MinTest::minelem1() { int numbers[6] = { -10, 15, -100, 36, -242, 42 }; int* r = min_element((int*)numbers, (int*)numbers + 6); CPPUNIT_ASSERT(*r==-242); } void MinTest::minelem2() { const char* names[] = { "Brett", "Graham", "Jack", "Mike", "Todd" }; const unsigned namesCt = sizeof(names) / sizeof(names[0]); const char** r = min_element((const char**)names, (const char**)names + namesCt, str_compare); CPPUNIT_ASSERT(!strcmp(*r, "Brett")); } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/mvctor_test.cpp ======================= #include <vector> #include <algorithm> #include <string> #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) # include <slist> #endif #include <list> #include <deque> #include <set> #if defined (STLPORT) # include <unordered_set> #endif #include "mvctor_test.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; # if defined (STLPORT) using namespace std::tr1; # endif #endif CPPUNIT_TEST_SUITE_REGISTRATION(MoveConstructorTest); // // tests implementation // void MoveConstructorTest::move_construct_test() { //cout << "vector<vector<int>>"; vector<int> const ref_vec(10, 0); vector<vector<int> > v_v_ints(1, ref_vec); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) int *pint = &(v_v_ints.front().front()); #endif size_t cur_capacity = v_v_ints.capacity(); while (v_v_ints.capacity() <= cur_capacity) { v_v_ints.push_back(ref_vec); } //v_v_ints has been resized #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) CPPUNIT_ASSERT((pint == &v_v_ints.front().front())); #endif //cout << "vector<vector<int>>::erase"; //We need at least 3 elements: while (v_v_ints.size() < 3) { v_v_ints.push_back(ref_vec); } //We erase the 2nd #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) pint = &v_v_ints[2].front(); #endif v_v_ints.erase(v_v_ints.begin() + 1); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) CPPUNIT_ASSERT((pint == &v_v_ints[1].front())); #endif //cout << "vector<string>"; string const ref_str("ref string, big enough to be a dynamic one"); vector<string> vec_strs(1, ref_str); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) char const* pstr = vec_strs.front().c_str(); #endif cur_capacity = vec_strs.capacity(); while (vec_strs.capacity() <= cur_capacity) { vec_strs.push_back(ref_str); } //vec_str has been resized #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) CPPUNIT_ASSERT((pstr == vec_strs.front().c_str())); #endif //cout << "vector<string>::erase"; //We need at least 3 elements: while (vec_strs.size() < 3) { vec_strs.push_back(ref_str); } //We erase the 2nd #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) pstr = vec_strs[2].c_str(); #endif vec_strs.erase(vec_strs.begin() + 1); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) CPPUNIT_ASSERT((pstr == vec_strs[1].c_str())); #endif //cout << "swap(vector<int>, vector<int>)"; vector<int> elem1(10, 0), elem2(10, 0); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) int *p1 = &elem1.front(); int *p2 = &elem2.front(); #endif swap(elem1, elem2); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) CPPUNIT_ASSERT(((p1 == &elem2.front()) && (p2 == &elem1.front()))); #endif { vector<bool> bit_vec(5, true); bit_vec.insert(bit_vec.end(), 5, false); vector<vector<bool> > v_v_bits(1, bit_vec); /* * This is a STLport specific test as we are using internal implementation * details to check that the move has been correctly handled. For other * STL implementation it is only a compile check. */ #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) # if defined (_STLP_DEBUG) unsigned int *punit = v_v_bits.front().begin()._M_iterator._M_p; # else unsigned int *punit = v_v_bits.front().begin()._M_p; # endif #endif cur_capacity = v_v_bits.capacity(); while (v_v_bits.capacity() <= cur_capacity) { v_v_bits.push_back(bit_vec); } #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) //v_v_bits has been resized # if defined (_STLP_DEBUG) CPPUNIT_ASSERT( punit == v_v_bits.front().begin()._M_iterator._M_p ); # else CPPUNIT_ASSERT( punit == v_v_bits.front().begin()._M_p ); # endif #endif } // zero: don't like this kind of tests // because of template test function // we should find another way to provide // move constructor testing... /* standard_test1(list<int>(10)); standard_test1(slist<int>(10)); standard_test1(deque<int>(10)); */ /* int int_values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; set<int> int_set(int_values, int_values + sizeof(in_values) / sizeof(int)); standard_test1(int_set); multiset<int> int_multiset(int_values, int_values + sizeof(in_values) / sizeof(int)); standard_test1(int_multiset); */ /* CheckFullMoveSupport(string()); CheckFullMoveSupport(vector<int>()); CheckFullMoveSupport(deque<int>()); CheckFullMoveSupport(list<int>()); CheckFullMoveSupport(slist<int>()); */ } void MoveConstructorTest::deque_test() { //Check the insert range method. //To the front: { # if!defined (STLPORT) ||!defined (_STLP_DEBUG) ||!defined (_STLP_NO_MEMBER_TEMPLATES) deque<vector<int> > vect_deque; vector<int*> bufs; vect_deque.assign(3, vector<int>(10)); bufs.push_back(&vect_deque[0].front()); bufs.push_back(&vect_deque[1].front()); bufs.push_back(&vect_deque[2].front()); int nb_insert = 5; //Initialize to 1 to generate a front insertion: int pos = 1; while (nb_insert--) { vector<vector<int> > vect_vect(2, vector<int>(10)); vect_deque.insert(vect_deque.begin() + pos, vect_vect.begin(), vect_vect.end()); bufs.insert(bufs.begin() + pos, &vect_deque[pos].front()); bufs.insert(bufs.begin() + pos + 1, &vect_deque[pos + 1].front()); ++pos; } CPPUNIT_ASSERT( vect_deque.size() == 13 ); # if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) for (int i = 0; i < 5; ++i) { CPPUNIT_ASSERT( bufs[i] == &vect_deque[i].front() ); CPPUNIT_ASSERT( bufs[11 - i] == &vect_deque[11 - i].front() ); } # endif # endif } //To the back { # if!defined (STLPORT) ||!defined (_STLP_DEBUG) ||!defined (_STLP_NO_MEMBER_TEMPLATES) deque<vector<int> > vect_deque; vector<int*> bufs; vect_deque.assign(3, vector<int>(10)); bufs.push_back(&vect_deque[0].front()); bufs.push_back(&vect_deque[1].front()); bufs.push_back(&vect_deque[2].front()); int nb_insert = 5; //Initialize to 2 to generate a back insertion: int pos = 2; while (nb_insert--) { vector<vector<int> > vect_vect(2, vector<int>(10)); vect_deque.insert(vect_deque.begin() + pos, vect_vect.begin(), vect_vect.end()); bufs.insert(bufs.begin() + pos, &vect_deque[pos].front()); bufs.insert(bufs.begin() + pos + 1, &vect_deque[pos + 1].front()); ++pos; } CPPUNIT_ASSERT( vect_deque.size() == 13 ); # if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) for (int i = 0; i < 5; ++i) { CPPUNIT_ASSERT( bufs[i + 1] == &vect_deque[i + 1].front() ); CPPUNIT_ASSERT( bufs[12 - i] == &vect_deque[12 - i].front() ); } # endif # endif } //Check the different erase methods. { deque<vector<int> > vect_deque; vect_deque.assign(20, vector<int>(10)); deque<vector<int> >::iterator vdit(vect_deque.begin()), vditEnd(vect_deque.end()); vector<int*> bufs; for (; vdit!= vditEnd; ++vdit) { bufs.push_back(&vdit->front()); } { // This check, repeated after each operation, check the deque consistency: deque<vector<int> >::iterator it = vect_deque.end() - 5; int nb_incr = 0; for (; it!= vect_deque.end() && nb_incr <= 6; ++nb_incr, ++it) {} CPPUNIT_ASSERT( nb_incr == 5 ); } { //erase in front: vect_deque.erase(vect_deque.begin() + 2); bufs.erase(bufs.begin() + 2); CPPUNIT_ASSERT( vect_deque.size() == 19 ); deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { deque<vector<int> >::iterator it = vect_deque.end() - 5; int nb_incr = 0; for (; it!= vect_deque.end() && nb_incr <= 6; ++nb_incr, ++it) {} CPPUNIT_ASSERT( nb_incr == 5 ); } { //erase in the back: vect_deque.erase(vect_deque.end() - 2); bufs.erase(bufs.end() - 2); CPPUNIT_ASSERT( vect_deque.size() == 18 ); deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { deque<vector<int> >::iterator it = vect_deque.end() - 5; int nb_incr = 0; for (; it!= vect_deque.end() && nb_incr < 6; ++nb_incr, ++it) {} CPPUNIT_ASSERT( nb_incr == 5 ); } { //range erase in front vect_deque.erase(vect_deque.begin() + 3, vect_deque.begin() + 5); bufs.erase(bufs.begin() + 3, bufs.begin() + 5); CPPUNIT_ASSERT( vect_deque.size() == 16 ); deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { deque<vector<int> >::iterator it = vect_deque.end() - 5; int nb_incr = 0; for (; it!= vect_deque.end() && nb_incr <= 6; ++nb_incr, ++it) {} CPPUNIT_ASSERT( nb_incr == 5 ); } { //range erase in back vect_deque.erase(vect_deque.end() - 5, vect_deque.end() - 3); bufs.erase(bufs.end() - 5, bufs.end() - 3); CPPUNIT_ASSERT( vect_deque.size() == 14 ); deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } } //Check the insert value(s) { deque<vector<int> > vect_deque; vect_deque.assign(20, vector<int>(10)); deque<vector<int> >::iterator vdit(vect_deque.begin()), vditEnd(vect_deque.end()); vector<int*> bufs; for (; vdit!= vditEnd; ++vdit) { bufs.push_back(&vdit->front()); } { //2 values in front: vect_deque.insert(vect_deque.begin() + 2, 2, vector<int>(10)); bufs.insert(bufs.begin() + 2, &vect_deque[2].front()); bufs.insert(bufs.begin() + 3, &vect_deque[3].front()); CPPUNIT_ASSERT( vect_deque.size() == 22 ); deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { //2 values in back: vect_deque.insert(vect_deque.end() - 2, 2, vector<int>(10)); bufs.insert(bufs.end() - 2, &vect_deque[20].front()); bufs.insert(bufs.end() - 2, &vect_deque[21].front()); CPPUNIT_ASSERT( vect_deque.size() == 24 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { //1 value in front: deque<vector<int> >::iterator ret; ret = vect_deque.insert(vect_deque.begin() + 2, vector<int>(10)); bufs.insert(bufs.begin() + 2, &vect_deque[2].front()); CPPUNIT_ASSERT( vect_deque.size() == 25 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) CPPUNIT_ASSERT( &ret->front() == bufs[2] ); deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { //1 value in back: deque<vector<int> >::iterator ret; ret = vect_deque.insert(vect_deque.end() - 2, vector<int>(10)); bufs.insert(bufs.end() - 2, &vect_deque[23].front()); CPPUNIT_ASSERT( vect_deque.size() == 26 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) CPPUNIT_ASSERT( &ret->front() == bufs[23] ); deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } } } void MoveConstructorTest::vector_test() { //Check the insert range method. //To the front: { vector<vector<int> > vect_vector; vector<int*> bufs; vect_vector.assign(3, vector<int>(10)); bufs.push_back(&vect_vector[0].front()); bufs.push_back(&vect_vector[1].front()); bufs.push_back(&vect_vector[2].front()); int nb_insert = 5; int pos = 1; while (nb_insert--) { vector<vector<int> > vect_vect(2, vector<int>(10)); vect_vector.insert(vect_vector.begin() + pos, vect_vect.begin(), vect_vect.end()); bufs.insert(bufs.begin() + pos, &vect_vector[pos].front()); bufs.insert(bufs.begin() + pos + 1, &vect_vector[pos + 1].front()); ++pos; } CPPUNIT_ASSERT( vect_vector.size() == 13 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) for (int i = 0; i < 5; ++i) { CPPUNIT_ASSERT( bufs[i] == &vect_vector[i].front() ); CPPUNIT_ASSERT( bufs[11 - i] == &vect_vector[11 - i].front() ); } #endif } //To the back { vector<vector<int> > vect_vector; vector<int*> bufs; vect_vector.assign(3, vector<int>(10)); bufs.push_back(&vect_vector[0].front()); bufs.push_back(&vect_vector[1].front()); bufs.push_back(&vect_vector[2].front()); int nb_insert = 5; //Initialize to 2 to generate a back insertion: int pos = 2; while (nb_insert--) { vector<vector<int> > vect_vect(2, vector<int>(10)); vect_vector.insert(vect_vector.begin() + pos, vect_vect.begin(), vect_vect.end()); bufs.insert(bufs.begin() + pos, &vect_vector[pos].front()); bufs.insert(bufs.begin() + pos + 1, &vect_vector[pos + 1].front()); ++pos; } CPPUNIT_ASSERT( vect_vector.size() == 13 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) for (int i = 0; i < 5; ++i) { CPPUNIT_ASSERT( bufs[i + 1] == &vect_vector[i + 1].front() ); CPPUNIT_ASSERT( bufs[12 - i] == &vect_vector[12 - i].front() ); } #endif } //Check the different erase methods. { vector<vector<int> > vect_vector; vect_vector.assign(20, vector<int>(10)); vector<vector<int> >::iterator vdit(vect_vector.begin()), vditEnd(vect_vector.end()); vector<int*> bufs; for (; vdit!= vditEnd; ++vdit) { bufs.push_back(&vdit->front()); } { // This check, repeated after each operation, check the vector consistency: vector<vector<int> >::iterator it = vect_vector.end() - 5; int nb_incr = 0; for (; it!= vect_vector.end() && nb_incr <= 6; ++nb_incr, ++it) {} CPPUNIT_ASSERT( nb_incr == 5 ); } { //erase in front: vect_vector.erase(vect_vector.begin() + 2); bufs.erase(bufs.begin() + 2); CPPUNIT_ASSERT( vect_vector.size() == 19 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { vector<vector<int> >::iterator it = vect_vector.end() - 5; int nb_incr = 0; for (; it!= vect_vector.end() && nb_incr <= 6; ++nb_incr, ++it) {} CPPUNIT_ASSERT( nb_incr == 5 ); } { //erase in the back: vect_vector.erase(vect_vector.end() - 2); bufs.erase(bufs.end() - 2); CPPUNIT_ASSERT( vect_vector.size() == 18 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { vector<vector<int> >::iterator it = vect_vector.end() - 5; int nb_incr = 0; for (; it!= vect_vector.end() && nb_incr < 6; ++nb_incr, ++it) {} CPPUNIT_ASSERT( nb_incr == 5 ); } { //range erase in front vect_vector.erase(vect_vector.begin() + 3, vect_vector.begin() + 5); bufs.erase(bufs.begin() + 3, bufs.begin() + 5); CPPUNIT_ASSERT( vect_vector.size() == 16 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { vector<vector<int> >::iterator it = vect_vector.end() - 5; int nb_incr = 0; for (; it!= vect_vector.end() && nb_incr <= 6; ++nb_incr, ++it) {} CPPUNIT_ASSERT( nb_incr == 5 ); } { //range erase in back vect_vector.erase(vect_vector.end() - 5, vect_vector.end() - 3); bufs.erase(bufs.end() - 5, bufs.end() - 3); CPPUNIT_ASSERT( vect_vector.size() == 14 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } } //Check the insert value(s) { vector<vector<int> > vect_vector; vect_vector.assign(20, vector<int>(10)); vector<vector<int> >::iterator vdit(vect_vector.begin()), vditEnd(vect_vector.end()); vector<int*> bufs; for (; vdit!= vditEnd; ++vdit) { bufs.push_back(&vdit->front()); } { //2 values in front: vect_vector.insert(vect_vector.begin() + 2, 2, vector<int>(10)); bufs.insert(bufs.begin() + 2, &vect_vector[2].front()); bufs.insert(bufs.begin() + 3, &vect_vector[3].front()); CPPUNIT_ASSERT( vect_vector.size() == 22 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { //2 values in back: vect_vector.insert(vect_vector.end() - 2, 2, vector<int>(10)); bufs.insert(bufs.end() - 2, &vect_vector[20].front()); bufs.insert(bufs.end() - 2, &vect_vector[21].front()); CPPUNIT_ASSERT( vect_vector.size() == 24 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { //1 value in front: #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) vector<vector<int> >::iterator ret = #endif vect_vector.insert(vect_vector.begin() + 2, vector<int>(10)); bufs.insert(bufs.begin() + 2, &vect_vector[2].front()); CPPUNIT_ASSERT( vect_vector.size() == 25 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) CPPUNIT_ASSERT( &ret->front() == bufs[2] ); vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } { //1 value in back: #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) vector<vector<int> >::iterator ret = #endif vect_vector.insert(vect_vector.end() - 2, vector<int>(10)); bufs.insert(bufs.end() - 2, &vect_vector[23].front()); CPPUNIT_ASSERT( vect_vector.size() == 26 ); #if defined (STLPORT) &&!defined (_STLP_NO_MOVE_SEMANTIC) CPPUNIT_ASSERT( &ret->front() == bufs[23] ); vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); for (size_t i = 0; dit!= ditEnd; ++dit, ++i) { CPPUNIT_ASSERT( bufs[i] == &dit->front() ); } #endif } } //The following tests are checking move contructor implementations: const string long_str("long enough string to force dynamic allocation"); { //vector move contructor: vector<vector<string> > vect(10, vector<string>(10, long_str)); vector<string> strs; size_t index = 0; for (;;) { vector<vector<string> >::iterator it(vect.begin()); advance(it, index % vect.size()); strs.push_back(it->front()); it->erase(it->begin()); if (it->empty()) { vect.erase(it); if (vect.empty()) break; } index += 3; } CPPUNIT_ASSERT( strs.size() == 10 * 10 ); vector<string>::iterator it(strs.begin()), itEnd(strs.end()); for (; it!= itEnd; ++it) { CPPUNIT_ASSERT( *it == long_str ); } } { //deque move contructor: # if!defined (__DMC__) vector<deque<string> > vect(10, deque<string>(10, long_str)); # else deque<string> deq_str = deque<string>(10, long_str); vector<deque<string> > vect(10, deq_str); # endif vector<string> strs; size_t index = 0; for (;;) { vector<deque<string> >::iterator it(vect.begin()); advance(it, index % vect.size()); strs.push_back(it->front()); it->pop_front(); if (it->empty()) { vect.erase(it); if (vect.empty()) break; } index += 3; } CPPUNIT_ASSERT( strs.size() == 10 * 10 ); vector<string>::iterator it(strs.begin()), itEnd(strs.end()); for (; it!= itEnd; ++it) { CPPUNIT_ASSERT( *it == long_str ); } } { //list move contructor: vector<list<string> > vect(10, list<string>(10, long_str)); vector<string> strs; size_t index = 0; for (;;) { vector<list<string> >::iterator it(vect.begin()); advance(it, index % vect.size()); strs.push_back(it->front()); it->pop_front(); if (it->empty()) { vect.erase(it); if (vect.empty()) break; } index += 3; } CPPUNIT_ASSERT( strs.size() == 10 * 10 ); vector<string>::iterator it(strs.begin()), itEnd(strs.end()); for (; it!= itEnd; ++it) { CPPUNIT_ASSERT( *it == long_str ); } } #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) { //slist move contructor: vector<slist<string> > vect(10, slist<string>(10, long_str)); vector<string> strs; size_t index = 0; while (true) { vector<slist<string> >::iterator it(vect.begin()); advance(it, index % vect.size()); strs.push_back(it->front()); it->pop_front(); if (it->empty()) { vect.erase(it); if (vect.empty()) break; } index += 3; } CPPUNIT_ASSERT( strs.size() == 10 * 10 ); vector<string>::iterator it(strs.begin()), itEnd(strs.end()); for (; it!= itEnd; ++it) { CPPUNIT_ASSERT( *it == long_str ); } } #endif { //binary tree move contructor: multiset<string> ref; for (size_t i = 0; i < 10; ++i) { ref.insert(long_str); } vector<multiset<string> > vect(10, ref); vector<string> strs; size_t index = 0; for (;;) { vector<multiset<string> >::iterator it(vect.begin()); advance(it, index % vect.size()); strs.push_back(*it->begin()); it->erase(it->begin()); if (it->empty()) { vect.erase(it); if (vect.empty()) break; } index += 3; } CPPUNIT_ASSERT( strs.size() == 10 * 10 ); vector<string>::iterator it(strs.begin()), itEnd(strs.end()); for (; it!= itEnd; ++it) { CPPUNIT_ASSERT( *it == long_str ); } } #if defined (STLPORT) # if!defined (__DMC__) { //hash container move contructor: unordered_multiset<string> ref; for (size_t i = 0; i < 10; ++i) { ref.insert(long_str); } vector<unordered_multiset<string> > vect(10, ref); vector<string> strs; size_t index = 0; while (true) { vector<unordered_multiset<string> >::iterator it(vect.begin()); advance(it, index % vect.size()); strs.push_back(*it->begin()); it->erase(it->begin()); if (it->empty()) { vect.erase(it); if (vect.empty()) break; } index += 3; } CPPUNIT_ASSERT( strs.size() == 10 * 10 ); vector<string>::iterator it(strs.begin()), itEnd(strs.end()); for (; it!= itEnd; ++it) { CPPUNIT_ASSERT( *it == long_str ); } } # endif #endif } #if defined (__BORLANDC__) /* Specific Borland test case to show a really weird compiler behavior. */ class Standalone { public: //Uncomment following to pass the test //Standalone() {} ~Standalone() {} MovableStruct movableStruct; vector<int> intVector; }; void MoveConstructorTest::nb_destructor_calls() { MovableStruct::reset(); try { Standalone standalone; throw "some exception"; MovableStruct movableStruct; } catch (const char*) { CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 1 ); CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 1 ); } } #endif ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/rvalue1.cpp ======================= // { dg-do run } // PRMS Id: 6000 // Bug: g++ gets confused trying to build up a reference to a cast. class String { protected: char *cp; public: String(char *incp); String(const String &constStringRef); virtual void virtualFn1(void) const {;} }; String::String(char *incp) { cp = incp; } String::String(const String &constStringRef) { // Right here, do an 'info args', and look at the virtual function table // pointer: typically junk! Calling the function through that table could // do anything, since we're really leaping off into the void. This example // goes down with 'SIGBUS', but I've seen 'SIGSEGV' too, and 'SIGILL' is // possible. cp = constStringRef.cp; constStringRef.virtualFn1(); } void foofun(String string) { ; } class Class1 { public: Class1(const String & constStringRef); }; Class1 :: Class1 (const String & constStringRef) { // If instead of calling the function 'foofun()' here, we just assign // 'constStringRef' to a local variable, then the vptr is typically == 0! foofun(String(constStringRef)); } int main(void) { Class1 *class1 = new Class1((char*) "Hi!"); } ======================= File: android-ndk-r10b/tests/device/issue22165-typeinfo/jni/throwable.cpp ======================= <reponame>perezite/Boost4Android #include <iostream> #include "myexception.h" #include "throwable.h" int throw_an_exception() { std::cout << "throw_an_exception()" << std::endl; throw my_exception("my exception"); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/p755.cpp ======================= // { dg-do run } // It checks to see if you can define your own global new operator. // prms-id: 755 #include <stddef.h> #include <new> extern "C" void _exit(int); void* operator new(size_t sz) throw (std::bad_alloc) { void* p = 0; _exit(0); return p; } int main () { int* i = new int; delete i; return 1; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/iota_test.cpp ======================= #include <vector> #include <numeric> #include "cppunit/cppunit_proxy.h" #if defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class IotaTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(IotaTest); #if!defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) CPPUNIT_IGNORE; #endif CPPUNIT_TEST(iota1); CPPUNIT_TEST_SUITE_END(); protected: void iota1(); }; CPPUNIT_TEST_SUITE_REGISTRATION(IotaTest); // // tests implementation // void IotaTest::iota1() { #if defined (STLPORT) &&!defined (_STLP_NO_EXTENSIONS) int numbers[10]; iota(numbers, numbers + 10, 42); CPPUNIT_ASSERT(numbers[0]==42); CPPUNIT_ASSERT(numbers[1]==43); CPPUNIT_ASSERT(numbers[2]==44); CPPUNIT_ASSERT(numbers[3]==45); CPPUNIT_ASSERT(numbers[4]==46); CPPUNIT_ASSERT(numbers[5]==47); CPPUNIT_ASSERT(numbers[6]==48); CPPUNIT_ASSERT(numbers[7]==49); CPPUNIT_ASSERT(numbers[8]==50); CPPUNIT_ASSERT(numbers[9]==51); #endif } ======================= File: android-ndk-r10b/tests/device/test-basic-rtti/jni/test_basic_rtti.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. */ #include <cstdio> class Foo { public: virtual ~Foo() { } virtual void print() { std::printf("in Foo!\n"); } }; class Bar: public Foo { public: void print() { std::printf("in Bar!\n"); } }; int main() { Foo* foo = new Bar(); Bar* bar; bar = dynamic_cast<Bar*>(foo); if (bar!= NULL) { printf("OK: 'foo' is pointing to a Bar class instance.\n"); } else { fprintf(stderr, "KO: Could not dynamically cast 'foo' to a 'Bar*'\n"); return 1; } delete foo; return 0; } ======================= File: android-ndk-r10b/tests/device/test-gnustl-full/unit/num_put_get_test.cpp ======================= #include <limits> #if!defined (STLPORT) ||!defined (_STLP_USE_NO_IOSTREAMS) # include <iomanip> # include <string> # include <sstream> # include <cstdio> /* # include <iostream> # include <ieee754.h> */ # include "complete_digits.h" # include "cppunit/cppunit_proxy.h" # if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; # endif // // TestCase class // class NumPutGetTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(NumPutGetTest); # if defined (__BORLANDC__) /* Ignore FPU exceptions, set FPU precision to 64 bits */ unsigned int _float_control_word = _control87(0, 0); _control87(PC_64|MCW_EM|IC_AFFINE, MCW_PC|MCW_EM|MCW_IC); # endif CPPUNIT_TEST(num_put_float); CPPUNIT_TEST(num_put_integer); CPPUNIT_TEST(num_get_float); CPPUNIT_TEST(num_get_integer); CPPUNIT_TEST(inhex); CPPUNIT_TEST(pointer); CPPUNIT_TEST(fix_float_long); CPPUNIT_TEST(custom_numpunct); # if defined (__BORLANDC__) /* Reset floating point control word */ _clear87(); _control87(_float_control_word, MCW_PC|MCW_EM|MCW_IC); # endif CPPUNIT_TEST_SUITE_END(); private: void num_put_float(); void num_put_integer(); void num_get_float(); void num_get_integer(); void inhex(); void pointer(); void fix_float_long(); void custom_numpunct(); static bool check_float(float val, float ref) { float epsilon = numeric_limits<float>::epsilon(); return val <= ref + epsilon && val >= ref - epsilon; } static bool check_double(double val, double ref) { double epsilon = numeric_limits<double>::epsilon(); return val <= ref + epsilon && val >= ref - epsilon; } static string reset_stream(ostringstream &ostr) { string tmp = ostr.str(); ostr.str(""); return tmp; } #if!defined (STLPORT) ||!defined (_STLP_NO_MEMBER_TEMPLATES) template <class F> void check_get_float( F v ) { F in_val_d = v; typedef numeric_limits<F> limits; { stringstream str; str << "1E+" << limits::max_exponent10; str >> in_val_d; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_CHECK( in_val_d == in_val_d ); CPPUNIT_CHECK( in_val_d!= limits::infinity() ); } { stringstream str; str << "-1E+" << limits::max_exponent10; str >> in_val_d; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_CHECK( in_val_d == in_val_d ); CPPUNIT_CHECK( in_val_d!= -limits::infinity() ); } { stringstream str; str << "1E" << limits::min_exponent10; str >> in_val_d; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_CHECK( in_val_d == in_val_d ); CPPUNIT_CHECK( in_val_d!= F(0.0) ); } { stringstream str; str << "1E+" << (limits::max_exponent10 + 1); str >> in_val_d; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_CHECK( in_val_d == in_val_d ); CPPUNIT_CHECK( in_val_d == limits::infinity() ); } { stringstream str; str << "-1E+" << (limits::max_exponent10 + 1); str >> in_val_d; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_CHECK( in_val_d == in_val_d ); CPPUNIT_CHECK( in_val_d == -limits::infinity() ); } { stringstream str; str << "1E" << (limits::min_exponent10 - 1); str >> in_val_d; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_CHECK( in_val_d == in_val_d ); CPPUNIT_CHECK( in_val_d >= F(0.0) && in_val_d <= limits::min() ); } #if!defined (__MINGW32__) { stringstream str; str << limits::max(); CPPUNIT_ASSERT(!str.fail()); CPPUNIT_CHECK( str.str()!= "inf" ); CPPUNIT_CHECK( str.str()!= "-inf" ); CPPUNIT_CHECK( str.str()!= "nan" ); CPPUNIT_CHECK( str.str()!= "-nan" ); //CPPUNIT_MESSAGE( str.str().c_str() ); //str.str(""); //str << limits::max_exponent10; //CPPUNIT_MESSAGE( str.str().c_str() ); str >> in_val_d; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_CHECK( in_val_d == in_val_d ); CPPUNIT_CHECK( in_val_d!= limits::infinity() ); } { stringstream str; str << fixed << limits::max(); CPPUNIT_ASSERT(!str.fail()); CPPUNIT_CHECK( str.str()!= "inf" ); CPPUNIT_CHECK( str.str()!= "-inf" ); CPPUNIT_CHECK( str.str()!= "nan" ); CPPUNIT_CHECK( str.str()!= "-nan" ); //CPPUNIT_MESSAGE( str.str().c_str() ); //str.str(""); //str << limits::max_exponent10; //CPPUNIT_MESSAGE( str.str().c_str() ); str >> in_val_d; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_CHECK( in_val_d == in_val_d ); CPPUNIT_CHECK( in_val_d!= limits::infinity() ); } { stringstream str; str << scientific << setprecision(50) << limits::max(); CPPUNIT_ASSERT(!str.fail()); CPPUNIT_CHECK( str.str()!= "inf" ); CPPUNIT_CHECK( str.str()!= "-inf" ); CPPUNIT_CHECK( str.str()!= "nan" ); CPPUNIT_CHECK( str.str()!= "-nan" ); //CPPUNIT_MESSAGE( str.str().c_str() ); //str.str(""); //str << limits::max_exponent10; //CPPUNIT_MESSAGE( str.str().c_str() ); str >> in_val_d; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_CHECK( in_val_d == in_val_d ); CPPUNIT_CHECK( in_val_d!= limits::infinity() ); } #endif { stringstream str; str << limits::infinity(); CPPUNIT_ASSERT(!str.fail() ); CPPUNIT_ASSERT(!limits::has_infinity || str.str() == "inf" ); } { stringstream str; str << -limits::infinity(); CPPUNIT_ASSERT(!str.fail() ); CPPUNIT_ASSERT(!limits::has_infinity || str.str() == "-inf" ); } { stringstream str; str << limits::quiet_NaN(); CPPUNIT_ASSERT(!str.fail() ); CPPUNIT_ASSERT(!limits::has_quiet_NaN || str.str() == "nan" ); } { stringstream str; str << -limits::quiet_NaN(); CPPUNIT_ASSERT(!str.fail() ); CPPUNIT_ASSERT(!limits::has_quiet_NaN || str.str() == "-nan" ); } { stringstream str; str << "0." << string(limits::max_exponent10, '0') << "1e" << (limits::max_exponent10 + 1); CPPUNIT_ASSERT(!str.fail() ); str >> in_val_d; CPPUNIT_ASSERT(!str.fail() ); CPPUNIT_ASSERT( str.eof() ); CPPUNIT_CHECK( in_val_d == 1 ); } { stringstream str; str << "1" << string(-(limits::min_exponent10 - 1), '0') << "e" << (limits::min_exponent10 - 1); CPPUNIT_ASSERT(!str.fail() ); str >> in_val_d; CPPUNIT_ASSERT(!str.fail() ); CPPUNIT_ASSERT( str.eof() ); CPPUNIT_CHECK( in_val_d == 1 ); } # if defined (_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x530) // The following tests are showing that simply changing stream // precision lead to different result. Do not seems to be a real // problem, simply rounding approximation but additional study should // be done after 5.2 release. { stringstream str; str << setprecision(limits::digits10 + 2) << limits::max(); CPPUNIT_MESSAGE(str.str().c_str()); CPPUNIT_ASSERT(!str.fail() ); F val; str >> val; CPPUNIT_ASSERT(!str.fail() ); CPPUNIT_ASSERT( limits::infinity() > val ); } { stringstream str; str << setprecision(limits::digits10 + 1) << limits::max(); CPPUNIT_MESSAGE(str.str().c_str()); CPPUNIT_ASSERT(!str.fail() ); F val; str >> val; CPPUNIT_ASSERT(!str.fail() ); CPPUNIT_ASSERT( limits::infinity() > val ); } # endif } #else # define __check_get_float( F ) \ void check_get_float( F v ) \ { \ F in_val_d = v; \ { \ stringstream str; \ \ str << "1E+" << numeric_limits<F>::max_exponent10; \ \ str >> in_val_d; \ CPPUNIT_ASSERT(!str.fail()); \ CPPUNIT_ASSERT(str.eof()); \ CPPUNIT_CHECK( in_val_d == in_val_d ); \ CPPUNIT_CHECK( in_val_d!= numeric_limits<F>::infinity() ); \ } \ { \ stringstream str; \ \ str << "-1E+" << numeric_limits<F>::max_exponent10; \ \ str >> in_val_d; \ CPPUNIT_ASSERT(!str.fail()); \ CPPUNIT_ASSERT(str.eof()); \ CPPUNIT_CHECK( in_val_d == in_val_d ); \ CPPUNIT_CHECK( in_val_d!= -numeric_limits<F>::infinity() ); \ } \ { \ stringstream str; \ \ str << "1E" << numeric_limits<F>::min_exponent10; \ \ str >> in_val_d; \ CPPUNIT_ASSERT(!str.fail()); \ CPPUNIT_ASSERT(str.eof()); \ CPPUNIT_CHECK( in_val_d == in_val_d ); \ CPPUNIT_CHECK( in_val_d!= F(0.0) ); \ } \ { \ stringstream str; \ \ str << "1E+" << (numeric_limits<F>::max_exponent10 + 1); \ \ str >> in_val_d; \ CPPUNIT_ASSERT(!str.fail()); \ CPPUNIT_ASSERT(str.eof()); \ CPPUNIT_CHECK( in_val_d == in_val_d ); \ CPPUNIT_CHECK( in_val_d == numeric_limits<F>::infinity() ); \ } \ { \ stringstream str; \ \ str << "-1E+" << (numeric_limits<F>::max_exponent10 + 1); \ \ str >> in_val_d; \ CPPUNIT_ASSERT(!str.fail()); \ CPPUNIT_ASSERT(str.eof()); \ CPPUNIT_CHECK( in_val_d == in_val_d ); \ CPPUNIT_CHECK( in_val_d == -numeric_limits<F>::infinity() ); \ } \ { \ stringstream str; \ \ str << "1E" << (numeric_limits<F>::min_exponent10 - 1); \ \ str >> in_val_d; \ CPPUNIT_ASSERT(!str.fail()); \ CPPUNIT_ASSERT(str.eof()); \ CPPUNIT_CHECK( in_val_d == in_val_d ); \ CPPUNIT_CHECK( in_val_d >= F(0.0) && in_val_d <= numeric_limits<F>::min() ); \ } \ } __check_get_float( float ) __check_get_float( double ) # if!defined (STLPORT) ||!defined (_STLP_NO_LONG_DOUBLE) __check_get_float( long double ) # endif # undef __check_get_float #endif // _STLP_NO_MEMBER_TEMPLATES }; CPPUNIT_TEST_SUITE_REGISTRATION(NumPutGetTest); #if defined (_MSC_VER) # pragma warning (disable : 4056) # pragma warning (disable : 4756) #endif // // tests implementation // void NumPutGetTest::num_put_float() { { string output, digits; { ostringstream ostr; ostr << 1.23457e+17f; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); digits = "17"; complete_digits(digits); CPPUNIT_CHECK(output == string("1.23457e+") + digits ); } { ostringstream ostr; ostr << setprecision(200) << 1.23457e+17f; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK( output.size() < 200 ); } { ostringstream ostr; ostr << setprecision(200) << numeric_limits<float>::min(); CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK( output.size() < 200 ); } { ostringstream ostr; ostr << fixed << 1.23457e+17f; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK(output.size() == 25); CPPUNIT_CHECK(output.substr(0, 5) == "12345"); CPPUNIT_CHECK(output.substr(18) == ".000000"); } { ostringstream ostr; ostr << fixed << showpos << 1.23457e+17f; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK(output.size() == 26); CPPUNIT_CHECK(output.substr(0, 6) == "+12345"); CPPUNIT_CHECK(output.substr(19) == ".000000"); } { ostringstream ostr; ostr << fixed << showpos << setprecision(100) << 1.23457e+17f; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK(output.size() == 120); CPPUNIT_CHECK(output.substr(0, 6) == "+12345"); CPPUNIT_CHECK(output.substr(19) == ".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ); } { ostringstream ostr; ostr << scientific << setprecision(8) << 0.12345678f; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); digits = "1"; complete_digits(digits); CPPUNIT_CHECK(output == string("1.23456780e-") + digits ); } { ostringstream ostr; ostr << fixed << setprecision(8) << setw(30) << setfill('0') << 0.12345678f; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK(output == "000000000000000000000.12345678"); } { ostringstream ostr; ostr << fixed << showpos << setprecision(8) << setw(30) << setfill('0') << 0.12345678f; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK(output == "0000000000000000000+0.12345678"); } { ostringstream ostr; ostr << fixed << showpos << setprecision(8) << setw(30) << left << setfill('0') << 0.12345678f; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK(output == "+0.123456780000000000000000000"); } { ostringstream ostr; ostr << fixed << showpos << setprecision(8) << setw(30) << internal << setfill('0') << 0.12345678f; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK(output == "+00000000000000000000.12345678"); } { ostringstream ostr; ostr << fixed << showpos << setprecision(100) << 1.234567e+17; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK(output.size() == 120); CPPUNIT_CHECK(output.substr(0, 6) == "+12345"); CPPUNIT_CHECK(output.substr(19) == ".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ); } #if!defined (STLPORT) ||!defined (_STLP_NO_LONG_DOUBLE) { ostringstream ostr; ostr << fixed << showpos << setprecision(100) << 1.234567e+17l; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK(output.size() == 120); CPPUNIT_CHECK(output.substr(0, 6) == "+12345"); CPPUNIT_CHECK(output.substr(19) == ".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ); } #endif { ostringstream ostr; ostr << scientific << setprecision(50) << 0.0; CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); CPPUNIT_CHECK( output == "0.00000000000000000000000000000000000000000000000000e+00" ); } { ostringstream ostr; ostr << fixed << setprecision(100) << numeric_limits<float>::max(); CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); //CPPUNIT_MESSAGE( output.c_str() ); } { ostringstream ostr; ostr << setprecision(100) << numeric_limits<double>::max(); CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); //CPPUNIT_MESSAGE( output.c_str() ); } #if!defined (STLPORT) ||!defined (_STLP_NO_LONG_DOUBLE) { ostringstream ostr; ostr << setprecision(100) << numeric_limits<long double>::max(); CPPUNIT_ASSERT(ostr.good()); output = reset_stream(ostr); //CPPUNIT_MESSAGE( output.c_str() ); } #endif //{ // ostringstream ostr; // ostr << setprecision(-numeric_limits<float>::min_exponent10 + numeric_limits<float>::digits10 + 9) << numeric_limits<float>::min(); // CPPUNIT_ASSERT(ostr.good()); // output = reset_stream(ostr); // //CPPUNIT_MESSAGE( output.c_str() ); //} //{ // ostringstream ostr; // ostr << setprecision(-numeric_limits<double>::min_exponent10 + numeric_limits<double>::digits10) << numeric_limits<double>::min(); // CPPUNIT_ASSERT(ostr.good()); // output = reset_stream(ostr); // //CPPUNIT_MESSAGE( output.c_str() ); //} //#if!defined (STLPORT) ||!defined (_STLP_NO_LONG_DOUBLE) // { // ostringstream ostr; // ostr << setprecision(-numeric_limits<long double>::min_exponent10 + numeric_limits<long double>::digits10) << numeric_limits<long double>::min(); // CPPUNIT_ASSERT(ostr.good()); // output = reset_stream(ostr); // CPPUNIT_MESSAGE( output.c_str() ); // } //#endif } { ostringstream str; str.setf(ios::fixed, ios::floatfield); str << 1.0e+5; // cerr << str.str() << endl; CPPUNIT_CHECK( str.str() == "100000.000000" ); reset_stream(str); str.precision(0); str << 1.0e+5; CPPUNIT_CHECK( str.str() == "100000" ); reset_stream(str); str.precision(4); str << 1.0e+5; CPPUNIT_CHECK( str.str() == "100000.0000" ); reset_stream(str); str.precision(0); str << 1.0e+83; CPPUNIT_CHECK( str.str().size() == 84 ); //printf("\nC result: %.0f\n", 1.0e+83); //CPPUNIT_MESSAGE( str.str().c_str() ); //CPPUNIT_CHECK( str.str() == "100000000000000000000000000000000000000000000000000000000000000000000000000000000000" ); // cerr.setf(ios::fixed, ios::floatfield); // cerr << DBL_MAX << endl; // cerr << 1.0e+37 << endl; } } #define CHECK_COMPLETE(type, val, base, showbase, showpos, casing, width, adjust, expected) \ { \ type tmp = val; \ ostringstream ostr; \ ostr << base << showbase << showpos << casing << setw(width) << adjust << tmp; \ CPPUNIT_CHECK( ostr.str() == expected ); \ } #define CHECK(type, val, base, expected) \ CHECK_COMPLETE(type, val, base, noshowbase, noshowpos, nouppercase, 0, right, expected) void NumPutGetTest::num_put_integer() { //octal outputs { CHECK(short, 0, oct, "0") CHECK(short, 1, oct, "1") CHECK(short, 12345, oct, "30071") if (sizeof(short) == 2) { CHECK(short, -1, oct, "177777") CHECK(short, -12345, oct, "147707") } CHECK(unsigned short, 0, oct, "0") CHECK(unsigned short, 12345, oct, "30071") CHECK(int, 0, oct, "0") CHECK(int, 12345678, oct, "57060516") if (sizeof(int) == 4) { CHECK(int, -1, oct, "37777777777") CHECK(int, -12345678, oct, "37720717262") } CHECK(unsigned int, 0, oct, "0") CHECK(unsigned int, 12345678, oct, "57060516") CHECK(long, 0, oct, "0") CHECK(long, 12345678, oct, "57060516") if (sizeof(long) == 4) { CHECK(long, -1, oct, "37777777777") CHECK(long, -12345678, oct, "37720717262") } CHECK(unsigned long, 0, oct, "0") CHECK(unsigned long, 12345678, oct, "57060516") #if defined (STLPORT) && defined (_STLP_LONG_LONG) CHECK(_STLP_LONG_LONG, 0, oct, "0") CHECK(_STLP_LONG_LONG, 12345678, oct, "57060516") if (sizeof(_STLP_LONG_LONG) == 8) { CHECK(_STLP_LONG_LONG, -1, oct, "1777777777777777777777") CHECK(_STLP_LONG_LONG, -12345678, oct, "1777777777777720717262") } CHECK(unsigned _STLP_LONG_LONG, 0, oct, "0") CHECK(unsigned _STLP_LONG_LONG, 12345678, oct, "57060516") #endif //Even with showbase, 0 value gives "0" (see printf documentation) CHECK_COMPLETE(short, 0, oct, showbase, noshowpos, nouppercase, 0, right, "0") CHECK_COMPLETE(short, 0, oct, showbase, showpos, nouppercase, 6, right, " 0") CHECK_COMPLETE(short, 1, oct, showbase, noshowpos, nouppercase, 6, right, " 01") CHECK_COMPLETE(short, 1, oct, showbase, noshowpos, nouppercase, 6, left, "01 ") CHECK_COMPLETE(short, 1, oct, showbase, showpos, nouppercase, 6, internal, " 01") } //decimal outputs { CHECK(short, 0, dec, "0") CHECK(short, -1, dec, "-1") CHECK(short, 12345, dec, "12345") CHECK(short, -12345, dec, "-12345") CHECK(unsigned short, 0, dec, "0") CHECK(unsigned short, 12345, dec, "12345") CHECK(int, 0, dec, "0") CHECK(int, -1, dec, "-1") CHECK(int, 12345678, dec, "12345678") CHECK(int, -12345678, dec, "-12345678") CHECK(unsigned int, 0, dec, "0") CHECK(unsigned int, 12345678, dec, "12345678") CHECK(long, 0, dec, "0") CHECK(long, -1, dec, "-1") CHECK(long, 12345678, dec, "12345678") CHECK(long, -12345678, dec, "-12345678") CHECK(unsigned long, 0, dec, "0") CHECK(unsigned long, 12345678, dec, "12345678") #if defined (STLPORT) && defined (_STLP_LONG_LONG) CHECK(_STLP_LONG_LONG, 0, dec, "0") CHECK(_STLP_LONG_LONG, -1, dec, "-1") CHECK(_STLP_LONG_LONG, 12345678, dec, "12345678") CHECK(_STLP_LONG_LONG, -12345678, dec, "-12345678") CHECK(unsigned _STLP_LONG_LONG, 0, dec, "0") CHECK(unsigned _STLP_LONG_LONG, 12345678, dec, "12345678") #endif CHECK_COMPLETE(short, 0, dec, showbase, showpos, nouppercase, 0, right, "+0") CHECK_COMPLETE(short, 0, dec, showbase, showpos, nouppercase, 6, right, " +0") CHECK_COMPLETE(short, 1, dec, showbase, showpos, nouppercase, 6, right, " +1") CHECK_COMPLETE(short, 1, dec, showbase, showpos, nouppercase, 6, left, "+1 ") CHECK_COMPLETE(short, 1, dec, showbase, showpos, nouppercase, 6, internal, "+ 1") } //hexadecimal outputs { CHECK(short, 0, hex, "0") CHECK(short, 12345, hex, "3039") if (sizeof(short) == 2) { CHECK(short, -1, hex, "ffff") CHECK(short, -12345, hex, "cfc7") } CHECK(unsigned short, 0, hex, "0") CHECK(unsigned short, 12345, hex, "3039") CHECK(int, 0, hex, "0") CHECK(int, 12345678, hex, "bc614e") if (sizeof(int) == 4) { CHECK(int, -1, hex, "ffffffff") CHECK(int, -12345678, hex, "ff439eb2") } CHECK(unsigned int, 0, hex, "0") CHECK(unsigned int, 12345678, hex, "bc614e") CHECK(long, 0, hex, "0") CHECK(long, 12345678, hex, "bc614e") if (sizeof(long) == 4) { CHECK(long, -1, hex, "ffffffff") CHECK(long, -12345678, hex, "ff439eb2") } CHECK(unsigned long, 0, hex, "0") CHECK(unsigned long, 12345678, hex, "bc614e") #if defined (STLPORT) && defined (_STLP_LONG_LONG) CHECK(_STLP_LONG_LONG, 0, hex, "0") CHECK(_STLP_LONG_LONG, 12345678, hex, "bc614e") if (sizeof(_STLP_LONG_LONG) == 8) { CHECK(_STLP_LONG_LONG, -1, hex, "ffffffffffffffff") CHECK(_STLP_LONG_LONG, -12345678, hex, "ffffffffff439eb2") } CHECK(unsigned _STLP_LONG_LONG, 0, hex, "0") CHECK(unsigned _STLP_LONG_LONG, 12345678, hex, "bc614e") #endif //Even with showbase, 0 value gives "0" output (see printf documentation) CHECK_COMPLETE(short, 0, hex, showbase, showpos, nouppercase, 0, right, "0") CHECK_COMPLETE(short, 0, hex, showbase, noshowpos, nouppercase, 6, right, " 0") CHECK_COMPLETE(short, 0, hex, showbase, noshowpos, nouppercase, 6, internal, " 0") CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, nouppercase, 6, right, " 0x1") CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, nouppercase, 6, left, "0x1 ") CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, nouppercase, 6, internal, "0x 1") CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, uppercase, 6, left, "0X1 ") CHECK_COMPLETE(short, 1, hex, showbase, showpos, uppercase, 6, internal, "0X 1") } } void NumPutGetTest::num_get_float() { float in_val; istringstream istr; istr.str("1.2345"); istr >> in_val; CPPUNIT_ASSERT(!istr.fail()); CPPUNIT_ASSERT(istr.eof()); CPPUNIT_ASSERT(check_float(in_val, 1.2345f)); istr.clear(); istr.str("-1.2345"); istr >> in_val; CPPUNIT_ASSERT(!istr.fail()); CPPUNIT_ASSERT(istr.eof()); CPPUNIT_ASSERT(check_float(in_val, -1.2345f)); istr.clear(); istr.str("+1.2345"); istr >> in_val; CPPUNIT_ASSERT(!istr.fail()); CPPUNIT_ASSERT(check_float(in_val, 1.2345f)); istr.clear(); istr.str("000000000000001.234500000000"); istr >> in_val; CPPUNIT_ASSERT(!istr.fail()); CPPUNIT_ASSERT(istr.eof()); CPPUNIT_ASSERT(check_float(in_val, 1.2345f)); istr.clear(); istr.str("1.2345e+04"); istr >> in_val; CPPUNIT_ASSERT(!istr.fail()); CPPUNIT_ASSERT(istr.eof()); CPPUNIT_ASSERT(check_float(in_val, 12345.0f)); istr.clear(); CPPUNIT_MESSAGE( "float" ); check_get_float( 0.0F ); CPPUNIT_MESSAGE( "double" ); check_get_float( 0.0 ); #if!defined (STLPORT) ||!defined (_STLP_NO_LONG_DOUBLE) CPPUNIT_MESSAGE( "long double" ); check_get_float( 0.0L ); #endif { stringstream str; str << "1e" << numeric_limits<double>::max_exponent10; CPPUNIT_ASSERT(!str.fail()); float val; str >> val; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_ASSERT( numeric_limits<double>::max_exponent10 <= numeric_limits<float>::max_exponent10 || val == numeric_limits<float>::infinity() ); } { stringstream str; str << "1e" << numeric_limits<double>::min_exponent10; CPPUNIT_ASSERT(!str.fail()); float val; str >> val; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_ASSERT( numeric_limits<double>::min_exponent10 >= numeric_limits<float>::min_exponent10 || val == 0.0f ); } #if!defined (STLPORT) ||!defined (_STLP_NO_LONG_DOUBLE) { stringstream str; str << "1e" << numeric_limits<long double>::max_exponent10; CPPUNIT_ASSERT(!str.fail()); double val; str >> val; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_ASSERT( numeric_limits<long double>::max_exponent10 <= numeric_limits<double>::max_exponent10 || val == numeric_limits<double>::infinity() ); } { stringstream str; str << "1e" << numeric_limits<long double>::min_exponent10; CPPUNIT_ASSERT(!str.fail()); double val; str >> val; CPPUNIT_ASSERT(!str.fail()); CPPUNIT_ASSERT(str.eof()); CPPUNIT_ASSERT( numeric_limits<long double>::min_exponent10 >= numeric_limits<double>::min_exponent10 || val == 0.0 ); } { const char* p = "2.718281828459045235360287471352662497757247093e0"; std::stringstream s; s << p; long double x; s >> x; CPPUNIT_ASSERT( x > 2.70l && x < 2.72l ); } #endif } void NumPutGetTest::num_get_integer() { //octal input { istringstream istr; istr.str("30071"); short val; istr >> oct >> val; CPPUNIT_ASSERT(!istr.fail() ); CPPUNIT_ASSERT( istr.eof() ); CPPUNIT_ASSERT( val == 12345 ); istr.clear(); if (sizeof(short) == 2) { istr.str("177777"); istr >> oct >> val; CPPUNIT_ASSERT(!istr.fail() ); CPPUNIT_ASSERT( istr.eof() ); CPPUNIT_ASSERT( val == -1 ); istr.clear(); } } //decimal input { istringstream istr; istr.str("10000"); short val = -1; istr >> val; CPPUNIT_ASSERT(!istr.fail() ); CPPUNIT_ASSERT( istr.eof() ); CPPUNIT_ASSERT( val == 10000 ); istr.clear(); istr.str("+10000"); val = -1; istr >> val; CPPUNIT_ASSERT(!istr.fail() ); CPPUNIT_ASSERT( istr.eof() ); CPPUNIT_ASSERT( val == 10000 ); istr.clear(); if (sizeof(short) == 2) { val = -1; istr.str("10000000"); istr >> val; CPPUNIT_ASSERT( istr.fail() ); CPPUNIT_ASSERT( istr.eof() ); CPPUNIT_ASSERT( val == -1 ); istr.clear(); } val = -1; istr.str("0x0"); istr >> val; CPPUNIT_ASSERT(!istr.fail() ); CPPUNIT_ASSERT(!istr.eof() ); CPPUNIT_ASSERT( val == 0 ); istr.clear(); val = -1; istr.str("000001"); istr >> val; CPPUNIT_ASSERT(!istr.fail() ); CPPUNIT_ASSERT( istr.eof() ); CPPUNIT_ASSERT( val == 1 ); istr.clear(); } //hexadecimal input { istringstream istr; istr.str("3039"); short val = -1; istr >> hex >> val; CPPUNIT_ASSERT(!istr.fail() ); CPPUNIT_ASSERT( istr.eof() ); CPPUNIT_ASSERT( val == 12345 ); istr.clear(); istr.str("x3039"); val = -1; istr >> hex >> val; CPPUNIT_ASSERT( istr.fail() ); CPPUNIT_ASSERT(!istr.eof() ); CPPUNIT_ASSERT( val == -1 ); istr.clear(); istr.str("03039"); val = -1; istr >> hex >> val; CPPUNIT_ASSERT(!istr.fail() ); CPPUNIT_ASSERT( istr.eof() ); CPPUNIT_ASSERT( val == 12345 ); istr.clear(); istr.str("0x3039"); istr >> hex >> val; CPPUNIT_ASSERT(!istr.fail() ); CPPUNIT_ASSERT( istr.eof() ); CPPUNIT_ASSERT( val == 12345 ); istr.clear(); if (sizeof(short) == 2) { val = -1; istr.str("cfc7"); istr >> hex >> val; CPPUNIT_ASSERT(!istr.fail() ); CPPUNIT_ASSERT( istr.eof() ); CPPUNIT_ASSERT( val == -12345 ); istr.clear(); } } } void NumPutGetTest::inhex() { { ostringstream s; s << hex << 0; CPPUNIT_CHECK( s.str() == "0" ); } { ostringstream s; s << hex << 0xff; CPPUNIT_CHECK( s.str() == "ff" ); } { ostringstream s; s << hex << setw( 4 ) << 0xff; CPPUNIT_CHECK( s.str() == " ff" ); } { ostringstream s; s << hex << setw( 4 ) << 0; CPPUNIT_CHECK( s.str() == " 0" ); } { ostringstream s; s << hex << showbase << 0; CPPUNIT_CHECK( s.str() == "0" ); } { ostringstream s; s << hex << showbase << 0xff; CPPUNIT_CHECK( s.str() == "0xff" ); } { ostringstream s; s << hex << showbase << setw( 4 ) << 0xff; CPPUNIT_CHECK( s.str() == "0xff" ); } { // special case for regression (partially duplicate CHECK_COMPLETE above): ostringstream s; s.setf( ios_base::internal, ios_base::adjustfield ); s << hex << showbase << setw(8+2) << 0; CPPUNIT_CHECK( s.str() == " 0" ); } } void NumPutGetTest::pointer() { // Problem with printing pointer to null /* * Really C's formatting not help here, due to: * * p The argument shall be a pointer to void. The value of * the pointer is converted to a sequence of printable characters, * in an implementation-defined manner. */ { /* char buf[128]; void *p = (void *)0xff00; sprintf( buf, "%p", p ); // cerr << buf << endl; // Hmmm, I see 0xff00 on box with 32-bits address; pointer like 'unsigned hex'? if ( sizeof( p ) == 2 ) { CPPUNIT_ASSERT( strcmp( buf, "0xff00" ) == 0 ); } else if ( sizeof( p ) == 4 ) { CPPUNIT_ASSERT( strcmp( buf, "0x0000ff00" ) == 0 ); } else if ( sizeof( p ) == 8 ) { CPPUNIT_ASSERT( strcmp( buf, "0x000000000000ff00" ) == 0 ); } else { CPPUNIT_CHECK( sizeof( p ) == 2 || sizeof( p ) == 4 || sizeof( p ) == 8 ); } */ } { /* char buf[128]; void *p = 0; */ // sprintf( buf, "%p", p ); /* Cool. "%p" print '(nil)'; "%#x" print '0' */ // sprintf( buf, "%#x", (unsigned)p ); // cerr << buf << endl; } { ostringstream s; void *p = (void *)0xff00; s << p; CPPUNIT_ASSERT( s.good() ); if ( sizeof( p ) == 2 ) { CPPUNIT_ASSERT( s.str() == "0xff00" ); } else if ( sizeof( p ) == 4 ) { CPPUNIT_ASSERT( s.str() == "0x0000ff00" ); // this pass } else if ( sizeof( p ) == 8 ) { CPPUNIT_ASSERT( s.str() == "0x000000000000ff00" ); } else { CPPUNIT_CHECK( sizeof( p ) == 2 || sizeof( p ) == 4 || sizeof( p ) == 8 ); } } { ostringstream s; void *p = 0; s << p; CPPUNIT_ASSERT( s.good() ); if ( sizeof( p ) == 2 ) { CPPUNIT_ASSERT( s.str() == "0x0000" ); } else if ( sizeof( p ) == 4 ) { CPPUNIT_ASSERT( s.str() == "0x00000000" ); // but this will fail, if follow %p } else if ( sizeof( p ) == 8 ) { CPPUNIT_ASSERT( s.str() == "0x0000000000000000" ); } else { CPPUNIT_CHECK( sizeof( p ) == 2 || sizeof( p ) == 4 || sizeof( p ) == 8 ); } } } void NumPutGetTest::fix_float_long() { ostringstream str; str.setf(ios::fixed, ios::floatfield); str << 1.0e+5; CPPUNIT_CHECK( str.str() == "100000.000000" ); reset_stream(str); str.precision(0); str << 1.0e+5; CPPUNIT_CHECK( str.str() == "100000" ); reset_stream(str); str.precision(4); str << 1.0e+5; CPPUNIT_CHECK( str.str() == "100000.0000" ); reset_stream(str); str.precision(0); str << 1.0e+83; { istringstream istr( str.str() ); double f; istr >> f; CPPUNIT_CHECK(!istr.fail() ); if ( int(numeric_limits<double>::digits10) < 83 ) { double delta = 1.0; for ( int ee = 83 - int(numeric_limits<double>::digits10); ee > 0; --ee ) { delta *= 10.0; } // we may loss some digits here, but not more than mantissa: CPPUNIT_CHECK( (f > (1.0e+83 - delta)) && (f < (1.0e+83 + delta)) ); } else { CPPUNIT_CHECK( check_double(f, 1.0e+83) ); } } #if 0 // #ifndef _STLP_NO_LONG_DOUBLE reset_stream(str); str.precision(0); str << 1.0e+83l; { istringstream istr( str.str() ); long double f; istr >> f; CPPUNIT_CHECK(!istr.fail() ); if ( int(numeric_limits<long double>::digits10) < 83 ) { long double delta = 1.0l; for ( int ee = 83 - int(numeric_limits<long double>::digits10); ee > 0; --ee ) { delta *= 10.0l; } // we may loss some digits here, but not more than mantissa: cerr << "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" << endl; cerr << str.str() << endl; cerr << delta << endl; cerr << f << endl; CPPUNIT_CHECK( (f > (1.0e+83l - delta)) && (f < (1.0e+83l + delta)) ); } else { CPPUNIT_CHECK( check_double(f, 1.0e+83l) ); } } #endif reset_stream(str); str.precision(0); str << numeric_limits<double>::max(); { istringstream istr( str.str() ); double f; istr >> f; CPPUNIT_CHECK(!istr.fail() ); if ( int(numeric_limits<double>::digits10) < int(numeric_limits<double>::max_exponent10) ) { double delta = 9.0; for ( int ee = int(numeric_limits<double>::max_exponent10) - int(numeric_limits<double>::digits10); ee > 0; --ee ) { delta *= 10.0; } // we may loss some digits here, but not more than mantissa: CPPUNIT_CHECK( (f > (numeric_limits<double>::max() - delta)) ); } } #if 0 // #ifndef _STLP_NO_LONG_DOUBLE reset_stream(str); str.precision(0); str << numeric_limits<long double>::max(); { istringstream istr( str.str() ); long double f; istr >> f; CPPUNIT_CHECK(!istr.fail() ); if ( int(numeric_limits<long double>::digits10) < int(numeric_limits<long double>::max_exponent10) ) { long double delta = 1.0l; for ( int ee = int(numeric_limits<long double>::max_exponent10) - int(numeric_limits<long double>::digits10); ee > 0; --ee ) { delta *= 10.0l; } // we may loss some digits here, but not more than mantissa: CPPUNIT_CHECK( (f > (numeric_limits<long double>::max() - delta)) ); } } #endif } class CommaSepNumPunct : public numpunct<char> { char do_thousands_sep() const { return ','; } string do_grouping() const { return string("\1\2\3") + (char)CHAR_MAX; } }; #define CHECK2(val, expected) \ os.str(""); os << fixed << setprecision(3) << showpos << val; \ CPPUNIT_ASSERT( os.str() == expected ) void NumPutGetTest::custom_numpunct() { ostringstream os; locale loc(os.getloc(), new CommaSepNumPunct()); os.imbue(loc); CHECK2(1, "+1"); CHECK2(10, "+1,0"); CHECK2(100, "+10,0"); CHECK2(1000, "+1,00,0"); CHECK2(1.234, "+1.234"); CHECK2(123.456, "+12,3.456"); CHECK2(1234.567, "+1,23,4.567"); CHECK2(12345.678, "+12,34,5.678"); CHECK2(123456.789, "+123,45,6.789"); CHECK2(1234567.891, "+1,234,56,7.891"); CHECK2(123456789.123, "+123,456,78,9.123"); //CHECK2(100000000000000000000000000000.0, "+100000000000000000000000,000,00,0.000"); CHECK2(numeric_limits<double>::infinity(), "+inf"); CHECK2(-1.234, "-1.234"); CHECK2(-123.456, "-12,3.456"); CHECK2(-1234.567, "-1,23,4.567"); CHECK2(-12345.678, "-12,34,5.678"); CHECK2(-123456.789, "-123,45,6.789"); CHECK2(-1234567.891, "-1,234,56,7.891"); CHECK2(-123456789.123, "-123,456,78,9.123"); //CHECK2(-100000000000000000000000000000.0, "-100000000000000000000000,000,00,0.000"); CHECK2(-numeric_limits<double>::infinity(), "-inf"); } #endif ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/const.cpp ======================= <reponame>perezite/Boost4Android // { dg-do run } // Bug: a ends up in the text segment, so trying to initialize it causes // a seg fault. struct A { int i; A(): i(0) {} A(int j): i(j) {} }; const A a; const A b(1); int main () { return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/vbase4_1.cpp ======================= <gh_stars>1-10 // { dg-do run } // Copyright (C) 2000 Free Software Foundation, Inc. // Contributed by <NAME> 8 Mar 2000 <<EMAIL>> // Derived from PR#7 // We need to destroy the thrown object when exiting the catch // clause. That needs to destroy the original thrown object, not // the caught one (which might be a base). static int ok = 0; struct A { A (){} virtual ~A () {} }; struct B : virtual A { int value; B () :value(10) {} ~B() { if (value == 10) ok = 1; } }; int main() { try { throw B (); } catch (A & e) { } return!ok; } ======================= File: android-ndk-r10b/tests/build/cpp-extensions/jni/foo4.cpp ======================= namespace cpp { extern int foo3(int); int foo4(int x) { return foo3(x) + 4; } } // namespace cpp ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/alias1.cpp ======================= <gh_stars>1-10 // { dg-do run } // { dg-options "-O3" } /* PR c++/28139: disjoint alias sets for the store from expand_start_catch_block than for loading P result in P being loaded before it is initialized for sh-elf. */ extern "C" { void exit (int) __attribute__ ((noreturn)); } int i_glob = 42; int *p0 = &i_glob; typedef int **ipp; void g (int i) { if (!i_glob) exit ((__SIZE_TYPE__) & i); } static void h () { throw &p0; } int main() { g (42); try { h (); } catch (const ipp &p) { if (**p!= 42) exit (1); } return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh1.cpp ======================= // { dg-do run } // { dg-options "-O" } // PRMS Id: 10776 extern "C" int printf (const char *,...); class Foo { public: Foo(int n) : n_(n) { } int f() { return n_; } int badTest(); int goodTest(); private: int n_; }; int Foo::badTest() { try { throw int(99); } catch (int &i) { n_ = 16; } return n_; // On the sparc, the return will use a ld [%l0],%i0 instruction. // However %l0 was clobbered at the end of the catch block. It was // used to do an indirect call. } int Foo::goodTest() { int n; try { throw int(99); } catch (int &i) { n = 16; } return n_; // The return will use a ld [%l2],%i0 instruction. Since %l2 // contains the "this" pointer this works. } int main() { Foo foo(5); foo.goodTest(); foo.badTest(); // the badTest will have failed printf ("PASS\n"); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-2.cpp ======================= // PR c++/36871 // { dg-do "run" } #include <cassert> struct A { template <class T> A (T) throw (int); }; struct B { B (B&) throw (); template <class T> B (T) throw (int); }; int main () { assert (__has_nothrow_copy (A)); assert (__has_nothrow_copy (B)); } ======================= File: android-ndk-r10b/sources/android/crazy_linker/src/crazy_linker_library_view.cpp ======================= // Copyright (c) 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 "crazy_linker_library_view.h" #include <dlfcn.h> #include "crazy_linker_debug.h" #include "crazy_linker_globals.h" #include "crazy_linker_shared_library.h" namespace crazy { LibraryView::~LibraryView() { LOG("%s: Destroying %s\n", __FUNCTION__, name_.c_str()); if (type_ == TYPE_SYSTEM) { ::dlclose(system_); system_ = NULL; } if (type_ == TYPE_CRAZY) { delete crazy_; crazy_ = NULL; } type_ = TYPE_NONE; } void* LibraryView::LookupSymbol(const char* symbol_name) { if (type_ == TYPE_SYSTEM) return ::dlsym(system_, symbol_name); if (type_ == TYPE_CRAZY) { LibraryList* lib_list = Globals::GetLibraries(); return lib_list->FindSymbolFrom(symbol_name, this); } return NULL; } bool LibraryView::GetInfo(size_t* load_address, size_t* load_size, size_t* relro_start, size_t* relro_size, Error* error) { if (type_!= TYPE_CRAZY) { *error = "No RELRO sharing with system libraries"; return false; } crazy_->GetInfo(load_address, load_size, relro_start, relro_size); return true; } } // namespace crazy ======================= File: android-ndk-r10b/tests/device/test-cxx-init-array/jni/test.cpp ======================= <reponame>perezite/Boost4Android #include <stdio.h> #include "global_ctor.h" GlobalCtor Obj; int main(void) { if (Obj.IsInitialized()) { puts("Passed"); return 0; } else { puts("ERROR: Global variables are NOT initialized."); return 1; } } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/catch12.cpp ======================= <reponame>perezite/Boost4Android // { dg-do run } // Copyright (C) 2000 Free Software Foundation, Inc. // Contributed by <NAME> 24 May 2000 <<EMAIL>> // we should be able to catch a base a virtual, provided it is accessible by at // least one public path // -- public, << private, == virtual // E--B<<==A // +--C--==A // +--D<<==A struct A {}; struct B : private virtual A {}; struct C : virtual A {}; struct D : private virtual A {}; struct E : public B, public C, public D {}; extern "C" void abort (); void fne (E *e) { throw e; } void check(E *e) { int caught; caught = 0; try { fne(e); } catch(A *p) { caught = 1; if (p!= e) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fne(e); } catch(B *p) { caught = 1; if (p!= e) abort();} catch(...) { abort (); } if (!caught) abort(); caught = 0; try { fne(e); } catch(C *p) { caught = 1; if (p!= e) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fne(e); } catch(D *p) { caught = 1; if (p!= e) abort ();} catch(...) { abort (); } if (!caught) abort(); return; } int main () { E e; check (&e); check ((E *)0); return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/shared_ptr_test.cpp ======================= <reponame>perezite/Boost4Android #include <memory> #if!defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT) // #include <typeinfo> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif class SharedPtrTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(SharedPtrTest); CPPUNIT_TEST(shared_from_this); CPPUNIT_TEST_SUITE_END(); protected: void shared_from_this(); }; CPPUNIT_TEST_SUITE_REGISTRATION(SharedPtrTest); struct X; struct X : public std::tr1::enable_shared_from_this<X> { }; void SharedPtrTest::shared_from_this() { std::tr1::shared_ptr<X> p( new X ); std::tr1::shared_ptr<X> q = p->shared_from_this(); CPPUNIT_CHECK( p == q ); CPPUNIT_CHECK(!(p < q) &&!(q < p) ); // p and q share ownership } #endif /*!_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */ ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/merge_test.cpp ======================= <filename>android-ndk-r10b/tests/device/test-stlport/unit/merge_test.cpp<gh_stars>100-1000 #include <vector> #include <algorithm> #include <functional> #include <numeric> #include "iota.h" #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class MergeTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(MergeTest); CPPUNIT_TEST(merge0); CPPUNIT_TEST(merge1); CPPUNIT_TEST(merge2); CPPUNIT_TEST_SUITE_END(); protected: void merge0(); void merge1(); void merge2(); }; CPPUNIT_TEST_SUITE_REGISTRATION(MergeTest); // // tests implementation // void MergeTest::merge0() { int numbers1[5] = { 1, 6, 13, 25, 101 }; int numbers2[5] = {-5, 26, 36, 46, 99 }; int result[10]; merge((int*)numbers1, (int*)numbers1 + 5, (int*)numbers2, (int*)numbers2 + 5, (int*)result); CPPUNIT_ASSERT(result[0]==-5); CPPUNIT_ASSERT(result[1]==1); CPPUNIT_ASSERT(result[2]==6); CPPUNIT_ASSERT(result[3]==13); CPPUNIT_ASSERT(result[4]==25); CPPUNIT_ASSERT(result[5]==26); CPPUNIT_ASSERT(result[6]==36); CPPUNIT_ASSERT(result[7]==46); CPPUNIT_ASSERT(result[8]==99); CPPUNIT_ASSERT(result[9]==101); } void MergeTest::merge1() { vector<int> v1(5); vector<int> v2(v1.size()); __iota(v1.begin(), v1.end(), 0); __iota(v2.begin(), v2.end(), 3); vector <int> result(v1.size() + v2.size()); merge(v1.begin(), v1.end(), v2.begin(), v2.end(), result.begin()); CPPUNIT_ASSERT(result[0]==0); CPPUNIT_ASSERT(result[1]==1); CPPUNIT_ASSERT(result[2]==2); CPPUNIT_ASSERT(result[3]==3); CPPUNIT_ASSERT(result[4]==3); CPPUNIT_ASSERT(result[5]==4); CPPUNIT_ASSERT(result[6]==4); CPPUNIT_ASSERT(result[7]==5); CPPUNIT_ASSERT(result[8]==6); CPPUNIT_ASSERT(result[9]==7); } void MergeTest::merge2() { vector <int> v1(5); vector <int> v2(v1.size()); for (int i = 0; (size_t)i < v1.size(); ++i) { v1[i] = 10 - i; v2[i] = 7 - i; } vector<int> result(v1.size() + v2.size()); merge(v1.begin(), v1.end(), v2.begin(), v2.end(), result.begin(), greater<int>() ); CPPUNIT_ASSERT(result[0]==10); CPPUNIT_ASSERT(result[1]==9); CPPUNIT_ASSERT(result[2]==8); CPPUNIT_ASSERT(result[3]==7); CPPUNIT_ASSERT(result[4]==7); CPPUNIT_ASSERT(result[5]==6); CPPUNIT_ASSERT(result[6]==6); CPPUNIT_ASSERT(result[7]==5); CPPUNIT_ASSERT(result[8]==4); CPPUNIT_ASSERT(result[9]==3); } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/includes_test.cpp ======================= #include <cstring> #include <vector> #include <algorithm> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class IncludesTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(IncludesTest); CPPUNIT_TEST(incl0); CPPUNIT_TEST(incl1); CPPUNIT_TEST(incl2); CPPUNIT_TEST_SUITE_END(); protected: void incl0(); void incl1(); void incl2(); static bool compare_strings(const char* s1_, const char* s2_) { return strcmp(s1_, s2_) < 0? 1 : 0; } }; CPPUNIT_TEST_SUITE_REGISTRATION(IncludesTest); // // tests implementation // void IncludesTest::incl0() { int numbers1[5] = { 1, 2, 3, 4, 5 }; //int numbers2[5] = { 1, 2, 4, 8, 16 }; int numbers3[2] = { 4, 8 }; bool r1=includes(numbers1, numbers1 + 5, numbers3, numbers3 + 2); CPPUNIT_ASSERT(!r1); } void IncludesTest::incl1() { vector<int> v1(10); vector<int> v2(3); int i; for (i = 0; (size_t)i < v1.size(); ++i) { v1[i] = i; } bool r1=includes(v1.begin(), v1.end(), v2.begin(), v2.end()); CPPUNIT_ASSERT(!r1); for (i = 0; (size_t)i < v2.size(); ++i) v2[i] = i + 3; bool r2=includes(v1.begin(), v1.end(), v2.begin(), v2.end()); CPPUNIT_ASSERT(r2); } void IncludesTest::incl2() { char const* names[] = { "Todd", "Mike", "Graham", "Jack", "Brett"}; const unsigned nameSize = sizeof(names)/sizeof(names[0]); vector <char const*> v1(nameSize); for (int i = 0; (size_t)i < v1.size(); ++i) { v1[i] = names[i]; } vector <char const*> v2(2); v2[0] = "foo"; v2[1] = "bar"; sort(v1.begin(), v1.end(), compare_strings); sort(v2.begin(), v2.end(), compare_strings); bool r1 = includes(v1.begin(), v1.end(), v2.begin(), v2.end(), compare_strings); CPPUNIT_ASSERT(!r1); v2[0] = "Brett"; v2[1] = "Todd"; bool r2 = includes(v1.begin(), v1.end(), v2.begin(), v2.end(), compare_strings); CPPUNIT_ASSERT(r2); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh-inline-1.cpp ======================= <filename>android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh-inline-1.cpp /* { dg-do run } */ #include "check.h" #ifndef ALIGNMENT #define ALIGNMENT 64 #endif typedef int aligned __attribute__((aligned(ALIGNMENT))); int global; class Base {}; struct A : virtual public Base { A() {} }; struct B {}; static void inline __attribute__((always_inline)) foo (void) throw (B,A) { aligned i; if (check_int (&i, __alignof__(i))!= i) abort (); throw A(); } int main() { try { foo (); } catch (A& a) { } return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/pr29166.cpp ======================= <reponame>perezite/Boost4Android // PR 29166: r4-r7 corrupted when unwinding. // { dg-do run } class Ex { public: int val; Ex( int v ) : val( v ) { } }; void doIt() { int OFF( 1000 ); register int v1=OFF+1,v2=OFF+2,v3=OFF+3,v4=OFF+4,v5=OFF+5,v6=OFF+6,v7=OFF+7,v8=OFF+8,v9=OFF+9,v10=OFF+10; register int v11=OFF+11,v12=OFF+12,v13=OFF+13,v14=OFF+14,v15=OFF+15,v16=OFF+16,v17=OFF+17,v18=OFF+18,v19=OFF+19,v20=OFF+20; register int v21=OFF+21,v22=OFF+22,v23=OFF+23,v24=OFF+24,v25=OFF+25,v26=OFF+26,v27=OFF+27,v28=OFF+28,v29=OFF+29,v30=OFF+30; register int v31=OFF+31,v32=OFF+32,v33=OFF+33,v34=OFF+34,v35=OFF+35,v36=OFF+36,v37=OFF+37,v38=OFF+38,v39=OFF+39,v40=OFF+40; register int v41=OFF+41,v42=OFF+42,v43=OFF+43,v44=OFF+44,v45=OFF+45,v46=OFF+46,v47=OFF+47,v48=OFF+48,v49=OFF+49,v50=OFF+50; register int v51=OFF+51,v52=OFF+52,v53=OFF+53,v54=OFF+54,v55=OFF+55,v56=OFF+56,v57=OFF+57,v58=OFF+58,v59=OFF+59,v60=OFF+60; register int v61=OFF+61,v62=OFF+62,v63=OFF+63,v64=OFF+64,v65=OFF+65,v66=OFF+66,v67=OFF+67,v68=OFF+68,v69=OFF+69,v70=OFF+70; register int v71=OFF+71,v72=OFF+72,v73=OFF+73,v74=OFF+74,v75=OFF+75,v76=OFF+76,v77=OFF+77,v78=OFF+78,v79=OFF+79,v80=OFF+80; register int v81=OFF+81,v82=OFF+82,v83=OFF+83,v84=OFF+84,v85=OFF+85,v86=OFF+86,v87=OFF+87,v88=OFF+88,v89=OFF+89,v90=OFF+90; register int v91=OFF+91,v92=OFF+92,v93=OFF+93,v94=OFF+94,v95=OFF+95,v96=OFF+96,v97=OFF+97,v98=OFF+98,v99=OFF+99,v100=OFF+100; register int v101=OFF+101,v102=OFF+102,v103=OFF+103,v104=OFF+104,v105=OFF+105,v106=OFF+106,v107=OFF+107,v108=OFF+108,v109=OFF+109,v110=OFF+110; register int v111=OFF+111,v112=OFF+112,v113=OFF+113,v114=OFF+114,v115=OFF+115,v116=OFF+116,v117=OFF+117,v118=OFF+118,v119=OFF+119,v120=OFF+120; register int v121=OFF+121,v122=OFF+122,v123=OFF+123,v124=OFF+124,v125=OFF+125,v126=OFF+126,v127=OFF+127,v128=OFF+128,v129=OFF+129,v130=OFF+130; register int v131=OFF+131,v132=OFF+132,v133=OFF+133,v134=OFF+134,v135=OFF+135,v136=OFF+136,v137=OFF+137,v138=OFF+138,v139=OFF+139,v140=OFF+140; register int v141=OFF+141,v142=OFF+142,v143=OFF+143,v144=OFF+144,v145=OFF+145,v146=OFF+146,v147=OFF+147,v148=OFF+148,v149=OFF+149,v150=OFF+150; register int v151=OFF+151,v152=OFF+152,v153=OFF+153,v154=OFF+154,v155=OFF+155,v156=OFF+156,v157=OFF+157,v158=OFF+158,v159=OFF+159,v160=OFF+160; register int v161=OFF+161,v162=OFF+162,v163=OFF+163,v164=OFF+164,v165=OFF+165,v166=OFF+166,v167=OFF+167,v168=OFF+168,v169=OFF+169,v170=OFF+170; register int v171=OFF+171,v172=OFF+172,v173=OFF+173,v174=OFF+174,v175=OFF+175,v176=OFF+176,v177=OFF+177,v178=OFF+178,v179=OFF+179,v180=OFF+180; register int v181=OFF+181,v182=OFF+182,v183=OFF+183,v184=OFF+184,v185=OFF+185,v186=OFF+186,v187=OFF+187,v188=OFF+188,v189=OFF+189,v190=OFF+190; register int v191=OFF+191,v192=OFF+192,v193=OFF+193,v194=OFF+194,v195=OFF+195,v196=OFF+196,v197=OFF+197,v198=OFF+198,v199=OFF+199,v200=OFF+200; register int v201=OFF+201,v202=OFF+202,v203=OFF+203,v204=OFF+204,v205=OFF+205,v206=OFF+206,v207=OFF+207,v208=OFF+208,v209=OFF+209,v210=OFF+210; register int v211=OFF+211,v212=OFF+212,v213=OFF+213,v214=OFF+214,v215=OFF+215,v216=OFF+216,v217=OFF+217,v218=OFF+218,v219=OFF+219,v220=OFF+220; register int v231=OFF+231,v232=OFF+232,v233=OFF+233,v234=OFF+234,v235=OFF+235,v236=OFF+236,v237=OFF+237,v238=OFF+238,v239=OFF+239,v240=OFF+240; register int v241=OFF+241,v242=OFF+242,v243=OFF+243,v244=OFF+244,v245=OFF+245,v246=OFF+246,v247=OFF+247,v248=OFF+248,v249=OFF+249,v250=OFF+250; register int v251=OFF+251,v252=OFF+252,v253=OFF+253,v254=OFF+254,v255=OFF+255,v256=OFF+256,v257=OFF+257,v258=OFF+258,v259=OFF+259,v260=OFF+260; register int v261=OFF+261,v262=OFF+262,v263=OFF+263,v264=OFF+264,v265=OFF+265,v266=OFF+266,v267=OFF+267,v268=OFF+268,v269=OFF+269,v270=OFF+270; register int v271=OFF+271,v272=OFF+272,v273=OFF+273,v274=OFF+274,v275=OFF+275,v276=OFF+276,v277=OFF+277,v278=OFF+278,v279=OFF+279,v280=OFF+280; register int v281=OFF+281,v282=OFF+282,v283=OFF+283,v284=OFF+284,v285=OFF+285,v286=OFF+286,v287=OFF+287,v288=OFF+288,v289=OFF+289,v290=OFF+290; register int v291=OFF+291,v292=OFF+292,v293=OFF+293,v294=OFF+294,v295=OFF+295,v296=OFF+296,v297=OFF+297,v298=OFF+298,v299=OFF+299,v300=OFF+300; register int sum = 0; sum +=v1+v2+v3+v4+v5+v6+v7+v8+v9+v10; sum +=v11+v12+v13+v14+v15+v16+v17+v18+v19+v20; sum +=v21+v22+v23+v24+v25+v26+v27+v28+v29+v30; sum +=v31+v32+v33+v34+v35+v36+v37+v38+v39+v40; sum +=v41+v42+v43+v44+v45+v46+v47+v48+v49+v50; sum +=v51+v52+v53+v54+v55+v56+v57+v58+v59+v60; sum +=v61+v62+v63+v64+v65+v66+v67+v68+v69+v70; sum +=v71+v72+v73+v74+v75+v76+v77+v78+v79+v80; sum +=v81+v82+v83+v84+v85+v86+v87+v88+v89+v90; sum +=v91+v92+v93+v94+v95+v96+v97+v98+v99+v100; sum +=v101+v102+v103+v104+v105+v106+v107+v108+v109+v110; sum +=v111+v112+v113+v114+v115+v116+v117+v118+v119+v120; sum +=v121+v122+v123+v124+v125+v126+v127+v128+v129+v130; sum +=v131+v132+v133+v134+v135+v136+v137+v138+v139+v140; sum +=v141+v142+v143+v144+v145+v146+v147+v148+v149+v150; sum +=v151+v152+v153+v154+v155+v156+v157+v158+v159+v160; sum +=v161+v162+v163+v164+v165+v166+v167+v168+v169+v170; sum +=v171+v172+v173+v174+v175+v176+v177+v178+v179+v180; sum +=v181+v182+v183+v184+v185+v186+v187+v188+v189+v190; sum +=v191+v192+v193+v194+v195+v196+v197+v198+v199+v200; sum +=v201+v202+v203+v204+v205+v206+v207+v208+v209+v210; sum +=v211+v212+v213+v214+v215+v216+v217+v218+v219+v220; sum +=v231+v232+v233+v234+v235+v236+v237+v238+v239+v240; sum +=v241+v242+v243+v244+v245+v246+v247+v248+v249+v250; sum +=v251+v252+v253+v254+v255+v256+v257+v258+v259+v260; sum +=v261+v262+v263+v264+v265+v266+v267+v268+v269+v270; sum +=v271+v272+v273+v274+v275+v276+v277+v278+v279+v280; sum +=v281+v282+v283+v284+v285+v286+v287+v288+v289+v290; sum +=v291+v292+v293+v294+v295+v296+v297+v298+v299+v300; throw Ex( sum ); } void test() { try { doIt(); } catch( Ex& ) { } } int main(int argc, char** argv) { int OFF(0); register int v1=OFF+1,v2=OFF+2,v3=OFF+3,v4=OFF+4,v5=OFF+5,v6=OFF+6,v7=OFF+7,v8=OFF+8,v9=OFF+9,v10=OFF+10; register int v11=OFF+11,v12=OFF+12,v13=OFF+13,v14=OFF+14,v15=OFF+15,v16=OFF+16,v17=OFF+17,v18=OFF+18,v19=OFF+19,v20=OFF+20; register int v21=OFF+21,v22=OFF+22,v23=OFF+23,v24=OFF+24,v25=OFF+25,v26=OFF+26,v27=OFF+27,v28=OFF+28,v29=OFF+29,v30=OFF+30; register int v31=OFF+31,v32=OFF+32,v33=OFF+33,v34=OFF+34,v35=OFF+35,v36=OFF+36,v37=OFF+37,v38=OFF+38,v39=OFF+39,v40=OFF+40; register int v41=OFF+41,v42=OFF+42,v43=OFF+43,v44=OFF+44,v45=OFF+45,v46=OFF+46,v47=OFF+47,v48=OFF+48,v49=OFF+49,v50=OFF+50; register int v51=OFF+51,v52=OFF+52,v53=OFF+53,v54=OFF+54,v55=OFF+55,v56=OFF+56,v57=OFF+57,v58=OFF+58,v59=OFF+59,v60=OFF+60; register int v61=OFF+61,v62=OFF+62,v63=OFF+63,v64=OFF+64,v65=OFF+65,v66=OFF+66,v67=OFF+67,v68=OFF+68,v69=OFF+69,v70=OFF+70; register int v71=OFF+71,v72=OFF+72,v73=OFF+73,v74=OFF+74,v75=OFF+75,v76=OFF+76,v77=OFF+77,v78=OFF+78,v79=OFF+79,v80=OFF+80; register int v81=OFF+81,v82=OFF+82,v83=OFF+83,v84=OFF+84,v85=OFF+85,v86=OFF+86,v87=OFF+87,v88=OFF+88,v89=OFF+89,v90=OFF+90; register int v91=OFF+91,v92=OFF+92,v93=OFF+93,v94=OFF+94,v95=OFF+95,v96=OFF+96,v97=OFF+97,v98=OFF+98,v99=OFF+99,v100=OFF+100; register int v101=OFF+101,v102=OFF+102,v103=OFF+103,v104=OFF+104,v105=OFF+105,v106=OFF+106,v107=OFF+107,v108=OFF+108,v109=OFF+109,v110=OFF+110; register int v111=OFF+111,v112=OFF+112,v113=OFF+113,v114=OFF+114,v115=OFF+115,v116=OFF+116,v117=OFF+117,v118=OFF+118,v119=OFF+119,v120=OFF+120; register int v121=OFF+121,v122=OFF+122,v123=OFF+123,v124=OFF+124,v125=OFF+125,v126=OFF+126,v127=OFF+127,v128=OFF+128,v129=OFF+129,v130=OFF+130; register int v131=OFF+131,v132=OFF+132,v133=OFF+133,v134=OFF+134,v135=OFF+135,v136=OFF+136,v137=OFF+137,v138=OFF+138,v139=OFF+139,v140=OFF+140; register int v141=OFF+141,v142=OFF+142,v143=OFF+143,v144=OFF+144,v145=OFF+145,v146=OFF+146,v147=OFF+147,v148=OFF+148,v149=OFF+149,v150=OFF+150; register int v151=OFF+151,v152=OFF+152,v153=OFF+153,v154=OFF+154,v155=OFF+155,v156=OFF+156,v157=OFF+157,v158=OFF+158,v159=OFF+159,v160=OFF+160; register int v161=OFF+161,v162=OFF+162,v163=OFF+163,v164=OFF+164,v165=OFF+165,v166=OFF+166,v167=OFF+167,v168=OFF+168,v169=OFF+169,v170=OFF+170; register int v171=OFF+171,v172=OFF+172,v173=OFF+173,v174=OFF+174,v175=OFF+175,v176=OFF+176,v177=OFF+177,v178=OFF+178,v179=OFF+179,v180=OFF+180; register int v181=OFF+181,v182=OFF+182,v183=OFF+183,v184=OFF+184,v185=OFF+185,v186=OFF+186,v187=OFF+187,v188=OFF+188,v189=OFF+189,v190=OFF+190; register int v191=OFF+191,v192=OFF+192,v193=OFF+193,v194=OFF+194,v195=OFF+195,v196=OFF+196,v197=OFF+197,v198=OFF+198,v199=OFF+199,v200=OFF+200; register int v201=OFF+201,v202=OFF+202,v203=OFF+203,v204=OFF+204,v205=OFF+205,v206=OFF+206,v207=OFF+207,v208=OFF+208,v209=OFF+209,v210=OFF+210; register int v211=OFF+211,v212=OFF+212,v213=OFF+213,v214=OFF+214,v215=OFF+215,v216=OFF+216,v217=OFF+217,v218=OFF+218,v219=OFF+219,v220=OFF+220; register int v231=OFF+231,v232=OFF+232,v233=OFF+233,v234=OFF+234,v235=OFF+235,v236=OFF+236,v237=OFF+237,v238=OFF+238,v239=OFF+239,v240=OFF+240; register int v241=OFF+241,v242=OFF+242,v243=OFF+243,v244=OFF+244,v245=OFF+245,v246=OFF+246,v247=OFF+247,v248=OFF+248,v249=OFF+249,v250=OFF+250; register int v251=OFF+251,v252=OFF+252,v253=OFF+253,v254=OFF+254,v255=OFF+255,v256=OFF+256,v257=OFF+257,v258=OFF+258,v259=OFF+259,v260=OFF+260; register int v261=OFF+261,v262=OFF+262,v263=OFF+263,v264=OFF+264,v265=OFF+265,v266=OFF+266,v267=OFF+267,v268=OFF+268,v269=OFF+269,v270=OFF+270; register int v271=OFF+271,v272=OFF+272,v273=OFF+273,v274=OFF+274,v275=OFF+275,v276=OFF+276,v277=OFF+277,v278=OFF+278,v279=OFF+279,v280=OFF+280; register int v281=OFF+281,v282=OFF+282,v283=OFF+283,v284=OFF+284,v285=OFF+285,v286=OFF+286,v287=OFF+287,v288=OFF+288,v289=OFF+289,v290=OFF+290; register int v291=OFF+291,v292=OFF+292,v293=OFF+293,v294=OFF+294,v295=OFF+295,v296=OFF+296,v297=OFF+297,v298=OFF+298,v299=OFF+299,v300=OFF+300; int sum_before, sum_after; { int sum( 0 ); sum +=v1+v2+v3+v4+v5+v6+v7+v8+v9+v10; sum +=v11+v12+v13+v14+v15+v16+v17+v18+v19+v20; sum +=v21+v22+v23+v24+v25+v26+v27+v28+v29+v30; sum +=v31+v32+v33+v34+v35+v36+v37+v38+v39+v40; sum +=v41+v42+v43+v44+v45+v46+v47+v48+v49+v50; sum +=v51+v52+v53+v54+v55+v56+v57+v58+v59+v60; sum +=v61+v62+v63+v64+v65+v66+v67+v68+v69+v70; sum +=v71+v72+v73+v74+v75+v76+v77+v78+v79+v80; sum +=v81+v82+v83+v84+v85+v86+v87+v88+v89+v90; sum +=v91+v92+v93+v94+v95+v96+v97+v98+v99+v100; sum +=v101+v102+v103+v104+v105+v106+v107+v108+v109+v110; sum +=v111+v112+v113+v114+v115+v116+v117+v118+v119+v120; sum +=v121+v122+v123+v124+v125+v126+v127+v128+v129+v130; sum +=v131+v132+v133+v134+v135+v136+v137+v138+v139+v140; sum +=v141+v142+v143+v144+v145+v146+v147+v148+v149+v150; sum +=v151+v152+v153+v154+v155+v156+v157+v158+v159+v160; sum +=v161+v162+v163+v164+v165+v166+v167+v168+v169+v170; sum +=v171+v172+v173+v174+v175+v176+v177+v178+v179+v180; sum +=v181+v182+v183+v184+v185+v186+v187+v188+v189+v190; sum +=v191+v192+v193+v194+v195+v196+v197+v198+v199+v200; sum +=v201+v202+v203+v204+v205+v206+v207+v208+v209+v210; sum +=v211+v212+v213+v214+v215+v216+v217+v218+v219+v220; sum +=v231+v232+v233+v234+v235+v236+v237+v238+v239+v240; sum +=v241+v242+v243+v244+v245+v246+v247+v248+v249+v250; sum +=v251+v252+v253+v254+v255+v256+v257+v258+v259+v260; sum +=v261+v262+v263+v264+v265+v266+v267+v268+v269+v270; sum +=v271+v272+v273+v274+v275+v276+v277+v278+v279+v280; sum +=v281+v282+v283+v284+v285+v286+v287+v288+v289+v290; sum +=v291+v292+v293+v294+v295+v296+v297+v298+v299+v300; sum_before = sum; } test(); { int sum( 0 ); sum +=v1+v2+v3+v4+v5+v6+v7+v8+v9+v10; sum +=v11+v12+v13+v14+v15+v16+v17+v18+v19+v20; sum +=v21+v22+v23+v24+v25+v26+v27+v28+v29+v30; sum +=v31+v32+v33+v34+v35+v36+v37+v38+v39+v40; sum +=v41+v42+v43+v44+v45+v46+v47+v48+v49+v50; sum +=v51+v52+v53+v54+v55+v56+v57+v58+v59+v60; sum +=v61+v62+v63+v64+v65+v66+v67+v68+v69+v70; sum +=v71+v72+v73+v74+v75+v76+v77+v78+v79+v80; sum +=v81+v82+v83+v84+v85+v86+v87+v88+v89+v90; sum +=v91+v92+v93+v94+v95+v96+v97+v98+v99+v100; sum +=v101+v102+v103+v104+v105+v106+v107+v108+v109+v110; sum +=v111+v112+v113+v114+v115+v116+v117+v118+v119+v120; sum +=v121+v122+v123+v124+v125+v126+v127+v128+v129+v130; sum +=v131+v132+v133+v134+v135+v136+v137+v138+v139+v140; sum +=v141+v142+v143+v144+v145+v146+v147+v148+v149+v150; sum +=v151+v152+v153+v154+v155+v156+v157+v158+v159+v160; sum +=v161+v162+v163+v164+v165+v166+v167+v168+v169+v170; sum +=v171+v172+v173+v174+v175+v176+v177+v178+v179+v180; sum +=v181+v182+v183+v184+v185+v186+v187+v188+v189+v190; sum +=v191+v192+v193+v194+v195+v196+v197+v198+v199+v200; sum +=v201+v202+v203+v204+v205+v206+v207+v208+v209+v210; sum +=v211+v212+v213+v214+v215+v216+v217+v218+v219+v220; sum +=v231+v232+v233+v234+v235+v236+v237+v238+v239+v240; sum +=v241+v242+v243+v244+v245+v246+v247+v248+v249+v250; sum +=v251+v252+v253+v254+v255+v256+v257+v258+v259+v260; sum +=v261+v262+v263+v264+v265+v266+v267+v268+v269+v270; sum +=v271+v272+v273+v274+v275+v276+v277+v278+v279+v280; sum +=v281+v282+v283+v284+v285+v286+v287+v288+v289+v290; sum +=v291+v292+v293+v294+v295+v296+v297+v298+v299+v300; sum_after = sum; } return sum_before!= sum_after; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/new1_3.cpp ======================= // { dg-do run } // // Purpose: Check the lifetime of the temporaries. // // Lifetime of temporaries: // egcs 2.92 performs cleanup for temporaries inside new expressions // after the new is complete, not at the end of the full expression. // // In GCC, the operands are computed first. If no exception is raised, then // the result should be "ctor, new, func, dtor". If the new operator throws // the exception, then the result should be "ctor, new, dtor". If the // constructor of the temporary throws the exception, then the result should // be "ctor". // // In Clang, the new operator is called first. If no exception is raised, // then the result should be "new, ctor, func, dtor". If the new operator // throws the exception, then the result should be "new". If the constructor // of the temporary throws the exception, then the result should be // "new, ctor, delete". // // Both of them are allowed by the C++ language specification, so we are using // #ifdef for different compilers. #include <new> #include <cstdlib> #include <cstdio> bool new_throws; bool ctor_throws; int new_done; int ctor_done; int func_done; int dtor_done; int delete_done; int count; void init() { new_throws = ctor_throws = false; new_done = ctor_done = func_done = dtor_done = delete_done = count = 0; } struct line_error{ int line; line_error(int i):line(i){} }; #define CHECK(cond) if(!(cond))throw line_error(__LINE__); struct A{ A(int){ ctor_done = ++count; if(ctor_throws) throw 1; } A(const A&){ CHECK(false); //no copy constructors in this code } ~A(){ dtor_done = ++count; } A* addr(){return this;} }; struct B{ B(A*){} void* operator new(size_t s){ new_done = ++count; if(new_throws) throw 1; return malloc(s); } void operator delete(void *){ delete_done = ++count; } }; void func(B* ) { func_done = ++count; } void test1() { init(); try{ func(new B(A(10).addr())); }catch(int){ } #if defined(__clang__) CHECK(new_done==1); CHECK(ctor_done==2); CHECK(func_done==3); CHECK(dtor_done==4); CHECK(delete_done==0); #elif defined(__GNUC__) CHECK(ctor_done==1); CHECK(new_done==2); CHECK(func_done==3); CHECK(dtor_done==4); CHECK(delete_done==0); #else #error "Unknown compiler" #endif } void test2() { init(); new_throws = true; try{ func(new B(A(10).addr())); }catch(int){ } #if defined(__clang__) CHECK(new_done==1); CHECK(ctor_done==0); CHECK(func_done==0); CHECK(dtor_done==0); CHECK(delete_done==0); #elif defined(__GNUC__) CHECK(ctor_done==1); CHECK(new_done==2); CHECK(func_done==0); CHECK(dtor_done==3); CHECK(delete_done==0); #else #error "Unknown compiler" #endif } void test3() { init(); ctor_throws = true; try{ func(new B(A(10).addr())); }catch(int){ } #if defined(__clang__) CHECK(new_done==1); CHECK(ctor_done==2); CHECK(func_done==0); CHECK(dtor_done==0); CHECK(delete_done==3); #elif defined(__GNUC__) CHECK(new_done==0); CHECK(ctor_done==1); CHECK(func_done==0); CHECK(dtor_done==0); CHECK(delete_done==0); #else #error "Unknown compiler" #endif } int main() { try{ test1(); test2(); test3(); }catch(line_error e){ printf("Got error in line %d\n",e.line); return 1; } return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/vbase2_1.cpp ======================= <reponame>perezite/Boost4Android // { dg-do run } // Origin: <NAME> <<EMAIL>> int i; struct A { A () { i++; } ~A () { i--; } }; struct B : public virtual A { B () { throw 1; } }; struct D: public B, virtual public A { }; void f() { D d; } int main () { try { f(); } catch (int) { } return i; } ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/string_header_test.cpp ======================= /* This test purpose is simply to check Standard header independancy that * is to say that the header can be included alone without any previous * include. * Additionnaly, for C Standard headers that STLport expose, it can also be * used to check that files included by those headers are compatible with * pure C compilers. */ #include <string> ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/cppunit/test_main.cpp ======================= /* * Copyright (c) 2003, 2004 * <NAME> * * This material is provided "as is", with absolutely no warranty expressed * or implied. Any use is at your own risk. * * Permission to use or copy this software for any purpose is hereby granted * without fee, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ #include "cppunit_proxy.h" #include "file_reporter.h" #include "cppunit_timer.h" #include "stdio.h" #if 0 namespace CPPUNIT_NS { #endif int TestCase::m_numErrors = 0; int TestCase::m_numTests = 0; TestCase *TestCase::m_root = 0; Reporter *TestCase::m_reporter = 0; void TestCase::registerTestCase(TestCase *in_testCase) { in_testCase->m_next = m_root; m_root = in_testCase; } int TestCase::run(Reporter *in_reporter, const char *in_testName, bool invert) { TestCase::m_reporter = in_reporter; m_numErrors = 0; m_numTests = 0; TestCase *tmp = m_root; while (tmp!= 0) { tmp->myRun(in_testName, invert); tmp = tmp->m_next; } return m_numErrors; } #if 0 } #endif static void usage(const char* name) { printf("Usage : %s [-t=<class>[::<test>]] [-x=<class>[::<test>]] [-f=<file>]%s\n", name, Timer::supported()? " [-m]": ""); printf("\t[-t=<class>[::<test>]] : test class or class::test to execute;\n"); printf("\t[-x=<class>[::<test>]] : test class or class::test to exclude from execution;\n"); printf("\t[-f=<file>] : output file"); if (Timer::supported()) printf(";\n\t[-m] : monitor test execution, display time duration for each test\n"); else printf("\n"); } int main(int argc, char** argv) { // CppUnit(mini) test launcher // command line option syntax: // test [OPTIONS] // where OPTIONS are // -t=CLASS[::TEST] run the test class CLASS or member test CLASS::TEST // -x=CLASS[::TEST] run all except the test class CLASS or member test CLASS::TEST // -f=FILE save output in file FILE instead of stdout // -m monitor test(s) execution const char *fileName = 0; const char *testName = ""; const char *xtestName = ""; bool doMonitoring = false; for (int i = 1; i < argc; ++i) { if (argv[i][0] == '-') { if (!strncmp(argv[i], "-t=", 3)) { testName = argv[i]+3; continue; } else if (!strncmp(argv[i], "-f=", 3)) { fileName = argv[i]+3; continue; } else if (!strncmp(argv[i], "-x=", 3)) { xtestName = argv[i]+3; continue; } else if (Timer::supported() &&!strncmp(argv[i], "-m", 2)) { doMonitoring = true; continue; } } // invalid option, we display normal usage. usage(argv[0]); return 1; } CPPUNIT_NS::Reporter* reporter; if (fileName!= 0) reporter = new FileReporter(fileName, doMonitoring); else reporter = new FileReporter(stdout, doMonitoring); int num_errors; if (xtestName[0]!= 0) { num_errors = CPPUNIT_NS::TestCase::run(reporter, xtestName, true); } else { num_errors = CPPUNIT_NS::TestCase::run(reporter, testName); } reporter->printSummary(); delete reporter; return num_errors; } // See doc/README.intel for explanation about this code #if defined (STLPORT) && defined (__ICL) && (__ICL >= 900) && \ (_STLP_MSVC_LIB < 1300) && defined (_STLP_USE_DYNAMIC_LIB) # include <exception> # undef std namespace std { void _STLP_CALL unexpected() { unexpected_handler hdl; set_unexpected(hdl = set_unexpected((unexpected_handler)0)); hdl(); } } #endif ======================= File: android-ndk-r10b/tests/device/test-stlport/unit/rm_cp_test.cpp ======================= <reponame>perezite/Boost4Android #include <vector> #include <algorithm> #include "cppunit/cppunit_proxy.h" #if!defined (STLPORT) || defined(_STLP_USE_NAMESPACES) using namespace std; #endif // // TestCase class // class RmCpTest : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE(RmCpTest); CPPUNIT_TEST(remcopy1); CPPUNIT_TEST(remcpif1); CPPUNIT_TEST(remif1); CPPUNIT_TEST(remove1); CPPUNIT_TEST(repcpif1); CPPUNIT_TEST(replace0); CPPUNIT_TEST(replace1); CPPUNIT_TEST(replcpy1); CPPUNIT_TEST(replif1); CPPUNIT_TEST(revcopy1); CPPUNIT_TEST(reverse1); CPPUNIT_TEST_SUITE_END(); protected: void remcopy1(); void remcpif1(); void remif1(); void remove1(); void repcpif1(); void replace0(); void replace1(); void replcpy1(); void replif1(); void revcopy1(); void reverse1(); }; CPPUNIT_TEST_SUITE_REGISTRATION(RmCpTest); static bool odd(int a_) { return (a_ % 2)!= 0; } // // tests implementation // void RmCpTest::reverse1() { int numbers[6] = { 0, 1, 2, 3, 4, 5 }; reverse(numbers, numbers + 6); CPPUNIT_ASSERT(numbers[0]==5); CPPUNIT_ASSERT(numbers[1]==4); CPPUNIT_ASSERT(numbers[2]==3); CPPUNIT_ASSERT(numbers[3]==2); CPPUNIT_ASSERT(numbers[4]==1); CPPUNIT_ASSERT(numbers[5]==0); } void RmCpTest::revcopy1() { int numbers[6] = { 0, 1, 2, 3, 4, 5 }; int result[6]; reverse_copy((int*)numbers, (int*)numbers + 6, (int*)result); // 5 4 3 2 1 0 CPPUNIT_ASSERT(result[0]==5); CPPUNIT_ASSERT(result[1]==4); CPPUNIT_ASSERT(result[2]==3); CPPUNIT_ASSERT(result[3]==2); CPPUNIT_ASSERT(result[4]==1); CPPUNIT_ASSERT(result[5]==0); } void RmCpTest::replif1() { vector <int> v1(10); for (int i = 0; (size_t)i < v1.size(); ++i) v1[i] = i % 5; replace_if(v1.begin(), v1.end(), odd, 42); // 0 42 2 42 4 0 42 2 42 4 CPPUNIT_ASSERT(v1[0]==0); CPPUNIT_ASSERT(v1[1]==42); CPPUNIT_ASSERT(v1[2]==2); CPPUNIT_ASSERT(v1[3]==42); CPPUNIT_ASSERT(v1[4]==4); CPPUNIT_ASSERT(v1[5]==0); CPPUNIT_ASSERT(v1[6]==42); CPPUNIT_ASSERT(v1[7]==2); CPPUNIT_ASSERT(v1[8]==42); CPPUNIT_ASSERT(v1[9]==4); } void RmCpTest::replcpy1() { int numbers[6] = { 0, 1, 2, 0, 1, 2 }; int result[6] = { 0, 0, 0, 0, 0, 0 }; replace_copy((int*)numbers, (int*)numbers + 6, (int*)result, 2, 42); CPPUNIT_ASSERT(result[0]==0); CPPUNIT_ASSERT(result[1]==1); CPPUNIT_ASSERT(result[2]==42); CPPUNIT_ASSERT(result[3]==0); CPPUNIT_ASSERT(result[4]==1); CPPUNIT_ASSERT(result[5]==42); } void RmCpTest::replace0() { int numbers[6] = { 0, 1, 2, 0, 1, 2 }; replace(numbers, numbers + 6, 2, 42); // 0 1 42 0 1 42 CPPUNIT_ASSERT(numbers[0]==0); CPPUNIT_ASSERT(numbers[1]==1); CPPUNIT_ASSERT(numbers[2]==42); CPPUNIT_ASSERT(numbers[3]==0); CPPUNIT_ASSERT(numbers[4]==1); CPPUNIT_ASSERT(numbers[5]==42); } void RmCpTest::replace1() { vector <int> v1(10); for (int i = 0; (size_t)i < v1.size(); ++i) v1[i] = i % 5; replace(v1.begin(), v1.end(), 2, 42); // 0 1 2 3 4 0 1 2 3 4 // 0 1 42 3 4 0 1 42 3 4 CPPUNIT_ASSERT(v1[0]==0); CPPUNIT_ASSERT(v1[1]==1); CPPUNIT_ASSERT(v1[2]==42); CPPUNIT_ASSERT(v1[3]==3); CPPUNIT_ASSERT(v1[4]==4); CPPUNIT_ASSERT(v1[5]==0); CPPUNIT_ASSERT(v1[6]==1); CPPUNIT_ASSERT(v1[7]==42); CPPUNIT_ASSERT(v1[8]==3); CPPUNIT_ASSERT(v1[9]==4); } void RmCpTest::repcpif1() { vector <int> v1(10); for (int i = 0; (size_t)i < v1.size(); ++i) v1[i] = i % 5; vector <int> v2(v1.size()); // 0 1 2 3 4 0 1 2 3 4 // 0 1 2 3 4 0 1 2 3 4 // 0 42 2 42 4 0 42 2 42 4 replace_copy_if(v1.begin(), v1.end(), v2.begin(), odd, 42); CPPUNIT_ASSERT(v1[0]==0); CPPUNIT_ASSERT(v1[1]==1); CPPUNIT_ASSERT(v1[2]==2); CPPUNIT_ASSERT(v1[3]==3); CPPUNIT_ASSERT(v1[4]==4); CPPUNIT_ASSERT(v1[5]==0); CPPUNIT_ASSERT(v1[6]==1); CPPUNIT_ASSERT(v1[7]==2); CPPUNIT_ASSERT(v1[8]==3); CPPUNIT_ASSERT(v1[9]==4); CPPUNIT_ASSERT(v2[0]==0); CPPUNIT_ASSERT(v2[1]==42); CPPUNIT_ASSERT(v2[2]==2); CPPUNIT_ASSERT(v2[3]==42); CPPUNIT_ASSERT(v2[4]==4); CPPUNIT_ASSERT(v2[5]==0); CPPUNIT_ASSERT(v2[6]==42); CPPUNIT_ASSERT(v2[7]==2); CPPUNIT_ASSERT(v2[8]==42); CPPUNIT_ASSERT(v2[9]==4); } void RmCpTest::remove1() { int numbers[6] = { 1, 2, 3, 1, 2, 3 }; remove((int*)numbers, (int*)numbers + 6, 1); // 2 3 2 3 2 3 CPPUNIT_ASSERT(numbers[0]==2); CPPUNIT_ASSERT(numbers[1]==3); CPPUNIT_ASSERT(numbers[2]==2); CPPUNIT_ASSERT(numbers[3]==3); CPPUNIT_ASSERT(numbers[4]==2); CPPUNIT_ASSERT(numbers[5]==3); } void RmCpTest::remif1() { int numbers[6] = { 0, 0, 1, 1, 2, 2 }; remove_if((int*)numbers, (int*)numbers + 6, odd); // 0 0 2 2 2 2 CPPUNIT_ASSERT(numbers[0]==0); CPPUNIT_ASSERT(numbers[1]==0); CPPUNIT_ASSERT(numbers[2]==2); CPPUNIT_ASSERT(numbers[3]==2); CPPUNIT_ASSERT(numbers[4]==2); CPPUNIT_ASSERT(numbers[5]==2); } void RmCpTest::remcopy1() { int numbers[6] = { 1, 2, 3, 1, 2, 3 }; int result[6] = { 0, 0, 0, 0, 0, 0 }; remove_copy((int*)numbers, (int*)numbers + 6, (int*)result, 2); CPPUNIT_ASSERT(result[0]==1); CPPUNIT_ASSERT(result[1]==3); CPPUNIT_ASSERT(result[2]==1); CPPUNIT_ASSERT(result[3]==3); CPPUNIT_ASSERT(result[4]==0); CPPUNIT_ASSERT(result[5]==0); } void RmCpTest::remcpif1() { int numbers[6] = { 1, 2, 3, 1, 2, 3 }; int result[6] = { 0, 0, 0, 0, 0, 0 }; remove_copy_if((int*)numbers, (int*)numbers + 6, (int*)result, odd); // 2 2 0 0 0 0 CPPUNIT_ASSERT(result[0]==2); CPPUNIT_ASSERT(result[1]==2); CPPUNIT_ASSERT(result[2]==0); CPPUNIT_ASSERT(result[3]==0); CPPUNIT_ASSERT(result[4]==0); CPPUNIT_ASSERT(result[5]==0); } ======================= File: android-ndk-r10b/tests/build/issue41770-_GLIBCXX_HAS_GTHREADS/jni/issue41770-_GLIBCXX_HAS_GTHREADS.cpp ======================= <gh_stars>1-10 #include <iostream> int main() { #if!defined(_GLIBCXX_HAS_GTHREADS) #error _GLIBCXX_HAS_GTHREADS is not defined #endif } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/vbase2_2.cpp ======================= // { dg-do run } // Origin: <NAME> <<EMAIL>> int i; struct A { ~A (); }; A::~A () { i = 1; } struct B : virtual public A { }; struct C { C (); B b; }; C::C () { throw 3; } int main () { try { C c; } catch (...) { } if (i!= 1) return 1; } ======================= File: android-ndk-r10b/tests/device/issue28598-linker-global-ref/jni/liba.cpp ======================= <filename>android-ndk-r10b/tests/device/issue28598-linker-global-ref/jni/liba.cpp #include <cstdio> #include "liba.h" int global = 0x42; void func() { printf("global = 0x%x (%p)\n", global, &global); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/delete3.cpp ======================= // { dg-do run } // Copyright (C) 1999 Free Software Foundation // by <NAME> <<EMAIL>> // Test whether dtors of vbases are called on throw within new[]. // Variant of delete2.C. extern "C" void abort(); extern "C" void exit(int); struct Foo { static bool first; Foo() { if (first) first = false; else throw first; } ~Foo() { exit(0); } }; bool Foo::first = true; struct Bar : virtual Foo { }; int main() { try { delete [] new Bar[2]; } catch (...) { } abort(); } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/has_nothrow_constructor.cpp ======================= // { dg-do "run" } #include <cassert> struct A { double a; double b; }; struct B { A a; }; struct C : public A { }; struct D { D() throw() { } }; struct E { E() throw(int) { } }; struct E1 { E1() throw(int) { throw int(); } }; struct F { F(const F&) throw() { } }; struct G { G(const G&) throw(int) { throw int(); } }; template<typename T> bool f() { return __has_nothrow_constructor(T); } template<typename T> class My { public: bool f() { return!!__has_nothrow_constructor(T); } }; template<typename T> class My2 { public: static const bool trait = __has_nothrow_constructor(T); }; template<typename T> const bool My2<T>::trait; template<typename T, bool b = __has_nothrow_constructor(T)> struct My3_help { static const bool trait = b; }; template<typename T, bool b> const bool My3_help<T, b>::trait; template<typename T> class My3 { public: bool f() { return My3_help<T>::trait; } }; #define PTEST(T) (__has_nothrow_constructor(T) && f<T>() \ && My<T>().f() && My2<T>::trait && My3<T>().f()) #define NTEST(T) (!__has_nothrow_constructor(T) &&!f<T>() \ &&!My<T>().f() &&!My2<T>::trait &&!My3<T>().f()) int main() { assert (PTEST (int)); assert (NTEST (int (int))); assert (NTEST (void)); assert (PTEST (A)); assert (PTEST (B)); assert (PTEST (C)); assert (PTEST (C[])); assert (PTEST (D)); assert (NTEST (E)); assert (NTEST (E1)); assert (NTEST (F)); assert (NTEST (G)); return 0; } ======================= File: android-ndk-r10b/tests/device/test-stlport_static-exception/jni/eh27.cpp ======================= // { dg-do run { xfail sparc64-*-elf arm-*-pe } } // { dg-options "-fexceptions" } #include <typeinfo> class My
71,251
thestackv1_concat_by_repo-long/65536-65536
10), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((14, 12), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((14, 13), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((14, 14), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((14, 15), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((14, 17), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((14, 18), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((14, 20), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((14, 21), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((14, 22), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((14, 23), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((14, 24), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((14, 26), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((14, 27), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((14, 28), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((14, 30), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((14, 31), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((14, 32), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((14, 33), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((14, 34), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((14, 35), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((14, 37), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((14, 38), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((14, 39), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((14, 40), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((15, 6), {(0, 0): (Fraction(-36, 1), 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (0, 0)}), ((15, 7), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((15, 8), {(0, 0): (Fraction(36, 1), 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (0, 0)}), ((15, 10), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((15, 12), {(0, 0): (Fraction(36, 1), 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (Fraction(36, 1), 0)}), ((15, 13), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((15, 14), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((15, 15), {(0, 0): (Fraction(-36, 1), 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (Fraction(-36, 1), 0)}), ((15, 17), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((15, 18), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((15, 20), {(0, 0): (0, 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (0, 0)}), ((15, 21), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((15, 22), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((15, 23), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((15, 24), {(0, 0): (0, 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (0, 0)}), ((15, 26), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((15, 27), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((15, 28), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((15, 30), {(0, 0): (0, 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (Fraction(-36, 1), 0)}), ((15, 31), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((15, 32), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((15, 33), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((15, 34), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((15, 35), {(0, 0): (0, 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (Fraction(36, 1), 0)}), ((15, 37), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((15, 38), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((15, 39), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((15, 40), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((16, 5), {(0, 0): (Fraction(-6, 1), 0), (0, 1): (Fraction(-2, 1), 0), (1, 0): (Fraction(-2, 1), 0), (1, 1): (0, 0)}), ((16, 11), {(0, 0): (Fraction(6, 1), 0), (0, 1): (Fraction(2, 1), 0), (1, 0): (Fraction(2, 1), 0), (1, 1): (Fraction(6, 1), 0)}), ((16, 19), {(0, 0): (0, 0), (0, 1): (Fraction(2, 1), 0), (1, 0): (Fraction(2, 1), 0), (1, 1): (0, 0)}), ((16, 29), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 1), 0), (1, 0): (Fraction(-2, 1), 0), (1, 1): (Fraction(-6, 1), 0)}), ((17, 6), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((17, 7), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((17, 8), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((17, 10), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((17, 12), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((17, 13), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((17, 14), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((17, 15), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((17, 17), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((17, 18), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((17, 20), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((17, 21), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((17, 22), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((17, 23), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((17, 24), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((17, 26), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((17, 27), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((17, 28), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((17, 30), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((17, 31), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((17, 32), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((17, 33), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((17, 34), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((17, 35), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((17, 37), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((17, 38), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((17, 39), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((17, 40), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((18, 6), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((18, 7), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((18, 8), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((18, 10), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((18, 12), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((18, 13), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((18, 14), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((18, 15), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((18, 17), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((18, 18), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((18, 20), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((18, 21), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((18, 22), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((18, 23), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((18, 24), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((18, 26), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((18, 27), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((18, 28), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((18, 30), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((18, 31), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((18, 32), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((18, 33), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((18, 34), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((18, 35), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((18, 37), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((18, 38), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((18, 39), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((18, 40), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((19, 9), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 1), 0), (1, 0): (Fraction(-2, 1), 0), (1, 1): (Fraction(-6, 1), 0)}), ((19, 16), {(0, 0): (0, 0), (0, 1): (Fraction(2, 1), 0), (1, 0): (Fraction(2, 1), 0), (1, 1): (0, 0)}), ((19, 25), {(0, 0): (Fraction(6, 1), 0), (0, 1): (Fraction(2, 1), 0), (1, 0): (Fraction(2, 1), 0), (1, 1): (Fraction(6, 1), 0)}), ((19, 36), {(0, 0): (Fraction(-6, 1), 0), (0, 1): (Fraction(-2, 1), 0), (1, 0): (Fraction(-2, 1), 0), (1, 1): (0, 0)}), ((20, 6), {(0, 0): (0, 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (Fraction(36, 1), 0)}), ((20, 7), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((20, 8), {(0, 0): (0, 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (Fraction(-36, 1), 0)}), ((20, 10), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((20, 12), {(0, 0): (0, 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (0, 0)}), ((20, 13), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((20, 14), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((20, 15), {(0, 0): (0, 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (0, 0)}), ((20, 17), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((20, 18), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((20, 20), {(0, 0): (Fraction(-36, 1), 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (Fraction(-36, 1), 0)}), ((20, 21), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((20, 22), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((20, 23), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((20, 24), {(0, 0): (Fraction(36, 1), 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (Fraction(36, 1), 0)}), ((20, 26), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((20, 27), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((20, 28), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((20, 30), {(0, 0): (Fraction(36, 1), 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (0, 0)}), ((20, 31), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((20, 32), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((20, 33), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((20, 34), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((20, 35), {(0, 0): (Fraction(-36, 1), 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (0, 0)}), ((20, 37), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((20, 38), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((20, 39), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((20, 40), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((21, 6), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((21, 7), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((21, 8), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((21, 10), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((21, 12), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((21, 13), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((21, 14), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((21, 15), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((21, 17), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((21, 18), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((21, 20), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((21, 21), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((21, 22), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((21, 23), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((21, 24), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((21, 26), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((21, 27), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((21, 28), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((21, 30), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((21, 31), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((21, 32), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((21, 33), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((21, 34), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((21, 35), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((21, 37), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((21, 38), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((21, 39), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((21, 40), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((22, 6), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((22, 7), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((22, 8), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((22, 10), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((22, 12), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((22, 13), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((22, 14), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((22, 15), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((22, 17), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((22, 18), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((22, 20), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((22, 21), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((22, 22), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((22, 23), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((22, 24), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((22, 26), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((22, 27), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((22, 28), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((22, 30), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((22, 31), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((22, 32), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((22, 33), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((22, 34), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((22, 35), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((22, 37), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((22, 38), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((22, 39), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((22, 40), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((23, 6), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((23, 7), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((23, 8), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((23, 10), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((23, 12), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((23, 13), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((23, 14), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((23, 15), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((23, 17), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((23, 18), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((23, 20), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((23, 21), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((23, 22), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((23, 23), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((23, 24), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((23, 26), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((23, 27), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((23, 28), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((23, 30), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((23, 31), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((23, 32), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((23, 33), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((23, 34), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((23, 35), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((23, 37), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((23, 38), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((23, 39), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((23, 40), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((24, 6), {(0, 0): (0, 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (Fraction(-36, 1), 0)}), ((24, 7), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((24, 8), {(0, 0): (0, 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (Fraction(36, 1), 0)}), ((24, 10), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((24, 12), {(0, 0): (0, 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (0, 0)}), ((24, 13), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((24, 14), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((24, 15), {(0, 0): (0, 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (0, 0)}), ((24, 17), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((24, 18), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((24, 20), {(0, 0): (Fraction(36, 1), 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (Fraction(36, 1), 0)}), ((24, 21), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((24, 22), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((24, 23), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((24, 24), {(0, 0): (Fraction(-36, 1), 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (Fraction(-36, 1), 0)}), ((24, 26), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((24, 27), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((24, 28), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((24, 30), {(0, 0): (Fraction(-36, 1), 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (0, 0)}), ((24, 31), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((24, 32), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((24, 33), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((24, 34), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((24, 35), {(0, 0): (Fraction(36, 1), 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (0, 0)}), ((24, 37), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((24, 38), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((24, 39), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((24, 40), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((25, 5), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 1), 0), (1, 0): (Fraction(-2, 1), 0), (1, 1): (Fraction(-6, 1), 0)}), ((25, 11), {(0, 0): (0, 0), (0, 1): (Fraction(2, 1), 0), (1, 0): (Fraction(2, 1), 0), (1, 1): (0, 0)}), ((25, 19), {(0, 0): (Fraction(6, 1), 0), (0, 1): (Fraction(2, 1), 0), (1, 0): (Fraction(2, 1), 0), (1, 1): (Fraction(6, 1), 0)}), ((25, 29), {(0, 0): (Fraction(-6, 1), 0), (0, 1): (Fraction(-2, 1), 0), (1, 0): (Fraction(-2, 1), 0), (1, 1): (0, 0)}), ((26, 6), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((26, 7), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((26, 8), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((26, 10), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((26, 12), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((26, 13), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((26, 14), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((26, 15), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((26, 17), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((26, 18), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((26, 20), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((26, 21), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((26, 22), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((26, 23), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((26, 24), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((26, 26), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((26, 27), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((26, 28), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((26, 30), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((26, 31), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((26, 32), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((26, 33), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((26, 34), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((26, 35), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((26, 37), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((26, 38), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((26, 39), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((26, 40), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((27, 6), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((27, 7), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((27, 8), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((27, 10), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((27, 12), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((27, 13), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((27, 14), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((27, 15), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((27, 17), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((27, 18), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((27, 20), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((27, 21), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((27, 22), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((27, 23), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((27, 24), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((27, 26), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((27, 27), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((27, 28), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((27, 30), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((27, 31), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((27, 32), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((27, 33), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((27, 34), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((27, 35), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((27, 37), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((27, 38), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((27, 39), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((27, 40), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((28, 6), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((28, 7), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((28, 8), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((28, 10), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((28, 12), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((28, 13), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((28, 14), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((28, 15), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((28, 17), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((28, 18), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((28, 20), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((28, 21), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((28, 22), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((28, 23), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((28, 24), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((28, 26), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((28, 27), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((28, 28), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((28, 30), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((28, 31), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((28, 32), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((28, 33), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((28, 34), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((28, 35), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((28, 37), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((28, 38), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((28, 39), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((28, 40), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((29, 9), {(0, 0): (0, 0), (0, 1): (Fraction(2, 1), 0), (1, 0): (Fraction(2, 1), 0), (1, 1): (0, 0)}), ((29, 16), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 1), 0), (1, 0): (Fraction(-2, 1), 0), (1, 1): (Fraction(-6, 1), 0)}), ((29, 25), {(0, 0): (Fraction(-6, 1), 0), (0, 1): (Fraction(-2, 1), 0), (1, 0): (Fraction(-2, 1), 0), (1, 1): (0, 0)}), ((29, 36), {(0, 0): (Fraction(6, 1), 0), (0, 1): (Fraction(2, 1), 0), (1, 0): (Fraction(2, 1), 0), (1, 1): (Fraction(6, 1), 0)}), ((30, 6), {(0, 0): (0, 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (0, 0)}), ((30, 7), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((30, 8), {(0, 0): (0, 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (0, 0)}), ((30, 10), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((30, 12), {(0, 0): (0, 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (Fraction(36, 1), 0)}), ((30, 13), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((30, 14), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((30, 15), {(0, 0): (0, 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (Fraction(-36, 1), 0)}), ((30, 17), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((30, 18), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((30, 20), {(0, 0): (Fraction(36, 1), 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (0, 0)}), ((30, 21), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((30, 22), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((30, 23), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((30, 24), {(0, 0): (Fraction(-36, 1), 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (0, 0)}), ((30, 26), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((30, 27), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((30, 28), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((30, 30), {(0, 0): (Fraction(-36, 1), 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (Fraction(-36, 1), 0)}), ((30, 31), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((30, 32), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((30, 33), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((30, 34), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((30, 35), {(0, 0): (Fraction(36, 1), 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (Fraction(36, 1), 0)}), ((30, 37), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((30, 38), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((30, 39), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((30, 40), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((31, 6), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((31, 7), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((31, 8), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((31, 10), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((31, 12), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((31, 13), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((31, 14), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((31, 15), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((31, 17), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((31, 18), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((31, 20), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((31, 21), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((31, 22), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((31, 23), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((31, 24), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((31, 26), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((31, 27), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((31, 28), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((31, 30), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((31, 31), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((31, 32), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((31, 33), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((31, 34), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((31, 35), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((31, 37), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((31, 38), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((31, 39), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((31, 40), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((32, 6), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((32, 7), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((32, 8), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((32, 10), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((32, 12), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((32, 13), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((32, 14), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((32, 15), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((32, 17), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((32, 18), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((32, 20), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((32, 21), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((32, 22), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((32, 23), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((32, 24), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((32, 26), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((32, 27), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((32, 28), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((32, 30), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((32, 31), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((32, 32), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((32, 33), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((32, 34), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((32, 35), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((32, 37), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((32, 38), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((32, 39), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((32, 40), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((33, 6), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((33, 7), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((33, 8), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((33, 10), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((33, 12), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((33, 13), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((33, 14), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((33, 15), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((33, 17), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((33, 18), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((33, 20), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((33, 21), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((33, 22), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((33, 23), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((33, 24), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((33, 26), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((33, 27), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((33, 28), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((33, 30), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((33, 31), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((33, 32), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((33, 33), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((33, 34), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((33, 35), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((33, 37), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((33, 38), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((33, 39), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((33, 40), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((34, 6), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((34, 7), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((34, 8), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((34, 10), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((34, 12), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((34, 13), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((34, 14), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((34, 15), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((34, 17), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((34, 18), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((34, 20), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((34, 21), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((34, 22), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((34, 23), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((34, 24), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((34, 26), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((34, 27), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((34, 28), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((34, 30), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((34, 31), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((34, 32), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((34, 33), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((34, 34), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((34, 35), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((34, 37), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((34, 38), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((34, 39), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((34, 40), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((35, 6), {(0, 0): (0, 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (0, 0)}), ((35, 7), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((35, 8), {(0, 0): (0, 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (0, 0)}), ((35, 10), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((35, 12), {(0, 0): (0, 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (Fraction(-36, 1), 0)}), ((35, 13), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((35, 14), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((35, 15), {(0, 0): (0, 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (Fraction(36, 1), 0)}), ((35, 17), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((35, 18), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((35, 20), {(0, 0): (Fraction(-36, 1), 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (0, 0)}), ((35, 21), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((35, 22), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((35, 23), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((35, 24), {(0, 0): (Fraction(36, 1), 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (0, 0)}), ((35, 26), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((35, 27), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((35, 28), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((35, 30), {(0, 0): (Fraction(36, 1), 0), (0, 1): (Fraction(12, 1), 0), (1, 0): (Fraction(12, 1), 0), (1, 1): (Fraction(36, 1), 0)}), ((35, 31), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((35, 32), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((35, 33), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((35, 34), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((35, 35), {(0, 0): (Fraction(-36, 1), 0), (0, 1): (Fraction(-12, 1), 0), (1, 0): (Fraction(-12, 1), 0), (1, 1): (Fraction(-36, 1), 0)}), ((35, 37), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((35, 38), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((35, 39), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((35, 40), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((36, 5), {(0, 0): (0, 0), (0, 1): (Fraction(2, 1), 0), (1, 0): (Fraction(2, 1), 0), (1, 1): (0, 0)}), ((36, 11), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 1), 0), (1, 0): (Fraction(-2, 1), 0), (1, 1): (Fraction(-6, 1), 0)}), ((36, 19), {(0, 0): (Fraction(-6, 1), 0), (0, 1): (Fraction(-2, 1), 0), (1, 0): (Fraction(-2, 1), 0), (1, 1): (0, 0)}), ((36, 29), {(0, 0): (Fraction(6, 1), 0), (0, 1): (Fraction(2, 1), 0), (1, 0): (Fraction(2, 1), 0), (1, 1): (Fraction(6, 1), 0)}), ((37, 6), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((37, 7), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((37, 8), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((37, 10), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((37, 12), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((37, 13), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((37, 14), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((37, 15), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((37, 17), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((37, 18), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((37, 20), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((37, 21), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((37, 22), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((37, 23), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((37, 24), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((37, 26), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((37, 27), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((37, 28), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((37, 30), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((37, 31), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((37, 32), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((37, 33), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((37, 34), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((37, 35), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((37, 37), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((37, 38), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((37, 39), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((37, 40), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((38, 6), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((38, 7), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((38, 8), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((38, 10), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((38, 12), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((38, 13), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((38, 14), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((38, 15), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((38, 17), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((38, 18), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((38, 20), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((38, 21), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((38, 22), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((38, 23), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((38, 24), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((38, 26), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((38, 27), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((38, 28), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((38, 30), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((38, 31), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((38, 32), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((38, 33), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((38, 34), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((38, 35), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((38, 37), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((38, 38), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((38, 39), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((38, 40), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((39, 6), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((39, 7), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((39, 8), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((39, 10), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((39, 12), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((39, 13), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((39, 14), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((39, 15), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((39, 17), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((39, 18), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((39, 20), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((39, 21), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((39, 22), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((39, 23), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((39, 24), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((39, 26), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((39, 27), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((39, 28), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((39, 30), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((39, 31), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((39, 32), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((39, 33), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((39, 34), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((39, 35), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((39, 37), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((39, 38), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((39, 39), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((39, 40), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((40, 6), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((40, 7), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((40, 8), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((40, 10), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((40, 12), {(0, 0): (0, 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((40, 13), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((40, 14), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((40, 15), {(0, 0): (0, 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((40, 17), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((40, 18), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((40, 20), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (0, 0)}), ((40, 21), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((40, 22), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((40, 23), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((40, 24), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (0, 0)}), ((40, 26), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-2, 1), 0)}), ((40, 27), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((40, 28), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((40, 30), {(0, 0): (Fraction(-18, 1), 0), (0, 1): (Fraction(-6, 1), 0), (1, 0): (Fraction(-6, 1), 0), (1, 1): (Fraction(-18, 1), 0)}), ((40, 31), {(0, 0): (0, 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (0, 0)}), ((40, 32), {(0, 0): (0, 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (Fraction(-16, 1), 0)}), ((40, 33), {(0, 0): (Fraction(-16, 1), 0), (0, 1): (Fraction(-16, 3), 0), (1, 0): (Fraction(-16, 3), 0), (1, 1): (0, 0)}), ((40, 34), {(0, 0): (Fraction(16, 1), 0), (0, 1): (Fraction(16, 3), 0), (1, 0): (Fraction(16, 3), 0), (1, 1): (Fraction(16, 1), 0)}), ((40, 35), {(0, 0): (Fraction(18, 1), 0), (0, 1): (Fraction(6, 1), 0), (1, 0): (Fraction(6, 1), 0), (1, 1): (Fraction(18, 1), 0)}), ((40, 37), {(0, 0): (0, 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (0, 0)}), ((40, 38), {(0, 0): (0, 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (Fraction(2, 1), 0)}), ((40, 39), {(0, 0): (Fraction(2, 1), 0), (0, 1): (Fraction(2, 3), 0), (1, 0): (Fraction(2, 3), 0), (1, 1): (0, 0)}), ((40, 40), {(0, 0): (Fraction(-2, 1), 0), (0, 1): (Fraction(-2, 3), 0), (1, 0): (Fraction(-2, 3), 0), (1, 1): (Fraction(-2, 1), 0)})], 'color_connections': {'LO': [(0, ())], 'NLO': [(0, ((1, -1, 1),)), (1, ((2, -1, 2),)), (2, ((3, -1, 3),)), (3, ((4, -1, 4),))], 'NNLO': [(0, ((1, -2, 1), (-2, -2, -1))), (1, ((1, -2, 1), (-2, -1, -2))), (2, ((1, -2, 1), (1, -1, 1))), (3, ((1, -1, 1), (-1, -2, -1))), (4, ((1, -1, 1), (-1, -1, -2))), (5, ((1, -1, 1), (1, -2, 1))), (6, ((2, -2, 2), (-2, -2, -1))), (7, ((2, -2, 2), (-2, -1, -2))), (8, ((2, -2, 2), (1, -1, 1))), (9, ((2, -2, 2), (2, -1, 2))), (10, ((2, -1, 2), (-1, -2, -1))), (11, ((2, -1, 2), (-1, -1, -2))), (12, ((2, -1, 2), (1, -2, 1))), (13, ((2, -1, 2), (2, -2, 2))), (14, ((3, -2, 3), (-2, -2, -1))), (15, ((3, -2, 3), (-2, -1, -2))), (16, ((3, -2, 3), (1, -1, 1))), (17, ((3, -2, 3), (2, -1, 2))), (18, ((3, -2, 3), (3, -1, 3))), (19, ((3, -1, 3), (-1, -2, -1))), (20, ((3, -1, 3), (-1, -1, -2))), (21, ((3, -1, 3), (1, -2, 1))), (22, ((3, -1, 3), (2, -2, 2))), (23, ((3, -1, 3), (3, -2, 3))), (24, ((4, -2, 4), (-2, -2, -1))), (25, ((4, -2, 4), (-2, -1, -2))), (26, ((4, -2, 4), (1, -1, 1))), (27, ((4, -2, 4), (2, -1, 2))), (28, ((4, -2, 4), (3, -1, 3))), (29, ((4, -2, 4), (4, -1, 4))), (30, ((4, -1, 4), (-1, -2, -1))), (31, ((4, -1, 4), (-1, -1, -2))), (32, ((4, -1, 4), (1, -2, 1))), (33, ((4, -1, 4), (2, -2, 2))), (34, ((4, -1, 4), (3, -2, 3))), (35, ((4, -1, 4), (4, -2, 4)))]} } ################ # NNNLO results ################ epem_ddx_NNNLO_res = { 'color_matrices': [((1, 1), {(0, 0): (Fraction(12, 1), 0)}), ((1, 2), {(0, 0): (Fraction(-12, 1), 0)}), ((2, 1), {(0, 0): (Fraction(-12, 1), 0)}), ((2, 2), {(0, 0): (Fraction(12, 1), 0)}), ((3, 7), {(0, 0): (Fraction(6, 1), 0)}), ((3, 14), {(0, 0): (Fraction(-6, 1), 0)}), ((4, 4), {(0, 0): (Fraction(-36, 1), 0)}), ((4, 5), {(0, 0): (Fraction(18, 1), 0)}), ((4, 6), {(0, 0): (Fraction(36, 1), 0)}), ((4, 8), {(0, 0): (Fraction(-18, 1), 0)}), ((4, 10), {(0, 0): (Fraction(36, 1), 0)}), ((4, 11), {(0, 0): (Fraction(18, 1), 0)}), ((4, 12), {(0, 0): (Fraction(-18, 1), 0)}), ((4, 13), {(0, 0): (Fraction(-36, 1), 0)}), ((4, 15), {(0, 0): (Fraction(-18, 1), 0)}), ((4, 16), {(0, 0): (Fraction(18, 1), 0)}), ((5, 4), {(0, 0): (Fraction(18, 1), 0)}), ((5, 5), {(0, 0): (Fraction(-2, 1), 0)}), ((5, 6), {(0, 0): (Fraction(-18, 1), 0)}), ((5, 8), {(0, 0): (Fraction(16, 1), 0)}), ((5, 10), {(0, 0): (Fraction(-18, 1), 0)}), ((5, 11), {(0, 0): (Fraction(-16, 1), 0)}), ((5, 12), {(0, 0): (Fraction(16, 1), 0)}), ((5, 13), {(0, 0): (Fraction(18, 1), 0)}), ((5, 15), {(0, 0): (Fraction(2, 1), 0)}), ((5, 16), {(0, 0): (Fraction(-2, 1), 0)}), ((6, 4), {(0, 0): (Fraction(36, 1), 0)}), ((6, 5), {(0, 0): (Fraction(-18, 1), 0)}), ((6, 6), {(0, 0): (Fraction(-36, 1), 0)}), ((6, 8), {(0, 0): (Fraction(18, 1), 0)}), ((6, 10), {(0, 0): (Fraction(-36, 1), 0)}), ((6, 11), {(0, 0): (Fraction(-18, 1), 0)}), ((6, 12), {(0, 0): (Fraction(18, 1), 0)}), ((6, 13), {(0, 0): (Fraction(36, 1), 0)}), ((6, 15), {(0, 0): (Fraction(18, 1), 0)}), ((6, 16), {(0, 0): (Fraction(-18, 1), 0)}), ((7, 3), {(0, 0): (Fraction(6, 1), 0)}), ((7, 9), {(0, 0): (Fraction(-6, 1), 0)}), ((8, 4), {(0, 0): (Fraction(-18, 1), 0)}), ((8, 5), {(0, 0): (Fraction(16, 1), 0)}), ((8, 6), {(0, 0): (Fraction(18, 1), 0)}), ((8, 8), {(0, 0): (Fraction(-2, 1), 0)}), ((8, 10), {(0, 0): (Fraction(18, 1), 0)}), ((8, 11), {(0, 0): (Fraction(2, 1), 0)}), ((8, 12), {(0, 0): (Fraction(-2, 1), 0)}), ((8, 13), {(0, 0): (Fraction(-18, 1), 0)}), ((8, 15), {(0, 0): (Fraction(-16, 1), 0)}), ((8, 16), {(0, 0): (Fraction(16, 1), 0)}), ((9, 7), {(0, 0): (Fraction(-6, 1), 0)}), ((9, 14), {(0, 0): (Fraction(6, 1), 0)}), ((10, 4), {(0, 0): (Fraction(36, 1), 0)}), ((10, 5), {(0, 0): (Fraction(-18, 1), 0)}), ((10, 6), {(0, 0): (Fraction(-36, 1), 0)}), ((10, 8), {(0, 0): (Fraction(18, 1), 0)}), ((10, 10), {(0, 0): (Fraction(-36, 1), 0)}), ((10, 11), {(0, 0): (Fraction(-18, 1), 0)}), ((10, 12), {(0, 0): (Fraction(18, 1), 0)}), ((10, 13), {(0, 0): (Fraction(36, 1), 0)}), ((10, 15), {(0, 0): (Fraction(18, 1), 0)}), ((10, 16), {(0, 0): (Fraction(-18, 1), 0)}), ((11, 4), {(0, 0): (Fraction(-18, 1), 0)}), ((11, 5), {(0, 0): (Fraction(2, 1), 0)}), ((11, 6), {(0, 0): (Fraction(18, 1), 0)}), ((11, 8), {(0, 0): (Fraction(-16, 1), 0)}), ((11, 10), {(0, 0): (Fraction(18, 1), 0)}), ((11, 11), {(0, 0): (Fraction(16, 1), 0)}), ((11, 12), {(0, 0): (Fraction(-16, 1), 0)}), ((11, 13), {(0, 0): (Fraction(-18, 1), 0)}), ((11, 15), {(0, 0): (Fraction(-2, 1), 0)}), ((11, 16), {(0, 0): (Fraction(2, 1), 0)}), ((12, 4), {(0, 0): (Fraction(-18, 1), 0)}), ((12, 5), {(0, 0): (Fraction(16, 1), 0)}), ((12, 6), {(0, 0): (Fraction(18, 1), 0)}), ((12, 8), {(0, 0): (Fraction(-2, 1), 0)}), ((12, 10), {(0, 0): (Fraction(-18, 1), 0)}), ((12, 11), {(0, 0): (Fraction(2, 1), 0)}), ((12, 12), {(0, 0): (Fraction(-2, 1), 0)}), ((12, 13), {(0, 0): (Fraction(18, 1), 0)}), ((12, 15), {(0, 0): (Fraction(-16, 1), 0)}), ((12, 16), {(0, 0): (Fraction(16, 1), 0)}), ((13, 4), {(0, 0): (Fraction(-36, 1), 0)}), ((13, 5), {(0, 0): (Fraction(18, 1), 0)}), ((13, 6), {(0, 0): (Fraction(36, 1), 0)}), ((13, 8), {(0, 0): (Fraction(-18, 1), 0)}), ((13, 10), {(0, 0): (Fraction(36, 1), 0)}), ((13, 11), {(0, 0): (Fraction(18, 1), 0)}), ((13, 12), {(0, 0): (Fraction(-18, 1), 0)}), ((13, 13), {(0, 0): (Fraction(-36, 1), 0)}), ((13, 15), {(0, 0): (Fraction(-18, 1), 0)}), ((13, 16), {(0, 0): (Fraction(18, 1), 0)}), ((14, 3), {(0, 0): (Fraction(-6, 1), 0)}), ((14, 9), {(0, 0): (Fraction(6, 1), 0)}), ((15, 4), {(0, 0): (Fraction(18, 1), 0)}), ((15, 5), {(0, 0): (Fraction(-16, 1), 0)}), ((15, 6), {(0, 0): (Fraction(-18, 1), 0)}), ((15, 8), {(0, 0): (Fraction(2, 1), 0)}), ((15, 10), {(0, 0): (Fraction(-18, 1), 0)}), ((15, 11), {(0, 0): (Fraction(-2, 1), 0)}), ((15, 12), {(0, 0): (Fraction(2, 1), 0)}), ((15, 13), {(0, 0): (Fraction(18, 1), 0)}), ((15, 15), {(0, 0): (Fraction(16, 1), 0)}), ((15, 16), {(0, 0): (Fraction(-16, 1), 0)}), ((16, 4), {(0, 0): (Fraction(18, 1), 0)}), ((16, 5), {(0, 0): (Fraction(-2, 1), 0)}), ((16, 6), {(0, 0): (Fraction(-18, 1), 0)}), ((16, 8), {(0, 0): (Fraction(16, 1), 0)}), ((16, 10), {(0, 0): (Fraction(18, 1), 0)}), ((16, 11), {(0, 0): (Fraction(-16, 1), 0)}), ((16, 12), {(0, 0): (Fraction(16, 1), 0)}), ((16, 13), {(0, 0): (Fraction(-18, 1), 0)}), ((16, 15), {(0, 0): (Fraction(2, 1), 0)}), ((16, 16), {(0, 0): (Fraction(-2, 1), 0)}), ((17, 43), {(0, 0): (Fraction(-8, 1), 0)}), ((17, 44), {(0, 0): (Fraction(-1, 1), 0)}), ((17, 47), {(0, 0): (Fraction(-9, 1), 0)}), ((17, 57), {(0, 0): (Fraction(2, 1), 0)}), ((17, 66), {(0, 0): (Fraction(9, 1), 0)}), ((17, 79), {(0, 0): (Fraction(-7, 1), 0)}), ((17, 121), {(0, 0): (Fraction(8, 1), 0)}), ((17, 122), {(0, 0): (Fraction(1, 1), 0)}), ((17, 125), {(0, 0): (Fraction(9, 1), 0)}), ((17, 135), {(0, 0): (Fraction(7, 1), 0)}), ((17, 146), {(0, 0): (Fraction(-7, 1), 0)}), ((17, 156), {(0, 0): (Fraction(-9, 1), 0)}), ((17, 169), {(0, 0): (Fraction(-2, 1), 0)}), ((17, 180), {(0, 0): (Fraction(2, 1), 0)}), ((18, 50), {(0, 0): (Fraction(9, 1), 0)}), ((18, 59), {(0, 0): (Fraction(-7, 1), 0)}), ((18, 68), {(0, 0): (Fraction(-9, 1), 0)}), ((18, 69), {(0, 0): (Fraction(-8, 1), 0)}), ((18, 70), {(0, 0): (Fraction(-1, 1), 0)}), ((18, 81), {(0, 0): (Fraction(2, 1), 0)}), ((18, 128), {(0, 0): (Fraction(-9, 1), 0)}), ((18, 137), {(0, 0): (Fraction(-2, 1), 0)}), ((18, 148), {(0, 0): (Fraction(2, 1), 0)}), ((18, 158), {(0, 0): (Fraction(9, 1), 0)}), ((18, 159), {(0, 0): (Fraction(8, 1), 0)}), ((18, 160), {(0, 0): (Fraction(1, 1), 0)}), ((18, 171), {(0, 0): (Fraction(7, 1), 0)}), ((18, 182), {(0, 0): (Fraction(-7, 1), 0)}), ((19, 50), {(0, 0): (Fraction(18, 1), 0)}), ((19, 59), {(0, 0): (Fraction(-9, 1), 0)}), ((19, 68), {(0, 0): (Fraction(-18, 1), 0)}), ((19, 69), {(0, 0): (Fraction(-9, 1), 0)}), ((19, 70), {(0, 0): (Fraction(-9, 1), 0)}), ((19, 81), {(0, 0): (Fraction(9, 1), 0)}), ((19, 128), {(0, 0): (Fraction(-18, 1), 0)}), ((19, 137), {(0, 0): (Fraction(-9, 1), 0)}), ((19, 148), {(0, 0): (Fraction(9, 1), 0)}), ((19, 158), {(0, 0): (Fraction(18, 1), 0)}), ((19, 159), {(0, 0): (Fraction(9, 1), 0)}), ((19, 160), {(0, 0): (Fraction(9, 1), 0)}), ((19, 171), {(0, 0): (Fraction(9, 1), 0)}), ((19, 182), {(0, 0): (Fraction(-9, 1), 0)}), ((20, 20), {(0, 0): (Fraction(108, 1), 0)}), ((20, 22), {(0, 0): (Fraction(54, 1), 0)}), ((20, 25), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 27), {(0, 0): (Fraction(54, 1), 0)}), ((20, 30), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 32), {(0, 0): (Fraction(27, 1), 0)}), ((20, 33), {(0, 0): (0, 0)}), ((20, 35), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 36), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 38), {(0, 0): (Fraction(27, 1), 0)}), ((20, 40), {(0, 0): (Fraction(-108, 1), 0)}), ((20, 42), {(0, 0): (Fraction(54, 1), 0)}), ((20, 46), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 49), {(0, 0): (Fraction(108, 1), 0)}), ((20, 52), {(0, 0): (Fraction(54, 1), 0)}), ((20, 54), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 55), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 56), {(0, 0): (Fraction(27, 1), 0)}), ((20, 58), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 60), {(0, 0): (Fraction(27, 1), 0)}), ((20, 62), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 63), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 65), {(0, 0): (Fraction(54, 1), 0)}), ((20, 67), {(0, 0): (Fraction(-108, 1), 0)}), ((20, 74), {(0, 0): (Fraction(27, 1), 0)}), ((20, 75), {(0, 0): (Fraction(27, 1), 0)}), ((20, 77), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 78), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 80), {(0, 0): (Fraction(54, 1), 0)}), ((20, 82), {(0, 0): (0, 0)}), ((20, 86), {(0, 0): (Fraction(-108, 1), 0)}), ((20, 88), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 91), {(0, 0): (Fraction(54, 1), 0)}), ((20, 93), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 96), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 98), {(0, 0): (Fraction(27, 1), 0)}), ((20, 99), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 101), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 102), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 104), {(0, 0): (0, 0)}), ((20, 106), {(0, 0): (Fraction(54, 1), 0)}), ((20, 108), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 109), {(0, 0): (0, 0)}), ((20, 110), {(0, 0): (0, 0)}), ((20, 112), {(0, 0): (Fraction(27, 1), 0)}), ((20, 113), {(0, 0): (Fraction(27, 1), 0)}), ((20, 115), {(0, 0): (Fraction(27, 1), 0)}), ((20, 116), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 118), {(0, 0): (Fraction(108, 1), 0)}), ((20, 120), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 124), {(0, 0): (Fraction(54, 1), 0)}), ((20, 127), {(0, 0): (Fraction(-108, 1), 0)}), ((20, 130), {(0, 0): (Fraction(54, 1), 0)}), ((20, 132), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 133), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 134), {(0, 0): (Fraction(27, 1), 0)}), ((20, 136), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 138), {(0, 0): (Fraction(27, 1), 0)}), ((20, 140), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 142), {(0, 0): (Fraction(27, 1), 0)}), ((20, 143), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 144), {(0, 0): (Fraction(27, 1), 0)}), ((20, 145), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 147), {(0, 0): (Fraction(54, 1), 0)}), ((20, 149), {(0, 0): (Fraction(27, 1), 0)}), ((20, 150), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 152), {(0, 0): (Fraction(54, 1), 0)}), ((20, 153), {(0, 0): (Fraction(54, 1), 0)}), ((20, 155), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 157), {(0, 0): (Fraction(108, 1), 0)}), ((20, 164), {(0, 0): (Fraction(27, 1), 0)}), ((20, 165), {(0, 0): (Fraction(27, 1), 0)}), ((20, 167), {(0, 0): (0, 0)}), ((20, 168), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 170), {(0, 0): (Fraction(54, 1), 0)}), ((20, 172), {(0, 0): (Fraction(27, 1), 0)}), ((20, 174), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 175), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 177), {(0, 0): (Fraction(-27, 1), 0)}), ((20, 178), {(0, 0): (Fraction(27, 1), 0)}), ((20, 179), {(0, 0): (Fraction(27, 1), 0)}), ((20, 181), {(0, 0): (Fraction(-54, 1), 0)}), ((20, 183), {(0, 0): (0, 0)}), ((20, 184), {(0, 0): (0, 0)}), ((21, 43), {(0, 0): (Fraction(-9, 1), 0)}), ((21, 44), {(0, 0): (Fraction(-9, 1), 0)}), ((21, 47), {(0, 0): (Fraction(-18, 1), 0)}), ((21, 57), {(0, 0): (Fraction(9, 1), 0)}), ((21, 66), {(0, 0): (Fraction(18, 1), 0)}), ((21, 79), {(0, 0): (Fraction(-9, 1), 0)}), ((21, 121), {(0, 0): (Fraction(9, 1), 0)}), ((21, 122), {(0, 0): (Fraction(9, 1), 0)}), ((21, 125), {(0, 0): (Fraction(18, 1), 0)}), ((21, 135), {(0, 0): (Fraction(9, 1), 0)}), ((21, 146), {(0, 0): (Fraction(-9, 1), 0)}), ((21, 156), {(0, 0): (Fraction(-18, 1), 0)}), ((21, 169), {(0, 0): (Fraction(-9, 1), 0)}), ((21, 180), {(0, 0): (Fraction(9, 1), 0)}), ((22, 20), {(0, 0): (Fraction(54, 1), 0)}), ((22, 22), {(0, 0): (Fraction(108, 1), 0)}), ((22, 25), {(0, 0): (Fraction(54, 1), 0)}), ((22, 27), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 30), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 32), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 33), {(0, 0): (Fraction(27, 1), 0)}), ((22, 35), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 36), {(0, 0): (Fraction(27, 1), 0)}), ((22, 38), {(0, 0): (0, 0)}), ((22, 40), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 42), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 46), {(0, 0): (Fraction(-108, 1), 0)}), ((22, 49), {(0, 0): (Fraction(54, 1), 0)}), ((22, 52), {(0, 0): (Fraction(27, 1), 0)}), ((22, 54), {(0, 0): (Fraction(27, 1), 0)}), ((22, 55), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 56), {(0, 0): (Fraction(54, 1), 0)}), ((22, 58), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 60), {(0, 0): (0, 0)}), ((22, 62), {(0, 0): (Fraction(-108, 1), 0)}), ((22, 63), {(0, 0): (Fraction(54, 1), 0)}), ((22, 65), {(0, 0): (Fraction(108, 1), 0)}), ((22, 67), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 74), {(0, 0): (Fraction(54, 1), 0)}), ((22, 75), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 77), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 78), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 80), {(0, 0): (Fraction(27, 1), 0)}), ((22, 82), {(0, 0): (Fraction(27, 1), 0)}), ((22, 86), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 88), {(0, 0): (Fraction(-108, 1), 0)}), ((22, 91), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 93), {(0, 0): (Fraction(54, 1), 0)}), ((22, 96), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 98), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 99), {(0, 0): (0, 0)}), ((22, 101), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 102), {(0, 0): (Fraction(27, 1), 0)}), ((22, 104), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 106), {(0, 0): (Fraction(27, 1), 0)}), ((22, 108), {(0, 0): (Fraction(27, 1), 0)}), ((22, 109), {(0, 0): (Fraction(27, 1), 0)}), ((22, 110), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 112), {(0, 0): (Fraction(54, 1), 0)}), ((22, 113), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 115), {(0, 0): (0, 0)}), ((22, 116), {(0, 0): (0, 0)}), ((22, 118), {(0, 0): (Fraction(54, 1), 0)}), ((22, 120), {(0, 0): (Fraction(54, 1), 0)}), ((22, 124), {(0, 0): (Fraction(108, 1), 0)}), ((22, 127), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 130), {(0, 0): (Fraction(27, 1), 0)}), ((22, 132), {(0, 0): (Fraction(27, 1), 0)}), ((22, 133), {(0, 0): (0, 0)}), ((22, 134), {(0, 0): (Fraction(54, 1), 0)}), ((22, 136), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 138), {(0, 0): (Fraction(27, 1), 0)}), ((22, 140), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 142), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 143), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 144), {(0, 0): (Fraction(27, 1), 0)}), ((22, 145), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 147), {(0, 0): (Fraction(27, 1), 0)}), ((22, 149), {(0, 0): (0, 0)}), ((22, 150), {(0, 0): (0, 0)}), ((22, 152), {(0, 0): (Fraction(108, 1), 0)}), ((22, 153), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 155), {(0, 0): (Fraction(-108, 1), 0)}), ((22, 157), {(0, 0): (Fraction(54, 1), 0)}), ((22, 164), {(0, 0): (Fraction(54, 1), 0)}), ((22, 165), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 167), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 168), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 170), {(0, 0): (Fraction(27, 1), 0)}), ((22, 172), {(0, 0): (Fraction(27, 1), 0)}), ((22, 174), {(0, 0): (Fraction(-54, 1), 0)}), ((22, 175), {(0, 0): (Fraction(27, 1), 0)}), ((22, 177), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 178), {(0, 0): (Fraction(27, 1), 0)}), ((22, 179), {(0, 0): (Fraction(54, 1), 0)}), ((22, 181), {(0, 0): (Fraction(-27, 1), 0)}), ((22, 183), {(0, 0): (Fraction(27, 1), 0)}), ((22, 184), {(0, 0): (Fraction(-27, 1), 0)}), ((23, 28), {(0, 0): (Fraction(-18, 1), 0)}), ((23, 37), {(0, 0): (Fraction(9, 1), 0)}), ((23, 64), {(0, 0): (Fraction(18, 1), 0)}), ((23, 71), {(0, 0): (Fraction(9, 1), 0)}), ((23, 72), {(0, 0): (Fraction(9, 1), 0)}), ((23, 76), {(0, 0): (Fraction(-9, 1), 0)}), ((23, 94), {(0, 0): (Fraction(18, 1), 0)}), ((23, 103), {(0, 0): (Fraction(9, 1), 0)}), ((23, 114), {(0, 0): (Fraction(-9, 1), 0)}), ((23, 154), {(0, 0): (Fraction(-18, 1), 0)}), ((23, 161), {(0, 0): (Fraction(-9, 1), 0)}), ((23, 162), {(0, 0): (Fraction(-9, 1), 0)}), ((23, 166), {(0, 0): (Fraction(-9, 1), 0)}), ((23, 176), {(0, 0): (Fraction(9, 1), 0)}), ((24, 43), {(0, 0): (Fraction(-1, 1), 0)}), ((24, 44), {(0, 0): (Fraction(-8, 1), 0)}), ((24, 47), {(0, 0): (Fraction(-9, 1), 0)}), ((24, 57), {(0, 0): (Fraction(7, 1), 0)}), ((24, 66), {(0, 0): (Fraction(9, 1), 0)}), ((24, 79), {(0, 0): (Fraction(-2, 1), 0)}), ((24, 121), {(0, 0): (Fraction(1, 1), 0)}), ((24, 122), {(0, 0): (Fraction(8, 1), 0)}), ((24, 125), {(0, 0): (Fraction(9, 1), 0)}), ((24, 135), {(0, 0): (Fraction(2, 1), 0)}), ((24, 146), {(0, 0): (Fraction(-2, 1), 0)}), ((24, 156), {(0, 0): (Fraction(-9, 1), 0)}), ((24, 169), {(0, 0): (Fraction(-7, 1), 0)}), ((24, 180), {(0, 0): (Fraction(7, 1), 0)}), ((25, 20), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 22), {(0, 0): (Fraction(54, 1), 0)}), ((25, 25), {(0, 0): (Fraction(108, 1), 0)}), ((25, 27), {(0, 0): (Fraction(-108, 1), 0)}), ((25, 30), {(0, 0): (Fraction(27, 1), 0)}), ((25, 32), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 33), {(0, 0): (Fraction(27, 1), 0)}), ((25, 35), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 36), {(0, 0): (Fraction(54, 1), 0)}), ((25, 38), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 40), {(0, 0): (Fraction(54, 1), 0)}), ((25, 42), {(0, 0): (Fraction(-108, 1), 0)}), ((25, 46), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 49), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 52), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 54), {(0, 0): (Fraction(54, 1), 0)}), ((25, 55), {(0, 0): (0, 0)}), ((25, 56), {(0, 0): (Fraction(27, 1), 0)}), ((25, 58), {(0, 0): (Fraction(27, 1), 0)}), ((25, 60), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 62), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 63), {(0, 0): (Fraction(108, 1), 0)}), ((25, 65), {(0, 0): (Fraction(54, 1), 0)}), ((25, 67), {(0, 0): (Fraction(54, 1), 0)}), ((25, 74), {(0, 0): (Fraction(27, 1), 0)}), ((25, 75), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 77), {(0, 0): (0, 0)}), ((25, 78), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 80), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 82), {(0, 0): (Fraction(27, 1), 0)}), ((25, 86), {(0, 0): (Fraction(54, 1), 0)}), ((25, 88), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 91), {(0, 0): (Fraction(-108, 1), 0)}), ((25, 93), {(0, 0): (Fraction(108, 1), 0)}), ((25, 96), {(0, 0): (Fraction(27, 1), 0)}), ((25, 98), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 99), {(0, 0): (Fraction(27, 1), 0)}), ((25, 101), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 102), {(0, 0): (Fraction(54, 1), 0)}), ((25, 104), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 106), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 108), {(0, 0): (Fraction(54, 1), 0)}), ((25, 109), {(0, 0): (Fraction(27, 1), 0)}), ((25, 110), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 112), {(0, 0): (Fraction(27, 1), 0)}), ((25, 113), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 115), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 116), {(0, 0): (Fraction(27, 1), 0)}), ((25, 118), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 120), {(0, 0): (Fraction(108, 1), 0)}), ((25, 124), {(0, 0): (Fraction(54, 1), 0)}), ((25, 127), {(0, 0): (Fraction(54, 1), 0)}), ((25, 130), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 132), {(0, 0): (Fraction(54, 1), 0)}), ((25, 133), {(0, 0): (Fraction(27, 1), 0)}), ((25, 134), {(0, 0): (Fraction(27, 1), 0)}), ((25, 136), {(0, 0): (Fraction(27, 1), 0)}), ((25, 138), {(0, 0): (0, 0)}), ((25, 140), {(0, 0): (Fraction(27, 1), 0)}), ((25, 142), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 143), {(0, 0): (0, 0)}), ((25, 144), {(0, 0): (0, 0)}), ((25, 145), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 147), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 149), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 150), {(0, 0): (Fraction(27, 1), 0)}), ((25, 152), {(0, 0): (Fraction(54, 1), 0)}), ((25, 153), {(0, 0): (Fraction(-108, 1), 0)}), ((25, 155), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 157), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 164), {(0, 0): (Fraction(27, 1), 0)}), ((25, 165), {(0, 0): (Fraction(-54, 1), 0)}), ((25, 167), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 168), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 170), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 172), {(0, 0): (0, 0)}), ((25, 174), {(0, 0): (Fraction(-27, 1), 0)}), ((25, 175), {(0, 0): (Fraction(54, 1), 0)}), ((25, 177), {(0, 0): (0, 0)}), ((25, 178), {(0, 0): (0, 0)}), ((25, 179), {(0, 0): (Fraction(27, 1), 0)}), ((25, 181), {(0, 0): (Fraction(27, 1), 0)}), ((25, 183), {(0, 0): (Fraction(27, 1), 0)}), ((25, 184), {(0, 0): (Fraction(-27, 1), 0)}), ((26, 50), {(0, 0): (Fraction(9, 1), 0)}), ((26, 59), {(0, 0): (Fraction(-2, 1), 0)}), ((26, 68), {(0, 0): (Fraction(-9, 1), 0)}), ((26, 69), {(0, 0): (Fraction(-1, 1), 0)}), ((26, 70), {(0, 0): (Fraction(-8, 1), 0)}), ((26, 81), {(0, 0): (Fraction(7, 1), 0)}), ((26, 128), {(0, 0): (Fraction(-9, 1), 0)}), ((26, 137), {(0, 0): (Fraction(-7, 1), 0)}), ((26, 148), {(0, 0): (Fraction(7, 1), 0)}), ((26, 158), {(0, 0): (Fraction(9, 1), 0)}), ((26, 159), {(0, 0): (Fraction(1, 1), 0)}), ((26, 160), {(0, 0): (Fraction(8, 1), 0)}), ((26, 171), {(0, 0): (Fraction(2, 1), 0)}), ((26, 182), {(0, 0): (Fraction(-2, 1), 0)}), ((27, 20), {(0, 0): (Fraction(54, 1), 0)}), ((27, 22), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 25), {(0, 0): (Fraction(-108, 1), 0)}), ((27, 27), {(0, 0): (Fraction(108, 1), 0)}), ((27, 30), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 32), {(0, 0): (Fraction(54, 1), 0)}), ((27, 33), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 35), {(0, 0): (Fraction(27, 1), 0)}), ((27, 36), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 38), {(0, 0): (Fraction(27, 1), 0)}), ((27, 40), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 42), {(0, 0): (Fraction(108, 1), 0)}), ((27, 46), {(0, 0): (Fraction(54, 1), 0)}), ((27, 49), {(0, 0): (Fraction(54, 1), 0)}), ((27, 52), {(0, 0): (Fraction(27, 1), 0)}), ((27, 54), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 55), {(0, 0): (0, 0)}), ((27, 56), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 58), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 60), {(0, 0): (Fraction(27, 1), 0)}), ((27, 62), {(0, 0): (Fraction(54, 1), 0)}), ((27, 63), {(0, 0): (Fraction(-108, 1), 0)}), ((27, 65), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 67), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 74), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 75), {(0, 0): (Fraction(54, 1), 0)}), ((27, 77), {(0, 0): (0, 0)}), ((27, 78), {(0, 0): (Fraction(27, 1), 0)}), ((27, 80), {(0, 0): (Fraction(27, 1), 0)}), ((27, 82), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 86), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 88), {(0, 0): (Fraction(54, 1), 0)}), ((27, 91), {(0, 0): (Fraction(108, 1), 0)}), ((27, 93), {(0, 0): (Fraction(-108, 1), 0)}), ((27, 96), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 98), {(0, 0): (Fraction(54, 1), 0)}), ((27, 99), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 101), {(0, 0): (Fraction(27, 1), 0)}), ((27, 102), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 104), {(0, 0): (Fraction(27, 1), 0)}), ((27, 106), {(0, 0): (Fraction(27, 1), 0)}), ((27, 108), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 109), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 110), {(0, 0): (Fraction(27, 1), 0)}), ((27, 112), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 113), {(0, 0): (Fraction(54, 1), 0)}), ((27, 115), {(0, 0): (Fraction(27, 1), 0)}), ((27, 116), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 118), {(0, 0): (Fraction(54, 1), 0)}), ((27, 120), {(0, 0): (Fraction(-108, 1), 0)}), ((27, 124), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 127), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 130), {(0, 0): (Fraction(27, 1), 0)}), ((27, 132), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 133), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 134), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 136), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 138), {(0, 0): (0, 0)}), ((27, 140), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 142), {(0, 0): (Fraction(54, 1), 0)}), ((27, 143), {(0, 0): (0, 0)}), ((27, 144), {(0, 0): (0, 0)}), ((27, 145), {(0, 0): (Fraction(27, 1), 0)}), ((27, 147), {(0, 0): (Fraction(27, 1), 0)}), ((27, 149), {(0, 0): (Fraction(27, 1), 0)}), ((27, 150), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 152), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 153), {(0, 0): (Fraction(108, 1), 0)}), ((27, 155), {(0, 0): (Fraction(54, 1), 0)}), ((27, 157), {(0, 0): (Fraction(54, 1), 0)}), ((27, 164), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 165), {(0, 0): (Fraction(54, 1), 0)}), ((27, 167), {(0, 0): (Fraction(27, 1), 0)}), ((27, 168), {(0, 0): (Fraction(27, 1), 0)}), ((27, 170), {(0, 0): (Fraction(27, 1), 0)}), ((27, 172), {(0, 0): (0, 0)}), ((27, 174), {(0, 0): (Fraction(27, 1), 0)}), ((27, 175), {(0, 0): (Fraction(-54, 1), 0)}), ((27, 177), {(0, 0): (0, 0)}), ((27, 178), {(0, 0): (0, 0)}), ((27, 179), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 181), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 183), {(0, 0): (Fraction(-27, 1), 0)}), ((27, 184), {(0, 0): (Fraction(27, 1), 0)}), ((28, 23), {(0, 0): (Fraction(-18, 1), 0)}), ((28, 31), {(0, 0): (Fraction(9, 1), 0)}), ((28, 41), {(0, 0): (Fraction(18, 1), 0)}), ((28, 45), {(0, 0): (Fraction(9, 1), 0)}), ((28, 48), {(0, 0): (Fraction(9, 1), 0)}), ((28, 53), {(0, 0): (Fraction(-9, 1), 0)}), ((28, 89), {(0, 0): (Fraction(18, 1), 0)}), ((28, 97), {(0, 0): (Fraction(9, 1), 0)}), ((28, 107), {(0, 0): (Fraction(-9, 1), 0)}), ((28, 119), {(0, 0): (Fraction(-18, 1), 0)}), ((28, 123), {(0, 0): (Fraction(-9, 1), 0)}), ((28, 126), {(0, 0): (Fraction(-9, 1), 0)}), ((28, 131), {(0, 0): (Fraction(-9, 1), 0)}), ((28, 141), {(0, 0): (Fraction(9, 1), 0)}), ((29, 50), {(0, 0): (Fraction(-9, 1), 0)}), ((29, 59), {(0, 0): (Fraction(8, 1), 0)}), ((29, 68), {(0, 0): (Fraction(9, 1), 0)}), ((29, 69), {(0, 0): (Fraction(7, 1), 0)}), ((29, 70), {(0, 0): (Fraction(2, 1), 0)}), ((29, 81), {(0, 0): (Fraction(-1, 1), 0)}), ((29, 128), {(0, 0): (Fraction(9, 1), 0)}), ((29, 137), {(0, 0): (Fraction(1, 1), 0)}), ((29, 148), {(0, 0): (Fraction(-1, 1), 0)}), ((29, 158), {(0, 0): (Fraction(-9, 1), 0)}), ((29, 159), {(0, 0): (Fraction(-7, 1), 0)}), ((29, 160), {(0, 0): (Fraction(-2, 1), 0)}), ((29, 171), {(0, 0): (Fraction(-8, 1), 0)}), ((29, 182), {(0, 0): (Fraction(8, 1), 0)}), ((30, 20), {(0, 0): (Fraction(-54, 1), 0)}), ((30, 22), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 25), {(0, 0): (Fraction(27, 1), 0)}), ((30, 27), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 30), {(0, 0): (Fraction(6, 1), 0)}), ((30, 32), {(0, 0): (0, 0)}), ((30, 33), {(0, 0): (Fraction(-3, 1), 0)}), ((30, 35), {(0, 0): (Fraction(27, 1), 0)}), ((30, 36), {(0, 0): (0, 0)}), ((30, 38), {(0, 0): (Fraction(-3, 1), 0)}), ((30, 40), {(0, 0): (Fraction(54, 1), 0)}), ((30, 42), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 46), {(0, 0): (Fraction(27, 1), 0)}), ((30, 49), {(0, 0): (Fraction(-54, 1), 0)}), ((30, 52), {(0, 0): (Fraction(-48, 1), 0)}), ((30, 54), {(0, 0): (Fraction(27, 1), 0)}), ((30, 55), {(0, 0): (Fraction(24, 1), 0)}), ((30, 56), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 58), {(0, 0): (Fraction(48, 1), 0)}), ((30, 60), {(0, 0): (Fraction(-24, 1), 0)}), ((30, 62), {(0, 0): (Fraction(27, 1), 0)}), ((30, 63), {(0, 0): (Fraction(27, 1), 0)}), ((30, 65), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 67), {(0, 0): (Fraction(54, 1), 0)}), ((30, 74), {(0, 0): (0, 0)}), ((30, 75), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 77), {(0, 0): (Fraction(3, 1), 0)}), ((30, 78), {(0, 0): (0, 0)}), ((30, 80), {(0, 0): (Fraction(-6, 1), 0)}), ((30, 82), {(0, 0): (Fraction(3, 1), 0)}), ((30, 86), {(0, 0): (Fraction(54, 1), 0)}), ((30, 88), {(0, 0): (Fraction(27, 1), 0)}), ((30, 91), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 93), {(0, 0): (Fraction(27, 1), 0)}), ((30, 96), {(0, 0): (Fraction(48, 1), 0)}), ((30, 98), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 99), {(0, 0): (Fraction(24, 1), 0)}), ((30, 101), {(0, 0): (0, 0)}), ((30, 102), {(0, 0): (Fraction(27, 1), 0)}), ((30, 104), {(0, 0): (Fraction(-3, 1), 0)}), ((30, 106), {(0, 0): (Fraction(-48, 1), 0)}), ((30, 108), {(0, 0): (Fraction(27, 1), 0)}), ((30, 109), {(0, 0): (Fraction(3, 1), 0)}), ((30, 110), {(0, 0): (Fraction(-3, 1), 0)}), ((30, 112), {(0, 0): (0, 0)}), ((30, 113), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 115), {(0, 0): (Fraction(-24, 1), 0)}), ((30, 116), {(0, 0): (Fraction(24, 1), 0)}), ((30, 118), {(0, 0): (Fraction(-54, 1), 0)}), ((30, 120), {(0, 0): (Fraction(27, 1), 0)}), ((30, 124), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 127), {(0, 0): (Fraction(54, 1), 0)}), ((30, 130), {(0, 0): (Fraction(-6, 1), 0)}), ((30, 132), {(0, 0): (0, 0)}), ((30, 133), {(0, 0): (Fraction(3, 1), 0)}), ((30, 134), {(0, 0): (0, 0)}), ((30, 136), {(0, 0): (Fraction(6, 1), 0)}), ((30, 138), {(0, 0): (Fraction(-3, 1), 0)}), ((30, 140), {(0, 0): (Fraction(6, 1), 0)}), ((30, 142), {(0, 0): (0, 0)}), ((30, 143), {(0, 0): (Fraction(3, 1), 0)}), ((30, 144), {(0, 0): (Fraction(-3, 1), 0)}), ((30, 145), {(0, 0): (0, 0)}), ((30, 147), {(0, 0): (Fraction(-6, 1), 0)}), ((30, 149), {(0, 0): (Fraction(-3, 1), 0)}), ((30, 150), {(0, 0): (Fraction(3, 1), 0)}), ((30, 152), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 153), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 155), {(0, 0): (Fraction(27, 1), 0)}), ((30, 157), {(0, 0): (Fraction(-54, 1), 0)}), ((30, 164), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 165), {(0, 0): (0, 0)}), ((30, 167), {(0, 0): (Fraction(3, 1), 0)}), ((30, 168), {(0, 0): (Fraction(27, 1), 0)}), ((30, 170), {(0, 0): (Fraction(-48, 1), 0)}), ((30, 172), {(0, 0): (Fraction(-24, 1), 0)}), ((30, 174), {(0, 0): (Fraction(27, 1), 0)}), ((30, 175), {(0, 0): (0, 0)}), ((30, 177), {(0, 0): (Fraction(24, 1), 0)}), ((30, 178), {(0, 0): (Fraction(-24, 1), 0)}), ((30, 179), {(0, 0): (Fraction(-27, 1), 0)}), ((30, 181), {(0, 0): (Fraction(48, 1), 0)}), ((30, 183), {(0, 0): (Fraction(-3, 1), 0)}), ((30, 184), {(0, 0): (Fraction(3, 1), 0)}), ((31, 28), {(0, 0): (Fraction(9, 1), 0)}), ((31, 37), {(0, 0): (Fraction(-1, 1), 0)}), ((31, 64), {(0, 0): (Fraction(-9, 1), 0)}), ((31, 71), {(0, 0): (Fraction(-2, 1), 0)}), ((31, 72), {(0, 0): (Fraction(-7, 1), 0)}), ((31, 76), {(0, 0): (Fraction(8, 1), 0)}), ((31, 94), {(0, 0): (Fraction(-9, 1), 0)}), ((31, 103), {(0, 0): (Fraction(-8, 1), 0)}), ((31, 114), {(0, 0): (Fraction(8, 1), 0)}), ((31, 154), {(0, 0): (Fraction(9, 1), 0)}), ((31, 161), {(0, 0): (Fraction(2, 1), 0)}), ((31, 162), {(0, 0): (Fraction(7, 1), 0)}), ((31, 166), {(0, 0): (Fraction(1, 1), 0)}), ((31, 176), {(0, 0): (Fraction(-1, 1), 0)}), ((32, 20), {(0, 0): (Fraction(27, 1), 0)}), ((32, 22), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 25), {(0, 0): (Fraction(-54, 1), 0)}), ((32, 27), {(0, 0): (Fraction(54, 1), 0)}), ((32, 30), {(0, 0): (0, 0)}), ((32, 32), {(0, 0): (Fraction(6, 1), 0)}), ((32, 33), {(0, 0): (Fraction(-3, 1), 0)}), ((32, 35), {(0, 0): (0, 0)}), ((32, 36), {(0, 0): (Fraction(-6, 1), 0)}), ((32, 38), {(0, 0): (Fraction(3, 1), 0)}), ((32, 40), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 42), {(0, 0): (Fraction(54, 1), 0)}), ((32, 46), {(0, 0): (Fraction(27, 1), 0)}), ((32, 49), {(0, 0): (Fraction(27, 1), 0)}), ((32, 52), {(0, 0): (Fraction(27, 1), 0)}), ((32, 54), {(0, 0): (Fraction(-48, 1), 0)}), ((32, 55), {(0, 0): (Fraction(-3, 1), 0)}), ((32, 56), {(0, 0): (0, 0)}), ((32, 58), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 60), {(0, 0): (Fraction(24, 1), 0)}), ((32, 62), {(0, 0): (Fraction(27, 1), 0)}), ((32, 63), {(0, 0): (Fraction(-54, 1), 0)}), ((32, 65), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 67), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 74), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 75), {(0, 0): (Fraction(48, 1), 0)}), ((32, 77), {(0, 0): (Fraction(3, 1), 0)}), ((32, 78), {(0, 0): (Fraction(27, 1), 0)}), ((32, 80), {(0, 0): (0, 0)}), ((32, 82), {(0, 0): (Fraction(-24, 1), 0)}), ((32, 86), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 88), {(0, 0): (Fraction(27, 1), 0)}), ((32, 91), {(0, 0): (Fraction(54, 1), 0)}), ((32, 93), {(0, 0): (Fraction(-54, 1), 0)}), ((32, 96), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 98), {(0, 0): (Fraction(48, 1), 0)}), ((32, 99), {(0, 0): (Fraction(-24, 1), 0)}), ((32, 101), {(0, 0): (Fraction(27, 1), 0)}), ((32, 102), {(0, 0): (Fraction(-48, 1), 0)}), ((32, 104), {(0, 0): (Fraction(24, 1), 0)}), ((32, 106), {(0, 0): (Fraction(27, 1), 0)}), ((32, 108), {(0, 0): (Fraction(-48, 1), 0)}), ((32, 109), {(0, 0): (Fraction(-24, 1), 0)}), ((32, 110), {(0, 0): (Fraction(24, 1), 0)}), ((32, 112), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 113), {(0, 0): (Fraction(48, 1), 0)}), ((32, 115), {(0, 0): (Fraction(24, 1), 0)}), ((32, 116), {(0, 0): (Fraction(-24, 1), 0)}), ((32, 118), {(0, 0): (Fraction(27, 1), 0)}), ((32, 120), {(0, 0): (Fraction(-54, 1), 0)}), ((32, 124), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 127), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 130), {(0, 0): (0, 0)}), ((32, 132), {(0, 0): (Fraction(-6, 1), 0)}), ((32, 133), {(0, 0): (Fraction(-3, 1), 0)}), ((32, 134), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 136), {(0, 0): (0, 0)}), ((32, 138), {(0, 0): (Fraction(-3, 1), 0)}), ((32, 140), {(0, 0): (0, 0)}), ((32, 142), {(0, 0): (Fraction(6, 1), 0)}), ((32, 143), {(0, 0): (Fraction(3, 1), 0)}), ((32, 144), {(0, 0): (Fraction(-3, 1), 0)}), ((32, 145), {(0, 0): (Fraction(27, 1), 0)}), ((32, 147), {(0, 0): (0, 0)}), ((32, 149), {(0, 0): (Fraction(3, 1), 0)}), ((32, 150), {(0, 0): (Fraction(-3, 1), 0)}), ((32, 152), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 153), {(0, 0): (Fraction(54, 1), 0)}), ((32, 155), {(0, 0): (Fraction(27, 1), 0)}), ((32, 157), {(0, 0): (Fraction(27, 1), 0)}), ((32, 164), {(0, 0): (0, 0)}), ((32, 165), {(0, 0): (Fraction(6, 1), 0)}), ((32, 167), {(0, 0): (Fraction(3, 1), 0)}), ((32, 168), {(0, 0): (0, 0)}), ((32, 170), {(0, 0): (Fraction(27, 1), 0)}), ((32, 172), {(0, 0): (Fraction(3, 1), 0)}), ((32, 174), {(0, 0): (0, 0)}), ((32, 175), {(0, 0): (Fraction(-6, 1), 0)}), ((32, 177), {(0, 0): (Fraction(-3, 1), 0)}), ((32, 178), {(0, 0): (Fraction(3, 1), 0)}), ((32, 179), {(0, 0): (0, 0)}), ((32, 181), {(0, 0): (Fraction(-27, 1), 0)}), ((32, 183), {(0, 0): (Fraction(-3, 1), 0)}), ((32, 184), {(0, 0): (Fraction(3, 1), 0)}), ((33, 20), {(0, 0): (0, 0)}), ((33, 22), {(0, 0): (Fraction(27, 1), 0)}), ((33, 25), {(0, 0): (Fraction(27, 1), 0)}), ((33, 27), {(0, 0): (Fraction(-27, 1), 0)}), ((33, 30), {(0, 0): (Fraction(-3, 1), 0)}), ((33, 32), {(0, 0): (Fraction(-3, 1), 0)}), ((33, 33), {(0, 0): (Fraction(10, 3), 0)}), ((33, 35), {(0, 0): (Fraction(-3, 1), 0)}), ((33, 36), {(0, 0): (Fraction(3, 1), 0)}), ((33, 38), {(0, 0): (Fraction(1, 3), 0)}), ((33, 40), {(0, 0): (0, 0)}), ((33, 42), {(0, 0): (Fraction(-27, 1), 0)}), ((33, 46), {(0, 0): (Fraction(-27, 1), 0)}), ((33, 49), {(0, 0): (0, 0)}), ((33, 52), {(0, 0): (Fraction(-3, 1), 0)}), ((33, 54), {(0, 0): (Fraction(24, 1), 0)}), ((33, 55), {(0, 0): (Fraction(1, 3), 0)}), ((33, 56), {(
69,882
thestackv1_concat_by_repo-long/65536-65536
"","website": "https://coinvendit.io","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/VenditFinTech","telegram": "","github": ""}} ======================= File: erc20/0x0835ecd15DdF08d4786304d71b4672dC5C40F011.json ======================= <gh_stars>100-1000 {"symbol": "PLC","address": "0x0835ecd15DdF08d4786304d71b4672dC5C40F011","overview":{"en": ""},"email": "<EMAIL>","website": "https://pluscoin.io/","state": "NORMAL","links": {"blog": "https://medium.com/@DSPlus.io","twitter": "https://twitter.com/DsplusF","telegram": "https://t.me/PlusCoinENG","github": "https://github.com/dsplus/PlusCoin"}} ======================= File: erc20/0x93190DbCE9b9BD4Aa546270a8D1D65905B5fDd28.json ======================= {"symbol": "DAPS","address": "0x93190DbCE9b9BD4Aa546270a8D1D65905B5fDd28","overview":{"en": ""},"email": "<EMAIL>","website": "https://dapscoin.com/","state": "NORMAL","links": {"blog": "https://steemit.com/@dapscoin/","twitter": "https://twitter.com/DAPScoin","telegram": "https://t.me/dapscoin","github": "https://github.com/DAPScoin/"}} ======================= File: erc20/0x011C5C4E4A86FC95A7A6d5C49a69Cdf0CB1d0467.json ======================= <reponame>641589523/token-profile { "symbol": "HKC", "address": "0x011c5c4e4a86fc95a7a6d5c49a69cdf0cb1d0467", "overview":{ "en": "HKC is a compliant stablecoin pegged 1:1 to the Hong Kong Dollar with 100% backing in cash.", "zh": "HKC 是 OneCash 发行的港元稳定币。通过与港币固定汇率的兑换体系实现价格稳定。" }, "email": "<EMAIL>", "website": "https://www.onecash.asia/", "whitepaper": "http://theonepangu.oss-cn-hongkong.aliyuncs.com/2021-08/30/5558phpwiCALp1630316935210830.pdf", "state": "NORMAL", "published_on": "2021-09-24", "initial_price":{ "HKD":"1 HKD" }, "links": { "twitter": "https://twitter.com/OneCashWallet", "telegram": "https://t.me/onecashofficial", "github": "https://github.com/your-awesome-project" } } ======================= File: erc20/0x8564653879a18C560E7C0Ea0E084c516C62F5653.json ======================= {"symbol": "UBXT","address": "0x8564653879a18C560E7C0Ea0E084c516C62F5653","overview":{"en": ""},"email": "","website": "https://upbots.com/","state": "NORMAL","links": {"blog": "https://medium.com/upbotscom","twitter": "https://twitter.com/UpBotscom","telegram": "","github": ""}} ======================= File: erc20/0x87DE305311D5788e8da38D19bb427645b09CB4e5.json ======================= {"symbol": "VRX","address": "0x87DE305311D5788e8da38D19bb427645b09CB4e5","overview":{"en": ""},"email": "","website": "https://www.veroxai.com/","state": "NORMAL","links": {"blog": "https://veroxai.medium.com/","twitter": "https://twitter.com/Verox_AI","telegram": "https://t.me/veroxgroup","github": "https://solidity.finance/audits/Verox/"}} ======================= File: erc20/0x9d7F969593D451CF172877C67EB7D0a8A9731b03.json ======================= <reponame>641589523/token-profile { "symbol":"YAKL", "address":"0x9d7F969593D451CF172877C67EB7D0a8A9731b03", "overview":{ "zh":"YAKL 游戏团队将“LOOPS”的三个特点:低开采、 高利用、低排放演变为游戏生态圈的三个特性:低消耗、高效率、低维护。通过供需关系的调解,让 整个游戏生态圈内实现产出和消耗的经济体能在这个不断进行的市场中得到合理 的转换和持久的利用,把市场波动对YAKL生态的影响降低到尽可能小的程度。整个生态中, YAK LOOPS的应用架构模型是”互联网架构+区块链交互“的结合模式,它既有传统互联网产品的基因,也有区块链应用的特色。YAK LOOPS 采用的分布式存储是一项专为需要存储和提供用户生成的内容应用开发者而打造的。用于将对象存储在YAK去中心化存储的服务中。对象是由任意格式的文件组成的不可变的数据段。对象存储在称为存储分区的容器中。所有存储分区都与项目相关联,可以在组织下对项目进行分组。" }, "email":"<EMAIL>", "website":"http://www.yakl.online/", "whitepaper":"http://www.yakl.online/files/YAKL-WP-CN_1.0.pdf", "published_on":"2020-07-13" } ======================= File: erc20/0xC7e43A1c8E118aA2965F5EAbe0e718D83DB7A63C.json ======================= <reponame>641589523/token-profile {"symbol": "ZCRT","address": "0xC7e43A1c8E118aA2965F5EAbe0e718D83DB7A63C","overview":{"en": ""},"email": "<EMAIL>","website": "https://zcore.network/","state": "NORMAL","links": {"blog": "https://medium.com/zcore","twitter": "https://twitter.com/zcorecrypto","telegram": "https://t.me/ZCoreMiners","github": "https://github.com/zcore-coin"}} ======================= File: erc20/0x24dDFf6D8B8a42d835af3b440De91f3386554Aa4.json ======================= {"symbol": "ING","address": "0x24dDFf6D8B8a42d835af3b440De91f3386554Aa4","overview":{"en": ""},"email": "<EMAIL>","website": "https://iungo.network/","state": "NORMAL","links": {"blog": "https://medium.com/@iungo","twitter": "https://twitter.com/iungonetwork","telegram": "https://t.me/IUNGO","github": "https://github.com/iungonetwork"}} ======================= File: erc20/0xA8006e3Ac1bD94e54E3136B8e5dD75db0163e6f4.json ======================= <reponame>641589523/token-profile {"symbol": "EOC","address": "0xA8006e3Ac1bD94e54E3136B8e5dD75db0163e6f4","overview":{"en": "EOC aims to be cryptocurrency for paying options, trading, tipping, voting, staking, defi, exchanges, etc."},"email": "<EMAIL>","website": "https://everyonescrypto.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Everyonescrypto","telegram": "https://t.me/eoc_discuss","github": ""}} ======================= File: erc20/0xaeF4F02E31CdbF007f8D98da4aE365188A0E9eCC.json ======================= <reponame>641589523/token-profile {"symbol": "TFT","address": "0xaeF4F02E31CdbF007f8D98da4aE365188A0E9eCC","overview":{"en": ""},"email": "","website": "https://thefamoustoken.com/","state": "NORMAL","links": {"blog": "https://thefamoustoken.medium.com/","twitter": "https://twitter.com/TheFamousToken","telegram": "","github": ""}} ======================= File: erc20/0x741b0428Efdf4372A8DF6FB54B018dB5e5aB7710.json ======================= <reponame>641589523/token-profile {"symbol": "ARTX","address": "0x741b0428Efdf4372A8DF6FB54B018dB5e5aB7710","overview":{"en": ""},"email": "","website": "https://artx.trading/","state": "NORMAL","links": {"blog": "https://artxtrading.medium.com/","twitter": "https://twitter.com/artxtrading","telegram": "","github": ""}} ======================= File: erc20/0xBa5160Ba66b286f1B9B6f3a57A6ABCFa440E7aA2.json ======================= <reponame>641589523/token-profile {"symbol": "HUB","address": "0xBa5160Ba66b286f1B9B6f3a57A6ABCFa440E7aA2","overview":{"en": ""},"email": "","website": "https://www.hubi.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/HubiExchange","telegram": "","github": ""}} ======================= File: erc20/0x006699d34AA3013605d468d2755A2Fe59A16B12B.json ======================= <gh_stars>100-1000 { "symbol": "Zild", "address": "0x006699d34AA3013605d468d2755A2Fe59A16B12B", "overview":{ "en": "ZILD is a DeFi protocol that utilizes decentralized financial technologies to enable the sustainable creation of individual and collective non-custodial wealth. It aims to launch ZILD (governance token), YILD (synthetic token for staking) and XILD (reputation token)."}, "email": "<EMAIL>", "website": "https://zild.finance/", "whitepaper": "https://www.zild.finance/WP_Zild.pdf", "state": "NORMAL", "published_on": "2020-09-01", "initial_price":{ "ETH":"0.006 ETH", "USD":"2.0 USD", "BTC":"0.0001666 BTC" }, "links": { "twitter": "https://twitter.com/zild_finance", "telegram": "https://t.me/Zildfinance", "github": "https://github.com/zildfinance/", "facebook": "https://www.facebook.com/zild.finance/", "medium": "https://medium.com/@zild" } } ======================= File: erc20/0xb3Bd49E28f8F832b8d1E246106991e546c323502.json ======================= <gh_stars>100-1000 {"symbol": "GMT","address": "0xb3Bd49E28f8F832b8d1E246106991e546c323502","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.mercuryprotocol.com/","state": "NORMAL","links": {"blog": "https://medium.com/mercuryprotocol","twitter": "https://twitter.com/mercuryprotocol","telegram": "https://t.me/joinchat/G47gcA8f5EYFfEsILw7H2w","github": ""}} ======================= File: erc20/0xa101E27f06A97985B925E244111b61560Ecd97DB.json ======================= {"symbol": "BITTO","address": "0xa101E27f06A97985B925E244111b61560Ecd97DB","overview":{"en": ""},"email": "<EMAIL>","website": "http://www.bittoexchange.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/bittoexchange","telegram": "https://telegram.me/bittoexchangenews","github": ""}} ======================= File: erc20/0x9f7229aF0c4b9740e207Ea283b9094983f78ba04.json ======================= {"symbol": "TAD","address": "0x9f7229aF0c4b9740e207Ea283b9094983f78ba04","overview":{"en": "Tadpole Finance is an open-source platform providing decentralized finance services for saving and lending. Tadpole Finance is an experimental project to create a more open lending market, where users can make deposits and loans with any ERC20 tokens on the Ethereum network."},"email": "<EMAIL>","website": "https://tadpole.finance/","state": "NORMAL","links": {"blog": "https://medium.com/@tadpolefinance/","twitter": "https://twitter.com/TadpoleFinance","telegram": "https://t.me/TadpoleFinance","github": "https://github.com/tadpole-finance"}} ======================= File: erc20/0xc21dBEE65D62770953035f0434C532d578a666c9.json ======================= <filename>erc20/0xc21dBEE65D62770953035f0434C532d578a666c9.json {"symbol": "CNRG","address": "0xc21dBEE65D62770953035f0434C532d578a666c9","overview":{"en": ""},"email": "","website": "https://cryptoenergy.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Crypto_Energy","telegram": "https://t.me/crypto_energy","github": ""}} ======================= File: erc20/0x159A1dFAe19057de57dFfFcbB3DA1aE784678965.json ======================= <gh_stars>100-1000 {"symbol": "RFX","address": "0x159A1dFAe19057de57dFfFcbB3DA1aE784678965","overview":{"en": "Reflex wants to revolutionise the social media ecosystem rewarding users for the content they share on our platforms, paying them based on their followers, likes and views."},"email": "<EMAIL>","website": "https://reflextoken.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/reflextoken","telegram": "https://t.me/reflextoken","github": ""}} ======================= File: erc20/0x01C0987E88F778DF6640787226bc96354E1a9766.json ======================= <filename>erc20/0x01C0987E88F778DF6640787226bc96354E1a9766.json<gh_stars>100-1000 {"symbol": "UAT","address": "0x01C0987E88F778DF6640787226bc96354E1a9766","overview":{"en": ""},"email": "<EMAIL>","website": "https://ultralpha.io/","state": "NORMAL","links": {"blog": "https://medium.com/@UAT_official","twitter": "https://twitter.com/UAT_Official","telegram": "https://t.me/UltrAlphaOfficialAnnouncements","github": ""}} ======================= File: erc20/0x540e5fFF293f523Acd26291b5bC7ac5713991FEb.json ======================= {"symbol": "PTS","address": "0x540e5fFF293f523Acd26291b5bC7ac5713991FEb","overview":{"en": ""},"email": "<EMAIL>","website": "http://www.pitiscoin.asia/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/pitiscoin","telegram": "","github": ""}} ======================= File: erc20/0x3fF426Ca07A9F589a80f18CCCC759E84CF06f0Eb.json ======================= <gh_stars>100-1000 {"symbol": "EC2","address": "0x3fF426Ca07A9F589a80f18CCCC759E84CF06f0Eb","overview":{"en": ""},"email": "","website": "https://www.ec2token.com","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Employmentcoin","telegram": "","github": ""}} ======================= File: erc20/0xE09394F8BA642430eD448CA20f342EC7aa1Ba2E1.json ======================= <filename>erc20/0xE09394F8BA642430eD448CA20f342EC7aa1Ba2E1.json {"symbol": "FESS","address": "0xE09394F8BA642430eD448CA20f342EC7aa1Ba2E1","overview":{"en": ""},"email": "","website": "https://fesschain.live/","state": "NORMAL","links": {"blog": "https://medium.com/fesschain","twitter": "https://twitter.com/fesschain","telegram": "","github": ""}} ======================= File: erc20/0xABE9b2e4bbD5A8C718752c41254Ed81aaE7d98BF.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "P2P","address": "0xABE9b2e4bbD5A8C718752c41254Ed81aaE7d98BF","overview":{"en": "P2P (P2P) is a cryptocurrency and has a current supply of 250,000,000 with 0 in circulation."},"email": "","website": "http://p2pcash.net/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/PnetP2","telegram": "","github": ""}} ======================= File: erc20/0x4a527d8fc13C5203AB24BA0944F4Cb14658D1Db6.json ======================= <gh_stars>100-1000 {"symbol": "MITx","address": "0x4a527d8fc13C5203AB24BA0944F4Cb14658D1Db6","overview":{"en": ""},"email": "<EMAIL>","website": "https://token.morpheuslabs.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/morpheus_labs_","telegram": "https://t.me/morpheuslabs","github": "https://github.com/Morpheuslabs-io"}} ======================= File: erc20/0xDa4c27a9fbdDe1f5F3aF0398396be4644dCEC715.json ======================= <reponame>641589523/token-profile {"symbol": "PONZU","address": "0xDa4c27a9fbdDe1f5F3aF0398396be4644dCEC715","overview":{"en": ""},"email": "","website": "https://ponzuinu.finance","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/inu_ponzu","telegram": "","github": ""}} ======================= File: erc20/0x46cc7EC70746F4cbd56CE5FA9Bb7d648398EaA5C.json ======================= <gh_stars>100-1000 {"symbol": "REALT","address": "0x46cc7EC70746F4cbd56CE5FA9Bb7d648398EaA5C","overview":{"en": "RealT (RLT) maintains its value paired with the Brazilian Real. Therefore, a RealT unit is always equal to 1 Brazilian Real."},"email": "<EMAIL>","website": "http://realt.to/","state": "NORMAL","links": {"blog": "","twitter": "http://twitter.com/realtstable","telegram": "https://t.me/realtstable","github": ""}} ======================= File: erc20/0x7E1922F5eaFB2AA8f849838C638B7a7a5eC50751.json ======================= <gh_stars>100-1000 {"symbol": "GcchainGCC","address": "0x7E1922F5eaFB2AA8f849838C638B7a7a5eC50751","overview":{"en": ""},"email": "<EMAIL>","website": "https://gcchain.net/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Gcchains","telegram": "","github": ""}} ======================= File: erc20/0xD7e0F80FB28233bdde0006c50568606A8feb964C.json ======================= {"symbol": "AUDT","address": "0xD7e0F80FB28233bdde0006c50568606A8feb964C","overview":{"en": "AUDT is an Australian Dollar stablecoin managed by AUDT Pty Ltd (ACN: 627 827 383). The tokens are linked to audited Australian Dollar bank deposits domiciled in Australia."},"email": "<EMAIL>","website": "https://audt.to/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/audt_to","telegram": "https://t.me/audt_to","github": ""}} ======================= File: erc20/0x174bea2cb8b20646681E855196cF34FcEcEc2489.json ======================= {"symbol": "FTT","address": "0x174bea2cb8b20646681E855196cF34FcEcEc2489","overview":{"en": ""},"email": "","website": "https://freetiptoken.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/freetiptoken","telegram": "","github": ""}} ======================= File: erc20/0xb7e77aEbBe0687d2EfF24Cc90c41A3b6eA74bdAB.json ======================= <gh_stars>100-1000 {"symbol": "WIKEN","address": "0xb7e77aEbBe0687d2EfF24Cc90c41A3b6eA74bdAB","overview":{"en": ""},"email": "","website": "https://projectwith.io/","state": "NORMAL","links": {"blog": "https://medium.com/projectwith","twitter": "","telegram": "https://t.me/projectwith_eng","github": ""}} ======================= File: erc20/0x1A0F2aB46EC630F9FD638029027b552aFA64b94c.json ======================= {"symbol": "ATX","address": "0x1A0F2aB46EC630F9FD638029027b552aFA64b94c","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.aston.company/","state": "NORMAL","links": {"blog": "https://medium.com/@aston_37700","twitter": "https://twitter.com/aston_company","telegram": "https://t.me/joinchat/HJVnDA9SmlOueciQIBEoQQ","github": "https://github.com/astonx/astonx-token"}} ======================= File: erc20/0x22dE9912cd3D74953B1cd1F250B825133cC2C1b3.json ======================= {"symbol": "DREP","address": "0x22dE9912cd3D74953B1cd1F250B825133cC2C1b3","overview":{"en": ""},"email": "<EMAIL>","website": "http://www.drep.org/","state": "NORMAL","links": {"blog": "https://medium.com/drep-family","twitter": "https://twitter.com/FoundationDrep","telegram": "https://t.me/drep_foundation","github": "https://github.com/drep-project"}} ======================= File: erc20/0x06Ee5a52AaA96074e9A6fEaEcD9fcE6809d9aE39.json ======================= { "symbol": "GOSS", "address": "0x06Ee5a52AaA96074e9A6fEaEcD9fcE6809d9aE39", "overview":{ "en": "Goss is a decentralized cloud storage system based on blockchain ecological application.", "zh": "Goss是一个基于区块链生态应用的去中心化云存储系统." }, "email": "<EMAIL>", "website": "https://gossiptoken.io", "whitepaper": "https://gossiptoken.io/download/download-73-773.html", "published_on": "2020-10-31", "initial_price":{ "ETH":"0.001 ETH" }, "links": { "twitter": "https://twitter.com/Gossiptokenio", "telegram": "https://t.me/Gossiptokenio_en", "facebook": "https://facebook.com/Gossiptokenio" } } ======================= File: erc20/0x0fdC5313333533cC0c00C22792BfF7383d3055F2.json ======================= {"symbol": "YFPRO","address": "0x0fdC5313333533cC0c00C22792BfF7383d3055F2","overview":{"en": ""},"email": "","website": "https://yfpro.finance","state": "NORMAL","links": {"blog": "https://medium.com/@yield_farm/yield-farm-protocol-aggregator-5b36b0aa2ef3","twitter": "https://twitter.com/yield_farm","telegram": "https://t.me/yield_farm","github": "https://github.com/yfprofinance"}} ======================= File: erc20/0xa117000000f279D81A1D3cc75430fAA017FA5A2e.json ======================= <gh_stars>100-1000 {"symbol": "ANT","address": "0xa117000000f279D81A1D3cc75430fAA017FA5A2e","overview":{"en": "Create and manage unstoppable organizations. Aragon lets you manage entire organizations using the blockchain. This makes Aragon organizations more efficient than their traditional counterparties."},"email": "<EMAIL>","website": "https://aragon.org/","state": "NORMAL","links": {"blog": "https://blog.aragon.org/","twitter": "https://twitter.com/aragonproject","telegram": "","github": ""}} ======================= File: erc20/0x8290D7a64F25e6b5002d98367E8367c1b532b534.json ======================= {"symbol": "ONEUNI","address": "0x8290D7a64F25e6b5002d98367E8367c1b532b534","overview":{"en": ""},"email": "","website": "https://app.ichi.org/","state": "NORMAL","links": {"blog": "https://medium.com/ichifarm","twitter": "https://twitter.com/ichifarm","telegram": "","github": ""}} ======================= File: erc20/0x15ef5b9447710Eab904e63e6233Ff540400d603f.json ======================= {"symbol": "BTC2X","address": "0x15ef5b9447710Eab904e63e6233Ff540400d603f","overview":{"en": "Crypto, Blockchain, Finance Guides"},"email": "<EMAIL>","website": "http://bitcoin-2x.org/","state": "NORMAL","links": {"blog": "https://medium.com/@bitcoin.2x.org2","twitter": "https://twitter.com/bitcoin_2x_org","telegram": "https://t.me/joinchat/GR59BhBzbnh1GHbGAU6nqQ","github": ""}} ======================= File: erc20/0xC1E0510A0dF7646817b6632D32CaA681A425a5e6.json ======================= <gh_stars>100-1000 {"symbol": "CFL365","address": "0xC1E0510A0dF7646817b6632D32CaA681A425a5e6","overview":{"en": ""},"email": "","website": "http://cfl365.finance","state": "NORMAL","links": {"blog": "https://medium.com/cfl365-finance","twitter": "https://twitter.com/cfl365_finance","telegram": "","github": ""}} ======================= File: erc20/0x25C7b64A93Eb1261E130eC21a3e9918CaA38b611.json ======================= <gh_stars>100-1000 {"symbol": "WVG0","address": "0x25C7b64A93Eb1261E130eC21a3e9918CaA38b611","overview":{"en": ""},"email": "","website": "https://www.wrappered.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/CryptoKitties","telegram": "","github": ""}} ======================= File: erc20/0x6378930da9be7C90d824d7f113974741644d62dA.json ======================= {"symbol": "CTC","address": "0x6378930da9be7C90d824d7f113974741644d62dA","overview":{"en": "Cetacean Pool will continue to be used to increase liquidity and borrowing needs for BMJ-DAO as the First Distributed Storage Project BMJ DeFi Governance Certificate."},"email": "<EMAIL>","website": "https://dapp.bmjcoin.com/","state": "NORMAL","links": {"blog": "https://medium.com/@bmj20200716","twitter": "https://twitter.com/BMJ67466085","telegram": "","github": ""}} ======================= File: erc20/0x71D01dB8d6a2fBEa7f8d434599C237980C234e4C.json ======================= {"symbol": "GLA","address": "0x71D01dB8d6a2fBEa7f8d434599C237980C234e4C","overview":{"en": ""},"email": "<EMAIL>","website": "https://gladius.io/","state": "NORMAL","links": {"blog": "https://medium.com/@gladiusio","twitter": "https://twitter.com/gladiusio","telegram": "https://t.me/gladiusio","github": "https://github.com/gladiusio"}} ======================= File: erc20/0x1cBb83EbcD552D5EBf8131eF8c9CD9d9BAB342bC.json ======================= <gh_stars>100-1000 {"symbol": "NFY","address": "0x1cBb83EbcD552D5EBf8131eF8c9CD9d9BAB342bC","overview":{"en": "Non-Fungible Yearn is a DeFi platform aims to utilize the full potential of Non-Fungible Tokens (NFTs) in the DeFi sector. The platform will allow user to stake their various cryptocurrency holdings in multiple different pools to earn governance token - NFY."},"email": "","website": "https://nfy.finance/","state": "NORMAL","links": {"blog": "https://medium.com/@NFY","twitter": "https://twitter.com/NFYFinance","telegram": "https://t.me/NFYOfficial","github": "https://github.com/NFYFinance"}} ======================= File: erc20/0xf2Df8458130F00c94bCDE2Dd3F288cF608187F87.json ======================= {"symbol": "FEAST","address": "0xf2Df8458130F00c94bCDE2Dd3F288cF608187F87","overview":{"en": ""},"email": "","website": "https://feast.finance","state": "NORMAL","links": {"blog": "https://feastfinance.medium.com/","twitter": "https://twitter.com/feastfinance","telegram": "","github": ""}} ======================= File: erc20/0x697eF32B4a3F5a4C39dE1cB7563f24CA7BfC5947.json ======================= {"symbol": "ISLA","address": "0x697eF32B4a3F5a4C39dE1cB7563f24CA7BfC5947","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.insulainvestments.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/InsulaInvestme1","telegram": "","github": "https://github.com/insula-investment-management/Project-1"}} ======================= File: erc20/0x74603e780545d02C4257E7D2BE19c74dE7BE1952.json ======================= <gh_stars>100-1000 {"symbol": "ETGF","address": "0x74603e780545d02C4257E7D2BE19c74dE7BE1952","overview":{"en": ""},"email": "","website": "https://etgproject.org","state": "NORMAL","links": {"blog": "https://t.me/ETG_Finance","twitter": "https://twitter.com/ethereumgoldetg","telegram": "","github": ""}} ======================= File: erc20/0x7Fe92EC600F15cD25253b421bc151c51b0276b7D.json ======================= {"symbol": "JCT","address": "0x7Fe92EC600F15cD25253b421bc151c51b0276b7D","overview":{"en": ""},"email": "<EMAIL>","website": "https://ja-cket.com/en/","state": "NORMAL","links": {"blog": "https://blog.naver.com/jacket_korea","twitter": "","telegram": "https://t.me/JCT_Official","github": ""}} ======================= File: erc20/0x82125AFe01819Dff1535D0D6276d57045291B6c0.json ======================= {"symbol": "MRL","address": "0x82125AFe01819Dff1535D0D6276d57045291B6c0","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.marcelo-mrl.com/","state": "NORMAL","links": {"blog": "https://medium.com/@marcelomrl","twitter": "https://twitter.com/Mrl_io","telegram": "https://t.me/joinchat/IGyNLA9UybLEpfDZYX5xpQ","github": "https://github.com/MarceloMRL"}} ======================= File: erc20/0xA15690E9205De386Ce849889831C1668c300C1ad.json ======================= <reponame>641589523/token-profile {"symbol": "pETH18C","address": "0xA15690E9205De386Ce849889831C1668c300C1ad","overview":{"en": ""},"email": "","website": "https://mars.poolin.fi/#/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/MarsProject2020","telegram": "","github": ""}} ======================= File: erc20/0xa1638C4AaF3399A6eDFF55E874B93BD545B88457.json ======================= <reponame>641589523/token-profile { "symbol": "GECT", "address": "0xa1638C4AaF3399A6eDFF55E874B93BD545B88457", "overview":{ "en": "GECT was based on block chain technology; it can monitor the whole process of renewable energy supply chain. It can not only solve the problem of fund supply during construction period, but also enable participants to monitor the whole process and truly prevent fraud. At the same time, each GECT has equity value because it is linked to real new energy assets. It can not only circulate in the digital world, but also bring bonus candy to holders every year.", "zh": "GECT以区块链技术为基础,监控可再生能源供应链的整个过程,不仅可以解决建设期资金供应的问题,还可以让参与者能监督整个过程,真正做到防欺诈。同时,由于与实体新能源资产挂钩,每一枚GECT都具有权益价值,不但可以在数字世界进行流通,还将每年为持有者带来红利糖果。" }, "email": "<EMAIL>", "website": "http://www.gectoken.cn/", "whitepaper": "http://www.gectoken.cn/pdf/gect-en.pdf", "state": "NORMAL", "published_on": "2019-06-28", "initial_price":{ "USD":"0.08 USD" }, "links": { "twitter": "https://twitter.com/EnGect", "telegram": "https://t.me/GECTCN", "github": "https://github.com/GECToken", "facebook": "https://www.facebook.com/GECTme-100822157942920/" } } ======================= File: erc20/0x1fd27F0CfC6f273b87A5E0F6fCf063422E7bCD6a.json ======================= {"symbol": "AGRO","address": "0x1fd27F0CfC6f273b87A5E0F6fCf063422E7bCD6a","overview":{"en": ""},"email": "<EMAIL>","website": "https://bitagro.io/","state": "NORMAL","links": {"blog": "https://medium.com/@agrocoin.org","twitter": "https://twitter.com/BitagroI","telegram": "https://t.me/agrodex_official","github": "https://github.com/agrodex"}} ======================= File: erc20/0x48f07301E9E29c3C38a80ae8d9ae771F224f1054.json ======================= <filename>erc20/0x48f07301E9E29c3C38a80ae8d9ae771F224f1054.json<gh_stars>100-1000 {"symbol": "XZAR","address": "0x48f07301E9E29c3C38a80ae8d9ae771F224f1054","overview":{"en": "xZAR is a South African stablecoin pegged 1 to 1 with the South African Rand (ZAR). This project was created and is therefore backed by altcointrader.co.za a South African crypto exchange."},"email": "<EMAIL>","website": "http://www.xzar.co.za/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/AltCoinTraderSA","telegram": "","github": ""}} ======================= File: erc20/0x1FCdcE58959f536621d76f5b7FfB955baa5A672F.json ======================= { "symbol": "FOR", "address": "0x1FCdcE58959f536621d76f5b7FfB955baa5A672F", "overview": { "en": "ForTube is the leading global DeFi lending platform launched by The Force Protocol. It is committed to providing decentralized lending services for cryptoasset enthusiasts around the world, supporting most of the world's popular assets. ForTube is based on smart contracts and automated algorithm technology. Users can deposit tokens to earn interest, pledge to borrow tokens and pay interests. ForTube's interest rate is determined by market supply and demand. Assets are controlled by users. ForTube allows users to deposit and withdraw anytime, borrow and repay anytime globally.", "zh": "ForTube是原力协议推出的全球领先的DeFi借贷平台,致力于为全球的加密数字资产爱好者提供去中心化的借贷服务,支持全球绝大部分热门资产。ForTube基于智能合约和自动化算法技术,用户可以存币获得利息,抵押借币支付利息。ForTube的利率由市场供需决定,资产由用户掌握,在全球支持随存随取、随借随还。" }, "email": "<EMAIL>", "website": "https://for.tube", "whitepaper": "https://for.tube/ForTube_whitepaper_zh.pdf", "state": "NORMAL", "published_on": "2019-04-22", "initial_price":{ "USD":"0.02 USD" }, "links": { "blog": "https://medium.com/@fortube", "twitter": "https://twitter.com/ForTubeFi", "telegram": "https://t.me/theforceprotocol666", "reddit": "https://www.reddit.com/r/The_Force_Protocol/", "github": "https://github.com/thefortube" } } ======================= File: erc20/0x469eDA64aEd3A3Ad6f868c44564291aA415cB1d9.json ======================= {"symbol": "FLUX","address": "0x469eDA64aEd3A3Ad6f868c44564291aA415cB1d9","overview":{"en": ""},"email": "<EMAIL>","website": "https://datamine.network/","state": "NORMAL","links": {"blog": "https://medium.com/@dataminenetwork","twitter": "https://twitter.com/dataminenetwork","telegram": "","github": "https://github.com/Datamine-Crypto"}} ======================= File: erc20/0xF6dBE88bA55f1793Ff0773c9B1275300f830914F.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "AD","address": "0xF6dBE88bA55f1793Ff0773c9B1275300f830914F","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.asiandragoncoin.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/CoinAsian","telegram": "https://t.me/adgncoin","github": ""}} ======================= File: erc20/0xAAE81c0194D6459F320b70CA0CEdf88e11a242CE.json ======================= <reponame>641589523/token-profile {"symbol": "WT","address": "0xAAE81c0194D6459F320b70CA0CEdf88e11a242CE","overview":{"en": ""},"email": "","website": "https://en.worldwifi.io/","state": "NORMAL","links": {"blog": "https://medium.com/world-wi-fi-blog","twitter": "https://twitter.com/WorldWifi_ICO","telegram": "","github": ""}} ======================= File: erc20/0xB8E2e2101eD11e9138803cd3e06e16dd19910647.json ======================= {"symbol": "ARDX","address": "0xB8E2e2101eD11e9138803cd3e06e16dd19910647","overview":{"en": ""},"email": "<EMAIL>","website": "http://www.ardcoin.com/","state": "NORMAL","links": {"blog": "https://medium.com/@ardcoin","twitter": "https://twitter.com/ard_coin","telegram": "https://t.me/ardcoin","github": ""}} ======================= File: erc20/0x810EE35443639348aDbbC467b33310d2AB43c168.json ======================= <filename>erc20/0x810EE35443639348aDbbC467b33310d2AB43c168.json<gh_stars>100-1000 {"symbol": "CYC","address": "0x810EE35443639348aDbbC467b33310d2AB43c168","overview":{"en": ""},"email": "","website": "https://cyclone.xyz/","state": "NORMAL","links": {"blog": "https://twitter.com/cycloneprotocol/status/1353975495566626817","twitter": "https://twitter.com/cycloneprotocol","telegram": "","github": ""}} ======================= File: erc20/0xBc1b4a60Ea8F6169d07Fa66e74D4Ff5CcB87C260.json ======================= <gh_stars>100-1000 { "symbol": "ELS", "address": "0xBc1b4a60Ea8F6169d07Fa66e74D4Ff5CcB87C260", "overview":{ "en": "ETPlan is based on the application of the block chain technology, the birth of decentralized global Buddhist culture-related digital communication. It can effectively break through the barriers of related industries, realize the communication and exchange of the globalization of Buddhist culture and realize the global circulation of the certificate of Buddhist culture-related industries through the low-level technology of weak centralization, openness and transparency, distributed bookkeeping and global convenient trading channels.", "zh": "ETPlan是基于区块链技术应用而诞生的去中心化全球文化相关领域数字通证。它能有效打通相关产业壁垒,通过弱中心化、公开透明、分布式记账的底层技术及全球性的便捷交易途径,实现文化全球化的传播交流,实现文化相关产业通证的全球流通。" }, "email": "<EMAIL>", "website": "https://etplan.org/", "whitepaper": "https://etplan.org/ELS%E7%99%BD%E7%9A%AE%E4%B9%A6.pdf", "state": "NORMAL", "published_on": "2020-10-22", "initial_price":{ "ETH":"0.002 ETH", "USD":"1.5 USD" }, "links": { } } ======================= File: erc20/0xc15A399c4eA7815fE36857C9E290EE452A5D6B21.json ======================= <filename>erc20/0xc15A399c4eA7815fE36857C9E290EE452A5D6B21.json {"symbol": "NAVY","address": "0xc15A399c4eA7815fE36857C9E290EE452A5D6B21","overview":{"en": ""},"email": "<EMAIL>","website": "https://boatpilot.io/","state": "NORMAL","links": {"blog": "https://medium.com/@boatpilot","twitter": "https://twitter.com/boatpilot_io","telegram": "https://t.me/boatpilot","github": "https://github.com/BoatPilotNAVI/"}} ======================= File: erc20/0x0557E0d15aeC0b9026dD17aA874fDf7d182A2cEB.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "CFXQ","address": "0x0557E0d15aeC0b9026dD17aA874fDf7d182A2cEB","overview":{"en": ""},"email": "","website": "https://token.cfxquantum.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/CfxQuantum","telegram": "","github": ""}} ======================= File: erc20/0xd963a907f83e1b391D664617AE8e87f744aD8F82.json ======================= { "symbol": "PTG", "address": "0xd963a907f83e1b391D664617AE8e87f744aD8F82", "overview":{ "en": "PTG is a distributed financial system based on blockchain. It is committed to promoting the development and improvement of the distributed financial DeFi ecosystem, creating on-chain finance, and then building an efficient distributed financial DeFi ecological infrastructure.", "zh": "PTG是基于区块链的分布式金融系统,致力于推动分布式金融DeFi生态的发展和完善,打造链上金融,进而搭建高效运行的分布式金融DeFi生态基础设施。" }, "email": "<EMAIL>", "website": "http://ptgdefi.club/", "whitepaper": "http://ptgdefi.club/whitepaper.pdf", "state": "NORMAL", "published_on": "2020-10-29", "links": { "telegram": "https://t.me/ptggroup", "twitter": "https://twitter.com/ptgdefi" } } ======================= File: erc20/0xAC51066d7bEC65Dc4589368da368b212745d63E8.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "ALICE","address": "0xAC51066d7bEC65Dc4589368da368b212745d63E8","overview":{"en": "My Neighbor Alice is a multiplayer builder game, where anyone can buy and own virtual islands, collect and build items and meet new friends."},"email": "<EMAIL>","website": "https://www.myneighboralice.com/","state": "NORMAL","links": {"blog": "https://myneighboralice.medium.com/","twitter": "https://twitter.com/MyNeighborAlice/","telegram": "https://t.me/MyNeighborAlice","github": ""}} ======================= File: erc20/0x468ab3b1f63A1C14b361bC367c3cC92277588Da1.json ======================= {"symbol": "YELD","address": "0x468ab3b1f63A1C14b361bC367c3cC92277588Da1","overview":{"en": "Yeld is a DeFi yield farming dApp that rewards stakers and holders alike with decreasing supply and permanent rewards after users are done staking."},"email": "<EMAIL>","website": "https://yeld.finance/","state": "NORMAL","links": {"blog": "http://yeldf.medium.com/","twitter": "https://twitter.com/yeldf","telegram": "https://t.me/yeldf","github": "https://github.com/merlox/yeld-website"}} ======================= File: erc20/0xcf9c692F7e62Af3c571D4173fd4ABf9A3E5330D0.json ======================= {"symbol": "ONIGIRI","address": "0xcf9c692F7e62Af3c571D4173fd4ABf9A3E5330D0","overview":{"en": "$ONIGIRI is a governance token for staking Uniswap/Sushiswap LP tokens and by providing liquidity to OnigiriSwap DEX."},"email": "","website": "https://onigiriswap.finance/","state": "NORMAL","links": {"blog": "https://medium.com/onigiriswap/introducing-onigiriswap-and-onigiri-token-40706c42aed8","twitter": "https://twitter.com/OnigiriSwap","telegram": "https://t.me/onigiriswap","github": "https://github.com/onigiriswapfi/onigiriswap"}} ======================= File: erc20/0xaf79C4c4106b7C35c2FeC72D130783524f821D89.json ======================= <filename>erc20/0xaf79C4c4106b7C35c2FeC72D130783524f821D89.json {"symbol": "FIT","address": "0xaf79C4c4106b7C35c2FeC72D130783524f821D89","overview":{"en": "FI is a digital token backed by fiat currency and aims to provide individuals and organizations with a robust and decentralized method of exchanging value while using a familiar accounting unit."},"email": "<EMAIL>","website": "https://fitoken.org/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/fitoken_org","telegram": "","github": ""}} ======================= File: erc20/0x3DB99ab08006aeFcC9600972eCA8C202396B4300.json ======================= {"symbol": "VINCI","address": "0x3DB99ab08006aeFcC9600972eCA8C202396B4300","overview":{"en": ""},"email": "<EMAIL>","website": "https://vinci.id/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/vincifoundation","telegram": "https://t.me/vincichannel","github": "https://github.com/vinci-project"}} ======================= File: erc20/0xaE17f4F5CA32F77ea8e3786db7C0b2FE877aC176.json ======================= {"symbol": "BCC","address": "0xaE17f4F5CA32F77ea8e3786db7C0b2FE877aC176","overview":{"en": "BasisCoin is an algorithmic stablecoin fork from Basis.cash - with improvements."},"email": "","website": "https://basiscoin.finance/","state": "NORMAL","links": {"blog": "https://basis-coin.medium.com/","twitter": "https://twitter.com/Basis_Coin","telegram": "https://t.me/basiscoin","github": ""}} ======================= File: erc20/0x3A8cCCB969a61532d1E6005e2CE12C200caeCe87.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "Titan","address": "0x3A8cCCB969a61532d1E6005e2CE12C200caeCe87","overview":{"en": "TITAN is a blockchain based decentralized financial center that provides optimal liquidity solutions for different digital asset category by adaptive bonding curve."},"email": "","website": "https://titanswap.org/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/TitanSwaporg","telegram": "https://t.me/TitanSwap","github": "https://github.com/titanSwap"}} ======================= File: coins/tezos.json ======================= <filename>coins/tezos.json { "symbol": "XTZ", "address": "tezos", "overview":{ "en": "Tezos is an open-source platform for assets and applications backed by a global community of validators, researchers, and builders.", "zh": "Tezos是一个资产和应用程序的开源平台,由全球验证者,研究人员和建造者共同支持。" }, "website": "https://tezos.com/", "state": "NORMAL", "published_on": "2016-06", "links": { "twitter": "https://twitter.com/tezos", "facebook": "https://www.facebook.com/tezosledger" } } ======================= File: erc20/0x35f88B2F33E9A5bbD07517a8051644E12a6E0b0E.json ======================= <reponame>641589523/token-profile { "symbol": "UMBC", "address": "0x35f88B2F33E9A5bbD07517a8051644E12a6E0b0E", "overview":{ "en": "MERMAID is an encrypted social meta-universe based on blockchain technology, which provides users with a more secure, open, and free social environment. It uses decentralized technology to make information transmission more private and give users a more immersive social experience. The name of MERMAID's ecological token is UMBC, and there are a large number of applications in scenarios such as DAPP stores in the MERMAID ecosystem, centralization of transactions, and MERMAID merchant payment.", "zh": "MERMAID是一个基于区块链技术的加密社交元宇宙,为用户提供更加安全、开放、自由的社交环境,通过去中心化的技术让信息传输更加的私密,给用户更加沉浸式的社交体验。MERMAID的生态通证名称为UMBC,在MERMAID生态中的DAPP商店,去中⼼化交易,MERMAID商家⽀付等场景中有⼤量的应⽤。" }, "email": "Email", "website": "https://www.umbcoin.com/", "whitepaper": "https://www.umbcoin.com/assets/cms/whitepaper/MERMAID_UMB_EN.pdf", "state": "LOCKED", "published_on": "2021-08-01", "initial_price":{ "ETH":"0.00166666 ETH", "USD":"1.4 USD", "BTC":"0.00004137 BTC" }, "links": { } } ======================= File: erc20/0xC5005344d52758EE2264be257A198B50f884711b.json ======================= <filename>erc20/0xC5005344d52758EE2264be257A198B50f884711b.json {"symbol": "ILT","address": "0xC5005344d52758EE2264be257A198B50f884711b","overview":{"en": "illume took the next step by creating the multichain protocol and multichain token ILT"},"email": "<EMAIL>","website": "https://illumetech.site/","state": "NORMAL","links": {"blog": "https://medium.com/@illumeproject","twitter": "https://twitter.com/illume_token","telegram": "https://t.me/illumechat","github": "https://github.com/illumeproject/SmartContractIllume/blob/master/README.md"}} ======================= File: erc20/0x6Fa0952355607dFB2d399138B7fE10EB90F245e4.json ======================= {"symbol": "SCT","address": "0x6Fa0952355607dFB2d399138B7fE10EB90F245e4","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.spiritclash.com/","state": "NORMAL","links": {"blog": "https://spiritclash.medium.com/","twitter": "https://twitter.com/spiritclashccg","telegram": "https://t.me/SpiritClash","github": ""}} ======================= File: erc20/0xf1f5De69C9C8D9BE8a7B01773Cc1166D4Ec6Ede2.json ======================= <gh_stars>100-1000 {"symbol": "DFX","address": "0xf1f5De69C9C8D9BE8a7B01773Cc1166D4Ec6Ede2","overview":{"en": ""},"email": "","website": "http://definitex.org/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/beyonddefinitex","telegram": "","github": ""}} ======================= File: erc20/0x2c31C747e0D1eb1f662b619461DcED4ce5ca22Ea.json ======================= {"symbol": "FSCP","address": "0x2c31C747e0D1eb1f662b619461DcED4ce5ca22Ea","overview":{"en": ""},"email": "<EMAIL>","website": "https://fivestarcoinpro.com/","state": "NORMAL","links": {"blog": "http://fivestarcoinpro.blogspot.com/","twitter": "https://twitter.com/fivestarcoinpro?s=08","telegram": "http://t.me/fivestarcoinpro_update","github": "https://github.com/fivestarcoinpro"}} ======================= File: erc20/0x6fe56C0bcdD471359019FcBC48863d6c3e9d4F41.json ======================= {"symbol": "PROPS","address": "0x6fe56C0bcdD471359019FcBC48863d6c3e9d4F41","overview":{"en": ""},"email": "<EMAIL>","website": "https://propsproject.com/","state": "NORMAL","links": {"blog": "https://blog.propsproject.com/","twitter": "https://twitter.com/propsproject","telegram": "http://t.me/propsproject","github": "https://github.com/propsproject"}} ======================= File: erc20/0xb51F64A297122D44822FcCeecEa3ae63b98F4297.json ======================= { "symbol": "AIB", "address": "0xb51F64A297122D44822FcCeecEa3ae63b98F4297", "overview": { "en": "AIB (AI coin) is a decentralized trading platform with high liquidity for real-time trading and exchange of digital assets (various crypto tokens, such as Ethereum and its erc20 token, bitcoin and zcash, etc.). In order to realize seamless payment between different tokens for all users, AIB will provide rich payment API and a new generation of contract wallet to expand the overall trading capacity of AIB. AIB (AI coin) will establish a decentralized shopping mall, marriage, game, live broadcast and marketing system, and will serve a large number of online and offline users. AIB (AI coin) is committed to the research of VR artificial intelligence human-computer interaction, which will show great market value in 3-5 years", "zh": "AIB(艾币)是一个具备高流动性的数字资产(各种加密代币,例如以太币及其ERC20代币,比特币和ZCash等)即时交易和兑换的去中心化交易平台。为了实现所有用户在不同代币之间的无缝支付,AIB(艾币)将提供丰富的支付API以及新一代的合约钱包,来扩展AIB(艾币)的整体交易能力。AIB(艾币)将建立去中心化的商城、婚恋、游戏、直播和营销系统,并将服务于线上线下海量用户,AIB(艾币)致力于VR人工智能人机交互研究,必将在3到5年内展现出巨大的市场价值" }, "email": "<EMAIL>", "website": "http://www.aibgpf.com/", "whitepaper": "http://www.aibgpf.com/images/AIB_Chain_Whitepaper_CN.pdf", "state": "NORMAL", "published_on": "2019-07-04", "initial_price":{ "USDT":"2 USDT" }, "links": { "github": "https://github.com/lovejseaa" } } ======================= File: erc20/0xc56c2b7e71B54d38Aab6d52E94a04Cbfa8F604fA.json ======================= <gh_stars>100-1000 {"symbol": "ZUSD","address": "0xc56c2b7e71B54d38Aab6d52E94a04Cbfa8F604fA","overview":{"en": ""},"email": "","website": "https://stablecoin.z.com/","state": "NORMAL","links": {"blog": "https://gmotrust.medium.com/introducing-the-first-regulated-jpy-pegged-stablecoin-gyen-c3d1a80c91ee","twitter": "https://twitter.com/GMOTrust","telegram": "","github": ""}} ======================= File: erc20/0xCdeee767beD58c5325f68500115d4B722b3724EE.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "CRBN","address": "0xCdeee767beD58c5325f68500115d4B722b3724EE","overview":{"en": "Carbon aims to bring users' day-to-day crypto experience into one place while rewarding them in a big way at the same time."},"email": "<EMAIL>","website": "https://crbn.io/","state": "NORMAL","links": {"blog": "https://medium.com/@crbnio","twitter": "https://twitter.com/crbnio","telegram": "https://t.me/crbnio","github": ""}} ======================= File: erc20/0xd36E9F8F194A47B10aF16C7656a68EBa1DFe88e4.json ======================= {"symbol": "ATLS","address": "0xd36E9F8F194A47B10aF16C7656a68EBa1DFe88e4","overview":{"en": ""},"email": "","website": "https://atlas.world/","state": "NORMAL","links": {"blog": "https://medium.com/atlas-network","twitter": "https://twitter.com/AtlasEcosystem","telegram": "https://t.me/AtlasEcosystem","github": ""}} ======================= File: erc20/0x70debcDAB2Ef20bE3d1dBFf6a845E9cCb6E46930.json ======================= <gh_stars>100-1000 {"symbol": "BIKI","address": "0x70debcDAB2Ef20bE3d1dBFf6a845E9cCb6E46930","overview":{"en": ""},"email": "","website": "https://www.biki.com/","state": "NORMAL","links": {"blog": "https://medium.com/@bikicoin","twitter": "","telegram": "https://t.me/bikicoin","github": "https://github.com/code-bikicoin/bikicoin"}} ======================= File: erc20/0x2620638EDA99F9e7E902Ea24a285456EE9438861.json ======================= { "symbol": "CSM", "address": "0x2620638EDA99F9e7E902Ea24a285456EE9438861", "overview":{ "en": "CSM (Crust Storage Market) token is designed for Crust storage market. The total amount of CSM is 200 million, and will be dropped to community freely. CSM can be used as a ticket to to participate in storage market related CRU drop activities (such as subsequent store-data-to-get-CRU activity), obtain storage market related fee discounts, and get recycled to claim CRU of storage market revenue pool.", "zh": "CSM (Crust Storage Market) 是Crust的存储市场通证。CSM总量共计2亿,会以免费的方式向社区投放。CSM主要服务于存储市场,可被用作凭证参与存储市场相关投放活动(如后续的存储数据获取CRU活动)、获得商户和用户的存储相关费率优惠、以及兑换存储市场CRU收益池。" }, "email": "<EMAIL>", "website": "https://crust.network", "whitepaper": "https://crust.network/download/whitepaper_en.pdf", "state": "NORMAL", "published_on": "2020-11-30", "initial_price":{ "ETH":"0.0 ETH", "USD":"0.0 USD", "BTC":"0.0 BTC" }, "links": { "blog": "https://medium.com/crustnetwork/", "twitter": "https://twitter.com/CrustNetwork", "telegram": "https://t.me/CrustNetwork", "reddit": "https://www.reddit.com/r/CrustNetwork/", "github": "https://github.com/crustio", "facebook": "https://www.facebook.com/CrustNetwork/", "medium": "https://medium.com/crustnetwork/" } } ======================= File: erc20/0xD7394087E1DBBE477FE4F1CF373B9Ac9459565fF.json ======================= {"symbol": "RET","address": "0xD7394087E1DBBE477FE4F1CF373B9Ac9459565fF","overview":{"en": ""},"email": "<EMAIL>","website": "https://realtract.network/","state": "NORMAL","links": {"blog": "https://medium.com/@realtractofficial","twitter": "https://twitter.com/realtract","telegram": "https://t.me/RealTractOfficial","github": "https://github.com/RETnetwork"}} ======================= File: erc20/0x74dB83Feba1574fec860413Eb509d1DdFb1b730B.json ======================= <reponame>641589523/token-profile<filename>erc20/0x74dB83Feba1574fec860413Eb509d1DdFb1b730B.json<gh_stars>100-1000 {"symbol": "FCD","address": "0x74dB83Feba1574fec860413Eb509d1DdFb1b730B","overview":{"en": ""},"email": "","website": "https://future-cash.digital/#road-map","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/FutureCashD?s=03","telegram": "","github": ""}} ======================= File: erc20/0x09970aec766b6f3223aCA9111555E99DC50Ff13a.json ======================= {"symbol": "LEVL","address": "0x09970aec766b6f3223aCA9111555E99DC50Ff13a","overview":{"en": ""},"email": "<EMAIL>","website": "https://ito.levolution.io/","state": "NORMAL","links": {"blog": "https://levolution.io/news/","twitter": "https://twitter.com/LevolutionP","telegram": "https://t.me/levolutionITO","github": "https://github.com/LEVL-LLC"}} ======================= File: erc20/0x8aD6739649f1fbF079882C14D27862d5c2206660.json ======================= {"symbol": "IOUX","address": "0x8aD6739649f1fbF079882C14D27862d5c2206660","overview":{"en": ""},"email": "<EMAIL>","website": "https://iou.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/iouico%C2%A0","telegram": "http://t.me/IOUCommunity","github": "https://github.com/iouico/IOU"}} ======================= File: erc20/0xea3983Fc6D0fbbC41fb6F6091f68F3e08894dC06.json ======================= {"symbol": "UDO","address": "0xea3983Fc6D0fbbC41fb6F6091f68F3e08894dC06","overview":{"en": "Unido is a technology ecosystem that addresses the governance, security and accessibility challenges of decentralized applications - enabling enterprises to manage crypto assets and capitalize on DeFi."},"email": "<EMAIL>","website": "https://www.unido.us/","state": "NORMAL","links": {"blog": "https://unidocore.medium.com/","twitter": "https://twitter.com/Unidoep","telegram": "https://t.me/unidogroup","github": "https://github.com/unidocore/contract/blob/master/unido-1.sol"}} ======================= File: erc20/0x0878B3d9Ae5dCA7042D16FA6c6Cc0D831b71c7C2.json ======================= { "symbol": "XY", "address": "0x0878B3d9Ae5dCA7042D16FA6c6Cc0D831b71c7C2", "overview":{ "en": "Xiu Yan is Positioning based on blockchain storage technology to create a blockchain storage information network", "zh": "Xiu Yan 定位基于区块链储存技术以打造区块链储存信息网络,使之成为互联网世界的信息链接器。" }, "email": "<EMAIL>", "website": "http://xiuyan.xyz/", "whitepaper": "https://docsend.com/view/8s5t728", "state": "NORMAL", "published_on": "2020.02.02", "initial_price":{ "BTC":"0.00000005 BTC" }, "links": { "reddit": "https://mp.weixin.qq.com/s/lIhGdHa6_MTIyD27ay1q1w" } } ======================= File: erc20/0xe7E4279b80D319EDe2889855135A22021baf0907.json ======================= <filename>erc20/0xe7E4279b80D319EDe2889855135A22021baf0907.json {"symbol": "ZEUS","address": "0xe7E4279b80D319EDe2889855135A22021baf0907","overview":{"en": ""},"email": "<EMAIL>","website": "https://zeusnetwork.io/","state": "NORMAL","links": {"blog": "https://medium.com/@BitcoinGeo","twitter": "https://twitter.com/network_zeus?lang=en","telegram": "https://t.me/ZeusCrowdfundingOfficial","github": ""}} ======================= File: erc20/0x87f5E8c3425218837f3CB67dB941aF0C01323E56.json ======================= <gh_stars>100-1000 {"symbol": "BTCONE","address": "0x87f5E8c3425218837f3CB67dB941aF0C01323E56","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.bitcoinone.io","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/THEBITCOINONE","telegram": "https://t.me/TheBitCoinONE","github": "https://github.com/BitCoinONE1"}} ======================= File: erc20/0xAE31b85Bfe62747d0836B82608B4830361a3d37a.json ======================= <gh_stars>100-1000 {"symbol": "AERGO","address": "0xAE31b85Bfe62747d0836B82608B4830361a3d37a","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.aergo.io/","state": "NORMAL","links": {"blog": "https://medium.com/aergo","twitter": "https://twitter.com/AERGO_IO","telegram": "https://t.me/aergoannouncements","github": "https://github.com/aergoio"}} ======================= File: erc20/0xccf51a3323da073CAa13907d085956f100080e2c.json ======================= { "symbol": "HL", "address": "0xccf51a3323da073CAa13907d085956f100080e2c", "overview":{ "en": "Fox ecology is created by the HL Blockchain Foundation. It aims to efficiently solve the existing problems in the industry through the self-developed community autonomous and flexible financial increase and decrease agreement. Through the establishment of the increase and decrease agreement, it will drive the formation of decentralization and ensure the indispensability of currency prices. Be manipulated to create a more fair, free and high-value return token space for users and investments.", "zh": "Fox ecology由HL区块链基金会打造,旨在通过自主研发的社区自治弹性金融增减协议,高效解决行业现存问题,通过增减协议的建立,驱动去中心化的形成,保障币价的不可被操控,从而为用户和投资建立一个更加公平、自由和高价值回报的通证空间。" }, "email": "<EMAIL>", "website": "http://foxecology.cn.com/", "whitepaper": "http://foxecology.cn.com/enwhitepaper.pdf", "state": "NORMAL", "published_on": "2020-09-08", "links": { "telegram": "https://t.me/joinchat/JRdCSRsp7qaj8_p0NtLm5g", "twitter": "https://twitter.com/foxecology1" } } ======================= File: erc20/0xDf59C8BA19B4d1437d80836b45F1319D9A429EED.json ======================= <reponame>641589523/token-profile {"symbol": "IZI","address": "0xDf59C8BA19B4d1437d80836b45F1319D9A429EED","overview":{"en": ""},"email": "<EMAIL>","website": "https://izichain.io/","state": "NORMAL","links": {"blog": "https://medium.com/@izichainnetwork","twitter": "https://twitter.com/chain_izi","telegram": "https://t.me/izichainnetwork","github": "https://github.com/IZIChainLab"}} ======================= File: erc20/0x2eb86e8fC520E0F6Bb5D9Af08F924fe70558Ab89.json ======================= {"symbol": "LGR","address": "0x2eb86e8fC520E0F6Bb5D9Af08F924fe70558Ab89","overview":{"en": ""},"email": "<EMAIL>","website": "https://getlogarithm.com/","state": "NORMAL","links": {"blog": "https://medium.com/@getlogarithm","twitter": "https://twitter.com/getlogarithm","telegram": "https://t.me/getlgr","github": ""}} ======================= File: erc20/0x9B683d81B8334325bCC1802D47DE65571993Fe89.json ======================= {"symbol": "CFT","address": "0x9B683d81B8334325bCC1802D47DE65571993Fe89","overview":{"en": ""},"email": "","website": "https://www.coinbene.vip/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/coinbene","telegram": "","github": ""}} ======================= File: erc20/0xf4A81C18816C9B0AB98FAC51B36Dcb63b0E58Fde.json ======================= {"symbol": "WAR","address": "0xf4A81C18816C9B0AB98FAC51B36Dcb63b0E58Fde","overview":{"en": "YieldWars is a yield farming project that aims to create a utility token $WAR for governance and active participation."},"email": "","website": "https://yieldwars.com/","state": "NORMAL","links": {"blog": "https://medium.com/@yieldwars","twitter": "https://twitter.com/yieldwars","telegram": "https://t.me/yieldwarsofficial","github": ""}} ======================= File: erc20/0xF29992D7b589A0A6bD2de7Be29a97A6EB73EaF85.json ======================= <reponame>641589523/token-profile<filename>erc20/0xF29992D7b589A0A6bD2de7Be29a97A6EB73EaF85.json<gh_stars>100-1000 {"symbol": "DMST","address": "0xF29992D7b589A0A6bD2de7Be29a97A6EB73EaF85","overview":{"en": ""},"email": "<EMAIL>","website": "http://dmscript.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/DMScript","telegram": "https://t.me/dmscriptgroup","github": ""}} ======================= File: erc20/0xE1cc20A067FfF42D9e6056e609644398F11c84a8.json ======================= { "symbol": "BFM", "address": "0xE1cc20A067FfF42D9e6056e609644398F11c84a8", "overview": { "en": "BFM (B4 flash memory) is a new cryptocurrency based on Conditioned Proof of Capacity (cpoc). Its main characteristics are to use the B4 flash memory chip as a consensus participant, reduce the loss of temperature on the miner chip, improve the speed of chip rewriting and reading, provide the highest reliable storage, etc., so as to reduce the consumption of encrypted currency on power resources, reduce the threshold of participation, make its production mode more decentralized, and more secure and credible, so that everyone can participate with the mining of cryptocurrencies, credit and value are generated through mathematical algorithms and distributed mining.", "zh": "BFM(B4 Flash Memory)是基于Conditioned Proof Of Capacity(CPOC)的新型加密货币。其主要的特点是使用B4闪存芯片作为共识的参与者,减少温度对矿机芯片的损耗,提高芯片的重写、读取的速度,提供最高的可靠性存储等,从而降低加密货币对电力资源的消耗,降低参与门槛,让其生产方式更趋向去中心化方式,并更加安全可信,让人人都能参与到加密货币的开采,通过数学算法以及分布式开采产生信用和价值。" }, "email": "<EMAIL>", "website": "http://www.upbfm.com/", "whitepaper": "http://www.upbfm.com/wp", "state": "NORMAL", "published_on": "2019-12-6", "initial_price": { "USD": "0.0714 USD" }, "links": {} } ======================= File: erc20/0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0.json ======================= <reponame>641589523/token-profile { "symbol": "MATIC", "address": "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", "overview":{ "en": "Used for Transactions on Matic Network, holding Matic allows you to interact and use the plethora of Dapps on Matic, without high gas fees burning a hole in your pocket!", "zh": "用于在Matic网络上进行交易时,持有Matic可以使您在Matic上进行交互和使用过多的Dapps,而无需支付高昂的汽油费,就可以在口袋里挖洞! Yòng yú zài Matic wǎngluò shàng jìnxíng jiāoyì shí, chí yǒu Matic kěyǐ shǐ nín zài Matic shàng jìnxíng jiāohù hé shǐyòngguò duō de Dapps, ér wúxū zhīfù gāo'áng de qìyóu fèi, jiù kěyǐ zài kǒudài lǐ wā dòng!" }, "email": "<EMAIL>", "website": "https://matic.network/", "whitepaper": "https://matic.network/matic-litepaper.pdf", "state": "NORMAL", "published_on": "2019-04-24", "initial_price":{ "ETH":"0.000015348 ETH", "USD":"0.00263 USD", "BTC":"0.0000004720 BTC" }, "links": { "blog": "https://blog.matic.network/", "twitter": "https://twitter.com/maticnetwork", "telegram": "https://t.me/maticnetwork", "github": "https://github.com/maticnetwork", "facebook": "https://www.facebook.com/maticnetwork/", "reddit": "https://www.reddit.com/r/maticnetwork/", "medium": "https://medium.com/matic-network" } } ======================= File: erc20/0x1fa9F1CbF8c9a4fb3431a5809f31723038ed291B.json ======================= {"symbol": "SWEET","address": "0x1fa9F1CbF8c9a4fb3431a5809f31723038ed291B","overview":{"en": ""},"email": "","website": "https://honeytoken.org/","state": "NORMAL","links": {"blog": "http://t.me/honeytoken1","twitter": "https://twitter.com/HoneyToken1","telegram": "","github": ""}} ======================= File: erc20/0x3108ccFd96816F9E663baA0E8c5951D229E8C6da.json ======================= <reponame>641589523/token-profile {"symbol": "DARK","address": "0x3108ccFd96816F9E663baA0E8c5951D229E8C6da","overview":{"en": ""},"email": "","website": "https://www.dark.build/","state": "NORMAL","links": {"blog": "https://t.me/darkbuildANN","twitter": "https://twitter.com/DarkBuild1","telegram": "","github": ""}} ======================= File: erc20/0x42c41dABf7962Be4f510d54Aa9Eb0d2240634842.json ======================= <gh_stars>100-1000 {"symbol": "LEEK","address": "0x42c41dABf7962Be4f510d54Aa9Eb0d2240634842","overview":{"en": ""},"email": "","website": "http://www.leekgame.com/","state": "NORMAL","links": {"blog": "https://medium.com/@leekicoico","twitter": "https://twitter.com/Leekico_Info","telegram": "","github": ""}} ======================= File: erc20/0x73EE6D7e6b203125aDd89320E9F343d65ec7c39a.json ======================= {"symbol": "AXI","address": "0x73EE6D7e6b203125aDd89320E9F343d65ec7c39a","overview":{"en": "Axioms network aims to provide utility for an incentivized community to create the next game-changing token, farming sensation, social experiment, or viral dApp."},"email": "<EMAIL>","website": "https://axioms.app/","state": "NORMAL","links": {"blog": "https://axiomsapp.medium.com/","twitter": "https://twitter.com/AxiomsApp","telegram": "https://t.me/axiomsapp","github": ""}} ======================= File: erc20/0x3fa807B6F8d4c407e6E605368F4372d14658b38C.json ======================= {"symbol": "RISE","address": "0x3fa807B6F8d4c407e6E605368F4372d14658b38C","overview":{"en": "Rise Protocol is a hybrid rebase synthetic asset that incorporates powerful deflationary mechanisms, frictionless yield, auto-liquidity generation, and automatic liquidity provider rewards."},"email": "<EMAIL>","website": "https://riseprotocol.io/","state": "NORMAL","links": {"blog": "https://riseprotocolofficial.medium.com/","twitter": "https://twitter.com/RiseProtocol","telegram": "https://t.me/RiseProtocolOfficial","github": ""}} ======================= File: erc20/0xaC0741127CAC11E4455C7943b654bcCeD7FDD5A4.json ======================= <gh_stars>100-1000 {"symbol": "EJOY","address": "0xaC0741127CAC11E4455C7943b654bcCeD7FDD5A4","overview":{"en": ""},"email": "<EMAIL>","website": "","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Etherjoy1","telegram": "https://t.me/etherjoy","github": "https://github.com/etherjoy"}} ======================= File: erc20/0xeF9Cd7882c067686691B6fF49e650b43AFBBCC6B.json ======================= { "symbol": "FNX", "address": "0xeF9Cd7882c067686691B6fF49e650b43AFBBCC6B", "overview": { "en": "FinNexus is building a suite of open finance protocol clusters that will power hybrid marketplaces trading both decentralized and traditional financial products. The headline product to be released is a fully decentralized bitcoin (and other cryptocurrencies) options model that will live on both Wanchain and Ethereum.", "zh": "FinNexus是指为满足投资多样性、便捷性、以及价值基础三方面需求,运用区块链技术,构建实现资产、用户以及不同的服务商之间的交互的”开放金融连接器”的协议簇;从落地方面我们将衍生品赛道作为重点,并落地于去中心化期权。FinNexus将通过去中心化期权产品和创新的抵押流动池模式以更高的纬度切入赛道,并基于保证金抵押池和围绕FNX的生态价值纠缠设计,逐步开发出更多DeFi衍生品和其他创新型的DeFi金融产品,跻身DeFi衍生品赛道的头部。" }, "email": "<EMAIL>", "website": "https://www.finnexus.io", "whitepaper": "https://github.com/FinNexus/Pdfs/blob/master/FinNexus_Whitepaper_en.pdf", "state": "NORMAL", "links": { "medium": "https://medium.com/finnexus", "github": "https://github.com/FinNexus/", "twitter": "https://twitter.com/fin_nexus", "telegram": "https://t.me/FinNexusOfficial", "facebook": "https://www.facebook.com/FinNexus/", "linkedin": "https://www.linkedin.com/company/finnexus/", "discord": "https://discord.gg/bCDMHN7" } } ======================= File: erc20/0x383518188C0C6d7730D91b2c03a03C837814a899.json ======================= {"symbol": "OHM","address": "0x383518188C0C6d7730D91b2c03a03C837814a899","overview":{"en": ""},"email": "","website": "https://olympusdao.eth.link/#/","state": "NORMAL","links": {"blog": "https://olympusdao.medium.com/","twitter": "https://twitter.com/OlympusDAO","telegram": "","github": ""}} ======================= File: erc20/0x957891C11616D3E0B0A76a76fb42724C382E0eF3.json ======================= {"symbol": "COLL","address": "0x957891C11616D3E0B0A76a76fb42724C382E0eF3","overview":{"en": ""},"email": "","website": "https://www.collateralpay.com/","state": "NORMAL","links": {"blog": "https://collateraldefi.medium.com/","twitter": "https://twitter.com/CollateralDefi","telegram": "","github": ""}} ======================= File: erc20/0xbE685C5E06866cfB94A4242E3DF8f2fa3E7c2b73.json ======================= {"symbol": "YFRM","address": "0xbE685C5E06866cfB94A4242E3DF8f2fa3E7c2b73","overview":{"en": ""},"email": "","website": "https://yfrm.finance","state": "NORMAL","links": {"blog": "https://yfrmtoken.medium.com/yf-red-moon-defi-addd243b0d21","twitter": "https://twitter.com/YFRM_TOKEN","telegram": "","github": ""}} ======================= File: erc20/0x84119cb33E8F590D75c2D6Ea4e6B0741a7494EDA.json ======================= <reponame>641589523/token-profile {"symbol": "WTT","address": "0x84119cb33E8F590D75c2D6Ea4e6B0741a7494EDA","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.giga-watt.com/","state": "NORMAL","links": {"blog": "https://medium.com/gigawatt","twitter": "https://twitter.com/gigawatt_mining","telegram": "https://telegram.me/wtt_token","github": ""}} ======================= File: erc20/0xB53e08B97724126Bda6d237B94F766c0b81C90fE.json ======================= {"symbol": "PIXBY","address": "0xB53e08B97724126Bda6d237B94F766c0b81C90fE","overview":{"en": ""},"email": "<EMAIL>","website": "https://pixby.io/","state": "NORMAL","links": {"blog": "https://medium.com/@pixbytoken","twitter": "https://twitter.com/PixbyToken","telegram": "https://t.me/pixbytoken","github": "https://github.com/shadiyarPXB/PIXBY-Project"}} ======================= File: erc20/0x2Fc246aA66F0da5bB1368F688548ecBBE9bdee5d.json ======================= {"symbol": "TEMCO","address": "0x2Fc246aA66F0da5bB1368F688548ecBBE9bdee5d","overview":{"en": ""},"email": "<EMAIL>","website": "https://temco.io/","state": "NORMAL","links": {"blog": "https://medium.com/temcolabs","twitter": "https://twitter.com/TEMCOLABS","telegram": "https://t.me/TEMCOLABS","github": "https://github.com/temcolabs/token"}} ======================= File: erc20/0x4cA0654f4fc1025cF1a17B7459c20aC0479522aD.json ======================= {"symbol": "RIGEL","address": "0x4cA0654f4fc1025cF1a17B7459c20aC0479522aD","overview":{"en": "Rigel Finance is an AMM decentralized exchange with farming and staking functions. Users can create new pools or add liquidity on existing pools to start farming and earn fee."},"email": "","website": "https://rigel.finance/","state": "NORMAL","links": {"blog": "https://rigelfinance.medium.com","twitter": "https://twitter.com/RigelFinance","telegram": "https://t.me/RigelFinance1","github": "https://github.com/RigelFinance"}} ======================= File: erc20/0x2aF72850c504dDD3c1876C66a914cAee7Ff8a46A.json ======================= <filename>erc20/0x2aF72850c504dDD3c1876C66a914cAee7Ff8a46A.json {"symbol": "WHL","address": "0x2aF72850c504dDD3c1876C66a914cAee7Ff8a46A","overview":{"en": "Chatrooms for crypto projects, whales, and influencers."},"email": "<EMAIL>","website": "https://whaleroom.org/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/WhaleRooms","telegram": "https://t.me/WhaleRooms","github": "https://github.com/whaleroom/whaleroom"}} ======================= File: erc20/0x2ccbFF3A042c68716Ed2a2Cb0c544A9f1d1935E1.json ======================= {"symbol": "DMT","address": "0x2ccbFF3A042c68716Ed2a2Cb0c544A9f1d1935E1","overview":{"en": ""},"email": "<EMAIL>","website": "https://dmarket.com/","state": "NORMAL","links": {"blog": "https://medium.com/@dmarket","twitter": "https://twitter.com/dmarket_io","telegram": "https://t.me/joinchat/CV8tCULRq_vJ2Xzu9Iopqg","github": "https://github.com/suntechsoft/dmarket-smartcontract"}} ======================= File: erc20/0x002f2264AEec71041Ae5739ecf0a2C80c5EA30FA.json ======================= {"symbol": "FEX","address": "0x002f2264AEec71041Ae5739ecf0a2C80c5EA30FA","overview":{"en": ""},"email": "","website": "https://foresterx.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/JamesWh69174828","telegram": "","github": ""}} ======================= File: erc20/0x2d9765a94FF22e0CA3AfC3E3F4B116dE2b67582a.json ======================= {"symbol": "CGC","address": "0x2d9765a94FF22e0CA3AfC3E3F4B116dE2b67582a","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.genieico.net/","state": "NORMAL","links": {"blog": "https://medium.com/@genieico","twitter": "","telegram": "https://t.me/joinchat/F9j7MhF-eb-t5SVPYptdyQ","github": "https://github.com/crowdgenie/smart-contract"}} ======================= File: erc20/0x5a4623F305A8d7904ED68638AF3B4328678edDBF.json ======================= {"symbol": "dART","address": "0x5a4623F305A8d7904ED68638AF3B4328678edDBF","overview":{"en": ""},"email": "","website": "https://dart.gold/","state": "NORMAL","links": {"blog": "https://dartinsurance.medium.com/dart-token-the-backbone-of-the-first-nft-insurance-platform-1deaea759d4d","twitter": "https://twitter.com/dARTinsurance","telegram": "","github": ""}} ======================= File: erc20/0x722F2f3EaC7e9597C73a593f7CF3de33Fbfc3308.json ======================= {"symbol": "CNUS","address": "0x722F2f3EaC7e9597C73a593f7CF3de33Fbfc3308","overview":{"en": ""},"email": "<EMAIL>","website": "https://coinus.io/","state": "NORMAL","links": {"blog": "https://medium.com/@coinus.official/","twitter": "https://twitter.com/CoinUs_Official","telegram": "https://t.me/CoinUs_ENG","github": ""}} ======================= File: erc20/0x526Ccc90191A9472299323816bD2c784C0A1BCDE.json ======================= <gh_stars>100-1000 {"symbol": "DBLK","address": "0x526Ccc90191A9472299323816bD2c784C0A1BCDE","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.dataonblock.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/dataonblock","telegram": "https://t.me/DataOnBlock_Updates","github": "https://github.com/DataOnBlock"}} ======================= File: erc20/0x538CCA3AFAC8DBc178Afd74087C43C73F3A4B548.json ======================= <gh_stars>100-1000 { "symbol": "CBD", "address": "0x538CCA3AFAC8DBc178Afd74087C43C73F3A4B548", "overview": { "en": "Computing blockchain development is based on the value circulation integral issued by the cloud computing mine project, and also the ecological incentive integral applied to the blockchain mining industry. Based on the consensus of real assets and value, cloud computing CBD will build the world's first and complete blockchain mining ecosystem.", "zh": "Computing Blockchain Development,是基于云算矿场项目所发行的价值流通积分,也是应用于区块链矿业行业的生态激励积分,云算CBD的基于实体资产和价值共识,将构建全球第一个完备的区块链矿业生态体系." }, "email": "<EMAIL>", "website": "http://www.yscbd.io/", "whitepaper": "http://www.yscbd.io/cbdwhitepaper.pdf", "published_on": "2020-03-09", "state": "NORMAL", "initial_price":{ "USD":"0.1416 USD" }, "links": { "telegram": "https://t.me/cbdchain" } } ======================= File: erc20/0xB8c50B608f20AB84344a8CD10E71bbb658c658B2.json ======================= { "symbol": "DIPP", "address": "0xB8c50B608f20AB84344a8CD10E71bbb658c658B2", "overview":{ "en": "DIPPER,the decentralized asset management platform, It is the world's first dam platform in the field of defi. It redefines the trading service and asset management in the era of open finance, and truly realizes the decentralized open asset management platform by means of fund custody decentralization, underlying trading decentralization, strategy revenue and withdrawal data Oracle verification, real-time transaction signal storage and online chain.", "zh": "DIPPER,是DEFI领域全球第一个DAM平台,重新定义开放式金融时代下的交易服务与资产管理,通过资金托管去中心化、标的交易去中心化、策略收益与回撤数据预言机验证、交易信号实时存证上链等技术手段,真正实现去中心化的开放式资产管理平台。DIPP是开放式资管平台DIPPER的唯一平台通证,总发行量仅1000万枚,通证经济模型领先有效,将成功打造开放式资管与交易服务新生态。" }, "email": "<EMAIL>", "website": "https://www.dipper.top", "whitepaper": "https://raw.githubusercontent.com/dipperdev/materials/master/whitepaper.pdf", "state": "NORMAL", "published_on": "2020-12-08", "initial_price":{ "USD": "30 USD" }, "links": { "twitter": "https://twitter.com/DipperDam", "telegram": "https://t.me/dipperdam", "github": "https://github.com/andyleeee", "medium": "https://medium.com/DipperDam", "discord": "https://discord.gg/TW3MRR9uAw", "reddit": "https://www.reddit.com/r/DipperDam" } } ======================= File: erc20/0x52d904eFf2605463c2F0b338d34aBc9B7c3e3b08.json ======================= {"symbol": "BPP","address": "0x52d904eFf2605463c2F0b338d34aBc9B7c3e3b08","overview":{"en": "Bitpower is bringing to market a digital token powering two key products: BitChallengly platform for online P2P blitz challenges and Block Insight, a live service analyzing blockchain projects for credibility, performance, and user potential."},"email": "<EMAIL>","website": "https://www.blinsight.com/","state": "NORMAL","links": {"blog": "https://bitpower.medium.com/","twitter": "https://twitter.com/_BITPOWER","telegram": "https://t.co/7iTwCdDb58?amp=1","github": ""}} ======================= File: erc20/0x75c5eE419331B6150879530D06f9Ba054755F1DA.json ======================= {"symbol": "SAL","address": "0x75c5eE419331B6150879530D06f9Ba054755F1DA","overview":{"en": ""},"email": "<EMAIL>","website": "https://ico.salpay.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/salariumpayroll","telegram": "https://t.co/1Xl3AiZBwq","github": ""}} ======================= File: erc20/0x949bEd886c739f1A3273629b3320db0C5024c719.json ======================= <reponame>641589523/token-profile {"symbol": "AMIS","address": "0x949bEd886c739f1A3273629b3320db0C5024c719","overview":{"en": ""},"email": "<EMAIL>","website": "http://erc20-amis.amisolution.net/","state": "NORMAL","links": {"blog": "https://medium.com/@AMIS_ERC20","twitter": "https://twitter.com/AMIS_ERC20","telegram": "","github": "https://github.com/amisolution/ERC20-AMIS"}} ======================= File: erc20/0x3a08b85D00eb899afE3Bb382Fe7375926880718f.json ======================= {"symbol": "MERC","address": "0x3a08b85D00eb899afE3Bb382Fe7375926880718f","overview":{"en": ""},"email": "","website": "https://merlincoins.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/MagicMerlin4","telegram": "","github": ""}} ======================= File: erc20/0x2863916C6ebDBBf0c6f02F87b7eB478509299868.json ======================= {"symbol": "SST","address": "0x2863916C6ebDBBf0c6f02F87b7eB478509299868","overview":{"en": ""},"email": "","website": "https://simba.storage/","state": "NORMAL","links": {"blog": "https://medium.com/@simbastorage","twitter": "https://twitter.com/SWISSSST","telegram": "","github": ""}} ======================= File: erc20/0xfd8971d5E8E1740cE2d0A84095fCA4De729d0c16.json ======================= {"symbol": "ZLA","address": "0xfd8971d5E8E1740cE2d0A84095fCA4De729d0c16","overview":{"en": ""},"email": "<EMAIL>","website": "https://zla.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/zillatoken","telegram": "https://t.me/zilla_app","github": ""}} ======================= File: erc20/0x8fEEf860E9fA9326ff9d7E0058F637bE8579Cc29.json ======================= <gh_stars>100-1000 {"symbol": "IPM","address": "0x8fEEf860E9fA9326ff9d7E0058F637bE8579Cc29","overview":{"en": "The TIMERS token is a representation of a human's intrinsic time value. The abbreviation IPM stands for Income/Per/Minute."},"email": "<EMAIL>","website": "https://timers.network/","state": "NORMAL","links": {"blog": "https://medium.com/timers","twitter": "https://twitter.com/TIMERSnetwork","telegram": "https://t.me/TIMERSipm","github": ""}} ======================= File: erc20/0x6710CeE627Fa3A988200ffD5687cc1C814cEf0F6.json ======================= <filename>erc20/0x6710CeE627Fa3A988200ffD5687cc1C814cEf0F6.json<gh_stars>100-1000 {"symbol": "FCQ","address": "0x6710CeE627Fa3A988200ffD5687cc1C814cEf0F6","overview":{"en": ""},"email": "","website": "https://fortemcoin.io","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/CapitalFortem","telegram": "https://t.me/fortemcapital","github": "https://github.com/FortemCapitalOU/token"}} ======================= File: erc20/0xC40AF1E4fEcFA05Ce6BAb79DcD8B373d2E436c4E.json ======================= <filename>erc20/0xC40AF1E4fEcFA05Ce6BAb79DcD8B373d2E436c4E.json {"symbol": "HOKK","address": "0xC40AF1E4fEcFA05Ce6BAb79DcD8B373d2E436c4E","overview":{"en": ""},"email": "","website": "https://hokk.finance/","state": "NORMAL","links": {"blog": "https://hokkfinance.medium.com/","twitter": "https://twitter.com/hokkaiduinu","telegram": "","github": ""}} ======================= File: erc20/0x594120039687DDaAB50C4aB03bAda20Eb4b218F6.json ======================= {"symbol": "GMV","address": "0x594120039687DDaAB50C4aB03bAda20Eb4b218F6","overview":{"en": "Green Movement (GMV) is an Ethereum Blockchain based token supporting the green movement and a more conducive environment."},"email": "<EMAIL>","website": "http://greenmovement.network/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/gmvtoken","telegram": "https://t.me/gmvchat","github": ""}} ======================= File: erc20/0x95b3497bBcCcc46a8F45F5Cf54b0878b39f8D96C.json ======================= {"symbol": "UNIDX","address": "0x95b3497bBcCcc46a8F45F5Cf54b0878b39f8D96C","overview":{"en": "UniDex aims to aggregate and combine all the solutions current DeFi exchanges provide and have it all done on a single exchange. View and manage all your different trades with limit orders, manage your option trades, UniSwap or similar LP tokens, and borrow and lend all from UniDex."},"email": "<EMAIL>","website": "https://www.unidex.finance/","state": "NORMAL","links": {"blog": "https://unidexfinance.medium.com/","twitter": "https://twitter.com/UniDexFinance","telegram": "https://t.me/unidexfinance","github": "https://github.com/supakawaiidesu"}} ======================= File: erc20/0x1B4d86229eC0A071C1A3D1ABc7AA1C0E45c57Ed5.json ======================= <filename>erc20/0x1B4d86229eC0A071C1A3D1ABc7AA1C0E45c57Ed5.json {"symbol":"FGCC","address":"0x1B4d86229eC0A071C1A3D1ABc7AA1C0E45c57Ed5","overview":{"en":"Feel grateful chian,help and Thanksgiving around the people and things, the coin that through the transfer of love to get value.","zh":"感恩链,帮扶与感恩身边的人事物,通过传递爱心而获得价值的一种币"},"email":"<EMAIL>","website":"https://www.helpchain.co.ax/#/homeIndex","whitepaper":"https://fgc.helpchain.co.ax/baipiBook/FGCwhitepaper.pdf","state":"NORMAL","published_on":"2021-01-01","initial_price":{"ETH":"0.00166666 ETH","USD":"0.7 USD","BTC":"0.00004137 BTC"},"links":{"github":"https://github.com/linqitai/fgc-h5"}} ======================= File: erc20/0x55a290f08Bb4CAe8DcF1Ea5635A3FCfd4Da60456.json ======================= <reponame>641589523/token-profile {"symbol": "BITTO","address": "0x55a290f08Bb4CAe8DcF1Ea5635A3FCfd4Da60456","overview":{"en": ""},"email": "","website": "http://www.bittoexchange.com/","state": "NORMAL","links": {"blog": "https://medium.com/@bittoexchange","twitter": "https://twitter.com/bittoexchange","telegram": "","github": ""}} ======================= File: erc20/0xE02784175C3BE0DEa7CC0F284041b64503639E66.json ======================= <gh_stars>100-1000 {"symbol": "TOC","address": "0xE02784175C3BE0DEa7CC0F284041b64503639E66","overview":{"en": "The TouchCon is a platform that creates mutual benefits between advertisers and consumers by generating Smart QR Code Ad contents."},"email": "<EMAIL>","website": "http://www.touchcon.org/","state": "NORMAL","links": {"blog": "https://medium.com/@touchconinfo","twitter": "https://twitter.com/TouchconInfo","telegram": "https://t.me/touchconQR","github": ""}} ======================= File: erc20/0x83c88dBd0059EdB45A3e57B9Cc50E9Ee0fdA7191.json ======================= <gh_stars>100-1000 {"symbol": "PBC","address": "0x83c88dBd0059EdB45A3e57B9Cc50E9Ee0fdA7191","overview":{"en": ""},"email": "<EMAIL>","website": "https://planetblockchain.io/","state": "NORMAL","links": {"blog": "https://planetblockchain.io/","twitter": "https://twitter.com/PlanetBlockC","telegram": "","github": ""}} ======================= File: erc20/0x1183F92A5624D68e85FFB9170F16BF0443B4c242.json ======================= {"symbol": "QVT","address": "0x1183F92A5624D68e85FFB9170F16BF0443B4c242","overview":{"en": ""},"email": "<EMAIL>","website": "https://qvolta.com/","state": "NORMAL","links": {"blog": "https://medium.com/@Qvolta","twitter": "https://twitter.com/Qvolta_platform","telegram": "https://t.me/qvolta","github": "https://github.com/qvolta"}} ======================= File: erc20/0x256845e721C0c46d54E6afBD4FA3B52CB72353EA.json ======================= {"symbol": "UNIUSD","address": "0x256845e721C0c46d54E6afBD4FA3B52CB72353EA","overview":{"en": ""},"email": "","website": "https://unidollar.network","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/unidollartoken","telegram": "https://t.me/unidollar","github": ""}} ======================= File: erc20/0xac4D22e40bf0B8eF4750a99ED4E935B99A42685E.json ======================= {"symbol": "AER","address": "0xac4D22e40bf0B8eF4750a99ED4E935B99A42685E","overview":{"en": ""},"email": "","website": "https://aeryus.com/","state": "NORMAL","links": {"blog": "https://medium.com/@h.lorenzo","twitter": "https://twitter.com/Aeryus_one","telegram": "","github": ""}} ======================= File: erc20/0x2eDf094dB69d6Dcd487f1B3dB9febE2eeC0dd4c5.json ======================= {"symbol": "ZEE","address": "0x2eDf094dB69d6Dcd487f1B3dB9febE2eeC0dd4c5","overview":{"en": "ZeroSwap.io is a multi-Chain, zero-fee, on-chain trading protocol with liquidity mining, DeFi token offering, and DEX aggregation. The protocol will reward users every time they make an on-chain trade and provide liquidity to existing DEXes. All transactions would be Gasless with zero trade fee."},"email": "<EMAIL>","website": "https://zeroswap.io/","state": "NORMAL","links": {"blog": "https://medium.com/zeroswaplabs","twitter": "https://twitter.com/ZeroSwapLabs","telegram": "https://t.me/ZeroSwap_ANN","github": ""}} ======================= File: erc20/0xfe5D908c9Ad85f651185dAa6a4770726E2b27d09.json ======================= <reponame>641589523/token-profile<filename>erc20/0xfe5D908c9Ad85f651185dAa6a4770726E2b27d09.json {"symbol": "BHR","address": "0xfe5D908c9Ad85f651185dAa6a4770726E2b27d09","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.bether.cc/","state": "NORMAL","links": {"blog": "https://bethercoin.blogspot.com/","twitter": "https://twitter.com/BETHERcoin","telegram": "","github": ""}} ======================= File: erc20/0xf4065e4477e91C177DED71A7A6fb5ee07DC46BC9.json ======================= <gh_stars>100-1000 {"symbol": "CEDEX","address": "0xf4065e4477e91C177DED71A7A6fb5ee07DC46BC9","overview":{"en": ""},"email": "<EMAIL>","website": "https://cedex.com/","state": "NORMAL","links": {"blog": "https://medium.com/@cedex.community","twitter": "https://twitter.com/CedexOfficial","telegram": "","github": "https://github.com/Cedex-Diamond-Exchange/contracts-cedex-token"}} ======================= File: erc20/0xC222e5B89309FAB5FAf55a3b3bd9082be834916C.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "BCA","address": "0xC222e5B89309FAB5FAf55a3b3bd9082be834916C","overview":{"en": ""},"email": "","website": "https://bitcoiva.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/bitcoiva","telegram": "https://t.me/BITCOIVA","github": "https://github.com/bitcoiva-token"}} ======================= File: erc20/0x37E8789bB9996CaC9156cD5F5Fd32599E6b91289.json ======================= <reponame>641589523/token-profile {"symbol": "AID","address": "0x37E8789bB9996CaC9156cD5F5Fd32599E6b91289","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.aidcoin.co/","state": "NORMAL","links": {"blog": "https://medium.com/aidcoin","twitter": "https://twitter.com/aid_coin","telegram": "https://t.me/aidcoincommunity","github": "https://github.com/AidCoinCo"}} ======================= File: erc20/0x884e3902C4d5cFA86de4aCE7A96AA91EbC25C0Ff.json ======================= {"symbol": "JBX","address": "0x884e3902C4d5cFA86de4aCE7A96AA91EbC25C0Ff","overview":{"en": ""},"email": "","website": "https://jboxcoin.org/","state": "NORMAL","links": {"blog": "https://medium.com/jboxcoin/","twitter": "https://twitter.com/jbox_coin","telegram": "","github": ""}} ======================= File: erc20/0x7cf74238D48Ce383db00a1EFff8da99303552cb0.json ======================= {"symbol": "I9C","address": "0x7cf74238D48Ce383db00a1EFff8da99303552cb0","overview":{"en": ""},"email": "","website": "http://i9coin.org","state": "NORMAL","links": {"blog": "https://medium.com/@tokeni9coin","twitter": "https://twitter.com/I9Coin","telegram": "","github": ""}} ======================= File: erc20/0xD56daC73A4d6766464b38ec6D91eB45Ce7457c44.json ======================= {"symbol": "PAN","address": "0xD56daC73A4d6766464b38ec6D91eB45Ce7457c44","overview":{"en": "Panvala is a decentralized foundation that helps fund the work that the whole Ethereum community depends on."},"email": "<EMAIL>","website": "https://panvala.com/","state": "NORMAL","links": {"blog": "https://medium.com/@Panvala","twitter": "https://twitter.com/panvalahq","telegram": "https://t.me/panvala","github": "https://github.com/ConsenSys/panvala"}} ======================= File: erc20/0x34612903Db071e888a4dADcaA416d3EE263a87b9.json ======================= {"symbol": "arte","address": "0x34612903Db071e888a4dADcaA416d3EE263a87b9","overview":{"en": "The Voting Token of ethart, an R&D in how a self-sovereign bank can be used in the future. ARTE holders can rule information of NFTs stored in the State Holder of Ethart (NFT Owner and NFT Data), like an anonymous bank in co-ownership with the ERC721 holders."},"email": "<EMAIL>","website": "https://www.ethart.org/","state": "NORMAL","links": {"blog": "https://medium.com/dfohub","twitter": "https://twitter.com/dfohub","telegram": "","github": "https://github.com/b-u-i-d-l/ethArt"}} ======================= File: erc20/0xfB559CE67Ff522ec0b9Ba7f5dC9dc7EF6c139803.json ======================= {"symbol": "PROB","address": "0xfB559CE67Ff522ec0b9Ba7f5dC9dc7EF6c139803","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.probit.com","state": "NORMAL","links": {"blog": "https://medium.com/@ProBit_Exchange","twitter": "https://twitter.com/ProBit_Exchange","telegram": "https://t.me/ProbitEnglish","github": "https://github.com/probitexchange"}} ======================= File: erc20/0xA0aa85b54F8A7b09C845F13a09172B08925f3d54.json ======================= {"symbol": "SISA","address": "0xA0aa85b54F8A7b09C845F13a09172B08925f3d54","overview":{"en": ""},"email": "","website": "https://sisa.fund/","state": "NORMAL","links": {"blog": "https://medium.com/@sisa.fund","twitter": "https://twitter.com/sisa_fund","telegram": "","github": ""}} ======================= File: erc20/0x6710c63432A2De02954fc0f851db07146a6c0312.json ======================= <filename>erc20/0x6710c63432A2De02954fc0f851db07146a6c0312.json<gh_stars>100-1000 {"symbol": "MFG","address": "0x6710c63432A2De02954fc0f851db07146a6c0312","overview":{"en": ""},"email": "<EMAIL>","website": "https://blockchain.syncfab.com/","state": "NORMAL","links": {"blog": "https://medium.com/syncfabmfg","twitter": "https://twitter.com/syncfab","telegram": "https://t.me/syncfab","github": "https://github.com/syncfab"}} ======================= File: erc20/0x6E5a43DB10b04701385A34afb670E404bC7Ea597.json ======================= <reponame>641589523/token-profile {"symbol": "RKN","address": "0x6E5a43DB10b04701385A34afb670E404bC7Ea597","overview":{"en": ""},"email": "<EMAIL>","website": "https://rkntoken.io/","state": "NORMAL","links": {"blog": "https://medium.com/@rakontoken","twitter": "https://twitter.com/RakonRkn","telegram": "https://t.me/rkntoken","github": ""}} ======================= File: erc20/0x3c75226555FC496168d48B88DF83B95F16771F37.json ======================= {"symbol": "DROP","address": "0x3c75226555FC496168d48B88DF83B95F16771F37","overview":{"en": ""},"email": "<EMAIL>","website": "https://droplex.org/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Droplex2","telegram": "","github": "https://github.com/Droplexprotocol/"}} ======================= File: erc20/0x5456BC77Dd275c45c3C15f0cF936b763cF57c3B5.json ======================= <filename>erc20/0x5456BC77Dd275c45c3C15f0cF936b763cF57c3B5.json {"symbol": "ANCT","address": "0x5456BC77Dd275c45c3C15f0cF936b763cF57c3B5","overview":{"en": ""},"email": "<EMAIL>","website": "https://theanchor.io/","state": "NORMAL","links": {"blog": "https://medium.com/@theanchor.io","twitter": "https://twitter.com/theanchor_io","telegram": "https://t.me/theanchorprojectcommunity","github": "https://github.com/AnchorProject/anchor-tokens"}} ======================= File: erc20/0xb2C822a1b923E06Dbd193d2cFc7ad15388EA09DD.json ======================= {"symbol": "VAMP","address": "0xb2C822a1b923E06Dbd193d2cFc7ad15388EA09DD","overview":{"en": "VAMP is native token for Vampire Protocol. VAMP gains value by rebasing and farming tokens & items. MANA Token - a token that grants a holder an enhanced rebase."},"email": "<EMAIL>","website": "https://vampire.finance/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/ethtari","telegram": "https://t.me/vampireprotocol","github": ""}} ======================= File: erc20/0x8e70cd9A3962e192B76454dcf10d24B63fDDA195.json ======================= <filename>erc20/0x8e70cd9A3962e192B76454dcf10d24B63fDDA195.json<gh_stars>100-1000 { "symbol": "BAA", "address": "0x8e70cd9A3962e192B76454dcf10d24B63fDDA195", "overview":{ "en": "BAA (BAAToken), is issued by Apollo Green Energy Foundation(Apollo), incorporated in Singapore on Sep 2018. Apollothrough its blockchain consensus algorithm ensures the security of accounts and assets, it provides tamper proof technology, digital signature, encrypted wallet and other means of security features.", "zh": "BAAtoken(简称 BAA),是由新加坡阿波罗基金会(简称 阿波罗)发行,该基金会成立于2018年9月,阿波罗通过区块链共识、不可篡改技术以及数字签名、加密钱包等安全手段确保帐户和资产的安全性。" }, "email": "<EMAIL>", "website": "http://www.baatoken.com/", "whitepaper": "http://20811820.s21d-20.faiusrd.com/61/ABUIABA9GAAg0Lnd8gUo0I_83AQ.pdf?v=1582783771", "state": "NORMAL", "published_on": "2020-03-04", "links": { "website": "http://www.baatoken.com/" } } ======================= File: erc20/0x24b80fBa4B2ECaF0C4Df522354408F0A59A775C8.json ======================= <reponame>641589523/token-profile {"symbol": "WADS","address": "0x24b80fBa4B2ECaF0C4Df522354408F0A59A775C8","overview":{"en": ""},"email": "<EMAIL>","website": "https://adsbywifi.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/adsbywifi","telegram": "https://t.me/adsbywifi","github": "https://github.com/adsbywifi"}} ======================= File: erc20/0xC64500DD7B0f1794807e67802F8Abbf5F8Ffb054.json ======================= <filename>erc20/0xC64500DD7B0f1794807e67802F8Abbf5F8Ffb054.json {"symbol": "LOCUS","address": "0xC64500DD7B0f1794807e67802F8Abbf5F8Ffb054","overview":{"en": ""},"email": "<EMAIL>","website": "https://locuschain.com/","state": "NORMAL","links": {"blog": "https://medium.com/@locus_10211","twitter": "https://twitter.com/LocusChain","telegram": "https://t.me/locusofficial","github": ""}} ======================= File: erc20/0x97af10D3fc7C70F67711Bf715d8397C6Da79C1Ab.json ======================= { "symbol": "DIP", "address": "0x97af10D3fc7C70F67711Bf715d8397C6Da79C1Ab", "overview":{ "en": "Dipper Network is an open financial blockchain based on BPOS and cross-chain ecology.", "zh": "Dipper Network是一条基于BPOS共识机制和跨链生态的开放金融公链。" }, "website": "https://www.dippernetwork.com", "whitepaper": "https://github.com/Dipper-Labs/resources/blob/master/whitepaper.pdf", "state": "NORMAL", "published_on": "2020-7", "links": { "twitter": "https://twitter.com/DipperNetwork", "telegram": "https://t.me/DipperNetworkOfficial", "github": "https://github.com/Dipper-Labs" } } ======================= File: erc20/0x720c2c93F5f9A6b82226e84095558B10F399b0FA.json ======================= {"symbol": "GC","address": "0x720c2c93F5f9A6b82226e84095558B10F399b0FA","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.agric.io/","state": "NORMAL","links": {"blog": "https://medium.com/@griccointube","twitter": "https://twitter.com/griccoin/","telegram": "https://t.me/griccoin1","github": "https://github.com/Gric-Coin"}} ======================= File: erc20/0x5c4ac68aAc56eBe098D621Cd8CE9F43270Aaa355.json ======================= {"symbol": "bXIOT","address": "0x5c4ac68aAc56eBe098D621Cd8CE9F43270Aaa355","overview":{"en": "XIOTRI is a community-based protocol for a fair multi-asset collateral yield exposure."},"email": "<EMAIL>","website": "https://xiotri.io/","state": "NORMAL","links": {"blog": "http://medium.com/@xiotri","twitter": "http://twitter.com/xiotri_defi","telegram": "https://t.me/xiotri_chat","github": ""}} ======================= File: coins/westend.json ======================= <filename>coins/westend.json { "symbol": "WND", "address": "westend", "overview":{ "en": "Westend testnet token", "zh": "Westend 测试网通证" }, "email": "<EMAIL>", "website": "polkadot.network", "state": "NORMAL", "published_on": "2019-07", "links": { "twitter": "https://twitter.com/polkadotnetwork", } } ======================= File: erc20/0x0F612a09eAd55Bb81b6534e80ed5A21Bf0a27B16.json ======================= <reponame>641589523/token-profile {"symbol": "ENTS","address": "0x0F612a09eAd55Bb81b6534e80ed5A21Bf0a27B16","overview":{"en": ""},"email": "<EMAIL>","website": "https://ent.zone/","state": "NORMAL","links": {"blog": "https://ent.zone/blog/","twitter": "https://twitter.com/EunomiaToken","telegram": "https://t.me/eunomiaglobal","github": "https://github.com/ENTSProject"}} ======================= File: erc20/0x8F2C01B50A16482Efd29560Ecb2B4E6016CC3886.json ======================= <filename>erc20/0x8F2C01B50A16482Efd29560Ecb2B4E6016CC3886.json {"symbol": "AMBA","address": "0x8F2C01B50A16482Efd29560Ecb2B4E6016CC3886","overview":{"en": ""},"email": "<EMAIL>","website": "https://ambacoin.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/CoinAmba","telegram": "https://t.me/joinchat/DlNNYQ5vMrvr0syXeyFX3g","github": "https://github.com/AmbazonianCoin"}} ======================= File: erc20/0x25e1474170c4c0aA64fa98123bdc8dB49D7802fa.json ======================= {"symbol": "BID","address": "0x25e1474170c4c0aA64fa98123bdc8dB49D7802fa","overview":{"en": ""},"email": "","website": "https://bidaochain.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Bidaochain","telegram": "","github": ""}} ======================= File: erc20/0x7a3AcC486229bc979FeF5DafBc5Ae22a59cae8e5.json ======================= <reponame>641589523/token-profile { "symbol": "GZT", "address": "0x7a3AcC486229bc979FeF5DafBc5Ae22a59cae8e5", "overview":{ "en": "GZT(J.Golden Zone Token) is a community membership credit,issued by J.Golden Zone Services Pvt. Ltd. It's non-divisible, non-tradable and only distributed through official channels.GZT will not launch an ICO or IEO.", "zh": "GZT 是由 J.Golden Zone Services Pvt. Ltd发行的社区积分凭证。目前仅由官方渠道发放,其不可分割,不支持交易。GZT不参与ICO、IEO及其他任何形式的融资。" }, "email": "<EMAIL>", "website": "https://www.jgz.com/", "state": "NORMAL", "published_on": "2020-3-27", "links": { "facebook": "https://www.facebook.com/JGoldenZone", "weibo": "https://weibo.com/jgzdata", } } ======================= File: erc20/0x3a26746Ddb79B1B8e4450e3F4FFE3285A307387E.json ======================= <reponame>641589523/token-profile {"symbol": "ETHB","address": "0x3a26746Ddb79B1B8e4450e3F4FFE3285A307387E","overview":{"en": ""},"email": "<EMAIL>","website": "http://etherbtc.io/","state": "NORMAL","links": {"blog": "http://etherbtc.io/news/","twitter": "https://twitter.com/EtherBTC_io","telegram": "","github": ""}} ======================= File: erc20/0x56Aa2f35Ad4Bf936a144D193b43FCc0F27b16F5B.json ======================= { "symbol": "SUNNY", "address": "0x56Aa2f35Ad4Bf936a144D193b43FCc0F27b16F5B", "overview": { "en": "A highly scalable decentralized algorithm protocol based on Ethereum." }, "whitepaper": "https://github.com/RevelationDAO/whitepaper/raw/master/Revelation%20Project%20White%20Paper(%20English).pdf", "website": "https://sunnyswap.space/#/home", "state": "NORMAL", "links": { "telegram": "https://t.me/joinchat/TdL6xhnj3J3a87ftBnYJjw", "github": "https://github.com/RevelationDAO", "reddit": "https://www.reddit.com/user/RevelationDAO/", "medium": "https://medium.com/@revelationdao" } } ======================= File: erc20/0xF69709C4c6F3F2b17978280dCe8b7b7a2CbcbA8b.json ======================= {"symbol": "ATD","address": "0xF69709C4c6F3F2b17978280dCe8b7b7a2CbcbA8b","overview":{"en": ""},"email": "","website": "https://www.atidium.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/AtidiumNetwork","telegram": "https://t.me/atidium","github": "https://github.com/atidium"}} ======================= File: erc20/0x47da42696A866CDC61A4C809A515500a242909C1.json ======================= <gh_stars>100-1000 {"symbol": "BIT","address": "0x47da42696A866CDC61A4C809A515500a242909C1","overview":{"en": ""},"email": "","website": "https://bitrewards.network/","state": "NORMAL","links": {"blog": "https://medium.com/@bitrewards","twitter": "https://twitter.com/bitrewards","telegram": "","github": ""}} ======================= File: erc20/0x0729377becBd653b9f14fBF2956cfD317bF2aFDd.json ======================= {"symbol": "LEXC","address": "0x0729377becBd653b9f14fBF2956cfD317bF2aFDd","overview":{"en": ""},"email": "<EMAIL>","website": "http://lex.powdercode.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/lexcoin_LEXC","telegram": "https://t.me/lexcoingroup","github": ""}} ======================= File: erc20/0xC4f6E93AEDdc11dc22268488465bAbcAF09399aC.json ======================= <filename>erc20/0xC4f6E93AEDdc11dc22268488465bAbcAF09399aC.json<gh_stars>100-1000 {"symbol": "HI","address": "0xC4f6E93AEDdc11dc22268488465bAbcAF09399aC","overview":{"en": ""},"email": "","website": "https://www.hi.com/","state": "NORMAL","links": {"blog": "https://resources.hi.com/","twitter": "https://twitter.com/hi_com_official","telegram": "","github": ""}} ======================= File: erc20/0x054C64741dBafDC19784505494029823D89c3b13.json ======================= {"symbol": "XET","address": "0x054C64741dBafDC19784505494029823D89c3b13","overview":{"en": ""},"email": "","website": "https://www.atom-solutions.jp/en/xetchange.php","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/AdminXet","telegram": "https://t.me/xetofficial","github": "https://github.com/atom-solutions"}} ======================= File: erc20/0x5a14fe6923e767A8238f29d3E1FB1a913975F0d7.json ======================= <reponame>641589523/token-profile {"symbol": "PWAY","address": "0x5a14fe6923e767A8238f29d3E1FB1a913975F0d7","overview":{"en": ""},"email": "","website": "https://www.pway.io","state": "NORMAL","links": {"blog": "https://bitmart-exchange.medium.com/pway-pway-the-first-blockchain-based-platform-for-acquiring-video-game-ideas-to-debut-at-c1a0298dad73","twitter": "","telegram": "","github": ""}} ======================= File: erc20/0xc2BdE1A2fA26890c8E6AcB10C91CC6D9c11F4a73.json ======================= <gh_stars>100-1000 {"symbol": "MASK20","address": "0xc2BdE1A2fA26890c8E6AcB10C91CC6D9c11F4a73","overview":{"en": ""},"email": "","website": "https://nft20.io/asset/0xc2bde1a2fa26890c8e6acb10c91cc6d9c11f4a73","state": "NORMAL","links": {"blog": "https://verynifty.medium.com/","twitter": "https://twitter.com/NiftyMuseum","telegram": "","github": ""}} ======================= File: erc20/0xf8C3527CC04340b208C854E985240c02F7B7793f.json ======================= {"symbol": "FRONT","address": "0xf8C3527CC04340b208C854E985240c02F7B7793f","overview":{"en": "Frontier is a chain-agnostic DeFi aggregation layer. To date, they have added support for DeFi on Ethereum, Binance Chain, BandChain, Kava, and Harmony. Via StaFi Protocol, they will enter into the Polkadot ecosystem, and will now put vigorous efforts towards Serum."},"email": "","website": "https://frontier.xyz","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/FrontierDotXYZ","telegram": "https://t.me/FrontierDotXYZ","github": "https://github.com/frontierwallet"}} ======================= File: erc20/0xCE7895C567Dcf7b950890dEA3360872524EECA41.json ======================= <reponame>641589523/token-profile { "symbol": "TRUMP", "address": "0xCE7895C567Dcf7b950890dEA3360872524EECA41", "overview": { "en": "TrumpSwap takes \"everyone should benefit from the development of the crypto economy\" as its core mission,mainly focuses on decentralized finance(DeFi) business, contributing in decentralized trading, funds, stocks, insurance, lending, etc. TrumpSwap creates the world’s first share mining mechanism. Every participant who shares TrumpSwap can get the dividends brought by the development of the project. In TrumpSwap, you don’t have to participate in mining or provide liquidity for TrumpSwap, share TrumpSwap to your friends, When your friends start mining and produce TRUMP, you can get rewarding TRUMP.", "zh": "TrumpSwap以“人人都应从加密经济的发展中受益”为己任,专注于去中心化金融(DeFi)业务,TrumpSwap在去中心化交易、基金、股票、保险、借贷等方向综合发力,不断推动DeFi经济的向前发展。TrumpSwap在全球首创共享挖矿机制,每个共享TrumpSwap的参与者都能获得项目发展带来的红利,在TrumpSwap里,您不需要参与挖矿,不需要为TrumpSwap提供流动性,您只需与您的朋友分享TrumpSwap,当您的朋友开始挖矿并产出后,您就可以获得TRUMP收益。" }, "email": "<EMAIL>", "website": "https://trumpswap.finance", "whitepaper": "https://medium.com/@trumpswap/trumpswap-you-share-you-mine-you-mine-you-earn-fc18b31bcee0", "state": "NORMAL", "published_on": "2020-09-21", "initial_price":{ "ETH":"0.00262 ETH", "USD":"1 USD", "BTC":"0.00009615 BTC" }, "links": { "twitter": "https://twitter.com/TRUMPSWAP__FI", "telegram": "https://t.me/TrumpSwap https://t.me/TrumpSwapcn", "github": "https://github.com/TrumpSwap", "medium": "https://medium.com/@trumpswap/trumpswap-you-share-you-mine-you-mine-you-earn-fc18b31bcee0" } } ======================= File: erc20/0xaB2282E27533749d7883E24F82dc8DFa2B3e3C85.json ======================= <gh_stars>100-1000 {"symbol": "XLMX","address": "0xaB2282E27533749d7883E24F82dc8DFa2B3e3C85","overview":{"en": "Stellar Classic offers its users high-speed transactions at near-zero fees, superb stability and security of the system, instant P2P money transfers thanks to the implementation of Lightning Network."},"email": "<EMAIL>","website": "http://stellarclassics.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/classicsstellar","telegram": "https://telegram.me/stellarclassics","github": "https://github.com/Stellarclassics"}} ======================= File: erc20/0xa96F31F1C187c28980176C3A27ba7069f48abDE4.json ======================= {"symbol": "ETGP","address": "0xa96F31F1C187c28980176C3A27ba7069f48abDE4","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.etgproject.org/","state": "NORMAL","links": {"blog": "https://medium.com/@amandaETG/the-revolution-of-ethereum-gold-etg-ce8b8316db09","twitter": "https://twitter.com/ethereumgoldetg","telegram": "https://t.me/joinchat/GzPNJhCuW5Lw862j_qJy3g","github": "https://github.com/EthereumGoldETG/ETGP"}} ======================= File: erc20/0x6FeBdFC0A9d9502C45343fCE0dF08828dEF44795.json ======================= <reponame>641589523/token-profile {"symbol": "BNBBEAR","address": "0x6FeBdFC0A9d9502C45343fCE0dF08828dEF44795","overview":{"en": ""},"email": "<EMAIL>","website": "https://ftx.com/tokens/BNBBEAR","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "https://t.me/FTX_Official","github": ""}} ======================= File: erc20/0x587E276Dc7F2C97d986E8AdF9b82D3F14D6cd8d2.json ======================= {"symbol": "FYS","address": "0x587E276Dc7F2C97d986E8AdF9b82D3F14D6cd8d2","overview":{"en": ""},"email": "<EMAIL>","website": "https://fysical.org/","state": "NORMAL","links": {"blog": "https://medium.com/fysicalblog","twitter": "https://twitter.com/FysicalProtocol","telegram": "https://t.me/fysical","github": "https://github.com/Fysical/Fysical"}} ======================= File: erc20/0x7AeE312E115493A510144348769681340E2BdfFf.json ======================= { "symbol": "ASAM", "address": "0x7AeE312E115493A510144348769681340E2BdfFf", "overview":{ "en": "The monetary protocol automatically adjusts the supply of ASAM across all user wallets based on price. This means the number of ASAM you own changes based on market conditions. When price is high wallet balances automatically increase. When price is low wallet balances automatically decrease. This supply adjustment operation happens once per day and is called a rebase.This daily rebase operation is applied universally and proportionally across every wallet’s balance. This means ASAM is non-dilutive. Like Bitcoin, if you own 1% of the overall network you will always own 1% unless you actively make a transfer.", "zh": "Asam是 A Stabilization agreement团队开发的基于以太ERC20和DeFi机制的稳定数字代币。其根据市场供需,将币价平衡于1USDT附近,当价格高于目标区域,合约通过增加代币供应,以使币价降低到目标区域;当价格低于目标区域,合约通过缩减代币供应,以使币价升高到目标区域。" }, "email": "<EMAIL>", "website": "http://asam.cc/", "whitepaper": "http://asam.cc/AsamWhitePaper.pdf", "state": "NORMAL", "published_on": "2020-8-18", "links": { "facebook": "https://www.facebook.com/ASam", "Telegram": "https://t.me/pcasam", "Twitter": "https://twitter.com/ASam" } } ======================= File: erc20/0xC52e23194476B1dD39408cB0B9D935dA8e6Db3d6.json ======================= {"symbol": "CLVA","address": "0xC52e23194476B1dD39408cB0B9D935dA8e6Db3d6","overview":{"en": "CLEVER is a DEFI (Decentralized Finance) Protocol that distributes AUTOMATIC INTEREST PAYMENTS to all CLVA Token Holders on a pre-programmed routine cycle schedule over 888 fortnightly cycles taking exactly 34.15 years to complete."},"email": "<EMAIL>","website": "https://clva.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/cleverdefi","telegram": "https://t.me/cleverdefi","github": ""}} ======================= File: erc20/0xA00425D3e2D3E9FF74F3e112B4D3A7978d7D88c2.json ======================= <reponame>641589523/token-profile<filename>erc20/0xA00425D3e2D3E9FF74F3e112B4D3A7978d7D88c2.json {"symbol": "GPT","address": "0xA00425D3e2D3E9FF74F3e112B4D3A7978d7D88c2","overview":{"en": ""},"email": "<EMAIL>","website": "https://tokengoplatform.com/","state": "NORMAL","links": {"blog": "https://medium.com/@EN_TokenGo","twitter": "https://twitter.com/Token_Go","telegram": "http://t.me/TokenGo_EN","github": "https://github.com/TokenGo"}} ======================= File: erc20/0xfE4455fd433Ed3CA025ec7c43cb8686eD89826CD.json ======================= <gh_stars>100-1000 {"symbol": "MZG","address": "0xfE4455fd433Ed3CA025ec7c43cb8686eD89826CD","overview":{"en": ""},"email": "<EMAIL>","website": "https://tokensale.moozicore.com/","state": "NORMAL","links": {"blog": "https://medium.com/@moozicore","twitter": "https://twitter.com/Moozicore","telegram": "https://t.me/moozicore","github": "https://github.com/Moozicore"}} ======================= File: erc20/0xd9af2d11d788da0097076f4Eb21bd1C5533743D9.json ======================= {"symbol": "LBK","address": "0xd9af2d11d788da0097076f4Eb21bd1C5533743D9","overview":{"en": ""},"email": "","website": "http://www.legal-block.com","state": "NORMAL","links": {"blog": "https://blog.naver.com/legalblock_official","twitter": "https://twitter.com/LEGALBLOCK_main","telegram": "","github": ""}} ======================= File: erc20/0xEEF9f339514298C6A857EfCfC1A762aF84438dEE.json ======================= {"symbol": "HEZ","address": "0xEEF9f339514298C6A857EfCfC1A762aF84438dEE","overview":{"en": ""},"email": "<EMAIL>","website": "https://hermez.io/","state": "NORMAL","links": {"blog": "https://blog.hermez.io/","twitter": "https://twitter.com/hermez_network","telegram": "https://t.me/hermeznetwork","github": "https://github.com/hermeznetwork"}} ======================= File: erc20/0xDD436a0Dce9244B36599AE7b22f0373b4e33992d.json ======================= <filename>erc20/0xDD436a0Dce9244B36599AE7b22f0373b4e33992d.json<gh_stars>100-1000 {"symbol": "TRUSD","address": "0xDD436a0Dce9244B36599AE7b22f0373b4e33992d","overview":{"en": "TrustUSD is a monetary protocol that achieves stability via supply and demand of the markets."},"email": "<EMAIL>","website": "https://unitedtrust.co/","state": "NORMAL","links": {"blog": "https://medium.com/@TrustUSD","twitter": "https://twitter.com/TrustUSD","telegram": "https://t.me/trustusd","github": "https://github.com/UnitedTrust"}} ======================= File: erc20/0x583dd607A64e8657DF325bDcC88A80CF518fC67f.json ======================= <reponame>641589523/token-profile { "symbol": "VCM", "address": "0x583dd607A64e8657DF325bDcC88A80CF518fC67f", "overview":{ "en": "The full name of VCM project is VolunChainMax, which is operated by the practitioner charity team to carry out all the projects. VCM mainly aims at creating a public service platform for sans frontieres physical therapy. By using the technical features of block chain, it issues VolunChainMax Token to make public and transparent the progress of public welfare, and combines the services of the platform itself. At present, the extension of the Internet to the traditional field makes the connection between the upstream and downstream links of the public welfare industry increasingly close, whose essence is the relationship between the supply and demand of relief and assistance and recipients. Public welfare charity is the lofty spiritual quality and moral pursuit of mankind. It is essentially the third distribution of social resources and wealth.", "zh": "VCM项目全称VolunChainMax,由实业家公益团队承接所有项目运营,VCM主要为打造无国界理疗公益服务平台,通过运用区块链的技术特性,发行VolunChainMax Token,公开透明公益进度,并平台本身服务相结合。目前互联网向传统领域的拓展延伸,使公益行业上下游环节的关联日趋紧密,其实质是救助帮扶与受助者间的供给与需求关系。公益慈善是人类崇高的 精神品质和道德追求,本质上是社会资源和财富的第三次分配,事关社会公众的 福祉和利益,是传播人道主义和社会责任的重要载体。" }, "email": "<EMAIL>", "website": "http://www.etokenpro.com/", "whitepaper": "http://20359508.s21d-20.faiusrd.com/0/ABUIABA9GAAgjon08gUoyL7gjgU?f=%E5%85%AC%E7%9B%8A%E9%93%BE%E7%99%BD%E7%9A%AE%E4%B9%A6.pdf&v=1583154318", "state": "NORMAL", "published_on": "2020-03-02", "initial_price":{ "ETH":"0.00001 ETH", "USD":"0.00143 USD", "BTC":"0.0000002 BTC" }, "links": { "twitter": "https://twitter.com/guyuehi/status/1205209215230455808", "facebook": "https://www.facebook.com/permalink.php?story_fbid=1014982602193517&id=100010453604932" } } ======================= File: erc20/0x2e6539edc3b76f1E21B71d214527FAbA875F70F3.json ======================= { "symbol": "YFDOT", "address": "0x2e6539edc3b76f1E21B71d214527FAbA875F70F3", "overview": { "en": "Yearn Finance Dot platform is powerful enough from a scalability, interoperability, developability and governance perspective to help make the vision of Web3 a reality that aims to get more value for an investment.", "zh": "从可伸缩性,互操作性,可开发性和治理的角度来看,Yearn Finance Dot平台具有足够强大的功能,可以帮助实现Web3的愿景,旨在为投资带来更多价值。" }, "email": "<EMAIL>", "website": "https://yfdot.finance/", "state": "NORMAL", "published_on": "2020-09-22", "initial_price": { "USD": "$50.00 USD" }, "links": { "twitter": "https://twitter.com/Yfdotfinance", "github": "https://github.com/YFDOT", "medium": "https://medium.com/@YFdotFinance", "telegram": "https://t.me/YFDOT_Finance" } } ======================= File: erc20/0x809FAaF63eE61B9133102b4Fbe560219b534b6e4.json ======================= {"symbol": "PPC","address": "0x809FAaF63eE61B9133102b4Fbe560219b534b6e4","overview":{"en": ""},"email": "<EMAIL>","website": "https://purplethrone.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/purplethronecor","telegram": "https://t.me/purplecoin","github": ""}} ======================= File: erc20/0xCAEaf8381D4B20b43AFA42061D6f80319A8881F6.json ======================= {"symbol": "R34P","address": "0xCAEaf8381D4B20b43AFA42061D6f80319A8881F6","overview":{"en": "R34P (R3AP) a soft fork, constructed as a secondary layer on Reflect Finance (RFI) which benefits holders with a low-cost 1% fee on every transaction in the blockchain."},"email": "","website": "https://r34p.finance/","state": "NORMAL","links": {"blog": "https://vtachy.medium.com/introduction-to-r34p-9683b2ad6445","twitter": "https://twitter.com/R34PTOKEN","telegram": "https://t.me/R34Ptoken","github": ""}} ======================= File: erc20/0xBac7A1798350cdf2Dbfe0c210C2C9861223f4B31.json ======================= <reponame>641589523/token-profile {"symbol": "MNC","address": "0xBac7A1798350cdf2Dbfe0c210C2C9861223f4B31","overview":{"en": ""},"email": "<EMAIL>","website": "https://moneynet.io/","state": "NORMAL","links": {"blog": "https://medium.com/@moneynet","twitter": "https://twitter.com/gotmoneynet","telegram": "https://t.me/mncio_official","github": "https://github.com/gotmoneynet"}} ======================= File: erc20/0x5c250ff9b993C6991cC4A3cC543716e53b478018.json ======================= {"symbol": "STP","address": "0x5c250ff9b993C6991cC4A3cC543716e53b478018","overview":{"en": ""},"email": "<EMAIL>","website": "https://stpay.org/","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "https://t.me/stpaychannel","github": ""}} ======================= File: erc20/0xB020eD54651831878E5C967e0953A900786178f9.json ======================= {"symbol": "BAZT","address": "0xB020eD54651831878E5C967e0953A900786178f9","overview":{"en": "Baztoken is an ERC-20 Token which aims to revolutionize the E-Gaming, Sports betting, and E-commerce industry."},"email": "<EMAIL>","website": "https://baztoken.io/","state": "NORMAL","links": {"blog": "https://medium.com/@Baztoken","twitter": "https://twitter.com/Baztoken","telegram": "https://t.me/bazookians","github": "https://github.com/Bazteam"}} ======================= File: erc20/0x515669d308f887Fd83a471C7764F5d084886D34D.json ======================= {"symbol": "MUXE","address": "0x515669d308f887Fd83a471C7764F5d084886D34D","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.muxe.io/","state": "NORMAL","links": {"blog": "https://www.muxe.io/blog/","twitter": "https://www.twitter.com/muxeprojecthttps://www.twitter.com/muxeproject","telegram": "https://t.me/muxebv","github": "https://gist.github.com/muxeproject/fe941d13e75af7bb99217da11955eb6f"}} ======================= File: erc20/0x574F84108a98c575794F75483d801d1d5DC861a5.json ======================= {"symbol": "ROX","address": "0x574F84108a98c575794F75483d801d1d5DC861a5","overview":{"en": ""},"email": "","website": "https://robotinarox.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/robotinarox_io","telegram": "https://t.me/Robotinaico","github": ""}} ======================= File: erc20/0x6020Da0F7c1857dBE4431Ec92A15cC318D933eAa.json ======================= {"symbol": "ETM","address": "0x6020Da0F7c1857dBE4431Ec92A15cC318D933eAa","overview":{"en": ""},"email": "","website": "http://www.entanmo.io","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/entanmo1","telegram": "https://t.me/entanmo","github": "https://github.com/entanmo/etm"}} ======================= File: erc20/0xE48972fCd82a274411c01834e2f031D4377Fa2c0.json ======================= {"symbol": "2KEY","address": "0xE48972fCd82a274411c01834e2f031D4377Fa2c0","overview":{"en": ""},"email": "<EMAIL>","website": "https://2key.network/","state": "NORMAL","links": {"blog": "https://medium.com/2key","twitter": "https://twitter.com/2keyNetwork","telegram": "https://t.me/twokey_official","github": "https://github.com/2key"}} ======================= File: erc20/0x1c79ab32C66aCAa1e9E81952B8AAa581B43e54E7.json ======================= <filename>erc20/0x1c79ab32C66aCAa1e9E81952B8AAa581B43e54E7.json<gh_stars>100-1000 {"symbol": "TEAM","address": "0x1c79ab32C66aCAa1e9E81952B8AAa581B43e54E7","overview":{"en": ""},"email": "<EMAIL>","website": "https://tokenstars.com/team/","state": "NORMAL","links": {"blog": "https://medium.com/@tokenstars","twitter": "https://twitter.com/TokenStars","telegram": "https://t.me/TokenStars_en","github": "https://github.com/tokenstars/team-token"}} ======================= File: erc20/0x471dAEE6E481b2ab7d2f2f64B8F9B083daAe29da.json ======================= {"symbol": "HOPS","address": "0x471dAEE6E481b2ab7d2f2f64B8F9B083daAe29da","overview":{"en": ""},"email": "<EMAIL>","website": "https://lordless.io/","state": "NORMAL","links": {"blog": "https://medium.com/@lordlessio","twitter": "https://twitter.com/lordlessio","telegram": "https://t.me/lordless_global","github": "https://github.com/lordlessio"}} ======================= File: erc20/0x0C37Bcf456bC661C14D596683325623076D7e283.json ======================= <reponame>641589523/token-profile {"symbol": "ARNX","address": "0x0C37Bcf456bC661C14D596683325623076D7e283","overview":{"en": ""},"email": "<EMAIL>","website": "https://aeron.aero/","state": "NORMAL","links": {"blog": "https://medium.com/@aeronaero","twitter": "https://twitter.com/aeron_aero","telegram": "https://t.me/aeronaero","github": "https://github.com/aeronaero/aeron"}} ======================= File: erc20/0xFc979087305A826c2B2a0056cFAbA50aad3E6439.json ======================= <gh_stars>100-1000 {"symbol": "DAFI","address": "0xFc979087305A826c2B2a0056cFAbA50aad3E6439","overview":{"en": ""},"email": "","website": "https://www.dafiprotocol.io/","state": "NORMAL","links": {"blog": "https://dafiprotocol.medium.com/","twitter": "","telegram": "","github": ""}} ======================= File: erc20/0xC53d46Fd66edeB5d6F36e53BA22eee4647e2Cdb2.json ======================= { "symbol": "ZKTR", "address": "0xC53d46Fd66edeB5d6F36e53BA22eee4647e2Cdb2", "overview": { "en": "ZKTube is a project built and developed on Layer2 using PLONK protocol based on ZK rollup technology. It can improve scalability by converting batch transfers into a single transaction. Its essence is to compress the user state on the chain and store it in a Merkle tree and transfer the user state change to the chain, while ensuring the correctness of the user state change process under the chain through a zero-knowledge proof mechanism. The cost of directly processing user state changes on the chain is relatively high, but only using the smart contract on the chain to verify the correctness of a zero-knowledge proof PROOF is relatively low. In addition, the required remittance information is transmitted to the contract along with the certificate, which is convenient for users to verify accounts." }, "email": "<EMAIL>", "website": "https://zktube.io/", "whitepaper": "https://zktube.medium.com/zktube1-0-whitepaper-8d942cbd30a3", "state": "NORMAL", "links": { "blog": "https://discord.gg/ZhcSuxhX4S/", "twitter": "https://twitter.com/zktubeofficial", "telegram": "https://t.me/zkTubeGlobal", "github": "https://github.com/zktube", "facebook": "https://www.facebook.com/zkTube.official", "medium": "https://zktube.medium.com/" } } ======================= File: erc20/0xd2057d71fE3F5b0dc1E3e7722940E1908Fc72078.json ======================= <gh_stars>100-1000 {"symbol": "$KING","address": "0xd2057d71fE3F5b0dc1E3e7722940E1908Fc72078","overview":{"en": "Kingswap is a fork of the Uniswap protocol, with improvements and features. After its liquidity pool migration, Kingswap will add Layer 2 and Layer 3 implementations that are technological developments."},"email": "","website": "https://www.kingswap.io/","state": "NORMAL","links": {"blog": "https://medium.com/@defi_kingswap/the-king-swap-project-b689c0f5ccff","twitter": "https://twitter.com/defi_kingswap","telegram": "https://t.me/kingswap","github": "https://github.com/KingLuigy/KingSwap_V1"}} ======================= File: erc20/0xCC4304A31d09258b0029eA7FE63d032f52e44EFe.json ======================= {"symbol": "SWAP","address": "0xCC4304A31d09258b0029eA7FE63d032f52e44EFe","overview":{"en": "TrustSwap is a new platform designed to help people exchange money securely and reliably."},"email": "","website": "https://trustswap.org/","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "https://t.me/TrustSwap","github": ""}} ======================= File: erc20/0xff56Cc6b1E6dEd347aA0B7676C85AB0B3D08B0FA.json ======================= <gh_stars>100-1000 {"symbol": "ORBS","address": "0xff56Cc6b1E6dEd347aA0B7676C85AB0B3D08B0FA","overview":{"en": ""},"email": "","website": "https://www.orbs.com/","state": "NORMAL","links": {"blog": "https://www.orbs.com/blog/","twitter": "https://twitter.com/orbs_network","telegram": "","github": ""}} ======================= File: erc20/0x16ECCfDbb4eE1A85A33f3A9B21175Cd7Ae753dB4.json ======================= {"symbol": "ROUTE","address": "0x16ECCfDbb4eE1A85A33f3A9B21175Cd7Ae753dB4","overview":{"en": "Router Protocol is a crosschain-liquidity aggregator platform that was built to seamlessly provide bridging infrastructure between current and emerging Layer 1 and Layer 2 blockchain solutions."},"email": "<EMAIL>","website": "https://www.routerprotocol.com/","state": "NORMAL","links": {"blog": "https://routerprotocol.medium.com/","twitter": "https://twitter.com/routerprotocol","telegram": "https://t.me/routerprotocol","github": "https://github.com/router-protocol"}} ======================= File: erc20/0x9bd4f0B2c73B5E2bef9F1aB0841E5C460Cf8CEdC.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "GCM","address": "0x9bd4f0B2c73B5E2bef9F1aB0841E5C460Cf8CEdC","overview":{"en": ""},"email": "","website": "http://gcmbest.top/?i=1","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "","github": ""}} ======================= File: erc20/0x02b1669bC9EE893edAFf3cADfD326A294d643f99.json ======================= <gh_stars>100-1000 {"symbol": "WLF","address": "0x02b1669bC9EE893edAFf3cADfD326A294d643f99","overview":{"en": ""},"email": "","website": "https://wolfs.group/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/GroupWolfs","telegram": "https://t.me/wolfsgroup","github": ""}} ======================= File: erc20/0x94939D55000B31B7808904a80aA7Bab05eF59Ed6.json ======================= {"symbol": "JIAOZI","address": "0x94939D55000B31B7808904a80aA7Bab05eF59Ed6","overview":{"en": "JIAOZI claimed to be forked from YUNO and KIMCHI and have removed the mint function that was added by YUNO. It is yield farming project that gives governance token - JIAOZI as reward."},"email": "","website": "https://jiaozi.farm/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/JiaoziFarm","telegram": "https://t.me/JiaoziFarm","github": "https://github.com/JiaoziFarm/"}} ======================= File: erc20/0xdF6D916F89936d67543998E03dB40d79870bE41E.json ======================= <gh_stars>100-1000 {"symbol": "C50","address": "0xdF6D916F89936d67543998E03dB40d79870bE41E","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.c50index.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/c50index","telegram": "https://t.me/C50index","github": "https://github.com/C50Index"}} ======================= File: erc20/0x9813037ee2218799597d83D4a5B6F3b6778218d9.json ======================= { "symbol": "BONE", "address": "0x9813037ee2218799597d83D4a5B6F3b6778218d9", "overview":{ "en": "Only available on ShibaSwap, BONE has 250,000,000 tokens, and is designed to fit perfectly between the previous two Ecosystem tokens (SHIB and LEASH) in regards to circulation supply. Moreover, the token is a Governance token which will allow the #ShibArmy to vote on upcoming proposals.", "zh": "BONE 仅在 ShibaSwap 上可用,拥有 250,000,000 个代币,其设计在流通供应方面完美地介于前两个生态系统代币(SHIB 和 LEASH)之间。此外,该代币是一种治理代币,它将允许 #ShibArmy 对即将到来的提案进行投票。" }, "email": "<EMAIL>", "website": "https://www.shibatoken.com", "whitepaper": " ", "state": "NORMAL", "links": { "blog": "https://allhailtheshiba.medium.com", "twitter": "https://twitter.com/shibtoken", "telegram": "https://t.me/bonedogekiller", "github": " ", "facebook": " ", "reddit": "https://www.reddit.com/r/SHIBArmy", "slack": " ", "medium": "https://allhailtheshiba.medium.com" } } ======================= File: erc20/0xDf49C9f599A0A9049D97CFF34D0C30E468987389.json ======================= {"symbol": "SATT","address": "0xDf49C9f599A0A9049D97CFF34D0C30E468987389","overview":{"en": ""},"email": "","website": "http://www.satt-token.com/","state": "NORMAL","links": {"blog": "https://bitcointalk.org/index.php?topic=3407522.0","twitter": "https://twitter.com/SaTT_Token","telegram": "","github": ""}} ======================= File: erc20/0x88FCFBc22C6d3dBaa25aF478C578978339BDe77a.json ======================= {"symbol": "KAT","address": "0x88FCFBc22C6d3dBaa25aF478C578978339BDe77a","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.katalyse.io/","state": "NORMAL","links": {"blog": "https://medium.com/@Katalyse","twitter": "https://twitter.com/katalyse_io","telegram": "https://telegram.me/fundyourselfnow","github": "https://github.com/PinnacleOne/FYNTokens"}} ======================= File: erc20/0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72.json ======================= <reponame>641589523/token-profile { "symbol": "ENS", "address": "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", "overview":{ "en": "The Ethereum Name Service (ENS) is a distributed, open, and extensible naming system based on the Ethereum blockchain", "zh": "以太坊名称服务(ENS)是一个基于以太坊区块链的分布式、开放和可扩展的命名系统" }, "email": "<EMAIL>", "website": "https://ens.domains/", "state": "NORMAL", "links": { "twitter": "https://twitter.com/ensdomains", "github": "https://github.com/ensdomains", "medium": "https://medium.com/the-ethereum-name-service" } } ======================= File: erc20/0x6C8aAd3100e3fa45AAC799c0c302400900b60302.json ======================= {"symbol": "YFIC","address": "0x6C8aAd3100e3fa45AAC799c0c302400900b60302","overview":{"en": "YFI CREDITS is an open-source decentralized protocol which enables users to participate in dual staking, farming, governance vote, lending and borrowing in one dashboard."},"email": "<EMAIL>","website": "https://yficredits.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/CreditsYfi","telegram": "https://t.me/YFICREDITNEWS","github": ""}} ======================= File: erc20/0x653430560bE843C4a3D143d0110e896c2Ab8ac0D.json ======================= <gh_stars>100-1000 {"symbol": "MOF","address": "0x653430560bE843C4a3D143d0110e896c2Ab8ac0D","overview":{"en": ""},"email": "<EMAIL>","website": "http://www.molecular.cc/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/molecular_cc","telegram": "https://t.me/joinchat/Hix2Ow7xE6jnK4WTpOie-w","github": ""}} ======================= File: erc20/0x9Ea1Ae46C15a4164B74463Bc26f8aA3b0EeA2e6E.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "DANK","address": "0x9Ea1Ae46C15a4164B74463Bc26f8aA3b0EeA2e6E","overview":{"en": ""},"email": "","website": "https://memeunity.com/","state": "NORMAL","links": {"blog": "https://medium.com/@memeunity","twitter": "https://twitter.com/thememeunity","telegram": "","github": ""}} ======================= File: erc20/0x00a8b738E453fFd858a7edf03bcCfe20412f0Eb0.json ======================= <gh_stars>100-1000 {"symbol": "ALBT","address": "0x00a8b738E453fFd858a7edf03bcCfe20412f0Eb0","overview":{"en": ""},"email": "","website": "https://allianceblock.io/","state": "NORMAL","links": {"blog": "https://medium.com/@allianceblock","twitter": "https://twitter.com/allianceblock","telegram": "","github": ""}} ======================= File: erc20/0x9dD04fC27eDAF636F1a07D2Ada8770c42d2f52Ff.json ======================= {"symbol": "DMND","address": "0x9dD04fC27eDAF636F1a07D2Ada8770c42d2f52Ff","overview":{"en": ""},"email": "<EMAIL>","website": "http://dmndcoin.xyz/","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "","github": ""}} ======================= File: erc20/0x2775F2A3C83bee1541D1d1BC308b3BB432B45151.json ======================= <reponame>641589523/token-profile {"symbol": "PLANETAGRO.ORG","address": "0x2775F2A3C83bee1541D1d1BC308b3BB432B45151","overview":{"en": "This token and platform main feature are to enable agroproducts trading while still in transit."},"email": "<EMAIL>","website": "http://www.planetagro.org/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/PlanetagroMX","telegram": "","github": ""}} ======================= File: erc20/0xE689a257e070b13a08104AEb995c95FEe1d87673.json ======================= <filename>erc20/0xE689a257e070b13a08104AEb995c95FEe1d87673.json {"symbol": "DART","address": "0xE689a257e070b13a08104AEb995c95FEe1d87673","overview":{"en": ""},"email": "<EMAIL>","website": "http://darextravel.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/DarexTravelPro","telegram": "https://t.me/darextravelofficial","github": "https://github.com/DarexTravel"}} ======================= File: erc20/0xF03f8D65BaFA598611C3495124093c56e8F638f0.json ======================= <reponame>641589523/token-profile {"symbol": "VIEW","address": "0xF03f8D65BaFA598611C3495124093c56e8F638f0","overview":{"en": ""},"email": "<EMAIL>","website": "https://view.ly/","state": "NORMAL","links": {"blog": "https://blog.view.ly/","twitter": "","telegram": "https://t.me/viewly","github": "https://github.com/Viewly/"}} ======================= File: erc20/0xb41f09a973a85c7F497c10B00a939dE667B55a78.json ======================= {"symbol": "KNOW","address": "0xb41f09a973a85c7F497c10B00a939dE667B55a78","overview":{"en": ""},"email": "<EMAIL>","website": "https://kryptono.exchange","state": "NORMAL","links": {"blog": "https://medium.com/@kryptono","twitter": "https://twitter.com/KryptonoEx","telegram": "https://t.me/kryptono","github": "https://github.com/Kryptono/SmartContract"}} ======================= File: erc20/0x580c8520dEDA0a441522AEAe0f9F7A5f29629aFa.json ======================= {"symbol": "DAWN","address": "0x580c8520dEDA0a441522AEAe0f9F7A5f29629aFa","overview":{"en": "Dawn is a utility token to reward competitive gaming and help players to build their professional Esports careers."},"email": "<EMAIL>","website": "https://dawn.org/","state": "NORMAL","links": {"blog": "https://dawn.org/blog","twitter": "https://twitter.com/DawnProtocol","telegram": "https://t.me/dawnprotocol","github": "https://github.com/Dawn-Protocol"}} ======================= File: erc20/0x2C537E5624e4af88A7ae4060C022609376C8D0EB.json ======================= {"symbol": "TRYb","address": "0x2C537E5624e4af88A7ae4060C022609376C8D0EB","overview":{"en": "BiLira is a stablecoin backed 1:1 by the Turkish Lira."},"email": "<EMAIL>","website": "https://www.bilira.co/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/BiLira_Official","telegram": "https://t.me/bilira_official","github": ""}} ======================= File: erc20/0x28dee01D53FED0Edf5f6E310BF8Ef9311513Ae40.json ======================= <filename>erc20/0x28dee01D53FED0Edf5f6E310BF8Ef9311513Ae40.json<gh_stars>100-1000 {"symbol": "XBP","address": "0x28dee01D53FED0Edf5f6E310BF8Ef9311513Ae40","overview":{"en": ""},"email": "","website": "https://www.blitzpredict.io/","state": "NORMAL","links": {"blog": "https://medium.com/@BlitzPredict1","twitter": "https://twitter.com/@blitzpredict","telegram": "https://t.me/BlitzPredict","github": "https://github.com/blitzpredict"}} ======================= File: erc20/0x4442556a08a841227bEf04C67A7Ba7acf01b6Fc8.json ======================= {"symbol": "MT","address": "0x4442556a08a841227bEf04C67A7Ba7acf01b6Fc8","overview":{"en": "Monarch offers mobile and desktop apps, a decentralized wallet, a decentralized ERC20 exchange, a BTC/ETH fiat gateway, a portfolio tracker, and universal KYC integration."},"email": "","website": "https://monarchwallet.com/","state": "NORMAL","links": {"blog": "https://monarchwallet.com/blog/","twitter": "https://twitter.com/monarchtoken","telegram": "https://t.me/monarchtoken","github": ""}} ======================= File: erc20/0xC8D2AB2a6FdEbC25432E54941cb85b55b9f152dB.json ======================= <gh_stars>100-1000 { "symbol": "GRAP", "address": "0xC8D2AB2a6FdEbC25432E54941cb85b55b9f152dB", "overview": { "en": "Grap is a fork of the YAM project. But it came with correct ‘rebase’ and it fixed some obvious bugs. So it will be less trouble and more fun.", "zh": "Grap 是YAM 项目的Fork 版本,旨在修复它的rebase 问题,让YAM 1.0 本可发生的愿景得以再现。" }, "email": "<EMAIL>", "website": "https://grap.finance/", "whitepaper": "https://grap.finance/", "state": "NORMAL", "published_on": "2020-08-20", "initial_price":{ "USD":"1 USD", }, "links": { "blog": "https://medium.com/@grap.finance", "twitter": "https://twitter.com/GrapFinance", "telegram": "https://t.me/GrapFinance", "github": "https://github.com/grapfinance/grap-protocol", "medium": "https://medium.com/@grap.finance" } } ======================= File: erc20/0x4f76E85d067e219779A863ff18577846b3152F1F.json ======================= {"symbol": "KUBO","address": "0x4f76E85d067e219779A863ff18577846b3152F1F","overview":{"en": ""},"email": "<EMAIL>","website": "https://kubocoin.org/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/KuboCoin","telegram": "https://t.me/Kubo_coin","github": ""}} ======================= File: erc20/0x2baac9330Cf9aC479D819195794d79AD0c7616e3.json ======================= {"symbol": "ADB","address": "0x2baac9330Cf9aC479D819195794d79AD0c7616e3","overview":{"en": ""},"email": "<EMAIL>","website": "https://adbank.network/","state": "NORMAL","links": {"blog": "https://medium.com/adbank-blog/","twitter": "https://twitter.com/adbanknetwork","telegram": "https://t.me/adbanknetwork","github": ""}} ======================= File: erc20/0x793786e2dd4Cc492ed366a94B88a3Ff9ba5E7546.json ======================= <reponame>641589523/token-profile<filename>erc20/0x793786e2dd4Cc492ed366a94B88a3Ff9ba5E7546.json {"symbol": "axiaprotocol.ioAXIAv3","address": "0x793786e2dd4Cc492ed366a94B88a3Ff9ba5E7546","overview":{"en": "Axia Protocol is a decentralized crypto index fund platform which presents cryptocurrency enthusiasts or investors with the opportunity to invest in baskets of cryptocurrencies and also rewards them for making such investments."},"email": "<EMAIL>","website": "https://axiaprotocol.io/","state": "NORMAL","links": {"blog": "https://medium.com/@protocolaxia","twitter": "https://twitter.com/axiaprotocol","telegram": "https://t.me/axiaprotocol","github": ""}} ======================= File: erc20/0xcA2796F9F61dc7b238Aab043971e49c6164DF375.json ======================= <gh_stars>100-1000 {"symbol": "YEED","address": "0xcA2796F9F61dc7b238Aab043971e49c6164DF375","overview":{"en": ""},"email": "<EMAIL>","website": "https://yggdrash.io/","state": "NORMAL","links": {"blog": "https://medium.com/@yggdrash","twitter": "https://twitter.com/YggdrashNews","telegram": "https://t.me/yggdrash","github": "https://github.com/yggdrash/"}} ======================= File: erc20/0x30f271C9E86D2B7d00a6376Cd96A1cFBD5F0b9b3.json ======================= <filename>erc20/0x30f271C9E86D2B7d00a6376Cd96A1cFBD5F0b9b3.json<gh_stars>100-1000 {"symbol": "DEC","address": "0x30f271C9E86D2B7d00a6376Cd96A1cFBD5F0b9b3","overview":{"en": ""},"email": "","website": "https://decentr.net/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/DecentrNet","telegram": "","github": ""}} ======================= File: erc20/0xaD2aa3C57570AD9811bA8Ee90316f9C73F78035A.json ======================= <gh_stars>100-1000 {"symbol": "CLN","address": "0xaD2aa3C57570AD9811bA8Ee90316f9C73F78035A","overview":{"en": "CasinoLand aims to develop a Casino platform that is the most popular and friendly to everyone. With Blockchain technology, CasinoLand aims to be transparent, decentralized, and secure."},"email": "<EMAIL>","website": "https://casinoland.network/","state": "NORMAL","links": {"blog": "https://medium.com/@casinoland.network","twitter": "https://twitter.com/casinoland_net","telegram": "https://t.me/casinoland_channel","github": "https://github.com/casinolandnetwork/chinesedicegame"}} ======================= File: erc20/0xD82BB924a1707950903e2C0a619824024e254cD1.json ======================= <gh_stars>100-1000 {"symbol": "DAOfi","address": "0xD82BB924a1707950903e2C0a619824024e254cD1","overview":{"en": ""},"email": "","website": "https://daofi.org","state": "NORMAL","links": {"blog": "https://medium.com/@daofi","twitter": "https://twitter.com/DAOfifinance","telegram": "https://t.me/daofi","github": ""}} ======================= File: erc20/0xA858bC1b71a895Ee83B92F149616F9B3F6Afa0FB.json ======================= <filename>erc20/0xA858bC1b71a895Ee83B92F149616F9B3F6Afa0FB.json<gh_stars>100-1000 {"symbol": "KAT","address": "0xA858bC1b71a895Ee83B92F149616F9B3F6Afa0FB","overview":{"en": ""},"email": "<EMAIL>","website": "https://kambria.io/","state": "NORMAL","links": {"blog": "https://medium.com/kambria-network","twitter": "https://twitter.com/KambriaNetwork","telegram": "https://t.me/kambriaofficial","github": "https://github.com/kambria-platform"}} ======================= File: erc20/0x5d8cE06A40fB101895bE5b6560931b92a1b3444F.json ======================= <reponame>641589523/token-profile {"symbol": "TAGZ","address": "0x5d8cE06A40fB101895bE5b6560931b92a1b3444F","overview":{"en": ""},"email": "<EMAIL>","website": "https://tagz.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/tagzexchange","telegram": "https://t.me/tagzexchange","github": ""}} ======================= File: erc20/0xc07A150ECAdF2cc352f5586396e344A6b17625EB.json ======================= {"symbol": "BIOT","address": "0xc07A150ECAdF2cc352f5586396e344A6b17625EB","overview":{"en": "BioPassport is committed to help make healthcare a personal component of our daily lives. This starts with a 'health passport' platform that houses a patient's DPHR, or decentralized personal health record built around DID (decentralized identity) technology."},"email": "<EMAIL>","website": "https://biopassport.io/","state": "NORMAL","links": {"blog": "https://biopassportofficial.medium.com/","twitter": "https://twitter.com/Biopassport1","telegram": "https://t.me/biopassportofficial","github": "https://github.com/biopassport/contract"}} ======================= File: erc20/0x14Da7b27b2E0FedEfe0a664118b0c9bc68e2E9AF.json ======================= <filename>erc20/0x14Da7b27b2E0FedEfe0a664118b0c9bc68e2E9AF.json {"symbol": "BCUG","address": "0x14Da7b27b2E0FedEfe0a664118b0c9bc68e2E9AF","overview":{"en": "Blockchain Cuties Universe is a collectible NFT game that's based around adorable little pets called Cuties that explore the world of Cutieland and fight each other in adventures."},"email": "<EMAIL>","website": "https://www.blockchaincuties.finance/","state": "NORMAL","links": {"blog": "https://medium.com/blockchain-cuties","twitter": "https://twitter.com/BlockchainCutie","telegram": "https://t.me/bcugfinance","github": ""}} ======================= File: erc20/0xc4De189Abf94c57f396bD4c52ab13b954FebEfD8.json ======================= <filename>erc20/0xc4De189Abf94c57f396bD4c52ab13b954FebEfD8.json {"symbol": "B20","address": "0xc4De189Abf94c57f396bD4c52ab13b954FebEfD8","overview":{"en": ""},"email": "","website": "https://b20.whalestreet.xyz/","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "","github": ""}} ======================= File: erc20/0xE7Cb24F449973D5B3520E5b93D88B405903c75Fb.json ======================= {"symbol": "BNBTC","address": "0xE7Cb24F449973D5B3520E5b93D88B405903c75Fb","overview":{"en": ""},"email": "","website": "https://bnbitcoin.org","state": "NORMAL","links": {"blog": "https://medium.com/@BNbitcoin","twitter": "https://twitter.com/BNBTC_on_BSC","telegram": "","github": ""}} ======================= File: erc20/0x1A3496C18d558bd9C6C8f609E1B129f67AB08163.json ======================= {"symbol": "DEP","address": "0x1A3496C18d558bd9C6C8f609E1B129f67AB08163","overview":{"en": ""},"email": "<EMAIL>","website": "https://dea.sg/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/PlayMining_SG","telegram": "https://t.me/DEAPcoin_group","github": "https://github.com/Digita-Entertainment-Asset/DEP"}} ======================= File: erc20/0xfe7B915A0bAA0E79f85c5553266513F7C1c03Ed0.json ======================= <filename>erc20/0xfe7B915A0bAA0E79f85c5553266513F7C1c03Ed0.json {"symbol": "THUG","address": "0xfe7B915A0bAA0E79f85c5553266513F7C1c03Ed0","overview":{"en": ""},"email": "<EMAIL>","website": "https://thugcoin.cash/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/THUGCOIN","telegram": "https://t.me/THUGCOIN","github": "https://github.com/THUGCOIN/THUGCoin"}} ======================= File: erc20/0x83869DE76B9Ad8125e22b857f519F001588c0f62.json ======================= {"symbol": "EXM","address": "0x83869DE76B9Ad8125e22b857f519F001588c0f62","overview":{"en": ""},"email": "<EMAIL>","website": "https://exmo.com/","state": "NORMAL","links": {"blog": "https://medium.com/exmo-official","twitter": "https://twitter.com/Exmo_com","telegram": "https://t.me/Exmo_com","github": ""}} ======================= File: erc20/0x55F93985431Fc9304077687a35A1BA103dC1e081.json ======================= {"symbol": "SMT","address": "0x55F93985431Fc9304077687a35A1BA103dC1e081","overview":{"en": ""},"email": "","website": "https://smartmesh.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/smart_mesh","telegram": "","github": ""}} ======================= File: erc20/0x6368e1E18c4C419DDFC608A0BEd1ccb87b9250fc.json ======================= <gh_stars>100-1000 {"symbol": "XTP","address": "0x6368e1E18c4C419DDFC608A0BEd1ccb87b9250fc","overview":{"en": ""},"email": "","website": "https://www.tap.global/","state": "NORMAL","links": {"blog": "https://medium.com/@tapngo.social","twitter": "https://twitter.com/tapofficial1","telegram": "https://t.me/officialtapngo","github": ""}} ======================= File: erc20/0x799d214d7143B766cDd4979cd0280939288ba931.json ======================= {"symbol": "CHT","address": "0x799d214d7143B766cDd4979cd0280939288ba931","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.countinghousefund.com/","state": "NORMAL","links": {"blog": "https://www.countinghousefund.com/insights-blog","twitter": "https://twitter.com/CountinghouseFd","telegram": "https://t.me/Countinghouse","github": ""}} ======================= File: erc20/0x72430A612Adc007c50e3b6946dBb1Bb0fd3101D1.json ======================= <reponame>641589523/token-profile {"symbol": "TIC","address": "0x72430A612Adc007c50e3b6946dBb1Bb0fd3101D1","overview":{"en": ""},"email": "<EMAIL>","website": "https://thingschain.network/","state": "NORMAL","links": {"blog": "https://medium.com/@thingschain","twitter": "https://twitter.com/Things_chain","telegram": "https://t.me/thingschain_group","github": "https://github.com/TICnetwork"}} ======================= File: erc20/0xe0b9BcD54bF8A730EA5d3f1fFCe0885E911a502c.json ======================= {"symbol": "ZUM","address": "0xe0b9BcD54bF8A730EA5d3f1fFCe0885E911a502c","overview":{"en": ""},"email": "","website": "https://zum-token.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Zum_Token","telegram": "https://t.me/ZumToken","github": "https://github.com/TournamentGameToken/ZUM"}} ======================= File: erc20/0xD9A12Cde03a86E800496469858De8581D3A5353d.json ======================= {"symbol": "YUP","address": "0xD9A12Cde03a86E800496469858De8581D3A5353d","overview":{"en": ""},"email": "<EMAIL>","website": "crowdholding.com","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/crowdholding","telegram": "https://t.me/Crowdholding","github": ""}} ======================= File: erc20/0xA1BA7186eeC1Be5114b0Cf49b95B23aDC4131B51.json ======================= {"symbol": "TECH","address": "0xA1BA7186eeC1Be5114b0Cf49b95B23aDC4131B51","overview":{"en": ""},"email": "<EMAIL>","website": "http://futuretechinsider.com/about/","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "","github": "https://github.com/ftinetwork/ftin"}} ======================= File: erc20/0xF7461C8D8E469e9c41a9013dC09Ba8AbED66ef65.json ======================= <filename>erc20/0xF7461C8D8E469e9c41a9013dC09Ba8AbED66ef65.json {"symbol": "CTAT","address": "0xF7461C8D8E469e9c41a9013dC09Ba8AbED66ef65","overview":{"en": "Cryptassist will simplify the way crypto is used. With one login on either your web or mobile device, you are able to access everything."},"email": "<EMAIL>","website": "https://www.cryptassist.io","state": "NORMAL","links": {"blog": "https://medium.com/@cryptassisttoken","twitter": "https://twitter.com/cryptassistcoin","telegram": "","github": ""}} ======================= File: erc20/0x9720b467a710382A232a32F540bDCed7d662a10B.json ======================= {"symbol": "VZT","address": "0x9720b467a710382A232a32F540bDCed7d662a10B","overview":{"en": ""},"email": "<EMAIL>","website": "https://vezt.co/","state": "NORMAL","links": {"blog": "https://medium.com/@vezt","twitter": "https://twitter.com/veztinc","telegram": "https://t.me/joinchat/F_38d0NlVp_oQfB0S5u1Fg","github": ""}} ======================= File: erc20/0xd9555279B1c18b7aa388F053EBc0ab22e2497964.json ======================= {"symbol": "RTN","address": "0xd9555279B1c18b7aa388F053EBc0ab22e2497964","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.reactioon.com/","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "","github": ""}} ======================= File: erc20/0x5a23b7E3bb936C7753B5e7A6C304a8FB43979d20.json ======================= <filename>erc20/0x5a23b7E3bb936C7753B5e7A6C304a8FB43979d20.json { "symbol": "Gra", "address": "0x5a23b7E3bb936C7753B5e7A6C304a8FB43979d20", "overview":{ "en": "Graswap is a decentralized digital asset exchange based on ETH, HECO and other well-known public chain underlying technologies. Graswap new upgrade, integration of DeFi, decentralized mechanism, but also the use of the latest chain price limit single matchmaking mechanism to provide users with more secure and credible, more diversified asset selection and allocation, higher expected return on investment decentralized token exchange service!", "zh": "Graswap是基于以太坊、HECO等知名公链底层技术的去中心化数字资产交易所。Graswap全新升级,融合DeFi、去中心化机制,还采用最新链上限价单撮合交易机制为用户提供更加安全可信、资产选择及配置更多样化,预期投资回报率更高的去中心化代币兑换服务!" }, "email": "<EMAIL>", "website": "https://www.grampusex.com/#/", "whitepaper": "https://www.grampusex.com/GrampusEx.pdf", "state": "NORMAL", "published_on": "2021-01-13", "links": { "reddit": "https://www.reddit.com/user/GrampusEx", "telegram": "https://0.plus/joinchat/LAB_1YYkRyljYjk1", "github": "https://github.com/grampusex", "facebook": "https://www.facebook.com/grampus.ex", "linkedin": "https://www.linkedin.com/in/%E9%B2%B8-%E8%99%8E-b66306205/", "medium": "https://grampusex.medium.com/" } } ======================= File: erc20/0x1C1C14A6B5074905Ce5d367B0A7E098b58EbFD47.json ======================= <reponame>641589523/token-profile {"symbol": "FEX","address": "0x1C1C14A6B5074905Ce5d367B0A7E098b58EbFD47","overview":{"en": ""},"email": "<EMAIL>","website": "https://ico.fidex.market","state": "NORMAL","links": {"blog": "https://medium.com/@fidexexchange","twitter": "https://twitter.com/fidexexchange","telegram": "https://t.me/FidexGlobal","github": "https://github.com/fidexexchange/smartcontract"}} ======================= File: erc20/0x3D3aB800D105fBd2F97102675A412Da3dC934357.json ======================= { "symbol": "MSV", "address": "0x3D3aB800D105fBd2F97102675A412Da3dC934357", "overview":{ "en": "MSV (Marvrodi Salute Vison) is issued using the POM (Proof of Mutual) mutual proof mechanism, a total of 21 million, MSV not only inherits the concept of mutual assistance from Marvrodi, but also uses blockchain technology to shape a new decentralized financial inclusion ecology. The application scope of MSV includes DeFi credit mining under POM consensus, knotted credit proof and payment pass of MSV mutual ecological community.", "zh": "MSV(Marvrodi Salute Vison)是采用POM(Proof of Mutual)互助证明机制发行,总量2100万枚。MSV不仅继承了来自Marvrodi的互助理念,还采用区块链技术塑造全新的去中心化普惠金融生态。通过结绳契约,MSV创造出了全新的去中心化匿名环境下的信任审核机制,通过更少的抵押物扩大DeFi的授信能力,构建了以MID为体系节点的全新的社区治理形式。MSV的应用范围包括POM共识下的DeFi信用挖矿,结绳信用证明以及MSV互助生态社区的支付通证" }, "email": "<EMAIL>", "website": "http://3msv.io/", "whitepaper": "http://3msv.io/WhitePaper.pdf", "state": "NORMAL", "published_on": "2020-07-29", "initial_price":{ "USD":"1 USD" }, "links": { "telegram": "https://t.me/MarvrodiSaluteVison" } } ======================= File: erc20/0x6295Ab2BE04A617747481B292c390BfcA592Cf28.json ======================= <gh_stars>100-1000 {"symbol": "TDS","address": "0x6295Ab2BE04A617747481B292c390BfcA592Cf28","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.tokendesk.io/","state": "NORMAL","links": {"blog": "https://medium.com/@Tokendesk","twitter": "https://twitter.com/tokendesk","telegram": "","github": ""}} ======================= File: erc20/0x623Bf68EEc610DD0Dd471b76b7C0CbD97ed637C1.json ======================= <filename>erc20/0x623Bf68EEc610DD0Dd471b76b7C0CbD97ed637C1.json { "symbol": "COG", "address": "0x623Bf68EEc610DD0Dd471b76b7C0CbD97ed637C1", "overview":{ "en": "COG, or Cube_ORANGE, is the name of the orange cubes in LeCube. COG has a total supply of 1,000,000. COG tokens are mined through cooperation and competition, while its output efficiency is reduced once every half year. COG tokens can be composed and are locked after the composition process.", "zh": "COG的全称是Cube_ORANGE,是LeCube项目中的橙块,共计100万个。COG从LeCube竞合挖矿中产出(每半年减产),可以用于拼搭,并在拼搭后锁定。" }, "email": "<EMAIL>", "website": "https://www.mixmarvel.com/product?game=LeCube", "whitepaper": "https://www.lecube.co/res/LeCube%20Light%20Paper%20Ver.%201.0.pdf", "state": "NORMAL", "published_on": "2021-06-07", "initial_price":{ "ETH":"0 ETH", "USD":"0 USD", "BTC":"0 BTC" }, "links": { "blog": "", "twitter": "https://twitter.com/MIXMARVELGAME", "telegram": "https://t.me/MixMarvelGlobal", "github": "", "facebook": "", "reddit": "", "slack": "", "medium": "https://mixmarvelgame.medium.com/" } } ======================= File: erc20/0xba8E5a4c64c1Be42230910F7B39A6388F3d4297c.json ======================= <filename>erc20/0xba8E5a4c64c1Be42230910F7B39A6388F3d4297c.json {"symbol": "GIVE","address": "0xba8E5a4c64c1Be42230910F7B39A6388F3d4297c","overview":{"en": ""},"email": "","website": "http://giveglobal.co","state": "NORMAL","links": {"blog": "https://giveglobal.medium.com","twitter": "https://twitter.com/_GIVEGLOBAL","telegram": "","github": ""}} ======================= File: erc20/0xa3Efef1a1e3d1AD72b9D0f4253e7c9c084C2c08B.json ======================= <gh_stars>100-1000 {"symbol": "OIO","address": "0xa3Efef1a1e3d1AD72b9D0f4253e7c9c084C2c08B","overview":{"en": ""},"email": "","website": "https://online.io/","state": "NORMAL","links": {"blog": "https://medium.com/online-io-blockchain-technologies","twitter": "https://twitter.com/Online_OIO","telegram": "https://t.me/OnlineIO","github": "https://github.com/Online-io"}} ======================= File: erc20/0xAf80e6612D9C2E883122e7F2292Ee6C34176ad4F.json ======================= {"symbol": "JAN","address": "0xAf80e6612D9C2E883122e7F2292Ee6C34176ad4F","overview":{"en": "CoinJanitor is cleaning crypto and recycling lost value by buying failed projects and dead coins."},"email": "<EMAIL>","website": "https://coinjanitor.io/","state": "NORMAL","links": {"blog": "https://medium.com/@CoinJanitor","twitter": "https://twitter.com/CoinJanitor","telegram": "https://t.me/CoinJanitor","github": ""}} ======================= File: erc20/0xFd3305E1c7cB5D269fb6CeD8eB8240255a50E7a4.json ======================= {"symbol": "CloudbitToken","address": "0xFd3305E1c7cB5D269fb6CeD8eB8240255a50E7a4","overview":{"en": ""},"email": "<EMAIL>","website": "https://cloudbitex.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Cloudbit_Token","telegram": "https://t.me/cloudbit_token_official","github": ""}} ======================= File: erc20/0xb736bA66aAd83ADb2322D1f199Bfa32B3962f13C.json ======================= {"symbol": "BRDG","address": "0xb736bA66aAd83ADb2322D1f199Bfa32B3962f13C","overview":{"en": ""},"email": "<EMAIL>","website": "http://www.bridgeprotocol.io/","state": "NORMAL","links": {"blog": "https://medium.com/@bridgeprotocol","twitter": "https://twitter.com/bridgeprotocol","telegram": "https://t.me/BridgeProtocol","github": "https://github.com/bridge-protocol"}} ======================= File: erc20/0x11218d13C92cFAC1fDa041EcA844215662A7D96d.json ======================= { "symbol": "BSGT", "address": "0x11218d13C92cFAC1fDa041EcA844215662A7D96d", "overview":{ "en": "The origin of SINGULARITY is a distributed storage application public chain based on distributed storage technology. SINGULARITY is committed to providing a point-to-point distributed data management system for global users, linking all idle storage resources, allowing all network storage devices to participate in mining, forming a powerful distributed data storage network service system, and reconstructing the data storage network structure. Joint internal and external ecological development to build a super cloud computing platform.", "zh": "SINGULARITY 奇点起源是基于分布式存储技术开发的分布式存储应用公链。SINGULARITY致力于面向全球用户提供点对点的分布式数据管理系统,链接一切闲置存储资源,让所有网络存储设备都可以参与挖矿,形成强大的分布式数据存储网络服务系统,重构数据存储网络结构,联合内外部生态发展,共建超级云计算平台。" }, "email": "<EMAIL>", "website": "http://www.bsgt.top/", "whitepaper": "http://www.bsgt.top/white-paper/en.pdf", "state": "NORMAL", "published_on": "2020-08-17", "links": { "telegram": "https://t.me/singularityto", "twitter": "https://twitter.com/Cynthia08325859" } } ======================= File: erc20/0xEE8Bd1502c3e9F6c543781467c01592ac51CFbb8.json ======================= <reponame>641589523/token-profile {"symbol": "TBAR","address": "0xEE8Bd1502c3e9F6c543781467c01592ac51CFbb8","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.tbis.io/","state": "NORMAL","links": {"blog": "https://medium.com/tbis","twitter": "","telegram": "https://t.me/tbisinc","github": ""}} ======================= File: erc20/0xbcC7026CdE024c6a97d2DF6e40613217d946279C.json ======================= {"symbol": "ALA","address": "0xbcC7026CdE024c6a97d2DF6e40613217d946279C","overview":{"en": ""},"email": "<EMAIL>","website": "https://alatoken.org/","state": "NORMAL","links": {"blog": "https://medium.com/@AlaToken","twitter": "https://twitter.com/AlaToken0","telegram": "https://t.me/Alaofficialgroup","github": ""}} ======================= File: erc20/0xBFd78659212F00dE65A6411DAdC75878930725Ec.json ======================= <gh_stars>100-1000 {"symbol": "AMAL","address": "0xBFd78659212F00dE65A6411DAdC75878930725Ec","overview":{"en": "AMAL allows a reduction of commissions which can be obstacles in leverage transactions."},"email": "<EMAIL>","website": "https://amanpuri.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/AMANPURIEX","telegram": "https://t.me/amanpurichat","github": ""}} ======================= File: erc20/0xC92276872CD1907d2e00B58A81a9bbd275B0a4ba.json ======================= {"symbol": "COLLG","address": "0xC92276872CD1907d2e00B58A81a9bbd275B0a4ba","overview":{"en": ""},"email": "","website": "https://collateralpay.com/","state": "NORMAL","links": {"blog": "https://collateraldefi.medium.com/","twitter": "https://twitter.com/collateraldefi","telegram": "","github": ""}} ======================= File: erc20/0xB14eBF566511B9e6002bB286016AB2497B9b9c9D.json ======================= {"symbol": "HID","address": "0xB14eBF566511B9e6002bB286016AB2497B9b9c9D","overview":{"en": ""},"email": "","website": "https://hypersign.id/","state": "NORMAL","links": {"blog": "https://medium.com/hypersign","twitter": "https://twitter.com/hypersignchain","telegram": "","github": ""}} ======================= File: eos-token/[email protected] ======================= <filename>eos-token/[email protected] { "symbol": "FIL", "account_name": "ipfsoneissue", "overview": { "zh": "IPFS One (FIL) 是全球领先的分布式存储网络的运营商;是分布式储存矿业市场的先行者;是IPFS网络的卓越贡献者。在IPFS主网正式上线前,IPFS One 开创性的针对检索挖矿开发了基于EOS网络的去中心化智能存储合约,采用节点质押挖矿的模式,产出FIL测试币用于测试网流通,上线后映射由IPFS自有矿机开采出的Filecoin代币,实现不用挖也能得币的参与模式。" }, "website": "http://www.ipfsone.io", "published_on": "2020-03-05", "initial_price": { "USD": "0.036 USD" }, "email": "<EMAIL>" } ======================= File: erc20/0x499A6B77bc25C26bCf8265E2102B1B3dd1617024.json ======================= {"symbol": "BTR","address": "0x499A6B77bc25C26bCf8265E2102B1B3dd1617024","overview":{"en": ""},"email": "<EMAIL>","website": "https://bitether.org/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/socialbitether","telegram": "https://t.me/bitether","github": "https://github.com/bitetherbtr/Bitether"}} ======================= File: erc20/0xb9EF770B6A5e12E45983C5D80545258aA38F3B78.json ======================= <gh_stars>100-1000 {"symbol": "ZCN","address": "0xb9EF770B6A5e12E45983C5D80545258aA38F3B78","overview":{"en": ""},"email": "<EMAIL>","website": "https://0chain.net/","state": "NORMAL","links": {"blog": "https://medium.com/0chain","twitter": "https://twitter.com/0costcloud","telegram": "https://t.me/Ochain","github": ""}} ======================= File: erc20/0x22ACaEe85dDB83a3A33B7f0928a0e2c3bFDb6a4F.json ======================= <filename>erc20/0x22ACaEe85dDB83a3A33B7f0928a0e2c3bFDb6a4F.json {"symbol": "PRXY","address": "0x22ACaEe85dDB83a3A33B7f0928a0e2c3bFDb6a4F","overview":{"en": ""},"email": "","website": "https://btcpx.io/","state": "NORMAL","links": {"blog": "https://medium.com/btc-proxy","twitter": "https://twitter.com/BTC_proxy","telegram": "","github": ""}} ======================= File: erc20/0xc91B523A59ACC63A64f61fc7bBfB4bfc82DD25f2.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 { "symbol": "AI", "address": "0xc91B523A59ACC63A64f61fc7bBfB4bfc82DD25f2", "overview":{ "en": "Artificial intelligence and machine learning (A.I./ML) will soon become the most important technological force in society. This ecosystem is currently monopolized by only a few tech giants and elite institutions. The technological and inequality gaps are rapidly growing. Its high time for change. In the Multiverse, we believe that powerful technology must involve people of all stripes. Many people have great ideas on how A.I. could help their communities, but they are limited by lack of coding skills or capital. That’s why we built the Multiverse, which enables people to start projects without needing to write code or raise large amounts of capital. You can finally have a say in the types of A.I. applications you want, build the future together with visionary founders from all walks of life, be a part of the A.I. revolution today by easily staking on new A.I. projects. The playing field is finally level. Have the first mover advantage. Enter our Multiverse and stake on your chosen projects today.", "zh": "" }, "email": "<EMAIL>", "website": "https://multiverse.ai/", "whitepaper": "https://multiverse.ai/whitepaper", "state": "NORMAL", "published_on": "2021-06-02", "initial_price":{ "USD":"0.01 USD" }, "links": { "twitter": "https://twitter.com/multiverse_labs", "telegram": "https://t.me/multiverselabs", "github": "https://github.com/multiverseai/ERC20", "reddit": "https://www.reddit.com/r/Multiverselabs/", "linkedin": "https://www.linkedin.com/company/multiverseai?originalSubdomain=sg" } } ======================= File: erc20/0x15B543e986b8c34074DFc9901136d9355a537e7E.json ======================= <filename>erc20/0x15B543e986b8c34074DFc9901136d9355a537e7E.json {"symbol": "STC","address": "0x15B543e986b8c34074DFc9901136d9355a537e7E","overview":{"en": ""},"email": "","website": "https://www.studentcoin.org/","state": "NORMAL","links": {"blog": "https://t.me/alkstudentcoin","twitter": "https://twitter.com/studentcoinorg","telegram": "","github": ""}} ======================= File: erc20/0xef6344de1fcfC5F48c30234C16c1389e8CdC572C.json ======================= <reponame>641589523/token-profile<filename>erc20/0xef6344de1fcfC5F48c30234C16c1389e8CdC572C.json {"symbol": "DNA","address": "0xef6344de1fcfC5F48c30234C16c1389e8CdC572C","overview":{"en": ""},"email": "","website": "https://www.encrypgen.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/encrypgen","telegram": "","github": ""}} ======================= File: erc20/0x4B3a0c6d668B43F3f07904E124328659b90Bb4Ca.json ======================= <gh_stars>100-1000 {"symbol": "AceD","address": "0x4B3a0c6d668B43F3f07904E124328659b90Bb4Ca","overview":{"en": ""},"email": "","website": "https://www.acedcoin.com/","state": "NORMAL","links": {"blog": "https://medium.com/@acedcoin","twitter": "https://twitter.com/AcedCoin","telegram": "https://t.me/AceD_Coin","github": "https://github.com/Acedcoin/AceD"}} ======================= File: erc20/0x419B8ED155180A8c9C64145e76DaD49c0A4Efb97.json ======================= {"symbol": "ALT","address": "0x419B8ED155180A8c9C64145e76DaD49c0A4Efb97","overview":{"en": ""},"email": "<EMAIL>","website": "https://alt.estate/","state": "NORMAL","links": {"blog": "https://medium.com/@alt.estate","twitter": "https://twitter.com/alt_estate","telegram": "https://t.me/AltEstate","github": "https://github.com/AltEstate/altestate"}} ======================= File: erc20/0x186Af393bF9cEef31CE7EaE2b468C46231163cC7.json ======================= {"symbol": "YlFi","address": "0x186Af393bF9cEef31CE7EaE2b468C46231163cC7","overview":{"en": "Yearn Loans Finance is a platform for loans, staking, liquidity farming, vault, and vote. Borrowers get money without selling cryptoassets while lenders offer loans and earn competitive returns."},"email": "<EMAIL>","website": "https://yloans.finance/","state": "NORMAL","links": {"blog": "https://yearnloansfinance.medium.com/","twitter": "https://twitter.com/Yearn_Loans_Fin","telegram": "https://t.me/Yearn_Loans_Finance_YlFi_Chat","github": "https://github.com/YlFi"}} ======================= File: erc20/0x7Ef5ac1FE8B6832EbAddEE1856E4A21E46843565.json ======================= <gh_stars>100-1000 { "symbol": "DOI", "address": "0x7Ef5ac1FE8B6832EbAddEE1856E4A21E46843565", "overview":{ "en": "Daoswap is a global community, started by develpers and domain experts from Dubai, US, Canda and other regions joining, started from 2020. Working togather the community focus on the Automatic Market Maker (AMM) algorithm, trying to optimize both from tech and Defi Mode." }, "email": "<EMAIL>", "website": "https://www.daoswap.global", "whitepaper": "https://www.daoswap.global/whitepaper.pdf", "state": "NORMAL", "published_on": "2020-11-03", "links": { "twitter": "https://twitter.com/SwapDao", "telegram": "https://t.me/daoswap", "github": "https://github.com/daoswap-tech" } } ======================= File: erc20/0xC650f5514AE1A3a27930922145ce49E8A91b91AB.json ======================= <filename>erc20/0xC650f5514AE1A3a27930922145ce49E8A91b91AB.json {"symbol": "VNTY","address": "0xC650f5514AE1A3a27930922145ce49E8A91b91AB","overview":{"en": ""},"email": "<EMAIL>","website": "https://venoty.com/","state": "NORMAL","links": {"blog": "https://medium.com/@venoty","twitter": "https://twitter.com/venotycurrency","telegram": "https://t.me/venotycurrency","github": "https://github.com/venoty"}} ======================= File: erc20/0xd379700999F4805Ce80aa32DB46A94dF64561108.json ======================= <gh_stars>100-1000 {"symbol": "DETS","address": "0xd379700999F4805Ce80aa32DB46A94dF64561108","overview":{"en": "A community driven decentralised exchange platform build for trading ERC-20 tokens."},"email": "","website": "https://dextrust.org/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Dextrust1","telegram": "https://t.me/DextrustCommunity","github": "https://github.com/dextrust1"}} ======================= File: erc20/0x4534492034a2cd3EAb34C8F357cD139c95b09F52.json ======================= <filename>erc20/0x4534492034a2cd3EAb34C8F357cD139c95b09F52.json<gh_stars>100-1000 {"symbol": "MLGC","address": "0x4534492034a2cd3EAb34C8F357cD139c95b09F52","overview":{"en": ""},"email": "","website": "https://mlgc.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/marshal_lion","telegram": "","github": ""}} ======================= File: erc20/0x5432C580E34f590f4dd901B825DDeb92e905e826.json ======================= {"symbol": "TXH","address": "0x5432C580E34f590f4dd901B825DDeb92e905e826","overview":{"en": "TradeX Token is a peer-to-peer crypto token."},"email": "<EMAIL>","website": "https://www.tradextoken.com/","state": "NORMAL","links": {"blog": "https://medium.com/@tradextoken","twitter": "https://twitter.com/tradex_token","telegram": "https://t.me/tradextokenupdates","github": ""}} ======================= File: erc20/0x2934443c1749dCC0cDcabbD77098EEa31D2ea6c3.json ======================= {"symbol": "XSNXA","address": "0x2934443c1749dCC0cDcabbD77098EEa31D2ea6c3","overview":{"en": ""},"email": "","website": "https://xtoken.market/invest/","state": "NORMAL","links": {"blog": "https://medium.com/xtoken","twitter": "https://twitter.com/xtokenmarket","telegram": "","github": ""}} ======================= File: erc20/0x07Cc1d447619B46E198e15F3cB4DF7b47B340230.json ======================= <reponame>641589523/token-profile {"symbol": "NSF","address": "0x07Cc1d447619B46E198e15F3cB4DF7b47B340230","overview":{"en": ""},"email": "<EMAIL>","website": "http://nestfame.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/NestFame","telegram": "https://t.me/Nestfame","github": "https://github.com/nestfameplatfrom"}} ======================= File: erc20/0x2ecB13A8c458c379c4d9a7259e202De03c8F3D19.json ======================= {"symbol": "BC","address": "0x2ecB13A8c458c379c4d9a7259e202De03c8F3D19","overview":{"en": ""},"email": "<EMAIL>","website": "https://block-chain.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Block_Chain_com","telegram": "https://t.me/block_chaincom","github": ""}} ======================= File: erc20/0x4c383bDCae52a6e1cb810C76C70d6f31A249eC9B.json ======================= {"symbol": "RGS","address": "0x4c383bDCae52a6e1cb810C76C70d6f31A249eC9B","overview":{"en": ""},"email": "","website": "https://rusgas.io/en/","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "","github": ""}} ======================= File: erc20/0x4be40bc9681D0A7C24A99b4c92F85B9053Fc2A45.json ======================= <reponame>641589523/token-profile {"symbol": "YFIII","address": "0x4be40bc9681D0A7C24A99b4c92F85B9053Fc2A45","overview":{"en": "A fork of Yearn.finance YFI with YIP 8 implemented."},"email": "<EMAIL>","website": "https://dify.finance/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/dify_finance","telegram": "https://t.me/difyfinance","github": "https://github.com/difyfinance"}} ======================= File: erc20/0x077DC3c0c9543df1cdD78386DF3204E69E0DD274.json ======================= {"symbol": "PBK","address": "0x077DC3c0c9543df1cdD78386DF3204E69E0DD274","overview":{"en": ""},"email": "<EMAIL>","website": "http://powerbankcoin.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/CoinPowerbank","telegram": "https://t.me/powerbankofficial","github": "https://github.com/powerbankofficial/powerbank-PBK-ERC20"}} ======================= File: erc20/0xbCdfE338D55c061C084D81fD793Ded00A27F226D.json ======================= {"symbol": "DML","address": "0xbCdfE338D55c061C084D81fD793Ded00A27F226D","overview":{"en": ""},"email": "","website": "https://decentralizedml.com/","state": "NORMAL","links": {"blog": "https://medium.com/@decentralizedml","twitter": "https://twitter.com/DecentralizedML","telegram": "https://t.me/DecentralizedML","github": "https://github.com/DecentralizedML"}} ======================= File: erc20/0x32353A6C91143bfd6C7d363B546e62a9A2489A20.json ======================= { "symbol": "AGLD", "address": "0x32353A6C91143bfd6C7d363B546e62a9A2489A20", "overview":{ "en": "Adventure Gold (AGLD) is the governance token of Loot Project community. And all Loot holders can get an airdrop of AGLD tokens.Loot Project is a collection of 8,000 unique bags of adventurer gear(NFT). Each loot bag contains 8 items for an adventurer.", "zh": "Adventure Gold(AGLD)是 Loot Project 社区的治理代币,所有 Loot 持有者都能获得 AGLD 代币空投。Loot 是允许任何人铸造代表一组8个冒险家主题装备物品的 NFT 项目。" }, "email": " ", "website": "https://www.lootproject.com/", "whitepaper": "", "state": "NORMAL", "published_on": "2021-09-03", "links": { "twitter": "https://twitter.com/lootproject" } } ======================= File: erc20/0xb056c38f6b7Dc4064367403E26424CD2c60655e1.json ======================= {"symbol": "CEEK","address": "0xb056c38f6b7Dc4064367403E26424CD2c60655e1","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.ceek.io/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/ceek","telegram": "https://t.me/ceekvrtokensale","github": ""}} ======================= File: erc20/0xc67B12049c2D0CF6e476BC64c7F82fc6C63cFFc5.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "GDT","address": "0xc67B12049c2D0CF6e476BC64c7F82fc6C63cFFc5","overview":{"en": ""},"email": "","website": "https://globedx.com/en/","state": "NORMAL","links": {"blog": "https://medium.com/globe-official","twitter": "https://twitter.com/globedx","telegram": "","github": ""}} ======================= File: erc20/0x71fbC1d795FcfBcA43A3ebF6de0101952f31a410.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "ADAO","address": "0x71fbC1d795FcfBcA43A3ebF6de0101952f31a410","overview":{"en": "The Revelation Agreement is committed to creating a decentralized financial complex (economy) and establishing a multi-level financial system."},"email": "<EMAIL>","website": "http://revelationdao.org/","state": "NORMAL","links": {"blog": "https://medium.com/@revelationdao","twitter": "https://twitter.com/Revelat03875442","telegram": "https://t.me/joinchat/TdL6xhnj3J3a87ftBnYJjw","github": "https://github.com/RevelationDAO"}} ======================= File: erc20/0x4730fB1463A6F1F44AEB45F6c5c422427f37F4D0.json ======================= {"symbol": "FOUR","address": "0x4730fB1463A6F1F44AEB45F6c5c422427f37F4D0","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.the4thpillar.io/","state": "NORMAL","links": {"blog": "https://medium.com/the4thpillar","twitter": "https://twitter.com/the4thpillarltd","telegram": "https://t.me/the4thpillarofficial","github": "https://github.com/The4thPillarOfficial"}} ======================= File: erc20/0xC98a910eDE52E7d5308525845F19e17470DbCCF7.json ======================= <reponame>641589523/token-profile<filename>erc20/0xC98a910eDE52E7d5308525845F19e17470DbCCF7.json {"symbol": "WILC","address": "0xC98a910eDE52E7d5308525845F19e17470DbCCF7","overview":{"en": ""},"email": "","website": "https://wilc.finance/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/W_ILC_","telegram": "","github": ""}} ======================= File: erc20/0x9002D4485b7594e3E850F0a206713B305113f69e.json ======================= <filename>erc20/0x9002D4485b7594e3E850F0a206713B305113f69e.json {"symbol": "HAT","address": "0x9002D4485b7594e3E850F0a206713B305113f69e","overview":{"en": ""},"email": "<EMAIL>","website": "https://hat.exchange/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/HAT_Exchange","telegram": "https://t.me/hat_public","github": ""}} ======================= File: erc20/0x74b1Af114274335598da72f5C6ed7b954a016EeD.json ======================= {"symbol": "HIT","address": "0x74b1Af114274335598da72f5C6ed7b954a016EeD","overview":{"en": ""},"email": "","website": "https://hitbtc.com/hit","state": "NORMAL","links": {"blog": "https://blog.hitbtc.com/hitbtc-launches-its-native-utility-token-hit/","twitter": "https://twitter.com/hitbtc","telegram": "","github": ""}} ======================= File: erc20/0x6753795d67eD0b2b65B57FC45C7Ac0F53b55f4FE.json ======================= <reponame>641589523/token-profile {"symbol": "REST","address": "0x6753795d67eD0b2b65B57FC45C7Ac0F53b55f4FE","overview":{"en": ""},"email": "","website": "https://www.restoretoken.net/","state": "NORMAL","links": {"blog": "https://medium.com/@restoretoken","twitter": "https://twitter.com/RestoreToken","telegram": "","github": ""}} ======================= File: erc20/0xa5e262EC733051B14B38901901A82F2684637E78.json ======================= <reponame>641589523/token-profile<filename>erc20/0xa5e262EC733051B14B38901901A82F2684637E78.json {"symbol": "MCH","address": "0xa5e262EC733051B14B38901901A82F2684637E78","overview":{"en": "MeconCash offers a blockchain-based new paradigm for mobile app game service and P2P trade of cryptocurrency."},"email": "<EMAIL>","website": "http://www.meconcash.com/","state": "NORMAL","links": {"blog": "","twitter": "https://www.facebook.com/MeconCash","telegram": "https://t.me/meconcashchannel","github": "https://github.com/mecon-coin/mecon-coin-erc20"}} ======================= File: erc20/0xF921ae2DAC5fa128DC0F6168Bf153ea0943d2D43.json ======================= <gh_stars>100-1000 {"symbol": "FIRE","address": "0xF921ae2DAC5fa128DC0F6168Bf153ea0943d2D43","overview":{"en": ""},"email": "","website": "https://fireprotocol.io/","state": "NORMAL","links": {"blog": "https://medium.com/fireprotocol","twitter": "https://twitter.com/FireProtocolOS","telegram": "","github": ""}} ======================= File: erc20/0x697beac28B09E122C4332D163985e8a73121b97F.json ======================= <reponame>641589523/token-profile {"symbol": "QRL","address": "0x697beac28B09E122C4332D163985e8a73121b97F","overview":{"en": ""},"email": "<EMAIL>","website": "https://theqrl.org/","state": "NORMAL","links": {"blog": "https://medium.com/quantum-resistant-ledger","twitter": "https://twitter.com/qrledger","telegram": "","github": "https://github.com/theQRL"}} ======================= File: erc20/0x44b6e3e85561ce054aB13Affa0773358D795D36D.json ======================= {"symbol": "ARTE","address": "0x44b6e3e85561ce054aB13Affa0773358D795D36D","overview":{"en": "ethArt token contract has migrated to 0x34612903Db071e888a4dADcaA416d3EE263a87b9."},"email": "","website": "https://www.ethart.org/","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "","github": ""}} ======================= File: erc20/0x0Eb152d2bba8aF722D7E296A1F223d819C3bbB1f.json ======================= <reponame>641589523/token-profile {"symbol": "CEC","address": "0x0Eb152d2bba8aF722D7E296A1F223d819C3bbB1f","overview":{"en": "CEC is an environmental protection projection project using the block chain technology to optimize the price of carbon trading and to expand the price of the trees and the other tradable products."},"email": "<EMAIL>","website": "https://www.carboncoin.one/","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "https://t.me/ceccn","github": ""}} ======================= File: erc20/0x81dBc1c8e40C3095071949Eda9800C2209a7279A.json ======================= {"symbol": "PUP","address": "0x81dBc1c8e40C3095071949Eda9800C2209a7279A","overview":{"en": ""},"email": "","website": "https://www.pupper.info/","state": "NORMAL","links": {"blog": "https://pupper-token.medium.com/","twitter": "https://twitter.com/Pupper_Token","telegram": "","github": ""}} ======================= File: erc20/0x8ab98C28295Ea3BD2DB6aC8b3CA57A625C054BD1.json ======================= <gh_stars>100-1000 { "symbol": "SFR", "address": "0x8ab98C28295Ea3BD2DB6aC8b3CA57A625C054BD1", "overview":{ "en": "Sunflower Swap is a NFT decentralized platform developed based on the ETH standard. At the same time, it uses the DeFi protocol to pledge to obtain encrypted assets Sunflower (SFR) through AMM and SLP (providing liquidity proof) that provides liquid mining, and then exchanges with SFR NFT provided on the platform. " }, "email": "<EMAIL>", "website": "http://sunflowerswap.finance/", "whitepaper": "https://help.sfrswap.com/", "state": "NORMAL", "published_on": "2020-11-01", "links": { "twitter": "https://twitter.com/sunflower_swap", "github": "https://github.com/sunflowerswap", "medium": "https://medium.com/@sunflowerswap" } } ======================= File: erc20/0xb1ED41dc1Fe9b723a31137aFdd1201D17917FE91.json ======================= {"symbol": "ALTX","address": "0xb1ED41dc1Fe9b723a31137aFdd1201D17917FE91","overview":{"en": ""},"email": "<EMAIL>","website": "https://alttex.io/","state": "NORMAL","links": {"blog": "https://alttex.io/blog","twitter": "https://twitter.com/alttex_io","telegram": "https://t.me/AlttexEn","github": "https://github.com/alttex?tab=repositories"}} ======================= File: erc20/0x46f4E420C75401494a39B70653F4bbb88aD2d728.json ======================= {"symbol": "WENB","address": "0x46f4E420C75401494a39B70653F4bbb88aD2d728","overview":{"en": ""},"email": "","website": "https://wenburn.com","state": "NORMAL","links": {"blog": "https://t.me/wenburn","twitter": "https://twitter.com/wwenmoon","telegram": "","github": ""}} ======================= File: erc20/0x39Fa206c1648944f92E8F7B626e1CBdf78d7E9dB.json ======================= <filename>erc20/0x39Fa206c1648944f92E8F7B626e1CBdf78d7E9dB.json<gh_stars>100-1000 {"symbol": "DXY","address": "0x39Fa206c1648944f92E8F7B626e1CBdf78d7E9dB","overview":{"en": ""},"email": "","website": "https://dxy.finance/","state": "NORMAL","links": {"blog": "https://medium.com/@dxyfinance","twitter": "https://twitter.com/dxyfinance","telegram": "https://t.me/dxyfinance","github": "https://github.com/dxyfinance"}} ======================= File: erc20/0xBA11D00c5f74255f56a5E366F4F77f5A186d7f55.json ======================= <reponame>641589523/token-profile {"symbol": "BAND","address": "0xBA11D00c5f74255f56a5E366F4F77f5A186d7f55","overview":{"en": ""},"email": "<EMAIL>","website": "https://bandprotocol.com/","state": "NORMAL","links": {"blog": "https://medium.com/bandprotocol","twitter": "https://twitter.com/bandprotocol","telegram": "https://t.me/bandprotocol","github": "https://github.com/bandprotocol"}} ======================= File: erc20/0x1A5F9352Af8aF974bFC03399e3767DF6370d82e4.json ======================= <gh_stars>100-1000 {"symbol": "OWL","address": "0x1A5F9352Af8aF974bFC03399e3767DF6370d82e4","overview":{"en": ""},"email": "<EMAIL>","website": "https://blog.gnosis.pm/owl-token-use-cases-6094027ecb37","state": "NORMAL","links": {"blog": "https://blog.gnosis.io/","twitter": "https://twitter.com/gnosispm","telegram": "","github": "https://github.com/gnosis"}} ======================= File: erc20/0x2E185eF6684d2D0fE9D311782E0ef738d63861E0.json ======================= {"symbol": "BCHDOOM","address": "0x2E185eF6684d2D0fE9D311782E0ef738d63861E0","overview":{"en": ""},"email": "","website": "https://ftx.com/tokens/BCHDOOM","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "","github": ""}} ======================= File: erc20/0x6eDA39647d9Da13f03Ed60BAE308480E87078D0e.json ======================= { "symbol": "WGX", "address": "0x6eDA39647d9Da13f03Ed60BAE308480E87078D0e", "overview": { "en": "WGX (World Game Protocol) is an underlying protocol based on blockchain technology and token economic model issuance It is also a game value carrier and ecological circulation token that integrates the global game industry and DeFi decentralized finance. It is mainly used for the stimulation, circulation and application of WGX community ecology.WGX is committed to the efficient empowerment of the global game industry. Its unique new market relations of community autonomy, decentralization, supply and demand will maximize the demand for the game market under the trend of digital finance and ignite a new round of industrial explosions.", "zh": "WGX(世界游戏协议)是基于区块链技术与通证经济模型发行的底层协议,同时也是全球游戏产业与DeFi去中心化金融两者相融合的游戏价值载体和生态流通代币,主要用于WGX社区生态的激励、流转以及应用等。WGX致力于高效赋能全球游戏行业,其独具特色的社区自治、去中心化、供需决定的新型市场关系,将在最大限度上激发数字金融趋势下的游戏市场需求,引燃新一轮的产业爆发式增长。" }, "email": "<EMAIL>", "website": "http://www.wgxglobal.xyz", "whitepaper": "http://www.wgxglobal.xyz/files/WGX.pdf", "state": "NORMAL", "published_on": "2021-01-05", "initial_price": { "USD": "1 USD" }, "links": { "twitter": "https://twitter.com/wgxglobal" } } ======================= File: erc20/0x2C9C19cE3b15ae77C6d80aEc3C1194Cfd6F7F3fA.json ======================= <filename>erc20/0x2C9C19cE3b15ae77C6d80aEc3C1194Cfd6F7F3fA.json {"symbol": "2CRZ","address": "0x2C9C19cE3b15ae77C6d80aEc3C1194Cfd6F7F3fA","overview":{"en": ""},"email": "","website": "http://2crazynft.com/","state": "NORMAL","links": {"blog": "https://2crazy.medium.com/","twitter": "https://twitter.com/2crazylive","telegram": "","github": ""}} ======================= File: erc20/0x63290fC683d11ea077abA09596Ff7387D49dF912.json ======================= <gh_stars>100-1000 {"symbol": "RAM","address": "0x63290fC683d11ea077abA09596Ff7387D49dF912","overview":{"en": ""},"email": "","website": "https://ramifi.org","state": "NORMAL","links": {"blog": "https://ramifitoken.medium.com/","twitter": "https://twitter.com/RamifiProtocol","telegram": "","github": ""}} ======================= File: erc20/0x25cef4fB106E76080E88135a0e4059276FA9BE87.json ======================= {"symbol": "UNITS","address": "0x25cef4fB106E76080E88135a0e4059276FA9BE87","overview":{"en": "Imperial is a liquid reserve for the cryptocurrency markets and a global currency reserve. Imperial plans on creating a mobile peer-to-peer mineable cryptocurrency that can be used to initiate payments on a slim blockchain."},"email": "<EMAIL>","website": "https://imperialtokens.com/index","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/ImperialTokens","telegram": "https://t.me/joinchat/FBbQZBoCQ8P3IoQXi_yAug","github": ""}} ======================= File: erc20/0x48E8164721A9fa6Bf8d26934099a4691D257598d.json ======================= <filename>erc20/0x48E8164721A9fa6Bf8d26934099a4691D257598d.json { "symbol": "KBZ", "address": "0x48E8164721A9fa6Bf8d26934099a4691D257598d", "overview": { "en": "The ecological health chain KBZ is the underlying blockchain of the entire industry chain for global human ecological health. It is a giant distributed computing network built by people who protect ecological resources and improve human health. KBZ blockchain advocates solutions for global humans to use blockchain to empower real economy industries, directly linking all nodes of the big health industry chain, and effectively lowering the threshold of innovation in the process of establishing ecological health.", "zh": "生态健康链KBZ,是全球人类生态健康的全产业链底层区块链,是由保护生态资源提高人类健康的人士构建的巨型分布式计算网络。KBZ区块链倡导全球人类利用区块链赋能实体经济产业的解决方案,直接贯通大健康产业链所有节点,有效降低了建立生态健康过程中的创新门槛。" }, "email": "<EMAIL>", "website": "http://www.kbzvip888.top/", "whitepaper": "http://www.kbzvip888.top/KBZ.pdf", "state": "NORMAL", "published_on": "2020-12-16", "initial_price": { "USD": "0.14 USD" } } ======================= File: erc20/0x765f0C16D1Ddc279295c1a7C24B0883F62d33F75.json ======================= <filename>erc20/0x765f0C16D1Ddc279295c1a7C24B0883F62d33F75.json<gh_stars>100-1000 {"symbol": "DTX","address": "0x765f0C16D1Ddc279295c1a7C24B0883F62d33F75","overview":{"en": ""},"email": "<EMAIL>","website": "https://databrokerdao.com/","state": "NORMAL","links": {"blog": "https://medium.com/databrokerdao","twitter": "https://twitter.com/DataBrokerDAO","telegram": "https://t.me/databrokerdao","github": "https://github.com/DataBrokerDAO"}} ======================= File: erc20/0xa8006C4ca56F24d6836727D106349320dB7fEF82.json ======================= {"symbol": "INXT","address": "0xa8006C4ca56F24d6836727D106349320dB7fEF82","overview":{"en": ""},"email": "<EMAIL>","website": "https://internxt.com/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Internxt","telegram": "https://t.me/InternxtHQ","github": "https://github.com/internxt"}} ======================= File: erc20/0x2688213fEDd489762a281a67Ae4F2295D8E17ECc.json ======================= {"symbol": "FUD","address": "0x2688213fEDd489762a281a67Ae4F2295D8E17ECc","overview":{"en": "Fud.Finance aims to end waste in the cryptoverse by promoting memes that fud and expose poor, risky and unhealthy projects. It aims to recycle the shitcoins that people have in their wallets into something fun and memorable - like an NFT."},"email": "<EMAIL>","website": "https://fud.finance/","state": "NORMAL","links": {"blog": "https://fudfinance.medium.com/","twitter": "https://twitter.com/dontrugme","telegram": "https://t.me/makefud","github": ""}} ======================= File: erc20/0x3EDD235C3E840C1F29286B2e39370a255C7B6fdb.json ======================= <gh_stars>100-1000 {"symbol": "CMBT","address": "0x3EDD235C3E840C1F29286B2e39370a255C7B6fdb","overview":{"en": ""},"email": "https://coinmarketbrasil.com.br/contact.html#","website": "https://cmbusinesstoken.com/","state": "NORMAL","links": {"blog": "https://blog.coinmarketbrasil.com.br/","twitter": "https://twitter.com/CoinMarketBR","telegram": "","github": "https://github.com/CoinMarketBrasil"}} ======================= File: erc20/0xb4d0FDFC8497AEF97d3c2892AE682eE06064A2BC.json ======================= {"symbol": "FMF","address": "0xb4d0FDFC8497AEF97d3c2892AE682eE06064A2BC","overview":{"en": ""},"email": "<EMAIL>","website": "https://www.formosa.financial/","state": "NORMAL","links": {"blog": "https://medium.com/formosa-financial","twitter": "https://twitter.com/formosaofficial","telegram": "https://t.me/formosafinancial","github": "https://github.com/FormosaFinancial/"}} ======================= File: erc20/0x4162178B78D6985480A308B2190EE5517460406D.json ======================= <reponame>641589523/token-profile {"symbol": "CLN","address": "0x4162178B78D6985480A308B2190EE5517460406D","overview":{"en": ""},"email": "<EMAIL>","website": "https://cln.network/","state": "NORMAL","links": {"blog": "https://medium.com/colu","twitter": "https://twitter.com/ColuNetwork","telegram": "https://t.me/joinchat/Gcrd9Q_E_rgGEjDqmn9Gtg","github": "https://github.com/colucom/CLN-solidity"}} ======================= File: erc20/0x247551F2EB3362E222c742E9c788B8957D9BC87e.json ======================= <filename>erc20/0x247551F2EB3362E222c742E9c788B8957D9BC87e.json<gh_stars>100-1000 {"symbol": "GNY","address": "0x247551F2EB3362E222c742E9c788B8957D9BC87e","overview":{"en": ""},"email": "<EMAIL>","website": "http://www.gny.io","state": "NORMAL","links": {"blog": "https://medium.com/@GNY.IO","twitter": "https://twitter.com/gny_io","telegram": "https://t.me/GNYioBlockchain","github": ""}} ======================= File: erc20/0x955b2AD292e8FbF7ACf9D029a211c3de56364b0a.json ======================= {"symbol": "TELEX","address": "0x955b2AD292e8FbF7ACf9D029a211c3de56364b0a","overview":{"en": "Privacy network focused on transactions,communication and secure file sharing. TELE utilises PoW/PoS protocol with masternode capabilities. TELEX forms part of the TELE IEO and Trend Setter Platform"},"email": "<EMAIL>","website": "https://www.telecoin.info/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/telecoincrypto","telegram": "","github": "https://github.com/TeleCoinOfficial/TELE"}} ======================= File: erc20/0x61bFC979EA8160Ede9b862798B7833a97baFa02a.json ======================= <filename>erc20/0x61bFC979EA8160Ede9b862798B7833a97baFa02a.json {"symbol": "REL","address": "0x61bFC979EA8160Ede9b862798B7833a97baFa02a","overview":{"en": ""},"email": "","website": "https://release.co.jp/rel/","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/ReleaseI","telegram": "","github": ""}} ======================= File: erc20/0x0db03B6CDe0B2d427C64a04FeAfd825938368f1F.json ======================= <reponame>641589523/token-profile<gh_stars>100-1000 {"symbol": "PDATA","address": "0x0db03B6CDe0B2d427C64a04FeAfd825938368f1F","overview":{"en": ""},"email": "<EMAIL>","website": "https://opiria.io/","state": "NORMAL","links": {"blog": "https://medium.com/pdata-token","twitter": "https://twitter.com/PDATA_Token","telegram": "https://t.me/PDATAtoken","github": "https://github.com/opiria-pdata"}} ======================= File: erc20/0x2BF91c18Cd4AE9C2f2858ef9FE518180F7B5096D.json ======================= <gh_stars>100-1000 {"symbol": "KIWI","address": "0x2BF91c18Cd4AE9C2f2858ef9FE518180F7B5096D","overview":{"en": "KIWI is a mineable ERC20/EIP-918 token, and it has no pre-mine. The project was first announced in Bitcointalk in May 6, 2018. Today KIWI is used in payments, NFT trading, engagement, and community development. It can be solo-mined using CPU or GPU."},"email": "<EMAIL>","website": "https://kiwi-token.com/","state": "NORMAL","links": {"blog": "https://medium.com/kiwitoken","twitter": "https://twitter.com/KiwiToken","telegram": "https://t.me/KIWIPoW","github": "https://github.com/KiwiToken"}} ======================= File: erc20/0x8d80de8A78198396329dfA769aD54d24bF90E7aa.json ======================= <reponame>641589523/token-profile {"symbol": "NAC","address": "0x8d80de8A78198396329dfA769aD54d24bF90E7aa","overview":{"en": ""},"email": "<EMAIL>","website": "https://nami.trade/","state": "NORMAL","links": {"blog": "https://nami.io/newsroom/","twitter": "https://twitter.com/NamiTrade","telegram": "https://t.me/namitrade","github": ""}} ======================= File: erc20/0x0DDe6F6e345bfd23f3F419F0DFe04E93143b44FB.json ======================= <reponame>641589523/token-profile<filename>erc20/0x0DDe6F6e345bfd23f3F419F0DFe04E93143b44FB.json {"symbol": "SOTA","address": "0x0DDe6F6e345bfd23f3F419F0DFe04E93143b44FB","overview":{"en": ""},"email": "<EMAIL>","website": "https://sota.finance/vi","state": "NORMAL","links": {"blog": "https://medium.com/@sota01","twitter": "","telegram": "","github": "https://github.com/sota-platform"}} ======================= File: erc20/0xF80D589b3Dbe130c270a69F1a69D050f268786Df.json ======================= <gh_stars>100-1000 {"symbol": "DAM","address": "0xF80D589b3Dbe130c270a69F1a69D050f268786Df","overview":{"en": ""},"email": "<EMAIL>","website": "https://datamine.network/","state": "NORMAL","links": {"blog": "https://medium.com/@dataminenetwork","twitter": "https://twitter.com/dataminenetwork","telegram": "","github": "https://github.com/Datamine-Crypto/"}} ======================= File: erc20/0xceb286C9604c542d3cc08b41AA6C9675B078A832.json ======================= {"symbol": "VTX","address": "0xceb286C9604c542d3cc08b41AA6C9675B078A832","overview":{"en": ""},"email": "","website": "https://vortexdefi.com","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/vortexdefi","telegram": "","github": ""}} ======================= File: erc20/0x22f098F08c4eda4bE4ad6B4ba59866F3E98CEF92.json ======================= <reponame>641589523/token-profile {"symbol": "FFF","address": "0x22f098F08c4eda4bE4ad6B4ba59866F3E98CEF92","overview":{"en": ""},"email": "","website": "http://www.forceforfast.com/","state": "NORMAL","links": {"blog": "","twitter": "","telegram": "","github": ""}} ======================= File: erc20/0x4B4Eb5C44D50Bfd44124688c6754633f7e258b01.json ======================= <gh_stars>100-1000 { "symbol": "SGB", "address": "0x4B4Eb5C44D50Bfd44124688c6754633f7e258b01", "overview":{ "en": "Subgame is a parallel chain of game and payment module engine for many developers around the world to participate in the construction of Boca Ecology. Subgame adopts Subscript as the underlying language and follows the syntax of JavaScript, and completes the encapsulation of Substrate smart contract API and SDK in Assembly Script. In short, Subscript implements the ability for any Web developer to quickly start deploying Poca's native smart contract.", "zh": "SubGame是一个面向全球众多开发者参与波卡生态建设的游戏和支付模组引擎平行链。SubGame采用Subscript为底层语言,沿用了Javascript的语法,并在Assembly Script中完成了对Substrate智能合约API和SDK的封装。简单来说,Subscript实现了支持任何Web开发者快速入手部署波卡原生智能合约的能力。" }, "email": "<EMAIL>", "website": "https://www.subgame.org/", "whitepaper": "https://subgame.guanfantech.com/api/assets/whitePaper/en/技術白皮書_英文_v7.pdf", "state": "NORMAL", "published_on": "2020-03-12", "initial_price":{ "ETH":"0.000169 ETH", "USD":"0.3 USD", "BTC":"0.00000526 BTC" }, "links": { "blog": "", "twitter": "https://twitter.com/SubgameBase", "telegram": "https://t.me/subgamenetwork", "github": "https://github.com/SubGame-Network", "facebook": "https://www.facebook.com/SubGame.netwrok/", "reddit": "https://www.reddit.com/user/SubgameBase_2021/", "slack": "", "medium": "" } } ======================= File: erc20/0xEdF44412B47A76e452FD133794e45d9485E4cd4b.json ======================= <gh_stars>100-1000 {"symbol": "CUAN","address": "0xEdF44412B47A76e452FD133794e45d9485E4cd4b","overview":{"en": "The decentralized cryptocurrency hedge fund."},"email": "<EMAIL>","website": "https://kingcuan.com","state": "NORMAL","links": {"blog": "","twitter": "https://twitter.com/Kingcuantoken","telegram": "https://t.me/joinchat/DdS0whGaum_K2QZ6wbnSXw","github": ""}} ======================= File: erc20/0xf99d58e463A2E07e5692127302C20A191861b4D6.json ======================= { "symbol": "ANY", "address": "0xf99d58e463A2E07e5692127302C20A191861b4D6", "overview":{ "en": "Anyswap is a fully decentralized cross chain swap protocol, based on Fusion DCRM technology, with automated pricing and liquidity system. Anyswap enables swaps between any coins on any blockchain which uses ECDSA or EdDSA as signature algorithm, including BTC, ETH, USDT, XRP, LTC, FSN, etc.", "zh": "Anyswap 是一个完全去中心化的跨链交换协议,基于 Fusion DCRM 技术,具有自动定价和流动性系统。 Anyswap 支持使用 ECDSA 或 EdDSA 作为签名算法的任何区块链上的任何硬币之间的交换,包括 BTC、ETH、USDT、XRP、LTC、FSN 等。" }, "email": "<EMAIL>", "website": "https://anyswap.exchange", "state": "NORMAL", "links
75,523
thestackv1_concat_by_repo-long/65536-65536
Repo: yalcinerbora/meturay ======================= File: Source/RayLib/ObjectFuncDefinitions.h ======================= #pragma once #include <memory> // Load Base Instace template <class T> using ObjGeneratorFunc = T* (*)(); template <class T, class... Args> using ObjGeneratorFuncArgs = T * (*)(Args...); template <class T> using ObjDestroyerFunc = void(*)(T*); template <class T> using SharedLibPtr = std::unique_ptr<T, ObjDestroyerFunc<T>>; //=========================// // Shared Ptr Construction // //=========================// // Tracer template <class Interface> class GeneratorNoArg { private: ObjGeneratorFunc<Interface> gFunc; ObjDestroyerFunc<Interface> dFunc; public: // Constructor & Destructor GeneratorNoArg(ObjGeneratorFunc<Interface> g, ObjDestroyerFunc<Interface> d) : gFunc(g) , dFunc(d) {} SharedLibPtr<Interface> operator()() { Interface* prim = gFunc(); return SharedLibPtr<Interface>(prim, dFunc); } }; namespace TypeGenWrappers { //==============// // New Wrappers // //==============// template <class Base, class T> Base* DefaultConstruct() { return new T(); } template <class T> void DefaultDestruct(T* t) { if(t) delete t; } template <class T> void EmptyDestruct(T* t) {} } ======================= File: Source/Tracer-Test/MaterialDataStructs.h ======================= <filename>Source/Tracer-Test/MaterialDataStructs.h<gh_stars>0 #pragma once #include "RayLib/Vector.h" struct NullData {}; struct AlbedoMatData { const Vector3* dAlbedo; }; struct ReflectMatData { const Vector4* dAlbedoAndRoughness; }; struct RefractMatData { const Vector4* dAlbedoAndIndex; }; ======================= File: Source/RayLib/BitManipulation.h ======================= #pragma once #include <cstdint> namespace Utility { uint64_t FindFirstSet64(uint64_t); uint32_t FindFirstSet32(uint32_t); } ======================= File: Source/TracerLib/ScenePartitionerI.h ======================= <reponame>yalcinerbora/meturay #pragma once #include <vector> #include <map> #include <set> #include <string> #include "NodeListing.h" class CudaGPU; struct SceneError; struct MatBatchData; using MaterialNodeList = std::map<std::string, NodeListing>; using MaterialBatchList = std::map<std::string, MatBatchData>; using MultiGPUMatNodes = std::map<std::pair<std::string, const CudaGPU*>, NodeListing>; using MultiGPUMatBatches = std::map<std::pair<std::string, const CudaGPU*>, MatBatchData>; class ScenePartitionerI { public: virtual ~ScenePartitionerI() = default; // Interface virtual SceneError PartitionMaterials(MultiGPUMatNodes&, MultiGPUMatBatches&, int& boundaryMaterialGPU, // Single Input MaterialNodeList& materialGroups, MaterialBatchList& materialBatches) const = 0; }; ======================= File: Source/TracerLib/TracerLogicGenerator.h ======================= #pragma once /** Base implementation of Logic Generator Provides storage of types (via across boundary capable unique ptrs) and it adds default accelerators and primitives as default types. */ #include <map> #include <list> #include "RayLib/Types.h" #include "RayLib/SharedLib.h" #include "TracerLogicGeneratorI.h" #include "TracerTypeGenerators.h" #include "TracerLogicPools.h" using NameGPUPair = std::pair<std::string, const CudaGPU*>; using AcceleratorPoolPtr = SharedLibPtr<AcceleratorLogicPoolI>; using MaterialPoolPtr = SharedLibPtr<MaterialLogicPoolI>; using PrimitivePoolPtr = SharedLibPtr<PrimitiveLogicPoolI>; using BaseAcceleratorPoolPtr = SharedLibPtr<BaseAcceleratorLogicPoolI>; using TracerLogicPoolPtr = SharedLibPtr<TracerLogicPoolI>; using EstimatorPoolPtr = SharedLibPtr<EstimatorLogicPoolI>; class TracerLogicGenerator : public TracerLogicGeneratorI { private: protected: // Shared Libraries That are Loaded std::map<std::string, SharedLib> openedLibs; // Included Pools std::map<PoolKey, AcceleratorPoolPtr> loadedAccPools; std::map<PoolKey, MaterialPoolPtr> loadedMatPools; std::map<PoolKey, PrimitivePoolPtr> loadedPrimPools; std::map<PoolKey, BaseAcceleratorPoolPtr> loadedBaseAccPools; std::map<PoolKey, TracerLogicPoolPtr> loadedTracerPools; std::map<PoolKey, EstimatorPoolPtr> loadedEstimatorPools; // All Combined Type Generation Functions // Type Generation Functions std::map<std::string, GPUPrimGroupGen> primGroupGenerators; std::map<std::string, GPUAccelGroupGen> accelGroupGenerators; std::map<std::string, GPUMatGroupGen> matGroupGenerators; std::map<std::string, GPUAccelBatchGen> accelBatchGenerators; std::map<std::string, GPUMatBatchGen> matBatchGenerators; std::map<std::string, GPUBaseAccelGen> baseAccelGenerators; std::map<std::string, GPUEstimatorGen> estimatorGenerators; std::map<std::string, GPUTracerGen> tracerGenerators; // Generated Types (Called by GPU Scene) // These hold ownership of classes (thus these will force destruction) // Primitives std::map<std::string, GPUPrimGPtr> primGroups; // Accelerators (Batch and Group) std::map<std::string, GPUAccelGPtr> accelGroups; std::map<std::string, GPUAccelBPtr> accelBatches; // Materials (Batch and Group) std::map<NameGPUPair, GPUMatGPtr> matGroups; std::map<NameGPUPair, GPUMatBPtr> matBatches; // Base Accelerator (Unique Ptr) GPUBaseAccelPtr baseAccelerator; // Tracer (Unique Ptr) GPUTracerPtr tracerPtr; // Estimator (Unique Ptr) GPUEstimatorPtr estimatorPtr; // Generated Batch Mappings AcceleratorBatchMappings accelBatchMap; MaterialBatchMappings matBatchMap; // Helper Funcs uint32_t CalculateHitStructSize(); DLLError FindOrGenerateSharedLib(SharedLib*& libOut, const std::string& libName); template <class T> DLLError FindOrGeneratePool(SharedLibPtr<T>*&, std::map<PoolKey, SharedLibPtr<T>>&, const PoolKey& libName); public: // Constructor & Destructor TracerLogicGenerator(); TracerLogicGenerator(const TracerLogicGenerator&) = delete; TracerLogicGenerator& operator=(const TracerLogicGenerator&) = delete; ~TracerLogicGenerator() = default; // Pritimive SceneError GeneratePrimitiveGroup(GPUPrimitiveGroupI*&, const std::string& primitiveType) override; // Accelerator SceneError GenerateAcceleratorGroup(GPUAcceleratorGroupI*&, const GPUPrimitiveGroupI&, const TransformStruct* t, const std::string& accelType) override; SceneError GenerateAcceleratorBatch(GPUAcceleratorBatchI*&, const GPUAcceleratorGroupI&, const GPUPrimitiveGroupI&, uint32_t keyBatchId, const std::string& batchType) override; // Material SceneError GenerateMaterialGroup(GPUMaterialGroupI*&, const CudaGPU&, const GPUEventEstimatorI&, const std::string& materialType) override; SceneError GenerateMaterialBatch(GPUMaterialBatchI*&, const GPUMaterialGroupI&, const GPUPrimitiveGroupI&, uint32_t keyBatchId, const std::string& batchType) override; // Base Accelerator should be fetched after all the stuff is generated SceneError GenerateBaseAccelerator(GPUBaseAcceleratorI*&, const std::string& accelType) override; // EventEstimator SceneError GenerateEventEstimaor(GPUEventEstimatorI*&, const std::string& estType) override; // Tracer Logic SceneError GenerateTracerLogic(TracerBaseLogicI*&, // Args const TracerParameters& opts, const Vector2i maxMats, const Vector2i maxAccels, const HitKey baseBoundMatKey, // Type const std::string& tracerType) override; PrimitiveGroupList GetPrimitiveGroups() const override; AcceleratorGroupList GetAcceleratorGroups() const override; AcceleratorBatchMappings GetAcceleratorBatches() const override; MaterialGroupList GetMaterialGroups() const override; MaterialBatchMappings GetMaterialBatches() const override; GPUBaseAcceleratorI* GetBaseAccelerator() const override; GPUEventEstimatorI* GetEventEstimator() const override; TracerBaseLogicI* GetTracerLogic() const override; // Resetting all generated Groups and Batches void ClearAll() override; // Inclusion Functionality // Additionally includes the materials, primitives etc. from other libraries DLLError IncludeBaseAcceleratorsFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) override; DLLError IncludeAcceleratorsFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) override; DLLError IncludeMaterialsFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) override; DLLError IncludePrimitivesFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) override; DLLError IncludeEstimatorsFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) override; DLLError IncludeTracersFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) override; }; template <class T> DLLError TracerLogicGenerator::FindOrGeneratePool(SharedLibPtr<T>*& pool, std::map<PoolKey, SharedLibPtr<T>>& generatedPools, const PoolKey& libKey) { DLLError e = DLLError::OK; auto loc = generatedPools.end(); if((loc = generatedPools.find(libKey))!= generatedPools.end()) { pool = &loc->second; return e; } else { SharedLibPtr<T> ptr = {nullptr, nullptr}; e = libKey.first->GenerateObject<T>(ptr,libKey.second); if(e!= DLLError::OK) return e; auto it = generatedPools.emplace(libKey, std::move(ptr)); pool = &(it.first->second); return e; } } ======================= File: Source/RayLib/StripComments.h ======================= <filename>Source/RayLib/StripComments.h #pragma once #include <istream> #include <sstream> #include <regex> namespace Utility { std::stringstream StripComments(std::istream& source); } inline std::stringstream Utility::StripComments(std::istream& source) { // Use Regex to Strip Comments std::regex commentre("/\\*([\\s\\S]*?)\\*/"); std::regex commentli("//(.*)[\\r\\n|\\n]"); std::string all(std::istreambuf_iterator<char>(source), {}); std::string modified = std::regex_replace(all, commentre, ""); modified = std::regex_replace(modified, commentli, "\n"); std::stringstream result(modified); return std::move(result); } ======================= File: Source/RayLib/HitStructs.h ======================= <filename>Source/RayLib/HitStructs.h #pragma once /** */ #include <cstdint> #include "CudaCheck.h" #include "Types.h" // Auxiliary Ids for transforms and primitives typedef uint32_t TransformId; typedef uint64_t PrimitiveId; // TODO: Implement struct HitStructPtr { private: Byte* dPtr; int combinedSize; public: HitStructPtr() : dPtr(nullptr), combinedSize(0) {} HitStructPtr(void* dPtr, int combinedSize) : dPtr(static_cast<Byte*>(dPtr)) , combinedSize(combinedSize) {} template<class T> __device__ __host__ T& Ref(int i) { return *reinterpret_cast<T*>(dPtr + combinedSize * i); } template<class T> __device__ __host__ const T& Ref(int i) const { return *reinterpret_cast<T*>(dPtr + combinedSize * i); } //template<class T> //__device__ __host__ //const T& operator[](int i) const { return *reinterpret_cast<const T&>(dPtr + combinedSize * i); } }; template <class T, uint32_t BatchBits, uint32_t IdBits> struct alignas(sizeof(T)) HitKeyT { using Type = T; // Constructors & Destructor HitKeyT() = default; __device__ __host__ constexpr HitKeyT(T v) : value(v) {} // Props T value; __device__ __host__ operator const T&() const; __device__ __host__ operator T&(); __device__ __host__ static constexpr T CombinedKey(uint32_t batch, uint64_t id); __device__ __host__ static constexpr T FetchIdPortion(HitKeyT key); __device__ __host__ static constexpr uint16_t FetchBatchPortion(HitKeyT key); static constexpr uint32_t BatchBits = BatchBits; static constexpr uint32_t IdBits = IdBits; static constexpr T IdMask = (0x1ull << IdBits) - 1; static constexpr T BatchMask = ((0x1ull << BatchBits) - 1) << IdBits; static_assert((IdBits + BatchBits) == std::numeric_limits<T>::digits, "Bits representing portions of HitKey should complement each other."); static_assert((IdMask | BatchMask) == std::numeric_limits<T>::max() && (IdMask & BatchMask) == std::numeric_limits<T>::min(), "Masks representing portions of HitKey should complement each other."); static constexpr uint16_t NullBatch = NullBatchId; static constexpr T InvalidKey = CombinedKey(NullBatch, 0); }; template <class T, uint32_t BatchBits, uint32_t IdBits> __device__ __host__ HitKeyT<T, BatchBits, IdBits>::operator const T&() const { return value; } template <class T, uint32_t BatchBits, uint32_t IdBits> __device__ __host__ HitKeyT<T, BatchBits, IdBits>::operator T&() { return value; } template <class T, uint32_t BatchBits, uint32_t IdBits> __device__ __host__ constexpr T HitKeyT<T, BatchBits, IdBits>::CombinedKey(uint32_t batch, uint64_t id) { return (static_cast<T>(batch) << IdBits) | (static_cast<T>(id) & IdMask); } template <class T, uint32_t BatchBits, uint32_t IdBits> __device__ __host__ constexpr T HitKeyT<T, BatchBits, IdBits>::FetchIdPortion(HitKeyT key) { return key & IdMask; } template <class T, uint32_t BatchBits, uint32_t IdBits> __device__ __host__ constexpr uint16_t HitKeyT<T, BatchBits, IdBits>::FetchBatchPortion(HitKeyT key) { return static_cast<uint16_t>((static_cast<T>(key) & BatchMask) >> IdBits); } // Id-Key pair which will be used in sorting for kernel partitioning typedef uint32_t RayId; using HitKeyType = uint32_t; using HitKey = HitKeyT<HitKeyType, 8u, 24u>; static_assert(sizeof(HitKey) == sizeof(HitKeyType), "Type and Key sizes should match."); ======================= File: Source/RayLib/Triangle.h ======================= <reponame>yalcinerbora/meturay #pragma once #include "Vector.h" #include "AABB.h" namespace Triangle { template <class T> __device__ __host__ AABB<3, T> BoundingBox(const Vector<3, T>& p0, const Vector<3, T>& p1, const Vector<3, T>& p2); } template <class T> __device__ __host__ AABB<3, T> Triangle::BoundingBox(const Vector<3, T>& p0, const Vector<3, T>& p1, const Vector<3, T>& p2) { AABB3f aabb(p0, p0); aabb.SetMin(Vector3f::Min(aabb.Min(), p1)); aabb.SetMin(Vector3f::Min(aabb.Min(), p2)); aabb.SetMax(Vector3f::Max(aabb.Max(), p1)); aabb.SetMax(Vector3f::Max(aabb.Max(), p2)); return aabb; } ======================= File: Source/TracerLib/GPUPrimitiveI.h ======================= <filename>Source/TracerLib/GPUPrimitiveI.h #pragma once /** Primitive related structs Primitive is a simple building block of a surface. It can be numeric types (such as triangles, volumes etc.) or it can be analtyic types (such as splines, spheres) PrimtiveGroup holds multiple primitive lists (i.e. multiple meshes) PrimtiveGroup holds the same primitives that have the same layout in memory multiple triangle layouts will be on different primtive groups (this is required since their primtiive data fetch logics will be different) Most of the time user will define a single primtive for same types to have better performance since this API is being developed for customization this is mandatory. */ #include <cstdint> #include "RayLib/Vector.h" #include "RayLib/AABB.h" #include "NodeListing.h" struct SceneError; struct EstimatorInfo; class SceneNodeI; class SurfaceLoaderGeneratorI; class GPUPrimitiveGroupI { public: virtual ~GPUPrimitiveGroupI() = default; // Interface // Type (as string) of the primitive group virtual const char* Type() const = 0; // Allocates and Generates Data virtual SceneError InitializeGroup(const NodeListing& surfaceDataNodes, double time, const SurfaceLoaderGeneratorI&, const std::string& scenePath) = 0; virtual SceneError ChangeTime(const NodeListing& surfaceDatalNodes, double time, const SurfaceLoaderGeneratorI&, const std::string& scenePath) = 0; // Provides data to Event Estimator virtual bool HasPrimitive(uint32_t surfaceDataId) const = 0; virtual SceneError GenerateEstimatorInfo(std::vector<EstimatorInfo>&, const Vector3& power, HitKey key, uint32_t surfaceDataId) const = 0; // Access primitive range from Id virtual Vector2ul PrimitiveBatchRange(uint32_t surfaceDataId) const = 0; virtual AABB3 PrimitiveBatchAABB(uint32_t surfaceDataId) const = 0; virtual uint32_t PrimitiveHitSize() const = 0; // Error check // Queries in order to check if this primitive group supports certain primitive data // Material may need that data virtual bool CanGenerateData(const std::string& s) const = 0; }; ======================= File: Source/AssimpSurfaceLoaders/MetaSurfaceLoader.h ======================= <gh_stars>0 #pragma once #include "RayLib/SurfaceLoaderI.h" #include "RayLib/SceneNodeI.h" #include "AssimpForward.h" #include <string> class AssimpMetaSurfaceLoader : public SurfaceLoader { public: static constexpr const char* InnerIdJSON = "innerIndex"; private: Assimp::Importer& importer; const aiScene* scene; const std::string& extension; // Inner Ids const UIntList innerIds; protected: public: // Constructors & Destructor AssimpMetaSurfaceLoader(Assimp::Importer&, const std::string& scenePath, const std::string& fileExt, const SceneNodeI& node, double time = 0.0); AssimpMetaSurfaceLoader(const AssimpMetaSurfaceLoader&) = delete; AssimpMetaSurfaceLoader& operator=(const AssimpMetaSurfaceLoader&) = delete; ~AssimpMetaSurfaceLoader(); // Interface const char* SufaceDataFileExt() const override; // Per Batch Fetch SceneError AABB(std::vector<AABB3>&) const override; SceneError PrimitiveRanges(std::vector<Vector2ul>&) const override; SceneError PrimitiveCounts(std::vector<size_t>&) const override; SceneError PrimitiveDataRanges(std::vector<Vector2ul>&) const override; // Entire Data Fetch SceneError GetPrimitiveData(Byte*, PrimitiveDataType primitiveDataType) const override; SceneError PrimitiveDataCount(size_t&, PrimitiveDataType primitiveDataType) const override; SceneError PrimDataLayout(PrimitiveDataLayout&, PrimitiveDataType primitiveDataType) const override; }; ======================= File: Source/RayLib/NodeI.h ======================= #pragma once /** Basic Interface for Node System nodes can be multiple and it can be joined to node packs Nodes have single purpose (Except Self-Node): - Trace scene (Tracer Node) - Show current progress of tracing (Visor Node) - Change options, do actions (Command Node) - Show analytic data (Analytic Node) Self node does everything (for workstation use- or debug use etc.) */ #include "NodeError.h" //#include "TracerStatus.h" class NodeI { public: virtual ~NodeI() = default; // Interface virtual NodeError Initialize() = 0; // virtual TracerStatus Status() const = 0; // Main Thead virtual void Work() = 0; }; ======================= File: Source/RayLib/UniformDistribution.h ======================= <filename>Source/RayLib/UniformDistribution.h #pragma once #include <cassert> #include <cuda.h> #include <cuda_runtime.h> #include <type_traits> #include "Constants.h" #include "Vector.h" namespace UniformDist { // 1D Classic template <class T, class = FloatEnable<T>> __device__ __host__ inline T PDF(/*T xi,*/ const T start, const T end) { assert(end > start); if(xi < start || xi > end) return 0; return 1 / (end - start); } template <class T, class = FloatEnable<T>> __device__ __host__ inline T CDF(T xi, const T start, const T end) { assert(end > start); if(xi < start) return 0; else if(xi >= end) return 1; return 1 / (end - start); } template <class T, class = FloatEnable<T>> __device__ __host__ inline T ICDF(T xi, const T start, const T end) { assert(end > start); return xi * (end - start) + start; } // Hemispherical template <class T, class = FloatEnable<T>> __device__ __host__ inline T HemiPDF(/*const Vector<2,T>& xi*/) { return static_cast<T>(0.5) * static_cast<T>(MathConstants::InvPi_d); } template <class T, class = FloatEnable<T>> __device__ __host__ inline Vector<3, T> HemiICDF(const Vector<2, T>& xi) { // Disk distribution with uniform Z T xi0Coeff = sqrt(1 - xi[0] * xi[0]); T xi1Coeff = 2 * static_cast<T>(MathConstants::Pi_d) * xi[1]; Vector<3, T> dir; dir[0] = xi0Coeff * cos(xi1Coeff); dir[1] = xi0Coeff * sin(xi1Coeff); dir[2] = xi[0]; return dir; } // Spherical template <class T, class = FloatEnable<T>> __device__ __host__ inline T SphrPDF(/*const Vector<2,T>& xi*/) { return static_cast<T>(0.25) * static_cast<T>(MathConstants::InvPi_d); } template <class T, class = FloatEnable<T>> __device__ __host__ inline Vector<3, T> SphrICDF(const Vector<2, T>& xi) { // Disk distribution with uniform Z T z = 1 - 2 * xi[0]; T xi1Coeff = 2 * static_cast<T>(MathConstants::Pi_d) * xi[1]; T radius = sqrt(1 - z * z); Vector<3, T> dir; dir[0] = xi0Coeff * cos(xi1Coeff); dir[1] = xi0Coeff * sin(xi1Coeff); dir[2] = z; return dir; } // Cone template <class T, class = FloatEnable<T>> __device__ __host__ inline T ConePDF(T aperture) { return 1 / (2 * static_cast<T>(MathConstants::Pi_d) * (1 - cos(aperture))); } template <class T, class = FloatEnable<T>> __device__ __host__ inline Vector<3, T> ConeICDF(const Vector<2, T>& xi, T aperture) { T cosTheta = (1 - xi[0]) + xi[0] * cos(aperture); T sinTheta = sqrt(1 - cosTheta * cosTheta); T phi = xi[1] * 2 * Pi; Vector<3, T> dir; dir[0] = cos(phi) * sinTheta; dir[1] = sin(phi) * sinTheta; dir[2] = cosTheta; return dir; } } ======================= File: Source/RayLib/MPMCQueue.h ======================= #pragma once /** Fix Sized Multi-producer Multi-consumer ring buffer queue, shitty implementation (single lock and cond var used) TODO: improve, atomic etc... */ #include <vector> #include <mutex> #include <condition_variable> template<class T> class MPMCQueue { private: std::vector<T> data; size_t enqueueLoc; size_t dequeueLoc; std::condition_variable enqueWake; std::condition_variable dequeueWake; std::mutex mutex; bool terminate; bool Empty(); bool Full(); void Increment(size_t&); protected: public: // Constructors & Destructor MPMCQueue(size_t bufferSize); MPMCQueue(const MPMCQueue&) = delete; MPMCQueue(MPMCQueue&&) = delete; MPMCQueue& operator=(const MPMCQueue&) = delete; MPMCQueue& operator=(MPMCQueue&&) = delete; ~MPMCQueue() = default; // Interface void Dequeue(T&); bool TryDequeue(T&); void Enqueue(T&&); bool TryEnqueue(T&&); // Awakes all threads and forces them to leave queue void Terminate(); }; #include "MPMCQueue.hpp" ======================= File: Source/TracerLib/TypeTraits.h ======================= #pragma once /** Tracer Data Structure Type trait */ #include <type_traits> //#define HAS_STATIC_FUNC(_NAME_)\ // template<typename, typename T>\ // struct Has##_NAME_##T\ // {\ // static_assert(std::integral_constant<T, false>::value, \ // "Second template parameter needs to be of function type."); \ // };\ // template<typename C, typename Ret, typename... Args> \ // struct Has##N##T<C, Ret(Args...)>\ // {\ // private:\ // template<typename T>\ // static constexpr auto check(T*) -> typename\ // std::is_same<decltype(T::##_NAME_##(std::declval<Args>()...)), Ret>::type; \ // template<typename>\ // static constexpr std::false_type check(...) { return std::false_type(); }\ // typedef decltype(check<C>(0)) type;\ // public:\ // static constexpr bool value = type::value;\ // };\ // template <class C>\ // using Has##_NAME_## = Has##_NAME_##T<C, const char*()>;\ // \ // template<typename C, typename Ret, typename...Args>\ // template<typename T>\ // inline constexpr auto Has##_NAME_##T<C, Ret(Args...)>::check(T*) -> typename std::is_same<decltype(T::##_NAME_##(std::declval<Args>()...)), Ret>::type\ // {\ // return typename std::is_same<decltype(T::##_NAME_##(std::declval<Args>()...)), Ret>::type();\ // } // //HAS_STATIC_FUNC(TypeName) //HAS_STATIC_FUNC(Name) template<typename, typename T> struct HasTypeNameT { static_assert(std::integral_constant<T, false>::value, "Second template parameter needs to be of function type."); }; template<typename C, typename Ret, typename... Args> struct HasTypeNameT<C, Ret(Args...)> { private: template<typename T> static constexpr auto check(T*) -> typename std::is_same<decltype(T::TypeName(std::declval<Args>()...)), Ret>::type; // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // attempt to call it and see if the return type is correct template<typename> static constexpr std::false_type check(...) { return std::false_type(); } typedef decltype(check<C>(0)) type; public: static constexpr bool value = type::value; }; template <class C> using HasTypeName = HasTypeNameT<C, const char*()>; template<typename C, typename Ret, typename...Args> template<typename T> inline constexpr auto HasTypeNameT<C, Ret(Args...)>::check(T*) -> typename std::is_same<decltype(T::TypeName(std::declval<Args>()...)), Ret>::type { return typename std::is_same<decltype(T::TypeName(std::declval<Args>()...)), Ret>::type(); } template <class T> struct IsTracerClass { static constexpr bool has_type_name_v = HasTypeName<T>::value; static constexpr bool is_class_v = std::is_class<T>::value; static constexpr bool not_abstract_v =!std::is_abstract<T>::value; // TODO: Add more when required static_assert(has_type_name_v, "A Tracer class should have" "\"static const char* TypeName()\" function"); static_assert(is_class_v, "A Tracer class must be a class. (duh)"); static_assert(not_abstract_v, "A Tracer class must not be a abstract class. (duh)"); static constexpr bool value = has_type_name_v && is_class_v && not_abstract_v; }; ======================= File: Source/RayLib/LoopingThreadI.h ======================= <reponame>yalcinerbora/meturay<gh_stars>0 #pragma once /** Looping Thread Partial Interface used by threads that do same work over and over again like tracer thread and visor thread. Visor thread continously renders stuff untill terminated Tracer(s) continiously render stuff untill terminated User can define internal terminate condition where thread automatically ends */ #include <thread> #include <mutex> #include <condition_variable> class LoopingThreadI { private: std::thread thread; std::mutex mutex; std::condition_variable conditionVar; bool stopSignal; bool pauseSignal; void THRDEntry(); protected: virtual bool InternallyTerminated() const = 0; virtual void InitialWork() = 0; virtual void LoopWork() = 0; virtual void FinalWork() = 0; public: // Constructors & Destructor LoopingThreadI(); virtual ~LoopingThreadI(); void Start(); void Stop(); void Pause(bool pause); }; inline void LoopingThreadI::THRDEntry() { InitialWork(); while(!InternallyTerminated() || stopSignal) { LoopWork(); // Condition { std::unique_lock<std::mutex> lock(mutex); // Wait if queue is empty conditionVar.wait(lock, [&] { return stopSignal ||!pauseSignal; }); } //if(stopSignal) return; } FinalWork(); } inline LoopingThreadI::LoopingThreadI() : pauseSignal(false) , stopSignal(false) {} inline LoopingThreadI::~LoopingThreadI() { Stop(); }; inline void LoopingThreadI::Start() { thread = std::thread(&LoopingThreadI::THRDEntry, this); } inline void LoopingThreadI::Stop() { mutex.lock(); stopSignal = true; mutex.unlock(); conditionVar.notify_one(); if(thread.joinable()) thread.join(); stopSignal = false; } inline void LoopingThreadI::Pause(bool pause) { mutex.lock(); pauseSignal = pause; mutex.unlock(); conditionVar.notify_one(); } ======================= File: Source/RayLib/VisorMovementI.h ======================= #pragma once #include "VisorInputStructs.h" struct CameraPerspective; class MovementSchemeI { public: virtual ~MovementSchemeI() = default; // Interface virtual void KeyboardAction(CameraPerspective&, //.. KeyboardKeyType, KeyAction, const KeyboardKeyBindings&) = 0; virtual void MouseMovementAction(CameraPerspective&, //.. double x, double y) = 0; virtual void MouseScrollAction(CameraPerspective&, //.. double x, double y) = 0; virtual void MouseButtonAction(CameraPerspective&, //.. MouseButtonType button, KeyAction action, const MouseKeyBindings&) = 0; }; ======================= File: Source/Tracer-Test/TestPools.h ======================= #pragma once #include "TracerLib/TracerLogicGenerator.h" #include "TracerLib/TracerLogicPools.h" class TestMaterialPool final : public MaterialLogicPoolI { public: // Constructors & Destructor TestMaterialPool(); ~TestMaterialPool() = default; }; class TestTracerLogicPool final : public TracerLogicPoolI { public: // Constructors & Destructor TestTracerLogicPool(); ~TestTracerLogicPool() = default; }; ======================= File: Source/RayLib/Log.h ======================= <gh_stars>0 #pragma once #include <string> // Debug #ifdef METU_DEBUG static constexpr bool IS_DEBUG_MODE = true; template<class... Args> static inline constexpr void METU_DEBUG_LOG(const char* string, Args... args) { std::string s; s += "\33[2K\r"; s += string; s += "\n"; fprintf(stdout, s.c_str(), args...); } #else static const bool IS_DEBUG_MODE = false; template<class... Args> static inline constexpr void METU_DEBUG_LOG(const char* string, Args... args) {} #endif template<class... Args> static inline constexpr void METU_LOG(const char* string, Args... args) { std::string s; //s += "\33[2K\r"; s += string; s += "\n"; fprintf(stdout, s.c_str(), args...); } template<class... Args> static inline constexpr void METU_ERROR_LOG(const char* string, Args... args) { std::string s; //s += "\33[2K\r"; s += "Error: "; s += string; s += "\n"; fprintf(stderr, s.c_str(), args...); } ======================= File: Source/VisorGL/VisorGLEntry.h ======================= #pragma once #ifdef METU_SHARED_VISORGL #define METU_SHARED_VISORGL_ENTRY_POINT __declspec(dllexport) #else #define METU_SHARED_VISORGL_ENTRY_POINT __declspec(dllimport) #endif #include <memory> #include "RayLib/VisorI.h" METU_SHARED_VISORGL_ENTRY_POINT std::unique_ptr<VisorI> CreateVisorGL(const VisorOptions&); ======================= File: Source/TracerLib/RayStructs.h ======================= <filename>Source/TracerLib/RayStructs.h #pragma once /** Ray Struct that is mandatory for hit acceleration Ray has two different layouts One is global memory layout which is optimized for memory acess (and minimize padding) Second is register layout which is used for cleaner code */ #include <vector> #include "RayLib/Vector.h" #include "RayLib/Ray.h" // Global memory Layout for Rays struct alignas(32) RayGMem { Vector3 pos; float tMin; Vector3 dir; float tMax; }; // GPU register layout for rays struct RayReg { RayF ray; float tMin; float tMax; RayReg() = default; __device__ __host__ constexpr RayReg(RayF, float, float); __device__ __host__ RayReg(const RayGMem* mem, unsigned int loc); // Save __device__ __host__ void Update(RayGMem* mem, unsigned int loc); __device__ __host__ void UpdateTMax(RayGMem* mem, unsigned int loc); __device__ __host__ bool IsInvalidRay() const; }; constexpr RayReg::RayReg(RayF ray, float tMin, float tMax) : ray(ray) , tMin(tMin) , tMax(tMax) {} static constexpr RayReg EMPTY_RAY_REGISTER = RayReg { RayF(Zero3, Zero3), 0.0f, 0.0f }; __device__ __host__ inline RayReg::RayReg(const RayGMem* mem, unsigned int loc) { RayGMem rayGMem = mem[loc]; ray = RayF(rayGMem.dir, rayGMem.pos); tMin = rayGMem.tMin; tMax = rayGMem.tMax; } __device__ __host__ inline void RayReg::Update(RayGMem* mem, unsigned int loc) { RayGMem rayGMem = { ray.getPosition(), tMin, ray.getDirection(), tMax }; mem[loc] = rayGMem; } __device__ __host__ inline void RayReg::UpdateTMax(RayGMem* mem, unsigned int loc) { mem[loc].tMax = tMax; } __device__ __host__ inline bool RayReg::IsInvalidRay() const { static const RayReg eRay = EMPTY_RAY_REGISTER; return(ray.getDirection() == eRay.ray.getDirection() && ray.getPosition() == eRay.ray.getPosition() && tMin == eRay.tMin && tMax == eRay.tMax); } ======================= File: Source/RayLib/DLLError.h ======================= #pragma once #pragma once /** DLL Error error "Enumeration" */ #include "Error.h" #include <stdexcept> struct DLLError : public ErrorI { public: enum Type { OK, // Logical DLL_NOT_FOUND, MANGLED_NAME_NOT_FOUND, // End END }; private: Type type; public: // Constructors & Destructor DLLError(Type); ~DLLError() = default; operator Type() const; operator std::string() const override; }; class DLLException : public std::runtime_error { private: DLLError e; protected: public: DLLException(DLLError::Type t) : std::runtime_error("") , e(t) {} DLLException(DLLError::Type t, const char* const err) : std::runtime_error(err) , e(t) {} operator DLLError() const { return e; }; }; inline DLLError::DLLError(DLLError::Type t) : type(t) {} inline DLLError::operator Type() const { return type; } inline DLLError::operator std::string() const { static constexpr char const* const ErrorStrings[] = { "OK", // Logical "Shared Library not found", "Unable to find shared function" }; static_assert((sizeof(ErrorStrings) / sizeof(const char*)) == static_cast<size_t>(DLLError::END), "Enum and enum string list size mismatch."); return ErrorStrings[static_cast<int>(type)]; } ======================= File: Source/RayLib/SceneError.h ======================= <reponame>yalcinerbora/meturay<filename>Source/RayLib/SceneError.h #pragma once #pragma once /** Tracer error "Enumeration" */ #include <stdexcept> #include "Error.h" struct SceneError : public ErrorI { public: enum Type { OK, // Common FILE_NOT_FOUND, ANIMATION_FILE_NOT_FOUND, // Not Found MATERIALS_ARRAY_NOT_FOUND, PRIMITIVES_ARRAY_NOT_FOUND, SURFACES_ARRAY_NOT_FOUND, ACCELERATORS_ARRAY_NOT_FOUND, LIGHTS_ARRAY_NOT_FOUND, TRANSFORMS_ARRAY_NOT_FOUND, CAMERAS_ARRAY_NOT_FOUND, BASE_ACCELERATOR_NODE_NOT_FOUND, BASE_BOUND_MAT_NODE_NOT_FOUND, TRACER_NODE_NOT_FOUND, ESTIMATOR_NODE_NOT_FOUND, // No Logic NO_LOGIC_FOR_ACCELERATOR, NO_LOGIC_FOR_MATERIAL, NO_LOGIC_FOR_PRIMITIVE, NO_LOGIC_FOR_SURFACE_DATA, NO_LOGIC_FOR_TRACER, NO_LOGIC_FOR_ESTIMATOR, // Id Errors DUPLICATE_ACCELERATOR_ID, DUPLICATE_MATERIAL_ID, DUPLICATE_PRIMITIVE_ID, DUPLICATE_TRANSFORM_ID, // Id not found ACCELERATOR_ID_NOT_FOUND, MATERIAL_ID_NOT_FOUND, PRIMITIVE_ID_NOT_FOUND, TRANSFORM_ID_NOT_FOUND, // Json parse errors LOGIC_MISMATCH, TYPE_MISMATCH, JSON_FILE_PARSE_ERROR, // Special Type Values UNKNOWN_TRANSFORM_TYPE, UNKNOWN_LIGHT_TYPE, // Loading Surface Data SURFACE_DATA_PRIMITIVE_MISMATCH, SURFACE_DATA_TYPE_NOT_FOUND, SURFACE_DATA_INVALID_READ, // Some Mat/Accel Logic // may not support certain prims PRIM_ACCEL_MISMATCH, PRIM_MAT_MISMATCH, // Updating the Scene // Primitive Update Size Mismmatch PRIM_UPDATE_SIZE_MISMATCH, // Too many types than key system can handle TOO_MANY_ACCELERATOR_GROUPS, TOO_MANY_ACCELERATOR_IN_GROUP, TOO_MANY_MATERIAL_GROUPS, TOO_MANY_MATERIAL_IN_GROUP, // Misc TOO_MANY_SURFACE_ON_NODE, PRIM_MATERIAL_NOT_SAME_SIZE, PRIM_TYPE_NOT_CONSISTENT_ON_SURFACE, LIGHT_PRIMITIVE_NOT_FOUND, // Internal Errors INTERNAL_DUPLICATE_MAT_ID, INTERNAL_DUPLICATE_ACCEL_ID, // PRIMITIVE_TYPE_INTERNAL_ERROR, MATERIAL_TYPE_INTERNAL_ERROR, SURFACE_LOADER_INTERNAL_ERROR, // End END }; private: Type type; public: // Constructors & Destructor SceneError(Type); ~SceneError() = default; operator Type() const; operator std::string() const override; }; class SceneException : public std::runtime_error { private: SceneError e; protected: public: SceneException(SceneError::Type t) : std::runtime_error("") , e(t) {} SceneException(SceneError::Type t, const char* const err) : std::runtime_error(err) , e(t) {} operator SceneError() const { return e; }; }; inline SceneError::SceneError(SceneError::Type t) : type(t) {} inline SceneError::operator Type() const { return type; } inline SceneError::operator std::string() const { static constexpr char const* const ErrorStrings[] = { "OK", // Common "Scene file not found", "Animation file not found", // Not Found "\"Materials\" array not found", "\"Primitives\" array not found", "\"Surfaces\" array not found", "\"Accelerators\" array not found", "\"Lights\" array not found", "\"Transforms\" array not found", "\"Cameras\" array not found", "\"BaseAccelerator\" node not found", "\"BaseBoundaryMaterial\" node not found", "\"Tracer\" node not found", "\"Estimator\" node not found", // No Logic "No logic found for that accelerator", "No logic found for that material", "No logic found for that primitive", "No logic found for loading that surface data", "No logic found for that tracer", "No logic found for that estimator", // Id Errors "Duplicate accelerator id", "Duplicate material id", "Duplicate primitive id", "Duplicate transform id", // "Accelerator id not found", "Material id not found", "Primitive id not found", "Transform id not found", // Json Parse Errors "Logics does not match", "JSON type does not match with required type", "JSON file could not be parsed properly", // Special Type Values "Transform type name is unknown", "Light type name is unknown", // Loading Surface Data "Surface data type is mismatched with primitive type", "Surface data type not found", "Surface data unknown type", // Some Mat/Accel Logic // may not support certain prims "Primitive-Material mismatch", "Primitive-Accelerator mismatch", // Updating the scene // Primitive Update Size Mismmatch "Updating primitive has more nodes than older itself", // Too many types than key system can handle "Accelerator groups required for this scene exceeds limit", "Accelerators in a group required for this scene exceeds limit", "Material groups required for this scene exceeds limit", "Materials in a batch required for this scene exceeds limit", // Misc "Too many data/material pairs per surface node", "Prim/Material pairs on surface node does not have same size", "Primitive types are not consistent in a surface", "Primitive for light not found", // Internal Errors "Internal Error, Duplicate material id", "Internal Error, Duplicate accelerator id", // "Internal Error on the Primitive Type", "Internal Error on the Material Type", "Internal Error on the Surface Loader" }; static_assert((sizeof(ErrorStrings) / sizeof(const char*)) == static_cast<size_t>(SceneError::END), "Enum and enum string list size mismatch."); return ErrorStrings[static_cast<int>(type)]; } ======================= File: Source/RayLib/AABB.h ======================= #pragma once /** Arbitrary sized axis aligned bounding box. N should be 2, 3 or 4 at most. These are convenience register classes for GPU. */ #include "Vector.h" template<int N, class T, typename = ArithmeticEnable<T>> class AABB; template<int N, class T> class alignas(ChooseVectorAlignment(N * sizeof(T))) AABB<N, T> { private: Vector<N, T> min; Vector<N, T> max; protected: public: // Constructors & Destructor constexpr AABB() = default; constexpr __device__ __host__ AABB(const Vector<N, T>& min, const Vector<N, T>& max); __device__ __host__ AABB(const T* dataMin, const T* dataMax); template <class... Args0, class... Args1, typename = AllArithmeticEnable<Args1...>, typename = AllArithmeticEnable<Args0...>> constexpr __device__ __host__ AABB(const Args0... dataList0, const Args1... dataList1); ~AABB() = default; // Accessors __device__ __host__ const Vector<N, T>& Min() const; __device__ __host__ const Vector<N, T>& Max() const; __device__ __host__ Vector<N, T> Min(); __device__ __host__ Vector<N, T> Max(); // Mutators __device__ __host__ void SetMin(const Vector<N, T>&); __device__ __host__ void SetMax(const Vector<N, T>&); // Functionality __device__ __host__ Vector<N, T> Centroid() const; __device__ __host__ AABB Union(const AABB&) const; __device__ __host__ AABB& UnionSelf(const AABB&); }; // Typeless aabbs are defaulted to float using AABB2 = AABB<2, float>; using AABB3 = AABB<3, float>; using AABB4 = AABB<4, float>; // Float Type using AABB2f = AABB<2, float>; using AABB3f = AABB<3, float>; using AABB4f = AABB<4, float>; // Double Type using AABB2d = AABB<2, double>; using AABB3d = AABB<3, double>; using AABB4d = AABB<4, double>; // Requirements of Vectors static_assert(std::is_literal_type<AABB3>::value == true, "AABBs has to be literal types"); static_assert(std::is_trivially_copyable<AABB3>::value == true, "AABBs has to be trivially copyable"); static_assert(std::is_polymorphic<AABB3>::value == false, "AABBs should not be polymorphic"); // Implementation #include "AABB.hpp" // CPU & GPU // Zero Constants static constexpr AABB2f ZeroAABB2f = AABB2f(Vector2f(0.0f, 0.0f), Vector2f(0.0f, 0.0f)); static constexpr AABB3f ZeroAABB3f = AABB3f(Vector3f(0.0f, 0.0f, 0.0f), Vector3f(0.0f, 0.0f, 0.0f)); static constexpr AABB4f ZeroAABB4f = AABB4f(Vector4f(0.0f, 0.0f, 0.0f, 0.0f), Vector4f(0.0f, 0.0f, 0.0f, 0.0f)); static constexpr AABB2d ZeroAABB2d = AABB2d(Vector2d(0.0, 0.0), Vector2d(0.0, 0.0)); static constexpr AABB3d ZeroAABB3d = AABB3d(Vector3d(0.0, 0.0, 0.0), Vector3d(0.0, 0.0, 0.0)); static constexpr AABB4d ZeroAABB4d = AABB4d(Vector4d(0.0, 0.0, 0.0, 0.0), Vector4d(0.0, 0.0, 0.0, 0.0)); static constexpr AABB2f CoveringAABB2f = AABB2f(Vector2f(-FLT_MAX, -FLT_MAX), Vector2f(FLT_MAX, FLT_MAX)); static constexpr AABB3f CoveringAABB3f = AABB3f(Vector3f(-FLT_MAX, -FLT_MAX, -FLT_MAX), Vector3f(FLT_MAX, FLT_MAX, FLT_MAX)); static constexpr AABB4f CoveringAABB4f = AABB4f(Vector4f(-FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX), Vector4f(FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX)); static constexpr AABB2d CoveringAABB2d = AABB2d(Vector2d(-DBL_MAX, -DBL_MAX), Vector2d(DBL_MAX, DBL_MAX)); static constexpr AABB3d CoveringAABB3d = AABB3d(Vector3d(-DBL_MAX, -DBL_MAX, -DBL_MAX), Vector3d(DBL_MAX, DBL_MAX, DBL_MAX)); static constexpr AABB4d CoveringAABB4d = AABB4d(Vector4d(-DBL_MAX, -DBL_MAX, -DBL_MAX, -DBL_MAX), Vector4d(DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX)); static constexpr AABB2f NegativeAABB2f = AABB2f(Vector2f(FLT_MAX, FLT_MAX), Vector2f(-FLT_MAX, -FLT_MAX)); static constexpr AABB3f NegativeAABB3f = AABB3f(Vector3f(FLT_MAX, FLT_MAX, FLT_MAX), Vector3f(-FLT_MAX, -FLT_MAX, -FLT_MAX)); static constexpr AABB4f NegativeAABB4f = AABB4f(Vector4f(FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX), Vector4f(-FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX)); static constexpr AABB2d NegativeAABB2d = AABB2d(Vector2d(DBL_MAX, DBL_MAX), Vector2d(-DBL_MAX, -DBL_MAX)); static constexpr AABB3d NegativeAABB3d = AABB3d(Vector3d(DBL_MAX, DBL_MAX, DBL_MAX), Vector3d(-DBL_MAX, -DBL_MAX, -DBL_MAX)); static constexpr AABB4d NegativeAABB4d = AABB4d(Vector4d(DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX), Vector4d(-DBL_MAX, -DBL_MAX, -DBL_MAX, -DBL_MAX)); static constexpr AABB2 CoveringAABB2 = CoveringAABB2f; static constexpr AABB3 CoveringAABB3 = CoveringAABB3f; static constexpr AABB4 CoveringAABB4 = CoveringAABB4f; static constexpr AABB2 NegativeAABB2 = NegativeAABB2f; static constexpr AABB3 NegativeAABB3 = NegativeAABB3f; static constexpr AABB4 NegativeAABB4 = NegativeAABB4f; static constexpr AABB2 ZeroAABB2 = ZeroAABB2f; static constexpr AABB3 ZeroAABB3 = ZeroAABB3f; static constexpr AABB4 ZeroAABB4 = ZeroAABB4f; // AABB Extern extern template class AABB<2, float>; extern template class AABB<3, float>; extern template class AABB<4, float>; extern template class AABB<2, double>; extern template class AABB<3, double>; extern template class AABB<4, double>; ======================= File: Source/RayLib/MDistributor.h ======================= //#pragma once ///** // //Distributed version of MDistributor // //Each process will have single Distributor and a Tracer or Visor // //Visor is responsible for delegating commands to multiple Tracer Nodes //thorugh this interface (using udp or tcp we will see) // //*/ // //#include "DistributorI.h" //#include <asio.hpp> //#include <deque> // //using asio::ip::tcp; // //class MDistributor : public DistributorI //{ // // public: // enum Type // { // TRACER, // VISOR // }; // // struct Node // { // uint32_t id; // asio::ip::address adress; // // // }; // // // private: // bool isLeader; // std::deque<Node> nodes; // Node* leader; // // // Visor Callback (If this distributor is visor distributor) // SetImageSegmentFunc displayCallback; // // //... // // // protected: // // Interface // // Distributed Leader // void EliminateNode() override; // Leader removes node from the pool // void IntroduceNode() override; // Leader sends new node to pairs // // void StartFrame() override; // Send Start Frame Command // void RenderIntersect() override; // Main intersect command // void RenderGenRays() override; // Main ray generation command // void RenderEnd() override; // Main rendering end command // void AssignMaterial(uint32_t material, // Assign material to node // uint32_t node) override; // void PollNode(uint32_t) override; // PollNode to check if its not dead // // // Distributed Non-Leader // void RequestLeaderElection() override; // Request a Leader election // void RedirectCandidateNode() override; // Redirect new node to leader // // public: // // Constructors & Destructor // MDistributor(); // ~MDistributor() = default; // // // ================= // // // Tracer Related // // // ================= // // // Sending (All non-blocking) // void SendMaterialRays(uint32_t materialId, // const std::vector<RayStack>) override; // void SendMaterialRays(const std::vector<ArrayPortion<uint32_t>> materialIds, // const std::vector<RayStack>) override; // void SendImage(const std::vector<Vector3f> image, // const Vector2ui resolution, // const Vector2ui offset = Vector2ui(0, 0), // const Vector2ui size = Vector2ui(0, 0)) override; // // // Requesting (All are blocking) // void RequestObjectAccelerator() override; // void RequestObjectAccelerator(uint32_t objId) override; // void RequestObjectAccelerator(const std::vector<uint32_t>& objIds) override; // // void RequestScene() override; // void RequestSceneMaterial(uint32_t) override; // void RequestSceneObject(uint32_t) override; // // // Request rays that are responsible by this node // void RequestMaterialRays(const std::vector<RayStack>&) override; // // // Misc. // uint64_t NodeId() override; // uint64_t TotalCPUMemory() override; // uint64_t TotalGPUMemory() override; // // // Check if render is requested for this frame // bool CheckIfRenderRequested(uint32_t renderCount) override; // // Check if distributed system is distributed at all // bool Alone() override; // // // Recieving data from callbacks // void AttachCameraCallback(SetCameraFunc) override; // void AttachTimeCallback(SetTimeFunc) override; // void AttachParamCallback(SetParameterFunc) override; // void AttachFPSCallback(SetFPSFunc) override; // void AttachFrameCallback(SetFrameCallback) override; // // // ================= // // // Visor Related // // // ================= // // void SetImageStream(bool) override; // void SetImagePeriod(double seconds) override; // // // Visor Window I-O // void ChangeCamera(const CameraPerspective&) override; // void ChangeTime(double seconds) override; // void ChangeParameters() override; // void ChangeFPS(int fps) override; // void NextFrame() override; // void PreviousFrame() override; // // void AttachDisplayCallback(SetImageSegmentFunc) override; // // // Visor CLI // //... //}; ======================= File: Source/TracerLib/AcceleratorDeviceFunctions.h ======================= #pragma once #include "RayStructs.h" #include "RayLib/HitStructs.h" #include "RayLib/AABB.h" using HitKeyList = std::array<HitKey, SceneConstants::MaxPrimitivePerSurface>; using PrimitiveRangeList = std::array<Vector2ul, SceneConstants::MaxPrimitivePerSurface>; using HitResult = Vector<2, bool>; // This is Leaf of Base Accelerator // It points to another accelerator pair struct /*alignas(16)*/ BaseLeaf { Vector3f aabbMin; HitKey accKey; Vector3f aabbMax; TransformId transformId; }; // Accept hit function // Return two booleans first boolean tells control flow to terminate // intersection checking (when finding any hit is enough), // other boolean is returns that the hit is accepted or not. // // If hit is accepted Accept hit function should return // valid material key, primitiveId, and hit. // // Material Key is the index of material // Primitive id is the index of the individual primitive // Hit is the interpolting weights of the primitive // // PrimitiveData struct holds the array of the primitive data // (normal, position etc..) template <class HitData, class PrimitiveData, class LeafData> using AcceptHitFunction = HitResult(*)(// Output HitKey&, PrimitiveId&, HitData&, // I-O RayReg& r, // Input const LeafData& data, const PrimitiveData& gPrimData); template <class PrimitiveData, class LeafData> using LeafGenFunction = LeafData(*)(const HitKey matId, const PrimitiveId primitiveId, const PrimitiveData& primData); // Custom bounding box generation function // For primitive template <class PrimitiveData> using BoxGenFunction = AABB3f(*)(PrimitiveId primitiveId, const PrimitiveData&); // Surface area generation function for bound hierarcy generation template <class PrimitiveData> using AreaGenFunction = float(*)(PrimitiveId primitiveId, const PrimitiveData&); // Center generation function for bound hierarcy generation template <class PrimitiveData> using CenterGenFunction = Vector3(*)(PrimitiveId primitiveId, const PrimitiveData&); ======================= File: Source/RayLib/UTF8StringConversion.h ======================= #pragma once #include <string> namespace Utility { // Converts string to u8 inline std::u8string CopyStringU8(const std::string& s) { static_assert(sizeof(char8_t) == sizeof(char), "char8_t char size mismatch"); std::u8string u8String; u8String.resize(s.size(), u8'\0'); std::memcpy(u8String.data(), s.data(), s.size() * sizeof(char)); return u8String; } } ======================= File: Source/TracerLib/GPUAcceleratorI.h ======================= <filename>Source/TracerLib/GPUAcceleratorI.h #pragma once /** Base Interface for GPU accelerators */ #include <map> #include <set> #include <array> #include <cstdint> #include <functional> #include "RayLib/HitStructs.h" #include "RayLib/SceneStructs.h" #include "RayLib/AABB.h" #include "AcceleratorDeviceFunctions.h" struct RayGMem; struct SceneError; class CudaGPU; class CudaSystem; class GPUPrimitiveGroupI; class GPUMaterialGroupI; class SceneNodeI; using SceneNodePtr = std::unique_ptr<SceneNodeI>; // Accelerator Group defines same type of accelerators // This struct holds accelerator data // Unlike material group there is one to one relationship between // Accelerator batch and group since accelerator is strongly tied with primitive // However interface is split for consistency (to be like material group/batch) class GPUAcceleratorGroupI { public: virtual ~GPUAcceleratorGroupI() = default; // Interface // Type(as string) of the accelerator group virtual const char* Type() const = 0; // Loads required data to CPU cache for virtual SceneError InitializeGroup(// Accelerator Option Node const SceneNodePtr& node, // Map of hit keys for all materials // w.r.t matId and primitive type const std::map<TypeIdPair, HitKey>&, // List of surface/material // pairings that uses this accelerator type // and primitive type const std::map<uint32_t, IdPairs>& pairingList, double time) = 0; virtual SceneError ChangeTime(// Map of hit keys for all materials // w.r.t matId and primitive type const std::map<TypeIdPair, HitKey>&, // List of surface/material // pairings that uses this accelerator type // and primitive type const std::map<uint32_t, IdPairs>& pairingList, double time) = 0; // Surface Queries virtual uint32_t InnerId(uint32_t surfaceId) const = 0; // Batched and singular construction virtual TracerError ConstructAccelerators(const CudaSystem&) = 0; virtual TracerError ConstructAccelerator(uint32_t surface, const CudaSystem&) = 0; virtual TracerError ConstructAccelerators(const std::vector<uint32_t>& surfaces, const CudaSystem&) = 0; virtual TracerError DestroyAccelerators(const CudaSystem&) = 0; virtual TracerError DestroyAccelerator(uint32_t surface, const CudaSystem&) = 0; virtual TracerError DestroyAccelerators(const std::vector<uint32_t>& surfaces, const CudaSystem&) = 0; virtual size_t UsedGPUMemory() const = 0; virtual size_t UsedCPUMemory() const = 0; virtual const GPUPrimitiveGroupI& PrimitiveGroup() const = 0; }; // class GPUAcceleratorBatchI { public: virtual ~GPUAcceleratorBatchI() = default; // Interface // Type(as string) of the accelerator group virtual const char* Type() const = 0; // Kernel Logic virtual void Hit(const CudaGPU&, // O HitKey* dMaterialKeys, PrimitiveId* dPrimitiveIds, HitStructPtr dHitStructs, // I-O RayGMem* dRays, // Input const TransformId* dTransformIds, const RayId* dRayIds, const HitKey* dAcceleratorKeys, const uint32_t rayCount) const = 0; // Every MaterialBatch is available for a specific primitive / accelerator data virtual const GPUPrimitiveGroupI& PrimitiveGroup() const = 0; virtual const GPUAcceleratorGroupI& AcceleratorGroup() const = 0; }; class GPUBaseAcceleratorI { public: virtual ~GPUBaseAcceleratorI() = default; // Interface // Type(as string) of the accelerator group virtual const char* Type() const = 0; // Get ready for hit loop virtual void GetReady(const CudaSystem& system, uint32_t rayCount) = 0; // Base accelerator only points to the next accelerator key. // It can return invalid key, // which is either means data is out of bounds or ray is invalid. virtual void Hit(const CudaSystem&, // Output TransformId* dTransformIds, HitKey* dMaterialKeys, // Inputs const RayGMem* dRays, const RayId* dRayIds, const uint32_t rayCount) const = 0; // Initialization virtual SceneError Initialize(// Accelerator Option Node const SceneNodePtr& node, // List of surface to transform id hit key mappings const std::map<uint32_t, BaseLeaf>&) = 0; virtual SceneError Change(// List of only changed surface to transform id hit key mappings const std::map<uint32_t, BaseLeaf>&) = 0; // Construction & Destruction virtual TracerError Constrcut(const CudaSystem&) = 0; virtual TracerError Destruct(const CudaSystem&) = 0; }; ======================= File: Source/Tracer-Test/Tracers.h ======================= #pragma once //#include "TracerLib/TracerLogic.h" //#include "RayLib/Vector.h" // //struct SimpleRayData //{ // Vector3 totalIrrad; //}; // //extern template class TracerBaseLogic<SimpleRayData>; // //template<class T> //SceneError TracerLogicGenerator<T>::GetPrimitiveGroup(GPUPrimitiveGroupI*&, // const std::string& primitiveType) //{ // // // //We are one level higher //} // //template<class T> //SceneError TracerLogicGenerator<T>::GetAcceleratorGroup(GPUAcceleratorGroupI*&, // const GPUPrimitiveGroupI&, // const std::string& accelType) //{ // //Accelerator does not need anything related to asd //} // //template<class T> //SceneError TracerLogicGenerator<T>::GetMaterialGroup(GPUMaterialGroupI*&, // const GPUPrimitiveGroupI&, // const std::string& materialType) //{ // // Material Does need... //} ======================= File: Source/TracerLib/GPUPrimitiveTriangle.h ======================= #pragma once /** Default Triangle Implementation Has three types of data Position, Normal and UV. These data are indirected by a single index (like DirectX and OpenGL) All of them should be provided */ #include <map> #include "RayLib/PrimitiveDataTypes.h" #include "RayLib/Vector.h" #include "RayLib/Triangle.h" #include "DefaultLeaf.h" #include "GPUPrimitiveP.cuh" #include "DeviceMemory.h" #include "TypeTraits.h" class SurfaceDataLoaderI; using SurfaceDataLoaders = std::vector<std::unique_ptr<SurfaceDataLoaderI>>; // Triangle Memory Layout struct TriData { const Vector4f* positionsU; const Vector4f* normalsV; const uint64_t* indexList; }; // Triangle Hit is barycentric coordinates // c is (1-a-b) thus it is not stored. using TriangleHit = Vector2f; // Triangle Hit Acceptance __device__ __host__ inline HitResult TriangleClosestHit(// Output HitKey& newMat, PrimitiveId& newPrimitive, TriangleHit& newHit, // I-O RayReg& rayData, // Input const DefaultLeaf& leaf, const TriData& primData) { //if(leaf.matId.value == 0x2000002) //printf("PrimId %llu, MatId %x\n", leaf.primitiveId, leaf.matId.value); // Get Position uint64_t index0 = primData.indexList[leaf.primitiveId * 3 + 0]; uint64_t index1 = primData.indexList[leaf.primitiveId * 3 + 1]; uint64_t index2 = primData.indexList[leaf.primitiveId * 3 + 2]; Vector3 position0 = primData.positionsU[index0]; Vector3 position1 = primData.positionsU[index1]; Vector3 position2 = primData.positionsU[index2]; // Do Intersecton test Vector3 baryCoords; float newT; bool intersects = rayData.ray.IntersectsTriangle(baryCoords, newT, position0, position1, position2, true); // Check if the hit is closer bool closerHit = intersects && (newT < rayData.tMax); if(closerHit) { rayData.tMax = newT; newMat = leaf.matId; newPrimitive = leaf.primitiveId; newHit = Vector2(baryCoords[0], baryCoords[1]); } //printf("ray dir{%f, %f, %f} " // "old %f new %f --- Testing Mat: %x -> {%s, %s}\n", // rayData.ray.getDirection()[0], // rayData.ray.getDirection()[1], // rayData.ray.getDirection()[2], // oldT, newT, // leaf.matId.value, // closerHit? "Close!" : " ", // intersects? "Intersects!" : " "); return HitResult{false, closerHit}; } __device__ __host__ inline AABB3f GenerateAABBTriangle(PrimitiveId primitiveId, const TriData& primData) { // Get Position uint64_t index0 = primData.indexList[primitiveId * 3 + 0]; uint64_t index1 = primData.indexList[primitiveId * 3 + 1]; uint64_t index2 = primData.indexList[primitiveId * 3 + 2]; Vector3 position0 = primData.positionsU[index0]; Vector3 position1 = primData.positionsU[index1]; Vector3 position2 = primData.positionsU[index2]; return Triangle::BoundingBox(position0, position1, position2); } __device__ __host__ inline float GenerateAreaTriangle(PrimitiveId primitiveId, const TriData& primData) { // Get Position uint64_t index0 = primData.indexList[primitiveId * 3 + 0]; uint64_t index1 = primData.indexList[primitiveId * 3 + 1]; uint64_t index2 = primData.indexList[primitiveId * 3 + 2]; Vector3 position0 = primData.positionsU[index0]; Vector3 position1 = primData.positionsU[index1]; Vector3 position2 = primData.positionsU[index2]; // CCW Vector3 vec0 = position1 - position0; Vector3 vec1 = position2 - position0; return Cross(vec0, vec1).Length() * 0.5f; } __device__ __host__ inline Vector3 GenerateCenterTriangle(PrimitiveId primitiveId, const TriData& primData) { // Get Position uint64_t index0 = primData.indexList[primitiveId * 3 + 0]; uint64_t index1 = primData.indexList[primitiveId * 3 + 1]; uint64_t index2 = primData.indexList[primitiveId * 3 + 2]; Vector3 position0 = primData.positionsU[index0]; Vector3 position1 = primData.positionsU[index1]; Vector3 position2 = primData.positionsU[index2]; return position0 * 0.33333f + position1 * 0.33333f + position2 * 0.33333f; } class GPUPrimitiveTriangle final : public GPUPrimitiveGroup<TriangleHit, TriData, DefaultLeaf, TriangleClosestHit, GenerateDefaultLeaf, GenerateAABBTriangle, GenerateAreaTriangle, GenerateCenterTriangle> { public: static constexpr const char* TypeName() { return "Triangle"; } static constexpr PrimitiveDataLayout POS_LAYOUT = PrimitiveDataLayout::FLOAT_3; static constexpr PrimitiveDataLayout UV_LAYOUT = PrimitiveDataLayout::FLOAT_2; static constexpr PrimitiveDataLayout NORMAL_LAYOUT = PrimitiveDataLayout::FLOAT_3; static constexpr PrimitiveDataLayout INDEX_LAYOUT = PrimitiveDataLayout::UINT64_1; private: DeviceMemory memory; // List of ranges for each batch uint64_t totalPrimitiveCount; uint64_t totalDataCount; std::map<uint32_t, Vector2ul> batchRanges; std::map<uint32_t, Vector2ul> batchDataRanges; std::map<uint32_t, AABB3> batchAABBs; protected: public: // Constructors & Destructor GPUPrimitiveTriangle(); ~GPUPrimitiveTriangle() = default; // Interface // Pirmitive type is used for delegating scene info to this class const char* Type() const override; // Allocates and Generates Data SceneError InitializeGroup(const NodeListing& surfaceDataNodes, double time, const SurfaceLoaderGeneratorI&, const std::string& scenePath) override; SceneError ChangeTime(const NodeListing& surfaceDataNodes, double time, const SurfaceLoaderGeneratorI&, const std::string& scenePath) override; // Provides data to Event Estimator bool HasPrimitive(uint32_t surfaceDataId) const override; SceneError GenerateEstimatorInfo(std::vector<EstimatorInfo>&, const Vector3& power, HitKey key, uint32_t surfaceDataId) const override; // Access primitive range from Id Vector2ul PrimitiveBatchRange(uint32_t surfaceDataId) const override; AABB3 PrimitiveBatchAABB(uint32_t surfaceDataId) const override; // Error check // Queries in order to check if this primitive group supports certain primitive data // Material may need that data bool CanGenerateData(const std::string& s) const override; }; static_assert(IsTracerClass<GPUPrimitiveTriangle>::value, "GPUPrimitiveTriangle is not a Tracer Class."); ======================= File: Source/TracerLib/GPUMaterialI.h ======================= #pragma once /** */ #include <cstdint> #include "RayLib/HitStructs.h" #include "RayLib/Vector.h" #include "NodeListing.h" struct RayGMem; struct SceneError; class CudaGPU; class SceneNodeI; class RNGMemory; class ImageMemory; class GPUPrimitiveGroupI; class GPUEventEstimatorI; // Defines the same type materials // Logics consists of loading unloading certain material // This struct holds the material data in a batched fashion (textures arrays etc) // These are singular and can be shared by multiple accelrator batches class GPUMaterialGroupI { public: virtual ~GPUMaterialGroupI() = default; // Interface // Type (as string) of the primitive group virtual const char* Type() const = 0; // Allocates and Generates Data virtual SceneError InitializeGroup(const NodeListing& materialNodes, double time, const std::string& scenePath) = 0; virtual SceneError ChangeTime(const NodeListing& materialNodes, double time, const std::string& scenePath) = 0; // Material Queries virtual int InnerId(uint32_t materialId) const = 0; virtual bool HasCachedTextures(uint32_t materialId) const = 0; virtual const CudaGPU& GPU() const = 0; virtual const GPUEventEstimatorI& EventEstimator() const = 0; virtual size_t UsedGPUMemory() const = 0; virtual size_t UsedCPUMemory() const = 0; virtual size_t UsedGPUMemory(uint32_t materialId) const = 0; virtual size_t UsedCPUMemory(uint32_t materialId) const = 0; virtual uint8_t OutRayCount() const = 0; }; // Defines call action over a certain material group // The batch further specializes over a primitive logic // which defines how certain primitive data could be fetched class GPUMaterialBatchI { public: virtual ~GPUMaterialBatchI() = default; // Interface // Type (as string) of the primitive group virtual const char* Type() const = 0; // Kernel Call virtual void ShadeRays(// Output ImageMemory& dImage, // HitKey* dBoundMatOut, RayGMem* dRayOut, void* dRayAuxOut, // Input const RayGMem* dRayIn, const void* dRayAuxIn, const PrimitiveId* dPrimitiveIds, const HitStructPtr dHitStructs, // Ids const HitKey* dMatIds, const RayId* dRayIds, // const uint32_t rayCount, RNGMemory& rngMem) const = 0; // Every MaterialBatch is available for a specific primitive / material data virtual const GPUPrimitiveGroupI& PrimitiveGroup() const = 0; virtual const GPUMaterialGroupI& MaterialGroup() const = 0; virtual uint8_t OutRayCount() const = 0; }; ======================= File: Source/TracerLib/DefaultLeaf.h ======================= <gh_stars>0 #pragma once #include "RayLib/HitStructs.h" // Default Leaf Struct // Most of the leaf structs will have these // data but still it is user defined. struct DefaultLeaf { PrimitiveId primitiveId; HitKey matId; }; struct EmptyLeaf {}; template <class PrimData> __device__ __host__ inline EmptyLeaf GenerateEmptyLeaf(const HitKey matId, const PrimitiveId primitiveId, const PrimData& primData) { return {}; } template <class PrimData> __device__ __host__ inline DefaultLeaf GenerateDefaultLeaf(const HitKey matId, const PrimitiveId primitiveId, const PrimData& primData) { return DefaultLeaf{primitiveId, matId}; } ======================= File: Source/RayLib/ImageStructs.h ======================= <reponame>yalcinerbora/meturay #pragma once enum class ImageType { // SDR Types PNG // TODO: Do other SDR types // TODO: Do HDR Types }; ======================= File: Source/VisorGL/ShaderGL.h ======================= <reponame>yalcinerbora/meturay #pragma once /** Shader Class that Compiles and Binds Shaders */ #include <GL\glew.h> #include <string> enum class ShaderType { VERTEX, TESS_C, TESS_E, GEOMETRY, FRAGMENT, COMPUTE }; class ShaderGL { private: // Global Variables static GLuint shaderPipelineID; static int shaderCount; // Properties GLuint shaderID; ShaderType shaderType; bool valid; static GLenum ShaderTypeToGL(ShaderType); static GLenum ShaderTypeToGLBit(ShaderType); protected: public: // Constructors & Destructor ShaderGL(); ShaderGL(ShaderType, const std::u8string& path); ShaderGL(ShaderGL&&) noexcept; ShaderGL(const ShaderGL&) = delete; ShaderGL& operator=(ShaderGL&&) noexcept; ShaderGL& operator=(const ShaderGL&) = delete; ~ShaderGL(); // Renderer Usage void Bind(); bool IsValid() const; static void Unbind(ShaderType); }; ======================= File: Source/TracerLib/MangledNames.h ======================= #pragma once #include <string> namespace MangledNames { const std::string MaterialGroup(const char* tracerLogicName, const char* estimatorLogicName, const char* materialGroupName); const std::string MaterialBatch(const char* tracerLogicName, const char* estimatorLogicName, const char* primitiveGroupName, const char* materialGroupName); const std::string AcceleratorGroup(const char* primitiveGroupName, const char* acceleratorGroupName); } #define ACCELERATOR_TYPE_NAME(name, P)\ public: static const char* TypeName()\ {\ static std::string typeName = MangledNames::AcceleratorGroup(##P##::TypeName(),\ ##name##);\ return typeName.c_str();\ } #define MATERIAL_TYPE_NAME(name, T, E) \ public:\ static const char* Name()\ {\ return ##name##; \ }\ static const char* TypeName()\ {\ static const std::string typeName = MangledNames::MaterialGroup(##T##::TypeName(),\ ##E##::TypeName(),\ ##name##);\ return typeName.c_str();\ } ======================= File: Source/RayLib/Types.h ======================= #pragma once /** */ typedef unsigned char Byte; static constexpr uint16_t NullBatchId = 0; static constexpr uint16_t BYTE_BITS = 8; enum class PixelFormat { R8_UNORM, RG8_UNORM, RGB8_UNORM, RGBA8_UNORM, R16_UNORM, RG16_UNORM, RGB16_UNORM, RGBA16_UNORM, R_HALF, RG_HALF, RGB_HALF, RGBA_HALF, R_FLOAT, RG_FLOAT, RGB_FLOAT, RGBA_FLOAT, END }; enum class DataType { // Float Data Types HALF_1, // one component IEEE 754 (16-bit) floating point number HALF_2, // two component "" HALF_3, // three component "" HALF_4, // four component "" FLOAT_1, // one component IEEE 754 (32-bit) floating point number FLOAT_2, // two component "" FLOAT_3, // three component "" FLOAT_4, // four component "" DOUBLE_1, // one component IEEE 754 (64-bit) floating point number DOUBLE_2, // two component "" DOUBLE_3, // three component "" DOUBLE_4, // four component "" // Nobody will ever use this in this decade but w/e QUADRUPLE_1, // one component IEEE 754 (128-bit) floating point number QUADRUPLE_2, // two component "" QUADRUPLE_3, // three component "" QUADRUPLE_4, // four component "" // Integers // 8-bit INT8_1, INT8_2, INT8_3, INT8_4, UINT8_1, UINT8_2, UINT8_3, UINT8_4, // 16-bit INT16_1, INT16_2, INT16_3, INT16_4, UINT16_1, UINT16_2, UINT16_3, UINT16_4, // 32-bit INT32_1, INT32_2, INT32_3, INT32_4, UINT32_1, UINT32_2, UINT32_3, UINT32_4, // 64-bit INT64_1, INT64_2, INT64_3, INT64_4, UINT64_1, UINT64_2, UINT64_3, UINT64_4, // Normalized Data Types (DX UNORM or NORM) // Fixed Point // Definition of UNORM/NORM can be found here // http://msdn.microsoft.com/en-us/library/windows/desktop/dd607323(v=vs.85).aspx // 8-bit NORM8_1, NORM8_2, NORM8_3, NORM8_4, UNORM8_1, UNORM8_2, UNORM8_3, UNORM8_4, // 16-bit NORM16_1, NORM16_2, NORM16_3, NORM16_4, UNORM16_1, UNORM16_2, UNORM16_3, UNORM16_4, // 32-bit NORM32_1, NORM32_2, NORM32_3, NORM32_4, UNORM32_1, UNORM32_2, UNORM32_3, UNORM32_4, END }; ======================= File: Source/RayLib/Sphere.h ======================= <gh_stars>0 #pragma once #include "Vector.h" #include "AABB.h" namespace Sphere { template<class T> __host__ __device__ AABB<3, T> BoundingBox(const Vector<3, T>& center, T radius); } template<class T> __host__ __device__ inline AABB<3, T> Sphere::BoundingBox(const Vector<3, T>& center, T radius) { return AABB<3, T>(center - radius, center + radius); } ======================= File: Source/TracerLib/RNGMemory.h ======================= <gh_stars>0 #pragma once /** */ #include <map> #include "DeviceMemory.h" #include "RNGStructs.h" class CudaGPU; class CudaSystem; class RNGMemory { private: DeviceMemory memRandom; std::map<const CudaGPU*, RNGGMem> randomStacks; protected: public: // Constructors & Destructor RNGMemory() = default; RNGMemory(uint32_t seed, const CudaSystem&); RNGMemory(const RNGMemory&) = delete; RNGMemory(RNGMemory&&) = default; RNGMemory& operator=(const RNGMemory&) = delete; RNGMemory& operator=(RNGMemory&&) = default; ~RNGMemory() = default; RNGGMem RNGData(const CudaGPU&); }; ======================= File: Source/Tracer-Test/EntryPoints.h ======================= #pragma once #include "TracerLib/TracerLogicI.h" #include "RayLib/TracerStructs.h" #include "TracerLib/TracerLogicPools.h" extern "C" _declspec(dllexport) MaterialLogicPoolI* __stdcall GenerateTestMaterialPool(); extern "C" _declspec(dllexport) TracerLogicPoolI * __stdcall GenerateTestTracerPool(); extern "C" _declspec(dllexport) void __stdcall DeleteTestTracerPool(TracerLogicPoolI*); extern "C" _declspec(dllexport) void __stdcall DeleteTestMaterialPool(MaterialLogicPoolI*); ======================= File: Source/TracerLib/TracerBase.h ======================= #pragma once /** Tracer Implementation for CUDA arcitechture (Actually all projects are pretty corralated with CUDA this abstraction is not necessary however it is always good to split implementation from actual call.) This is a Threaded Implementation. This is multi-gpu aware implementation. Single thread will */ #include <deque> #include <functional> #include <set> #include <map> #include <sstream> #include "RayLib/TracerStructs.h" #include "RayLib/TracerI.h" #include "RNGMemory.h" #include "RayMemory.h" #include "ImageMemory.h" class CudaSystem; class TracerBaseLogicI; class TracerLogicGeneratorI; struct TracerError; class TracerBase : public TracerI { private: // Cuda System For Kernel Calls const CudaSystem& cudaSystem; // Common Memory RNGMemory rngMemory; RayMemory rayMemory; ImageMemory outputImage; // Properties int sampleCountPerRay; uint32_t currentRayCount; TracerOptions options; // Base tracer logic TracerBaseLogicI* currentLogic; TracerCallbacksI* callbacks; // Error related bool healthy; // Internals template <class... Args> void SendLog(const char*, Args...); void SendError(TracerError e, bool isFatal); // Fundamental Hit / Shade Loop void HitRays(); void ShadeRays(); public: // Constructors & Destructor TracerBase(CudaSystem& system); TracerBase(const TracerBase&) = delete; TracerBase& operator=(const TracerBase&) = delete; ~TracerBase() = default; // =====================// // RESPONSE FROM TRACER // // =====================// // Callbacks void AttachTracerCallbacks(TracerCallbacksI&) override; // ===================// // COMMANDS TO TRACER // // ===================// // Main Calls TracerError Initialize() override; void SetOptions(const TracerOptions&) override; // Requests void RequestBaseAccelerator() override; void RequestAccelerator(HitKey key) override; // TODO: add sharing of other generated data (maybe interpolations etc.) // and their equavilent callbacks // Rendering Related void AttachLogic(TracerBaseLogicI&) override; void GenerateInitialRays(const GPUSceneI& scene, int cameraId, int samplePerLocation) override; void GenerateInitialRays(const GPUSceneI& scene, const CameraPerspective&, int samplePerLocation) override; bool Continue() override; // Continue hit/bounce looping (consume ray pool) void Render() override; // Render rays (do hit, then bounce) void FinishSamples() override; // Finish samples (write to image) // Image Related void SetImagePixelFormat(PixelFormat) override; void ReportionImage(Vector2i start = Zero2i, Vector2i end = BaseConstants::IMAGE_MAX_SIZE) override; void ResizeImage(Vector2i resolution) override; void ResetImage() override; }; inline void TracerBase::AttachTracerCallbacks(TracerCallbacksI& tc) { callbacks = &tc; } ======================= File: Source/RayLib/TracerError.h ======================= <reponame>yalcinerbora/meturay #pragma once /** Tracer error "Enumeration" */ #include "Error.h" #include <stdexcept> struct TracerError : public ErrorI { public: enum Type { OK, // Logical NO_LOGIC_SET, // General CPU_OUT_OF_MEMORY, GPU_OUT_OF_MEMORY, // Accelerator Related UNABLE_TO_CONSTRUCT_ACCELERATOR, UNABLE_TO_CONSTRUCT_BASE_ACCELERATOR, //... // End END }; private: Type type; public: // Constructors & Destructor TracerError(Type); ~TracerError() = default; operator Type() const; operator std::string() const override; }; class TracerException : public std::runtime_error { private: TracerError e; protected: public: TracerException(TracerError::Type t) : std::runtime_error("") , e(t) {} TracerException(TracerError::Type t, const char* const err) : std::runtime_error(err) , e(t) {} operator TracerError() const { return e; }; }; inline TracerError::TracerError(TracerError::Type t) : type(t) {} inline TracerError::operator Type() const { return type; } inline TracerError::operator std::string() const { static constexpr char const* const ErrorStrings[] = { "OK", "No Tracer Logic is set", // General "CPU is out of memory", "GPU is out of memory", // Accelerator Related "Unable to construct Accelerator", "Unable to construct BaseAccelerator" }; static_assert((sizeof(ErrorStrings) / sizeof(const char*)) == static_cast<size_t>(TracerError::END), "Enum and enum string list size mismatch."); return ErrorStrings[static_cast<int>(type)]; } ======================= File: Source/RayLib/HemiDistribution.h ======================= #pragma once #include <cuda.h> #include <cuda_runtime.h> #include <type_traits> #include "Constants.h" #include "Vector.h" namespace HemiDistribution { // Hemi template <class T, class = FloatEnable<T>> __device__ __host__ inline T HemiPDF(T cosTetha) { return cos(cosTetha) * static_cast<T>(MathConstants::Pi_d); } template <class T, class = FloatEnable<T>> __device__ __host__ inline Vector<3, T> HemiCosineCDF(const Vector<2, T>& xi) { T xi1Coeff = 2 * static_cast<T>(MathConstants::Pi_d) * xi[1]; Vector<3,T> dir; dir[0] = sqrt(xi[0]) * cos(xi1Coeff); dir[1] = sqrt(xi[0]) * sin(xi1Coeff); dir[2] = sqrt(1 - dir[0] * dir[0] - dir[1] * dir[1]); return dir; } template <class T, class = FloatEnable<T>> __device__ __host__ inline Vector<3, T> HemiUniformCDF(const Vector<2, T>& xi) { T xi0Coeff = 1 - xi[0] * xi[0]; T xi1Coeff = 2 * static_cast<T>(MathConstants::Pi_d) * xi[1]; Vector<3,T> dir; dir[0] = sqrt(xi0Coeff) * cos(xi1Coeff); dir[1] = sqrt(xi0Coeff) * sin(xi1Coeff); dir[2] = xi[0]; return dir; } } ======================= File: Source/RayLib/VisorI.h ======================= <gh_stars>0 #pragma once /** Visor Interface Visor is a standalone program to monitor current image that si being rendered by Tracers VisorView Interface encapsulates rendering window and real-time GPU portion Visor */ #include <cstddef> #include <vector> #include "Types.h" #include "Vector.h" #include "Constants.h" class VisorInputI; class VisorCallbacksI; struct VisorOptions { // Technical size_t eventBufferSize; // Window Related bool stereoOn; bool vSyncOn; PixelFormat wFormat; Vector2i wSize; float fpsLimit; // Image Related Vector2i iSize; PixelFormat iFormat; }; class VisorI { public: virtual ~VisorI() = default; // Interface virtual bool IsOpen() = 0; virtual void Render() = 0; virtual void ProcessInputs() = 0; // Input System virtual void SetInputScheme(VisorInputI&) = 0; // Data Related // Set the resolution of the rendering data virtual void SetImageRes(Vector2i resolution) = 0; virtual void SetImageFormat(PixelFormat f) = 0; // Reset Data (Clears the RGB(A) Buffer of the Image) // and resets total accumulated rays virtual void ResetSamples(Vector2i start = Zero2i, Vector2i end = BaseConstants::IMAGE_MAX_SIZE) = 0; // Append incoming data from virtual void AccumulatePortion(const std::vector<Byte> data, PixelFormat, size_t offset, Vector2i start = Zero2i, Vector2i end = BaseConstants::IMAGE_MAX_SIZE) = 0; // Options virtual const VisorOptions& VisorOpts() const = 0; // Misc virtual void SetWindowSize(const Vector2i& size) = 0; virtual void SetFPSLimit(float) = 0; virtual Vector2i MonitorResolution() const = 0; }; ======================= File: Source/TracerLib/GPUSceneJson.h ======================= #pragma once #include <vector> #include <nlohmann/json_fwd.hpp> #include "RayLib/Camera.h" #include "RayLib/SceneStructs.h" #include "RayLib/GPUSceneI.h" #include "DeviceMemory.h" #include "AcceleratorDeviceFunctions.h" #include "CudaConstants.h" #include "ScenePartitionerI.h" struct SceneError; class SceneNodeI; class ScenePartitionerI; class TracerLogicGeneratorI; class SurfaceLoaderGeneratorI; using IndexLookup = std::map<NodeId, std::pair<NodeIndex, InnerIndex>>; using PrimitiveNodeList = std::map<std::string, NodeListing>; using AcceleratorBatchList = std::map<std::string, AccelGroupData>; using LightPrimitives = std::vector<const GPUPrimitiveGroupI*>; class GPUSceneJson : public GPUSceneI { public: enum IdBasedNodeType { ACCELERATOR, MATERIAL, PRIMITIVE, TRANSFORM, SURFACE_DATA }; private: static constexpr const size_t AlignByteCount = 128; // Fundamental TracerLogicGeneratorI& logicGenerator; ScenePartitionerI& partitioner; const SurfaceLoaderGeneratorI& surfaceLoaderGenerator; // Loaded Vector2i maxAccelIds; Vector2i maxMatIds; HitKey baseBoundaryMatKey; // GPU Memory DeviceMemory memory; // CPU Memory std::vector<CameraPerspective> cameraMemory; // File Related std::unique_ptr<nlohmann::json> sceneJson; std::u8string fileName; std::string parentPath; double currentTime; // GPU Pointers LightStruct* dLights; TransformStruct* dTransforms; // Inners // Helper Logic SceneError OpenFile(const std::u8string& fileName); bool FindNode(const nlohmann::json*& node, const char* name); static SceneError GenIdLookup(IndexLookup&, const nlohmann::json& array, IdBasedNodeType); // Private Load Functionality SceneError GenerateConstructionData(// Striped Listings (Striped from unsued nodes) PrimitiveNodeList& primGroupNodes, // MaterialNodeList& matGroupNodes, MaterialBatchList& matBatchListings, AcceleratorBatchList& accelBatchListings, // Estimator Related NodeListing& lightList, // Base Accelerator required data std::map<uint32_t, uint32_t>& surfaceTransformIds, // Types const std::string& estimatorType, const std::string& tracerType, // double time = 0.0); SceneError GeneratePrimitiveGroups(const PrimitiveNodeList&, double time = 0.0); SceneError GenerateMaterialGroups(const MultiGPUMatNodes&, double time = 0.0); SceneError GenerateMaterialBatches(MaterialKeyListing&, const MultiGPUMatBatches&, double time = 0.0); SceneError GenerateAccelerators(std::map<uint32_t, AABB3>& accAABBs, std::map<uint32_t, HitKey>& accHitKeyList, // const AcceleratorBatchList& acceleratorBatchList, const MaterialKeyListing& matHitKeyList, double time = 0.0); SceneError GenerateBaseAccelerator(const std::map<uint32_t, AABB3>& accAABBs, const std::map<uint32_t, HitKey>& accHitKeyList, const std::map<uint32_t, uint32_t>& surfaceTransformIds, double time = 0.0); SceneError FindBoundaryMaterial(const MaterialKeyListing& matHitKeyList, double time = 0.0f); SceneError LoadCommon(double time); SceneError LoadLogicRelated(const TracerParameters&, double); SceneError ChangeCommon(double time); SceneError ChangeLogicRelated(double time); public: // Constructors & Destructor GPUSceneJson(const std::u8string&, ScenePartitionerI&, TracerLogicGeneratorI&, const SurfaceLoaderGeneratorI&); GPUSceneJson(const GPUSceneJson&) = delete; GPUSceneJson(GPUSceneJson&&) = default; GPUSceneJson& operator=(const GPUSceneJson&) = delete; ~GPUSceneJson() = default; // Members size_t UsedGPUMemory() override; size_t UsedCPUMemory() override; // SceneError LoadScene(const TracerParameters&, double) override; SceneError ChangeTime(double) override; // Vector2i MaxMatIds() override; Vector2i MaxAccelIds() override; HitKey BaseBoundaryMaterial() override; // Access GPU const LightStruct* LightsGPU() const override; const TransformStruct* TransformsGPU() const override; // Access CPU const CameraPerspective* CamerasCPU() const override; }; ======================= File: Source/RayLib/VisorNode.h ======================= #pragma once /** V This Distributor is user interfacable thorugh Visor and Analytic Classes/Programs. This deleagtes user input and recieves user output (image) */ #include "VisorCallbacksI.h" #include "DistributorI.h" class VisorNodeI : public VisorCallbacksI , public DistributorI { }; ======================= File: Source/TracerLib/TracerLogicI.h ======================= #pragma once /** Tracer Logic: Responsible for containing logic CUDA Tracer This wll be wrapped by a template class which partially implements some portions of the main code That interface is responsible for fetching */ #include <cstdint> #include <map> #include "RayLib/Constants.h" #include "RayLib/Vector.h" #include "RayLib/Camera.h" #include "RayLib/TracerStructs.h" #include "RayLib/HitStructs.h" // Common Memory class RayMemory; class RNGMemory; class ImageMemory; struct TracerError; struct CameraPerspective; class CudaSystem; class GPUSceneI; class GPUBaseAcceleratorI; class GPUAcceleratorBatchI; class GPUMaterialBatchI; class GPUEventEstimatorI; class TracerBaseLogicI { public: virtual ~TracerBaseLogicI() = default; // Interface virtual TracerError Initialize() = 0; // Generate Rays virtual uint32_t GenerateRays(const CudaSystem& cudaSystem, // ImageMemory&, RayMemory&, RNGMemory&, const GPUSceneI&, const CameraPerspective&, int samplePerLocation, Vector2i resolution, Vector2i pixelStart = Zero2i, Vector2i pixelEnd = BaseConstants::IMAGE_MAX_SIZE) = 0; // Interface fetching for logic virtual GPUBaseAcceleratorI& BaseAcelerator() = 0; virtual const AcceleratorBatchMappings& AcceleratorBatches() = 0; virtual const MaterialBatchMappings& MaterialBatches() = 0; virtual const AcceleratorGroupList& AcceleratorGroups() = 0; virtual const MaterialGroupList& MaterialGroups() = 0; virtual GPUEventEstimatorI& EventEstimator() = 0; // Returns max bits of keys (for batch and id respectively) virtual const Vector2i SceneMaterialMaxBits() const = 0; virtual const Vector2i SceneAcceleratorMaxBits() const = 0; virtual const HitKey SceneBaseBoundMatKey() const = 0; // Options of the Hitman & Shademan virtual const HitOpts& HitOptions() const = 0; virtual const ShadeOpts& ShadeOptions() const = 0; // Misc // Retuns "sizeof(RayAux)" virtual size_t PerRayAuxDataSize() const = 0; // Return mimimum size of an arbitrary struct which holds all hit results virtual size_t HitStructSize() const = 0; // Random seed virtual uint32_t Seed() const = 0; }; ======================= File: Source/RayLib/VisorInputI.h ======================= <gh_stars>0 #pragma once /** MVisorInput Interface Can be attached to a Visor to capture window actions */ #include <functional> #include "VisorInputStructs.h" class VisorCallbacksI; using KeyCallbacks = std::multimap<std::pair<KeyboardKeyType, KeyAction>, std::function<void()>>; using MouseButtonCallbacks = std::multimap<std::pair<MouseButtonType, KeyAction>, std::function<void()>>; class VisorInputI { private: KeyCallbacks keyCallbacks; MouseButtonCallbacks buttonCallbacks; void KeyboardUsedWithCallbacks(KeyboardKeyType key, KeyAction action); void MouseButtonUsedWithCallbacks(MouseButtonType button, KeyAction action); protected: public: virtual ~VisorInputI() = default; // Interface virtual void AttachVisorCallback(VisorCallbacksI&) = 0; virtual void WindowPosChanged(int posX, int posY) = 0; virtual void WindowFBChanged(int fbWidth, int fbHeight) = 0; virtual void WindowSizeChanged(int width, int height) = 0; virtual void WindowClosed() = 0; virtual void WindowRefreshed() = 0; virtual void WindowFocused(bool) = 0; virtual void WindowMinimized(bool) = 0; virtual void MouseScrolled(double xOffset, double yOffset) = 0; virtual void MouseMoved(double x, double y) = 0; virtual void KeyboardUsed(KeyboardKeyType key, KeyAction action) = 0; virtual void MouseButtonUsed(MouseButtonType button, KeyAction action) = 0; // Defining Custom Callback template <class Function, class... Args> void AddKeyCallback(KeyboardKeyType, KeyAction, Function&& f, Args&&... args); template <class Function, class... Args> void AddButtonCallback(MouseButtonType, KeyAction, Function&& f, Args&&... args); }; template <class Function, class... Args> void VisorInputI::AddKeyCallback(KeyboardKeyType key, KeyAction action, Function&& f, Args&&... args) { std::function<void()> func = std::bind(f, args...); keyCallbacks.emplace(std::make_pair(key, action), func); } template <class Function, class... Args> void VisorInputI::AddButtonCallback(MouseButtonType button, KeyAction action, Function&& f, Args&&... args) { std::function<void()> func = std::bind(f, args...); buttonCallbacks.emplace(std::make_pair(button, action), func); } inline void VisorInputI::KeyboardUsedWithCallbacks(KeyboardKeyType key, KeyAction action) { KeyboardUsed(key, action); auto range = keyCallbacks.equal_range(std::make_pair(key, action)); for(auto it = range.first; it!= range.second; ++it) { // Call Those Functions it->second(); } } inline void VisorInputI::MouseButtonUsedWithCallbacks(MouseButtonType button, KeyAction action) { MouseButtonUsed(button, action); auto range = buttonCallbacks.equal_range(std::make_pair(button, action)); for(auto it = range.first; it!= range.second; ++it) { // Call Those Functions it->second(); } } ======================= File: Source/TracerLib/ImageMemory.h ======================= #pragma once /** Basic output image memory Used by tracers */ #include <vector> #include "RayLib/Types.h" #include "RayLib/Vector.h" #include "DeviceMemory.h" #include "ImageStructs.h" class CudaSystem; class ImageMemory { private: static constexpr size_t AlignByteCount = 16; DeviceMemory memory; PixelFormat format; int pixelSize; Vector2i segmentSize; Vector2i segmentOffset; Vector2i resolution; static int PixelFormatToSize(PixelFormat); void* dPixels; uint32_t* dSampleCounts; protected: public: // Constructors & Destructors ImageMemory(); ImageMemory(const Vector2i& offset, const Vector2i& size, const Vector2i& resolution, PixelFormat f); ImageMemory(const ImageMemory&) = delete; ImageMemory(ImageMemory&&) = default; ImageMemory& operator=(const ImageMemory&) = delete; ImageMemory& operator=(ImageMemory&&) = default; ~ImageMemory() = default; void SetPixelFormat(PixelFormat, const CudaSystem& s); void Reportion(Vector2i offset, Vector2i size, const CudaSystem& system); void Resize(Vector2i resolution); void Reset(const CudaSystem& system); // Getters Vector2i SegmentSize() const; Vector2i SegmentOffset() const; Vector2i Resolution() const; PixelFormat Format() const; int PixelSize() const; // Image Global Memory template <class T> ImageGMem<T> GMem(); template <class T> ImageGMemConst<T> GMem() const; // Direct CPU std::vector<Byte> GetImageToCPU(const CudaSystem&); }; inline Vector2i ImageMemory::SegmentSize() const { return segmentSize; } inline Vector2i ImageMemory::SegmentOffset() const { return segmentOffset; } inline Vector2i ImageMemory::Resolution() const { return resolution; } inline PixelFormat ImageMemory::Format() const { return format; } inline int ImageMemory::PixelSize() const { return pixelSize; } template<class T> inline ImageGMem<T> ImageMemory::GMem() { return ImageGMem<T>{static_cast<T*>(dPixels), dSampleCounts}; } template<class T> inline ImageGMemConst<T> ImageMemory::GMem() const { return ImageGMemConst<T>{static_cast<T*>(dPixels), dSampleCounts}; } ======================= File: Source/TracerLib/TracerTypeGenerators.h ======================= <reponame>yalcinerbora/meturay<gh_stars>0 #pragma once /** Default type generation functions Most of the time each DLL will came with its own Class construction functions (which means calling constructor would suffice) These functions define how generators should be defined. If a type will be generated accross DLL boundaries it should declare It also hints how a constructor should be defined. Accelerator should take primitive as an input. (since those types are storngly tied) */ #include "RayLib/ObjectFuncDefinitions.h" #include "RayLib/SceneStructs.h" #include "RayLib/TracerStructs.h" class TracerBaseLogicI; class GPUEventEstimatorI; class GPUBaseAcceleratorI; class GPUAcceleratorGroupI; class GPUPrimitiveGroupI; class GPUMaterialGroupI; class GPUAcceleratorBatchI; class GPUMaterialBatchI; class CudaGPU; // Fundamental Pointers whichalso support creation-deletion // across dll boundaries using GPUTracerPtr = SharedLibPtr<TracerBaseLogicI>; using GPUBaseAccelPtr = SharedLibPtr<GPUBaseAcceleratorI>; using GPUAccelGPtr = SharedLibPtr<GPUAcceleratorGroupI>; using GPUPrimGPtr = SharedLibPtr<GPUPrimitiveGroupI>; using GPUMatGPtr = SharedLibPtr<GPUMaterialGroupI>; using GPUAccelBPtr = SharedLibPtr<GPUAcceleratorBatchI>; using GPUMatBPtr = SharedLibPtr<GPUMaterialBatchI>; using GPUEstimatorPtr = SharedLibPtr<GPUEventEstimatorI>; // Statically Inerfaced Generators template<class TracerLogic> using TracerLogicGeneratorFunc = TracerLogic* (*)(GPUBaseAcceleratorI& baseAccelerator, AcceleratorGroupList&& ag, AcceleratorBatchMappings&& ab, MaterialGroupList&& mg, MaterialBatchMappings&& mb, GPUEventEstimatorI& ee, // const TracerParameters& params, uint32_t hitStructSize, const Vector2i maxMats, const Vector2i maxAccels, const HitKey baseBoundMatKey); template<class Accel> using AccelGroupGeneratorFunc = Accel* (*)(const GPUPrimitiveGroupI&, const TransformStruct*); template<class AccelBatch> using AccelBatchGeneratorFunc = AccelBatch* (*)(const GPUAcceleratorGroupI&, const GPUPrimitiveGroupI&); template<class MaterialGroup> using MaterialGroupGeneratorFunc = MaterialGroup* (*)(const CudaGPU& gpuId, const GPUEventEstimatorI& e); template<class MaterialBatch> using MaterialBatchGeneratorFunc = MaterialBatch* (*)(const GPUMaterialGroupI&, const GPUPrimitiveGroupI&); using GPUBaseAccelGen = GeneratorNoArg<GPUBaseAcceleratorI>; using GPUPrimGroupGen = GeneratorNoArg<GPUPrimitiveGroupI>; using GPUEstimatorGen = GeneratorNoArg<GPUEventEstimatorI>; class GPUTracerGen { private: TracerLogicGeneratorFunc<TracerBaseLogicI> gFunc; ObjDestroyerFunc<TracerBaseLogicI> dFunc; public: // Constructor & Destructor GPUTracerGen(TracerLogicGeneratorFunc<TracerBaseLogicI> g, ObjDestroyerFunc<TracerBaseLogicI> d) : gFunc(g) , dFunc(d) {} GPUTracerPtr operator()(GPUBaseAcceleratorI& ba, AcceleratorGroupList&& ag, AcceleratorBatchMappings&& ab, MaterialGroupList&& mg, MaterialBatchMappings&& mb, GPUEventEstimatorI& ee, // const TracerParameters& op, uint32_t hitStructSize, const Vector2i maxMats, const Vector2i maxAccels, const HitKey baseBoundMatKey) { TracerBaseLogicI* logic = gFunc(ba, std::move(ag), std::move(ab), std::move(mg), std::move(mb), ee, op, hitStructSize, maxMats, maxAccels, baseBoundMatKey); return GPUTracerPtr(logic, dFunc); } }; class GPUMatGroupGen { private: MaterialGroupGeneratorFunc<GPUMaterialGroupI> gFunc; ObjDestroyerFunc<GPUMaterialGroupI> dFunc; public: // Constructor & Destructor GPUMatGroupGen(MaterialGroupGeneratorFunc<GPUMaterialGroupI> g, ObjDestroyerFunc<GPUMaterialGroupI> d) : gFunc(g) , dFunc(d) {} GPUMatGPtr operator()(const CudaGPU& gpu, const GPUEventEstimatorI& e) { GPUMaterialGroupI* mat = gFunc(gpu, e); return GPUMatGPtr(mat, dFunc); } }; class GPUAccelGroupGen { private: AccelGroupGeneratorFunc<GPUAcceleratorGroupI> gFunc; ObjDestroyerFunc<GPUAcceleratorGroupI> dFunc; public: // Constructor & Destructor GPUAccelGroupGen(AccelGroupGeneratorFunc<GPUAcceleratorGroupI> g, ObjDestroyerFunc<GPUAcceleratorGroupI> d) : gFunc(g) , dFunc(d) {} GPUAccelGPtr operator()(const GPUPrimitiveGroupI& pg, const TransformStruct* ts) { GPUAcceleratorGroupI* accel = gFunc(pg, ts); return GPUAccelGPtr(accel, dFunc); } }; // Batch class GPUAccelBatchGen { private: AccelBatchGeneratorFunc<GPUAcceleratorBatchI> gFunc; ObjDestroyerFunc<GPUAcceleratorBatchI> dFunc; public: // Constructor & Destructor GPUAccelBatchGen(AccelBatchGeneratorFunc<GPUAcceleratorBatchI> g, ObjDestroyerFunc<GPUAcceleratorBatchI> d) : gFunc(g) , dFunc(d) {} GPUAccelBPtr operator()(const GPUAcceleratorGroupI& ag, const GPUPrimitiveGroupI& pg) { GPUAcceleratorBatchI* accel = gFunc(ag, pg); return GPUAccelBPtr(accel, dFunc); } }; class GPUMatBatchGen { private: MaterialBatchGeneratorFunc<GPUMaterialBatchI> gFunc; ObjDestroyerFunc<GPUMaterialBatchI> dFunc; public: // Constructor & Destructor GPUMatBatchGen(MaterialBatchGeneratorFunc<GPUMaterialBatchI> g, ObjDestroyerFunc<GPUMaterialBatchI> d) : gFunc(g) , dFunc(d) {} GPUMatBPtr operator()(const GPUMaterialGroupI& mg, const GPUPrimitiveGroupI& pg) { GPUMaterialBatchI* mat = gFunc(mg, pg); return GPUMatBPtr(mat, dFunc); } }; namespace TypeGenWrappers { template <class Base, class TracerLogic> Base* TracerLogicConstruct(GPUBaseAcceleratorI& ba, AcceleratorGroupList&& ag, AcceleratorBatchMappings&& ab, MaterialGroupList&& mg, MaterialBatchMappings&& mb, GPUEventEstimatorI& ee, const TracerParameters& op, uint32_t hitStrctSize, const Vector2i maxMats, const Vector2i maxAccels, const HitKey baseBoundMatKey) { return new TracerLogic(ba, std::move(ag), std::move(ab), std::move(mg), std::move(mb), ee, op, hitStrctSize, maxMats, maxAccels, baseBoundMatKey); } template <class Base, class AccelGroup> Base* AccelGroupConstruct(const GPUPrimitiveGroupI& p, const TransformStruct* t) { return new AccelGroup(p, t); } template <class Base, class AccelBatch> Base* AccelBatchConstruct(const GPUAcceleratorGroupI& a, const GPUPrimitiveGroupI& p) { return new AccelBatch(a, p); } template <class Base, class MatBatch> Base* MaterialGroupConstruct(const CudaGPU& gpu, const GPUEventEstimatorI& e) { return new MatBatch(gpu, e); } template <class Base, class MatBatch> Base* MaterialBatchConstruct(const GPUMaterialGroupI& m, const GPUPrimitiveGroupI& p) { return new MatBatch(m, p); } } ======================= File: Source/RayLib/SurfaceLoaderI.h ======================= #pragma once #include <vector> #include "AABB.h" #include "Types.h" struct SceneError; class SceneNodeI; enum class PrimitiveDataLayout : uint32_t; enum class PrimitiveDataType; // Node Specific Loader class SurfaceLoaderI { public: virtual ~SurfaceLoaderI() = default; // Type Determination virtual const SceneNodeI& SceneNode() const = 0; virtual const char* SufaceDataFileExt() const = 0; // Per Batch Fetch virtual SceneError AABB(std::vector<AABB3>&) const = 0; virtual SceneError PrimitiveRanges(std::vector<Vector2ul>&) const = 0; virtual SceneError PrimitiveCounts(std::vector<size_t>&) const = 0; virtual SceneError PrimitiveDataRanges(std::vector<Vector2ul>&) const = 0; // Entire Data Fetch virtual SceneError GetPrimitiveData(Byte*, PrimitiveDataType primitiveDataType) const = 0; virtual SceneError PrimitiveDataCount(size_t&, PrimitiveDataType primitiveDataType) const = 0; virtual SceneError PrimDataLayout(PrimitiveDataLayout&, PrimitiveDataType primitiveDataType) const = 0; }; class SurfaceLoader : public SurfaceLoaderI { private: protected: const SceneNodeI& node; double time; // Constructor SurfaceLoader(const SceneNodeI& node, double time = 0.0); public: // Destructor ~SurfaceLoader() = default; // Implementation const SceneNodeI& SceneNode() const override; }; inline SurfaceLoader::SurfaceLoader(const SceneNodeI& node, double time) : node(node) , time(time) {} inline const SceneNodeI& SurfaceLoader::SceneNode() const { return node; } ======================= File: Source/TracerLib/TracerLogicGeneratorI.h ======================= #pragma once #include "RayLib/SceneStructs.h" #include <string> struct SceneError; struct DLLError; struct SharedLibArgs; class SharedLib; class CudaGPU; // Execution Related Abstraction class GPUBaseAcceleratorI; class GPUAcceleratorBatchI; class GPUMaterialBatchI; // Data Related Abstraction class GPUPrimitiveGroupI; class GPUAcceleratorGroupI; class GPUMaterialGroupI; // Base Logic class TracerBaseLogicI; struct TracerParameters; // Event Estimator class GPUEventEstimatorI; class TracerLogicGeneratorI { public: virtual ~TracerLogicGeneratorI() = default; // Logic Generators // This is the heart of the type generation mechanism // of the DLL (A.K.A abstract factory) // It generates or returns (if already constructed) types // w.r.t. a type name and parent type if applicable // Pritimive virtual SceneError GeneratePrimitiveGroup(GPUPrimitiveGroupI*&, const std::string& primitiveType) = 0; // Accelerator virtual SceneError GenerateAcceleratorGroup(GPUAcceleratorGroupI*&, const GPUPrimitiveGroupI&, const TransformStruct* t, const std::string& accelType) = 0; virtual SceneError GenerateAcceleratorBatch(GPUAcceleratorBatchI*&, const GPUAcceleratorGroupI&, const GPUPrimitiveGroupI&, uint32_t keyBatchId, const std::string& batchType) = 0; // Material virtual SceneError GenerateMaterialGroup(GPUMaterialGroupI*&, const CudaGPU&, const GPUEventEstimatorI&, const std::string& materialType) = 0; virtual SceneError GenerateMaterialBatch(GPUMaterialBatchI*&, const GPUMaterialGroupI&, const GPUPrimitiveGroupI&, uint32_t keyBatchId, const std::string& batchType) = 0; // Base Accelerator should be fetched after all the stuff is generated virtual SceneError GenerateBaseAccelerator(GPUBaseAcceleratorI*&, const std::string& accelType) = 0; // EventEstimator virtual SceneError GenerateEventEstimaor(GPUEventEstimatorI*&, const std::string& estType) = 0; // Tracer Logic virtual SceneError GenerateTracerLogic(TracerBaseLogicI*&, // Args const TracerParameters& opts, const Vector2i maxMats, const Vector2i maxAccels, const HitKey baseBoundMatKey, // Type const std::string& tracerType) = 0; // Get all generated stuff on a vector virtual PrimitiveGroupList GetPrimitiveGroups() const = 0; virtual AcceleratorGroupList GetAcceleratorGroups() const = 0; virtual AcceleratorBatchMappings GetAcceleratorBatches() const = 0; virtual MaterialGroupList GetMaterialGroups() const = 0; virtual MaterialBatchMappings GetMaterialBatches() const = 0; virtual GPUBaseAcceleratorI* GetBaseAccelerator() const = 0; virtual GPUEventEstimatorI* GetEventEstimator() const = 0; virtual TracerBaseLogicI* GetTracerLogic() const = 0; // Resetting all generated Groups and Batches virtual void ClearAll() = 0; // Inclusion Functionality // Additionally includes the materials from these libraries // No exclusion functionality provided just add what you need virtual DLLError IncludeBaseAcceleratorsFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) = 0; virtual DLLError IncludeAcceleratorsFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) = 0; virtual DLLError IncludeMaterialsFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) = 0; virtual DLLError IncludePrimitivesFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) = 0; virtual DLLError IncludeEstimatorsFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) = 0; virtual DLLError IncludeTracersFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) = 0; //// Exclusion functionality //// Unload A Library //virtual DLLError UnloadLibrary(std::string& libName) = 0; //// Functionality Stripping //virtual DLLError StripGenerators(std::string& regex) = 0; }; ======================= File: Source/RayLib/GPUSceneI.h ======================= #pragma once #include "Matrix.h" #include "HitStructs.h" struct SceneError; struct LightStruct; struct CameraPerspective; struct TracerParameters; using TransformStruct = Matrix4x4; class GPUSceneI { public: virtual ~GPUSceneI() = default; // Interface virtual size_t UsedGPUMemory() = 0; virtual size_t UsedCPUMemory() = 0; // virtual SceneError LoadScene(const TracerParameters&, double) = 0; virtual SceneError ChangeTime(double) = 0; // virtual Vector2i MaxMatIds() = 0; virtual Vector2i MaxAccelIds() = 0; virtual HitKey BaseBoundaryMaterial() = 0; // Access GPU virtual const LightStruct* LightsGPU() const = 0; virtual const TransformStruct* TransformsGPU() const = 0; // Access CPU virtual const CameraPerspective* CamerasCPU() const = 0; }; ======================= File: Source/RayLib/StaticString.h ======================= <gh_stars>0 #pragma once /** From: https://akrzemi1.wordpress.com/2017/06/28/compile-time-string-concatenation/ This is simpler version (without literal reference) however it copies literals which means extra redundant storage */ #include <cassert> #include <type_traits> template <int N> class static_string { private: char str[N + 1]; protected: public: constexpr static_string(const char (&strIn)[N + 1]) { assert(strIn[N] == '\0'); for(int i = 0; i < N; ++i) str[i] = strIn[i]; str[N] = '\0'; } template <int M> constexpr static_string(const char(&s1)[M], const char(&s2)[N - M]) { for(int i = 0; i < M; ++i) str[i] = s1[i]; for(int i = 0; i < N - M; ++i) str[M + i] = s2[i]; str[N] = '\0'; } constexpr char operator[](int i) const { assert(i >= 0 && i < N); return str[i]; } constexpr std::size_t size() const { return N; } constexpr const char* Str() const { return str; } }; template <int N1, int N2> constexpr static_string<N1 + N2> operator+(const static_string<N1>& s1, const static_string<N2>& s2) { return static_string<N1 + N2>(s1, s2); } // Deduction guides for literal template <int N> static_string(const char(&)[N]) -> static_string<N - 1>; template <int N, int M> static_string(const char(&)[M], const char(&)[N - M]) -> static_string<N>; ======================= File: Source/RayLib/Matrix.h ======================= <filename>Source/RayLib/Matrix.h #pragma once /** Arbitrary sized square matrix. N should be 2, 3, 4 at most. */ #include <algorithm> #include <type_traits> #include "CudaCheck.h" #include "Vector.h" #include "Quaternion.h" template<int N, class T, class... Args> using AllVectorEnable = typename std::enable_if<std::conjunction<std::is_same<Vector<N, T>, Args>...>::value>::type; template<int N, class T, typename = ArithmeticEnable<T>> class Matrix; template<int N, class T> class alignas(ChooseVectorAlignment(N * sizeof(T))) Matrix<N, T> { static_assert(N == 2 || N == 3 || N == 4, "Matrix size should be 2x2, 3x3 or 4x4"); private: T matrix[N*N]; protected: public: // Constructors & Destructor constexpr Matrix() = default; template <class C, typename = ArithmeticEnable<C>> __device__ __host__ Matrix(C); template <class C, typename = ArithmeticEnable<C>> __device__ __host__ Matrix(const C* data); template <class... Args, typename = AllArithmeticEnable<Args...>> constexpr __device__ __host__ Matrix(const Args... dataList); __device__ __host__ Matrix(const Vector<N,T> columns[]); template <int M> __device__ __host__ Matrix(const Matrix<M, T>&); ~Matrix() = default; // MVC bug? these trigger std::trivially_copyable static assert // Matrix(const Matrix&) = default; //Matrix& operator=(const Matrix&) = default; // Accessors __device__ __host__ explicit operator T*(); __device__ __host__ explicit operator const T*() const; __device__ __host__ T& operator[](int); __device__ __host__ const T& operator[](int) const; __device__ __host__ T& operator()(int, int); __device__ __host__ const T& operator()(int, int) const; // Modify __device__ __host__ void operator+=(const Matrix&); __device__ __host__ void operator-=(const Matrix&); __device__ __host__ void operator*=(const Matrix&); __device__ __host__ void operator*=(T); __device__ __host__ void operator/=(const Matrix&); __device__ __host__ void operator/=(T); __device__ __host__ Matrix operator+(const Matrix&) const; __device__ __host__ Matrix operator-(const Matrix&) const; template<class Q = T> __device__ __host__ SignedEnable<Q, Matrix> operator-() const; __device__ __host__ Matrix operator/(const Matrix&) const; __device__ __host__ Matrix operator/(T) const; __device__ __host__ Matrix operator*(const Matrix&) const; template<int M> __device__ __host__ Vector<M, T> operator*(const Vector<M, T>&) const; __device__ __host__ Matrix operator*(T) const; // Logic __device__ __host__ bool operator==(const Matrix&) const; __device__ __host__ bool operator!=(const Matrix&) const; // Utilty __device__ __host__ T Determinant() const; template<class Q = T> __device__ __host__ FloatEnable<Q, Matrix> Inverse() const; template<class Q = T> __device__ __host__ FloatEnable<Q, Matrix&> InverseSelf(); __device__ __host__ Matrix Transpose() const; __device__ __host__ Matrix& TransposeSelf(); __device__ __host__ Matrix Clamp(const Matrix&, const Matrix&) const; __device__ __host__ Matrix Clamp(T min, T max) const; __device__ __host__ Matrix& ClampSelf(const Matrix&, const Matrix&); __device__ __host__ Matrix& ClampSelf(T min, T max); template<class Q = T> __device__ __host__ SignedEnable<Q, Matrix> Abs() const; template<class Q = T> __device__ __host__ SignedEnable<Q, Matrix&> AbsSelf(); template<class Q = T> __device__ __host__ FloatEnable<Q, Matrix> Round() const; template<class Q = T> __device__ __host__ FloatEnable<Q, Matrix&> RoundSelf(); template<class Q = T> __device__ __host__ FloatEnable<Q, Matrix> Floor() const; template<class Q = T> __device__ __host__ FloatEnable<Q, Matrix&> FloorSelf(); template<class Q = T> __device__ __host__ FloatEnable<Q, Matrix> Ceil() const; template<class Q = T> __device__ __host__ FloatEnable<Q, Matrix&> CeilSelf(); template<class Q = T> static __device__ __host__ FloatEnable<Q, Matrix> Lerp(const Matrix&, const Matrix&, T); static __device__ __host__ Matrix Min(const Matrix&, const Matrix&); static __device__ __host__ Matrix Min(const Matrix&, T); static __device__ __host__ Matrix Max(const Matrix&, const Matrix&); static __device__ __host__ Matrix Max(const Matrix&, T); }; // Determinants template<class T> static __device__ __host__ T Determinant2(const T*); template<class T> static __device__ __host__ T Determinant3(const T*); template<class T> static __device__ __host__ T Determinant4(const T*); // Inverse template<class T> static __device__ __host__ Matrix<2, T> Inverse2(const T*); template<class T> static __device__ __host__ Matrix<3, T> Inverse3(const T*); template<class T> static __device__ __host__ Matrix<4, T> Inverse4(const T*); // Left Scalar operators template<int N, class T> static __device__ __host__ Matrix<N, T> operator*(float, const Matrix<N,T>&); // Typeless matrices are defaulted to float using Matrix2x2 = Matrix<2, float>; using Matrix3x3 = Matrix<3, float>; using Matrix4x4 = Matrix<4, float>; // Float Type using Matrix2x2f = Matrix<2, float>; using Matrix3x3f = Matrix<3, float>; using Matrix4x4f = Matrix<4, float>; // Double Type using Matrix2x2d = Matrix<2, double>; using Matrix3x3d = Matrix<3, double>; using Matrix4x4d = Matrix<4, double>; // Integer Type using Matrix2x2i = Matrix<2, int>; using Matrix3x3i = Matrix<3, int>; using Matrix4x4i = Matrix<4, int>; // Unsigned Integer Type using Matrix2x2ui = Matrix<2, unsigned int>; using Matrix3x3ui = Matrix<3, unsigned int>; using Matrix4x4ui = Matrix<4, unsigned int>; // Requirements of Vectors static_assert(std::is_literal_type<Matrix3x3>::value == true, "Matrices has to be literal types"); static_assert(std::is_trivially_copyable<Matrix3x3>::value == true, "Matrices has to be trivially copyable"); static_assert(std::is_polymorphic<Matrix3x3>::value == false, "Matrices should not be polymorphic"); // Special 4x4 Matrix Operation template<class T> static __device__ __host__ Vector<3,T> ExtractScaleInfo(const Matrix<4, T>&); // Transformation Matrix Generation namespace TransformGen { template<class T, typename = FloatEnable<T>> static __device__ __host__ Matrix<4, T> Translate(const Vector<3, T>&); template<class T, typename = FloatEnable<T>> static __device__ __host__ Matrix<4, T> Scale(T); template<class T, typename = FloatEnable<T>> static __device__ __host__ Matrix <4, T> Scale(T x, T y, T z); template<class T, typename = FloatEnable<T>> static __device__ __host__ Matrix<4, T> Rotate(T angle, const Vector<3, T>&); template<class T, typename = FloatEnable<T>> static __device__ __host__ Matrix<4, T> Rotate(const Quaternion<T>&); template<class T, typename = FloatEnable<T>> static __device__ __host__ Matrix<4, T> Perspective(T fovXRadians, T aspectRatio, T nearPlane, T farPlane); template<class T, typename = FloatEnable<T>> static __device__ __host__ Matrix<4, T> Ortogonal(T left, T right, T top, T bottom, T nearPlane, T farPlane); template<class T, typename = FloatEnable<T>> static __device__ __host__ Matrix<4, T> Ortogonal(T width, T height, T nearPlane, T farPlane); template<class T, typename = FloatEnable<T>> static __device__ __host__ Matrix<4, T> LookAt(const Vector<3, T>& eyePos, const Vector<3, T>& at, const Vector<3, T>& up); } // Implementation #include "Matrix.hpp" // CPU & GPU // Constants static constexpr Matrix2x2 Indentity2x2 = Matrix2x2(1.0f, 0.0f, 0.0f, 1.0f); static constexpr Matrix3x3 Indentity3x3 = Matrix3x3(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f); static constexpr Matrix4x4 Indentity4x4 = Matrix4x4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); // Zeros static constexpr Matrix2x2f Zero2x2f = Matrix2x2f(0.0f, 0.0f, 0.0f, 0.0f); static constexpr Matrix3x3f Zero3x3f = Matrix3x3f(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); static constexpr Matrix4x4f Zero4x4f = Matrix4x4f(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); static constexpr Matrix2x2d Zero2x2d = Matrix2x2d(0.0f, 0.0f, 0.0f, 0.0f); static constexpr Matrix3x3d Zero3x3d = Matrix3x3d(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); static constexpr Matrix4x4d Zero4x4d = Matrix4x4d(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); static constexpr Matrix2x2i Zero2x2i = Matrix2x2i(0, 0, 0, 0); static constexpr Matrix3x3i Zero3x3i = Matrix3x3i(0, 0, 0, 0, 0, 0, 0, 0, 0); static constexpr Matrix4x4i Zero4x4i = Matrix4x4i(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); static constexpr Matrix2x2ui Zero2x2ui = Matrix2x2ui(0u, 0u, 0u, 0u); static constexpr Matrix3x3ui Zero3x3ui = Matrix3x3ui(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u); static constexpr Matrix4x4ui Zero4x4ui = Matrix4x4ui(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u); static constexpr Matrix2x2 Zero2x2 = Zero2x2f; static constexpr Matrix3x3 Zero3x3 = Zero3x3f; static constexpr Matrix4x4 Zero4x4 = Zero4x4f; // Matrix Traits template<class T> struct IsMatrixType { static constexpr bool value = std::is_same<T, Matrix2x2f>::value || std::is_same<T, Matrix2x2d>::value || std::is_same<T, Matrix2x2i>::value || std::is_same<T, Matrix2x2ui>::value || std::is_same<T, Matrix3x3f>::value || std::is_same<T, Matrix3x3d>::value || std::is_same<T, Matrix3x3i>::value || std::is_same<T, Matrix3x3ui>::value || std::is_same<T, Matrix4x4f>::value || std::is_same<T, Matrix4x4d>::value || std::is_same<T, Matrix4x4i>::value || std::is_same<T, Matrix4x4ui>::value; }; // Matrix Etern extern template class Matrix<2, float>; extern template class Matrix<2, double>; extern template class Matrix<2, int>; extern template class Matrix<2, unsigned int>; extern template class Matrix<3, float>; extern template class Matrix<3, double>; extern template class Matrix<3, int>; extern template class Matrix<3, unsigned int>; extern template class Matrix<4, float>; extern template class Matrix<4, double>; extern template class Matrix<4, int>; extern template class Matrix<4, unsigned int>; ======================= File: Source/TracerLib/RNGStructs.h ======================= #pragma once #include <cstdint> #include <curand_kernel.h> struct RNGGMem { curandStateMRG32k3a_t* state; }; ======================= File: Source/RayLib/DistributorI.h ======================= <reponame>yalcinerbora/meturay #pragma once /** Tracer Distributor Interface Main interface for data distribution between nodes Implementation has distributed system logics for creating cluster It also is responsible for data transfer between nodes. Distributor is main backend for all nodes (Analytic / Visor, Tracer) */ #include <cstdint> #include <vector> #include "Vector.h" #include "Types.h" enum class DistError { OK, }; class DistributorI { public: enum CommandType { REQUEST, RECIEVE }; enum CommandTag { ACCELERATOR, SCENE, MATERIAL, OBJECT }; // Main Recieve typedef void(*RecieveFunc)(CommandTag, std::vector<Byte>); private: protected: // Interface // Distributed Leader virtual void EliminateNode() = 0; // Leader removes node from the pool virtual void IntroduceNode() = 0; // Leader sends new node to pairs virtual void StartFrame() = 0; // Send Start Frame Command virtual void RenderIntersect() = 0; // Main intersect command virtual void RenderGenRays() = 0; // Main ray generation command virtual void RenderEnd() = 0; // Main rendering end command virtual void AssignMaterial(uint32_t material, // Assign material to node uint32_t node) = 0; virtual void PollNode(uint32_t) = 0; // PollNode to check if its not dead // Distributed Non-Leader virtual void RequestLeaderElection() = 0; // Request a Leader election virtual void RedirectCandidateNode() = 0; // Redirect new node to leader public: virtual ~DistributorI() = default; // Main Interface virtual DistError Connect(const std::string&, int port) = 0; // Sending Data (non-block) virtual void Request(const CommandTag) = 0; virtual void Send(const CommandTag, const std::vector<const char*>) = 0; // Recieving Data virtual void AttachRecieveCallback(RecieveFunc) = 0; // Misc virtual uint64_t NodeId() = 0; }; ======================= File: Source/RayLib/ImageIO.h ======================= #pragma once #include <vector> #include <string> #include <memory> #include "Vector.h" class ImageIO { private: static std::unique_ptr<ImageIO> instance; protected: public: // Constructors & Destructor ImageIO(); ImageIO(const ImageIO&) = delete; ImageIO& operator=(const ImageIO&) = delete; ~ImageIO(); // Singleton Accessor static ImageIO& System(); // Usage // Read bool ReadHDR(std::vector<Vector4>& image, Vector2ui& size, const std::string& fileName) const; // Write bool WriteAsPNG(const Vector4f* image, const Vector2ui& size, const std::string& fileName) const; }; ======================= File: Source/RayLib/TracerStructs.h ======================= <reponame>yalcinerbora/meturay #pragma once /** Structures that is related to TracerI */ #include <cstdint> #include <vector> #include <map> class GPUPrimitiveGroupI; class GPUAcceleratorGroupI; class GPUAcceleratorBatchI; class GPUMaterialGroupI; class GPUMaterialBatchI; using PrimitiveGroupList = std::vector<const GPUPrimitiveGroupI*>; using AcceleratorGroupList = std::vector<GPUAcceleratorGroupI*>; using AcceleratorBatchMappings = std::map<uint32_t, GPUAcceleratorBatchI*>; using MaterialGroupList = std::vector<const GPUMaterialGroupI*>; using MaterialBatchMappings = std::map<uint32_t, GPUMaterialBatchI*>; struct MaterialOptions { bool fullLoadTextures; }; struct ShadeOpts { int i; }; struct HitOpts { int j; }; // Constant Paramters that cannot be changed after initialization time struct TracerParameters { uint32_t seed; }; // Options that can be changed during runtime struct TracerOptions { // Misc bool verbose; }; //struct MatBatchRayDataCPU //{ // uint32_t batchId; // std::vector<uint8_t> record; // // // uint64_t raysOffset; // uint64_t auxiliaryOffset; // uint64_t primitiveIdsOffset; // uint64_t hitStructOffset; //}; ======================= File: Source/TracerLib/GPUEventEstimatorP.h ======================= <reponame>yalcinerbora/meturay #pragma once #include "GPUEventEstimatorI.h" #include "EstimatorFunctions.cuh" #include "EstimatorStructs.h" #include "GPUPrimitiveI.h" #include "RayLib/SceneNodeNames.h" #include <vector> template <class EstimatorD> class GPUEventEstimatorP { friend struct EstimatorDataAccessor; protected: EstimatorD dData = EstimatorD{}; }; template<class EstimatorD, EstimateEventFunc<EstimatorD> EstF, TerminateEventFunc TermF> class GPUEventEstimator : public GPUEventEstimatorI , public GPUEventEstimatorP<EstimatorD> { public: // Type Definitions using EstimatorData = typename EstimatorD; // Function Definitions static constexpr auto EstimatorFunc = EstF; static constexpr auto TerminatorFunc = TermF; private: protected: std::vector<EstimatorInfo> lightInfo; std::vector<HitKey> lightMaterialInfo; public: // Constructors & Destructor GPUEventEstimator() = default; virtual ~GPUEventEstimator() = default; virtual SceneError Initialize(const NodeListing& lightList, // Material Keys const MaterialKeyListing& hitKeys, const std::vector<const GPUPrimitiveGroupI*>&, double time) override; }; struct EstimatorDataAccessor { // Data fetch function of the primitive // This struct should contain all necessary data required for kernel calls // related to this primitive // I dont know any design pattern for converting from static polymorphism // to dynamic one. This is my solution (it is quite werid) template <class EventEstimatorS> static typename EventEstimatorS::EstimatorData Data(const EventEstimatorS& est) { using E = typename EventEstimatorS::EstimatorData; return static_cast<const GPUEventEstimatorP<E>&>(est).dData; } }; template<class EstimatorD, EstimateEventFunc<EstimatorD> EstF, TerminateEventFunc TermF> SceneError GPUEventEstimator<EstimatorD, EstF, TermF>::Initialize(const NodeListing& lightList, // Material Keys const MaterialKeyListing& materialKeys, const std::vector<const GPUPrimitiveGroupI*>& prims, double time) { SceneError err = SceneError::OK; for(const auto& nodePtr : lightList) { const SceneNodeI& node = *nodePtr; const std::string typeName = node.CommonString(NodeNames::TYPE, time); LightType type = LightType::END; if((err = LightTypeStringToEnum(type, typeName))!= SceneError::OK) return err; std::vector<EstimatorInfo> newInfo; if((err = FetchLightInfoFromNode(newInfo, node, materialKeys, type, time))!= SceneError::OK) return err; if(type == LightType::PRIMITIVE) { const UIntList primIds = node.AccessUInt(NodeNames::LIGHT_PRIMITIVE); const UIntList matIds = node.AccessUInt(NodeNames::LIGHT_MATERIAL); const Vector3List powers = node.AccessVector3(NodeNames::LIGHT_POWER, time); assert(primIds.size() == matIds.size()); // Fetch all for(size_t i = 0; i < primIds.size(); i++) { uint32_t primId = primIds[i]; uint32_t matId = matIds[i]; Vector3 power = powers[i]; const auto FindPrimFunc = [primId](const GPUPrimitiveGroupI* pGroup) -> bool { return pGroup->HasPrimitive(primId); }; auto it = prims.end(); if((it = std::find_if(prims.begin(), prims.end(), FindPrimFunc)) == prims.end()) return SceneError::LIGHT_PRIMITIVE_NOT_FOUND; // Generate Estimators From Primitive const auto matLookup = std::make_pair((*it)->Type(), matId); HitKey key = materialKeys.at(matLookup); if((err = (*it)->GenerateEstimatorInfo(newInfo, power, key, primId))!= SceneError::OK) return err; } } lightInfo.insert(lightInfo.end(), newInfo.begin(), newInfo.end()); } return SceneError::OK; } ======================= File: Source/RayLib/NodeError.h ======================= <gh_stars>0 #pragma once #pragma once /** Tracer error "Enumeration" */ #include "Error.h" struct NodeError : public ErrorI { public: enum Type { OK, // Connection CONNECTION_FAILED, //... // End END }; private: Type type; public: // Constructors & Destructor NodeError(Type); ~NodeError() = default; operator Type() const; operator std::string() const override; }; inline NodeError::NodeError(NodeError::Type t) : type(t) {} inline NodeError::operator Type() const { return type; } inline NodeError::operator std::string() const { static constexpr char const* const ErrorStrings[] = { "OK", "Connection cannot be established" }; static_assert((sizeof(ErrorStrings) / sizeof(const char*)) == static_cast<size_t>(NodeError::END), "Enum and enum string list size mismatch."); return ErrorStrings[static_cast<int>(type)]; } ======================= File: Source/TracerLib/GPUPrimitiveEmpty.h ======================= <reponame>yalcinerbora/meturay #pragma once #pragma once /** Default Triangle Implementation Has three types of data Position, Normal and UV. All of them should be provided */ #include <map> #include <type_traits> #include "RayLib/Vector.h" #include "DefaultLeaf.h" #include "GPUPrimitiveP.cuh" #include "TypeTraits.h" struct EmptyData {}; struct EmptyHit {}; // Triangle Hit Acceptance __device__ __host__ inline HitResult EmptyClosestHit(// Output HitKey& newMat, PrimitiveId& newPrimitive, EmptyHit& newHit, // I-O RayReg& rayData, // Input const EmptyLeaf& leaf, const EmptyData& primData) { return HitResult{false, -FLT_MAX}; } __device__ __host__ inline AABB3f GenerateAABBEmpty(PrimitiveId primitiveId, const EmptyData& primData) { Vector3f minInf(-INFINITY); return AABB3f(minInf, minInf); } __device__ __host__ inline float GenerateAreaEmpty(PrimitiveId primitiveId, const EmptyData& primData) { return 0.0f; } __device__ __host__ inline Vector3f GenerateCenterEmpty(PrimitiveId primitiveId, const EmptyData& primData) { return Zero3; } class GPUPrimitiveEmpty final : public GPUPrimitiveGroup<EmptyHit, EmptyData, EmptyLeaf, EmptyClosestHit, GenerateEmptyLeaf, GenerateAABBEmpty, GenerateAreaEmpty, GenerateCenterEmpty> { public: static constexpr const char* TypeName() { return BaseConstants::EMPTY_PRIMITIVE_NAME; } private: protected: public: // Constructors & Destructor GPUPrimitiveEmpty(); ~GPUPrimitiveEmpty() = default; // Interface // Pirmitive type is used for delegating scene info to this class const char* Type() const override; // Allocates and Generates Data SceneError InitializeGroup(const NodeListing& surfaceDatalNodes, double time, const SurfaceLoaderGeneratorI&, const std::string&) override; SceneError ChangeTime(const NodeListing& surfaceDatalNodes, double time, const SurfaceLoaderGeneratorI&, const std::string&) override; // Provides data to Event Estimator bool HasPrimitive(uint32_t surfaceDataId) const override; SceneError GenerateEstimatorInfo(std::vector<EstimatorInfo>&, const Vector3& power, HitKey key, uint32_t surfaceDataId) const override; // Access primitive range from Id Vector2ul PrimitiveBatchRange(uint32_t surfaceDataId) const override; AABB3 PrimitiveBatchAABB(uint32_t surfaceDataId) const override; // Error check // Queries in order to check if this primitive group supports certain primitive data // Material may need that data bool CanGenerateData(const std::string& s) const override; }; static_assert(IsTracerClass<GPUPrimitiveEmpty>::value, "GPUPrimitiveEmpty is not a Tracer Class."); ======================= File: Source/RayLib/MemoryAlignment.h ======================= <reponame>yalcinerbora/meturay #pragma once namespace Memory { static constexpr const size_t AlignByteCount = 16; size_t AlignSize(size_t size); size_t AlignSize(size_t size, size_t alignCount); } inline size_t Memory::AlignSize(size_t size) { return AlignSize(size, AlignByteCount); } inline size_t Memory::AlignSize(size_t size, size_t alignCount) { size = AlignByteCount * ((size + alignCount - 1) / alignCount); return size; } ======================= File: Source/RayLib/CudaCheck.h ======================= <reponame>yalcinerbora/meturay<gh_stars>0 #pragma once /** Utility header for header only cuda vector and cpu vector implementations */ #include <cstdio> #include <cassert> #include "TracerError.h" #ifdef METU_CUDA #include <cuda.h> #include <cuda_runtime.h> inline static constexpr void GPUAssert(cudaError_t code, const char *file, int line) { if(code!= cudaSuccess) { fprintf(stderr, "Cuda Failure: %s %s %d\n", cudaGetErrorString(code), file, line); assert(false); } } inline static constexpr void GPUMemoryCheck(cudaError_t code) { //if(code == cudaErrorMemoryAllocation) if(code!= cudaSuccess) { //fprintf(stderr, "Cuda Failure: %s %s %d\n", cudaGetErrorString(code), file, line); throw TracerException(TracerError::GPU_OUT_OF_MEMORY, cudaGetErrorString(code)); } } #define CUDA_MEMORY_CHECK(func){GPUMemoryCheck((func));} #else #define __device__ #define __host__ typedef int cudaError_t; inline static constexpr void GPUAssert(cudaError_t code, const char *file, int line) {} #endif #ifdef __CUDA_ARCH__ #define UNROLL_LOOP #pragma unroll #define UNROLL_LOOP_COUNT(count) _Pragma(unroll(count)) #else #define UNROLL_LOOP #define UNROLL_LOOP_COUNT(count) #endif #ifdef METU_DEBUG constexpr bool METU_DEBUG_BOOL = true; #define CUDA_CHECK(func) GPUAssert((func), __FILE__, __LINE__) #define CUDA_KERNEL_CHECK() \ CUDA_CHECK(cudaDeviceSynchronize()); \ CUDA_CHECK(cudaGetLastError()) #else constexpr bool METU_DEBUG_BOOL = false; #define CUDA_CHECK(func) func #define CUDA_KERNEL_CHECK() //#define CUDA_KERNEL_CHECK() \ // CUDA_CHECK(cudaGetLastError()) //#define CUDA_CHECK(func) GPUAssert((func), __FILE__, __LINE__) //#define CUDA_KERNEL_CHECK() \ // CUDA_CHECK(cudaDeviceSynchronize()); \ // CUDA_CHECK(cudaGetLastError()) // TODO: Check this from time to time.. // Ok after kernels i need to put get last error // in order to properly synchronize i did not understand this // hoping for a driver bug instead of some bug resides in the // deep dark parts of the code. #endif ======================= File: Source/RayLib/WorkerThread.h ======================= #pragma once /** Worker Implementation Basic worker implementation. Single thread and a job queue that assigns any function to the worker. */ #include <queue> #include <mutex> #include <thread> #include <future> #include <functional> #include <condition_variable> // TODO: there is no limit on the queue // it may be an issue.. class WorkerThread { private: std::thread workerThread; bool stopSignal; // Queue and Associated Conc Helpers std::queue<std::function<void()>> assignedJobs; mutable std::mutex mutex; mutable std::condition_variable conditionVar; // Entry Point of the thread void THRDEntryPoint(); bool ProcessJob(); protected: public: // Constructor & Destructor WorkerThread(); WorkerThread(const WorkerThread&) = delete; WorkerThread& operator=(const WorkerThread&) = delete; ~WorkerThread() = default; // ThreadLifetime Worker void Start(); void Stop(); // Return the Amount of Queued Jobs int QueuedJobs() const; // Function Def Copied From std::async template <class Function, class... Args> std::future<typename std::result_of<Function(Args...)>::type> AddWork(Function&&, Args&&...); }; // Template Functions template <class Function, class... Args> std::future<typename std::result_of<Function(Args...)>::type> WorkerThread::AddWork(Function&& f, Args&&... args) { typedef typename std::result_of<Function(Args...)>::type returnType; // I had to make this by using make_shared // I tried to make this without make_shared since it is extra operation but w/e auto job = std::make_shared<std::packaged_task<returnType()>>(std::bind(f, args...)); auto future = job->get_future(); auto jobWrap = [job]() { (*job)(); }; mutex.lock(); assignedJobs.push(jobWrap); mutex.unlock(); conditionVar.notify_all(); return future; } ======================= File: Source/RayLib/VisorWindowInput.h ======================= <reponame>yalcinerbora/meturay<gh_stars>0 #pragma once /** */ #include "VisorInputI.h" #include "Camera.h" class MovementSchemeI; using MovementScemeList = std::vector<std::unique_ptr<MovementSchemeI>>; class VisorWindowInput : public VisorInputI { private: // Key Bindings const MouseKeyBindings mouseBindings; const KeyboardKeyBindings keyboardBindings; // Movement Related const MovementScemeList movementSchemes; // List of available movers unsigned int currentMovementScheme; // Camera Related States unsigned int currentSceneCam; // Currently selected scene camera CameraMode cameraMode; CameraPerspective customCamera; bool lockedCamera; // Other States bool pauseCont; bool startStop; double deltaT; // Visor Callback VisorCallbacksI* visorCallbacks; // Internals void ProcessInput(VisorActionType, KeyAction); protected: public: // Constructor & Destructor VisorWindowInput(KeyboardKeyBindings&&, MouseKeyBindings&&, MovementScemeList&&, const CameraPerspective& customCamera); ~VisorWindowInput() = default; void ChangeDeltaT(double); // Implementation void AttachVisorCallback(VisorCallbacksI&) override; void WindowPosChanged(int posX, int posY) override; void WindowFBChanged(int fbWidth, int fbHeight) override; void WindowSizeChanged(int width, int height) override; void WindowClosed() override; void WindowRefreshed() override; void WindowFocused(bool) override; void WindowMinimized(bool) override; void MouseScrolled(double xOffset, double yOffset) override; void MouseMoved(double x, double y) override; void KeyboardUsed(KeyboardKeyType key, KeyAction action) override; void MouseButtonUsed(MouseButtonType button, KeyAction action) override; }; ======================= File: Source/AssimpSurfaceLoaders/AssimpForward.h ======================= #pragma once namespace Assimp { class Importer; } struct aiScene; ======================= File: Source/RayLib/SceneI.h ======================= <filename>Source/RayLib/SceneI.h #pragma once class GPUSceneI { public: // Constructors & Destructor GPUScene(const std::string&, ScenePartitionerI& partitioner, TracerLogicGeneratorI&); GPUScene(const GPUScene&) = delete; GPUScene(GPUScene&&) noexcept; GPUScene& operator=(const GPUScene&) = delete; ~GPUScene(); // Members size_t UsedGPUMemory(); size_t UsedCPUMemory(); // SceneError LoadScene(double); SceneError ChangeTime(double); // Vector2i MaxMatIds(); Vector2i MaxAccelIds(); HitKey BaseBoundaryMaterial(); // Access GPU const LightStruct* LightsGPU() const; const TransformStruct* TransformsGPU() const; // Access CPU const CameraPerspective* CamerasCPU() const; } ======================= File: Source/RayLib/AnalyticData.h ======================= #pragma once struct AnalyticData { // Performance double raysPerSec; // Memory Related double TotalGPUMemory; // MiB double totalCPUMemoru; // MiB // Kernel Utilization double rayPerKernelMaterial; double rayPerKernelAccelerator; // Texture Cache related double texCacheHitRateGPU; // Percentage of Hits on GPU Memory double texCacheHitRateCPU; // Percentage of Hits on CPU Memory double texCacheHitRateHDD; // Percentage of Hits on Cold Memory // Timings double lastSceneLoadTime; // secs double lastSceneUpdateTime; // secs }; ======================= File: Source/Tracer-Test/SurfaceStructs.h ======================= <filename>Source/Tracer-Test/SurfaceStructs.h #pragma once #include "TracerLib/GPUPrimitiveSphere.h" #include "TracerLib/GPUPrimitiveTriangle.h" #include "TracerLib/GPUPrimitiveEmpty.h" struct BarySurface { Vector3 baryCoords; }; struct SphrSurface { Vector2 sphrCoords; }; struct BasicSurface { Vector3 normal; }; struct EmptySurface {}; // Surface Functions __device__ __host__ inline BarySurface BarySurfaceFromTri(const GPUPrimitiveTriangle::PrimitiveData& pData, const GPUPrimitiveTriangle::HitData& hData, PrimitiveId id) { Vector3 baryCoord = Vector3(hData[0], hData[1], 1 - hData[0] - hData[1]); return {baryCoord}; } __device__ __host__ inline BasicSurface BasicSurfaceFromTri(const GPUPrimitiveTriangle::PrimitiveData& pData, const GPUPrimitiveTriangle::HitData& hData, PrimitiveId id) { uint64_t index0 = pData.indexList[id * 3 + 0]; uint64_t index1 = pData.indexList[id * 3 + 1]; uint64_t index2 = pData.indexList[id * 3 + 2]; Vector3 n0 = pData.normalsV[index0]; Vector3 n1 = pData.normalsV[index1]; Vector3 n2 = pData.normalsV[index2]; Vector3 baryCoord = Vector3(hData[0], hData[1], 1 - hData[0] - hData[1]); Vector3 nAvg = (baryCoord[0] * n0 + baryCoord[1] * n1 + baryCoord[2] * n2); return {nAvg}; } __device__ __host__ inline EmptySurface EmptySurfaceFromTri(const GPUPrimitiveTriangle::PrimitiveData& pData, const GPUPrimitiveTriangle::HitData& hData, PrimitiveId id) { return {}; } __device__ __host__ inline BasicSurface BasicSurfaceFromSphr(const GPUPrimitiveSphere::PrimitiveData& pData, const GPUPrimitiveSphere::HitData& hData, PrimitiveId id) { Vector4f data = pData.centerRadius[id + 0]; Vector3f center = data; float r = data[3]; // Convert spherical hit to cartesian Vector3 normal = Vector3(sin(hData[0]) * cos(hData[1]), sin(hData[0]) * sin(hData[1]), cos(hData[0])); return {normal}; } __device__ __host__ inline EmptySurface EmptySurfaceFromSphr(const GPUPrimitiveSphere::PrimitiveData& pData, const GPUPrimitiveSphere::HitData& hData, PrimitiveId id) { return {}; } __device__ __host__ inline SphrSurface SphrSurfaceFromSphr(const GPUPrimitiveSphere::PrimitiveData& pData, const GPUPrimitiveSphere::HitData& hData, PrimitiveId id) { return { hData }; } __device__ __host__ inline EmptySurface EmptySurfaceFromEmpty(const GPUPrimitiveEmpty::PrimitiveData& pData, const GPUPrimitiveEmpty::HitData& hData, PrimitiveId id) { return {}; } ======================= File: Source/TracerLib/TracerDebug.h ======================= #pragma once #include <string> #include <iomanip> #include <sstream> #include <fstream> #include "RayLib/Log.h" #include "RayLib/HitStructs.h" #include "RayLib/AABB.h" #include "RayStructs.h" #include "CudaConstants.h" class ImageMemory; struct DefaultLeaf; namespace Debug { void PrintHitPairs(const RayId* ids, const HitKey* keys, size_t count); void WriteHitPairs(const RayId* ids, const HitKey* keys, size_t count, const std::string& file); void DumpImage(const std::string& fName, const ImageMemory&); // Memory Debugging template<class T> static void DumpMemToFile(const std::string& fName, const T* mPtr, size_t count, const char* seperator = "\n", bool hex = false); template<class T> static void DumpMemToStdout(const T* mPtr, size_t count, const char* seperator = "\n", bool hex = false); template<class T> static void DumpMemToStream(std::ostream& s, const T* mPtr, size_t count, const char* seperator = "\n", bool hex = false); namespace Detail { template <class T> void OutputData(std::ostream& s, const T* hits, size_t count); } } // Some Print Func Definitions extern std::ostream& operator<<(std::ostream& stream, const RayGMem&); extern std::ostream& operator<<(std::ostream& stream, const HitKey&); extern std::ostream& operator<<(std::ostream& stream, const Vector2ul&); extern std::ostream& operator<<(std::ostream& stream, const Vector2f&); extern std::ostream& operator<<(std::ostream& stream, const Vector3f&); extern std::ostream& operator<<(std::ostream& stream, const Vector4f&); extern std::ostream& operator<<(std::ostream& stream, const AABB3f&); extern std::ostream& operator<<(std::ostream& stream, const DefaultLeaf&); template<class T> void Debug::DumpMemToFile(const std::string& fName, const T* mPtr, size_t count, const char* seperator, bool hex) { std::ofstream file(fName); DumpMemToStream(file, mPtr, count, seperator, hex); } template<class T> void Debug::DumpMemToStdout(const T* mPtr, size_t count, const char* seperator, bool hex) { DumpMemToStream(std::cout, mPtr, count, seperator, hex); } template<class T> void Debug::DumpMemToStream(std::ostream& s, const T* mPtr, size_t count, const char* seperator, bool hex) { CUDA_CHECK(cudaDeviceSynchronize()); if(hex) s << std::hex; for(size_t i = 0; i < count; i++) { s << mPtr[i] << seperator; } if(hex) s << std::dec; } ======================= File: Source/RayLib/TracerStatus.h ======================= #pragma once #include <string> #include "Vector.h" #include "Types.h" #include "Camera.h" #include "TracerStructs.h" struct TracerStatus { std::u8string currentScene; // Current scene that is being render unsigned int cameraCount; // Total camera count on that scene unsigned int latestSceneCamId; // Latest camera that has been used // from the scene (for switching from that) CameraPerspective currentCamera; // Current Camera (as data) Vector2i currentRes; // Current Resolution of the scene; PixelFormat currentPixelFormat; // Pixel format of the image that is being generated double currentTime; // Current animation time point that is being rendered bool pausedCont; // Pause-Cont. bool startedStop; // Start-Stop TracerOptions currentTOpts; // Current Tracer Options TracerParameters tracerParameters; }; ======================= File: Source/RayLib/SceneStructs.h ======================= <reponame>yalcinerbora/meturay<filename>Source/RayLib/SceneStructs.h<gh_stars>0 #pragma once #include <vector> #include <array> #include <set> #include <map> #include "Vector.h" #include "Matrix.h" #include "SceneError.h" #include "Types.h" #include "HitStructs.h" using NodeId = uint32_t; // Node Id is generic name of the id logic using MaterialId = uint32_t; // Material Id represent material of some kind using SurfaceDataId = uint32_t; // Surface Id represent up to "MaxPrimitivePerSurface" // material-primitive pairings of some kind using NodeIndex = uint32_t; // Node index is the index of the node that is on the list // This is unique only for each type. (Materials, Primitives etc.) using InnerIndex = uint32_t; // Inner Index is sub index of the node // Each node can define multiple ids using TypeIdPair = std::pair<std::string, uint32_t>; using IdPair = std::pair<uint32_t, uint32_t>; using IdPairs = std::array<IdPair, SceneConstants::MaxPrimitivePerSurface>; class SceneNodeI; struct AccelGroupData { std::string accelType; std::string primType; std::map<uint32_t, IdPairs> matPrimIdPairs; std::unique_ptr<SceneNodeI> accelNode; }; struct MatBatchData { std::string primType; std::string matType; std::set<MaterialId> matIds; }; // Overall all material key listings of the scene // This is generated by distributor which has access to overall node and GPUs // on nodes etc. // Main node (or any node with the same code) will generate partitioning // of materials with this HitKey - Type Pair using MaterialKeyListing = std::map<TypeIdPair, HitKey>; struct LightStruct { std::string typeName; uint32_t matId; }; using TransformStruct = Matrix4x4; struct SurfaceStruct { uint32_t acceleratorId; uint32_t transformId; IdPairs matPrimPairs; int8_t pairCount; }; ======================= File: Source/RayLib/AnalyticNodeI.h ======================= <reponame>yalcinerbora/meturay<filename>Source/RayLib/AnalyticNodeI.h #pragma once class AnalyticNodeI { }; ======================= File: Source/RayLib/ThreadData.h ======================= <reponame>yalcinerbora/meturay #pragma once /** State storing simple Thread data. Can be set from outside of the tread and shown */ #include <atomic> template <class T> class ThreadData { private: std::atomic_bool changedOutside; T data; protected: public: ThreadData& operator=(const T& t); bool CheckChanged(T& newData); }; template <class T> inline ThreadData<T>& ThreadData<T>::operator=(const T& t) { data = t; changedOutside = true; return *this; } template <class T> inline bool ThreadData<T>::CheckChanged(T& newData) { bool changed = changedOutside.exchange(false); newData = data; return changed; } ======================= File: Source/RayLib/Vector.h ======================= <reponame>yalcinerbora/meturay #pragma once /** Arbitrary sized vector. Vector is column vector (N x 1 matrix) which means that it can only be multipled with matrices from right. N should be 2, 3 or 4 at most. */ #include <algorithm> #include <type_traits> #include <tuple> #include <cmath> #include "CudaCheck.h" template<class T> using ArithmeticEnable = typename std::enable_if<std::is_arithmetic<T>::value>::type; template<class T> using ArithmeticEnable = typename std::enable_if<std::is_arithmetic<T>::value>::type; template<class... Args> using AllArithmeticEnable = typename std::enable_if<std::conjunction<std::is_arithmetic<Args>...>::value>::type; template<class T, class RType = void> using FloatEnable = typename std::enable_if<std::is_floating_point<T>::value, RType>::type; template<class T, class RType = void> using IntegralEnable = typename std::enable_if<std::is_integral<T>::value, RType>::type; template<class T, class RType = void> using SignedEnable = typename std::enable_if<std::is_signed<T>::value, RType>::type; template<int N, class T, typename = ArithmeticEnable<T>> class Vector; static constexpr size_t ChooseVectorAlignment(size_t totalSize) { if(totalSize <= 4) return 4; // 1byte Vector Types else if(totalSize <= 8) return 8; // 4byte Vector2 Types else if(totalSize < 16) return 4; // 4byte Vector3 Types else return 16; // 4byte Vector4 Types } template<int N, class T> class alignas(ChooseVectorAlignment(N * sizeof(T))) Vector<N, T> { static_assert(N == 2 || N == 3 || N == 4, "Vector size should be 2, 3 or 4"); private: T vector[N]; protected: public: // Constructors & Destructor constexpr Vector() = default; template<class C, typename = ArithmeticEnable<C>> __device__ __host__ Vector(C); template<class C, typename = ArithmeticEnable<C>> __device__ __host__ Vector(const C* data); template <class... Args, typename = AllArithmeticEnable<Args...>> constexpr __device__ __host__ Vector(const Args... dataList); template <class... Args, typename = std::enable_if_t<((N - sizeof...(Args)) > 1)>> __device__ __host__ Vector(const Vector<N - sizeof...(Args), T>&, const Args... dataList); template <int M, typename = std::enable_if_t<(M > N)>> __device__ __host__ Vector(const Vector<M, T>&); ~Vector() = default; // MVC bug? these trigger std::trivially_copyable static assert // __device__ __host__ Vector(const Vector&) = default; // __device__ __host__ Vector& operator=(const Vector&) = default; // Accessors __device__ __host__ explicit operator T*(); __device__ __host__ explicit operator const T*() const; __device__ __host__ T& operator[](int); __device__ __host__ constexpr const T& operator[](int) const; // Type cast template<int M, class C, typename = std::enable_if_t<(M <= N)>> __device__ __host__ explicit operator Vector<M, C>() const; // Modify __device__ __host__ void operator+=(const Vector&); __device__ __host__ void operator-=(const Vector&); __device__ __host__ void operator*=(const Vector&); __device__ __host__ void operator*=(T); __device__ __host__ void operator/=(const Vector&); __device__ __host__ void operator/=(T); __device__ __host__ Vector operator+(const Vector&) const; __device__ __host__ Vector operator-(const Vector&) const; template<class Q = T> __device__ __host__ SignedEnable<Q, Vector> operator-() const; __device__ __host__ Vector operator*(const Vector&) const; __device__ __host__ Vector operator*(T) const; __device__ __host__ Vector operator/(const Vector&) const; __device__ __host__ Vector operator/(T) const; template<class Q = T> __device__ __host__ FloatEnable<Q, Vector> operator%(const Vector&) const; template<class Q = T> __device__ __host__ FloatEnable<Q, Vector> operator%(T) const; template<class Q = T> __device__ __host__ IntegralEnable<Q, Vector> operator%(const Vector&) const; template<class Q = T> __device__ __host__ IntegralEnable<Q, Vector> operator%(T) const; // Logic __device__ __host__ bool operator==(const Vector&) const; __device__ __host__ bool operator!=(const Vector&) const; __device__ __host__ bool operator<(const Vector&) const; __device__ __host__ bool operator<=(const Vector&) const; __device__ __host__ bool operator>(const Vector&) const; __device__ __host__ bool operator>=(const Vector&) const; // Utilty __device__ __host__ T Dot(const Vector&) const; template<class Q = T> __device__ __host__ FloatEnable<Q, T> Length() const; __device__ __host__ T LengthSqr() const; template<class Q = T> __device__ __host__ FloatEnable<Q, Vector> Normalize() const; template<class Q = T> __device__ __host__ FloatEnable<Q, Vector&> NormalizeSelf(); __device__ __host__ Vector Clamp(const Vector&, const Vector&) const; __device__ __host__ Vector Clamp(T min, T max) const; __device__ __host__ Vector& ClampSelf(const Vector&, const Vector&); __device__ __host__ Vector& ClampSelf(T min, T max); template<class Q = T> __device__ __host__ SignedEnable<Q, Vector> Abs() const; template<class Q = T> __device__ __host__ SignedEnable<Q, Vector&> AbsSelf(); template<class Q = T> __device__ __host__ FloatEnable<Q, Vector> Round() const; template<class Q = T> __device__ __host__ FloatEnable<Q, Vector&> RoundSelf(); template<class Q = T> __device__ __host__ FloatEnable<Q, Vector> Floor() const; template<class Q = T> __device__ __host__ FloatEnable<Q, Vector&> FloorSelf(); template<class Q = T> __device__ __host__ FloatEnable<Q, Vector> Ceil() const; template<class Q = T> __device__ __host__ FloatEnable<Q, Vector&> CeilSelf(); static __device__ __host__ Vector Min(const Vector&, const Vector&); static __device__ __host__ Vector Min(const Vector&, T); static __device__ __host__ Vector Max(const Vector&, const Vector&); static __device__ __host__ Vector Max(const Vector&, T); template<class Q = T> static __device__ __host__ FloatEnable<Q, Vector> Lerp(const Vector&, const Vector&, T); }; // Left scalars template<int N, class T> static __device__ __host__ Vector<N,T> operator*(T, const Vector<N, T>&); // Typeless vectors are defaulted to float using Vector2 = Vector<2, float>; using Vector3 = Vector<3, float>; using Vector4 = Vector<4, float>; // Float Type using Vector2f = Vector<2, float>; using Vector3f = Vector<3, float>; using Vector4f = Vector<4, float>; // Double Type using Vector2d = Vector<2, double>; using Vector3d = Vector<3, double>; using Vector4d = Vector<4, double>; // Integer Type using Vector2i = Vector<2, int>; using Vector3i = Vector<3, int>; using Vector4i = Vector<4, int>; // Unsigned Integer Type using Vector2ui = Vector<2, unsigned int>; using Vector3ui = Vector<3, unsigned int>; using Vector4ui = Vector<4, unsigned int>; // Long Types using Vector2l = Vector<2, int64_t>; using Vector2ul = Vector<2, uint64_t>; // Requirements of Vectors //static_assert(std::is_literal_type<Vector3>::value == true, "Vectors has to be literal types"); static_assert(std::is_trivially_copyable<Vector3>::value == true, "Vectors has to be trivially copyable"); static_assert(std::is_polymorphic<Vector3>::value == false, "Vectors should not be polymorphic"); // Alignment Checks static_assert(sizeof(Vector2) == 8, "Vector2 should be tightly packed"); static_assert(sizeof(Vector3) == 12, "Vector3 should be tightly packed"); static_assert(sizeof(Vector4) == 16, "Vector4 should be tightly packed"); // Cross product (only for 3d vectors) template <class T> static __device__ __host__ Vector<3, T> Cross(const Vector<3, T>&, const Vector<3, T>&); // Implementation #include "Vector.hpp" // CPU & GPU // Basic Constants static constexpr Vector3 XAxis = Vector3(1.0f, 0.0f, 0.0f); static constexpr Vector3 YAxis = Vector3(0.0f, 1.0f, 0.0f); static constexpr Vector3 ZAxis = Vector3(0.0f, 0.0f, 1.0f); // Zero Constants static constexpr Vector2 Zero2f = Vector2(0.0f, 0.0f); static constexpr Vector3 Zero3f = Vector3(0.0f, 0.0f, 0.0f); static constexpr Vector4 Zero4f = Vector4(0.0f, 0.0f, 0.0f, 0.0f); static constexpr Vector2 Zero2d = Vector2(0.0, 0.0); static constexpr Vector3 Zero3d = Vector3(0.0, 0.0, 0.0); static constexpr Vector4 Zero4d = Vector4(0.0, 0.0, 0.0, 0.0); static constexpr Vector2i Zero2i = Vector2i(0, 0); static constexpr Vector3i Zero3i = Vector3i(0, 0, 0); static constexpr Vector4i Zero4i = Vector4i(0, 0, 0, 0); static constexpr Vector2ui Zero2ui = Vector2ui(0u, 0u); static constexpr Vector3ui Zero3ui = Vector3ui(0u, 0u, 0u); static constexpr Vector4ui Zero4ui = Vector4ui(0u, 0u, 0u, 0u); static constexpr Vector2ul Zero2ul = Vector2ul(0ul, 0ul); static constexpr Vector2 Zero2 = Zero2f; static constexpr Vector3 Zero3 = Zero3f; static constexpr Vector4 Zero4 = Zero4f; // Vector Traits template<class T> struct IsVectorType { static constexpr bool value = std::is_same<T, Vector2f>::value || std::is_same<T, Vector2d>::value || std::is_same<T, Vector2i>::value || std::is_same<T, Vector2ui>::value || std::is_same<T, Vector3f>::value || std::is_same<T, Vector3d>::value || std::is_same<T, Vector3i>::value || std::is_same<T, Vector3ui>::value || std::is_same<T, Vector4f>::value || std::is_same<T, Vector4d>::value || std::is_same<T, Vector4i>::value || std::is_same<T, Vector4ui>::value; }; // Vector Etern extern template class Vector<2, float>; extern template class Vector<2, double>; extern template class Vector<2, int>; extern template class Vector<2, unsigned int>; extern template class Vector<3, float>; extern template class Vector<3, double>; extern template class Vector<3, int>; extern template class Vector<3, unsigned int>; extern template class Vector<4, float>; extern template class Vector<4, double>; extern template class Vector<4, int>; extern template class Vector<4, unsigned int>; extern template class Vector<2, int64_t>; extern template class Vector<2, uint64_t>; ======================= File: Source/RayLib/HybridFunctions.h ======================= #pragma once #include "CudaCheck.h" #include <algorithm> namespace HybridFuncs { template <class T> __device__ __host__ void Swap(T&, T&); template <class T> __device__ __host__ T Clamp(const T&, const T& min, const T& max); } template <class T> __device__ __host__ void HybridFuncs::Swap(T& t0, T& t1) { T temp = t0; t0 = t1; t1 = temp; } template <> __device__ __host__ inline float HybridFuncs::Clamp(const float& t, const float& minVal, const float& maxVal) { return fminf(fmaxf(minVal, t), maxVal); } template <> __device__ __host__ inline double HybridFuncs::Clamp(const double& t, const double& minVal, const double& maxVal) { return fmin(fmax(minVal, t), maxVal); } ======================= File: Source/RayLib/CommandCallbacksI.h ======================= <gh_stars>0 #pragma once #include <string> struct CameraPerspective; struct TracerOptions; enum class ImageType; class CommandCallbacksI { public: virtual ~CommandCallbacksI() = default; // Fundamental Scene Commands // Current Scene and Current Time on that Scene virtual void ChangeScene(const std::string) = 0; virtual void ChangeTime(const double) = 0; virtual void IncreaseTime(const double) = 0; virtual void DecreaseTime(const double) = 0; virtual void ChangeCamera(const CameraPerspective) = 0; virtual void ChangeCamera(const unsigned int) = 0; virtual void ChangeOptions(const TracerOptions) = 0; // Control Flow of the Simulation virtual void StartStopTrace(const bool) = 0; virtual void PauseContTrace(const bool) = 0; virtual void SetTimeIncrement(const double) = 0; virtual void SaveImage() = 0; // Default Image Save virtual void SaveImage(const std::string& path, // Location folder const std::string& fileName, // without extension ImageType, // Determines extension etc. bool overwriteFile) = 0; // Do overwrite // (if false new file will be created with suffix integer) }; ======================= File: Source/TracerLib/TracerThread.h ======================= #pragma once #include "RayLib/LoopingThreadI.h" #include "RayLib/ThreadData.h" #include "RayLib/Camera.h" #include "RayLib/TracerStructs.h" #include "RayLib/Types.h" class SceneI; class TracerI; class TracerBaseLogicI; /** Thread wrapper TracerI encapsulates system TracerThread is used to command Tracers using callbacks futures etc. */ class TracerThread : public LoopingThreadI { private: struct ImageSegment { Vector2i pixelStart; Vector2i pixelCount; }; private: // Actual Tracer TracerI& tracer; TracerBaseLogicI& logic; // Current Settings ThreadData<double> time; ThreadData<CameraPerspective> camera; ThreadData<Vector2i> resolution; ThreadData<uint32_t> sample; ThreadData<TracerOptions> options; ThreadData<ImageSegment> segment; ThreadData<PixelFormat> pixFormat; int currentFPS; int currentFrame; // Thread work void InitialWork() override; void LoopWork() override; void FinalWork() override; bool InternallyTerminated() const override; protected: public: // Constructors & Destructor TracerThread(TracerI&, TracerBaseLogicI&); TracerThread(const TracerThread&) = delete; TracerThread& operator=(const TracerThread&) = delete; ~TracerThread(); // State Change void ChangeCamera(const CameraPerspective&); void ChangeResolution(const Vector2i&); void ChangeTime(double seconds); void ChangePixelFormat(PixelFormat); void ChangeSampleCount(uint32_t); void ChangeOptions(const TracerOptions&); void ChangeImageSegment(const Vector2i& pixelStart, const Vector2i& pixelCount); }; inline TracerThread::TracerThread(TracerI& t, TracerBaseLogicI& l) : tracer(t) , logic(l) {} inline TracerThread::~TracerThread() { Stop(); } ======================= File: Source/RayLib/SceneIO.h ======================= #pragma once /** Scene file json interpeter and writer */ #include "SceneError.h" #include "Vector.h" #include "Matrix.h" #include "Quaternion.h" #include "SceneStructs.h" #include <sstream> #include <fstream> #include <nlohmann/json.hpp> struct CameraPerspective; template<class T> using IntegerEnable = typename std::enable_if<std::is_integral<T>::value>::type; template <class T> struct Range { // [start, end) T start; T end; }; namespace SceneIO { // Generic Time Dependency Check bool IsTimeDependent(const nlohmann::json&); // Load from anim template <class T> T LoadFromAnim(const std::string& fileName, double time = 0.0); // Static Loads bool LoadBool(const nlohmann::json&, double time = 0.0); std::string LoadString(const nlohmann::json&, double time = 0.0); template <class T> T LoadNumber(const nlohmann::json&, double time = 0.0); template <class T> Quaternion<T> LoadQuaternion(const nlohmann::json&, double time = 0.0); template <int N, class T> Vector<N, T> LoadVector(const nlohmann::json&, double time = 0.0); template <int N, class T> Matrix<N, T> LoadMatrix(const nlohmann::json&, double time = 0.0); // Ranged Arrays template <class T, typename = IntegerEnable<T>> std::vector<Range<T>> LoadRangedNumbers(const nlohmann::json&); // Utility std::string StripFileExt(const std::string& string); // Common Types LightStruct LoadLight(const nlohmann::json&, double time = 0.0); TransformStruct LoadTransform(const nlohmann::json&, double time = 0.0); CameraPerspective LoadCamera(const nlohmann::json&, double time = 0.0); SurfaceStruct LoadSurface(const nlohmann::json&, double time = 0.0); }; inline bool SceneIO::IsTimeDependent(const nlohmann::json& jsn) { std::string s; if(jsn.is_string() && (s = jsn).at(0) == '_') { return true; } return false; } template <class T> T SceneIO::LoadFromAnim(const std::string& fileName, double time) { // Strip '_' std::string filePath = fileName.substr(1); // Open File std::ifstream file(filePath); if(!file.is_open()) throw SceneException(SceneError::ANIMATION_FILE_NOT_FOUND); // TODO: // Read etc.... return T(); } inline bool SceneIO::LoadBool(const nlohmann::json& jsn, double time) { if(IsTimeDependent(jsn)) return LoadFromAnim<bool>(jsn, time); else if(jsn.is_boolean()) { bool val = jsn; return val; } else throw SceneException(SceneError::TYPE_MISMATCH); } inline std::string SceneIO::LoadString(const nlohmann::json& jsn, double time) { if(IsTimeDependent(jsn)) return LoadFromAnim<std::string>(jsn, time); else if(jsn.is_string()) { std::string val = jsn; return val; } else throw SceneException(SceneError::TYPE_MISMATCH); } template <class T> T SceneIO::LoadNumber(const nlohmann::json& jsn, double time) { if(IsTimeDependent(jsn)) return LoadFromAnim<T>(jsn, time); else if(jsn.is_number() && jsn.size() == 1) { T val = jsn; return val; } else throw SceneException(SceneError::TYPE_MISMATCH); } template <class T> Quaternion<T> SceneIO::LoadQuaternion(const nlohmann::json& jsn, double time) { if(IsTimeDependent(jsn)) return LoadFromAnim<Quaternion<T>>(jsn, time); else if(jsn.is_array() && jsn.size() == 4) { std::array<T, 4> array = jsn; return Quaternion<T>(array.data()); } else throw SceneException(SceneError::TYPE_MISMATCH); } template <int N, class T> Vector<N, T> SceneIO::LoadVector(const nlohmann::json& jsn, double time) { if(IsTimeDependent(jsn)) return LoadFromAnim<Vector<N, T>>(jsn, time); else if(jsn.is_array() && jsn.size() == N) { std::array<T, N> array = jsn; return Vector<N, T>(array.data()); } else throw SceneException(SceneError::TYPE_MISMATCH); } template <int N, class T> Matrix<N, T> SceneIO::LoadMatrix(const nlohmann::json& jsn, double time) { if(IsTimeDependent(jsn)) return LoadFromAnim<Matrix<N, T>>(jsn, time); else if(jsn.is_array() && jsn.size() == N * N) { std::array<T, N * N> array = jsn; return Matrix<N, T>(array.data()); } else throw SceneException(SceneError::TYPE_MISMATCH); } template <class T, typename> std::vector<Range<T>> SceneIO::LoadRangedNumbers(const nlohmann::json& jsn) { // It is mandatory for node to be an array if(jsn.is_array()) { std::vector<Range<T>> result; // Iterate for(const nlohmann::json& n : jsn) { // Each node can be either single integer or string // which can be decomposed of a range if(n.is_number()) { T num = n; result.push_back(Range<T>{num, num + 1}); } else if(n.is_string()) { // Decompose range std::string range = n; std::stringstream s(range); T start, end; s >> start; s >> range; s >> end; result.push_back(Range<T>{start, end + 1}); } else goto ERROR; } return result; } ERROR: throw SceneException(SceneError::TYPE_MISMATCH); } inline std::string SceneIO::StripFileExt(const std::string& string) { return string.substr(string.find_last_of('.') + 1); } ======================= File: Source/RayLib/Camera.h ======================= #pragma once #include "Vector.h" struct CameraPerspective { // World Space Lengths from camera Vector3 gazePoint; float nearPlane; Vector3 position; float farPlane; Vector3 up; float apertureSize; Vector2 fov; }; ======================= File: Source/RayLib/BasicSurfaceLoaders.h ======================= #pragma once #include <memory> #include <vector> #include "SurfaceLoaderI.h" #include "Vector.h" class InNodeTriLoader : public SurfaceLoader { public: static constexpr const char* TypeName() { return "nodeTriangle"; } private: protected: public: // Constructors & Destructor InNodeTriLoader(const SceneNodeI&, double time = 0.0); ~InNodeTriLoader() = default; // Type Determination const char* SufaceDataFileExt() const override; // Per Batch Fetch SceneError AABB(std::vector<AABB3>&) const override; SceneError PrimitiveRanges(std::vector<Vector2ul>&) const override; SceneError PrimitiveCounts(std::vector<size_t>&) const override; SceneError PrimitiveDataRanges(std::vector<Vector2ul>&) const override; // Entire Data Fetch SceneError GetPrimitiveData(Byte*, PrimitiveDataType primitiveDataType) const override; SceneError PrimitiveDataCount(size_t&, PrimitiveDataType primitiveDataType) const override; SceneError PrimDataLayout(PrimitiveDataLayout&, PrimitiveDataType primitiveDataType) const override; }; class InNodeTriLoaderIndexed : public SurfaceLoader { public: static constexpr const char* TypeName() { return "nodeTriangleIndexed"; } private: protected: public: // Constructors & Destructor InNodeTriLoaderIndexed(const SceneNodeI&, double time = 0.0); ~InNodeTriLoaderIndexed() = default; // Type Determination const char* SufaceDataFileExt() const override; // Per Batch Fetch SceneError AABB(std::vector<AABB3>&) const override; SceneError PrimitiveRanges(std::vector<Vector2ul>&) const override; SceneError PrimitiveCounts(std::vector<size_t>&) const override; SceneError PrimitiveDataRanges(std::vector<Vector2ul>&) const override; // Entire Data Fetch SceneError GetPrimitiveData(Byte*, PrimitiveDataType primitiveDataType) const override; SceneError PrimitiveDataCount(size_t&, PrimitiveDataType primitiveDataType) const override; SceneError PrimDataLayout(PrimitiveDataLayout&, PrimitiveDataType primitiveDataType) const override; }; class InNodeSphrLoader : public SurfaceLoader { public: static constexpr const char* TypeName() { return "nodeSphere"; } private: protected: public: // Constructors & Destructor InNodeSphrLoader(const SceneNodeI& node, double time = 0.0); ~InNodeSphrLoader() = default; // Type Determination const char* SufaceDataFileExt() const override; // Per Batch Fetch SceneError AABB(std::vector<AABB3>&) const override; SceneError PrimitiveRanges(std::vector<Vector2ul>&) const override; SceneError PrimitiveCounts(std::vector<size_t>&) const override; SceneError PrimitiveDataRanges(std::vector<Vector2ul>&) const override; // Entire Data Fetch SceneError GetPrimitiveData(Byte*, PrimitiveDataType primitiveDataType) const override; SceneError PrimitiveDataCount(size_t&, PrimitiveDataType primitiveDataType) const override; SceneError PrimDataLayout(PrimitiveDataLayout&, PrimitiveDataType primitiveDataType) const override; }; ======================= File: Source/TracerLib/RayMemory.h ======================= #pragma once /** General Device memory manager for ray and it's auxiliary data */ #include <set> #include "RayLib/ArrayPortion.h" #include "RayLib/HitStructs.h" #include "DeviceMemory.h" #include "RayStructs.h" class CudaGPU; template<class T> using RayPartitions = std::set<ArrayPortion<T>>; class RayMemory { private: // Leader GPU device that is responsible for // parititoning and sorting the ray data // (Only usefull in multi-GPU systems) const CudaGPU& leaderDevice; // Ray Related DeviceMemory memIn; DeviceMemory memOut; // In rays are enter material kernels RayGMem* dRayIn; // Those kernels will output one or multiple rays // Each material has a predefined max ray output // Out is allocated accordingly then materials fill it RayGMem* dRayOut; // Each ray has auxiliary data stored in these pointers // Single auxiliary struct can be defined per tracer system // and it is common. // (i.e. such struct may hold pixelId total accumulation etc) void* dRayAuxIn; void* dRayAuxOut; //--------------------------------------------------------- // Hit Related // Entire Hit related memory is allocated in bulk. DeviceMemory memHit; // MatKey holds the material group id and material group local id // This is used to sort rays to match kernels HitKey* dMaterialKeys; // Transform of the hit // Base accelerator fill this value with a potential hit TransformId* dTransformIds; // Primitive Id of the hit // Inner accelerators fill this value with a // primitive group local id PrimitiveId* dPrimitiveIds; // Custom hit Structure allocation pointer // This pointer is capable of holding data for all // hit stuructures currently active // (i.e. it holds Vec2 barcy coords for triangle primitives, // hold position for spheres (maybe spherical coords in order to save space). // or other custom value for a custom primitive (spline maybe i dunno) HitStructPtr dHitStructs; // Above code will be referenced by rayId for access // Since on each iteration some rays are finalzed (like out of bounds etc.) // We should skip them partition code will omit those rays accordingly. // -- // Double buffer and temporary memory for sorting // Key/Index pair (key can either be accelerator or material) void* dTempMemory; RayId* dIds0, *dIds1; HitKey* dKeys0, *dKeys1; // Current pointers to the double buffer // In hit portion of the code it holds accelerator ids etc. HitKey* dCurrentKeys; RayId* dCurrentIds; // Cub Requires acutal tempMemory size // It sometimes crash if you give larger memory size // I dunno why size_t cubIfMemSize; size_t cubSortMemSize; public: // Constructors & Destructor RayMemory(const CudaGPU&); RayMemory(const RayMemory&) = delete; RayMemory(RayMemory&&) = default; RayMemory& operator=(const RayMemory&) = delete; RayMemory& operator=(RayMemory&&) = default; ~RayMemory() = default; // Accessors // Ray In RayGMem* Rays(); template<class T> const T* RayAux() const; // Ray Out RayGMem* RaysOut(); template<class T> T* RayAuxOut(); // Hit Related HitStructPtr HitStructs(); const HitStructPtr HitStructs() const; HitKey* MaterialKeys(); const HitKey* MaterialKeys() const; TransformId* TransformIds(); const TransformId* TransformIds() const; PrimitiveId* PrimitiveIds(); const PrimitiveId* PrimitiveIds() const; // HitKey* CurrentKeys(); const HitKey* CurrentKeys() const; RayId* CurrentIds(); const RayId* CurrentIds() const; // Misc // Sets leader device which is responsible for sort and partition kernel calls //void SetLeaderDevice(const CudaGPU&); const CudaGPU& LeaderDevice() const; // Memory Allocation void ResetHitMemory(uint32_t rayCount, size_t hitStructSize); void ResizeRayOut(uint32_t rayCount, size_t perRayAuxSize, HitKey baseBoundMatKey); void SwapRays(); // Common Functions // Sorts the hit list for multi-kernel calls void SortKeys(RayId*& ids, HitKey*& keys, uint32_t count, const Vector2i& bitRange); // Partitions the segments for multi-kernel calls RayPartitions<uint32_t> Partition(uint32_t rayCount); // Initialize HitIds and Indices void FillMatIdsForSort(uint32_t rayCount); }; //inline void RayMemory::SetLeaderDevice(const CudaGPU& d) //{ // leaderDevice = &d; //} inline const CudaGPU& RayMemory::LeaderDevice() const { return leaderDevice; } inline RayGMem* RayMemory::Rays() { return dRayIn; } template<class T> inline const T* RayMemory::RayAux() const { return static_cast<const T*>(dRayAuxIn); } inline RayGMem* RayMemory::RaysOut() { return dRayOut; } template<class T> inline T* RayMemory::RayAuxOut() { return static_cast<T*>(dRayAuxOut); } inline HitStructPtr RayMemory::HitStructs() { return dHitStructs; } inline const HitStructPtr RayMemory::HitStructs() const { return dHitStructs; } inline HitKey* RayMemory::MaterialKeys() { return dMaterialKeys; } inline const HitKey* RayMemory::MaterialKeys() const { return dMaterialKeys; } inline TransformId* RayMemory::TransformIds() { return dTransformIds; } inline const TransformId* RayMemory::TransformIds() const { return dTransformIds; } inline PrimitiveId* RayMemory::PrimitiveIds() { return dPrimitiveIds; } inline const PrimitiveId* RayMemory::PrimitiveIds() const { return dPrimitiveIds; } // inline HitKey* RayMemory::CurrentKeys() { return dCurrentKeys; } inline const HitKey* RayMemory::CurrentKeys() const { return dCurrentKeys; } inline RayId* RayMemory::CurrentIds() { return dCurrentIds; } inline const RayId* RayMemory::CurrentIds() const { return dCurrentIds; } ======================= File: Source/TracerLib/TracerLogicPools.h ======================= <reponame>yalcinerbora/meturay #pragma once #include <map> #include <string> #include <regex> #include "TracerTypeGenerators.h" class AcceleratorLogicPoolI { protected: std::map<std::string, GPUAccelGroupGen> acceleratorGroupGenerators; std::map<std::string, GPUAccelBatchGen> acceleratorBatchGenerators; public: static constexpr const char* DefaultConstructorName = "GenAcceleratorPool"; static constexpr const char* DefaultDestructorName = "DelAcceleratorPool"; virtual ~AcceleratorLogicPoolI() = default; virtual std::map<std::string, GPUAccelGroupGen> AcceleratorGroupGenerators(const std::string regex = ".*") const; virtual std::map<std::string, GPUAccelBatchGen> AcceleratorBatchGenerators(const std::string regex = ".*") const; }; class BaseAcceleratorLogicPoolI { protected: std::map<std::string, GPUBaseAccelGen> baseAcceleratorGroupGenerators; public: static constexpr const char* DefaultConstructorName = "GenBaseAcceleratorPool"; static constexpr const char* DefaultDestructorName = "DelBaseAcceleratorPool"; virtual ~BaseAcceleratorLogicPoolI() = default; virtual std::map<std::string, GPUBaseAccelGen> BaseAcceleratorGenerators(const std::string regex = ".*") const; }; class PrimitiveLogicPoolI { protected: std::map<std::string, GPUPrimGroupGen> primitiveGenerators; public: static constexpr const char* DefaultConstructorName = "GenPrimitivePool"; static constexpr const char* DefaultDestructorName = "DelPrimitivePool"; virtual ~PrimitiveLogicPoolI() = default; virtual std::map<std::string, GPUPrimGroupGen> PrimitiveGenerators(const std::string regex = ".*") const; }; class MaterialLogicPoolI { protected: std::map<std::string, GPUMatGroupGen> materialGroupGenerators; std::map<std::string, GPUMatBatchGen> materialBatchGenerators; public: static constexpr const char* DefaultConstructorName = "GenMaterialPool"; static constexpr const char* DefaultDestructorName = "DelMaterialPool"; virtual ~MaterialLogicPoolI() = default; virtual std::map<std::string, GPUMatGroupGen> MaterialGroupGenerators(const std::string regex = ".*") const; virtual std::map<std::string, GPUMatBatchGen> MaterialBatchGenerators(const std::string regex = ".*") const; }; class TracerLogicPoolI { protected: std::map<std::string, GPUTracerGen> tracerLogicGenerators; public: static constexpr const char* DefaultConstructorName = "GenTracerPoolPool"; static constexpr const char* DefaultDestructorName = "DelTracerPool"; virtual ~TracerLogicPoolI() = default; virtual std::map<std::string, GPUTracerGen> TracerGenerators(const std::string regex = ".*") const; }; class EstimatorLogicPoolI { protected: std::map<std::string, GPUEstimatorGen> estimatorGenerators; public: static constexpr const char* DefaultConstructorName = "GenEstimatorPool"; static constexpr const char* DefaultDestructorName = "DelEstimatorPool"; virtual ~EstimatorLogicPoolI() = default; virtual std::map<std::string, GPUEstimatorGen> EstimatorGenerators(const std::string regex = ".*") const; }; inline std::map<std::string, GPUAccelGroupGen> AcceleratorLogicPoolI::AcceleratorGroupGenerators(const std::string regex) const { std::map<std::string, GPUAccelGroupGen> result; std::regex regExpression(regex); for(const auto& batchGenerator : acceleratorGroupGenerators) { if(std::regex_match(batchGenerator.first, regExpression)) result.emplace(batchGenerator); } return result; } inline std::map<std::string, GPUAccelBatchGen> AcceleratorLogicPoolI::AcceleratorBatchGenerators(const std::string regex) const { std::map<std::string, GPUAccelBatchGen> result; std::regex regExpression(regex); for(const auto& batchGenerator : acceleratorBatchGenerators) { if(std::regex_match(batchGenerator.first, regExpression)) result.emplace(batchGenerator); } return result; } inline std::map<std::string, GPUBaseAccelGen> BaseAcceleratorLogicPoolI::BaseAcceleratorGenerators(const std::string regex ) const { std::map<std::string, GPUBaseAccelGen> result; std::regex regExpression(regex); for(const auto& accelGenerator : baseAcceleratorGroupGenerators) { if(std::regex_match(accelGenerator.first, regExpression)) result.emplace(accelGenerator); } return result; } inline std::map<std::string, GPUPrimGroupGen> PrimitiveLogicPoolI::PrimitiveGenerators(const std::string regex) const { std::map<std::string, GPUPrimGroupGen> result; std::regex regExpression(regex); for(const auto& primGenerator : primitiveGenerators) { if(std::regex_match(primGenerator.first, regExpression)) result.emplace(primGenerator); } return result; } inline std::map<std::string, GPUMatGroupGen> MaterialLogicPoolI::MaterialGroupGenerators(const std::string regex) const { std::map<std::string, GPUMatGroupGen> result; std::regex regExpression(regex); for(const auto& groupGenerator : materialGroupGenerators) { if(std::regex_match(groupGenerator.first, regExpression)) result.emplace(groupGenerator); } return result; } inline std::map<std::string, GPUMatBatchGen> MaterialLogicPoolI::MaterialBatchGenerators(const std::string regex) const { std::map<std::string, GPUMatBatchGen> result; std::regex regExpression(regex); for(const auto& batchGenerator : materialBatchGenerators) { if(std::regex_match(batchGenerator.first, regExpression)) result.emplace(batchGenerator); } return result; } inline std::map<std::string, GPUTracerGen> TracerLogicPoolI::TracerGenerators(const std::string regex) const { std::map<std::string, GPUTracerGen> result; std::regex regExpression(regex); for(const auto& tracerGenerator : tracerLogicGenerators) { if(std::regex_match(tracerGenerator.first, regExpression)) result.emplace(tracerGenerator); } return result; } inline std::map<std::string, GPUEstimatorGen> EstimatorLogicPoolI::EstimatorGenerators(const std::string regex) const { std::map<std::string, GPUEstimatorGen> result; std::regex regExpression(regex); for(const auto& estimatorGenerator : estimatorGenerators) { if(std::regex_match(estimatorGenerator.first, regExpression)) result.emplace(estimatorGenerator); } return result; } ======================= File: Source/TracerLib/ScenePartitioner.h ======================= <filename>Source/TracerLib/ScenePartitioner.h<gh_stars>0 #pragma once #include "ScenePartitionerI.h" #include "CudaConstants.h" // Basic Partitioner (Throws everything to first GPU) class SingleGPUScenePartitioner : public ScenePartitionerI { private: const CudaSystem& system; protected: public: // Constructors & Destructor SingleGPUScenePartitioner(const CudaSystem&); ~SingleGPUScenePartitioner() = default; // Interface SceneError PartitionMaterials(MultiGPUMatNodes&, MultiGPUMatBatches&, int&, // Single Input MaterialNodeList& materialGroups, MaterialBatchList& materialBatches) const override; }; ======================= File: Source/RayLib/FileSystemUtility.h ======================= <reponame>yalcinerbora/meturay #pragma once #include <filesystem> namespace Utilitiy { inline std::string MergeFileFolder(const std::string& folder, const std::string& file) { // Return file if file is absolute // If not make file relative to the path (concat) std::filesystem::path filePath(file); if(filePath.is_absolute()) return file; else { std::filesystem::path folderPath(folder); auto mergedPath = folderPath / file; return mergedPath.string(); } } } ======================= File: Source/TracerLib/CudaConstants.h ======================= <gh_stars>0 #pragma once /** Compile Time Cuda Constants Thread per Block etc.. */ #ifdef METU_SHARED_GPULIST #define METU_SHARED_TRACER_ENTRY_POINT __declspec(dllexport) #else #define METU_SHARED_TRACER_ENTRY_POINT __declspec(dllimport) #endif #include <cuda.h> #include <set> #include <array> #include <vector> #include "RayLib/Vector.h" #include "RayLib/Error.h" // Except first generation this did not change having this compile time constant is a bliss static constexpr unsigned int WarpSize = 32; // Thread Per Block Constants static constexpr unsigned int BlocksPerSM = 32; static constexpr unsigned int StaticThreadPerBlock1D = 256; static constexpr unsigned int StaticThreadPerBlock2D_X = 16; static constexpr unsigned int StaticThreadPerBlock2D_Y = 16; static constexpr Vector2ui StaticThreadPerBlock2D = Vector2ui(StaticThreadPerBlock2D_X, StaticThreadPerBlock2D_Y); struct CudaError : public ErrorI { public: enum Type { OK, OLD_DRIVER, NO_DEVICE, // End END }; private: Type type; public: // Constructors & Destructor CudaError(Type); ~CudaError() = default; operator Type() const; operator std::string() const override; }; inline CudaError::CudaError(CudaError::Type t) : type(t) {} inline CudaError::operator Type() const { return type; } inline CudaError::operator std::string() const { static constexpr char const* const ErrorStrings[] = { "OK", "Driver is not up-to-date", "No cuda capable device is found" }; static_assert((sizeof(ErrorStrings) / sizeof(const char*)) == static_cast<size_t>(CudaError::END), "Enum and enum string list size mismatch."); return ErrorStrings[static_cast<int>(type)]; } class CudaGPU { public: enum GPUTier { GPU_UNSUPPORTED, GPU_KEPLER, GPU_MAXWELL, GPU_PASCAL, GPU_TURING_VOLTA }; static GPUTier DetermineGPUTier(cudaDeviceProp); private: struct WorkGroup { static constexpr size_t MAX_STREAMS = 64; std::array<cudaEvent_t, MAX_STREAMS> events; std::array<cudaStream_t, MAX_STREAMS> works; cudaEvent_t mainEvent; mutable int currentIndex; int totalStreams; // Constructors WorkGroup(); WorkGroup(int deviceId, int streamCount); WorkGroup(const WorkGroup&) = delete; WorkGroup(WorkGroup&&); WorkGroup& operator=(const WorkGroup&) = delete; WorkGroup& operator=(WorkGroup&&); ~WorkGroup(); cudaStream_t UseGroup() const; void WaitAllStreams() const; void WaitMainStream() const; }; private: int deviceId; cudaDeviceProp props; GPUTier tier; WorkGroup workList; uint32_t DetermineGridStrideBlock(uint32_t sharedMemSize, uint32_t threadCount, size_t workCount, void* func) const; protected: public: // Constrctors & Destructor explicit CudaGPU(int deviceId); CudaGPU(const CudaGPU&) = delete; CudaGPU(CudaGPU&&) = default; CudaGPU& operator=(const CudaGPU&) = delete; CudaGPU& operator=(CudaGPU&&) = default; ~CudaGPU() = default; // int DeviceId() const; std::string Name() const; double TotalMemoryMB() const; double TotalMemoryGB() const; GPUTier Tier() const; size_t TotalMemory() const; Vector2i MaxTexture2DSize() const; uint32_t SMCount() const; uint32_t RecommendedBlockCountPerSM(void* kernkernelFuncelPtr, uint32_t threadsPerBlock = StaticThreadPerBlock1D, uint32_t sharedMemSize = 0) const; cudaStream_t DetermineStream(uint32_t requiredSMCount) const; void WaitAllStreams() const; void WaitMainStream() const; bool operator<(const CudaGPU&) const; // Classic GPU Calls // Create just enough blocks according to work size template<class Function, class... Args> __host__ void KC_X(uint32_t sharedMemSize, cudaStream_t stream, size_t workCount, // Function&& f, Args&&...) const; template<class Function, class... Args> __host__ void KC_XY(uint32_t sharedMemSize, cudaStream_t stream, size_t workCount, // Function&& f, Args&&...) const; // Grid-Stride Kernels // Convenience Functions For Kernel Call // Simple full GPU utilizing calls over a stream template<class Function, class... Args> __host__ void GridStrideKC_X(uint32_t sharedMemSize, cudaStream_t stream, size_t workCount, // Function&&, Args&&...) const; template<class Function, class... Args> __host__ void GridStrideKC_XY(uint32_t sharedMemSize, cudaStream_t stream, size_t workCount, // Function&&, Args&&...) const; // Smart GPU Calls // Automatic stream split // Only for grid strided kernels, and for specific GPU // Material calls require difrrent GPUs (texture sharing) // TODO: template<class Function, class... Args> __host__ void AsyncGridStrideKC_X(uint32_t sharedMemSize, size_t workCount, // Function&&, Args&&...) const; template<class Function, class... Args> __host__ void AsyncGridStrideKC_XY(uint32_t sharedMemSize, size_t workCount, // Function&&, Args&&...) const; }; // Verbosity using GPUList = std::set<CudaGPU>; class CudaSystem { private: GPUList systemGPUs; //CudaError systemStatus; protected: public: // Constructors & Destructor CudaSystem() = default; CudaSystem(const CudaSystem&) = delete; CudaError Initialize(); // Multi-Device Splittable Smart GPU Calls // Automatic device split and stream split on devices const std::vector<size_t> GridStrideMultiGPUSplit(size_t workCount, uint32_t threadCount, uint32_t sharedMemSize, void* f) const; // Misc const GPUList& GPUList() const; // Device Synchronization void SyncGPUMainStreamAll() const; void SyncGPUMainStream(const CudaGPU& deviceId) const; void SyncGPUAll() const; void SyncGPU(const CudaGPU& deviceId) const; }; template<class Function, class... Args> __host__ void CudaGPU::KC_X(uint32_t sharedMemSize, cudaStream_t stream, size_t workCount, // Function&& f, Args&&... args) const { CUDA_CHECK(cudaSetDevice(deviceId)); uint32_t blockCount = static_cast<uint32_t>((workCount + (StaticThreadPerBlock1D - 1)) / StaticThreadPerBlock1D); uint32_t blockSize = StaticThreadPerBlock1D; f<<<blockCount, blockSize, sharedMemSize, stream>>>(args...); CUDA_KERNEL_CHECK(); } template<class Function, class... Args> __host__ void CudaGPU::KC_XY(uint32_t sharedMemSize, cudaStream_t stream, size_t workCount, // Function&& f, Args&&... args) const { CUDA_CHECK(cudaSetDevice(deviceId)); size_t linearThreadCount = StaticThreadPerBlock2D[0] * StaticThreadPerBlock2D[1]; size_t blockCount = (workCount + (linearThreadCount - 1)) / StaticThreadPerBlock1D; uint32_t blockSize = StaticThreadPerBlock1D; f<<<blockCount, blockSize, sharedMemSize, stream>>> (args...); CUDA_KERNEL_CHECK(); } template<class Function, class... Args> __host__ inline void CudaGPU::GridStrideKC_X(uint32_t sharedMemSize, cudaStream_t stream, size_t workCount, // Function&& f, Args&&... args) const { const size_t threadCount = StaticThreadPerBlock1D; uint32_t blockCount = DetermineGridStrideBlock(sharedMemSize, threadCount, workCount, &f); // Full potential GPU Call CUDA_CHECK(cudaSetDevice(deviceId)); uint32_t blockSize = StaticThreadPerBlock1D; f<<<blockCount, blockSize, sharedMemSize, stream>>> (args...); CUDA_KERNEL_CHECK(); } template<class Function, class... Args> __host__ inline void CudaGPU::GridStrideKC_XY(uint32_t sharedMemSize, cudaStream_t stream, size_t workCount, // Function&& f, Args&&... args) const { const size_t threadCount = StaticThreadPerBlock2D[0] * StaticThreadPerBlock2D[1]; uint32_t blockCount = DetermineGridStrideBlock(sharedMemSize, threadCount, workCount, &f); CUDA_CHECK(cudaSetDevice(deviceId)); dim3 blockSize = dim3(StaticThreadPerBlock2D[0], StaticThreadPerBlock2D[1]); f<<<blockCount, blockSize, sharedMemSize, stream>>>(args...); CUDA_KERNEL_CHECK(); } template<class Function, class... Args> __host__ void CudaGPU::AsyncGridStrideKC_X(uint32_t sharedMemSize, size_t workCount, // Function&& f, Args&&... args) const { const size_t threadCount = StaticThreadPerBlock1D; uint32_t requiredSMCount = DetermineGridStrideBlock(sharedMemSize, threadCount, workCount, &f); cudaStream_t stream = DetermineStream(requiredSMCount); CUDA_CHECK(cudaSetDevice(deviceId)); uint32_t blockSize = StaticThreadPerBlock1D; f<<<requiredSMCount, blockSize, sharedMemSize, stream>>>(args...); CUDA_KERNEL_CHECK(); } template<class Function, class... Args> __host__ void CudaGPU::AsyncGridStrideKC_XY(uint32_t sharedMemSize, size_t workCount, // Function&& f, Args&&... args) const { const size_t threadCount = StaticThreadPerBlock2D[0] * StaticThreadPerBlock2D[1]; uint32_t requiredSMCount = DetermineGridStrideBlock(sharedMemSize, thread, workCount, &f); cudaStream_t stream = GPUList()[gpuIndex].DetermineStream(requiredSMCount); CUDA_CHECK(cudaSetDevice(deviceId)); dim3 blockSize = dim3(StaticThreadPerBlock2D[0], StaticThreadPerBlock2D[1]); f<<<requiredSMCount, blockSize, sharedMemSize, stream>>>(args...); CUDA_KERNEL_CHECK(); } inline const GPUList& CudaSystem::GPUList() const { return systemGPUs; } inline void CudaSystem::SyncGPUMainStreamAll() const { int currentDevice; CUDA_CHECK(cudaGetDevice(&currentDevice)); for(const auto& gpu : systemGPUs) { gpu.WaitMainStream(); } CUDA_CHECK(cudaSetDevice(currentDevice)); } inline void CudaSystem::SyncGPUMainStream(const CudaGPU& gpu) const { int currentDevice; CUDA_CHECK(cudaGetDevice(&currentDevice)); auto i = systemGPUs.end(); if((i = systemGPUs.find(gpu))!= systemGPUs.end()) { i->WaitMainStream(); } CUDA_CHECK(cudaSetDevice(currentDevice)); } inline void CudaSystem::SyncGPUAll() const { int currentDevice; CUDA_CHECK(cudaGetDevice(&currentDevice)); for(const auto& gpu : systemGPUs) { gpu.WaitAllStreams(); gpu.WaitMainStream(); break; } CUDA_CHECK(cudaSetDevice(currentDevice)); } inline void CudaSystem::SyncGPU(const CudaGPU& gpu) const { int currentDevice; CUDA_CHECK(cudaGetDevice(&currentDevice)); auto i = systemGPUs.end(); if((i = systemGPUs.find(gpu))!= systemGPUs.end()) { i->WaitAllStreams(); i->WaitMainStream(); } CUDA_CHECK(cudaSetDevice(currentDevice)); } ======================= File: Source/RayLib/TracerDebug.h ======================= #pragma once #include <string> #include <iomanip> #include <sstream> #include <fstream> #include "HitStructs.h" #include "Log.h" #include "CudaConstants.h" namespace Debug { void PrintHitPairs(const RayId* ids, const HitKey* keys, size_t count); void WriteHitPairs(const RayId* ids, const HitKey* keys, size_t count, const std::string& file); template <class T> void PrintData(const T* ids, size_t count); template <class T> void WriteData(const T* ids, size_t count, const std::string& fileName); namespace Detail { template <class T> void OutputData(std::ostream& s, const T* hits, size_t count); } } template <class T> void Debug::PrintData(const T* data, size_t count) { std::stringstream s; Detail::OutputData(s, data, count); METU_LOG("%s", s.str().c_str()); } template <class T> void Debug::WriteData(const T* data, size_t count, const std::string& fileName) { std::ofstream f(fileName); Detail::OutputData(f, data, count); } template <class T> void Debug::Detail::OutputData(std::ostream& s, const T* data, size_t count) { CUDA_CHECK(cudaDeviceSynchronize()); for(size_t i = 0; i < count; i++) { s << std::dec << std::setw(0) << std::setfill(' ') << data[i] << ", "; } } ======================= File: Source/Tests/SimpleTracerSetup.h ======================= #pragma once #include <gtest/gtest.h> // Common #include "RayLib/System.h" #include "RayLib/Log.h" #include "RayLib/Constants.h" #include "RayLib/CPUTimer.h" #include "RayLib/SurfaceLoaderGenerator.h" #include "RayLib/TracerStatus.h" #include "RayLib/DLLError.h" // Visor #include "RayLib/VisorI.h" #include "RayLib/VisorWindowInput.h" #include "RayLib/MovementSchemes.h" #include "VisorGL/VisorGLEntry.h" // Tracer #include "TracerLib/GPUSceneJson.h" #include "TracerLib/TracerLoader.h" #include "TracerLib/TracerBase.h" #include "TracerLib/ScenePartitioner.h" #include "TracerLib/TracerLogicGenerator.h" // Node #include "RayLib/VisorCallbacksI.h" #include "RayLib/TracerCallbacksI.h" #include "RayLib/NodeI.h" #include "RayLib/AnalyticData.h" #include "RayLib/TracerError.h" #define ERROR_CHECK(ErrType, e) \ if(e!= ErrType::OK) \ {\ METU_ERROR_LOG("%s", static_cast<std::string>(e).c_str()); \ return false;\ } class MockNode : public VisorCallbacksI , public TracerCallbacksI , public NodeI { public: static constexpr uint32_t MAX_BOUNCES = 16; static constexpr int SAMPLE_COUNT = 3; //static constexpr Vector2i IMAGE_RESOLUTION = {32, 18}; //static constexpr Vector2i IMAGE_RESOLUTION = {320, 180}; //static constexpr Vector2i IMAGE_RESOLUTION = {640, 360}; static constexpr Vector2i IMAGE_RESOLUTION = {1280, 720}; //static constexpr Vector2i IMAGE_RESOLUTION = {1600, 900}; //static constexpr Vector2i IMAGE_RESOLUTION = {1920, 1080}; //static constexpr Vector2i IMAGE_RESOLUTION = {3840, 2160}; private: const double Duration; VisorI& visor; TracerI& tracer; GPUSceneI& scene; protected: public: // Constructor & Destructor MockNode(VisorI&, TracerI&, GPUSceneI&, double duration); ~MockNode() = default; // From Command Callbacks void ChangeScene(const std::string) override {} void ChangeTime(const double) override {} void IncreaseTime(const double) override {} void DecreaseTime(const double) override {} void ChangeCamera(const CameraPerspective) override {} void ChangeCamera(const unsigned int) override {} void ChangeOptions(const TracerOptions) override {} void StartStopTrace(const bool) override {} void PauseContTrace(const bool) override {} void SetTimeIncrement(const double) override {} void SaveImage() override {} void SaveImage(const std::string& path, const std::string& fileName, ImageType, bool overwriteFile) override {} void WindowMinimizeAction(bool minimized) override {} void WindowCloseAction() override {} // From Tracer Callbacks void SendLog(const std::string) override; void SendError(TracerError) override; void SendAnalyticData(AnalyticData) override {} void SendImage(const std::vector<Byte> data, PixelFormat, size_t offset, Vector2i start = Zero2i, Vector2i end = BaseConstants::IMAGE_MAX_SIZE) override; void SendAccelerator(HitKey key, const std::vector<Byte> data) override {} void SendBaseAccelerator(const std::vector<Byte> data) override {} // From Node Interface NodeError Initialize() override { return NodeError::OK; } void Work() override; }; MockNode::MockNode(VisorI& v, TracerI& t, GPUSceneI& s, double duration) : visor(v) , tracer(t) , scene(s) , Duration(duration) {} void MockNode::SendLog(const std::string s) { METU_LOG("Tracer: %s", s.c_str()); } void MockNode::SendError(TracerError err) { METU_ERROR_LOG("Tracer: %s", static_cast<std::string>(err).c_str()); } void MockNode::SendImage(const std::vector<Byte> data, PixelFormat f, size_t offset, Vector2i start, Vector2i end) { visor.AccumulatePortion(std::move(data), f, offset, start, end); } void MockNode::Work() { Utility::CPUTimer t; t.Start(); double elapsed = 0.0; // Specifically do not use self nodes loop functionality here // Main Poll Loop while(visor.IsOpen()) { // Run tracer tracer.GenerateInitialRays(scene, 0, SAMPLE_COUNT); uint32_t i = 0; while(tracer.Continue() && i < MAX_BOUNCES) { tracer.Render(); i++; } tracer.FinishSamples(); //printf("\n----------------------------------\n"); // Before try to show do render loop visor.Render(); // Present Back Buffer visor.ProcessInputs(); // Timing and Window Termination t.Lap(); elapsed += t.Elapsed<CPUTimeSeconds>(); double elapsedS = t.Elapsed<CPUTimeSeconds>(); double rps = SAMPLE_COUNT * SAMPLE_COUNT * IMAGE_RESOLUTION[0] * IMAGE_RESOLUTION[1]; rps *= (1.0 / elapsedS); rps /= 1'000'000.0; fprintf(stdout, "%c[2K", 27); fprintf(stdout, "Time: %fs Rps: %fM ray/s\r", elapsedS, rps); //if(elapsed >= Duration) break; } METU_LOG("\n"); } class SimpleTracerSetup { private: static constexpr Vector2i SCREEN_RESOLUTION = {1280, 720}; static constexpr double WINDOW_DURATION = 3.5; static constexpr PixelFormat IMAGE_PIXEL_FORMAT = PixelFormat::RGBA_FLOAT; static constexpr const char* ESTIMATOR_TYPE = "BasicEstimator"; static constexpr const char* TRACER_TYPE = "BasicTracer"; static constexpr const char* TRACER_DLL = "Tracer-Test"; static constexpr const char* TRACER_LOGIC_POOL_GEN = "GenerateTestTracerPool"; static constexpr const char* TRACER_LOGIC_POOL_DEL = "DeleteTestTracerPool"; static constexpr const char* TRACER_MAT_POOL_GEN = "GenerateTestMaterialPool"; static constexpr const char* TRACER_MAT_POOL_DEL = "DeleteTestMaterialPool"; static constexpr const char* SURF_LOAD_DLL = "AssimpSurfaceLoaders"; static constexpr const char* SURF_LOAD_GEN = "GenerateAssimpPool"; static constexpr const char* SURF_LOAD_DEL = "DeleteAssimpPool"; static constexpr TracerParameters TRACER_PARAMETERS = { 0 // Seed }; static constexpr TracerOptions TRACER_OPTIONS = { false // Verbose }; // Surface Loader Generators (Classes of primitive file loaders) SurfaceLoaderGenerator surfaceLoaders; // Tracer Logic Generators (Classes of CUDA Coda Segments) TracerLogicGenerator generator; // Scene Tracer and Visor std::unique_ptr<VisorI> visorView; std::unique_ptr<TracerBase> tracerBase; std::unique_ptr<GPUSceneJson> gpuScene; std::unique_ptr<CudaSystem> cudaSystem; // Visor Input std::unique_ptr<VisorWindowInput> visorInput; // Self Node std::unique_ptr<MockNode> node; const std::u8string sceneName; const double sceneTime; public: // Constructors & Destructor SimpleTracerSetup(std::u8string sceneName, double sceneTime); SimpleTracerSetup() = default; bool Init(); void Body(); }; SimpleTracerSetup::SimpleTracerSetup(std::u8string sceneName, double sceneTime) : sceneName(sceneName) , sceneTime(sceneTime) , visorView(nullptr) , tracerBase(nullptr) , gpuScene(nullptr) , visorInput(nullptr) , node(nullptr) {} bool SimpleTracerSetup::Init() { TracerStatus status = { sceneName, 0, 0, CameraPerspective{}, MockNode::IMAGE_RESOLUTION, IMAGE_PIXEL_FORMAT, 0.0, false, false, TRACER_OPTIONS }; // Load Materials from Test-Material Shared Library DLLError dllE = generator.IncludeMaterialsFromDLL(TRACER_DLL, ".*", SharedLibArgs{TRACER_MAT_POOL_GEN, TRACER_MAT_POOL_DEL}); ERROR_CHECK(DLLError, dllE); // Load Tracer Logics from Test-Material Shared Library dllE = generator.IncludeTracersFromDLL(TRACER_DLL, ".*", SharedLibArgs{TRACER_LOGIC_POOL_GEN, TRACER_LOGIC_POOL_DEL}); ERROR_CHECK(DLLError, dllE); // Load Assimp Surface Loader for loading files dllE = surfaceLoaders.IncludeLoadersFromDLL(SURF_LOAD_DLL, ".*", SharedLibArgs{SURF_LOAD_GEN, SURF_LOAD_DEL}); ERROR_CHECK(DLLError, dllE); // Load GFG Surface Loader for gfg data // Generate GPU List & A Partitioner // Check cuda system error here cudaSystem = std::make_unique<CudaSystem>(); CudaError cudaE = cudaSystem->Initialize(); ERROR_CHECK(CudaError, cudaE); // GPU Data Partitioner SingleGPUScenePartitioner partitioner(*cudaSystem); // Load Scene gpuScene = std::make_unique<GPUSceneJson>(sceneName, partitioner, generator, surfaceLoaders); SceneError scnE = gpuScene->LoadScene(TRACER_PARAMETERS, sceneTime); ERROR_CHECK(SceneError, scnE); MovementScemeList MovementSchemeList = {}; KeyboardKeyBindings KeyBinds = VisorConstants::DefaultKeyBinds; MouseKeyBindings MouseBinds = VisorConstants::DefaultButtonBinds; // Visor Input Generation visorInput = std::make_unique<VisorWindowInput>(std::move(KeyBinds), std::move(MouseBinds), std::move(MovementSchemeList), gpuScene->CamerasCPU()[0]); // Window Params VisorOptions visorOpts; visorOpts.stereoOn = false; visorOpts.vSyncOn = false; visorOpts.eventBufferSize = 128; visorOpts.fpsLimit = 24.0f; visorOpts.wSize = SCREEN_RESOLUTION; visorOpts.wFormat = IMAGE_PIXEL_FORMAT; visorOpts.iFormat = IMAGE_PIXEL_FORMAT; visorOpts.iSize = MockNode::IMAGE_RESOLUTION; // Create Visor visorView = CreateVisorGL(visorOpts); visorView->SetInputScheme(*visorInput); // Set Window Res wrt to monitor resolution Vector2i newImgSize = 3 * visorView->MonitorResolution() / 5; visorView->SetWindowSize(newImgSize); // Attach the logic & Image format tracerBase = std::make_unique<TracerBase>(*cudaSystem); tracerBase->AttachLogic(*generator.GetTracerLogic()); tracerBase->SetImagePixelFormat(IMAGE_PIXEL_FORMAT); tracerBase->ResizeImage(MockNode::IMAGE_RESOLUTION); tracerBase->ReportionImage(); tracerBase->ResetImage(); tracerBase->SetOptions(TRACER_OPTIONS); // Tracer Init TracerError trcE = tracerBase->Initialize(); ERROR_CHECK(TracerError, trcE); // Get a Self-Node // Generate your Node (in this case visor and renderer is on same node node = std::make_unique<MockNode>(*visorView, *tracerBase, *gpuScene, WINDOW_DURATION); NodeError nodeE = node->Initialize(); ERROR_CHECK(NodeError, nodeE); visorInput->AttachVisorCallback(*node); tracerBase->AttachTracerCallbacks(*node); return true; } void SimpleTracerSetup::Body() { try { node->Work(); } catch(TracerException const& e) { std::string err = static_cast<TracerError>(e); METU_ERROR_LOG("%s (%s)", err.c_str(), e.what()); GTEST_FAIL(); } } ======================= File: Source/RayLib/Constants.h ======================= <reponame>yalcinerbora/meturay<gh_stars>0 #pragma once /** Many Constants that are used throught the tracer */ #include <limits> #include "Vector.h" #include "TracerStructs.h" #include "VisorInputStructs.h" namespace VisorConstants { static const KeyboardKeyBindings DefaultKeyBinds = { {KeyboardKeyType::W, VisorActionType::MOVE_FORWARD}, {KeyboardKeyType::S, VisorActionType::MOVE_BACKWARD}, {KeyboardKeyType::D, VisorActionType::MOVE_RIGHT}, {KeyboardKeyType::A, VisorActionType::MOVE_LEFT}, {KeyboardKeyType::LEFT_SHIFT, VisorActionType::FAST_MOVE_TOGGLE}, {KeyboardKeyType::KP_9, VisorActionType::MOVE_TYPE_NEXT}, {KeyboardKeyType::KP_7, VisorActionType::MOVE_TYPE_PREV}, {KeyboardKeyType::KP_5, VisorActionType::TOGGLE_CUSTOM_SCENE_CAMERA}, {KeyboardKeyType::L, VisorActionType::LOCK_UNLOCK_CAMERA}, // {KeyboardKeyType::KP_6, VisorActionType::SCENE_CAM_NEXT}, {KeyboardKeyType::KP_4, VisorActionType::SCENE_CAM_PREV}, // Start Stop Actions {KeyboardKeyType::O, VisorActionType::START_STOP_TRACE}, {KeyboardKeyType::P, VisorActionType::PAUSE_CONT_TRACE}, // Animation Related {KeyboardKeyType::RIGHT, VisorActionType::FRAME_NEXT}, {KeyboardKeyType::LEFT, VisorActionType::FRAME_PREV}, // Image Related {KeyboardKeyType::SPACE, VisorActionType::SAVE_IMAGE}, // Lifetime Realted {KeyboardKeyType::ESCAPE, VisorActionType::CLOSE} }; static const MouseKeyBindings DefaultButtonBinds = { {MouseButtonType::LEFT, VisorActionType::MOUSE_MOVE_TOGGLE}, {MouseButtonType::RIGHT, VisorActionType::MOUSE_MOVE_TOGGLE}, {MouseButtonType::MIDDLE, VisorActionType::LOCK_UNLOCK_CAMERA} }; } namespace TracerConstants { static constexpr HitOpts DefaultHitOptions = {0}; static constexpr ShadeOpts DefaultShadeOptions = {0}; static constexpr TracerOptions DefaultTracerOptions = {false}; } namespace BaseConstants { static constexpr const char* EMPTY_PRIMITIVE_NAME = "Empty"; static constexpr Vector2i IMAGE_MAX_SIZE = Vector2i(std::numeric_limits<int>::max(), std::numeric_limits<int>::max()); } namespace SceneConstants { // Fundamental Limitations (for convenience) static constexpr const int MaxPrimitivePerSurface = 8; } namespace MathConstants { static constexpr double Pi_d = 3.1415926535897932384626433; static constexpr double PiSqr_d = Pi_d * Pi_d; static constexpr double InvPi_d = 1.0 / Pi_d; static constexpr double InvPiSqr_d = 1.0 / (Pi_d * Pi_d); static constexpr double Sqrt2_d = 1.4142135623730950488016887; static constexpr double Sqrt3_d = 1.7320508075688772935274463; static constexpr double E_d = 2.7182818284590452353602874; static constexpr double InvE_d = 1.0 / E_d; static constexpr double DegToRadCoef_d = Pi_d / 180.0; static constexpr double RadToDegCoef_d = 180.0 / Pi_d; static constexpr double Epsilon_d = 1.0e-6; static constexpr float Pi = static_cast<float>(Pi_d); static constexpr float PiSqr = static_cast<float>(PiSqr_d); static constexpr float InvPi = static_cast<float>(InvPi_d); static constexpr float InvPiSqr = static_cast<float>(InvPiSqr_d); static constexpr float Sqrt2 = static_cast<float>(Sqrt2_d); static constexpr float Sqrt3 = static_cast<float>(Sqrt3_d); static constexpr float E = static_cast<float>(E_d); static constexpr float InvE = static_cast<float>(InvE_d); static constexpr float DegToRadCoef = static_cast<float>(DegToRadCoef_d); static constexpr float RadToDegCoef = static_cast<float>(RadToDegCoef_d); static constexpr float Epsilon = static_cast<float>(Epsilon_d); } ======================= File: Source/RayLib/System.h ======================= <reponame>yalcinerbora/meturay #pragma once #ifdef _WIN32 #define METURAY_WIN #ifndef NOMINMAX #define NOMINMAX #endif #define WIN32_LEAN_AND_MEAN #include <windows.h> static inline bool EnableVTMode() { // Set output mode to handle virtual terminal sequences HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); if(hOut == INVALID_HANDLE_VALUE) { return false; } DWORD dwMode = 0; if(!GetConsoleMode(hOut, &dwMode)) { return false; } dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; if(!SetConsoleMode(hOut, dwMode)) { return false; } return true; } #else static inline bool EnableVTMode() {} #endif #ifdef __linux__ #define METURAY_UNIX #else #endif ======================= File: Source/TracerLib/GPUPrimitiveSphere.h ======================= #pragma once /** Default Sphere Implementation One of the fundamental functional types. Has two types of data Position and radius. All of them should be provided */ #include <map> #include "DefaultLeaf.h" #include "GPUPrimitiveP.cuh" #include "DeviceMemory.h" #include "TypeTraits.h" #include "RayLib/PrimitiveDataTypes.h" #include "RayLib/Vector.h" #include "RayLib/Sphere.h" // Sphere memory layout struct SphereData { const Vector4f* centerRadius; }; // Hit of sphere is spherical coordinates using SphereHit = Vector2f; // Sphere Hit Acceptance __device__ __host__ inline HitResult SphereClosestHit(// Output HitKey& newMat, PrimitiveId& newPrimitive, SphereHit& newHit, // I-O RayReg& rayData, // Input const DefaultLeaf& leaf, const SphereData& primData) { // Get Packed data and unpack Vector4f data = primData.centerRadius[leaf.primitiveId]; Vector3f center = data; float radius = data[3]; // Do Intersecton test Vector3 pos; float newT; bool intersects = rayData.ray.IntersectsSphere(pos, newT, center, radius); // Check if the hit is closer bool closerHit = intersects && (newT < rayData.tMax); if(closerHit) { rayData.tMax = newT; newMat = leaf.matId; newPrimitive = leaf.primitiveId; // Gen Spherical Coords (R can be fetched using primitiveId) // Clamp acos input for singularity Vector3 relativeCoord = pos - center; float tethaCos = HybridFuncs::Clamp(relativeCoord[2] / radius, -1.0f, 1.0f); float tetha = acos(tethaCos); float phi = atan2(relativeCoord[1], relativeCoord[0]); newHit = Vector2(tetha, phi); } return HitResult{false, closerHit}; } __device__ __host__ inline AABB3f GenerateAABBSphere(PrimitiveId primitiveId, const SphereData& primData) { // Get Packed data and unpack Vector4f data = primData.centerRadius[primitiveId]; Vector3f center = data; float radius = data[3]; return Sphere::BoundingBox(center, radius); } __device__ __host__ inline float GenerateAreaSphere(PrimitiveId primitiveId, const SphereData& primData) { Vector4f data = primData.centerRadius[primitiveId]; float radius = data[3]; // Surface area is related to radius only (wrt of its square) // TODO: check if this is a good estimation return radius * radius; } __device__ __host__ inline Vector3 GenerateCenterSphere(PrimitiveId primitiveId, const SphereData& primData) { Vector4f data = primData.centerRadius[primitiveId]; Vector3f center = data; return center; } class GPUPrimitiveSphere final : public GPUPrimitiveGroup<SphereHit, SphereData, DefaultLeaf, SphereClosestHit, GenerateDefaultLeaf, GenerateAABBSphere, GenerateAreaSphere, GenerateCenterSphere> { public: static constexpr const char* TypeName() { return "Sphere"; } static constexpr PrimitiveDataLayout POS_LAYOUT = PrimitiveDataLayout::FLOAT_3; static constexpr PrimitiveDataLayout RADUIS_LAYOUT = PrimitiveDataLayout::FLOAT_1; private: DeviceMemory memory; // List of ranges for each batch uint64_t totalPrimitiveCount; std::map<uint32_t, Vector2ul> batchRanges; std::map<uint32_t, AABB3> batchAABBs; public: // Constructors & Destructor GPUPrimitiveSphere(); ~GPUPrimitiveSphere() = default; // Interface // Pirmitive type is used for delegating scene info to this class const char* Type() const override; // Allocates and Generates Data SceneError InitializeGroup(const NodeListing& surfaceDatalNodes, double time, const SurfaceLoaderGeneratorI& loaderGen, const std::string& scenePath) override; SceneError ChangeTime(const NodeListing& surfaceDatalNodes, double time, const SurfaceLoaderGeneratorI& loaderGen, const std::string& scenePath) override; // Provides data to Event Estimator bool HasPrimitive(uint32_t surfaceDataId) const override; SceneError GenerateEstimatorInfo(std::vector<EstimatorInfo>&, const Vector3& power, HitKey key, uint32_t id) const override; // Access primitive range from Id Vector2ul PrimitiveBatchRange(uint32_t surfaceDataId) const override; AABB3 PrimitiveBatchAABB(uint32_t surfaceDataId) const override; // Error check // Queries in order to check if this primitive group supports certain primitive data // Material may need that data bool CanGenerateData(const std::string& s) const override; }; static_assert(IsTracerClass<GPUPrimitiveSphere>::value, "GPUPrimitiveSphere is not a Tracer Class."); ======================= File: Source/RayLib/MayaCacheIO.h ======================= #pragma once /** Maya nCache File I-O Reads are not universal. Specific options are required */ #include <vector> #include "Vector.h" #include "IOError.h" namespace MayaCache { constexpr const char* FrameTag = "Frame"; constexpr const char* Extension = "mcx"; enum MayaChannelType { DENSITY, VELOCITY, RESOLUTION, OFFSET }; struct MayaNSCacheInfo { Vector3ui dim; Vector3f size; // Channels std::vector<MayaChannelType> channels; // Color Interpolation std::vector<Vector3f> color; std::vector<float> colorInterp; // Opacity Interpolation std::vector<float> opacity; std::vector<float> opacityInterp; // Transparency Vector3f transparency; }; std::u8string GenerateNCacheFrameFile(const std::u8string& xmlFile, int frame); IOError LoadNCacheNavierStokesXML(MayaNSCacheInfo&, const std::u8string& fileName); IOError LoadNCacheNavierStokes(std::vector<float>& velocityDensityData, const MayaNSCacheInfo&, const std::u8string& fileName); }; ======================= File: Source/TracerLib/EstimatorStructs.h ======================= #pragma once #include <string> #include "RayLib/SceneNodeNames.h" #include "RayLib/HitStructs.h" enum class LightType { POINT, DIRECTIONAL, SPOT, RECTANGULAR, TRIANGULAR, DISK, SPHERICAL, PRIMITIVE, // END }; static constexpr const char* LightTypeNames[static_cast<int>(LightType::END)] = { "point", "directional", "spot", "rectangular", "triangular", "disk", "spherical", "primitive" }; struct EstimatorInfo { LightType type; HitKey matKey; Vector4 position0R; Vector4 position1G; Vector4 position2B; static EstimatorInfo GenOnlyPower(const Vector3& flux); static EstimatorInfo GenAsPoint(const HitKey key, const Vector3& flux, const Vector3& position); static EstimatorInfo GenAsDirectional(const HitKey key, const Vector3& flux, const Vector3& direction); static EstimatorInfo GenAsSpot(const HitKey key, const Vector3& flux, const Vector3& position, const Vector3& direction, float coneMin, float coneMax); static EstimatorInfo GenAsRectangular(const HitKey key, const Vector3& flux, const Vector3& topLeft, const Vector3& v0, const Vector3& v1); static EstimatorInfo GenAsTriangular(const HitKey key, const Vector3& flux, const Vector3& position0, const Vector3& position1, const Vector3& position2); static EstimatorInfo GenAsDisk(const HitKey key, const Vector3& flux, const Vector3& center, const Vector3& normal, float radius); static EstimatorInfo GenAsSpherical(const HitKey key, const Vector3& flux, const Vector3& center, float radius); }; inline EstimatorInfo EstimatorInfo::GenOnlyPower(const Vector3& flux) { EstimatorInfo r; r.position0R[3] = flux[0]; r.position1G[3] = flux[1]; r.position2B[3] = flux[2]; return r; } inline EstimatorInfo EstimatorInfo::GenAsPoint(const HitKey key, const Vector3& flux, const Vector3& position) { EstimatorInfo r; r.matKey = key; r.type = LightType::POINT; r.position0R = Vector4(position, flux[0]); r.position1G = Vector4(Zero3, flux[1]); r.position2B = Vector4(Zero3, flux[2]); return r; } inline EstimatorInfo EstimatorInfo::GenAsDirectional(const HitKey key, const Vector3& flux, const Vector3& direction) { EstimatorInfo r; r.matKey = key; r.type = LightType::DIRECTIONAL; r.position0R = Vector4(direction, flux[0]); r.position1G = Vector4(Zero3, flux[1]); r.position2B = Vector4(Zero3, flux[2]); return r; } inline EstimatorInfo EstimatorInfo::GenAsSpot(const HitKey key, const Vector3& flux, const Vector3& position, const Vector3& direction, float coneMin, float coneMax) { EstimatorInfo r; r.matKey = key; r.type = LightType::SPOT; r.position0R = Vector4(position, flux[0]); r.position1G = Vector4(direction, flux[1]); r.position2B = Vector4(coneMin, coneMax, 0.0f, flux[2]); return r; } inline EstimatorInfo EstimatorInfo::GenAsRectangular(const HitKey key, const Vector3& flux, const Vector3& topLeft, const Vector3& v0, const Vector3& v1) { EstimatorInfo r; r.matKey = key; r.type = LightType::RECTANGULAR; r.position0R = Vector4(topLeft, flux[0]); r.position1G = Vector4(v0, flux[1]); r.position2B = Vector4(v1, flux[2]); return r; } inline EstimatorInfo EstimatorInfo::GenAsTriangular(const HitKey key, const Vector3& flux, const Vector3& position0, const Vector3& position1, const Vector3& position2) { EstimatorInfo r; r.matKey = key; r.type = LightType::TRIANGULAR; r.position0R = Vector4(position0, flux[0]); r.position1G = Vector4(position1, flux[1]); r.position2B = Vector4(position2, flux[2]); return r; } inline EstimatorInfo EstimatorInfo::GenAsDisk(const HitKey key, const Vector3& flux, const Vector3& center, const Vector3& direction, float radius) { EstimatorInfo r; r.matKey = key; r.type = LightType::DISK; r.position0R = Vector4(center, flux[0]); r.position1G = Vector4(direction, flux[1]); r.position2B = Vector4(radius, 0.0f, 0.0f, flux[2]); return r; } inline EstimatorInfo EstimatorInfo::GenAsSpherical(const HitKey key, const Vector3& flux, const Vector3& center, float radius) { EstimatorInfo r; r.matKey = key; r.type = LightType::SPHERICAL; r.position0R = Vector4(center, flux[0]); r.position1G = Vector4(radius, 0.0f, 0.0f, flux[1]); r.position2B = Vector4(Zero3, flux[2]); return r; } inline SceneError LightTypeEnumToString(std::string& str, LightType type) { int index = static_cast<int>(type); if(index >= static_cast<int>(LightType::END)) return SceneError::UNKNOWN_LIGHT_TYPE; else str = LightTypeNames[index]; return SceneError::OK; } inline SceneError LightTypeStringToEnum(LightType& type, const std::string& str) { for(int i = 0; i < static_cast<int>(LightType::END); i++) { if(str == std::string(LightTypeNames[i])) { type = static_cast<LightType>(i); return SceneError::OK; } } return SceneError::UNKNOWN_LIGHT_TYPE; } inline SceneError FetchLightInfoFromNode(std::vector<EstimatorInfo>& result, const SceneNodeI& node, const MaterialKeyListing& materialKeys, LightType type, double time) { using namespace NodeNames; using namespace BaseConstants; const auto fluxList = node.AccessVector3(LIGHT_POWER, time); const auto matIds = node.AccessUInt(LIGHT_MATERIAL); switch(type) { // Fetch from Node if analytic light case LightType::POINT: { const auto posList = node.AccessVector3(LIGHT_POSITION, time); for(size_t i = 0; i < fluxList.size(); i++) { const Vector3& pos = posList[i]; const Vector3& flux = fluxList[i]; const auto matLookup = std::make_pair(EMPTY_PRIMITIVE_NAME, matIds[i]); const HitKey key = materialKeys.at(matLookup); result.push_back(EstimatorInfo::GenAsPoint(key, flux, pos)); } break; } case LightType::DIRECTIONAL: { const auto dirList = node.AccessVector3(LIGHT_DIRECTION, time); for(size_t i = 0; i < fluxList.size(); i++) { const Vector3& dir = dirList[i]; const Vector3& flux = fluxList[i]; const auto matLookup = std::make_pair(EMPTY_PRIMITIVE_NAME, matIds[i]); const HitKey key = materialKeys.at(matLookup); result.push_back(EstimatorInfo::GenAsDirectional(key, flux, dir)); } break; } case LightType::SPOT: { const auto posList = node.AccessVector3(LIGHT_POSITION, time); const auto dirList = node.AccessVector3(LIGHT_DIRECTION, time); const auto angleList = node.AccessVector2(LIGHT_CONE_APERTURE, time); for(size_t i = 0; i < fluxList.size(); i++) { const Vector3& pos = posList[i]; const Vector3& dir = dirList[i]; const Vector2& angle = angleList[i]; const Vector3& flux = fluxList[i]; const auto matLookup = std::make_pair(EMPTY_PRIMITIVE_NAME, matIds[i]); const HitKey key = materialKeys.at(matLookup); result.push_back(EstimatorInfo::GenAsSpot(key, flux, pos, dir, angle[0], angle[1])); } break; } case LightType::RECTANGULAR: { const auto posList = node.AccessVector3(LIGHT_POSITION, time); const auto v0List = node.AccessVector3(LIGHT_RECT_V0, time); const auto v1List = node.AccessVector3(LIGHT_RECT_V1, time); for(size_t i = 0; i < fluxList.size(); i++) { const Vector3& pos = posList[i]; const Vector3& v0 = v0List[i]; const Vector3& v1 = v1List[i]; const Vector3& flux = fluxList[i]; const auto matLookup = std::make_pair(EMPTY_PRIMITIVE_NAME, matIds[i]); const HitKey key = materialKeys.at(matLookup); result.push_back(EstimatorInfo::GenAsRectangular(key, flux, pos, v0, v1)); } break; } case LightType::TRIANGULAR: { const auto matIds = node.AccessUInt(LIGHT_MATERIAL); const auto posList = node.AccessVector3(LIGHT_POSITION, time); for(size_t i = 0; i < fluxList.size(); i++) { const Vector3& pos0 = posList[i * 3 + 0]; const Vector3& pos1 = posList[i * 3 + 1]; const Vector3& pos2 = posList[i * 3 + 2]; const Vector3& flux = fluxList[i]; const auto matLookup = std::make_pair(EMPTY_PRIMITIVE_NAME, matIds[i]); const HitKey key = materialKeys.at(matLookup); result.push_back(EstimatorInfo::GenAsTriangular(key, flux, pos0, pos1, pos2)); } break; } case LightType::DISK: { const auto dirList = node.AccessVector3(LIGHT_DIRECTION, time); const auto centerList = node.AccessVector3(LIGHT_DISK_CENTER, time); const auto radiusList = node.AccessFloat(LIGHT_DISK_RADIUS, time); for(size_t i = 0; i < fluxList.size(); i++) { const Vector3& center = centerList[i]; const Vector3& dir = dirList[i]; const float& radius = radiusList[i]; const Vector3& flux = fluxList[i]; const auto matLookup = std::make_pair(EMPTY_PRIMITIVE_NAME, matIds[i]); const HitKey key = materialKeys.at(matLookup); result.push_back(EstimatorInfo::GenAsDisk(key, flux, center, dir, radius)); } break; } case LightType::SPHERICAL: { const auto centerList = node.AccessVector3(LIGHT_SPHR_CENTER, time); const auto radiusList = node.AccessFloat(LIGHT_SPHR_RADIUS, time); for(size_t i = 0; i < fluxList.size(); i++) { const Vector3& center = centerList[i]; const float& radius = radiusList[i]; const Vector3& flux = fluxList[i]; const auto matLookup = std::make_pair(EMPTY_PRIMITIVE_NAME, matIds[i]); const HitKey key = materialKeys.at(matLookup); result.push_back(EstimatorInfo::GenAsSpherical(key, flux, center, radius)); } break; } case LightType::PRIMITIVE: { break; } default: return SceneError::UNKNOWN_LIGHT_TYPE; } return SceneError::OK; } ======================= File: Source/TracerLib/GPUEventEstimatorI.h ======================= <filename>Source/TracerLib/GPUEventEstimatorI.h #pragma once #include <vector> #include "RayLib/Vector.h" #include "NodeListing.h" struct SceneError; class CudaSystem; class GPUEventEstimatorI { public: virtual ~GPUEventEstimatorI() = default; // Interface // Type (as string) of the primitive group virtual const char* Type() const = 0; // Fetches Data for Nodes virtual SceneError Initialize(const NodeListing& lightList, // Material Keys const MaterialKeyListing& materialKeys, const std::vector<const GPUPrimitiveGroupI*>&, double time) = 0; // Constructs Event Estimator virtual TracerError Construct(const CudaSystem&) = 0; }; ======================= File: Source/RayLib/TracerCallbacksI.h ======================= #pragma once #include <vector> #include "Vector.h" #include "Types.h" #include "HitStructs.h" #include "Constants.h" struct TracerError; struct TracerOptions; struct AnalyticData; struct CameraPerspective; class TracerCallbacksI { public: virtual ~TracerCallbacksI() = default; virtual void SendLog(const std::string) = 0; virtual void SendError(TracerError) = 0; virtual void SendAnalyticData(AnalyticData) = 0; virtual void SendImage(const std::vector<Byte> data, PixelFormat, size_t sampleCount, Vector2i start = Zero2i, Vector2i end = BaseConstants::IMAGE_MAX_SIZE) = 0; virtual void SendAccelerator(HitKey key, const std::vector<Byte> data) = 0; virtual void SendBaseAccelerator(const std::vector<Byte> data) = 0; }; class TracerCommandsI { public: virtual ~TracerCommandsI() = default; }; ======================= File: Source/RayLib/Error.h ======================= #pragma once /** Generic Error */ #include <cstdint> #include <string> struct ErrorI { public: virtual ~ErrorI() = default; // Interface virtual operator std::string() const = 0; }; ======================= File: Source/TracerLib/TracerLoader.h ======================= #pragma once /** Tracer Loader provides functionality to load tracer logic and its equavilent sub-logics (material shade functions, primitive data fetching etc.) */ //#ifdef METU_SHARED_TRACERCUDA //#define METU_SHARED_TRACERCUDA_ENTRY_POINT __declspec(dllexport) //#else //#define METU_SHARED_TRACERCUDA_ENTRY_POINT __declspec(dllimport) //#endif // //#include <memory> //#include "RayLib/TracerI.h" // //METU_SHARED_TRACERCUDA_ENTRY_POINT std::unique_ptr<TracerI> CreateTracerCUDA(); #include <memory> #include "TracerLogicI.h" #include "TracerLogicGeneratorI.h" #include "TracerThread.h" #include "RayLib/SharedLib.h" #include "RayLib/TracerI.h" //using LogicInterface = SharedLibPtr<TracerLogicGeneratorI>; // //namespace TracerLoader //{ // static constexpr const char* BaseInterfaceConstructorName = "GenBaseTracer"; // static constexpr const char* BaseInterfaceDestructorName = "FreeBaseTracer"; // // static constexpr const char* LogicInterfaceConstructorName = "GenLogicGenerator"; // static constexpr const char* LogicInterfaceDestructorName = "FreeLogicGenerator"; // // // Load Tracer Logic From DLL // // Default named load // // This should be the usage for tracer // LogicInterface LoadTracerLogic(SharedLib& s); // // // Custom name load // // This is provided for test tracer // // Sine different test cases may need different tracer implementations // // This makes many different tracers to reside ona single dll // // This may be usefull // LogicInterface LoadTracerLogic(SharedLib& s, // const char* generatorConstructor, // const char* generatorDestructor); // //} ======================= File: Source/RayLib/MovementSchemeI.h ======================= <reponame>yalcinerbora/meturay #pragma once #include "VisorInputStructs.h" struct CameraPerspective; class MovementSchemeI { public: virtual ~MovementSchemeI() = default; // Interface virtual bool InputAction(CameraPerspective&, VisorActionType, KeyAction) = 0; virtual bool MouseMovementAction(CameraPerspective&, double x, double y) = 0; virtual bool MouseScrollAction(CameraPerspective&, double x, double y) = 0; }; ======================= File: Source/RayLib/SharedLib.h ======================= #pragma once /** Functionalty to Load DLLs or SOs */ #include <string> #include <memory> #include "ObjectFuncDefinitions.h" #include "DLLError.h" struct SharedLibArgs { std::string mangledConstructorName = "\0"; std::string mangledDestructorName = "\0"; bool operator<(const SharedLibArgs& s) const; }; inline bool SharedLibArgs::operator<(const SharedLibArgs& s) const { std::less<std::string> less; return less(mangledConstructorName, s.mangledConstructorName); } class SharedLib { private: static constexpr const char* WinDLLExt = ".dll"; static constexpr const char* LinuxDLLExt = ".so"; // Props void* libHandle; // Internal void* GetProcAdressInternal(const std::string& fName); protected: public: // Constructors & Destructor SharedLib(const std::string& libName); SharedLib(const SharedLib&) = delete; SharedLib(SharedLib&&) noexcept; SharedLib& operator=(const SharedLib&) = delete; SharedLib& operator=(SharedLib&&) noexcept; ~SharedLib(); template <class T> DLLError GenerateObject(SharedLibPtr<T>&, const SharedLibArgs& mangledNames); template <class T, class... Args> DLLError GenerateObjectWithArgs(SharedLibPtr<T>&, const SharedLibArgs& mangledNames, Args...); }; using PoolKey = std::pair<SharedLib*, SharedLibArgs>; template <class T> DLLError SharedLib::GenerateObject(SharedLibPtr<T>& ptr, const SharedLibArgs& args) { ObjGeneratorFunc<T> genFunc = static_cast<ObjGeneratorFunc<T>>(GetProcAdressInternal(args.mangledConstructorName)); ObjDestroyerFunc<T> destFunc = static_cast<ObjDestroyerFunc<T>>(GetProcAdressInternal(args.mangledDestructorName)); if(!genFunc) return DLLError::MANGLED_NAME_NOT_FOUND; if(!destFunc) return DLLError::MANGLED_NAME_NOT_FOUND; ptr = SharedLibPtr<T>(genFunc(), destFunc); return DLLError::OK; } template <class T, class... Args> DLLError SharedLib::GenerateObjectWithArgs(SharedLibPtr<T>& ptr, const SharedLibArgs& mangledNames, Args... args) { ObjGeneratorFuncArgs<T, Args...> genFunc = static_cast<ObjGeneratorFuncArgs<T, Args...>>(GetProcAdressInternal(mangledNames.mangledConstructorName)); ObjDestroyerFunc<T> destFunc = static_cast<ObjDestroyerFunc<T>>(GetProcAdressInternal(mangledNames.mangledDestructorName)); if(!genFunc) return DLLError::MANGLED_NAME_NOT_FOUND; if(!destFunc) return DLLError::MANGLED_NAME_NOT_FOUND; ptr = SharedLibPtr<T>(genFunc(std::forward<Args>(args)...), destFunc); return DLLError::OK; } ======================= File: Source/RayLib/CPUTimer.h ======================= #pragma once /** std::chrono wrapper for high performance time querying in a single thread. */ #include <chrono> // JESUS THAT NAMESPACES+TEMPLATES using CPUClock = std::chrono::high_resolution_clock; using CPUTimePoint = std::chrono::time_point<std::chrono::high_resolution_clock>; using CPUDuration = CPUTimePoint::duration; using CPUTimeNanos = std::nano; using CPUTimeMicros = std::micro; using CPUTimeMillis = std::milli; using CPUTimeSeconds = std::ratio<1>; using CPUTimeMins = std::ratio<60>; namespace Utility { class CPUTimer { private: CPUDuration elapsed; CPUTimePoint start; protected: public: // Constructors & Destructor CPUTimer() = default; ~CPUTimer() = default; // Util void Start(); void Stop(); void Lap(); template <class Time> double Elapsed(); }; inline void CPUTimer::Start() { start = CPUClock::now(); } inline void CPUTimer::Stop() { CPUTimePoint end = CPUClock::now(); elapsed = end - start; } inline void CPUTimer::Lap() { CPUTimePoint end = CPUClock::now(); elapsed = end - start; start = end; } template <class Time> double CPUTimer::Elapsed() { return std::chrono::duration<double, Time>(elapsed).count(); } } ======================= File: Source/RayLib/SurfaceLoaderGeneratorI.h ======================= #pragma once #include <string> #include "ObjectFuncDefinitions.h" struct DLLError; struct SceneError; struct SharedLibArgs; class SharedLib; class SurfaceLoaderI; class SceneNodeI; class SurfaceLoaderGeneratorI { public: virtual ~SurfaceLoaderGeneratorI() = default; virtual SceneError GenerateSurfaceLoader(SharedLibPtr<SurfaceLoaderI>&, const std::string& scenePath, const SceneNodeI& properties, double time = 0.0) const = 0; virtual DLLError IncludeLoadersFromDLL(const std::string& libName, const std::string& regex, const SharedLibArgs& mangledName) = 0; }; ======================= File: Source/TracerLib/GPUEventEstimatorBasic.h ======================= #pragma once #include "GPUEventEstimatorP.h" #include "DefaultEstimatorsKC.cuh" #include "TypeTraits.h" #include "TracerLib/DeviceMemory.h" class GPUEventEstimatorBasic final : public GPUEventEstimator<BasicEstimatorData, EstimateEventBasic, TerminateEventBasic> { public: static constexpr const char* TypeName() { return "Basic"; } private: DeviceMemory memory; protected: public: // Constructors & Destructor GPUEventEstimatorBasic() = default; ~GPUEventEstimatorBasic() = default; // Interface const char* Type() const override; // Constructs Event Estimator TracerError Construct(const CudaSystem&) override; }; static_assert(IsTracerClass<GPUEventEstimatorBasic>::value, "GPUEventEstimatorBasic is not a Tracer Class."); ======================= File: Source/RayLib/IOError.h ======================= #pragma once /** I-O error "Enumeration" */ #include "Error.h" struct IOError : public ErrorI { public: enum Type { OK, // General FILE_NOT_FOUND, // Scene SCENE_CORRUPTED, // Maya nCache NCACHE_XML_ERROR, NCACHE_INVALID_FOURCC, NCACHE_INVALID_FORMAT, // Maya nCache Navier-Stokes Fluid NCACHE_DENSITY_NOT_FOUND, NCACHE_VELOCITY_NOT_FOUND, // Scene Json //.... // End END }; private: Type type; public: // Constructors & Destructor IOError() = default; IOError(Type); ~IOError() = default; operator Type() const { return type; } operator std::string() const override; }; inline IOError::IOError(IOError::Type t) : type(t) {} inline IOError::operator std::string() const { const char* const ErrorStrings[] = { "OK.", // General "File not found.", // Scene "Scene file is corrupted.", // Maya nCache "nCache XML parse error.", "nCache invalid fourcc code.", "nCache invalid file format code.", // Maya nCache Navier-Stokes Fluid "nCache \"density\" channel not found.", "nCache \"velocity\" channel not found." }; static_assert((sizeof(ErrorStrings) / sizeof(const char*)) == static_cast<size_t>(IOError::END), "Enum and enum string list size mismatch."); return ErrorStrings[static_cast<int>(type)]; } ======================= File: Source/RayLib/MovementSchemes.h ======================= <reponame>yalcinerbora/meturay #pragma once #include "MovementSchemeI.h" class MovementSchemeFPS final : public MovementSchemeI { private: double prevMouseX; double prevMouseY; bool mouseToggle; // Camera Movement Constants const double Sensitivity; const double MoveRatio; const double MoveRatioModifier; double currentMovementRatio; protected: public: // Constructors & Destructor MovementSchemeFPS(double sensitivity, double moveRatio, double moveRatioModifier); // Interface bool InputAction(CameraPerspective&, VisorActionType, KeyAction) override; bool MouseMovementAction(CameraPerspective&, double x, double y) override; bool MouseScrollAction(CameraPerspective&, double x, double y) override; }; ======================= File: Source/RayLib/VisorInputStructs.h ======================= <reponame>yalcinerbora/meturay<gh_stars>0 #pragma once #include <map> enum class KeyboardKeyType { SPACE, APOSTROPHE, COMMA, MINUS, PERIOD, SLASH, NUMBER_0, NUMBER_1,
65,955
thestackv1_concat_by_repo-long/65536-65536
atarate = DataRate::_250K; fmt.encoding = Encoding::MFM; fmt.cyls = 40; fmt.sectors = 16; fmt.size = 1; break; case RegularFormat::AmigaDOS: fmt.fdc = FdcType::Amiga; fmt.datarate = DataRate::_250K; fmt.encoding = Encoding::Amiga; fmt.cyls = 80; fmt.sectors = 11; fmt.size = 2; fmt.base = 0; break; case RegularFormat::AmigaDOSHD: fmt.fdc = FdcType::Amiga; fmt.datarate = DataRate::_500K; fmt.encoding = Encoding::Amiga; fmt.sectors = 22; fmt.size = 2; fmt.base = 0; break; case RegularFormat::LIF: fmt.cyls = 77; fmt.heads = 2; fmt.fdc = FdcType::PC; fmt.datarate = DataRate::_250K; fmt.encoding = Encoding::MFM; fmt.sectors = 16; fmt.size = 1; break; case RegularFormat::AtariST: fmt.fdc = FdcType::WD; fmt.datarate = DataRate::_250K; fmt.encoding = Encoding::MFM; fmt.sectors = 9; fmt.gap3 = 40; fmt.fill = 0x00; break; case RegularFormat::TO_640K_MFM: fmt.cyls = 80; fmt.heads = 2; fmt.datarate = DataRate::_250K; fmt.encoding = Encoding::MFM; fmt.sectors = 16; fmt.size = 1; fmt.interleave = 7; fmt.gap3 = 50; fmt.fill = 0xe5; fmt.cyls_first = true; break; case RegularFormat::TO_320K_MFM: fmt = GetFormat(RegularFormat::TO_640K_MFM); fmt.cyls = 80; fmt.heads = 1; fmt.size = 1; fmt.encoding = Encoding::MFM; break; case RegularFormat::TO_160K_MFM: fmt = GetFormat(RegularFormat::TO_320K_MFM); fmt.cyls = 40; fmt.heads = 1; fmt.size = 1; fmt.encoding = Encoding::MFM; break; case RegularFormat::TO_160K_FM: fmt = GetFormat(RegularFormat::TO_320K_MFM); fmt.cyls = 80; fmt.heads = 1; fmt.size = 0; fmt.encoding = Encoding::FM; break; case RegularFormat::TO_80K_FM: fmt = GetFormat(RegularFormat::TO_160K_FM); fmt.cyls = 40; fmt.heads = 1; fmt.size = 0; fmt.encoding = Encoding::FM; case RegularFormat::DO: fmt.fdc = FdcType::Apple; fmt.datarate = DataRate::_250K; fmt.encoding = Encoding::Apple; fmt.cyls = 35; fmt.heads = 1; fmt.sectors = 16; fmt.base = 0; fmt.size = 1; break; default: assert(false); break; } return fmt; } bool Format::FromSize (int64_t size, Format &fmt) { switch (size) { case 143360: // Apple ][ fmt = RegularFormat::DO; break; case 163840: // 5.25" SSSD (160K) fmt = RegularFormat::PC320; fmt.heads = 1; break; case 184320: // 5.25" SSSD (180K) fmt = RegularFormat::PC360; fmt.heads = 1; break; case 327680: // 5.25" DSDD (320K) fmt = RegularFormat::PC320; break; case 368640: // 5.25" DSDD (360K) fmt = RegularFormat::PC360; break; case 655360: // 3.5" DSDD (640K) fmt = RegularFormat::PC640; break; case 737280: // 3.5" DSDD (720K) fmt = RegularFormat::PC720; break; case 1228800: // 5.25" DSHD (1200K) fmt = RegularFormat::PC1200; break; case 1261568: // 5.25" DSHD (1232K) fmt = RegularFormat::PC1232; break; case 1474560: // 3.5" DSHD (1440K) fmt = RegularFormat::PC1440; break; case 1638400: // 3.5" DSHD (1600K) fmt = RegularFormat::PC1440; fmt.sectors = 20; fmt.gap3 = 0; break; case 1720320: // 3.5" DSHD (1680K) fmt = RegularFormat::PC1440; fmt.sectors = 21; fmt.gap3 = 0; break; case 1763328: // 3.5" DSHD (1722K) fmt = RegularFormat::PC1440; fmt.cyls = 82; fmt.sectors = 21; fmt.gap3 = 0; break; case 1784832: // 3.5" DSHD (1743K) fmt = RegularFormat::PC1440; fmt.cyls = 83; fmt.sectors = 21; fmt.gap3 = 0; break; case 1802240: // 3.5" DSHD (1760K) fmt = RegularFormat::PC1440; fmt.sectors = 22; fmt.gap3 = 0; break; case 1884160: // 3.5" DSHD (1840K) fmt = RegularFormat::PC1440; fmt.sectors = 23; fmt.gap3 = 0; break; case 1966080: // 3.5" DSHD (1920K) fmt = RegularFormat::PC1440; fmt.sectors = 24; fmt.gap3 = 0; break; case 2949120: // 3.5" DSED (2880K) fmt = RegularFormat::PC2880; break; default: return false; } return true; } void Format::Validate () const { Validate(cyls, heads, sectors, sector_size()); } void Format::Validate (int cyls_, int heads_, int sectors_, int sector_size, int max_sector_size) { if (!cyls_ || cyls_ > MAX_TRACKS || !heads_ || heads_ > MAX_SIDES || !sectors_ || sectors_ > MAX_SECTORS || (max_sector_size && sector_size > max_sector_size)) { throw util::exception("bad geometry"); } } void Format::Override (bool full_control/*=false*/) { if (full_control) { if (opt.range.cyls()) cyls = opt.range.cyls(); if (opt.range.heads()) heads = opt.range.heads(); if (opt.sectors!= -1) sectors = opt.sectors; if (opt.size >= 0 && opt.size <= 7) size = opt.size; encoding = Encoding::MFM; if (track_size() < 6000) datarate = DataRate::_250K; else if (track_size() < 12000) datarate = DataRate::_500K; else datarate = DataRate::_1M; } // Merge any overrides from the command-line if (opt.fill >= 0) fill = static_cast<uint8_t>(opt.fill); if (opt.gap3 >= 0) gap3 = opt.gap3; if (opt.base!= -1) base = opt.base; if (opt.interleave >= 0) interleave = opt.interleave; if (opt.skew >= 0) skew = opt.skew; if (opt.head0!= -1) head0 = opt.head0; if (opt.head1!= -1) head1 = opt.head1; if (opt.cylsfirst!= -1) cyls_first = (opt.cylsfirst!= 0); if (opt.datarate!= DataRate::Unknown) datarate = opt.datarate; if (opt.encoding!= Encoding::Unknown) encoding = opt.encoding; } ======================= File: src/types/imd.cpp ======================= // <NAME>'s ImageDisk format: // http://www.classiccmp.org/dunfield/img/index.htm #include "SAMdisk.h" typedef struct { uint8_t mode; uint8_t cyl, head, sectors, size; } IMD_TRACK; typedef struct { uint8_t idstatus, datastatus; uint8_t cyl, head, sector, size; uint8_t crc1, crc2; } IMD_SECTOR; bool ReadIMD (MemFile &file, std::shared_ptr<Disk> &disk) { char sz[128]; if (!file.rewind() ||!file.read(sz, 4) || memcmp(sz, "IMD ", 4)) return false; // Search for the end of the file comment std::stringstream ss; char ch; file.rewind(); while (file.read(&ch, sizeof(ch)) && ch!= 0x1a) ss << ch; // Reject the file if we didn't find the end of comment if (ch!= 0x1a) return false; // Copy any comment disk->metadata["comment"] = ss.str(); uint8_t rmap[MAX_SECTORS], cmap[MAX_SECTORS], hmap[MAX_SECTORS], nmap[MAX_SECTORS * 2]; for (;;) { IMD_TRACK it; if (!file.read(&it, sizeof(it))) break; // Check for sensible geometry if (it.cyl > MAX_TRACKS || it.sectors > MAX_SECTORS || ((it.size & 0xf8) && it.size!= 0xff)) throw util::exception("bad geometry"); CylHead cylhead(it.cyl, it.head & 1); Track track; // Determine the encoding and data rate static const DataRate datarates[] = { DataRate::_500K, DataRate::_300K, DataRate::_250K, DataRate::_500K, DataRate::_300K, DataRate::_250K, DataRate::_1M, DataRate::_1M }; static const Encoding encodings[] = { Encoding::FM, Encoding::FM, Encoding::FM, Encoding::MFM, Encoding::MFM, Encoding::MFM, Encoding::FM, Encoding::MFM }; if (it.mode >= arraysize(datarates)) throw util::exception("invalid track mode (", it.mode, ") on ", cylhead); // Read the sector map if (!file.read(rmap, it.sectors)) throw util::exception("short file reading rmap for ", cylhead); // Read the cylinder map, if supplied if (!(it.head & 0x80)) memset(cmap, it.cyl, sizeof(cmap)); else if (!file.read(cmap, it.sectors)) throw util::exception("short file reading cmap for ", cylhead); // Read the head map, if supplied if (!(it.head & 0x40)) memset(hmap, it.head & 0x01, sizeof(hmap)); else if (!file.read(hmap, it.sectors)) throw util::exception("short file reading hmap for ", cylhead); // Read the size map, if supplied if (it.size == 0xff &&!file.read(nmap, 2, it.sectors)) throw util::exception("short file reading nmap for ", cylhead); for (int i = 0; i < it.sectors; ++i) { Sector sector(datarates[it.mode], encodings[it.mode], Header(cmap[i], hmap[i], rmap[i], it.size)); // Check for size map override if (it.size == 0xff) { // Read the sector size from the map, and convert to a size code uint16_t wSize = (nmap[i * 2 + 1] << 8) | nmap[i * 2]; sector.header.size = SizeToCode(wSize); // Fail if the size was invalid if (sector.header.size == 0xff) throw util::exception("invalid sector size (", wSize, ") on ", cylhead, " sector ", sector.header.sector); } uint8_t b; if (!file.read(&b, sizeof(b))) throw util::exception("short file reading ", cylhead, " sector ", sector.header.sector); // Unknown sector type? if (b > 8) throw util::exception("unknown sector type (", b, ") on ", cylhead, " sector ", sector.header.sector); // Data field present? if (b!= 0) { // No-data is a special case entry, convert type to more bitfields b--; bool deleted_data = (b & 2)!= 0; bool bad_data = (b & 4)!= 0; uint8_t dam = deleted_data? 0xf8 : 0xfb; // Compressed? if (b & 1) { // Read the fill byte uint8_t fill; if (!(file.read(&fill, sizeof(fill), 1))) throw util::exception("short file reading fill byte for ", cylhead, " sector ", sector.header.sector); sector.add(Data(sector.size(), fill), bad_data, dam); } else { Data data(sector.size()); // Read the normal sector data if (!file.read(data)) throw util::exception("short file reading ", cylhead, " sector ", sector.header.sector); sector.add(std::move(data), bad_data, dam); } } track.add(std::move(sector)); } disk->write(cylhead, std::move(track)); } disk->strType = "IMD"; return true; } bool WriteIMD (FILE* /*f_*/, std::shared_ptr<Disk> &/*disk*/) { throw std::logic_error("IMD writing not implemented"); #if 0 time_t now = time(NULL); struct tm *tm = localtime(&now); // Format a suitable ASCII header auto strHeader = util::fmt("IMD SAMdisk%02u%02u%02u, %02u/%02u/%04u %02u:%02u:%02u", YEAR % 100, MONTH + 1, DAY, tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec); fwrite(strHeader.c_str(), strHeader.length(), 1, f_); // Write the comment field, plus a terminating EOF fwrite(pd_->strComment.c_str(), pd_->strComment.length(), 1, f_); fwrite("\x1a", sizeof(char), 1, f_); for (BYTE cyl = 0; cyl < pd_->bUsedCyls; cyl++) { for (BYTE head = 0; head < pd_->bUsedHeads; head++) { PCTRACK pt = pd_->PeekTrack(cyl, head); int i; // Empty tracks aren't included in the image if (!pt->sectors) continue; // Map encrate to IMD track mode static BYTE modes[] = { 0, 1, 2, 6, 3, 4, 5, 7 }; IMD_TRACK it; it.mode = modes[(pt->IsMFM()? 4 : 0) | (pt->encrate & FD_RATE_MASK)]; it.cyl = cyl; it.head = head; it.sectors = pt->sectors; it.size = pt->sector[0].size; // default to first sector's size BYTE cmap[MAX_SECTORS], hmap[MAX_SECTORS], rmap[MAX_SECTORS], nmap[MAX_SECTORS * 2], hflags = 0; // First pass over the sectors to check for oddities for (i = 0; i < pt->sectors; i++) { PCSECTOR ps = &pt->sector[i]; // Ensure the sector size is legal if (ps->size > 7) { throw util::exception(CHSR(pt->cyl, pt->head, i, ps->sector), " uses an extended size code, which IMD doesn't support"); // ToDo! ScanTrack(pt, true); return retUnsuitableTarget; } else if (pt->IsMFM() && ps->IsFM()) { throw util::exception(CH(pt->cyl, pt->head), " is mixed-density, which IMD doesn't support"); // ToDo! ScanTrack(pt, true); return retUnsuitableTarget; } // Update the sector, cylinder and head maps cmap[i] = ps->cyl; hmap[i] = ps->head; rmap[i] = ps->sector; nmap[i * 2] = SectorSize(ps->size) & 0xff; nmap[i * 2 + 1] = static_cast<uint8_t>(SectorSize(ps->size) >> 8); // Note deviations from the physical cyl/head values, and fixed sector size if (ps->cyl!= cyl) hflags |= 0x80; if (ps->head!= head) hflags |= 0x40; if (ps->size!= it.size) it.size = 0xff; } // Add the flag bits to the track head value it.head |= hflags; // Write the track header if (!fwrite(&it, sizeof(it), 1, f_)) return retWriteError; // Write the sector map if (!fwrite(rmap, i, 1, f_)) return retWriteError; // Write the cylinder map if non-standard values were used if ((hflags & 0x80) &&!fwrite(cmap, i, 1, f_)) return retWriteError; // Write the head map if non-standard values were used if ((hflags & 0x40) &&!fwrite(hmap, i, 1, f_)) return retWriteError; // Write the size map if mixed sector sizes were used if (it.size == 0xff &&!fwrite(nmap, 2, i, f_)) return retWriteError; // Second pass over sectors to write the data out for (i = 0; i < pt->sectors; i++) { PCSECTOR ps = &pt->sector[i]; unsigned uDataSize = SectorSize(ps->size); // Check for missing data field if (!ps->apbData[0]) { BYTE bType = 0; // Write the sector data as 'not present' if (!fwrite(&bType, 1, 1, f_)) return retWriteError; } // Sector filled with the same value? else if (!memcmp(ps->apbData[0], ps->apbData[0] + 1, uDataSize - 1)) { BYTE bType = ps->IsDeleted()? 4 : 2; if (ps->IsDataCRC()) bType += 4; // Write the type and the fill byte to repeat BYTE bFill = ps->apbData[0][0]; if (!fwrite(&bType, sizeof(bType), 1, f_) ||!fwrite(&bFill, sizeof(bFill), 1, f_)) return retWriteError; } else { BYTE bType = ps->IsDeleted()? 3 : 1; if (ps->IsDataCRC()) bType += 4; // Write the type and the full sector data if (!fwrite(&bType, 1, 1, f_) ||!fwrite(ps->apbData[0], uDataSize, 1, f_)) return retWriteError; } } } } return retOK; #endif } ======================= File: src/FluxDecoder.cpp ======================= <filename>src/FluxDecoder.cpp // FDC-like flux reversal decoding // // PLL code from <NAME>'s Disk-Utilities/libdisk #include "SAMdisk.h" #include "FluxDecoder.h" FluxDecoder::FluxDecoder (const FluxData &flux_revs, int bitcell_ns, int flux_scale_percent, int pll_adjust) : m_flux_revs(flux_revs), m_clock(bitcell_ns), m_clock_centre(bitcell_ns), m_clock_min(bitcell_ns * (100 - pll_adjust) / 100), m_clock_max(bitcell_ns * (100 + pll_adjust) / 100), m_flux_scale_percent(flux_scale_percent), m_pll_adjust(pll_adjust) { assert(flux_revs.size()); m_rev_it = m_flux_revs.cbegin(); m_flux_it = (*m_rev_it).cbegin(); } int FluxDecoder::flux_revs () const { return static_cast<int>(m_flux_revs.size()); } int FluxDecoder::flux_count () const { auto count = 0; for (const auto &vec : m_flux_revs) count += static_cast<int>(vec.size()); return count; } bool FluxDecoder::index () { auto ret = m_index; m_index = false; return ret; } bool FluxDecoder::sync_lost () { auto ret = m_sync_lost; m_sync_lost = false; return ret; } int FluxDecoder::next_bit () { int new_flux; while (m_flux < m_clock / 2) { if ((new_flux = next_flux()) == -1) return -1; if (m_flux_scale_percent!= 100) new_flux = new_flux * m_flux_scale_percent / 100; m_flux += new_flux; m_clocked_zeros = 0; } m_flux -= m_clock; if (m_flux >= m_clock / 2) { ++m_clocked_zeros; ++m_goodbits; return 0; } // PLL: Adjust clock frequency according to phase mismatch if (m_clocked_zeros <= 3) { // In sync: adjust base clock by percentage of phase mismatch m_clock += m_flux * m_pll_adjust / 100; } else { // Out of sync: adjust base clock towards centre m_clock += (m_clock_centre - m_clock) * m_pll_adjust / 100; // Require 256 good bits before reporting another loss of sync if (m_goodbits >= 256) m_sync_lost = true; m_goodbits = 0; } // Clamp the clock's adjustment range m_clock = std::min(std::max(m_clock_min, m_clock), m_clock_max); // Authentic PLL: Do not snap the timing window to each flux transition new_flux = m_flux * (100 - opt.pllphase) / 100; m_flux = new_flux; ++m_goodbits; return 1; } int FluxDecoder::next_flux () { if (m_flux_it == (*m_rev_it).cend()) { if (++m_rev_it == m_flux_revs.cend()) return -1; m_index = true; m_flux_it = (*m_rev_it).cbegin(); if (m_flux_it == (*m_rev_it).cend()) return -1; } auto time_ns = *m_flux_it++; return time_ns; } ======================= File: src/Header.cpp ======================= #include "SAMdisk.h" #include "Header.h" std::string to_string (const DataRate &datarate) { switch (datarate) { case DataRate::_250K: return "250Kbps"; break; case DataRate::_300K: return "300Kbps"; break; case DataRate::_500K: return "500Kbps"; break; case DataRate::_1M: return "1Mbps"; break; case DataRate::Unknown: break; } return "Unknown"; } std::string to_string (const Encoding &encoding) { switch (encoding) { case Encoding::MFM: return "MFM"; break; case Encoding::FM: return "FM"; break; case Encoding::RX02: return "RX02"; break; case Encoding::Amiga: return "Amiga"; break; case Encoding::GCR: return "GCR"; break; case Encoding::Ace: return "Ace"; break; case Encoding::MX: return "MX"; break; case Encoding::Agat: return "Agat"; break; case Encoding::Apple: return "Apple"; break; case Encoding::Unknown: break; } return "Unknown"; } std::string short_name (const Encoding &encoding) { switch (encoding) { case Encoding::MFM: return "mfm"; break; case Encoding::FM: return "fm"; break; case Encoding::RX02: return "rx"; break; case Encoding::Amiga: return "ami"; break; case Encoding::GCR: return "gcr"; break; case Encoding::Ace: return "ace"; break; case Encoding::MX: return "mx"; break; case Encoding::Agat: return "agat"; break; case Encoding::Apple: return "a2"; break; case Encoding::Unknown: break; } return "unk"; } DataRate datarate_from_string(std::string str) { str = util::lowercase(str); auto len = str.size(); if (str == std::string("250kbps").substr(0, len)) return DataRate::_250K; if (str == std::string("300kbps").substr(0, len)) return DataRate::_300K; if (str == std::string("500kbps").substr(0, len)) return DataRate::_500K; if (str == std::string("1mbps").substr(0, len)) return DataRate::_1M; return DataRate::Unknown; } Encoding encoding_from_string (std::string str) { str = util::lowercase(str); if (str == "mfm") return Encoding::MFM; if (str == "fm") return Encoding::FM; if (str == "gcr") return Encoding::GCR; if (str == "amiga") return Encoding::Amiga; if (str == "ace") return Encoding::Ace; if (str == "mx") return Encoding::MX; if (str == "agat") return Encoding::Agat; return Encoding::Unknown; } ////////////////////////////////////////////////////////////////////////////// CylHead::operator int() const { return (cyl * MAX_DISK_HEADS) + head; } CylHead operator * (const CylHead &cylhead, int cyl_step) { return CylHead(cylhead.cyl * cyl_step, cylhead.head); } ////////////////////////////////////////////////////////////////////////////// Header::Header (int cyl_, int head_, int sector_, int size_) : cyl(cyl_), head(head_), sector(sector_), size(size_) { } Header::Header (const CylHead &cylhead, int sector_, int size_) : cyl(cylhead.cyl), head(cylhead.head), sector(sector_), size(size_) { } bool Header::operator== (const Header &rhs) const { return compare_crn(rhs); // ToDo: use compare_chrn? } bool Header::operator!= (const Header &rhs) const { return!compare_crn(rhs); } Header::operator CylHead() const { return CylHead(cyl, head); } bool Header::compare_chrn (const Header &rhs) const { return cyl == rhs.cyl && head == rhs.head && sector == rhs.sector && size == rhs.size; } bool Header::compare_crn (const Header &rhs) const { // Compare without head match, like WD17xx return cyl == rhs.cyl && sector == rhs.sector && size == rhs.size; } int Header::sector_size () const { return Sector::SizeCodeToLength(size); } ======================= File: src/types/msa.cpp ======================= <reponame>PeterBortas/samdisk // Magic Shadow Archiver for Atari ST // http://www.atari-wiki.com/?title=Magic_Shadow_Archiver #include "SAMdisk.h" #define MSA_SIGNATURE "\x0e\x0f" #define MSA_RLESTART 0xe5 typedef struct { uint8_t abSig[2]; // should be 0x0e,0x0f uint8_t abSectors[2]; // MSB/LSB of sectors/track uint8_t abSides[2]; // MSB/LSB of sides-1 uint8_t abStartTrack[2]; // MSB/LSB of start track (0-based) uint8_t abEndTrack[2]; // MSB/LSB of start track (0-based) } MSA_HEADER; typedef struct { uint8_t abLength[2]; // LSB/MSB track length } MSA_TRACK; typedef struct { uint8_t bMarker; // RLE start marker (0xE5) uint8_t bFill; // Repeated byte uint8_t abLength[2]; // Length of repeated block } MSA_RLE; bool ReadMSA (MemFile &file, std::shared_ptr<Disk> &disk) { MSA_HEADER dh; if (!file.rewind() ||!file.read(&dh, sizeof(dh))) return false; else if (memcmp(dh.abSig, MSA_SIGNATURE, sizeof(dh.abSig))) return false; else if (dh.abSectors[0] || dh.abSides[0] || dh.abStartTrack[0] || dh.abEndTrack[0]) return false; else if (dh.abStartTrack[1] > dh.abEndTrack[1] || dh.abSides[1] >= MAX_SIDES || dh.abSectors[1] > MAX_SECTORS) return false; auto bSectors = dh.abSectors[1]; auto bSides = dh.abSides[1] + 1; auto bStartTrack = dh.abStartTrack[1]; auto bEndTrack = dh.abEndTrack[1]; Format fmt { RegularFormat::AtariST }; fmt.cyls = bEndTrack + 1; fmt.heads = bSides; fmt.sectors = bSectors; fmt.datarate = (fmt.track_size() < 6000)? DataRate::_250K : DataRate::_500K; fmt.Override(); auto track_size = fmt.track_size(); Data mem(track_size); Data mem2(track_size); for (uint8_t cyl = bStartTrack; cyl <= bEndTrack; ++cyl) { for (uint8_t head = 0; head < bSides; ++head) { CylHead cylhead(cyl, head); MSA_TRACK dt; if (!file.read(&dt, sizeof(dt))) throw util::exception("short file reading ", cylhead, " header"); uint16_t wLength = (dt.abLength[0] << 8) | dt.abLength[1]; if (!wLength || wLength > track_size) throw util::exception("invalid track length (", wLength, ") on ", cylhead); else if (wLength == track_size) { // Read uncompressed track data if (!file.read(mem)) throw util::exception("short file reading raw data for ", cylhead); } else // Compressed track { mem.clear(); if (!file.read(mem2.data(), wLength)) throw util::exception("short file reading compressed data for ", cylhead); uint8_t *pb = mem2.data(); while (wLength) { // Not run-byte? if (*pb!= MSA_RLESTART) { mem.push_back(*pb++); wLength--; } else if (wLength < 4) throw util::exception("invalid RLE block on ", cylhead); else { // RLE block to expand auto prle = reinterpret_cast<MSA_RLE*>(pb); uint8_t fill = prle->bFill; auto wLen = (prle->abLength[0] << 8) | prle->abLength[1]; // Ensure the length is non-zero and fits if (!wLen || mem.size() + wLen > track_size) throw util::exception("invalid RLE data on ", cylhead); // Write the uncompressed block while (wLen--) mem.push_back(fill); pb += sizeof(MSA_RLE); wLength -= sizeof(MSA_RLE); } } // Ensure we've expanded the exact track size if (mem.size()!= track_size) throw util::exception("expanded data doesn't match track size on ", cylhead); } Track track; track.format(cylhead, fmt); track.populate(mem.begin(), mem.end()); disk->write(cylhead, std::move(track)); } } disk->fmt = fmt; disk->strType = "MSA"; return true; } ======================= File: src/BitstreamEncoder.cpp ======================= <filename>src/BitstreamEncoder.cpp // Encode tracks to a bitstream representation #include "SAMdisk.h" #include "BitstreamEncoder.h" #include "BitstreamTrackBuilder.h" #include "SpecialFormat.h" #include "IBMPC.h" bool generate_special(TrackData &trackdata) { auto track{ trackdata.track() }; int weak_offset{ 0 }, weak_size{ 0 }; // Special formats have special conversions if (IsEmptyTrack(track)) trackdata.add(GenerateEmptyTrack(trackdata.cylhead, track)); else if (IsKBI19Track(track)) trackdata.add(GenerateKBI19Track(trackdata.cylhead, track)); else if (IsSystem24Track(track)) trackdata.add(GenerateSystem24Track(trackdata.cylhead, track)); else if (IsSpectrumSpeedlockTrack(track, weak_offset, weak_size)) trackdata.add(GenerateSpectrumSpeedlockTrack(trackdata.cylhead, track, weak_offset, weak_size)); else if (IsCpcSpeedlockTrack(track, weak_offset, weak_size)) trackdata.add(GenerateCpcSpeedlockTrack(trackdata.cylhead, track, weak_offset, weak_size)); else if (IsRainbowArtsTrack(track, weak_offset, weak_size)) trackdata.add(GenerateRainbowArtsTrack(trackdata.cylhead, track, weak_offset, weak_size)); else if (IsKBIWeakSectorTrack(track, weak_offset, weak_size)) trackdata.add(GenerateKBIWeakSectorTrack(trackdata.cylhead, track, weak_offset, weak_size)); else if (IsLogoProfTrack(track)) trackdata.add(GenerateLogoProfTrack(trackdata.cylhead, track)); else if (IsOperaSoftTrack(track)) trackdata.add(GenerateOperaSoftTrack(trackdata.cylhead, track)); else if (Is8KSectorTrack(track)) trackdata.add(Generate8KSectorTrack(trackdata.cylhead, track)); else return false; return true; } bool generate_simple(TrackData &trackdata) { bool first_sector = true; auto &track = trackdata.track(); BitstreamTrackBuilder bitbuf(track[0].datarate, track[0].encoding); FitDetails fit_details{}; bool fits_ibmpc = FitTrackIBMPC(trackdata.cylhead, track, 200'000, fit_details); for (auto &s : track) { // Take user gap3 over sector gap3, with default of 25 bytes. int gap3 = (opt.gap3 > 0)? opt.gap3 : s.gap3? s.gap3 : (fits_ibmpc && fit_details.total_units == track.size())? fit_details.gap3 : 25; bitbuf.setEncoding(s.encoding); switch (s.encoding) { case Encoding::MFM: case Encoding::FM: case Encoding::Amiga: case Encoding::RX02: if (first_sector) bitbuf.addTrackStart(); if (s.has_badidcrc()) { bitbuf.addSectorHeader(s.header, true); } else if (s.has_baddatacrc() && fits_ibmpc &&!fit_details.real_errors) { bitbuf.addSectorUpToData(s.header, s.dam); auto fake_size = Sector::SizeCodeToLength(fit_details.size_code); auto data = s.data_copy(); if (data.size() > fake_size) data.resize(fake_size); bitbuf.addBlock(data); } else { bitbuf.addSector(s, gap3); } break; default: throw util::exception("bitstream conversion not yet available for ", s.encoding, " sectors"); } first_sector = false; } auto track_time_ns = bitbuf.size() * bitcell_ns(bitbuf.datarate()); auto track_time_ms = track_time_ns / 1'000'000; // ToDo: caller should supply size limit if (track_time_ms > 205) return false; trackdata.add(std::move(bitbuf.buffer())); return true; } void generate_bitstream(TrackData &trackdata) { assert(trackdata.has_track()); // Special formats have special conversions (unless disabled) if (!opt.nospecial && generate_special(trackdata)) { // Fail if we've encountered a flux-only special format, as converting // it to bitstream is unlikely to give a working track. if (!trackdata.has_bitstream()) throw util::exception("no suitable bitstream representation for ", trackdata.cylhead); } else if (opt.nottb) throw util::exception("track to bitstream conversion not permitted for ", trackdata.cylhead); else if (!generate_simple(trackdata)) throw util::exception("bitstream conversion not yet implemented for ", trackdata.cylhead); } void generate_flux(TrackData &trackdata) { uint8_t last_bit{ 0 }, curr_bit{ 0 }; auto &bitbuf = trackdata.bitstream(); auto ns_per_bitcell = bitcell_ns(bitbuf.datarate); bitbuf.seek(0); uint32_t flux_time{ 0 }; FluxData flux_data{}; std::vector<uint32_t> flux_times{}; flux_times.reserve(bitbuf.size()); while (!bitbuf.wrapped()) { auto next_bit{ bitbuf.read1() }; flux_time += ns_per_bitcell; if (curr_bit) { if (trackdata.cylhead.cyl < 40) { flux_times.push_back(flux_time); flux_time = 0; } else { auto pre_comp_ns{ (last_bit == next_bit)? 0 : (last_bit? +240 : -240) }; flux_times.push_back(flux_time + pre_comp_ns); flux_time = 0 - pre_comp_ns; } } last_bit = curr_bit; curr_bit = next_bit; if (bitbuf.index()) { flux_data.push_back(std::move(flux_times)); flux_times.clear(); } } if (!flux_times.empty()) flux_data.push_back(std::move(flux_times)); trackdata.add(std::move(flux_data), true); } ======================= File: src/cmd_view.cpp ======================= <filename>src/cmd_view.cpp // View command #include "SAMdisk.h" void ViewTrack (const CylHead &cylhead, const Track &track) { bool viewed = false; ScanContext context; ScanTrack(cylhead, track, context); if (!track.empty()) util::cout << "\n"; if (opt.verbose) return; for (const auto &sector : track.sectors()) { // If a specific sector/size is required, skip non-matching ones if ((opt.sectors!= -1 && (sector.header.sector!= opt.sectors)) || (opt.size >= 0 && (sector.header.size!= opt.size))) continue; if (!sector.has_data()) util::cout << "Sector " << sector.header.sector << " (no data field)\n\n"; else { // Determine the data copy and number of bytes to show auto copy = std::min(sector.copies(), opt.datacopy); const Data &data = sector.data_copy(copy); auto data_size = data.size(); auto show_begin = std::max(opt.bytes_begin, 0); auto show_end = (opt.bytes_end < 0)? data_size : std::min(opt.bytes_end, data_size); if (data_size!= sector.size()) util::cout << "Sector " << sector.header.sector << " (" << sector.size() << " bytes, " << data_size << " stored):\n"; else util::cout << "Sector " << sector.header.sector << " (" << data_size << " bytes):\n"; if (show_end > show_begin) { if (sector.copies() == 1) util::hex_dump(data.begin(), data.begin() + show_end, show_begin); else { std::vector<colour> colours; colours.reserve(sector.data_size()); for (auto &diff : DiffSectorCopies(sector)) { colour c; switch (diff.first) { default: case '=': c = colour::none; break; case '-': c = colour::RED; break; case '+': c = colour::YELLOW; break; } std::vector<colour> fill(diff.second, c); colours.insert(colours.end(), fill.begin(), fill.end()); } assert(static_cast<int>(colours.size()) == sector.data_size()); util::hex_dump(data.begin(), data.begin() + show_end, show_begin, colours.data()); } } util::cout << "\n"; } viewed = true; } // Single sector view but nothing matched? if (opt.sectors >= 0 &&!viewed) util::cout << "Sector " << opt.sectors << " not found\n"; if (!track.empty()) util::cout << "\n"; } void ViewTrack_MFM_FM (Encoding encoding, BitBuffer &bitbuf) { auto max_size = bitbuf.track_bitsize() * 110 / 100; Data track_data; std::vector<colour> colours; track_data.reserve(max_size); colours.reserve(max_size); uint32_t dword = 0; int bits = 0, a1 = 0, am_dist = 0xffff, data_size = 0; uint8_t am = 0; uint16_t sync_mask = opt.a1sync? 0xffdf : 0xffff; bitbuf.seek(0); while (!bitbuf.wrapped()) { dword = (dword << 1) | bitbuf.read1(); ++bits; bool found_am = false; if (encoding == Encoding::MFM && (dword & sync_mask) == 0x4489) { found_am = true; } else if (encoding == Encoding::FM) { switch (dword) { case 0xaa222888: // F8/C7 DDAM case 0xaa22288a: // F9/C7 Alt-DDAM case 0xaa2228a8: // FA/C7 Alt-DAM case 0xaa2228aa: // FB/C7 DAM case 0xaa2a2a88: // FC/D7 IAM case 0xaa222a8a: // FD/C7 RX02 DAM case 0xaa222aa8: // FE/C7 IDAM found_am = true; break; } } if (found_am || (bits == (encoding == Encoding::MFM? 16 : 32))) { // Decode data byte. uint8_t b = 0; if (encoding == Encoding::MFM) { for (int i = 7; i >= 0; --i) b |= static_cast<uint8_t>(((dword >> (i * 2)) & 1) << i); } else { for (int i = 7; i >= 0; --i) b |= static_cast<uint8_t>(((dword >> (i * 4 + 1)) & 1) << i); } track_data.push_back(b); ++am_dist; if (encoding == Encoding::MFM && found_am) { // A1 sync byte (red if aligned to bitstream, magenta if not). colours.push_back((bits == 16)? colour::YELLOW : colour::yellow); ++a1; } else { if (am == 0xfe && am_dist == 4) data_size = Sector::SizeCodeToLength(b); if (a1 == 3) { colours.push_back(colour::RED); am = b; am_dist = 0; } else if (encoding == Encoding::FM && found_am) { colours.push_back((bits == 32)? colour::RED : colour::red); am = b; am_dist = 0; } else if (am == 0xfe && am_dist >= 1 && am_dist <= 4) { colours.push_back((am_dist == 3)? colour::GREEN : colour::green); } else if (am == 0xfb && am_dist >= 1 && am_dist <= data_size) { colours.push_back(colour::white); } else if ((am == 0xfe && am_dist > 4 && am_dist <= 6) || (am == 0xfb && am_dist > data_size && am_dist <= (data_size + 2))) { colours.push_back(colour::MAGENTA); } else { colours.push_back(colour::grey); } a1 = 0; } bits = 0; } } auto show_begin = std::max(opt.bytes_begin, 0); auto show_end = (opt.bytes_end < 0)? track_data.size(): std::min(opt.bytes_end, track_data.size()); if (show_end > show_begin) { util::cout << encoding << " Decode (" << bitbuf.track_bitsize() << " bits):\n"; util::hex_dump(track_data.begin(), track_data.begin() + show_end, show_begin, colours.data()); } } bool ViewImage (const std::string &path, Range range) { util::cout << "[" << path << "]\n"; auto disk = std::make_shared<Disk>(); if (ReadImage(path, disk)) { ValidateRange(range, MAX_TRACKS, MAX_SIDES, opt.step, disk->cyls(), disk->heads()); range.each([&] (const CylHead &cylhead) { auto track = disk->read_track(cylhead * opt.step); NormaliseTrack(cylhead, track); ViewTrack(cylhead, track); if (opt.verbose) { auto trackdata = disk->read(cylhead * opt.step); auto bitbuf = trackdata.preferred().bitstream(); NormaliseBitstream(bitbuf); auto encoding = (opt.encoding == Encoding::Unknown)? bitbuf.encoding : opt.encoding; switch (encoding) { case Encoding::MFM: case Encoding::Amiga: case Encoding::Agat: case Encoding::MX: ViewTrack_MFM_FM(Encoding::MFM, bitbuf); break; case Encoding::FM: case Encoding::RX02: ViewTrack_MFM_FM(Encoding::FM, bitbuf); break; default: throw util::exception("unsupported track view encoding"); } } }, true); } return true; } bool ViewHdd (const std::string &path, Range range) { auto hdd = HDD::OpenDisk(path); if (!hdd) Error("open"); if (!range.empty() && (range.cyls()!= 1 || range.heads()!= 1)) throw util::exception("HDD view ranges are not supported"); MEMORY mem(hdd->sector_size); auto cyl = range.cyl_begin; auto head = range.head_begin; auto sector = (opt.sectors < 0)? 0 : opt.sectors; auto lba_sector = sector; if (!range.empty()) { if (cyl >= hdd->cyls || head >= hdd->heads || sector > hdd->sectors ||!sector) { util::cout << util::fmt("Invalid CHS address for drive (Cyl 0-%d, Head 0-%u, Sector 1-%u)\n", hdd->cyls - 1, hdd->heads - 1, hdd->sectors); return false; } // Convert CHS address to LBA lba_sector = (cyl * hdd->heads + head) * hdd->sectors + (sector - 1); } if (lba_sector >= hdd->total_sectors) util::cout << util::fmt("LBA value out of drive range (%u sectors).\n", hdd->total_sectors); else if (!hdd->Seek(lba_sector) ||!hdd->Read(mem, 1)) Error("read"); else { if (!range.empty()) util::cout << util::fmt("Cyl %s Head %s Sector %u (LBA %s):\n", CylStr(cyl), HeadStr(head), sector, lba_sector); else util::cout << util::fmt("LBA Sector %u (%u bytes):\n\n", lba_sector, mem.size); auto show_begin = std::max(opt.bytes_begin, 0); auto show_end = (opt.bytes_end < 0)? mem.size : std::min(opt.bytes_end, mem.size); util::hex_dump(mem.pb, mem.pb + show_end, show_begin); return true; } return false; } bool ViewBoot (const std::string &path, Range range) { // Strip ":0" from end of string std::string device = path.substr(0, path.find_last_of(":")); // Force boot sector opt.sectors = 0; return ViewHdd(device, range); } ======================= File: src/types/fdrawsys_dev.cpp ======================= // fdrawcmd.sys real device wrapper: // http://simonowen.com/fdrawcmd/ #include "SAMdisk.h" #include "DemandDisk.h" #include "IBMPC.h" #include "FdrawcmdSys.h" #ifdef HAVE_FDRAWCMD_H #include "fdrawcmd.h" class FdrawSysDevDisk final : public DemandDisk { public: FdrawSysDevDisk(const std::string &path, std::unique_ptr<FdrawcmdSys> fdrawcmd) : m_fdrawcmd(std::move(fdrawcmd)) { try { SetMetadata(path); auto srt = (opt.steprate >= 0)? opt.steprate : (opt.newdrive? 0xd : 0x8); auto hut = 0x0f; auto hlt = opt.newdrive? 0x0f : 0x7f; m_fdrawcmd->Specify(srt, hut, hlt); m_fdrawcmd->SetMotorTimeout(0); m_fdrawcmd->Recalibrate(); if (!opt.newdrive) m_fdrawcmd->SetDiskCheck(false); } catch (...) { throw util::exception("failed to initialise fdrawcmd.sys device"); } } protected: bool supports_retries() const override { return true; } TrackData load(const CylHead &cylhead, bool /*first_read*/) override { m_fdrawcmd->Seek(cylhead.cyl); auto firstSectorSeen{0}; auto track = BlindReadHeaders(cylhead, firstSectorSeen); int i; for (i = 0; i < track.size(); i += 2) ReadSector(cylhead, track, i, firstSectorSeen); for (i = 1 ; i < track.size(); i += 2) ReadSector(cylhead, track, i, firstSectorSeen); if (opt.gaps >= GAPS_CLEAN) ReadFirstGap(cylhead, track); return TrackData(cylhead, std::move(track)); } bool preload(const Range &/*range*/, int /*cyl_step*/) override { return false; } private: void SetMetadata(const std::string &path); bool DetectEncodingAndDataRate(int head); Track BlindReadHeaders(const CylHead &cylhead, int &firstSectorSeen); void ReadSector(const CylHead &cylhead, Track &track, int index, int firstSectorSeen=0); void ReadFirstGap(const CylHead &cylhead, Track &track); std::unique_ptr<FdrawcmdSys> m_fdrawcmd; Encoding m_lastEncoding{Encoding::Unknown}; DataRate m_lastDataRate{DataRate::Unknown}; bool m_warnedMFM128{false}; }; void FdrawSysDevDisk::SetMetadata(const std::string &path) { auto device_path = R"(\\.\)" + path; Win32Handle hdev{ CreateFile(device_path.c_str(), 0, FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, NULL) }; if (hdev.get()!= INVALID_HANDLE_VALUE) { DWORD dwRet = 0; DISK_GEOMETRY dg[8]{}; if (DeviceIoControl(hdev.get(), IOCTL_STORAGE_GET_MEDIA_TYPES, nullptr, 0, &dg, sizeof(dg), &dwRet, NULL) && dwRet > sizeof(DISK_GEOMETRY)) { auto count = dwRet / sizeof(dg[0]); metadata["bios_type"] = to_string(dg[count - 1].MediaType); } } FD_FDC_INFO info{}; if (m_fdrawcmd->GetFdcInfo(info)) { static const std::vector<std::string> fdc_types{ "Unknown", "Unknown1", "Normal", "Enhanced", "82077", "82077AA", "82078_44", "82078_64", "National" }; static const std::vector<std::string> data_rates{ "250K", "300K", "500K", "1M", "2M" }; std::stringstream ss; for (size_t i = 0, n = 0; i < data_rates.size(); ++i) { if (!(info.SpeedsAvailable & (1U << i))) continue; if (n++) ss << " / "; ss << data_rates[i]; } metadata["fdc_type"] = (info.ControllerType < fdc_types.size())? fdc_types[info.ControllerType] : "???"; metadata["data_rates"] = ss.str(); } } // Detect encoding and data rate of the track under the given drive head. bool FdrawSysDevDisk::DetectEncodingAndDataRate(int head) { FD_CMD_RESULT result{}; if (m_lastEncoding!= Encoding::Unknown && m_lastDataRate!= DataRate::Unknown) { // Try the last successful encoding and data rate. m_fdrawcmd->SetEncRate(m_lastEncoding, m_lastDataRate); // Return if we found a sector. if (m_fdrawcmd->CmdReadId(head, result)) return true; } for (auto encoding : {Encoding::MFM, Encoding::FM}) { for (auto datarate : {DataRate::_1M, DataRate::_500K, DataRate::_300K, DataRate::_250K}) { // Skip FM if we're only looking for MFM, or the data rate is 1Mbps. if (encoding == Encoding::FM && (opt.encoding == Encoding::MFM || datarate == DataRate::_1M)) continue; // Skip rates not matching user selection. if (opt.datarate!= DataRate::Unknown && datarate!= opt.datarate) continue; // Skip 1Mbps if the FDC doesn't report it's supported. if (datarate == DataRate::_1M) { FD_FDC_INFO fi{}; if (!m_fdrawcmd->GetFdcInfo(fi) ||!(fi.SpeedsAvailable & FDC_SPEED_1M)) { // Fail if user selected the rate. if (opt.datarate == DataRate::_1M) throw util::exception("FDC doesn't support 1Mbps data rate"); continue; } } m_fdrawcmd->SetEncRate(encoding, datarate); // Retry in case of spurious header CRC errors. for (auto i = 0; i <= opt.retries; ++i) { if (m_fdrawcmd->CmdReadId(head, result)) { // Remember the settings for the first try next time. m_lastEncoding = encoding; m_lastDataRate = datarate; return true; } // Give up on the current settings if nothing was found. if (GetLastError() == ERROR_FLOPPY_ID_MARK_NOT_FOUND || GetLastError() == ERROR_SECTOR_NOT_FOUND) break; // Fail for any reason except a CRC error if (GetLastError()!= ERROR_CRC) throw win32_error(GetLastError(), "READ_ID"); } } } // Nothing detected. return false; } Track FdrawSysDevDisk::BlindReadHeaders(const CylHead &cylhead, int &firstSectorSeen) { Track track; auto scan_size = sizeof(FD_TIMED_SCAN_RESULT) + sizeof(FD_TIMED_ID_HEADER) * MAX_SECTORS; MEMORY mem(scan_size); auto scan_result = reinterpret_cast<FD_TIMED_SCAN_RESULT *>(mem.pb); if (m_lastEncoding == Encoding::Unknown || m_lastDataRate == DataRate::Unknown) DetectEncodingAndDataRate(cylhead.head); if (!m_fdrawcmd->CmdTimedScan(cylhead.head, scan_result, scan_size)) throw win32_error(GetLastError(), "scan"); // If nothing was found and we have valid settings, they might have changed. if (!scan_result->count && m_lastEncoding!= Encoding::Unknown) { DetectEncodingAndDataRate(cylhead.head); if (!m_fdrawcmd->CmdTimedScan(cylhead.head, scan_result, scan_size)) throw win32_error(GetLastError(), "scan"); } // If the track time is slower than 200rpm, an index-halving cable must be present if (scan_result->tracktime > RPM_TIME_200) throw util::exception("index-halving cables are no longer supported"); firstSectorSeen = scan_result->firstseen; if (scan_result->count > 0) { auto bit_us = GetDataTime(m_lastDataRate, m_lastEncoding) / 16; track.tracktime = scan_result->tracktime; track.tracklen = track.tracktime / bit_us; for (int i = 0; i < scan_result->count; ++i) { const auto &scan_header = scan_result->Header[i]; Header header(scan_header.cyl, scan_header.head, scan_header.sector, scan_header.size); Sector sector(m_lastDataRate, m_lastEncoding, header); sector.offset = scan_header.reltime / bit_us; track.add(std::move(sector)); } } return track; } void FdrawSysDevDisk::ReadSector(const CylHead &cylhead, Track &track, int index, int firstSectorSeen) { auto &sector = track[index]; if (sector.has_badidcrc() || sector.has_good_data()) return; auto size = sector.SizeCodeToLength(sector.SizeCodeToRealSizeCode(sector.header.size)); MEMORY mem(size); for (int i = 0; i <= opt.retries; ++i) { // If the sector id occurs more than once on the track, synchronise to the correct one if (track.is_repeated(sector)) { auto offset{(index + track.size() - firstSectorSeen) % track.size()}; m_fdrawcmd->FdSetSectorOffset(offset); } // Invalidate the content so misbehaving FDCs can be identififed. memset(mem.pb, 0xee, mem.size); const Header &header = sector.header; if (!m_fdrawcmd->CmdRead(cylhead.head, header.cyl, header.head, header.sector, header.size, 1, mem)) { // Reject errors other than CRC, sector not found and missing address marks auto error{GetLastError()}; if (error!= ERROR_CRC && error!= ERROR_SECTOR_NOT_FOUND && error!= ERROR_FLOPPY_ID_MARK_NOT_FOUND) { throw win32_error(error, "read"); } } // Get the controller result for the read to find out more FD_CMD_RESULT result{}; if (!m_fdrawcmd->GetResult(result)) throw win32_error(GetLastError(), "result"); // Try again if header or data field are missing. if (result.st1 & (STREG1_MISSING_ADDRESS_MARK | STREG1_NO_DATA)) continue; // Header match not found for a sector we scanned earlier? if (result.st1 & STREG1_END_OF_CYLINDER) { // Warn the user if we suspect the FDC can't handle 128-byte MFM sectors. if (!m_warnedMFM128 && sector.encoding == Encoding::MFM && sector.size() == 128) { Message(msgWarning, "FDC seems unable to read 128-byte sectors correctly"); m_warnedMFM128 = true; } continue; } bool data_crc_error{ (result.st2 & STREG2_DATA_ERROR_IN_DATA_FIELD)!= 0 }; uint8_t dam = (result.st2 & STREG2_CONTROL_MARK)? 0xf8 : 0xfb; Data data(mem.pb, mem.pb + mem.size); sector.add(std::move(data), data_crc_error, dam); // If the read command was successful we're all done. if ((result.st0 & STREG0_INTERRUPT_CODE) == 0) break; // Accept sectors that overlap the next field, as they're unlikely to succeed. if (track.data_overlap(sector)) break; // Accept 8K sectors with a recognised checksum method. if (track.is_8k_sector() &&!ChecksumMethods(mem.pb, size).empty()) break; } } void FdrawSysDevDisk::ReadFirstGap(const CylHead &cylhead, Track &track) { if (track.empty()) return; auto &sector = track[0]; if (sector.has_badidcrc() || track.data_overlap(sector)) return; // Read a size auto size_code = sector.header.size + 1; auto size = sector.SizeCodeToLength(sector.SizeCodeToRealSizeCode(size_code)); MEMORY mem(size); for (int i = 0; i <= opt.retries; ++i) { // Invalidate the content so misbehaving FDCs can be identififed. memset(mem.pb, 0xee, mem.size); if (!m_fdrawcmd->CmdReadTrack(cylhead.head, 0, 0, 0, size_code, 1, mem)) { // Reject errors other than CRC, sector not found and missing address marks auto error{ GetLastError() }; if (error!= ERROR_CRC && error!= ERROR_SECTOR_NOT_FOUND && error!= ERROR_FLOPPY_ID_MARK_NOT_FOUND) { throw win32_error(error, "read_track"); } } FD_CMD_RESULT result{}; if (!m_fdrawcmd->GetResult(result)) throw win32_error(GetLastError(), "result"); if (result.st1 & (STREG1_MISSING_ADDRESS_MARK | STREG1_END_OF_CYLINDER)) continue; else if (result.st2 & STREG2_MISSING_ADDRESS_MARK_IN_DATA_FIELD) continue; // Sanity check the start of the track against a good copy. if (sector.has_good_data()) { const auto data = sector.data_copy(); if (std::memcmp(data.data(), mem.pb, data.size())) { Message(msgWarning, "track read of %s doesn't match first sector content", CH(cylhead.cyl, cylhead.head)); break; } } auto extent = track.data_extent_bytes(sector); sector.add(Data(mem.pb, mem.pb + extent), sector.has_baddatacrc(), sector.dam); break; } } bool ReadFdrawcmdSys (const std::string &path, std::shared_ptr<Disk> &disk) { if (!IsFloppyDevice(path)) return false; auto devidx = (util::lowercase(path) == "b:")? 1 : 0; auto fdrawcmd = FdrawcmdSys::Open(devidx); if (!fdrawcmd) throw util::exception("failed to open fdrawcmd.sys device"); auto fdrawcmd_dev_disk = std::make_shared<FdrawSysDevDisk>(path, std::move(fdrawcmd)); fdrawcmd_dev_disk->extend(CylHead(83 - 1, 2 - 1)); fdrawcmd_dev_disk->strType = "fdrawcmd.sys"; disk = fdrawcmd_dev_disk; return true; } bool WriteFdrawcmdSys (const std::string &path, std::shared_ptr<Disk> &/*disk*/) { if (!IsFloppyDevice(path)) return false; throw util::exception("fdrawcmd.sys writing not yet implemented"); } #endif // HAVE_FDRAWCMD_H ======================= File: src/types.cpp ======================= <filename>src/types.cpp // Macro magic for supported disk types #include "SAMdisk.h" #ifdef DECLARATIONS_ONLY extern IMAGE_ENTRY aImageTypes[]; extern DEVICE_ENTRY aDeviceTypes[]; #define ADD_IMAGE_RW(x) bool Read##x (MemFile&, std::shared_ptr<Disk> &); \ bool Write##x (FILE*, std::shared_ptr<Disk> &); #define ADD_IMAGE_RO(x) bool Read##x (MemFile&, std::shared_ptr<Disk> &); #define ADD_IMAGE_WO(x) bool Write##x (FILE*, std::shared_ptr<Disk> &); #define ADD_IMAGE_HIDDEN_RO(x) bool Read##x (MemFile&, std::shared_ptr<Disk> &); #define ADD_DEVICE(x) bool Read##x (const std::string &, std::shared_ptr<Disk> &); \ bool Write##x (const std::string &, std::shared_ptr<Disk> &); #else #include "types.h" #define ADD_IMAGE_RW(x) { #x, Read##x, Write##x }, #define ADD_IMAGE_RO(x) { #x, Read##x, nullptr }, #define ADD_IMAGE_WO(x) { #x, nullptr, Write##x }, #define ADD_IMAGE_HIDDEN_RO(x) { "", Read##x, nullptr }, #define ADD_DEVICE(x) { #x, Read##x, Write##x }, IMAGE_ENTRY aImageTypes[] = { #endif // Types with a header signature ADD_IMAGE_RW(DSK) ADD_IMAGE_RO(TD0) ADD_IMAGE_RW(SAD) ADD_IMAGE_RO(SCL) ADD_IMAGE_RW(FDI) ADD_IMAGE_RW(DTI) ADD_IMAGE_RO(IPF) ADD_IMAGE_RO(MSA) ADD_IMAGE_RO(CQM) ADD_IMAGE_RO(CWTOOL) ADD_IMAGE_RO(UDI) ADD_IMAGE_RW(IMD) ADD_IMAGE_RO(SBT) ADD_IMAGE_RO(DFI) ADD_IMAGE_RO(SCP) ADD_IMAGE_RO(STREAM) ADD_IMAGE_RW(HFE) ADD_IMAGE_RO(MFI) ADD_IMAGE_RW(QDOS) ADD_IMAGE_RW(SAP) ADD_IMAGE_RO(WOZ) // Types with distinctive fields ADD_IMAGE_RO(D80) ADD_IMAGE_RO(BPB) ADD_IMAGE_RW(ADF) ADD_IMAGE_RO(DMK) ADD_IMAGE_RW(MBD) ADD_IMAGE_RW(OPD) ADD_IMAGE_RW(D88) ADD_IMAGE_RW(1DD) // Raw types, identified by size or extension only ADD_IMAGE_RW(2D) ADD_IMAGE_RW(TRD) ADD_IMAGE_RW(LIF) ADD_IMAGE_RO(CFI) ADD_IMAGE_RO(DSC) ADD_IMAGE_RO(SDF) ADD_IMAGE_RO(S24) ADD_IMAGE_RW(D2M) ADD_IMAGE_RW(D4M) ADD_IMAGE_RW(D81) ADD_IMAGE_RW(MGT) ADD_IMAGE_RO(DS2) ADD_IMAGE_RW(CPM) ADD_IMAGE_RW(FD) ADD_IMAGE_WO(DO) ADD_IMAGE_RW(RAW) ADD_IMAGE_HIDDEN_RO(Unsupported) #ifndef DECLARATIONS_ONLY { nullptr, nullptr, nullptr } // aImageTypes list terminator }; #endif #ifndef DECLARATIONS_ONLY DEVICE_ENTRY aDeviceTypes[] = { #endif ADD_DEVICE(SuperCardPro) ADD_DEVICE(KryoFlux) ADD_DEVICE(TrinLoad) ADD_DEVICE(BDOS) ADD_DEVICE(BuiltIn) ADD_DEVICE(BlockDevice) #ifdef HAVE_FDRAWCMD_H ADD_DEVICE(FdrawcmdSys) ADD_DEVICE(FdrawcmdSysAB) #endif #ifndef DECLARATIONS_ONLY { nullptr, nullptr, nullptr } // aDeviceTypes list terminator }; #endif #undef ADD_IMAGE_RW #undef ADD_IMAGE_RO #undef ADD_IMAGE_WO #undef ADD_IMAGE_HIDDEN_RO #undef ADD_DEVICE ======================= File: src/types/mgt.cpp ======================= // Miles Gordon Technology format for MGT +D and SAM Coupe disks: // http://www.worldofspectrum.org/faq/reference/formats.htm#MGT // // Also accepts IMG variant with different track order. #include "SAMdisk.h" bool ReadMGT (MemFile &file, std::shared_ptr<Disk> &disk) { if (file.size()!= MGT_DISK_SIZE) return false; // Check the first directory chain to test for an IMG image std::array<uint8_t, 2> buf; auto offset = MGT_DIR_TRACKS * MGT_TRACK_SIZE + SECTOR_SIZE - 2; bool img = file.seek(offset) && file.read(buf) && buf[0] == 0x04 && buf[1] == 0x02; file.rewind(); disk->format(Format(RegularFormat::MGT), file.data(), img); disk->strType = img? "IMG" : "MGT"; return true; } bool WriteMGT (FILE* f_, std::shared_ptr<Disk> &disk) { return WriteRegularDisk(f_, *disk, RegularFormat::MGT); } ======================= File: src/types/qdos.cpp ======================= // QDOS = Sinclair QL // // http://www.qdosmsq.dunbar-it.co.uk/doku.php?id=qdosmsq:fs:dsdd #include "SAMdisk.h" #include "qdos.h" bool ReadQDOS (MemFile &file, std::shared_ptr<Disk> &disk) { QDOS_HEADER qh{}; if (!file.rewind() ||!file.read(&qh, sizeof(qh))) return false; if (memcmp(qh.signature, "QL5A", 4) && memcmp(qh.signature, "QL5B", 4)) return false; auto total_sectors = util::betoh(qh.total_sectors); auto sectors_per_track = util::betoh(qh.sectors_per_track); auto sectors_per_cyl = util::betoh(qh.sectors_per_cyl); auto cyls_per_side = util::betoh(qh.cyls_per_side); Format fmt { RegularFormat::QDOS }; fmt.cyls = cyls_per_side; fmt.heads = sectors_per_cyl / sectors_per_track; fmt.sectors = sectors_per_track; fmt.datarate = (fmt.track_size() > 6000)? DataRate::_500K : DataRate::_250K; if (total_sectors!= fmt.total_sectors()) Message(msgWarning, "sector count (%u) doesn't match geometry (%d)", total_sectors, fmt.total_sectors()); if (fmt.disk_size()!= file.size()) Message(msgWarning, "image file isn't expected size (%d)", fmt.disk_size()); auto label = util::trim(std::string(qh.label, sizeof(qh.label))); disk->metadata["label"] = label; disk->metadata["type"] = std::string(qh.signature, sizeof(qh.signature)); disk->format(fmt, file.data()); disk->strType = "QDOS (Sinclair QL)"; return true; } bool WriteQDOS (FILE* f_, std::shared_ptr<Disk> &disk) { const Sector *sector = nullptr; if (!disk->find(Header(0, 0, 1, 2), sector)) return false; auto &data = sector->data_copy(); if (data.size() < 512 || memcmp(data.data(), "QL5", 3)) return false; auto pqh = reinterpret_cast<const QDOS_HEADER *>(data.data()); auto total_sectors = util::betoh(pqh->total_sectors); auto cyls_per_side = util::betoh(pqh->cyls_per_side); auto sectors_per_cyl = util::betoh(pqh->sectors_per_cyl); auto sectors_per_track = util::betoh(pqh->sectors_per_track); Format fmt { RegularFormat::QDOS }; fmt.cyls = cyls_per_side; fmt.heads = sectors_per_track? (sectors_per_cyl / sectors_per_track) : 0; fmt.sectors = sectors_per_track; fmt.datarate = (fmt.track_size() > 6000)? DataRate::_500K : DataRate::_250K; fmt.Validate(); if (total_sectors!= fmt.total_sectors()) Message(msgWarning, "sector count (%u) doesn't match geometry (%d)", total_sectors, fmt.total_sectors()); WriteRegularDisk(f_, *disk, fmt); return true; } ======================= File: src/Range.cpp ======================= #include "SAMdisk.h" #include "Range.h" std::string to_string (const Range &range) { std::ostringstream ss; auto separator = ", "; if (range.empty()) return "All Tracks"; if (range.cyls() == 1) ss << "Cyl " << CylStr(range.cyl_begin); else if (range.cyl_begin == 0) { ss << std::setw(2) << range.cyl_end << " Cyls"; separator = " "; } else ss << "Cyls " << CylStr(range.cyl_begin) << '-' << CylStr(range.cyl_end - 1); if (range.heads() == 1) ss << " Head " << range.head_begin; else if (range.head_begin == 0) ss << separator << range.head_end << " Heads"; else ss << " Heads " << range.head_begin << '-' << (range.head_end - 1); return ss.str(); } Range::Range (int num_cyls, int num_heads) : Range(0, num_cyls, 0, num_heads) { } Range::Range (int cyl_begin_, int cyl_end_, int head_begin_, int head_end_) : cyl_begin(cyl_begin_), cyl_end(cyl_end_), head_begin(head_begin_), head_end(head_end_) { assert(cyl_begin >= 0 && cyl_begin <= cyl_end); assert(head_begin >= 0 && head_begin <= head_end); } bool Range::empty () const { return cyls() <= 0 || heads() <= 0; } int Range::cyls () const { return cyl_end - cyl_begin; } int Range::heads () const { return head_end - head_begin; } bool Range::contains (const CylHead &cylhead) { return cylhead.cyl >= cyl_begin && cylhead.cyl < cyl_end && cylhead.head >= head_begin && cylhead.head < head_end; } void Range::each (const std::function<void (const CylHead &cylhead)> &func, bool cyls_first/*=false*/) const { if (cyls_first && heads() > 1) { for (auto head = head_begin; head < head_end; ++head) for (auto cyl = cyl_begin; cyl < cyl_end; ++cyl) func(CylHead(cyl, head)); } else { for (auto cyl = cyl_begin; cyl < cyl_end; ++cyl) for (auto head = head_begin; head < head_end; ++head) func(CylHead(cyl, head)); } } ======================= File: src/types/builtin.cpp ======================= // Built-in disk images used for testing #include "SAMdisk.h" #include "IBMPC.h" #include "BitstreamTrackBuilder.h" #include "BitstreamDecoder.h" #include "FluxTrackBuilder.h" #include "SpecialFormat.h" static Track &complete (Track &track) { uint8_t fill = 0; for (auto &sector : track) { // Add test data to sectors that lack it if (!sector.copies()) sector.add(Data(sector.size(), fill)); // Remove data from sectors with 0 bytes of data (for no-data sectors) else if (!sector.data_size()) sector.datas().clear(); ++fill; } return track; } template<typename T> void fill(T &x, uint8_t val) { std::fill(x.begin(), x.end(), val); } template<typename T> void fill(T &x, size_t from, uint8_t val) { std::fill(x.begin() + from, x.end(), val); } template<typename T> void fill(T &x, size_t from, size_t to, uint8_t val) { std::fill(x.begin() + from, x.begin() + to, val); } template<typename T> void iota(T &x, uint8_t first_val) { std::iota(x.begin(), x.end(), first_val); } template<typename T> void iota(T &x, size_t from, uint8_t first_val) { std::iota(x.begin() + from, x.end(), first_val); } template<typename T> void iota(T &x, size_t from, size_t to, uint8_t first_val) { std::iota(x.begin() + from, x.begin() + to, first_val); } bool ReadBuiltIn (const std::string &path, std::shared_ptr<Disk> &disk) { if (!IsBuiltIn(path)) return false; CylHead cylhead(0, 0); uint8_t i; auto type = std::strtol(path.c_str() + 1, NULL, 0); switch (type) { // 500Kbps examples case 0: { disk->metadata["comment"] = "500Kbps examples"; #if 0 // 21 sectors/track { Track track(21); for (i = 0; i < 21; ++i) { Sector sector(DataRate::_500K, Encoding::MFM, Header(cylhead, 1 + i, 2)); track.add(std::move(sector)); } disk->write_track(cylhead.next_cyl(), std::move(complete(track))); } // Sega System 24 { Track track(6); for (i = 0; i < 6; ++i) { static const uint8_t sizes[] = { 6,3,3,3,2,1 }; Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, sizes[i])); track.add(std::move(sector)); } disk->write_track(cylhead.next_cyl(), std::move(complete(track))); } #endif // Missing data fields { Track track(18); for (i = 0; i < 18; ++i) { Sector sector(DataRate::_500K, Encoding::MFM, Header(cylhead, 1 + i, 2)); if (!(i % 10)) sector.add(Data()); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Data CRC errors { Track track(18); for (i = 0; i < 18; ++i) { Sector sector(DataRate::_500K, Encoding::MFM, Header(cylhead, 1 + i, 2)); if (!((i + 5) % 10)) sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // 65 x 128-byte sectors { Track track(65); for (i = 0; i < 65; ++i) { Sector sector(DataRate::_500K, Encoding::MFM, Header(cylhead, 1 + i, 0)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } break; } // 300Kbps examples case 1: { disk->metadata["comment"] = "300Kbps examples"; // BBC FM { Track track(10); for (i = 0; i < 10; ++i) { Sector sector(DataRate::_300K, Encoding::FM, Header(cylhead, 1 + i, 1)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } break; } // 250Kbps examples case 2: { disk->metadata["comment"] = "250Kbps examples"; #if 0 // 11-sector Atari ST { Track track(11); for (i = 0; i < 11; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, i + 1, 2)); track.add(std::move(sector)); } disk->write_track(cylhead.next_cyl(), std::move(complete(track))); } #endif // +3 Speedlock sector (fully weak - Arctic Fox) { Track track(9); for (i = 0; i < 9; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, 2)); if (i >= 2 && i <= 7) sector.add(Data(sector.size(), i), false, 0xf8); track.add(std::move(sector)); } // Add Speedlock signature to first sector Data data0(512, 0); std::string sig{ "SPEEDLOCK" }; std::copy(sig.begin(), sig.end(), data0.begin() + 304); track[0].add(Data(data0)); // Create 3 different copies of the weak sector iota(data0, 0); track[1].add(Data(data0), true); iota(data0, 1); track[1].add(Data(data0), true); iota(data0, 2); track[1].add(Data(data0), true); disk->write(cylhead.next_cyl(), std::move(complete(track))); } // +3 Speedlock sector (partially weak - Robocop) { Track track(9); for (i = 0; i < 9; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, 2)); if (i >= 2 && i <= 7) sector.add(Data(sector.size(), i), false, 0xf8); track.add(std::move(sector)); } // Add Speedlock signature to first sector Data data0(512, 0); const std::string sig{ "SPEEDLOCK" }; std::copy(sig.begin(), sig.end(), data0.begin() + 304); track[0].add(std::move(data0)); // Add 3 copies with differences matching the Robocop weakness (and SAMdisk v3) Data data1(512, 0); fill(data1, 0, 256, 0xe5); track[1].add(Data(data1), true); iota(data1, 256, 1); fill(data1, 256 + 32, 256 + 32 + 48, 2); track[1].add(Data(data1), true); iota(data1, 256, 0); fill(data1, 256 + 32, 256 + 32 + 48, 1); track[1].add(Data(data1), true); disk->write(cylhead.next_cyl(), std::move(complete(track))); } // CPC Speedlock sector (partially weak) { Track track(9); for (i = 0; i < 9; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 64 + i, 2)); track.add(std::move(sector)); } // Add Speedlock signature to first sector Data data0(512, 0); const std::string sig{ "SPEEDLOCK" }; std::copy(sig.begin(), sig.end(), data0.begin() + 257); track[0].add(std::move(data0)); // Add 3 copies with differences matching the typical weak sector Data data7(512, 0); fill(data7, 0, 256, 0xe5); track[7].add(Data(data7), true); iota(data7, 256, 1); fill(data7, 256 + 40, 256 + 40 + 40, 2); track[7].add(Data(data7), true); iota(data7, 256, 0); fill(data7, 256 + 40, 256 + 40 + 40, 1); track[7].add(Data(data7), true); disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Rainbow Arts partially weak sector { static constexpr uint8_t ids[]{ 193,198,194,109,195,200,196,201,197 }; Track track(arraysize(ids)); for (auto id : ids) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, id, 2)); track.add(std::move(sector)); } // Add Speedlock signature to first sector Data data0(512, 0); const std::string sig{ "SPEEDLOCK" }; std::copy(sig.begin(), sig.end(), data0.begin() + 9); track[0].add(std::move(data0)); // Add 3 copies with differences matching the typical weak sector Data data1(512, 0); fill(data1, 0, 256, 0xe5); track[1].add(Data(data1), true); iota(data1, 100, 100 + 207, 101); fill(data1, 100 + 207, 2); track[1].add(Data(data1), true); iota(data1, 100, 100 + 207, 101); fill(data1, 100 + 207, 1); track[1].add(Data(data1), true); Data data3(512, 0); const std::string codesig{ "\x2a\x6d\xa7\x01\x30\x01\xaf\xed\x42\x4d\x44\x21\x70\x01" }; std::copy(codesig.begin(), codesig.end(), data3.begin()); track[3].add(std::move(data3)); disk->write(cylhead.next_cyl(), std::move(complete(track))); } // KBI-10 weak sector { static constexpr uint8_t ids[]{ 193,198,194,109,195,200,196,201,197,202 }; Track track(arraysize(ids)); for (i = 0; i < 10; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, ids[i], (i == 9)? 1 : 2)); track.add(std::move(sector)); } Data data9(256, 0xe5); const std::string sig{ "KBI." }; std::copy(sig.begin(), sig.end(), data9.begin()); track[9].add(Data(data9), true); iota(data9, 4, 4 + 4, 5); iota(data9, 4 + 4 + 124, 4 + 4 + 124 + 4, 125); track[9].add(Data(data9), true); iota(data9, 4, 4 + 4, 4); iota(data9, 4 + 4 + 124, 4 + 4 + 124 + 4, 124); track[9].add(Data(data9), true); disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Missing data fields { Track track(10); for (i = 0; i < 10; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, 2)); if (!(i % 5)) sector.add(Data()); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // ID field CRC error { Track track(10); for (i = 0; i < 10; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, 2)); if (!(i % 5)) sector.set_badidcrc(); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Data CRC error { Track track(10); for (i = 0; i < 10; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, 2)); if (!(i % 5)) sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Jim Power with data hidden in gap after first sector (broken in SAMdisk v3.7+ 23???) { Track track(10); for (i = 0; i < 10; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, 2)); track.add(std::move(sector)); } Data data0(512, 0x01); CRC16 crc("\xa1\xa1\xa1", 3); crc.add(0xfb); crc.add(data0.data(), 512); data0.insert(data0.end(), crc.msb()); data0.insert(data0.end(), crc.lsb()); data0.insert(data0.end(), 1, 0x4e); data0.insert(data0.end(), 9, 0xf7); track[0].add(std::move(data0)); disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Single sector with gap data { Track track(1); Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1, 0)); track.add(std::move(sector)); const std::string sig{ "HELLO!" }; Data data0(6144, 0x01); fill(data0, 0, sector.size(), 0x00); std::copy(sig.begin(), sig.end(), std::prev(data0.end(), sig.size())); CRC16 crc("\xa1\xa1\xa1", 3); crc.add(0xfb); crc.add(data0.data(), sector.size()); data0[sector.size() + 0] = crc >> 8; data0[sector.size() + 1] = crc & 0xff; track[0].add(std::move(data0)); disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Le Necromancien typical track, with gap data conflicting with EDSK multiple copies extension { static constexpr uint8_t ids[]{ 1,1,6,2,7,3,8,4,9,5 }; Track track(arraysize(ids)); for (i = 0; i < 10; ++i) { Header header((i == 1)? 1 : cylhead.cyl, (i == 1)? 4 : cylhead.head, ids[i], i? 2 : 1); Sector sector(DataRate::_250K, Encoding::MFM, header); if (i == 0) sector.add(Data(512, 0xf7), true); if (i == 1) sector.add(Data(sector.size(), i), false, 0xf8); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Defenders of the Earth (+3) { Track track(10); for (i = 0; i < 10; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(206, 201, 196, 191)); sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // World Games (CPC) { Track track(9); for (i = 0; i < 9; ++i) { Header header(cylhead, (i == 8)? 121 : 129 + i, (i == 8)? 0 : 2); Sector sector(DataRate::_250K, Encoding::MFM, header); if (i == 8) sector.add(Data()); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // SP6 { Track track(9); for (i = 0; i < 9; ++i) { Header header(cylhead, 1 + i, (i == 8)? 0 : 2); Sector sector(DataRate::_250K, Encoding::MFM, header); if (i == 7) sector.header = Header(203, 253, 188, 221); if (i == 7 || i == 8) sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Tomahawk (track 3) { Track track(9); for (i = 0; i < 9; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(0, 0, 0, 2)); sector.add(Data(sector.size(), i), false, 0xf8); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // 8K sector { Track track(1); Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 193, 6)); sector.add(Data(sector.size(), i), true, 0xf8); track.add(std::move(sector)); disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Logo Professor (overformatted track, with offsets) { Track track(10); track.tracklen = 6250 * 16; for (i = 0; i < 10; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 2 + i, 2)); sector.offset = (TRACK_OVERHEAD_MFM + (SECTOR_OVERHEAD_MFM + 512 + 25) * (i + 1)) * 16; track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Edd the Duck (track 7) { static constexpr uint8_t ids[]{ 193,65,70,66,71,67,72,68,73,69,74 }; Track track(arraysize(ids)); for (auto id : ids) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, id, (id == 193)? 6 : 2)); if (id == 193) sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Alternative for KBI-10 weak sector { static constexpr uint8_t ids[]{ 193,198,194,199,202,195,200,196,201,197,202 }; Track track(arraysize(ids)); for (auto id : ids) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, id, (id == 202)? 1 : 2)); if (id == 202) sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } std::string sig{ "KBI" }; Data data3(512, 0); std::copy(sig.begin(), sig.end(), data3.begin()); track[3].add(std::move(data3)); disk->write(cylhead.next_cyl(), std::move(complete(track))); } // KBI-19: CPC Titan (cyl 14) and Mach 3 (cyl 40) { static constexpr uint8_t ids[]{ 0,1,4,7,10,13,16,2,5,8,11,14,17,3,6,9,12,15,18 }; Track track(arraysize(ids)); for (auto id : ids) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, id, 2)); track.add(std::move(sector)); } auto trackdata = GenerateKBI19Track(cylhead.next_cyl(), complete(track)); disk->write(std::move(trackdata)); } // CAL2BOOT.DMK (track 9) { static constexpr uint8_t ids[]{ 1,8,17,9,18 }; Track track(arraysize(ids)); for (auto id : ids) { Header header(39, cylhead.head, id, 2); if (id == 1) header = Header(20, 0, id, 3); Sector sector(DataRate::_250K, Encoding::MFM, header); if (id == 1 || id == 18) sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Prehistoric 2 (track 30) { static constexpr uint8_t ids[]{ 1,193,2,194,3,195,4,196,5,197,6,198,7,199 }; Track track(arraysize(ids)); for (auto id : ids) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, id, 2)); if (id <= 7) sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Tetris { Track track(16); for (i = 0; i < 16; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(i, i, i, i)); if (i > 0) sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Terre et Conquerants { Track track(30); for (i = 0; i < 30; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, i, (i == 29)? 2 : 5)); if (i!= 29) sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // 19 x 256-byte sectors { Track track(19); for (i = 0; i < 19; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, 1)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Opera Soft 32K sector { Track track(9); for (i = 0; i < 9; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, i, (i == 8)? 8 : 1)); if (i == 8) sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Sports Hero + Mugsy (+3) { static constexpr uint8_t ids[]{ 7,14,3,10,17,6,13,2,9,16,5,12,1,8,15,4,11,0 }; Track track(arraysize(ids)); for (auto id : ids) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, id, (id == 7)? 0 : 1)); if (id == 7 || id == 9) sector.add(Data(sector.size(), i), true); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Mirage (5*1024 + 1*512) { Track track(6); for (i = 0; i < 6; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, (i < 5)? 3 : 2)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Prophet 2000 (5*1024 + 1*256) { Track track(6); for (i = 0; i < 6; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, i, (i < 5)? 3 : 1)); if (i == 3 || i == 4) sector.add(Data(sector.size(), i), false, 0xf8); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Lemmings (SAM) { Track track(6); for (i = 0; i < 6; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, (i == 0)? 2 : 3)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // Puffy's Saga (CPC) { Track track(4); for (i = 0; i < 4; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 65 + i, (i == 0)? 2 : (i == 1)? 3 : 4)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // 32 x 128-byte sectors { Track track(32); for (i = 0; i < 32; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, 0)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } #if 1 // Some HP disks described on cctalk { Track track(18); for (i = 0; i < 18; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, i, (i == 17)? 0 : 1)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } #endif break; } // 1Mbps examples case 3: { disk->metadata["comment"] = "1Mbps examples"; // Normal ED format { Track track(36); for (i = 0; i < 36; ++i) { Sector sector(DataRate::_1M, Encoding::MFM, Header(cylhead, 1 + i, 2)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // 130 x 128-byte sectors { Track track(130); for (i = 0; i < 130; ++i) { Sector sector(DataRate::_1M, Encoding::MFM, Header(cylhead, 1 + i, 0)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } // GPT (Siemens) exchange format { Track track(20); for (i = 0; i < 20; ++i) { Sector sector(DataRate::_1M, Encoding::MFM, Header(cylhead, i, 3)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } break; } // 500Kbps MFM sector size test case 4 + 0: { disk->metadata["comment"] = "500Kbps MFM sector size test"; // MFM sizes 0 to 6 for (uint8_t size = 0; size < 7; ++size) { Track track(7 - size); for (i = 0; i < 7 - size; ++i) { Sector sector(DataRate::_500K, Encoding::MFM, Header(cylhead, 1 + i, size)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } break; } // 500Kbps FM simple size test case 8 + 0: { disk->metadata["comment"] = "500Kbps FM sector size test"; // FM sizes 0 to 5 for (uint8_t size = 0; size < 6; ++size) { Track track(6 - size); for (i = 0; i < 6 - size; ++i) { Sector sector(DataRate::_500K, Encoding::FM, Header(cylhead, 1 + i, size)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } break; } // 250Kbps MFM sector size test case 4 + 2: { disk->metadata["comment"] = "250Kbps MFM sector size test"; // MFM sizes 0 to 5 for (uint8_t size = 0; size < 6; ++size) { Track track(6 - size); for (i = 0; i < 6 - size; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, size)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } break; } // 250Kbps FM sector size test case 8 + 2: { disk->metadata["comment"] = "250Kbps FM sector size test"; // FM sizes 0 to 4 for (uint8_t size = 0; size < 5; ++size) { Track track(5 - size); for (i = 0; i < 5 - size; ++i) { Sector sector(DataRate::_250K, Encoding::FM, Header(cylhead, 1 + i, size)); track.add(std::move(sector)); } disk->write(cylhead.next_cyl(), std::move(complete(track))); } break; } // 500Kbps MFM bitstream case 16 + 0: { disk->metadata["comment"] = "500Kbps MFM bitstream"; BitstreamTrackBuilder bitbuf(DataRate::_500K, Encoding::MFM); bitbuf.addTrackStart(); for (i = 0; i < 18; i++) { const Data data(512, static_cast<uint8_t>(i)); bitbuf.addSector(Header(cylhead, i + 1, 2), data, 0x54); } disk->write(cylhead.next_cyl(), std::move(bitbuf.buffer())); break; } // 250Kbps MFM bitstream case 16 + 2: { disk->metadata["comment"] = "250Kbps MFM bitstream"; // Simple 9-sector format. { BitstreamTrackBuilder bitbuf(DataRate::_250K, Encoding::MFM); bitbuf.addTrackStart(); for (i = 0; i < 9; i++) { const Data data(512, static_cast<uint8_t>(i)); bitbuf.addSector(Header(cylhead, i + 1, 2), data, 0x54); } disk->write(cylhead.next_cyl(), std::move(bitbuf.buffer())); } // Empty track. { disk->write(GenerateEmptyTrack(cylhead.next_cyl(), Track())); } // KBI-19 format. { static constexpr uint8_t ids[]{ 0,1,4,7,10,13,16,2,5,8,11,14,17,3,6,9,12,15,18 }; Track track(arraysize(ids)); // Create a template that passes the IsKBI19Track check. for (auto &id : ids) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, id, 2)); track.add(std::move(sector)); } // Generate the full track from it. disk->write(GenerateKBI19Track(cylhead.next_cyl(), complete(track))); } // OperaSoft format with 32K sector. { Track track(9); // Create a template that passes the IsOperaSoftTrack check. for (i = 0; i < 9; ++i) { Header header(cylhead, i, (i == 8)? 8 : 1); Sector sector(DataRate::_250K, Encoding::MFM, header); track.add(std::move(sector)); } // Generate the full track from it. disk->write(GenerateOperaSoftTrack(cylhead.next_cyl(), complete(track))); } break; } // 250Kbps FM bitstream case 20 + 2: { disk->metadata["comment"] = "250Kbps FM bitstream"; BitstreamTrackBuilder bitbuf(DataRate::_250K, Encoding::FM); bitbuf.addTrackStart(); for (i = 0; i < 8; i++) { const Data data(256, static_cast<uint8_t>(i)); bitbuf.addSector(Header(cylhead, i + 1, 1), data, 0x4e); } disk->write(cylhead.next_cyl(), std::move(bitbuf.buffer())); break; } // 500Kbps MFM flux case 24 + 0: { disk->metadata["comment"] = "500Kbps MFM flux"; const Data data(512, 0x00); FluxTrackBuilder fluxbuf(cylhead, DataRate::_500K, Encoding::MFM); fluxbuf.addTrackStart(); for (i = 0; i < 18; i++) fluxbuf.addSector(Header(cylhead, i + 1, 2), data, 0x54); disk->write(cylhead.next_cyl(), FluxData{std::move(fluxbuf.buffer())}, true); break; } // 250Kbps MFM flux case 24 + 2: { disk->metadata["comment"] = "250Kbps MFM flux"; // Simple 9-sector format. { const Data data(512, 0x00); FluxTrackBuilder fluxbuf(cylhead, DataRate::_250K, Encoding::MFM); fluxbuf.addTrackStart(); for (i = 0; i < 9; i++) fluxbuf.addSector(Header(cylhead, i + 1, 2), data, 0x54); disk->write(cylhead.next_cyl(), FluxData{std::move(fluxbuf.buffer())}, true); } // Spectrum +3 Speedlock weak sectors (full and part). { Track track(9); for (i = 0; i < 9; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 1 + i, 2)); if (i >= 2 && i <= 7) sector.add(Data(sector.size(), i), false, 0xf8); track.add(std::move(sector)); } // Add Speedlock signature to first sector Data data0(512, 0); std::string sig{ "SPEEDLOCK" }; std::copy(sig.begin(), sig.end(), data0.begin() + 304); track[0].add(Data(data0)); complete(track); // Full weak sector. track[1].remove_data(); Data weak_data(512); iota(weak_data, 0); track[1].add(Data(weak_data), true); auto trackdata = GenerateSpectrumSpeedlockTrack(cylhead.next_cyl(), track, 0, 512); disk->write(trackdata.cylhead, FluxData(trackdata.flux()), true); // Part weak sector. track[1].remove_data(); fill(weak_data, 0, 256, 0xe5); iota(weak_data, 256, 1); fill(weak_data, 256 + 32, 256 + 32 + 48, 2); track[1].add(Data(weak_data), true); trackdata = GenerateSpectrumSpeedlockTrack(cylhead.next_cyl(), track, 336, 32); disk->write(trackdata.cylhead, FluxData(trackdata.flux()), true); } // Amstrad CPC Speedlock weak sectors (full, half, and part). { Track track(9); for (i = 0; i < 9; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 64 + i, 2)); track.add(std::move(sector)); } // Add Speedlock signature to first sector Data data0(512, 0); const std::string sig{ "SPEEDLOCK" }; std::copy(sig.begin(), sig.end(), data0.begin() + 257); track[0].add(std::move(data0)); complete(track); // Full weak sector. track[7].remove_data(); Data weak_data(512); iota(weak_data, 0); track[7].add(Data(weak_data), true); auto trackdata = GenerateCpcSpeedlockTrack(cylhead.next_cyl(), track, 0, 512); disk->write(trackdata.cylhead, FluxData(trackdata.flux()), true); // Half weak sector. track[0].datas()[0][129] = 'S'; track[7].remove_data(); fill(weak_data, 0, 256, 0xe5); iota(weak_data, 256, 1); track[7].add(Data(weak_data), true); trackdata = GenerateCpcSpeedlockTrack(cylhead.next_cyl(), track, 256, 256); disk->write(trackdata.cylhead, FluxData(trackdata.flux()), true); // Part weak sector. track[0].datas()[0][129] = 0; track[7].remove_data(); fill(weak_data, 0, 256, 0xe5); iota(weak_data, 256, 1); fill(weak_data, 256 + 32, 256 + 32 + 48, 2); track[7].add(Data(weak_data), true); trackdata = GenerateCpcSpeedlockTrack(cylhead.next_cyl(), track, 336, 32); disk->write(trackdata.cylhead, FluxData(trackdata.flux()), true); } // Rainbow Arts weak sector. { static constexpr uint8_t ids[]{ 193,198,194,109,195,200,196,201,197 }; Track track(arraysize(ids)); for (auto id : ids) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, id, 2)); track.add(std::move(sector)); } // Data error for weak sector. Data data1(512, 0); track[1].add(std::move(data1), true); // Add signature to 4th sector Data data3(512, 0); const std::string sig{ "\x2a\x6d\xa7\x01\x30\x01\xaf\xed\x42\x4d\x44\x21\x70\x01" }; std::copy(sig.begin(), sig.end(), data3.begin()); track[3].add(std::move(data3)); disk->write(GenerateRainbowArtsTrack(cylhead.next_cyl(), complete(track), 100, 256)); } // KBI-10 weak sector. { static constexpr uint8_t ids[]{ 193,198,194,199,195,200,196,201,197,202 }; Track track(arraysize(ids)); for (auto id : ids) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, id, (id == 202)? 1 : 2)); track.add(std::move(sector)); } // Signature and data error for weak sector. Data data9(256, 0); const std::string sig{ "KBI" }; std::copy(sig.begin(), sig.end(), data9.begin()); track[9].add(std::move(data9), true); disk->write(GenerateKBIWeakSectorTrack(cylhead.next_cyl(), complete(track), 4, 4)); } // Logo Professor (overformatted track). { Track track(10); track.tracklen = 6250 * 16; for (i = 0; i < 10; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 2 + i, 2)); sector.offset = (TRACK_OVERHEAD_MFM + (SECTOR_OVERHEAD_MFM + 512 + 25) * (i + 1)) * 16; track.add(std::move(sector)); } disk->write(GenerateLogoProfTrack(cylhead.next_cyl(), complete(track))); } // Sega System 24 (0x2f00 size) { static constexpr uint8_t sizes[]{ 4,4,4,4,4,3,1 }; Track track(arraysize(sizes)); for (i = 0; i < arraysize(sizes); ++i) { Sector sector(DataRate::_500K, Encoding::MFM, Header(cylhead, 1 + i, sizes[i])); track.add(std::move(sector)); } disk->write(GenerateSystem24Track(cylhead.next_cyl(), complete(track))); } // 8K sector track. { Track track(1); Sector sector(DataRate::_250K, Encoding::MFM, Header(cylhead, 193, 6)); sector.add(Data(sector.size(), i), true, 0xf8); track.add(std::move(sector)); disk->write(Generate8KSectorTrack(cylhead.next_cyl(), complete(track))); } break; } // 250Kbps FM flux case 28 + 2: { disk->metadata["comment"] = "250Kbps FM flux"; const Data data(256, 0x00); FluxTrackBuilder fluxbuf(cylhead, DataRate::_250K, Encoding::FM); fluxbuf.addTrackStart(); for (i = 0; i < 8; i++) fluxbuf.addSector(Header(cylhead, i + 1, 1), data, 0x4e); disk->write(cylhead.next_cyl(), FluxData{std::move(fluxbuf.buffer())}, true); break; } // 500Kbps Amiga bitstream case 32 + 0: { disk->metadata["comment"] = "500Kbps Amiga bitstream"; const Data data(512, 0x00); BitstreamTrackBuilder bitbuf(DataRate::_500K, Encoding::Amiga); bitbuf.addTrackStart(); for (i = 0; i < 22; i++) bitbuf.addSector(Header(cylhead, i, 2), data); disk->write(cylhead.next_cyl(), std::move(bitbuf.buffer())); break; } // 250Kbps bitstreams case 32 + 2: { disk->metadata["comment"] = "250Kbps bitstreams"; // AmigaDOS { BitstreamTrackBuilder bitbuf(DataRate::_250K, Encoding::Amiga); bitbuf.addTrackStart(); for (i = 0; i < 11; i++) { const Data data(512, static_cast<uint8_t>(i)); bitbuf.addSector(Header(cylhead, i, 2), data); } disk->write(cylhead.next_cyl(), std::move(bitbuf.buffer())); } // RX02 { BitstreamTrackBuilder bitbuf(DataRate::_250K, Encoding::RX02); bitbuf.addTrackStart(); for (i = 0; i < 26; i++) { const Data data(256, static_cast<uint8_t>(i)); bitbuf.addSector(Header(cylhead, i + 1, 0), data, 0x38); } disk->write(cylhead.next_cyl(), std::move(bitbuf.buffer())); } break; } default: throw util::exception("unknown built-in type"); } // Append a blank track disk->write(cylhead, Track()); disk->strType = "<builtin>"; return true; } bool WriteBuiltIn (const std::string &path, std::shared_ptr<Disk> &/*disk*/) { if (!IsBuiltIn(path)) return false; throw util::exception("built-in disks are read-only"); } ======================= File: src/cmd_scan.cpp ======================= // Scan command #include "SAMdisk.h" #include "IBMPC.h" #include "DiskUtil.h" void ScanTrack (const CylHead &cylhead, const Track &track, ScanContext &context) { // Reset the context if the cylinder is before the last (such as at a head change) if (cylhead.cyl < context.last_cylhead.cyl) context = ScanContext(); context.last_cylhead = cylhead; // Process only non-blank tracks if (!track.empty()) { // Have we warned about possible incompatible disks? // Example disk: Anaconda (TR-DOS) if (!context.warned && track.tracklen && track[0].encoding == Encoding::MFM) { auto &first_sector = *(track.begin()); auto &last_sector = *(track.rbegin()); // Calculate the offset needed to hide a 256-byte sector using the current encoding and // data rate. If the first sector offset exceeds that then there could be a problem. auto min_offset_bits = (Sector::SizeCodeToLength(1) + GetSectorOverhead(first_sector.encoding)) * 16; // Calculate the gap between the end of final sector and the start of the first sector auto data_end_bits = last_sector.offset + (GetSectorOverhead(last_sector.encoding) + last_sector.size() * 16); auto wrap_start_bits = track.tracklen + first_sector.offset; // If the gap before the first visible sector is suspiciously large, and the wrapping // gap is large enough to hide a 256-byte sector, warn the user if (first_sector.offset > min_offset_bits && (data_end_bits + min_offset_bits) < wrap_start_bits) { Message(msgWarning, "late track start on %s may indicate missing first sector", cylhead.to_string().c_str()); context.warned = true; } } Sector typical = GetTypicalSector(cylhead, track, context.sector); bool custom_cyl = cylhead.cyl!= typical.header.cyl; bool custom_head = cylhead.head!= typical.header.head; // If the encoding, rate or size have changed, show the track settings if (typical.datarate!= context.sector.datarate || typical.encoding!= context.sector.encoding || (typical.header.cyl!= context.sector.header.cyl && custom_cyl) || (typical.header.head!= context.sector.header.head && custom_head) || typical.header.size!= context.sector.header.size || typical.gap3!= context.gap3 || track.size()!= context.sectors || custom_cyl!= context.custom_cyl || custom_head!= context.custom_head) { util::cout << util::fmt("%s %s, %2u sector%s, %4u bytes%s", to_string(typical.datarate).c_str(), to_string(typical.encoding).c_str(), track.size(), (track.size() == 1)? "" : "s", typical.size(), (track.size() == 1)? "" : "/sector"); if (custom_cyl && typical.header.cyl!= cylhead.cyl) util::cout << ", c=" << CylStr(typical.header.cyl); if (custom_head && typical.header.head!= cylhead.head) util::cout << ", h=" << HeadStr(typical.header.head); if (typical.header.size!= Sector::SizeCodeToRealSizeCode(typical.header.size)) util::cout << ", n=" << SizeStr(typical.header.size); if (typical.gap3!= 0) util::cout << ", gap3=" << ByteStr(typical.gap3); util::cout << ":\n"; } context.sector = typical; context.sectors = track.size(); context.gap3 = typical.gap3; context.custom_cyl = custom_cyl; context.custom_head = custom_head; } auto flags = 0; if (opt.offsets == 1) flags |= DUMP_OFFSETS; if (!opt.nodiff) flags |= DUMP_DIFF; DumpTrack(cylhead, track, context, flags); } bool ScanImage (const std::string &path, Range range) { util::cout << '[' << path << "]\n"; util::cout.screen->flush(); auto disk = std::make_shared<Disk>(); if (ReadImage(path, disk)) { Format &fmt = disk->fmt; // Regular format and no range specified? if (!opt.verbose && range.empty() && fmt.sectors > 0) { util::cout << util::fmt("%s %s, %2u cyls, %u heads, %2u sectors, %4u bytes/sector\n", to_string(fmt.datarate).c_str(), to_string(fmt.encoding).c_str(), disk->cyls(), disk->heads(), fmt.sectors, fmt.sector_size()); std::stringstream ss; if (fmt.base!= 1) { ss << util::fmt(" Base=%u", fmt.base); } if (fmt.offset) { ss << util::fmt(" Offset=%u", fmt.offset); } if (fmt.skew) { ss << util::fmt(" Skew=%u", fmt.skew); } if (fmt.interleave > 1) { ss << util::fmt(" Interleave=%u:1", fmt.interleave); } if (fmt.head0!= 0) { ss << util::fmt(" Head0=%u", fmt.head0); } if (fmt.head1!= 1) { ss << util::fmt(" Head1=%u", fmt.head1); } if (fmt.gap3) { ss << util::fmt(" Gap3=%u", fmt.gap3); } auto str = ss.str(); if (!str.empty()) util::cout << str << "\n"; } else { ValidateRange(range, MAX_TRACKS, MAX_SIDES, opt.step, disk->cyls(), disk->heads()); util::cout << range << ":\n"; disk->preload(range, opt.step); ScanContext context; range.each([&] (const CylHead cylhead) { if (cylhead.cyl == range.cyl_begin) context = ScanContext(); auto track = disk->read_track(cylhead * opt.step); NormaliseTrack(cylhead, track); ScanTrack(cylhead, track, context); }, true); } } return true; } ======================= File: src/types/dfi.cpp ======================= <reponame>PeterBortas/samdisk // DiscFerret: // http://www.discferret.com/wiki/DFI_image_format #include "SAMdisk.h" #include "DemandDisk.h" #include "BitstreamDecoder.h" typedef struct { char signature[4]; // "DFE2" for new-style or "DFER" for (unsupported) old-style } DFI_FILE_HEADER; typedef struct { // Note: all values are big-endian uint16_t cyl; // physical cylinder uint16_t head; // physical head uint16_t sector; // physical sector (hard-sectored disks only) uint8_t datalen[4]; // data length, as bytes due to struct alignment } DFI_TRACK_HEADER; class DFIDisk final : public DemandDisk { public: void add_track_data (const CylHead &cylhead, Data &&data) { // Determine image clock rate if not yet known. It seems reasonable // to assume this will not vary between tracks. if (!m_tick_ns) { uint32_t index_pos = 0; for (auto byte : data) { index_pos += (byte & 0x7f); if (byte & 0x80) break; } // Oddly, the clock frequency isn't stored in the image, so guess it. for (auto mhz = 25;!m_tick_ns && mhz <= 100; mhz *= 2) { auto rpm = 60'000'000ULL * mhz / index_pos; if (rpm >= 285 && rpm <= 380) m_tick_ns = 1000 / mhz; } // Fail if we couldn't determine the clock rate if (!m_tick_ns) throw util::exception("failed to determine DFI clock frequency"); } m_data[cylhead] = std::move(data); extend(cylhead); } protected: TrackData load (const CylHead &cylhead, bool /*first_read*/) override { const auto &data = m_data[cylhead]; if (data.empty()) return TrackData(cylhead); FluxData flux_revs; std::vector<uint32_t> flux_times; flux_times.reserve(data.size()); uint32_t total_time = 0; for (auto byte : data) { if (byte & 0x80) { flux_revs.push_back(std::move(flux_times)); flux_times.clear(); flux_times.reserve(data.size()); } else { total_time += byte; if (byte!= 0x7f) { flux_times.push_back(total_time * m_tick_ns); total_time = 0; } } } if (!flux_times.empty()) flux_revs.push_back(std::move(flux_times)); m_data.erase(cylhead); return TrackData(cylhead, std::move(flux_revs)); } private: std::map<CylHead, Data> m_data {}; uint32_t m_tick_ns = 0; }; bool ReadDFI (MemFile &file, std::shared_ptr<Disk> &disk) { DFI_FILE_HEADER fh {}; if (!file.rewind() ||!file.read(&fh, sizeof(fh))) return false; if (!memcmp(fh.signature, "DFER", sizeof(fh.signature))) throw util::exception("old-style DiscFerret images are not supported"); else if (memcmp(fh.signature, "DFE2", sizeof(fh.signature))) return false; auto dfi_disk = std::make_shared<DFIDisk>(); for (;;) { DFI_TRACK_HEADER th; if (!file.read(&th, sizeof(th))) break; if (util::betoh(th.sector)!= 1) throw util::exception("hard-sectored images are not supported"); CylHead cylhead(util::betoh(th.cyl), util::betoh(th.head)); auto data_length = (static_cast<uint32_t>(th.datalen[0]) << 24) | (th.datalen[1] << 16) | (th.datalen[2] << 8) | th.datalen[3]; Data track_data(data_length); if (!file.read(track_data)) throw util::exception("short file reading ", cylhead, " data"); dfi_disk->add_track_data(cylhead, std::move(track_data)); } dfi_disk->strType = "DFI"; disk = dfi_disk; return true; } ======================= File: src/KF_libusb.cpp ======================= // libusb backend for KryoFlux device #include "SAMdisk.h" #include "KF_libusb.h" #ifdef HAVE_LIBUSB1 /*static*/ std::unique_ptr<KryoFlux> KF_libusb::Open () { libusb_context *ctx = nullptr; bool claimed = false; auto ret = libusb_init(&ctx); if (ret == LIBUSB_SUCCESS) { libusb_device *dev{nullptr}; libusb_device **dev_list{nullptr}; auto num_devices = libusb_get_device_list(ctx, &dev_list); ssize_t i; for (i = 0; i < num_devices; ++i) { libusb_device_descriptor desc{}; ret = libusb_get_device_descriptor(dev_list[i], &desc); if (ret == LIBUSB_SUCCESS) { if (desc.idVendor == KF_VID && desc.idProduct == KF_PID) { dev = dev_list[i]; break; } } } libusb_device_handle *hdev{nullptr}; if (dev) ret = libusb_open(dev, &hdev); if (dev_list) libusb_free_device_list(dev_list, 1); if (hdev) { libusb_set_auto_detach_kernel_driver(hdev, 1); if (ret == LIBUSB_SUCCESS) { ret = libusb_claim_interface(hdev, KF_INTERFACE); claimed = (ret == LIBUSB_SUCCESS); } if (ret == LIBUSB_SUCCESS) return std::make_unique<KF_libusb>(ctx, hdev); if (claimed) libusb_release_interface(hdev, KF_INTERFACE); libusb_close(hdev); } libusb_exit(ctx); } if (ret == LIBUSB_ERROR_ACCESS) throw util::exception(util::format("(open) ", libusb_error_name(ret), " (need root?)")); else if (ret!= LIBUSB_SUCCESS) throw util::exception(util::format("(open) ", libusb_error_name(ret))); return std::unique_ptr<KryoFlux>(); } KF_libusb::KF_libusb ( libusb_context *ctx, libusb_device_handle *hdev) : m_ctx(ctx), m_hdev(hdev) { } KF_libusb::~KF_libusb () { libusb_release_interface(m_hdev, KF_INTERFACE); libusb_close(m_hdev); libusb_exit(m_ctx); } std::string KF_libusb::GetProductName () { auto dev = libusb_get_device(m_hdev); libusb_device_descriptor devdesc {}; libusb_get_device_descriptor(dev, &devdesc); uint8_t product[256] {}; libusb_get_string_descriptor_ascii( m_hdev, devdesc.iProduct, product, sizeof(product) - 1); return std::string(reinterpret_cast<char *>(product)); } std::string KF_libusb::Control (int req, int index, int value) { uint8_t buf[256]; auto ret = libusb_control_transfer( m_hdev, LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_OTHER, static_cast<uint8_t>(req), 0, static_cast<uint16_t>(index), buf, sizeof(buf), KF_TIMEOUT_MS); if (ret < 0) throw util::exception(util::format("(control) ", libusb_error_name(ret))); return std::string(reinterpret_cast<char *>(buf), ret); } int KF_libusb::Read (void *buf, int len) { auto read = 0; auto ret = libusb_bulk_transfer( m_hdev, KF_EP_BULK_IN, reinterpret_cast<uint8_t *>(buf), len, &read, KF_TIMEOUT_MS); if (ret!= LIBUSB_SUCCESS) throw util::exception(util::format("(read) ", libusb_error_name(ret))); return read; } int KF_libusb::Write (const void *buf, int len) { auto written = 0; auto ret = libusb_bulk_transfer( m_hdev, KF_EP_BULK_OUT, reinterpret_cast<uint8_t *>(const_cast<void *>(buf)), len, &written, KF_TIMEOUT_MS); if (ret!= LIBUSB_SUCCESS) throw util::exception(util::format("(write) ", libusb_error_name(ret))); return written; } static void read_callback (libusb_transfer *xfer) { auto pobj = reinterpret_cast<KF_libusb*>(xfer->user_data); pobj->ReadCallback(xfer); } void KF_libusb::ReadCallback (libusb_transfer *xfer) { if (xfer->status!= LIBUSB_TRANSFER_COMPLETED) { m_readret = xfer->status; return; } std::lock_guard<std::mutex> lock(m_readmutex); m_readbuf.insert( m_readbuf.end(), reinterpret_cast<const uint8_t*>(xfer->buffer), reinterpret_cast<const uint8_t*>(xfer->buffer) + xfer->actual_length); if (m_reading) m_readret = libusb_submit_transfer(xfer); } void KF_libusb::StartAsyncRead() { if (m_reading) return; m_readbuf.clear(); m_xferpool.resize(m_bufpool.size()); int i = 0; for (auto &xfer : m_xferpool) { xfer = libusb_alloc_transfer(0); libusb_fill_bulk_transfer( xfer, m_hdev, KF_EP_BULK_IN, m_bufpool[i++].data(), m_bufpool[0].size(), read_callback, this, KF_TIMEOUT_MS); } for (auto &xfer : m_xferpool) { auto ret = libusb_submit_transfer(xfer); if (ret!= LIBUSB_SUCCESS) throw util::exception(util::format("(submit) ", libusb_error_name(ret))); } m_reading = true; } void KF_libusb::StopAsyncRead() { if (!m_reading) return; std::lock_guard<std::mutex> lock(m_readmutex); m_reading = false; for (auto &xfer : m_xferpool) { if (xfer) libusb_cancel_transfer(xfer); } m_xferpool.clear(); } int KF_libusb::ReadAsync (void *buf, int len) { struct timeval tv{KF_TIMEOUT_MS / 1000, (KF_TIMEOUT_MS % 1000) * 1000}; auto ret = libusb_handle_events_timeout(m_ctx, &tv); if (ret == LIBUSB_SUCCESS || ret == LIBUSB_ERROR_INTERRUPTED) ret = m_readret; if (ret!= LIBUSB_SUCCESS) throw util::exception(util::format("(events) ", libusb_error_name(ret))); std::lock_guard<std::mutex> lock(m_readmutex); len = std::min(len, static_cast<int>(m_readbuf.size())); std::memcpy(buf, m_readbuf.data(), len); m_readbuf.erase(m_readbuf.begin(), m_readbuf.begin() + len); return len; } #endif // HAVE_LIBUSB1 ======================= File: src/Image.cpp ======================= <reponame>PeterBortas/samdisk // High-level disk image/device reading and writing #include "SAMdisk.h" #include "record.h" #include "SpectrumPlus3.h" #include "types.h" #include "BlockDevice.h" bool UnwrapSDF (std::shared_ptr<Disk> &src_disk, std::shared_ptr<Disk> &disk); bool ReadUnsupp (MemFile &file, std::shared_ptr<Disk> &disk); bool ReadImage (const std::string &path, std::shared_ptr<Disk> &disk, bool normalise) { MemFile file; bool f = false; if (path.empty()) throw util::exception("invalid empty path"); // Try devices first as the path may use a custom syntax for (auto p = aDeviceTypes;!f && p->pszType; ++p) { if (p->pfnRead) f = p->pfnRead(path, disk); } if (!f && IsDir(path)) throw util::exception("path is a directory"); // Next try regular files (and archives) if (!f) { if (!file.open(path,!opt.nozip)) return false; // Present the image to all types with read support for (auto p = aImageTypes;!f && p->pszType; ++p) { if (p->pfnRead) f = p->pfnRead(file, disk); } // Store the archive type the image was found in, if any if (f) { if (file.compression()!= Compress::None) disk->metadata["archive"] = to_string(file.compression()); if (file.path().rfind(file.name()) + file.name().size()!= file.path().size()) disk->metadata["filename"] = file.name(); } } #if 0 // Unwrap any sub-containers if (!f) f = UnwrapSDF(olddisk, disk); // MakeSDF image if (!f) f = UnwrapCPM(olddisk, disk); // BDOS CP/M record format #endif if (!f) throw util::exception("unrecognised disk image format"); if (normalise) { // ToDo: Make resize and flip optional? replace fNormalise) and fLoadFilter_? #if 0 // breaks with sub-ranges if (!opt.range.empty()) disk->resize(opt.range.cyls(), opt.range.heads()); #endif // Forcibly correct +3 boot loader problems? if (opt.fix == 1) FixPlus3BootLoader(disk); if (opt.flip) disk->flip_sides(); } #if 0 auto cyls = disk->cyls(), heads = disk->heads(); for (uint8_t head = 0; head < heads; ++head) { // Determine any forced head value for sectors on this track (-1 for none) int nHeadVal = head? opt.head1 : opt.head0; // If nothing forced and we're using a regular format, use its head values if (nHeadVal == -1 && olddisk->format.sectors) nHeadVal = head? olddisk->format.head1 : olddisk->format.head0; for (uint8_t cyl = 0; cyl < cyls; ++cyl) { PTRACK pt = disk->GetTrack(cyl, head); // Optionally normalise the track, to allow'scan' to normalise on the fly if (fNormalise_) pt->Normalise(fLoadFilter_); // Forced head? if (nHeadVal!= -1) { for (int i = 0; i < pt->sectors; ++i) pt->sector[i].head = nHeadVal; } } } #endif return f; } bool WriteImage (const std::string &path, std::shared_ptr<Disk> &disk) { bool f = false; #if 0 // TODO: Wrap a CP/M image in a BDOS record container auto cpm_disk = std::make_shared<Disk>(); if (opt.cpm) f = WrapCPM(disk, cpm_disk); #endif // Try devices first as the path may use a custom syntax for (auto p = aDeviceTypes;!f && p->pszType; ++p) { if (p->pfnWrite) f = p->pfnWrite(path, disk); } // Normal image file if (!f) { auto p = aImageTypes; // Find the type matching the output file extension for (; p->pszType; ++p) { // Matching extension with write if (IsFileExt(path, p->pszType)) break; } if (!p->pszType) throw util::exception("unknown output file type"); else if (!p->pfnWrite) throw util::exception(util::format(p->pszType, " is not supported for output")); FILE *file = fopen(path.c_str(), "wb"); if (!file) throw posix_error(errno, path.c_str()); try { // Write the image f = p->pfnWrite(file, disk); if (!f) throw util::exception("output type is unsuitable for source content"); } catch (...) { fclose(file); std::remove(path.c_str()); throw; } fclose(file); } return true; } ======================= File: src/types/2d.cpp ======================= // 2D is a raw format used by PC-88 systems #include "SAMdisk.h" bool Read2D (MemFile &file, std::shared_ptr<Disk> &disk) { Format fmt { RegularFormat::_2D }; if (!IsFileExt(file.name(), "2d") || file.size()!= fmt.disk_size()) return false; file.rewind(); disk->format(fmt, file.data()); disk->strType = "2D"; return true; } bool Write2D (FILE* /*f_*/, std::shared_ptr<Disk> &/*disk*/) { throw std::logic_error("2D writing not implemented"); } ======================= File: src/KryoFlux.cpp ======================= <reponame>PeterBortas/samdisk<gh_stars>1-10 // KryoFlux device base class #include "SAMdisk.h" #include "KryoFlux.h" #ifdef HAVE_LIBUSB1 #include "KF_libusb.h" #endif #ifdef HAVE_WINUSB #include "KF_WinUSB.h" #endif #define MASTER_CLOCK_FREQ (((18432000 * 73) / 14) / 2) // 48054857.14 #define SAMPLE_FREQ (MASTER_CLOCK_FREQ / 2) // 24027428.57 #define INDEX_FREQ (MASTER_CLOCK_FREQ / 16) // 3003428.57 #define PS_PER_TICK(sck) (1000000000 / (sck / 1000)) // 41619.10 const char * KryoFlux::KF_FW_FILE = "firmware_kf_usb_rosalie.bin"; std::unique_ptr<KryoFlux> KryoFlux::Open () { std::unique_ptr<KryoFlux> p; for (auto i = 0; i < 2; ++i) { #ifdef HAVE_LIBUSB1 if (!p) p = KF_libusb::Open(); #endif #ifdef HAVE_WINUSB if (!p) p = KF_WinUsb::Open(); #endif // Missing device or present with firmware loaded? if (!p || p->GetProductName() == "KryoFlux DiskSystem") break; p->UploadFirmware(); p.reset(); std::this_thread::sleep_for(std::chrono::seconds(1)); } return p; } void KryoFlux::UploadFirmware () { // Set interactive then non-interactive mode, to check for boot responses // https://sourceforge.net/p/lejos/wiki-nxt/SAM-BA%20Protocol/ SamBaCommand("T#", ">"); SamBaCommand("N#", "\n\r"); auto fwpath = util::resource_dir() + KF_FW_FILE; std::ifstream fwfile(fwpath, std::ios::binary); if (!fwfile) throw posix_error(errno, fwpath.c_str()); auto fwdata = std::vector<uint8_t>(std::istreambuf_iterator<char>(fwfile), std::istreambuf_iterator<char>()); auto fwsize = static_cast<int>(fwdata.size()); SamBaCommand(util::fmt("S%08lx,%08lx#", KF_FW_LOAD_ADDR, fwsize)); auto offset = 0; while (offset < fwsize) offset += Write(fwdata.data() + offset, fwsize - offset); SamBaCommand(util::fmt("R%08lx,%08lx#", KF_FW_LOAD_ADDR, fwsize)); std::vector<uint8_t> fwverify(fwsize); for (offset = 0; offset < fwsize; ) offset += Read(fwverify.data() + offset, fwsize - offset); if (fwdata!= fwverify) throw util::exception("firmware verification failed"); SamBaCommand(util::fmt("G%08lx#", KF_FW_EXEC_ADDR)); } void KryoFlux::SamBaCommand (const std::string &cmd, const std::string &end) { std::string s; uint8_t buf[512]; try { Write(cmd.c_str(), static_cast<int>(cmd.length())); if (!end.empty()) { for (;;) { auto len = Read(buf, sizeof(buf)); s += std::string(reinterpret_cast<char *>(buf), len); if (s.length() >= end.length() && s.compare(s.length() - end.length(), end.length(), end) == 0) { break; } } } } catch (...) { throw util::exception("firmware upload failed, try resetting device"); } } /*static*/ int KryoFlux::ResponseCode (const std::string &str) { auto pos = str.find_first_of('='); if (pos == std::string::npos) return 0; return std::atoi(str.c_str() + pos + 1); } int KryoFlux::Reset () { return ResponseCode(Control(REQ_RESET)); } int KryoFlux::SelectDevice (int device) { return ResponseCode(Control(REQ_DEVICE, device)); } int KryoFlux::EnableMotor (int enable) { return ResponseCode(Control(REQ_MOTOR, enable)); } int KryoFlux::Seek (int cyl) { return ResponseCode(Control(REQ_TRACK, cyl)); } int KryoFlux::SelectDensity (bool density) { return ResponseCode(Control(REQ_DENSITY, density)); } int KryoFlux::SelectSide (int head) { return ResponseCode(Control(REQ_SIDE, head)); } int KryoFlux::SetMinTrack (int cyl) { return ResponseCode(Control(REQ_MIN_TRACK, cyl)); } int KryoFlux::SetMaxTrack (int cyl) { return ResponseCode(Control(REQ_MAX_TRACK, cyl)); } int KryoFlux::GetInfo (int index, std::string &info) { info = Control(REQ_INFO | REQ_GET, index); auto ret = ResponseCode(info); info.erase(0, info.find(' ') + 1); // remove time code info.erase(0, info.find(' ') + 1); // remove info response return ret; } void KryoFlux::ReadFlux (int revs, FluxData &flux_revs, std::vector<std::string> &warnings) { revs = std::max(1, std::min(revs, 20)); Data track_data; track_data.reserve(1'000'000); Data chunk(0x10000); // Start reading before we ask for the bulk data. StartAsyncRead(); // Start stream, for 1 more index hole than we require revolutions Control(REQ_STREAM, ((revs + 1) << 8) | 0x01); for (;;) { auto len = ReadAsync(chunk.data(), chunk.size()); track_data.insert(track_data.end(), chunk.begin(), chunk.begin() + len); // Check for end marker at end of current packet. // ToDo: parse this properly, due to small risk of false positives. if (len >= 7 &&!memcmp(chunk.data() + len - 7, "\xd\xd\xd\xd\xd\xd\xd", 7)) { // Stop streaming and finish Control(REQ_STREAM, 0); StopAsyncRead(); break; } } // Decode the track data to multiple flux revolutions, plus any warnings flux_revs = DecodeStream(track_data, warnings); } /*static*/ FluxData KryoFlux::DecodeStream (const Data &data, std::vector<std::string> &warnings) { FluxData flux_revs; std::vector<uint32_t> flux_times, flux_counts; flux_times.reserve(data.size()); flux_counts.resize(data.size()); uint32_t time = 0, stream_pos = 0; uint32_t ps_per_tick = PS_PER_TICK(SAMPLE_FREQ); std::vector<uint32_t> index_offsets; auto itBegin = data.begin(), it = itBegin, itEnd = data.end(); while (it!= itEnd) { // Store current flux count at each stream position flux_counts[stream_pos] = static_cast<int>(flux_times.size()); auto type = *it++; switch (type) { case 0x0c: // Flux3 type = *it++; stream_pos++; case 0x00: case 0x01: case 0x02: case 0x03: // Flux 2 case 0x04: case 0x05: case 0x06: case 0x07: time += (static_cast<uint32_t>(type) << 8) | *it++; flux_times.push_back(time * ps_per_tick / 1000); stream_pos += 2; time = 0; break; case 0xa: // Nop3 it++; stream_pos++; case 0x9: // Nop2 it++; stream_pos++; case 0x8: // Nop1 stream_pos++; break; case 0xb: // Ovl16 time += 0x10000; stream_pos++; break; case OOB: // OOB { auto subtype = *it++; uint16_t size = *it++; size |= (*it++ << 8); switch (subtype) { case 0x00: // Invalid warnings.push_back("invalid OOB detected"); it = itEnd; break; case 0x01: // StreamInfo assert(size == 8); break; case 0x02: // Index { assert(size == 12); auto pdw = reinterpret_cast<const uint32_t *>(&*it); index_offsets.push_back(util::letoh(pdw[0])); break; } case 0x03: // StreamEnd { assert(size == 8); auto pdw = reinterpret_cast<const uint32_t *>(&*it); // auto eof_pos = util::letoh(pdw[0]); auto eof_ret = util::letoh(pdw[1]); if (eof_ret == 1) warnings.push_back("stream end (buffering problem)"); else if (eof_ret == 2) warnings.push_back("stream end (no index detected)"); else if (eof_ret!= 0) warnings.push_back(util::fmt("stream end problem (%u)", eof_ret)); break; } case 0x04: // KFInfo { std::string info = reinterpret_cast<const char*>(&*it); for (auto &entry : util::split(info, ',')) { auto pos = entry.find('='); if (pos!= entry.npos) { auto name = util::trim(entry.substr(0, pos)); auto value = util::trim(entry.substr(pos + 1)); if (!name.empty() &&!value.empty()) { // disk.metadata[name] = value; if (name == "sck") ps_per_tick = PS_PER_TICK(std::atoi(value.c_str())); } } } break; } case 0x0d: // EOF assert(size == 0x0d0d); // documented value size = 0; // size is fake, so clear it it = itEnd; // advance to end break; default: warnings.push_back(util::fmt("unexpected OOB sub-type (%X)", subtype)); it = itEnd; break; } it += size; break; } default: // Flux1 time += type; flux_times.push_back(time * ps_per_tick / 1000); stream_pos++; time = 0; break; } } uint32_t last_pos = 0; for (auto index_offset : index_offsets) { // Ignore first partial track if (last_pos!= 0) { // Find the most recent flux count. while (index_offset &&!flux_counts[index_offset]) --index_offset; // Extract flux segment for current revolution flux_revs.emplace_back(std::vector<uint32_t>( flux_times.begin() + last_pos, flux_times.begin() + flux_counts[index_offset])); } last_pos = flux_counts[index_offset]; } if (flux_revs.size() == 0) warnings.push_back("no flux data"); return flux_revs; } ======================= File: src/Sector.cpp ======================= <filename>src/Sector.cpp #include "SAMdisk.h" #include "Sector.h" Sector::Sector (DataRate datarate_, Encoding encoding_, const Header &header_, int gap3_) : header(header_), datarate(datarate_), encoding(encoding_), gap3(gap3_) { } bool Sector::operator== (const Sector &sector) const { // Headers must match if (sector.header!= header) return false; // If neither has data it's a match if (sector.m_data.size() == 0 && m_data.size() == 0) return true; // Both sectors must have some data if (sector.copies() == 0 || copies() == 0) return false; // Both first sectors must have at least the natural size to compare if (sector.data_size() < sector.size() || data_size() < size()) return false; // The natural data contents must match return std::equal(data_copy().begin(), data_copy().begin() + size(), sector.data_copy().begin()); } int Sector::size () const { return header.sector_size(); } int Sector::data_size () const { return copies()? static_cast<int>(m_data[0].size()) : 0; } const DataList &Sector::datas () const { return m_data; } DataList &Sector::datas () { return m_data; } const Data &Sector::data_copy (int copy/*=0*/) const { copy = std::max(std::min(copy, static_cast<int>(m_data.size()) - 1), 0); return m_data[copy]; } Data &Sector::data_copy (int copy/*=0*/) { assert(m_data.size()!= 0); copy = std::max(std::min(copy, static_cast<int>(m_data.size()) - 1), 0); return m_data[copy]; } int Sector::copies () const { return static_cast<int>(m_data.size()); } Sector::Merge Sector::add (Data &&new_data, bool bad_crc, uint8_t new_dam) { Merge ret = Merge::NewData; // If the sector has a bad header CRC, it can't have any data if (has_badidcrc()) return Merge::Unchanged; #ifdef _DEBUG // If there's enough data, check the CRC if ((encoding == Encoding::MFM || encoding == Encoding::FM) && static_cast<int>(new_data.size()) >= (size() + 2)) { CRC16 crc; if (encoding == Encoding::MFM) crc.init(CRC16::A1A1A1); crc.add(new_dam); auto bad_data_crc = crc.add(new_data.data(), size() + 2)!= 0; assert(bad_crc == bad_data_crc); } #endif // If the exising sector has good data, ignore supplied data if it's bad if (bad_crc && has_good_data()) return Merge::Unchanged; // If the existing sector is bad, new good data will replace it all if (!bad_crc && has_baddatacrc()) { remove_data(); ret = Merge::Improved; } // 8K sectors always have a CRC error, but may include a secondary checksum if (is_8k_sector()) { // Attempt to identify the 8K checksum method used by the new data // If it's recognised, replace any existing data with it if (!ChecksumMethods(new_data.data(), new_data.size()).empty()) { remove_data(); ret = Merge::Improved; } // Do we already have a copy? else if (copies() == 1) { // Can we identify the method used by the existing copy? if (!ChecksumMethods(m_data[0].data(), m_data[0].size()).empty()) { // Keep the existing, ignoring the new data return Merge::Unchanged; } } } // DD 8K sectors are considered complete at 6K, everything else at natural size auto complete_size = is_8k_sector()? 0x1800 : new_data.size(); // Compare existing data with the new data, to avoid storing redundant copies. for (auto it = m_data.begin(); it!= m_data.end(); ) { auto &data = *it; if (data.size() >= complete_size && new_data.size() >= complete_size) { // If the complete area of the data matches, ignore the new copy. if (!std::memcmp(data.data(), new_data.data(), complete_size)) return Merge::Unchanged; } // Existing data is the same size or larger? if (data.size() >= new_data.size()) { // Compare the prefix of each. if (std::equal(new_data.begin(), new_data.end(), data.begin())) { // If identical, or new is shorter than complete size, ignore it. if (data.size() == new_data.size() || new_data.size() < complete_size) return Merge::Unchanged; // The new shorter copy replaces the existing data. it = m_data.erase(it); ret = Merge::Improved; continue; } } else // existing is shorter { // Compare the prefix of each. if (std::equal(data.begin(), data.end(), new_data.begin())) { // If the existing data is at least complete size, ignore the new data. if (data.size() >= complete_size) return Merge::Unchanged; // The new longer copy replaces the existing data. it = m_data.erase(it); ret = Merge::Improved; continue; } } ++it; } // Will we now have multiple copies? if (copies() > 0) { // Damage can cause us to see different DAM values for a sector. // Favour normal over deleted, and deleted over anything else. if (dam!= new_dam && (dam == 0xfb || (dam == 0xf8 && new_dam!= 0xfb))) { return Merge::Unchanged; } // Multiple good copies mean a difference in the gap data after // a good sector, perhaps due to a splice. We just ignore it. if (!has_baddatacrc()) return Merge::Unchanged; // Keep multiple copies the same size, whichever is shortest auto new_size = std::min(new_data.size(), m_data[0].size()); new_data.resize(new_size); // Resize any existing copies to match for (auto &d : m_data) d.resize(new_size); } // Insert the new data copy. m_data.emplace_back(std::move(new_data)); limit_copies(opt.maxcopies); // Update the data CRC state and DAM m_bad_data_crc = bad_crc; dam = new_dam; return ret; } Sector::Merge Sector::merge (Sector &&sector) { Merge ret = Merge::Unchanged; // If the new header CRC is bad there's nothing we can use if (sector.has_badidcrc()) return Merge::Unchanged; // Something is wrong if the new details don't match the existing one assert(sector.header == header); assert(sector.datarate == datarate); assert(sector.encoding == encoding); // If the existing header is bad, repair it if (has_badidcrc()) { header = sector.header; set_badidcrc(false); ret = Merge::Improved; } // We can't repair good data with bad if (!has_baddatacrc() && sector.has_baddatacrc()) return ret; // Add the new data snapshots for (Data &data : sector.m_data) { // Move the data into place, passing on the existing data CRC status and DAM auto add_ret = add(std::move(data), sector.has_baddatacrc(), sector.dam); if (add_ret == Merge::Improved || (ret == Merge::Unchanged)) ret = add_ret; } sector.m_data.clear(); return ret; } bool Sector::has_data () const { return copies()!= 0; } bool Sector::has_good_data() const { return has_data() &&!has_baddatacrc() &&!has_gapdata(); } bool Sector::has_gapdata () const { return data_size() > size(); } bool Sector::has_shortdata () const { return data_size() < size(); } bool Sector::has_badidcrc () const { return m_bad_id_crc; } bool Sector::has_baddatacrc () const { return m_bad_data_crc; } bool Sector::is_deleted () const { return dam == 0xf8 || dam == 0xf9; } bool Sector::is_altdam () const { return dam == 0xfa; } bool Sector::is_rx02dam () const { return dam == 0xfd; } bool Sector::is_8k_sector () const { // +3 and CPC disks treat this as a virtual complete sector return datarate == DataRate::_250K && encoding == Encoding::MFM && header.size == 6 && has_data(); } void Sector::set_badidcrc (bool bad) { m_bad_id_crc = bad; if (bad) remove_data(); } void Sector::set_baddatacrc (bool bad) { m_bad_data_crc = bad; if (!bad) { auto fill_byte = static_cast<uint8_t>((opt.fill >= 0)? opt.fill : 0); if (!has_data()) m_data.push_back(Data(size(), fill_byte)); else if (copies() > 1) { m_data.resize(1); if (data_size() < size()) { auto pad{ Data(size() - data_size(), fill_byte) }; m_data[0].insert(m_data[0].begin(), pad.begin(), pad.end()); } } } } void Sector::remove_data () { m_data.clear(); m_bad_data_crc = false; dam = 0xfb; } void Sector::limit_copies (int max_copies) { if (copies() > max_copies) m_data.resize(max_copies); } void Sector::remove_gapdata (bool keep_crc/*=false*/) { if (!has_gapdata()) return; for (auto &data : m_data) { // If requested, attempt to preserve CRC bytes on bad sectors. if (keep_crc && has_baddatacrc() && data.size() >= (size() + 2)) data.resize(size() + 2); else data.resize(size()); } } // Map a size code to how it's treated by the uPD765 FDC on the PC int Sector::SizeCodeToRealSizeCode (int size) { // Sizes above 8 are treated as 8 (32K) return (size <= 7)? size : 8; } // Return the sector length for a given sector size code int Sector::SizeCodeToLength (int size) { // 2 ^ (7 + size) return 128 << SizeCodeToRealSizeCode(size); } ======================= File: src/Disk.cpp ======================= <reponame>PeterBortas/samdisk // Core disk class #include "SAMdisk.h" #include "Disk.h" #include "IBMPC.h" #include "ThreadPool.h" ////////////////////////////////////////////////////////////////////////////// Disk::Disk (Format &fmt_) : fmt(fmt_) { format(fmt); } Range Disk::range () const { return Range(cyls(), heads()); } int Disk::cyls () const { return m_trackdata.empty()? 0 : (m_trackdata.rbegin()->first.cyl + 1); } int Disk::heads () const { if (m_trackdata.empty()) return 0; auto it = std::find_if(m_trackdata.begin(), m_trackdata.end(), [] (const std::pair<const CylHead, const TrackData> &p) { return p.first.head!= 0; }); return (it!= m_trackdata.end())? 2 : 1; } bool Disk::preload (const Range &range_, int cyl_step) { // No pre-loading if multi-threading disabled, or only a single core if (!opt.mt || ThreadPool::get_thread_count() <= 1) return false; ThreadPool pool; std::vector<std::future<void>> rets; range_.each([&] (const CylHead cylhead) { rets.push_back(pool.enqueue([this, cylhead, cyl_step] () { read_track(cylhead * cyl_step); })); }); for (auto &ret : rets) ret.get(); return true; } void Disk::clear () { m_trackdata.clear(); } const TrackData &Disk::read (const CylHead &cylhead, bool /*uncached*/) { // Safe look-up requires mutex ownership, in case of call from preload() std::lock_guard<std::mutex> lock(m_trackdata_mutex); return m_trackdata[cylhead]; } const Track &Disk::read_track (const CylHead &cylhead, bool uncached) { read(cylhead, uncached); std::lock_guard<std::mutex> lock(m_trackdata_mutex); return m_trackdata[cylhead].track(); } const BitBuffer &Disk::read_bitstream (const CylHead &cylhead, bool uncached) { read(cylhead, uncached); std::lock_guard<std::mutex> lock(m_trackdata_mutex); return m_trackdata[cylhead].bitstream(); } const FluxData &Disk::read_flux (const CylHead &cylhead, bool uncached) { read(cylhead, uncached); std::lock_guard<std::mutex> lock(m_trackdata_mutex); return m_trackdata[cylhead].flux(); } const TrackData &Disk::write (TrackData &&trackdata) { // Invalidate stored format, since we can no longer guarantee a match fmt.sectors = 0; std::lock_guard<std::mutex> lock(m_trackdata_mutex); auto cylhead = trackdata.cylhead; m_trackdata[cylhead] = std::move(trackdata); return m_trackdata[cylhead]; } const Track &Disk::write (const CylHead &cylhead, Track &&track) { write(TrackData(cylhead, std::move(track))); return read_track(cylhead); } const BitBuffer &Disk::write(const CylHead &cylhead, BitBuffer &&bitbuf) { write(TrackData(cylhead, std::move(bitbuf))); return read_bitstream(cylhead); } const FluxData &Disk::write(const CylHead &cylhead, FluxData &&flux_revs, bool normalised) { write(TrackData(cylhead, std::move(flux_revs), normalised)); return read_flux(cylhead); } void Disk::each (const std::function<void (const CylHead &cylhead, const Track &track)> &func, bool cyls_first) { if (!m_trackdata.empty()) { range().each([&] (const CylHead &cylhead) { func(cylhead, read_track(cylhead)); }, cyls_first); } } void Disk::format (const RegularFormat &reg_fmt, const Data &data, bool cyls_first) { format(Format(reg_fmt), data, cyls_first); } void Disk::format (const Format &new_fmt, const Data &data, bool cyls_first) { auto it = data.begin(), itEnd = data.end(); new_fmt.range().each([&] (const CylHead &cylhead) { Track track; track.format(cylhead, new_fmt); it = track.populate(it, itEnd); write(cylhead, std::move(track)); }, cyls_first); // Assign format after formatting as it's cleared by formatting fmt = new_fmt; } void Disk::flip_sides () { decltype(m_trackdata) trackdata; for (auto pair : m_trackdata) { CylHead cylhead = pair.first; cylhead.head ^= 1; // Move tracks to the new head position trackdata[cylhead] = std::move(pair.second); } // Finally, swap the gutted container with the new one std::swap(trackdata, m_trackdata); } void Disk::resize (int new_cyls, int new_heads) { if (!new_cyls &&!new_heads) { m_trackdata.clear(); return; } // Remove tracks beyond the new extent for (auto it = m_trackdata.begin(); it!= m_trackdata.end(); ) { if (it->first.cyl >= new_cyls || it->first.head >= new_heads) it = m_trackdata.erase(it); else ++it; } // If the disk is too small, insert a blank track to extend it if (cyls() < new_cyls || heads() < new_heads) m_trackdata[CylHead(new_cyls - 1, new_heads - 1)]; } const Sector &Disk::get_sector (const Header &header) { return read_track(header).get_sector(header); } bool Disk::find (const Header &header, const Sector *&found_sector) { auto &track = read_track(header); auto it = track.find(header); if (it!= track.end()) { found_sector = &*it; return true; } return false; } ======================= File: src/SpectrumPlus3.cpp ======================= // Sinclair Spectrum +3 helper functions #include "SAMdisk.h" static bool MatchBlock (const uint8_t *pbInput_, const uint8_t *pbMatch_, const char* psczRules_) { while (*psczRules_) { switch (*psczRules_++) { // Character must match case 'y': if (*pbInput_++!= *pbMatch_++) return false; break; // Character not expected to match case 'n': ++pbInput_; ++pbMatch_; break; // Skip optional input if matched case 'o': if (*pbInput_ == *pbMatch_++) ++pbInput_; break; } } // Fully matched return true; } void FixPlus3BootChecksum (Data &data) { // Start from zero auto sum = data[0x0f] = 0x00; // Add up all the bytes in the sector for (auto &b : data) sum += b; // Adjust the total so the LSB is 3 (for +3) data[0x0f] = 0x03 - sum; } // Fix boot loader issues when loading from a 3.5" drive. // // The +3DOS ROM switches the motor off just before passing control to the // boot sector code. If this code turns the motor on and immediately attempts // to read from the disk, it may not yet be up to speed and could fail. // If the loader is not willing to retry commands the loader will fail/crash. // // Even though this is technically a loader bug, 3" spindles seem heavy // enough to retain sufficient speed to mask the issue. Modern 3.5" drives // spin down more quickly and need a little longer to recover. // // Below we identify known problem cases and modify the loader to fix it. // This requires adding a delay or preventing unnecessary 'off' transitions. bool FixPlus3BootLoader (std::shared_ptr<Disk> &disk) { bool patched = false; // Attempt to read the standard +3 boot sector const Sector *sector = nullptr; if (!disk->find(Header(0, 0, 1, 2), sector) || sector->data_size() < 512) return false; // Create a working copy to modify Data data(sector->data_copy()); // Check for Alkatraz signature and AND #F8 ; OR #04 at specific position // Example disk: Artura if (!patched && !std::memcmp(&data[0x145], "ALKATRAZ", 8) && !std::memcmp(&data[0x2d], "\xe6\xf8\xf6\x04", 4)) { data[0x2e] -= 0x08; // Clear motor off bit in value written to BANK678 variable Message(msgFix, "corrected motor issue in Alkatraz boot loader"); patched = true; } // Decrypter code - the data (HL) and length (BC) values will change between loaders, and the DI is optional static const std::vector<uint8_t> erbe_decrypt { 0x21, 0x2b, 0xfe, // LD HL,#FE2B 0x01, 0x6c, 0x01, // LD BC,#016C 0x11, 0x10, 0xfe, // LD DE,#FE10 0x79, // LD A,C 0xf3, // DI 0xed, 0x4f, // LD R,A 0xed, 0x5f, // loop: LD A,R 0xae, // XOR (HL) 0xeb, // EX DE,HL 0xae, // XOR (HL) 0xeb, // EX DE,HL 0x77, // LD (HL),A 0x23, // INC HL 0x13, // INC DE 0x0b, // DEC BC 0x78, // LD A,B 0xb1, // OR C 0x20, 0xf2 // JR NZ,loop }; // Matching rules against code block above static const char *pcszErbeMatch = "ynyynnyyyyoyyyyyyyyyyyyyyyy"; int code_offset = 0x10; // Check for Erbe decrypter // Example disk: Barbarian II (Erbe) if (!patched && MatchBlock(&data[code_offset], erbe_decrypt.data(), pcszErbeMatch)) { // Determine decryption parameters int data_offset = data[code_offset + 1]; uint16_t len = (data[code_offset + 5] << 8) | data[code_offset + 4]; // Extract length from LD BC,nn instruction uint8_t r = data[code_offset + 4]; // R register initialised from LSB of length r = (r & 0x80) | ((r + 2) & 0x7f); // R advances by 2 between LD R,A and LD A,R, with 7-bit update // Decrypt the block for (auto i = 0; i < len; ++i) { data[data_offset + i] ^= data[code_offset + i] ^ r; // XOR source+dest+R to decrypt r = (r & 0x80) | ((r + 0x0d) & 0x7f); // R advanced by 0x0d each loop, with 7-bit update } // Locate the motor-off instruction for (int i = data_offset + 3; i < data_offset + len - 2; ++i) { // Check for LD B,#1F ; LD A,#01 ; OUT (C),A if (data[i]!= 0x01 || std::memcmp(&data[i - 3], "\x06\x1f\x3e\x01\xed\x79", 6)) continue; // Patch the missing motor-on bit data[i] |= 0x08; // Replace the decrypter with code to turn the motor on and allow some spin-up time static std::vector<uint8_t> fix { 0xf6, 0x08, // OR #08 0xed, 0x79, // OUT (C),A 0x2e, 0x02, // LD L,#02 0x0b, // loop: DEC BC 0x78, // LD A,B 0xb1, // OR C 0x20, 0xfb, // JR NZ,loop 0x2d, // DEC L 0x20, 0xf8, // JR NZ,loop 0x18, 0x00 // jr start [offset set below] }; // Set the JR distance and apply the fix fix[fix.size() - 1] = static_cast<uint8_t>(data_offset - code_offset - fix.size()); std::copy(fix.begin(), fix.end(), data.begin() + code_offset); Message(msgFix, "corrected motor issue in Erbe boot loader"); patched = true; break; } } // The Ubi Soft loaders used by Iron Lord and Twin World are different enough to need separate matching // Example disk: Iron Lord if (!patched && ((!std::memcmp(&data[0x1f0], "IRONLORD", 8) && CRC16(&data[0x10], 0x1f0 - 0x10) == 0x3e0a) || (!std::memcmp(&data[0x180], "TWINWORLD", 9) && CRC16(&data[0x10], 0x180 - 0x10) == 0x5546))) { static std::vector<uint8_t> fix { 0x31, 0x00, 0x5e, // LD SP,#5E00 0x11, 0x13, 0x0c, // LD DE,#130C 0xed, 0x51, // OUT (C),D 0x06, 0x7f, // LD B,#7F 0xed, 0x59, // OUT (C),E 0x2e, 0x02, // LD L,#02 0x0b, // loop: DEC BC 0x78, // LD A,B 0xb1, // OR C 0x20, 0xfb, // JR NZ,loop 0x2d, // DEC L 0x20, 0xf8, // JR NZ,loop 0x18, 0x00 // jr start [offset set below] }; // Set the JR distance and apply the fix fix[fix.size() - 1] = (data[0x1f0] == 'I')? 0x08 : 0x04; std::copy(fix.begin(), fix.end(), data.begin() + 0x10); Message(msgFix, "corrected motor issue in UbiSoft boot loader"); patched = true; } static const std::vector<uint8_t> ubisoft_clear { 0xf3, // DI 0x3e, 0x0d, // LD A,#0D 0x01, 0xfd, 0x1f, // LD BC,#1FFD 0xed, 0x79, // OUT (C),A 0x21, 0x00, 0x58, // LD HL,#5800 0x11, 0x01, 0x58, // LD DE,#5801 0x01, 0xFF, 0x02, // LD BC,#02FF 0x36, 0x3F, // LD (HL),#3f 0xed, 0xb0 // LDIR }; // Matching rules against the block above. Allow only the paging // flags and attribute value to be different. static const char *pcszUbiSoftMatch = "yynyyyyyyyyyyyyyyynyy"; // Motor on without delay, followed by attribute clear. // Example disk: Zombi (Ubi Soft) if (!patched && (data[0x12] & 0x08) && // check for motor on MatchBlock(&data[0x10], ubisoft_clear.data(), pcszUbiSoftMatch)) { static const std::vector<uint8_t> fix { 0x2e, 0x02, // LD L,#02 0x0b, // loop: DEC BC 0x78, // LD A,B 0xb1, // OR C 0x20, 0xfb, // JR NZ,loop 0x2d, // DEC L 0x20, 0xf8, // JR NZ,loop 0x00, 0x00, 0x00, // NOP ; NOP ; NOP }; // Replace the attr clear with a delay. std::copy(fix.begin(), fix.end(), data.begin() + 0x18); Message(msgFix, "corrected motor issue in boot loader"); patched = true; } // Infogrames loader // Example disk: North And South - Side A (1989) if (!patched && !std::memcmp(&data[0x41], "\xaf\x21\x00\x58", 4) && CRC16(&data[0x10], 0x053 - 0x10) == 0x6e53) { static const std::vector<uint8_t> fix { 0x2e, 0x02, // LD L,#02 0x0b, // loop: DEC BC 0x78, // LD A,B 0xb1, // OR C 0x20, 0xfb, // JR NZ,loop 0x2d, // DEC L 0x20, 0xf8, // JR NZ,loop 0x00, 0x00, 0x00, // NOP ; NOP ; NOP 0x00, 0x00 // NOP ; NOP }; // Apply the fix std::copy(fix.begin(), fix.end(), data.begin() + 0x41); Message(msgFix, "corrected motor issue in Infogrames boot loader"); patched = true; } // Have we patched the sector? if (patched) { // Fix the +3 boot checksum FixPlus3BootChecksum(data); // Replace the original sector with our modified version CylHead cylhead(0, 0); auto t = disk->read_track(cylhead); t.find(sector->header)->datas().assign({ std::move(data) }); disk->write(cylhead, std::move(t)); return true; } // Read a potential second stage loader from the following track if (!disk->find(Header(1, 0, 193, 6), sector) || sector->data_size() < 6144) return false; data = sector->data_copy(); // The second stage Shadow Warriors loader disables the drive motor after each sector read. // Example disk: Shadow Warriors if (!std::memcmp(&data[653], "\x49\x2a\xff\x02\x07\x00\x04", 4) && CRC16(data.data(), 1024) == 0x4717) { data[659] = 0x0c; // Change 0x04 to 0x0C to keep motor on CylHead cylhead(1, 0); auto t = disk->read_track(cylhead); t.find(sector->header)->datas().assign({ std::move(data) }); disk->write(cylhead, std::move(t)); Message(msgFix, "corrected motor issue in Shadow Warriors second-stage loader"); return true; } // Nothing changed return false; } ======================= File: src/types/do.cpp ======================= // Apple ][ DOS 3.3-ordered disk image #include "SAMdisk.h" // not used bool ReadDO (MemFile &file, std::shared_ptr<Disk> &disk) { Format fmt { RegularFormat::DO }; // For now, rely on the file size and extension if (file.size()!= fmt.disk_size() ||!IsFileExt(file.name(), "do")) return false; file.rewind(); disk->format(fmt, file.data()); disk->strType = "DO"; return true; } bool WriteDO (FILE* f_, std::shared_ptr<Disk> &disk) { return WriteAppleDODisk(f_, *disk, RegularFormat::DO); } ======================= File: src/types/hfe.cpp ======================= // HFE format for HxC floppy emulator: // http://hxc2001.com/download/floppy_drive_emulator/SDCard_HxC_Floppy_Emulator_HFE_file_format.pdf #include "SAMdisk.h" // Note: currently only format revision 00 is supported. #define HFE_SIGNATURE "HXCPICFE" typedef struct { char header_signature[8]; uint8_t format_revision; uint8_t number_of_tracks; uint8_t number_of_sides; uint8_t track_encoding; uint16_t bitrate_kbps; // little-endian uint16_t floppy_rpm; uint8_t floppy_interface_mode; uint8_t do_not_use; uint16_t track_list_offset; // in 512-byte blocks uint8_t write_allowed; uint8_t single_step; // 0xff = normal, 0x00 = double-step uint8_t track0s0_altencoding; // 0xff = ignore, otherwise use encoding below uint8_t track0s0_encoding; // override encoding for track 0 head 0 uint8_t track0s1_altencoding; // 0xff = ignore, otherwise use encoding below uint8_t track0s1_encoding; // override encoding for track 0 head 1 } HFE_HEADER; typedef struct { uint16_t offset; uint16_t track_len; } HFE_TRACK; enum FloppyInterfaceMode { IBMPC_DD_FLOPPYMODE = 0, IBMPC_HD_FLOPPYMODE, ATARIST_DD_FLOPPYMODE, ATARIST_HD_FLOPPYMODE, AMIGA_DD_FLOPPYMODE, AMIGA_HD_FLOPPYMODE, CPC_DD_FLOPPYMODE, GENERIC_SHUGART_DD_FLOPPYMODE, IBMPC_ED_FLOPPYMODE, MSX2_DD_FLOPPYMODE, C64_DD_FLOPPYMODE, EMU_SHUGART_FLOPPYMODE, S950_DD_FLOPPYMODE, S950_HD_FLOPPYMODE, DISABLE_FLOPPYMODE = 0xfe }; enum TrackEncoding { ISOIBM_MFM_ENCODING = 0, AMIGA_MFM_ENCODING, ISOIBM_FM_ENCODING, EMU_FM_ENCODING, UNKNOWN_ENCODING = 0xff }; std::string to_string (FloppyInterfaceMode interface_mode) { switch (interface_mode) { case IBMPC_DD_FLOPPYMODE: return "IBMPC_DD_FLOPPYMODE"; break; case IBMPC_HD_FLOPPYMODE: return "IBMPC_HD_FLOPPYMODE"; break; case ATARIST_DD_FLOPPYMODE: return "ATARIST_DD_FLOPPYMODE"; break; case ATARIST_HD_FLOPPYMODE: return "ATARIST_HD_FLOPPYMODE"; break; case AMIGA_DD_FLOPPYMODE: return "AMIGA_DD_FLOPPYMODE"; break; case AMIGA_HD_FLOPPYMODE: return "AMIGA_HD_FLOPPYMODE"; break; case CPC_DD_FLOPPYMODE: return "CPC_DD_FLOPPYMODE"; break; case GENERIC_SHUGART_DD_FLOPPYMODE: return "GENERIC_SHUGART_DD_FLOPPYMODE"; break; case IBMPC_ED_FLOPPYMODE: return "IBMPC_ED_FLOPPYMODE"; break; case MSX2_DD_FLOPPYMODE: return "MSX2_DD_FLOPPYMODE"; break; case C64_DD_FLOPPYMODE: return "C64_DD_FLOPPYMODE"; break; case EMU_SHUGART_FLOPPYMODE:return "EMU_SHUGART_FLOPPYMODE";break; case S950_DD_FLOPPYMODE: return "S950_DD_FLOPPYMODE"; break; case S950_HD_FLOPPYMODE: return "S950_HD_FLOPPYMODE"; break; case DISABLE_FLOPPYMODE: return "DISABLE_FLOPPYMODE"; break; } return "Unknown"; } std::string to_string (TrackEncoding track_encoding) { switch (track_encoding) { case ISOIBM_MFM_ENCODING: return "ISOIBM_MFM_ENCODING"; break; case AMIGA_MFM_ENCODING: return "AMIGA_MFM_ENCODING"; break; case ISOIBM_FM_ENCODING: return "ISOIBM_FM_ENCODING"; break; case EMU_FM_ENCODING: return "EMU_FM_ENCODING"; break; case UNKNOWN_ENCODING: return "UNKNOWN_ENCODING"; break; } return "Unknown"; } bool ReadHFE (MemFile &file, std::shared_ptr<Disk> &disk) { HFE_HEADER hh; if (!file.rewind() ||!file.read(&hh, sizeof(hh)) || memcmp(&hh.header_signature, HFE_SIGNATURE, sizeof(hh.header_signature))) return false; if (hh.format_revision!= 0) throw util::exception("unsupported HFE format revision (", hh.format_revision, ")"); HFE_TRACK aTrackLUT[256]; auto track_lut_offset = util::letoh(hh.track_list_offset) << 9; if (!file.seek(track_lut_offset) ||!file.read(aTrackLUT, sizeof(aTrackLUT))) throw util::exception("failed to read track LUT (@", track_lut_offset, ")"); auto datarate = DataRate::Unknown; auto data_bitrate = util::letoh(hh.bitrate_kbps); if (data_bitrate >= 240 && data_bitrate <= 260) datarate = DataRate::_250K; else if (data_bitrate >= 290 && data_bitrate <= 310) datarate = DataRate::_300K; else if (data_bitrate >= 490 && data_bitrate <= 510) datarate = DataRate::_500K; else if (data_bitrate == -1) throw util::exception("variable bitrate images are not supported"); else throw util::exception("unsupported data rate (", data_bitrate, "Kbps)"); Format::Validate(hh.number_of_tracks, hh.number_of_sides); // 64K should be enough for maximum MFM track size, and we'll check later anyway MEMORY mem(0x10000); auto pbTrack = mem.pb; for (uint8_t cyl = 0; cyl < hh.number_of_tracks; ++cyl) { // Offset is in 512-byte blocks, data length covers both heads auto uTrackDataOffset = util::letoh(aTrackLUT[cyl].offset) << 9; auto uTrackDataLen = util::letoh(aTrackLUT[cyl].track_len) >> 1; if (uTrackDataLen > mem.size) throw util::exception("invalid track size (", uTrackDataLen, ") for track ", CylStr(cyl)); for (uint8_t head = 0; head < hh.number_of_sides; ++head) { // Head 1 data starts 256 bytes in if (head == 1) uTrackDataOffset += 256; auto uRead = 0; while (uRead < uTrackDataLen) { auto chunk = std::min(uTrackDataLen - uRead, 256); // Read the next interleaved chunk if (!file.seek(uTrackDataOffset + (uRead * 2)) ||!file.read(pbTrack + uRead, chunk)) throw util::exception("EOF reading track data for ", CH(cyl, head)); uRead += chunk; } BitBuffer bitbuf(datarate, pbTrack, uTrackDataLen * 8); disk->write(CylHead(cyl, head), std::move(bitbuf)); } } disk->metadata["interface_mode"] = to_string(static_cast<FloppyInterfaceMode>(hh.floppy_interface_mode)); disk->metadata["track_encoding"] = to_string(static_cast<TrackEncoding>(hh.track_encoding)); disk->metadata["data_bitrate"] = std::to_string(hh.bitrate_kbps) + "Kbps"; if (hh.floppy_rpm) disk->metadata["floppy_rpm"] = std::to_string(hh.floppy_rpm); disk->strType = "HFE"; return true; } static uint8_t HfeTrackEncoding (const Track &track) { auto encoding = (opt.encoding!= Encoding::Unknown)? opt.encoding : !track.empty()? track[0].encoding : Encoding::Unknown; switch (encoding) { case Encoding::MFM: case Encoding::RX02: case Encoding::MX: case Encoding::Agat: return ISOIBM_MFM_ENCODING; case Encoding::FM: return ISOIBM_FM_ENCODING; case Encoding::Amiga: return AMIGA_MFM_ENCODING; case Encoding::GCR: case Encoding::Ace: default: break; } return UNKNOWN_ENCODING; } static uint16_t HfeDataRate (const Track &track) { auto datarate = (opt.datarate!= DataRate::Unknown)? opt.datarate : !track.empty()? track[0].datarate : DataRate::Unknown; if (datarate!= DataRate::Unknown) { auto kbps = bits_per_second(datarate) / 1000U; return static_cast<uint16_t>(kbps); } return 250U; } static uint8_t HfeInterfaceMode (const Track &track) { if (!track.empty()) { switch (track[0].encoding) { case Encoding::Amiga: switch (track[0].datarate) { case DataRate::_250K: return AMIGA_DD_FLOPPYMODE; case DataRate::_500K: return AMIGA_HD_FLOPPYMODE; default: break; } break; case Encoding::MFM: case Encoding::FM: switch (track[0].datarate) { case DataRate::_250K: case DataRate::_300K: // Use general DD rather than IBMPC_DD_FLOPPYMODE. return GENERIC_SHUGART_DD_FLOPPYMODE; case DataRate::_500K: return IBMPC_HD_FLOPPYMODE; case DataRate::_1M: return IBMPC_ED_FLOPPYMODE; default: break; } break; default: break; } } return GENERIC_SHUGART_DD_FLOPPYMODE; } bool WriteHFE (FILE* f_, std::shared_ptr<Disk> &disk) { std::vector<uint8_t> header(256, 0xff); auto &hh = *reinterpret_cast<HFE_HEADER*>(header.data()); auto &track0 = disk->read_track({ 0, 0 }); strncpy(hh.header_signature, HFE_SIGNATURE, sizeof(hh.header_signature)); hh.format_revision = 0x00; hh.number_of_tracks = static_cast<uint8_t>(disk->cyls()); hh.number_of_sides = static_cast<uint8_t>(disk->heads()); hh.track_encoding = HfeTrackEncoding(track0); hh.bitrate_kbps = util::htole(HfeDataRate(track0)); hh.floppy_rpm = 0; hh.floppy_interface_mode = HfeInterfaceMode(track0); hh.do_not_use = 0x01; hh.track_list_offset = util::htole(static_cast<uint16_t>(0x200 >> 9)); hh.write_allowed = 0xff; hh.single_step = 0xff; hh.track0s0_altencoding = 0xff; hh.track0s0_encoding = 0xff; hh.track0s1_altencoding = 0xff; hh.track0s1_encoding = 0xff; if (!fwrite(header.data(), header.size(), 1, f_)) throw util::exception("write error"); if (fseek(f_, hh.track_list_offset << 9, SEEK_SET)) throw util::exception("seek error"); std::array<HFE_TRACK, 128> aTrackLUT{}; int data_offset = 2; auto max_disk_track_bytes = 0; for (uint8_t cyl = 0; cyl < hh.number_of_tracks; ++cyl) { auto max_track_bytes = 0; for (uint8_t head = 0; head < hh.number_of_sides; ++head) { auto &bitstream = disk->read_bitstream(CylHead(cyl, head)); auto track_bytes = (bitstream.track_bitsize() + 7) / 8; max_track_bytes = std::max(track_bytes, max_track_bytes); max_disk_track_bytes = std::max(max_disk_track_bytes, max_track_bytes); } aTrackLUT[cyl].offset = util::htole(static_cast<uint16_t>(data_offset)); aTrackLUT[cyl].track_len = util::htole(static_cast<uint16_t>(max_track_bytes * 2)); data_offset += ((max_track_bytes * 2) / 512) + 1; } if (!fwrite(aTrackLUT.data(), aTrackLUT.size() * sizeof(aTrackLUT[0]), 1, f_)) throw util::exception("write error"); MEMORY mem(max_disk_track_bytes * 2 + 512); for (uint8_t cyl = 0; cyl < hh.number_of_tracks; ++cyl) { uint8_t *pbTrack{}; for (uint8_t head = 0; head < hh.number_of_sides; ++head) { auto trackdata = disk->read({ cyl, head }); auto bitstream = trackdata.preferred().bitstream(); auto track_bytes = (bitstream.track_bitsize() + 7) / 8; bitstream.seek(0); pbTrack = mem.pb + head * 256; while (track_bytes > 0) { auto chunk_size = std::min(track_bytes, 0x100); for (int i = 0; i < chunk_size; ++i) *pbTrack++ = bitstream.read8_lsb(); memset(pbTrack, 0x55, 0x100 - chunk_size); pbTrack += 0x200 - chunk_size; track_bytes -= chunk_size; } } fseek(f_, util::letoh(aTrackLUT[cyl].offset) * 512, SEEK_SET); auto track_len = (util::letoh(aTrackLUT[cyl].track_len) + 511) & ~0x1ff; if (!fwrite(mem.pb, track_len, 1, f_)) throw util::exception("write error"); } return true; } ======================= File: src/types/fdrawsys_ab_dev.cpp ======================= // fdrawcmd.sys raw reading using drives A+B: // http://simonowen.com/fdrawcmd/ // // The 2-drive technique was developed by <NAME> for his Disk2FDI utility. // It requires BIOS support for 2 floppy drives, and both connected via one cable. // // The technique works as follows: // - the double-density disk to read is in A: // - a formatted high-density disk is in B: // - both drive motors are started // - a 16-32K read request is made on drive B: // - once data starts flowing, drive select is switched to drive A: // - the data returned contains raw bits from drive A: // // This allows reading of double-density formats that the PC FDC doesn't normally // support, such as AmigaDOS. It does require the general format of the disk is // known in order to know when the track is complete. Multiple attempts are often // required to see all the expected sectors. #include "SAMdisk.h" #include "BitstreamTrackBuilder.h" #include "DemandDisk.h" #include "IBMPC.h" #include "FdrawcmdSys.h" #ifdef HAVE_FDRAWCMD_H #include "fdrawcmd.h" #define RAW_READ_ATTEMPTS 10 // Default reads per track #define RAW_READ_SIZE_CODE 7 // 16K class FdrawSysDevABDisk final : public DemandDisk { public: FdrawSysDevABDisk(std::unique_ptr<FdrawcmdSys> fdrawcmd) : m_fdrawcmd(std::move(fdrawcmd)) { auto srt = (opt.steprate >= 0)? opt.steprate : (opt.newdrive? 0xd : 0x8); auto hut = 0x0f; auto hlt = opt.newdrive? 0x0f : 0x7f; m_fdrawcmd->Specify(srt, hut, hlt); m_fdrawcmd->SetMotorTimeout(0); m_fdrawcmd->Recalibrate(); if (!opt.newdrive) m_fdrawcmd->SetDiskCheck(false); } protected: TrackData load(const CylHead &cylhead, bool /*first_read*/) override { m_fdrawcmd->Seek(cylhead.cyl); m_fdrawcmd->SetEncRate(Encoding::MFM, DataRate::_500K); Track track; auto total_scans = 1 + opt.retries; if (total_scans <= 0) total_scans = RAW_READ_ATTEMPTS; for (auto scan = 0; scan < total_scans; ) { MEMORY mem(Sector::SizeCodeToLength(RAW_READ_SIZE_CODE)); if (!m_fdrawcmd->FdRawReadTrack(cylhead.head, RAW_READ_SIZE_CODE, mem)) throw win32_error(GetLastError(), "FdRawReadTrack"); util::bit_reverse(mem.pb, mem.size); BitBuffer bitbuf(DataRate::_250K, mem.pb, mem.size * 8); auto newtrack = TrackData(cylhead, std::move(bitbuf)).track(); bool modified = false; for (auto &sector : newtrack) { // Add new sectors that don't already exist. if (sector.has_good_data() && track.find(sector.header) == track.end()) { track.add(std::move(sector)); modified = true; } } // Once we've seen an Amiga sector, keep trying until we have them all. if (!track.empty() && track[0].encoding == Encoding::Amiga) { if (track.size() == Format(RegularFormat::AmigaDOS).sectors) break; continue; } // Respect a user-defined sector count too. if (opt.sectors > 0 && track.size() >= opt.sectors) break; // If no new sectors were found count an attempt. if (!modified) ++scan; } return TrackData(cylhead, std::move(track)); } bool preload(const Range &/*range*/, int /*cyl_step*/) override { return false; } private: std::unique_ptr<FdrawcmdSys> m_fdrawcmd; }; bool ReadFdrawcmdSysAB (const std::string &path, std::shared_ptr<Disk> &disk) { if (util::lowercase(path)!= "ab:") return false; auto fdrawcmd = FdrawcmdSys::Open(1); if (!fdrawcmd) throw util::exception(path, " requires non-USB drives A: and B:"); FD_CMD_RESULT result{}; fdrawcmd->SetEncRate(Encoding::MFM, DataRate::_500K); if (!fdrawcmd->CmdReadId(0, result) || GetLastError() == ERROR_FLOPPY_ID_MARK_NOT_FOUND) throw util::exception("please insert a formatted high-density disk in B:"); fdrawcmd.reset(); fdrawcmd = FdrawcmdSys::Open(0); if (!fdrawcmd) throw util::exception("failed to open fdrawcmd.sys A:"); else if (!fdrawcmd->FdCheckDisk()) throw win32_error(GetLastError(), "A"); auto fdrawcmd_dev_disk = std::make_shared<FdrawSysDevABDisk>(std::move(fdrawcmd)); fdrawcmd_dev_disk->extend(CylHead(83 - 1, 2 - 1)); fdrawcmd_dev_disk->strType = "fdrawcmd.sys"; disk = fdrawcmd_dev_disk; return true; } bool WriteFdrawcmdSysAB (const std::string &path, std::shared_ptr<Disk> &/*disk*/) { if (util::lowercase(path)!= "ab:") return false; throw util::exception("2-drive writing is impossible"); } #endif // HAVE_FDRAWCMD_H ======================= File: src/types/d4m.cpp ======================= <gh_stars>1-10 // CMD FD-2000 (ED): // http://www.unusedino.de/ec64/technical/formats/d2m-dnp.html #include "SAMdisk.h" const int D4M_TRACKS = 81; const int D4M_SIDES = 2; const int D4M_SECTORS = 20; const int D4M_SECTOR_SIZE = 1024; const int D4M_TRACK_SIZE = D4M_SECTORS * D4M_SECTOR_SIZE; const int D4M_DISK_SIZE = D4M_TRACKS * D4M_SIDES * D4M_TRACK_SIZE; const int D4M_PARTITION_OFFSET = D4M_DISK_SIZE - (2 * D4M_TRACK_SIZE) + (2 * D4M_SECTOR_SIZE); // Partition table start bool ReadD4M (MemFile &file, std::shared_ptr<Disk> &disk) { // D4M is a fixed-size image uint8_t ab[256]; if (file.size()!= D4M_DISK_SIZE ||!file.seek(D4M_PARTITION_OFFSET) ||!file.read(&ab, sizeof(ab))) return false; // Check a partition starts at track 1 sector 1, with "SYSTEM" name if (memcmp(ab, "\x01\x01", 2) || memcmp(ab + 5, "SYSTEM\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0", 16)) return false; Format fmt { RegularFormat::D4M }; // D2M stores the sides in the reverse order, so fiddle things to read it easily file.rewind(); std::swap(fmt.head0, fmt.head1); disk->format(fmt, file.data()); std::swap(disk->fmt.head0, disk->fmt.head1); disk->flip_sides(); disk->strType = "D4M"; return true; } bool WriteD4M (FILE* /*f_*/, std::shared_ptr<Disk> &/*disk*/) { throw std::logic_error("D4M writing not implemented"); #if 0 auto missing = 0; bool f = true; PCFORMAT pf_ = &fmtD4M; auto cyls = D4M_TRACKS; auto heads = D4M_SIDES; MEMORY mem(D4M_TRACK_SIZE); for (auto cyl = 0; f && cyl < cyls; cyl++) { for (auto head = heads - 1; f && head >= 0; head--) { missing += pd_->ReadRegularTrack(cyl, head, pf_, mem); f = (fwrite(mem, D4M_SECTOR_SIZE, pf_->sectors, f_) == pf_->sectors); } } if (!f) throw util::exception("write error"); if (missing) Message(msgWarning, "source missing %d/%d sectors", missing, cyls * heads * pf_->sectors); return true; #endif } ======================= File: src/cmd_format.cpp ======================= // Format and unformat commands #include "SAMdisk.h" #include "record.h" /* uint8_t abAtomLiteBoot[] = { 0xEB, 0x3C, 0x90, 0x41, 0x4C, 0x42, 0x32, 0x2E, 0x34, 0x18, 0x35, 0x00, 0x02, 0x02, 0x8E, 0x04, 0x02, 0x20, 0x00, 0x00, 0x40, 0xF8, 0x01, 0x00, 0x3F, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x53, 0x41, 0x4D, 0x43, 0x4F, 0x55, 0x50, 0x45, 0x2D, 0x43, 0x46, 0x46, 0x41, 0x54, 0x31, 0x36, 0x20, 0x20, 0x20, 0xEB, 0xFE, 0xD5, 0xC5, 0x21, 0x4F, 0x80, 0x11, 0x4F, 0x4F, 0x01, 0xB1, 0x01, 0xD5, 0xED, 0xB0, 0xC9, 0xC1, 0x21, 0xF0, 0x4F, 0x7E, 0x23, 0xDB, 0xFE, 0xA6, 0x23, 0x7E, 0x23, 0x20, 0x07, 0xB9, 0xC0, 0x7E, 0xB8, 0xC0, 0x18, 0x03, 0x2C, 0x20, 0xEC, 0xED, 0x5B, 0x08, 0x50, 0x7A, 0xB3, 0x28, 0x26, 0x3E, 0x1F, 0xD3, 0xFA, 0xDB, 0xFB, 0x3C, 0xD3, 0xFB, 0x21, 0xF7, 0x7F, 0xCD, 0x36, 0x50, 0xC5, 0x01, 0xF8, 0x10, 0x21, 0x0F, 0xE0, 0xED, 0xBB, 0xC1, 0x3A, 0x9F, 0x5C, 0xD3, 0xFC, 0xD6, 0x61, 0xD3, 0xFB, 0x3E, 0x5F, 0xD3, 0xFA, 0xED, 0x5B, 0x0A, 0x50, 0x7A, 0xB3, 0xC8, 0x21, 0x00, 0x80, 0xCD, 0x36, 0x50, 0x21, 0x03, 0x81, 0x11, 0x03, 0x50, 0x1A, 0xAE, 0xE6, 0x5F, 0xC0, 0x1B, 0x2D, 0xF2, 0xA8, 0x4F, 0xD1, 0xDB, 0xFB, 0x32, 0xC2, 0x5B, 0x26, 0x51, 0x6F, 0x36, 0x60, 0x3C, 0x32, 0x0A, 0x81, 0x3C, 0x32, 0x1C, 0x81, 0x3E, 0xA0, 0xCB, 0x61, 0x20, 0x06, 0xAF, 0x32, 0x0F, 0x50, 0x3E, 0xA1, 0xB0, 0x32, 0x30, 0x50, 0x2A, 0x0C, 0x50, 0x22, 0x00, 0x80, 0xEB, 0x21, 0x0E, 0x50, 0x01, 0x27, 0x00, 0xED, 0xB0, 0xC3, 0xAC, 0x50, 0x48, 0x69, 0x20, 0x53, 0x69, 0x6D, 0x6F, 0x6E, 0x21, 0xF7, 0x01, 0xF5, 0x00, 0xF7, 0x02, 0xF5, 0x10, 0xF7, 0x04, 0xE5, 0x00, 0xF7, 0x08, 0xE5, 0x10, 0x42, 0x4F, 0x4F, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x04, 0xB7, 0x40, 0x07, 0xD0, 0xD0, 0x44, 0x02, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xA0, 0xC9, 0x00, 0x00, 0x01, 0x00, 0xE5, 0x7A, 0x16, 0x00, 0x1D, 0x87, 0x30, 0x02, 0xC6, 0xA0, 0x6F, 0x7A, 0x8A, 0x67, 0xEB, 0x19, 0xEB, 0x29, 0x29, 0x19, 0xED, 0x5B, 0x04, 0x50, 0x19, 0xED, 0x5B, 0x06, 0x50, 0x30, 0x01, 0x13, 0x3E, 0xF2, 0xED, 0x79, 0x3E, 0x01, 0x0C, 0xED, 0x79, 0x0D, 0x3E, 0xF3, 0xED, 0x79, 0x0C, 0xED, 0x69, 0x0D, 0x3C, 0xED, 0x79, 0x0C, 0xED, 0x61, 0x0D, 0x3C, 0xED, 0x79, 0x0C, 0xED, 0x59, 0x0D, 0x3C, 0xED, 0x79, 0x0C, 0x78, 0xB2, 0xED, 0x79, 0x0D, 0xE1, 0x3E, 0xF7, 0xED, 0x79, 0x0C, 0xED, 0x78, 0xFE, 0x50, 0x20, 0xFA, 0x3E, 0x20, 0xED, 0x79, 0xED, 0x78, 0xFE, 0x58, 0x20, 0xFA, 0x3E, 0xF0, 0x0D, 0xED, 0x79, 0xC5, 0x0C, 0x06, 0xFE, 0xED, 0xB2, 0xED, 0xB2, 0xED, 0x50, 0x7A, 0xED, 0x58, 0xC1, 0xB3, 0x20, 0x8B, 0xC9, 0x60, 0x68, 0x39, 0xDB, 0xFB, 0x3D, 0xD3, 0xFB, 0x31, 0x00, 0xC0, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0x10, 0xDE, 0xFE, 0x04, 0x20, 0xD4, 0xF9, 0x2A, 0x11, 0x50, 0x22, 0x06, 0x5A, 0x3E, 0xEF, 0x32, 0xAA, 0x59, 0x3A, 0x35, 0x50, 0xA7, 0xC8, 0x32, 0x08, 0x5C, 0xC9, 0x45, 0x64, 0x77, 0x69, 0x6E, 0x20, 0x42, 0x6C, 0x69, 0x6E, 0x6B, 0x2E, 0x55, 0xAA }; */ bool FormatImage (const std::string &path, Range range) { auto disk = std::make_shared<Disk>(); if (!ReadImage(path, disk)) return false; ValidateRange(range, MAX_TRACKS, MAX_SIDES, 1, disk->cyls(), disk->heads()); // Start with MGT or ProDos format, but with automatic gap3. Format fmt{!opt.cpm? RegularFormat::MGT : RegularFormat::ProDos }; fmt.gap3 = 0; // Halve the default sector count in FM to ensure it fits. if (opt.encoding == Encoding::FM) fmt.sectors /= 2; // Allow everything to be overridden, but check it's sensible. fmt.Override(true); fmt.Validate(); util::cout << util::fmt("%s %s, %2u cyls, %u heads, %2u sectors/track, %4u bytes/sector\n", to_string(fmt.datarate).c_str(), to_string(fmt.encoding).c_str(), range.cyls(), range.heads(), fmt.sectors, fmt.sector_size()); range.each([&](const CylHead &cylhead) { Track track; track.format(cylhead, fmt); Message(msgStatus, "Formatting %s", CH(cylhead.cyl, cylhead.head)); disk->write(cylhead, std::move(track)); }, fmt.cyls_first); return WriteImage(path, disk); } bool UnformatImage (const std::string &path, Range range) { auto disk = std::make_shared<Disk>(); if (!ReadImage(path, disk)) return false; ValidateRange(range, MAX_TRACKS, MAX_SIDES, 1, disk->cyls(), disk->heads()); range.each([&] (const CylHead &cylhead) { Message(msgStatus, "Unformatting %s", CH(cylhead.cyl, cylhead.head)); disk->write(cylhead, Track()); }); return WriteImage(path, disk); } bool FormatHdd (const std::string &path) { bool f = false; auto hdd = HDD::OpenDisk(path); /* MEMORY mem(SECTOR_SIZE); // Disk to be made BDOS-bootable? if (opt.boot) { // Provide a default boot sector memcpy(mem, abAtomLiteBoot, sizeof(abAtomLiteBoot)); // Boot sector file supplied? if (*opt.boot) { MFILE file; if (!file.Open(opt.boot)) return Error("boot"); else if (msize(&file)!= SECTOR_SIZE) { throw util::exception("boot sector must be exactly 512 bytes"); return false; } else mread(mem, mem.size, 1, &file); } } */ if (!hdd) Error("open"); else if (hdd->SafetyCheck() && hdd->Lock()) { BDOS_CAPS bdc; GetBDOSCaps(hdd->total_sectors, bdc); bdc.need_byteswap =!!opt.byteswap; // A quick format stops after the MGT boot sector in record 1 int64_t total_sectors = opt.quick? bdc.base_sectors + MGT_DIR_TRACKS*MGT_SECTORS + 1 : hdd->total_sectors; // Format the boot sector and record list f = hdd->Copy(nullptr, bdc.base_sectors, 0, 0, total_sectors, "Formatting"); MEMORY mem(MGT_DISK_SIZE); if (!opt.nosig) memcpy(mem + 232, "BDOS", 4); // Format the record data area for (int64_t uPos = bdc.base_sectors; ; uPos += MGT_DISK_SECTORS) { // Determine how much to transfer in one go if (uPos > total_sectors) uPos = total_sectors; auto block_size = std::min(static_cast<int>(total_sectors - uPos), MGT_DISK_SECTORS); Message(msgStatus, "Formatting... %u%%", static_cast<unsigned>(uPos * 100 / total_sectors)); if (!block_size) break; // Locate and write the record block if (!hdd->Seek(uPos) ||!hdd->Write(mem, block_size, bdc.need_byteswap)) { // If this is a raw format, report the sector offset if (opt.nosig) Message(msgStatus, "Write error at sector %u: %s", uPos, LastError()); else { // Report the record containing the error Message(msgStatus, "Write error in record %u: %s", 1 + (uPos - bdc.base_sectors) / MGT_DISK_SECTORS, LastError()); // Attempt to clear the BDOS signature in the bad record, to prevent its use MEMORY memblank(hdd->sector_size); hdd->Seek(uPos); hdd->Write(memblank, 1); } } } /* if (opt.boot) { UpdateBDOSBootSector(mem, &hdd); if (!hdd->Seek(0) ||!hdd->Write(mem, 1, bdc.fNeedSwap)) return Error("boot"); } */ hdd->Unlock(); } return f; } bool FormatBoot (const std::string &path) { bool fRet = false; // Strip ":0" from end of string auto hdd = HDD::OpenDisk(path.substr(0, path.rfind(':'))); if (!hdd.get() ||!hdd->Seek(0)) Error("open"); else if (hdd->SafetyCheck() && hdd->Lock()) { MEMORY mem(hdd->sector_size); if (!hdd->Write(mem, 1)) Error("write"); else fRet = true; hdd->Unlock(); } return fRet; } bool FormatRecord (const std::string &path) { auto record = 0; if (!IsRecord(path, &record)) throw util::exception("invalid record path"); throw std::logic_error("BDOS record formatting not implemented"); #if 0 auto hdd_path = path.substr(0, path.rfind(':')); auto hdd = HDD::OpenDisk(hdd_path); if (!hdd) return Error("open"); // The disk signature is part of record 1, so unformatting is dangerous if (record == 1 && opt.nosig == 1) throw util::exception("unformatting record 1 would destroy BDOS signature!"); auto olddisk = std::make_shared<DISK>(); MEMORY mem(MGT_TRACK_SIZE); for (BYTE cyl = 0; cyl < NORMAL_TRACKS; ++cyl) for (BYTE head = 0; head < NORMAL_SIDES; ++head) olddisk->FormatRegularTrack(cyl, head, &fmtMGT, mem); return!WriteRecord(hdd.get(), record, *olddisk, true); #endif } ======================= File: src/FdrawcmdSys.cpp ======================= // fdrawcmd.sys device #include "SAMdisk.h" #include "FdrawcmdSys.h" #ifdef HAVE_FDRAWCMD_H /*static*/ std::unique_ptr<FdrawcmdSys> FdrawcmdSys::Open(int device_index) { auto path = util::format(R"(\\.\fdraw)", device_index); Win32Handle hdev{CreateFile( path.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr)}; if (hdev.get()!= INVALID_HANDLE_VALUE) return std::make_unique<FdrawcmdSys>(hdev.release()); return std::unique_ptr<FdrawcmdSys>(); } FdrawcmdSys::FdrawcmdSys(HANDLE hdev) { m_hdev.reset(hdev); } bool FdrawcmdSys::Ioctl(DWORD code, void *inbuf, int insize, void *outbuf, int outsize) { DWORD dwRet{0}; return!!DeviceIoControl(m_hdev.get(), code, inbuf, insize, outbuf, outsize, &dwRet, NULL); } constexpr uint8_t FdrawcmdSys::DtlFromSize(int size) { // Data length used only for 128-byte sectors. return (size == 0)? 0x80 : 0xff; } //////////////////////////////////////////////////////////////////////////////// bool FdrawcmdSys::GetResult(FD_CMD_RESULT &result) { return Ioctl(IOCTL_FD_GET_RESULT, nullptr, 0, &result, sizeof(result)); } bool FdrawcmdSys::SetEncRate(Encoding encoding, DataRate datarate) { if (encoding!= Encoding::MFM && encoding!= Encoding::FM) throw util::exception("unsupported encoding (", encoding, ") for fdrawcmd.sys"); // Set perpendicular mode and write-enable for 1M data rate FD_PERPENDICULAR_PARAMS pp{}; pp.ow_ds_gap_wgate = (datarate == DataRate::_1M)? 0xbc : 0x00; Ioctl(IOCTL_FDCMD_PERPENDICULAR_MODE, &pp, sizeof(pp)); uint8_t rate; switch (datarate) { case DataRate::_250K: rate = FD_RATE_250K; break; case DataRate::_300K: rate = FD_RATE_300K; break; case DataRate::_500K: rate = FD_RATE_500K; break; case DataRate::_1M: rate = FD_RATE_1M; break; default: throw util::exception("unsupported datarate (", datarate, ")"); } return Ioctl(IOCTL_FD_SET_DATA_RATE, &rate, sizeof(rate)); } bool FdrawcmdSys::SetHeadSettleTime(int ms) { auto hst = static_cast<uint8_t>(std::max(0, std::min(255, ms))); return Ioctl(IOCTL_FD_SET_HEAD_SETTLE_TIME, &hst, sizeof(hst)); } bool FdrawcmdSys::SetMotorTimeout(int seconds) { auto timeout = static_cast<uint8_t>(std::max(0, std::min(3, seconds))); return Ioctl(IOCTL_FD_SET_MOTOR_TIMEOUT, &timeout, sizeof(timeout)); } bool FdrawcmdSys::SetMotorOff() { return Ioctl(IOCTL_FD_MOTOR_OFF); } bool FdrawcmdSys::SetDiskCheck(bool enable) { uint8_t check{enable? 1U : 0}; return Ioctl(IOCTL_FD_SET_DISK_CHECK, &check, sizeof(check)); } bool FdrawcmdSys::GetFdcInfo(FD_FDC_INFO &info) { return Ioctl(IOCTL_FD_GET_FDC_INFO, nullptr, 0, &info, sizeof(info)); } bool FdrawcmdSys::Configure(uint8_t eis_efifo_poll_fifothr, uint8_t pretrk) { FD_CONFIGURE_PARAMS cp{}; cp.eis_efifo_poll_fifothr = eis_efifo_poll_fifothr; cp.pretrk = pretrk; return Ioctl(IOCTL_FDCMD_CONFIGURE, &cp, sizeof(cp)); } bool FdrawcmdSys::Specify(int step_rate, int head_unload_time, int head_load_time) { auto srt = static_cast<uint8_t>(step_rate & 0x0f); auto hut = static_cast<uint8_t>(head_unload_time & 0x0f); auto hlt = static_cast<uint8_t>(head_load_time & 0x7f); FD_SPECIFY_PARAMS sp{}; sp.srt_hut = (srt << 4) | hut; sp.hlt_nd = (hlt << 1) | 0; return Ioctl(IOCTL_FDCMD_SPECIFY, &sp, sizeof(sp)); } bool FdrawcmdSys::Recalibrate() { // ToDo: should we check TRACK0 and retry if not signalled? return Ioctl(IOCTL_FDCMD_RECALIBRATE); } bool FdrawcmdSys::Seek(int cyl) { if (cyl == 0) return Recalibrate(); FD_SEEK_PARAMS sp{}; sp.cyl = static_cast<uint8_t>(cyl); return Ioctl(IOCTL_FDCMD_SEEK, &sp, sizeof(sp)); } bool FdrawcmdSys::RelativeSeek(int head, int offset) { FD_RELATIVE_SEEK_PARAMS rsp{}; rsp.flags = (offset > 0)? FD_OPTION_DIR : 0; rsp.head = static_cast<uint8_t>(head); rsp.offset = static_cast<uint8_t>(std::abs(offset)); return Ioctl(IOCTL_FDCMD_RELATIVE_SEEK, &rsp, sizeof(rsp)); } bool FdrawcmdSys::CmdVerify(int cyl, int head, int sector, int size, int eot) { return CmdVerify(head, cyl, head, sector, size, eot); } bool FdrawcmdSys::CmdVerify(int phead, int cyl, int head, int sector, int size, int eot) { FD_READ_WRITE_PARAMS rwp{}; rwp.flags = m_encoding_flags; rwp.phead = static_cast<uint8_t>(phead); rwp.cyl = static_cast<uint8_t>(cyl); rwp.head = static_cast<uint8_t>(head); rwp.sector = static_cast<uint8_t>(sector); rwp.size = static_cast<uint8_t>(size); rwp.eot = static_cast<uint8_t>(eot); rwp.gap = RW_GAP; rwp.datalen = DtlFromSize(size); return Ioctl(IOCTL_FDCMD_VERIFY, &rwp, sizeof(rwp)); } bool FdrawcmdSys::CmdReadTrack(int phead, int cyl, int head, int sector, int size, int eot, MEMORY &mem) { FD_READ_WRITE_PARAMS rwp{}; rwp.flags = m_encoding_flags; rwp.phead = static_cast<uint8_t>(phead); rwp.cyl = static_cast<uint8_t>(cyl); rwp.head = static_cast<uint8_t>(head); rwp.sector = static_cast<uint8_t>(sector); rwp.size = static_cast<uint8_t>(size); rwp.eot = static_cast<uint8_t>(eot); rwp.gap = RW_GAP; rwp.datalen = DtlFromSize(size); return Ioctl(IOCTL_FDCMD_READ_TRACK, &rwp, sizeof(rwp), mem, eot * Sector::SizeCodeToLength(rwp.size)); } bool FdrawcmdSys::CmdRead(int phead, int cyl, int head, int sector, int size, int count, MEMORY &mem, size_t data_offset, bool deleted) { FD_READ_WRITE_PARAMS rwp{}; rwp.flags = m_encoding_flags; rwp.phead = static_cast<uint8_t>(phead); rwp.cyl = static_cast<uint8_t>(cyl); rwp.head = static_cast<uint8_t>(head); rwp.sector = static_cast<uint8_t>(sector); rwp.size = static_cast<uint8_t>(size); rwp.eot = static_cast<uint8_t>(sector + count); rwp.gap = RW_GAP; rwp.datalen = DtlFromSize(size); return Ioctl(deleted? IOCTL_FDCMD_READ_DELETED_DATA : IOCTL_FDCMD_READ_DATA, &rwp, sizeof(rwp), mem + data_offset, count * Sector::SizeCodeToLength(size)); } bool FdrawcmdSys::CmdWrite(int phead, int cyl, int head, int sector, int size, int count, MEMORY &mem, bool deleted) { FD_READ_WRITE_PARAMS rwp{}; rwp.flags = m_encoding_flags; rwp.phead = static_cast<uint8_t>(phead); rwp.cyl = static_cast<uint8_t>(cyl); rwp.head = static_cast<uint8_t>(head); rwp.sector = static_cast<uint8_t>(sector); rwp.size = static_cast<uint8_t>(size); rwp.eot = static_cast<uint8_t>(sector + count); rwp.gap = RW_GAP; rwp.datalen = DtlFromSize(size); return Ioctl(deleted? IOCTL_FDCMD_WRITE_DELETED_DATA : IOCTL_FDCMD_WRITE_DATA, &rwp, sizeof(rwp), mem, count * Sector::SizeCodeToLength(size)); } bool FdrawcmdSys::CmdFormat(FD_FORMAT_PARAMS *params, int size) { return Ioctl(IOCTL_FDCMD_FORMAT_TRACK, params, size); } bool FdrawcmdSys::CmdFormatAndWrite(FD_FORMAT_PARAMS *params, int size) { return Ioctl(IOCTL_FDCMD_FORMAT_AND_WRITE, params, size); } bool FdrawcmdSys::CmdScan(int head, FD_SCAN_RESULT *scan, int size) { FD_SCAN_PARAMS sp{}; sp.flags = m_encoding_flags; sp.head = static_cast<uint8_t>(head); return Ioctl(IOCTL_FD_SCAN_TRACK, &sp, sizeof(sp), scan, size); } bool FdrawcmdSys::CmdTimedScan(int head, FD_TIMED_SCAN_RESULT *timed_scan, int size) { FD_SCAN_PARAMS sp{}; sp.flags = m_encoding_flags; sp.head = static_cast<uint8_t>(head); return Ioctl(IOCTL_FD_TIMED_SCAN_TRACK, &sp, sizeof(sp), timed_scan, size); } bool FdrawcmdSys::CmdReadId(int head, FD_CMD_RESULT &result) { FD_READ_ID_PARAMS rip{}; rip.flags = m_encoding_flags; rip.head = static_cast<uint8_t>(head); return Ioctl(IOCTL_FDCMD_READ_ID, &rip, sizeof(rip), &result, sizeof(result)); } bool FdrawcmdSys::FdRawReadTrack(int head, int size, MEMORY &mem) { FD_RAW_READ_PARAMS rrp{}; rrp.flags = FD_OPTION_MFM; rrp.head = static_cast<uint8_t>(head); rrp.size = static_cast<uint8_t>(size); return Ioctl(IOCTL_FD_RAW_READ_TRACK, &rrp, sizeof(rrp), mem.pb, mem.size); } bool FdrawcmdSys::FdSetSectorOffset(int index) { FD_SECTOR_OFFSET_PARAMS sop{}; sop.sectors = static_cast<uint8_t>(std::max(0, std::min(255, index))); return Ioctl(IOCTL_FD_SET_SECTOR_OFFSET, &sop, sizeof(sop)); } bool FdrawcmdSys::FdSetShortWrite(int length, int finetune) { FD_SHORT_WRITE_PARAMS swp{}; swp.length = static_cast<DWORD>(length); swp.finetune = static_cast<DWORD>(finetune); return Ioctl(IOCTL_FD_SET_SHORT_WRITE, &swp, sizeof(swp)); } bool FdrawcmdSys::FdGetRemainCount(int &remain) { return Ioctl(IOCTL_FD_GET_REMAIN_COUNT, nullptr, 0, &remain, sizeof(remain)); } bool FdrawcmdSys::FdCheckDisk() { return Ioctl(IOCTL_FD_CHECK_DISK); } bool FdrawcmdSys::FdGetTrackTime(int &microseconds) { return Ioctl(IOCTL_FD_GET_TRACK_TIME, nullptr, 0, &microseconds, sizeof(microseconds)); } bool FdrawcmdSys::FdReset() { return Ioctl(IOCTL_FD_RESET); } #endif // HAVE_FDRAWCMD_H ======================= File: src/win32_error.cpp ======================= <filename>src/win32_error.cpp // Win32 error exception #include "SAMdisk.h" #ifdef _WIN32 std::string GetWin32ErrorStr (DWORD error_code, bool english) { if (!error_code) error_code = GetLastError(); if (!error_code) return ""; LPWSTR pMessage = nullptr; DWORD length = 0; // Try for English first? if (english) { length = FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_NEUTRAL), reinterpret_cast<LPWSTR>(&pMessage), 0, nullptr); } if (!length) { length = FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), reinterpret_cast<LPWSTR>(&pMessage), 0, nullptr); } std::ostringstream ss; if (length) { std::wstring wstr { pMessage, length }; wstr.erase(wstr.find_last_not_of(L"\r\n. ") + 1); LocalFree(pMessage); int wstr_length = static_cast<int>(wstr.length()); int utf8_size = WideCharToMultiByte(CP_UTF8, 0, wstr.data(), wstr_length, nullptr, 0, nullptr, nullptr); std::vector<char> utf8_str(utf8_size); WideCharToMultiByte(CP_UTF8, 0, wstr.data(), wstr_length, utf8_str.data(), utf8_size, nullptr, nullptr); ss << std::string(utf8_str.data(), utf8_str.size()); } else { ss << "Unknown Win32 error"; } ss << " (" << error_code << ')'; return ss.str(); } #endif // _WIN32 ======================= File: src/types/trinload.cpp ======================= <reponame>PeterBortas/samdisk<filename>src/types/trinload.cpp // Requires Quazar Trinity ethernet interface // http://www.samcoupe.com/hardtrin.htm // // Also TrinLoad network loader for the SAM Coupe: // http://simonowen.com/blog/2015/03/05/trinload-10/ #include "SAMdisk.h" #include "Trinity.h" #include "DemandDisk.h" class TrinLoadDisk final : public DemandDisk { public: explicit TrinLoadDisk (std::unique_ptr<Trinity> trinity) : m_trinity(std::move(trinity)) { } protected: TrackData load (const CylHead &cylhead, bool /*first_read*/) override { auto data = m_trinity->read_track(cylhead.cyl, cylhead.head); Track track; track.format(cylhead, RegularFormat::MGT); track.populate(data.begin(), data.end()); return TrackData(cylhead, std::move(track)); } bool preload (const Range &/*range*/, int /*cyl_step*/) override { return false; } private: std::unique_ptr<Trinity> m_trinity; }; bool ReadTrinLoad (const std::string &path, std::shared_ptr<Disk> &disk) { if (!IsTrinity(path)) return false; auto trinity = Trinity::Open(); auto record = strtoul(path.c_str() + 4, nullptr, 10); if (record!= 0) trinity->select_record(record); auto ip_addr_str = trinity->devices()[0]; auto trinload_disk = std::make_shared<TrinLoadDisk>(std::move(trinity)); trinload_disk->fmt = Format(RegularFormat::MGT); trinload_disk->extend(CylHead(trinload_disk->fmt.cyls - 1, trinload_disk->fmt.heads - 1)); trinload_disk->metadata["address"] = ip_addr_str; trinload_disk->strType = "TrinLoad"; disk = trinload_disk; return true; } bool WriteTrinLoad (const std::string &path, std::shared_ptr<Disk> &/*disk*/) { if (!IsTrinity(path)) return false; throw util::exception("TrinLoad writing not implemented"); } ======================= File: src/types/sdf.cpp ======================= <filename>src/types/sdf.cpp // Temporary SAM Disk File format, replaced by EDSK for custom format SAM disks #include "SAMdisk.h" const uint8_t SDF_CRC_ERROR = 0x08; const uint8_t SDF_RECORD_NOT_FOUND = 0x10; const uint8_t SDF_DELETED_DATA = 0x20; const int SDF_TRACK_SIZE = 512 * 12; const int SDF_SIDES = 2; const int SDF_NORMAL_SIZE = SDF_SIDES * SDF_TRACK_SIZE * 80; const int SDF_SIZE_81_TRACKS = SDF_SIDES * SDF_TRACK_SIZE * 81; const int SDF_SIZE_82_TRACKS = SDF_SIDES * SDF_TRACK_SIZE * 82; const int SDF_SIZE_83_TRACKS = SDF_SIDES * SDF_TRACK_SIZE * 83; typedef struct { uint8_t sectors; } SDF_TRACK; typedef struct { uint8_t idstatus, datastatus; uint8_t cyl, head, sector, size; uint8_t crc1, crc2; } SDF_SECTOR; bool ReadSDF (MemFile &file, std::shared_ptr<Disk> &disk) { file.rewind(); if (file.size()!= SDF_NORMAL_SIZE && file.size()!= SDF_SIZE_81_TRACKS && file.size()!= SDF_SIZE_82_TRACKS && file.size()!= SDF_SIZE_83_TRACKS) return false; MEMORY mem(SDF_TRACK_SIZE); uint8_t cyls = static_cast<uint8_t>(file.size() / (SDF_TRACK_SIZE * SDF_SIDES)); Range(cyls, SDF_SIDES).each([&] (const CylHead &cylhead) { if (!file.read(mem, SDF_TRACK_SIZE)) throw util::exception("short file reading ", cylhead); auto pt = reinterpret_cast<const SDF_TRACK *>(mem.pb); auto ps = reinterpret_cast<const SDF_SECTOR *>(pt + 1); Track track(pt->sectors); for (auto i = 0; i < pt->sectors; ++i) { Sector sector(DataRate::_250K, Encoding::MFM, Header(ps->cyl, ps->head, ps->sector, ps->size)); auto pd = reinterpret_cast<const uint8_t *>(ps + 1); bool id_crc_error = (ps->idstatus & SDF_CRC_ERROR)!= 0; bool data_not_found = (ps->datastatus & SDF_RECORD_NOT_FOUND)!= 0; bool deleted_dam = (ps->datastatus & SDF_DELETED_DATA)!= 0; bool data_crc_error = (ps->datastatus & SDF_CRC_ERROR)!= 0; if (id_crc_error) sector.set_badidcrc(); else if (!data_not_found) { Data data(pd, pd + sector.size()); sector.add(std::move(data), data_crc_error, deleted_dam? 0xf8 : 0xfb); } ps = reinterpret_cast<const SDF_SECTOR *>(pd + sector.size()); track.add(std::move(sector)); } disk->write(cylhead, std::move(track)); }, true); disk->strType = "SDF"; return true; } #if 0 static bool UnpackSDF (const uint8_t *ps_, uint8_t *pd_, int /*len*/) // ToDo: use len! { const uint8_t *s; uint8_t *t, *p; int nTracks = 0; s = ps_; t = p = pd_; for (;;) { // No escape coming up so must be a data byte if (s[1]!= 0xed) *t++ = *s++; // Repeated block escape? <ED><ED><len><byte> else if (s[0] == 0xed) { // Expand repeated byte block memset(t, s[3], s[2]); t += s[2]; s += 4; } // End of track marker? <00><ED><ED><00> else if (s[2] == 0xed &&!s[0] &&!s[3]) { // Chop off the extra null we included size_t len = t - p; s += 4; // Last block? if (!len) break; // Invalid track length? if (len > SDF_TRACK_SIZE) throw util::exception("invalid packed SDF data"); // Pad up to the end of the track with zeros len = SDF_TRACK_SIZE - len; memset(t, 0x00, SDF_TRACK_SIZE - len); t = p += SDF_TRACK_SIZE; // Increment track count nTracks++; } // Regular data byte else *t++ = *s++; } return nTracks; } #endif bool UnwrapSDF (std::shared_ptr<Disk> &/*src_disk*/, std::shared_ptr<Disk> &/*disk*/) { throw std::logic_error("SDF unwrapping not implemented"); #if 0 // Unpacking nested files is effectively a fix if (opt.fix == 0) return false; // Check for SPECIAL file in the first directory slot, with filename ending in _DATA PCSECTOR ps = disk->GetSector(0, 0, 1, &fmtMGT); if (!ps) return retOK; MGT_DIR *pdir = reinterpret_cast<MGT_DIR *>(ps->apbData[0]); if (pdir->bType!= 8 || memcmp(&pdir->abName[3], "_DATA", 5) || pdir->bSectorsHigh!= 0x06 || pdir->bSectorsLow!= 0x17) return retOK; MEMORY mem(MGT_DISK_SIZE - (MGT_DIR_TRACKS * MGT_TRACK_SIZE)); auto pb = mem.pb; for (uint8_t head = 0; head < NORMAL_SIDES; head++) { for (uint8_t cyl = 0; cyl < NORMAL_TRACKS; cyl++) { if (!head && cyl < MGT_DIR_TRACKS) continue; if (disk->ReadRegularTrack(cyl, head, &fmtMGT, pb)) return 0; pb += MGT_TRACK_SIZE; } } MEMORY mem2(SDF_SIZE_83_TRACKS * 2); int nTracks = UnpackSDF(mem, mem2, SDF_SIZE_83_TRACKS); if (nTracks!= 80 * 2 && nTracks!= 81 * 2 && nTracks!= 82 * 2 && nTracks!= 83 * 2) return retOK; MemFile file; file.open(mem2, nTracks * SDF_TRACK_SIZE, "packed.sdf"); disk.reset(); if (!ReadSDF(file, disk)) throw util::exception("invalid packed SDF data"); disk->strType = "SDF (packed)"; return true; #endif } ======================= File: src/types/d88.cpp ======================= <filename>src/types/d88.cpp // <NAME> 7: // http://www1.plala.or.jp/aoto/tech.htm #include "SAMdisk.h" enum : uint8_t { D88_TYPE_2D = 0x00, // DSSD D88_TYPE_2DD = 0x10, // DSDD D88_TYPE_2HD = 0x20, // DSHD D88_TYPE_1D = 0x30, // SSSD D88_TYPE_1DD = 0x40 // SSDD }; const int D88_HEADS = 2; const int D88_CYLS_2D = 42; // Low density wide tracks const int D88_CYLS_2DD2HD = 82; // 82x2 in double-sided image typedef struct { char szTitle[17]; uint8_t abReserved[9]; uint8_t bReadOnly; uint8_t bDiskType; uint32_t dwDiskSize; uint32_t adwTrackOffsets[D88_CYLS_2DD2HD*D88_HEADS]; } D88_HEADER; typedef struct { uint8_t c, h, r, n; uint8_t bSectorsLow; uint8_t bSectorsHigh; uint8_t bDensity; uint8_t bDeleted; uint8_t bStatus; uint8_t abReserved[5]; uint8_t bLengthLow; uint8_t bLengthHigh; } D88_SECTOR; bool ReadD88 (MemFile &file, std::shared_ptr<Disk> &disk) { bool big_endian = false; D88_HEADER dh; if (!file.rewind() ||!file.read(&dh, sizeof(dh))) return false; // Check for a supported disk type switch (dh.bDiskType) { case D88_TYPE_2D: // 0x00 case D88_TYPE_2DD: // 0x10 case D88_TYPE_2HD: // 0x20 case D88_TYPE_1D: // 0x30 case D88_TYPE_1DD: // 0x40 break; default: return false; } // Check for null terminator in the disk description void *pnull = memchr(&dh, 0, sizeof(dh.szTitle) + sizeof(&dh.abReserved)); if (!pnull) return false; long disk_size = util::letoh(dh.dwDiskSize); // Check the size in the header matches the image size if (disk_size!= file.size()) { // Reject if the file extension isn't what we expect, to avoid false positives if (!IsFileExt(file.name(), "d88") && !IsFileExt(file.name(), "88d") && !IsFileExt(file.name(), "d77") && !IsFileExt(file.name(), "d68") && !IsFileExt(file.name(), "d98") && !IsFileExt(file.name(), "d8u") && !IsFileExt(file.name(), "1dd")) return false; // Warn about the difference but continue Message(msgWarning, "header size field (%u) doesn't match image size (%u)", dh.dwDiskSize, file.size()); } // Store the disk type as meta-data disk->metadata["d88 disk type"] = util::fmt("%02X", dh.bDiskType); // Assume full cyl count until we discover otherwise. Determine the head count from the disk type. auto cyls = D88_CYLS_2DD2HD; auto heads = (dh.bDiskType == D88_TYPE_1D || dh.bDiskType == D88_TYPE_1DD)? 1 : 2; // Copy any comment (we've already checked for a null-terminator above) if (dh.szTitle[0]) disk->metadata["label"] = dh.szTitle; auto last_offset = 0; bool stop = false; for (auto cyl = 0;!stop && cyl < cyls; cyl++) { for (auto head = 0;!stop && head < heads; head++) { CylHead cylhead(cyl, head); int current_offset = dh.adwTrackOffsets[cyl*heads + head]; // Skip blank tracks (no offset or pointing to end of disk) if (!current_offset || current_offset == file.size()) continue; // If this is the first valid offset, use it to calculate the track offset table size if (!last_offset) { long table_size = current_offset - offsetof(D88_HEADER, adwTrackOffsets); if (table_size > 0) { // Update the cylinder count it's beyond the table end uint8_t max_cyls = static_cast<uint8_t>(table_size / 8); if (cyls > max_cyls) cyls = max_cyls; } } // Seek the start of the file data if (current_offset <= last_offset ||!file.seek(current_offset)) { Message(msgWarning, "invalid offset (%lu) for %s", current_offset, CH(cyl, head)); stop = true; break; } last_offset = current_offset; Track track(MAX_SECTORS); D88_SECTOR d88s; do { // Read the next sector header if (!file.read(&d88s, sizeof(d88s))) throw util::exception("short file reading ", cylhead); // Dummy sector indicating no sectors? if (!d88s.bSectorsLow &&!d88s.bSectorsHigh) break; // If the sector count is too large, use the upper byte instead. It is unknown whether // this field is big or little endian, but we now support either. if (d88s.bSectorsLow == 0) { d88s.bSectorsLow = d88s.bSectorsHigh; d88s.bSectorsHigh = 0; if (!big_endian) { Message(msgWarning, "correcting for big-endian sector counts"); big_endian = true; } } // Ensure the sector count is within range, so we don't overrun the sector array and crash. if (d88s.bSectorsLow > MAX_SECTORS) throw util::exception("invalid sector count (", d88s.bSectorsLow, ") on ", cylhead); DataRate datarate = (dh.bDiskType == D88_TYPE_2HD)? DataRate::_500K : DataRate::_250K; Encoding encoding = (d88s.bDensity & 0x40)? Encoding::FM : Encoding::MFM; Sector sector(datarate, encoding, Header(d88s.c, d88s.h, d88s.r, d88s.n)); bool deleted_dam = (d88s.bStatus & 0xf0) == 0x10 || (d88s.bDeleted & 0x10); bool id_crc_error = (d88s.bStatus & 0xf0) == 0xa0; bool data_crc_error = (d88s.bStatus & 0xf0) == 0xb0; bool data_not_found = (d88s.bStatus & 0xf0) == 0xf0; if (id_crc_error) sector.set_badidcrc(); else if (!data_not_found) { // Data may be shorter than the nature size (1942.D88) auto length = (d88s.bLengthHigh << 8) | d88s.bLengthLow; if (length > sector.size()) throw util::exception("too much data on ", cylhead, " sector ", sector.header.sector); Data data(length); file.read(data); sector.add(std::move(data), data_crc_error, deleted_dam? 0xf8 : 0xfb); } track.add(std::move(sector)); } while (track.size() < d88s.bSectorsLow); // Add the track to the disk disk->write(cylhead, std::move(track)); } } disk->strType = "D88"; return true; } bool WriteD88 (FILE* f_, std::shared_ptr<Disk> &disk) { D88_HEADER dh = {}; auto cyls = disk->cyls(); auto heads = disk->heads(); auto _1dd = IsFileExt(opt.szTarget, "1dd"); if (_1dd && heads == 2) throw util::exception("can't write double-sided image to 1DD container"); // Cap the cylinder count at the track offset table limit if (cyls > D88_CYLS_2DD2HD) { Message(msgWarning, "ignoring tracks >= %s", CylStr(D88_CYLS_2DD2HD)); cyls = D88_CYLS_2DD2HD; } // Non-1DD output files are always double-sided if (!_1dd) heads = 2; // Use 1DD for.1dd output files, otherwise use 2D or 2DD depending on the cylinder count. // If we find any HD sectors we'll switch the type to 2HD later. dh.bDiskType = _1dd? ((cyls <= D88_CYLS_2D)? D88_TYPE_1D : D88_TYPE_1DD) : (cyls <= D88_CYLS_2D)? D88_TYPE_2D : D88_TYPE_2DD; // Preserve any disk label if (disk->metadata.find("label")!= disk->metadata.end()) strncpy(dh.szTitle, disk->metadata["label"].c_str(), sizeof(dh.szTitle) - 1); // Skip the file header, which will be written at the end fseek(f_, sizeof(dh), SEEK_SET); Range(cyls, heads).each([&] (const CylHead &cylhead) { auto &track = disk->read_track(cylhead); // Nothing to do for blank tracks if (!track.size()) return; // Set the track offset to the current position dh.adwTrackOffsets[cylhead.cyl*heads + cylhead.head] = ftell(f_); for (auto &sector : track.sectors()) { const auto &data = sector.data_copy(); D88_SECTOR ds = {}; ds.c = static_cast<uint8_t>(sector.header.cyl); ds.h = static_cast<uint8_t>(sector.header.head); ds.r = static_cast<uint8_t>(sector.header.sector); ds.n = static_cast<uint8_t>(sector.header.size); ds.bDensity = (sector.encoding == Encoding::FM)? 0x40 : 0x00; // note: set for FM! ds.bSectorsLow = track.size() & 0xff; ds.bSectorsHigh = 0; ds.bDeleted = sector.is_deleted()? 0x10 : 0x00; auto data_length = sector.size(); // For DITT compatibility, clip sectors using extended size codes if (sector.header.size >= 8) data_length = 256; ds.bLengthLow = data_length & 0xff; ds.bLengthHigh = static_cast<uint8_t>(data_length >> 8); // Determine the BIOS status byte for reading this sector if (sector.has_badidcrc()) ds.bStatus = 0xa0; else if (!sector.has_data()) ds.bStatus = 0xf0; else if (sector.has_baddatacrc()) ds.bStatus = 0xb0; else if (sector.is_deleted()) ds.bStatus = 0x10; else ds.bStatus = 0x00; // Convert 2DD to 2HD if HD content is found if (!_1dd && dh.bDiskType == D88_TYPE_2DD && sector.datarate == DataRate::_500K) dh.bDiskType = D88_TYPE_2HD; // The disk type and data rate must be consistent if ((dh.bDiskType == D88_TYPE_2HD && sector.datarate!= DataRate::_500K) || (dh.bDiskType!= D88_TYPE_2HD && sector.datarate!= DataRate::_250K && sector.datarate!= DataRate::_300K)) { throw util::exception(cylhead, " data rate (", sector.datarate, ") does not match disk type (", dh.bDiskType, ")"); } // Write the sector header if (!fwrite(&ds, sizeof(ds), 1, f_)) throw posix_error(); // Write the sector data if (data.size() >= data_length) { if (!fwrite(data.data(), data_length, 1, f_)) throw posix_error(); } else { Data fill(data_length - data.size()); if (!fwrite(data.data(), data.size(), 1, f_) ||!fwrite(fill.data(), fill.size(), 1, f_)) throw posix_error(); } } }); // Set the completed disk size dh.dwDiskSize = ftell(f_); // Write the file header to the start of the file fseek(f_, 0, SEEK_SET); if (!fwrite(&dh, sizeof(dh), 1, f_)) throw posix_error(); fseek(f_, 0, SEEK_END); return true; } ======================= File: src/types/mbd.cpp ======================= <reponame>PeterBortas/samdisk // MB-02 Spectrum disk interface: // http://busy.host.sk/tvorba/mb02form.htm // http://z00m.speccy.cz/docs/bsdos308-techman-en.txt (English) #include "SAMdisk.h" typedef struct { uint8_t abJpBoot[2]; // Jump to boot routine uint8_t bUnused; uint8_t bSig1; // 0x02 (MB-02 signature 1) uint8_t abTracks[2]; // Tracks per side uint8_t abSectors[2]; // Sectors per track uint8_t abSides[2]; // Disk sides uint8_t abSecPerClust[2]; // Sectors per cluster uint8_t abDirSectors[2]; // Sectors per directory uint8_t abFatSectors[2]; // Sectors per FAT uint8_t abFatLen[2]; // FAT length uint8_t abFAT1Pos[2]; // Logical sector for 1st FAT uint8_t abFat2Pos[2]; // Logical sector for 2nd FAT uint8_t abUnknown[10]; uint8_t bSig2; // 0x00 (MB-02 signature 2) uint8_t date[2]; // Creation date uint8_t time[2]; // Creation time uint8_t bSig3; // 0x00 (MB-02 signature 3) char szDiskName[10]; char szDiskNameEx[16]; char szSystemId[32]; uint8_t abBootCode[88]; } MBD_BOOTSECTOR; bool ReadMBD (MemFile &file, std::shared_ptr<Disk> &disk) { // Make sure we can read the boot information MBD_BOOTSECTOR bs; if (!file.rewind() ||!file.read(&bs, sizeof(bs))) return false; // Check the 3 signature markers if (bs.bSig1!= 0x02 || bs.bSig2!= 0x00 || bs.bSig3!= 0x00) return false; // Pick up the geometry details from the boot sector auto cyls = (bs.abTracks[1] << 8) | bs.abTracks[0]; auto heads = (bs.abSides[1] << 8) | bs.abSides[0]; auto sectors = (bs.abSectors[1] << 8) | bs.abSectors[0]; Format fmt820 { RegularFormat::MBD820 }; Format fmt1804 { RegularFormat::MBD1804 }; Format fmt = (sectors <= fmt820.sectors)? fmt820 : fmt1804; fmt.cyls = cyls; fmt.heads = heads; fmt.sectors = sectors; // Check the image size is correct if (file.size()!= fmt.disk_size()) return false; fmt.Validate(); file.rewind(); disk->format(fmt, file.data()); disk->strType = "MBD"; return true; } bool WriteMBD (FILE* f_, std::shared_ptr<Disk> &disk) { Format fmt { RegularFormat::MBD820 }; const Sector *ps = nullptr; if (!disk->find(Header(0, 0, fmt.base, fmt.size), ps) || ps->data_size() < static_cast<int>(sizeof(MBD_BOOTSECTOR))) return false; auto pbs = reinterpret_cast<const MBD_BOOTSECTOR *>(ps->data_copy().data()); if (pbs->bSig1!= 0x02 || pbs->bSig2!= 0x00 || pbs->bSig3!= 0x00) return false; auto cyls = (pbs->abTracks[1] << 8) | pbs->abTracks[0]; auto heads = (pbs->abSides[1] << 8) | pbs->abSides[0]; auto sectors = (pbs->abSectors[1] << 8) | pbs->abSectors[0]; if (sectors > fmt.sectors) fmt = RegularFormat::MBD1804; fmt.cyls = static_cast<uint8_t>(cyls); fmt.heads = static_cast<uint8_t>(heads); fmt.sectors = static_cast<uint8_t>(sectors); fmt.Validate(); return WriteRegularDisk(f_, *disk, fmt); } ======================= File: src/types/bpb.cpp ======================= // BIOS Parameter Block, for MS-DOS and compatible disks #include "SAMdisk.h" typedef struct { uint8_t abJump[3]; // x86 jump instruction, either 0xeb or 0xe9 uint8_t bOemName[8]; // OEM string uint8_t abBytesPerSec[2]; // bytes per sector uint8_t bSecPerClust; // sectors per cluster uint8_t abResSectors[2]; // number of reserved sectors uint8_t bFATs; // number of FATs uint8_t abRootDirEnts[2]; // number of root directory entries uint8_t abSectors[2]; // total number of sectors uint8_t bMedia; // media descriptor uint8_t abFATSecs[2]; // number of sectors per FAT uint8_t abSecPerTrack[2]; // sectors per track uint8_t abHeads[2]; // number of heads uint8_t abHiddenSecs[4]; // number of hidden sectors uint8_t abLargeSecs[4]; // number of large sectors // extended fields below uint8_t abLargeSectorsPerFat[4]; uint8_t abFlags[2]; uint8_t abFsVersion[2]; uint8_t abRootDirFirstCluster[4]; uint8_t abFsInfoSector[2]; uint8_t BackupBootSector[2]; uint8_t abReserved[12]; } BIOS_PARAMETER_BLOCK; static bool IsValidBPB (BIOS_PARAMETER_BLOCK &bpb) { // Check for known jump-to-bootstrap code patterns // if ((bpb.abJump[0]!= 0xeb || bpb.abJump[2]!= 0x90) && bpb.abJump[0]!= 0xe9) // return false; // Check some basic BPB entries if (!bpb.bFATs || bpb.bFATs > 2 ||!bpb.abResSectors[0] ||!bpb.abRootDirEnts[0]) return false; // Check for a sensible media byte if (bpb.bMedia!= 0xf0 && bpb.bMedia < 0xf8) return false; if (!bpb.bSecPerClust) { // Message(msgWarning, "sectors-per-cluster missing, assuming 2 sectors"); // mpoke(f_, offsetof(BOOT_SECTOR, bSecPerClust), 2); } /* // Only allow "true" DOS disks to be short? if ((bpb.abJump[0]!= 0xeb || bpb.abJump[2]!= 0x90) && bpb.abJump[0]!= 0xe9 && msize(f_) < (uSectorSize * uTotalSectors)) return false; */ return true; } bool ReadBPB (MemFile &file, std::shared_ptr<Disk> &disk) { BIOS_PARAMETER_BLOCK bpb; if (!file.rewind() ||!file.read(&bpb, sizeof(bpb))) return false; if (!IsValidBPB(bpb)) return false; // Extract the full geometry auto total_sectors = bpb.abSectors[0] | (bpb.abSectors[1] << 8); auto sector_size = bpb.abBytesPerSec[0] | (bpb.abBytesPerSec[1] << 8); auto sectors = bpb.abSecPerTrack[0] | (bpb.abSecPerTrack[1] << 8); auto heads = bpb.abHeads[0] | (bpb.abHeads[1] << 8); auto cyls = (sectors && heads)? (total_sectors / (sectors * heads)) : 0; Format fmt { RegularFormat::PC720 }; fmt.cyls = static_cast<uint8_t>(cyls); fmt.heads = static_cast<uint8_t>(heads); fmt.sectors = static_cast<uint8_t>(sectors); fmt.size = SizeToCode(sector_size); fmt.Validate(); if (fmt.track_size() < 6000) fmt.datarate = DataRate::_250K; else if (fmt.track_size() < 12000) fmt.datarate = DataRate::_500K; else fmt.datarate = DataRate::_1M; // Reject disks larger than geometry suggests, but accept space-saver truncated images if (file.size() > fmt.disk_size()) return false; file.rewind(); disk->format(fmt, file.data()); disk->strType = "BPB"; return true; } ======================= File: src/types/mfi.cpp ======================= // MAME/MESS floppy image // // https://github.com/mamedev/mame/blob/master/src/lib/formats/mfi_dsk.cpp #include "SAMdisk.h" #include "DemandDisk.h" #include "BitstreamDecoder.h" #ifdef HAVE_ZLIB #include "zlib.h" #endif // Note: all values are little-endian typedef struct { char signature[16]; // "MESSFLOPPYIMAGE" uint32_t cyl_count, head_count; uint32_t form_factor, variant; } MFI_FILE_HEADER; typedef struct { uint32_t offset, compressed_size, uncompressed_size, write_splice; } MFI_TRACK_HEADER; //! Floppy format data enum { TIME_MASK = 0x0fffffff, MG_MASK = 0xf0000000, MG_SHIFT = 28, //!< Bitshift constant for magnetic orientation data MG_A = (0 << MG_SHIFT), //!< - 0, MG_A -> Magnetic orientation A MG_B = (1 << MG_SHIFT), //!< - 1, MG_B -> Magnetic orientation B MG_N = (2 << MG_SHIFT), //!< - 2, MG_N -> Non-magnetized zone (neutral) MG_D = (3 << MG_SHIFT), //!< - 3, MG_D -> Damaged zone, reads as neutral but cannot be changed by writing RESOLUTION_SHIFT = 30, CYLINDER_MASK = 0x3fffffff }; //! Form factors enum { FF_UNKNOWN = 0x00000000, //!< Unknown, useful when converting FF_3 = 0x20202033, //!< "3 " 3 inch disk FF_35 = 0x20203533, //!< "35 " 3.5 inch disk FF_525 = 0x20353235, //!< "525 " 5.25 inch disk FF_8 = 0x20202038 //!< "8 " 8 inch disk }; //! Variants enum { SSSD = 0x44535353, //!< "SSSD", Single-sided single-density SSDD = 0x44445353, //!< "SSDD", Single-sided double-density SSQD = 0x44515353, //!< "SSQD", Single-sided quad-density DSSD = 0x44535344, //!< "DSSD", Double-sided single-density DSDD = 0x44445344, //!< "DSDD", Double-sided double-density (720K in 3.5, 360K in 5.25) DSQD = 0x44515344, //!< "DSQD", Double-sided quad-density (720K in 5.25, means DD+80 tracks) DSHD = 0x44485344, //!< "DSHD", Double-sided high-density (1440K) DSED = 0x44455344 //!< "DSED", Double-sided extra-density (2880K) }; class MFIDisk final : public DemandDisk { public: void add_track_data (const CylHead &cylhead, std::vector<uint32_t> &&trackdata) { m_data[cylhead] = std::move(trackdata); extend(cylhead); } protected: TrackData load (const CylHead &cylhead, bool /*first_read*/) override { const auto &data = m_data[cylhead]; if (data.empty()) return TrackData(cylhead); FluxData flux_revs; std::vector<uint32_t> flux_times; flux_times.reserve(data.size()); uint32_t total_time = 0; for (auto time : data) { flux_times.push_back(time); total_time += time; } if (total_time!= 200000000) throw util::exception("wrong total_time for ", cylhead, ": ", total_time); if (!flux_times.empty()) flux_revs.push_back(std::move(flux_times)); // causes random crashes // m_data.erase(cylhead); return TrackData(c
67,598
thestackv1_concat_by_repo-long/65536-65536
*/ public void setBitmap(Bitmap bmap) { Bitmap.Config config = bmap.getConfig(); //if a bitmap of format other than supported format is found, //try to create a new bitmap from it of config ARGB_8888. if (!supportedConfigs.contains(config)) bmap = getBitmapSupported(bmap); NativeBitmapImage.updateFromBitmap(getNative(), bmap, bmap.hasAlpha(), bmap.getConfig().name()); } private Bitmap getBitmapSupported(Bitmap orig) { Bitmap supBitmap = Bitmap.createBitmap( orig.getWidth(), orig.getHeight(), Bitmap.Config.ARGB_8888 ); Canvas c = new Canvas(supBitmap); Paint p = new Paint(); c.drawBitmap(orig,0,0,p); return supBitmap; } /** * Copy a new texture from a {@link Buffer} to the GPU texture. This one is also safe even * in a non-GL thread. An updateGPU request on a non-GL thread will * be forwarded to the GL thread and be executed before main rendering happens. * * Creating a new {@link GVRImage} is pretty cheap, but it's still not a * totally trivial operation: it does involve some memory management and * some GL hardware handshaking. Reusing the texture reduces this overhead * (primarily by delaying garbage collection). Do be aware that updating a * texture will affect any and all {@linkplain GVRMaterial materials} * (and/or post effects that use the texture! * * @param width * Texture width, in texels * @param height * Texture height, in texels * @param format * Texture format * @param type * Texture type * @param pixels * A NIO Buffer with the texture * */ public void setBuffer(final int width, final int height, final int format, final int type, final Buffer pixels) { NativeBitmapImage.updateFromBuffer(getNative(), 0, 0, width, height, format, type, pixels); } /** * Copy a new texture subimage from a {@link Buffer} to the GPU texture. This one is also safe even * in a non-GL thread. An updateGPU request on a non-GL thread will * be forwarded to the GL thread and be executed before main rendering happens. * * Creating a new {@link GVRImage} is pretty cheap, but it's still not a * totally trivial operation: it does involve some memory management and * some GL hardware handshaking. Reusing the texture reduces this overhead * (primarily by delaying garbage collection). Do be aware that updating a * texture will affect any and all {@linkplain GVRMaterial materials} * (and/or post effects that use the texture! * * @param xoffset * Subimage texel offset in X direction * @param yoffset * Subimage texel offset in Y direction * @param width * Texture subimage width, in texels * @param height * Texture subimage height, in texels * @param format * Texture format * @param type * Texture type * @param pixels * A NIO Buffer with the texture * */ public void setBuffer(final int xoffset, final int yoffset, final int width, final int height, final int format, final int type, final Buffer pixels) { NativeBitmapImage.updateFromBuffer(getNative(), xoffset, yoffset, width, height, format, type, pixels); } /** * Copy new grayscale data to the GPU texture. This one is also safe even * in a non-GL thread. An updateGPU request on a non-GL thread will * be forwarded to the GL thread and be executed before main rendering happens. * * Be aware that updating a texture will affect any and all * {@linkplain GVRMaterial materials} and/or post effects that use the texture! * @param width width of grayscale image * @param height height of grayscale image * @param grayscaleData A byte array containing grayscale data * * @since 1.6.3 */ public void update(int width, int height, byte[] grayscaleData) { NativeBitmapImage.updateFromMemory(getNative(), width, height, grayscaleData); } private static Bitmap loadBitmap(GVRContext gvrContext, String pngAssetFilename) { try { return BitmapFactory.decodeStream( gvrContext.getContext().getAssets().open(pngAssetFilename)); } catch (final IOException exc) { Log.e(TAG, "asset not found", exc); } return null; } private final static String TAG = "GVRBitmapTexture"; private final static List<Bitmap.Config> supportedConfigs = Arrays.asList( Bitmap.Config.ALPHA_8, Bitmap.Config.ARGB_4444, Bitmap.Config.ARGB_8888, Bitmap.Config.RGB_565 ) ; } class NativeBitmapImage { static native long constructor(int type, int format); static native void setFileName(long pointer, String fname); static native String getFileName(long pointer); static native void updateFromMemory(long pointer, int width, int height, byte[] data); static native void updateFromBitmap(long pointer, Bitmap bitmap, boolean hasAlpha, String format); static native void updateFromBuffer(long pointer, int xoffset, int yoffset, int width, int height, int format, int type, Buffer pixels); static native void updateCompressed(long pointer, int width, int height, int imageSize, byte[] data, int levels, int[] offsets); } ======================= File: GVRf/Framework/backend_daydream/src/main/java/org/gearvrf/DayDreamControllerReader.java ======================= <filename>GVRf/Framework/backend_daydream/src/main/java/org/gearvrf/DayDreamControllerReader.java package org.gearvrf; import android.graphics.PointF; import com.google.vr.sdk.controller.Controller; import com.google.vr.sdk.controller.Controller.ConnectionStates; import com.google.vr.sdk.controller.ControllerManager; import com.google.vr.sdk.controller.Orientation; import org.gearvrf.io.GVRGearCursorController; import org.joml.Math; import org.joml.Quaternionf; import org.joml.Vector3f; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; class DayDreamControllerReader extends GVRGearCursorController.ControllerReaderStubs { private ControllerManager mControllerManager; private Controller mController; private int mConnectionState = ConnectionStates.DISCONNECTED; private FloatBuffer readbackBuffer = null; private GVRApplication mApplication; private final float OCULUS_SCALE = 256.0f; DayDreamControllerReader(GVRApplication application) { EventListener listener = new EventListener(); mControllerManager = new ControllerManager(application.getActivity(), listener); mController = mControllerManager.getController(); mController.setEventListener(listener); mControllerManager.start(); mApplication = application; } @Override public boolean isTouched(int index){ return mController.isTouching; } @Override public boolean isConnected(int index) { return mConnectionState == ConnectionStates.CONNECTED; } public void bufferInit(){ ByteBuffer readbackBufferB = ByteBuffer.allocateDirect(4); readbackBufferB.order(ByteOrder.nativeOrder()); readbackBuffer = readbackBufferB.asFloatBuffer(); GVRViewManager gvrViewManager = mApplication.getViewManager(); DaydreamViewManager viewManager = (DaydreamViewManager)gvrViewManager; setNativeBuffer(viewManager.getNativeRenderer(), readbackBufferB); updateHandedness(viewManager.getNativeRenderer()); } @Override public void updateRotation(Quaternionf quat,int index) { Orientation orientation = mController.orientation; quat.set(orientation.x, orientation.y, orientation.z,orientation.w); quat.rotateLocalY(-(float)Math.toRadians(45.0)); // this makes it to look same as other backends } @Override public void updatePosition(Vector3f vec,int index) { vec.set(mController.position[0], mController.position[1], mController.position[2]); vec.add(0.341f, -0.486f, -0.383f); // this makes it to look same as other backends } @Override public int getKey(int index) { if(mController.appButtonState) return GVRGearCursorController.CONTROLLER_KEYS.BUTTON_A.getNumVal(); if(mController.clickButtonState) return GVRGearCursorController.CONTROLLER_KEYS.BUTTON_ENTER.getNumVal(); if(mController.volumeUpButtonState) return GVRGearCursorController.CONTROLLER_KEYS.BUTTON_VOLUME_UP.getNumVal(); if(mController.volumeDownButtonState) return GVRGearCursorController.CONTROLLER_KEYS.BUTTON_VOLUME_DOWN.getNumVal(); if(mController.homeButtonState) return GVRGearCursorController.CONTROLLER_KEYS.BUTTON_HOME.getNumVal(); return 0; } @Override public float getHandedness() { if(readbackBuffer == null) bufferInit(); return readbackBuffer.get(0); } @Override public void updateTouchpad(PointF pt,int index) { pt.set(mController.touch.x * OCULUS_SCALE, mController.touch.y * OCULUS_SCALE); } @Override protected void finalize() throws Throwable { try { mControllerManager.stop(); mControllerManager = null; } finally { super.finalize(); } } private class EventListener extends Controller.EventListener implements ControllerManager.EventListener { @Override public void onConnectionStateChanged(int state) { mConnectionState = state; } @Override public void onApiStatusChanged(int var1){} @Override public void onRecentered() {} @Override public void onUpdate() { mController.update(); } } public static native void setNativeBuffer(long nativeRenderer, ByteBuffer buffer); public static native void updateHandedness(long nativeRenderer); } ======================= File: GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/TextureCoordinates.java ======================= /* Copyright 2016 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.x3d; /** * * @author m1.williams Used for the texture coordinate values in an array list * Can also construct texture coordinates for X3D via coding. */ public class TextureCoordinates { public short[] coords = new short[3]; public TextureCoordinates() { } public TextureCoordinates(short x, short y, short z) { this.coords[0] = x; this.coords[1] = y; this.coords[2] = z; } public TextureCoordinates(short[] tc) { for (int i = 0; i < 3; i++) { this.coords[i] = tc[i]; } } } ======================= File: GVRf/Extensions/3DCursor/IODevices/io_hand_template/src/main/java/com/sample/hand/template/IOBaseComponent.java ======================= /* * Copyright (c) 2016. Samsung Electronics Co., LTD * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.sample.hand.template; import org.gearvrf.GVRSceneObject; import org.joml.Quaternionf; import org.joml.Vector3f; /** * This class represents a base object that manages a scene object with methods that can set its * type, position and rotation. */ public abstract class IOBaseComponent { public GVRSceneObject sceneObject; private int type; private GVRSceneObject handSceneObject; private Vector3f componentPosition; private Quaternionf componentRotation; /** * Create an {@link IOBaseComponent} of the provided type. * * @param type the type of the {@link IOBaseComponent}. * @param handSceneObject This is the root {@link GVRSceneObject} that represents the hand. */ public IOBaseComponent(int type, GVRSceneObject handSceneObject) { this.type = type; this.handSceneObject = handSceneObject; componentPosition = new Vector3f(); componentRotation = new Quaternionf(); } /** * Get the scene object that represents this component. * * @return This call returns null if no scene object has been set */ public GVRSceneObject getSceneObject() { return sceneObject; } /** * This call sets the {@link GVRSceneObject} that represents this {@link IOBaseComponent} and * adds it to the root hand object. * * @param boneSceneObject */ public void setSceneObject(GVRSceneObject boneSceneObject) { this.sceneObject = boneSceneObject; handSceneObject.addChildObject(boneSceneObject); } /** * Set the rotation for the {@link IOBaseComponent} * * @param w the w value of the quaternion * @param x the x value of the quaternion * @param y the y value of the quaternion * @param z the z value of the quaternion */ public void setRotation(float w, float x, float y, float z) { componentRotation.set(w, x, y, z); if (sceneObject!= null) { sceneObject.getTransform().setRotation(w, x, y, z); } } /** * Set the rotation for the {@link IOBaseComponent} * * @param rotation the quaternion that represents the bone rotation */ public void setRotation(Quaternionf rotation) { setRotation(rotation.w, rotation.x, rotation.y, rotation.z); } /** * Set the position of the {@link IOBaseComponent} * * @param x the x value of the quaternion * @param y the y value of the quaternion * @param z the z value of the quaternion */ public void setPosition(float x, float y, float z) { componentPosition.set(x, y, z); if (sceneObject!= null) { sceneObject.getTransform().setPosition(x, y, z); } } /** * Set the position of the {@link IOBaseComponent} * param position the vector representing the position */ public void setPosition(Vector3f position) { setPosition(position.x, position.y, position.z); } /** * Get the type of this {@link IOBaseComponent} * * @return the type of this {@link IOBaseComponent} as an int */ public int getType() { return type; } /** * Get the position of the {@link IOBaseComponent}. * * @return the position as a vector */ public Vector3f getPosition() { return componentPosition; } /** * Get the rotation of this {@link IOBaseComponent}. * * @return the rotation as a quaternion. */ public Quaternionf getRotation() { return componentRotation; } } ======================= File: GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/Vertex.java ======================= /* Copyright 2016 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.x3d; public class Vertex { private float[] point = { 0, 0, 0 }; public Vertex(float x, float y, float z) { this.point[0] = x; this.point[1] = y; this.point[2] = z; } public Vertex(float[] values) { for (int i = 0; i < 3; i++) { this.point[i] = values[i]; } } public float getVertexCoord(int i) { return point[i]; } } ======================= File: GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/ObjectCursorAsset.java ======================= <reponame>sidia-dev-team/GearVRf /* * Copyright 2016 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.io.cursor3d; import android.util.SparseArray; import org.gearvrf.GVRContext; import org.gearvrf.GVRSceneObject; import org.gearvrf.animation.GVRAnimation; import org.gearvrf.animation.GVRAnimationEngine; import org.gearvrf.animation.GVRRepeatMode; import org.gearvrf.scene_objects.GVRModelSceneObject; import org.gearvrf.utility.Log; import java.io.IOException; /** * Use this behavior to uniquely set an object to the {@link Cursor}. */ class ObjectCursorAsset extends CursorAsset { private static final String TAG = ObjectCursorAsset.class.getSimpleName(); private final String assetName; private SparseArray<GVRModelSceneObject> objects; private GVRAnimationEngine animationEngine; private int LOOP_REPEAT_COUNT = -1; ObjectCursorAsset(GVRContext context, CursorType type, Action action, String assetName) { super(context, type, action); this.assetName = assetName; objects = new SparseArray<GVRModelSceneObject>(); animationEngine = context.getAnimationEngine(); } @Override void set(Cursor cursor) { super.set(cursor); GVRModelSceneObject modelSceneObject = objects.get(cursor.getId()); if (modelSceneObject == null) { Log.e(TAG, "Model not found, should not happen"); return; } modelSceneObject.setEnable(true); for (GVRAnimation animation : modelSceneObject.getAnimations()) { animation.setRepeatMode(GVRRepeatMode.REPEATED); animation.setRepeatCount(LOOP_REPEAT_COUNT); animation.start(animationEngine); } } private GVRModelSceneObject loadModelSceneObject() { GVRModelSceneObject modelSceneObject = null; try { modelSceneObject = context.getAssetLoader().loadModel(assetName); } catch (IOException e) { //should not happen Log.e(TAG, "Could not load model", e); } return modelSceneObject; } @Override void reset(Cursor cursor) { super.reset(cursor); GVRModelSceneObject modelSceneObject = objects.get(cursor.getId()); modelSceneObject.setEnable(false); for (GVRAnimation animation : modelSceneObject.getAnimations()) { if (animation.isFinished() == false) { animation.setRepeatMode(GVRRepeatMode.ONCE); animation.setRepeatCount(0); animationEngine.stop(animation); } } } @Override void load(Cursor cursor) { Integer key = cursor.getId(); GVRModelSceneObject modelSceneObject = objects.get(key); if (modelSceneObject == null) { modelSceneObject = loadModelSceneObject(); modelSceneObject.setName( getAction().toString() + key.toString()); objects.put(key, modelSceneObject); } cursor.addChildObject(modelSceneObject); modelSceneObject.setEnable(false); } @Override void unload(Cursor cursor) { GVRSceneObject assetSceneObject = objects.get(cursor.getId()); cursor.removeChildObject(assetSceneObject); objects.remove(cursor.getId()); } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/GVRCompressedTextureLoader.java ======================= /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.asynchronous; import java.io.InputStream; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; import android.graphics.BitmapFactory; import android.opengl.GLES20; import org.gearvrf.GVRCompressedImage; /** * Implement this class to use compressed texture formats that GVRF does not * support. * * A {@link GVRCompressedTextureLoader} contains the logic to detect a * particular file type, and to parse the header. It is an abstract class (not * an interface) so that it can contain a protected method ( * {@code CompressedImage()}) that calls the private {@code CompressedImage} * constructor: this limits the chances that someone will create an instance * with invalid value, while still allowing apps to add new loaders without * having to add them to this package. * * <p> * The general data flow is * <ul> * <li>The internal load method loads the file into memory * <li>If one and only one {@linkplain #sniff(byte[], Reader) sniff()} method * returns {@code true}, the data is passed to the corresponding * {@linkplain #parse(byte[], Reader) parse()} method * <li>The {@code parse()} method extracts GL parameters, and uses * {@code CompressedImage()} to return an internal {@code CompressedImage} * instance * <li>The internal load method passes that {@code CompressedImage} to a * GL-thread callback, that converts it to a texture and passes that texture to * the app's {@link org.gearvrf.GVRAndroidResource.BitmapTextureCallback * BitmapTextureCallback} * </ul> * * @since 1.6.1 */ public abstract class GVRCompressedTextureLoader { protected GVRCompressedTextureLoader() { } /** * Bytes of header data that we need to * {@link #sniff(byte[], Reader)} or {@link #parse(byte[], Reader)}. * * When we <em>know</em> that a file contains a compressed texture, we can * simply load the whole thing into a {@code byte[]}, and pass the offset of * the actual data to * {@link #CompressedTexture(int, int, int, int, int, byte[], int, int)}. * But, when a file may contain either an Android {@link android.graphics.Bitmap} or a * compressed texture, we don't want to load the whole file into memory: * {@link BitmapFactory#decodeStream(InputStream)} is more memory-efficient * than {@link BitmapFactory#decodeByteArray(byte[], int, int)}. * * @return Number of bytes of header data needed to successfully sniff or * parse the file format. * * @since 1.6.6 */ public abstract int headerLength(); /** * Does this byte array contain an instance of'my' compressed texture? The * {@link CompressedTexture#load(InputStream, int, boolean)} methods will call all * registered Loader's sniffers: if one and only one returns {@code true}, * the load() method will return a {@code CompressedImage}. * * <p> * <em>Note:</em> This routine needs to be very fast! The * {@link CompressedTexture#load(InputStream, int, boolean)} routine will call all * registered sniffers, rather than looking at (possibly invalid) file * extensions, or asking the user for a (possibly invalid) hint. * * @param data * A compressed texture file's contents * @param reader * A data reader, pointing to data[0] * @return Whether or not this data is in'my' format */ public abstract boolean sniff(byte[] data, Reader reader); /** * Parse the header, and return a {@link CompressedTexture}. This will only * be called if the loader's {@link #sniff(byte[], Reader)} function * returned {@code true}. * * @param data * A compressed texture file's contents: this loader's * {@link #sniff(byte[], Reader)} function has already returned * {@code true}. * @param reader * A data reader, pointing to data[0] * @return A {@code CompressedImage}, from * {@link #CompressedTexture(int, int, int, int, int, byte[], int, int)} */ public abstract CompressedTexture parse(byte[] data, Reader reader); /** * Provides external parsers access to the internal * {@code CompressedImage} constructor. * * The {@code CompressedImage} class represents a texture file, loaded * into memory; it's what your {@link #parse(byte[], Reader)} method needs * to return. * * <p> * The first four parameters are passed directly to * {@code glCompressedTexImage2D}; the names are from <a href= * "https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCompressedTexImage2D.xml" * >https://www.khronos.org/opengles/sdk/docs/man/xhtml/ * glCompressedTexImage2D.xml</a> * * @param internalformat * The * {@link GLES20#glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer) * glCompressedTexImage2D()} <code>internalformat</code> * parameter. * @param width * The * {@link GLES20#glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer) * glCompressedTexImage2D()} <code>width</code> parameter. * @param height * The * {@link GLES20#glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer) * glCompressedTexImage2D()} <code>height</code> parameter. * @param imageSize * The * {@link GLES20#glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer) * glCompressedTexImage2D()} <code>imageSize</code> parameter. * @param levels * The number of mipmap levels * @param data * The {@code byte[]} passed to {@link #parse(byte[], Reader)} * @param dataOffset * Header length - offset of first byte of texture data * @param dataBytes * Number of bytes of texture data * @return An internal buffer that the GL thread can use to create a * {@link GVRCompressedImage} */ protected CompressedTexture CompressedTexture(int internalformat, int width, int height, int imageSize, int levels, byte[] data, int dataOffset, int dataBytes) { ByteBuffer buffer = ByteBuffer.wrap(data, dataOffset, dataBytes); return new CompressedTexture(internalformat, width, height, imageSize, levels, buffer); } /** * Register a loader with the'sniffer'. * * 'Factory loaders' are pre-registered. To load a format we don't support, * create a {@link GVRCompressedTextureLoader} descendant. Then, before * trying to load any files in that format, create an instance and call * {@link #register()}: * * <pre> * * new MyCompressedFormat().register(); * </pre> */ public void register() { synchronized (loaders) { loaders.add(this); maximumHeaderLength = 0; for (GVRCompressedTextureLoader loader : loaders) { int headerLength = loader.headerLength(); if (headerLength > maximumHeaderLength) { maximumHeaderLength = headerLength; } } } } static List<GVRCompressedTextureLoader> getLoaders() { return loaders; } private static final List<GVRCompressedTextureLoader> loaders = new ArrayList<GVRCompressedTextureLoader>(); static int maximumHeaderLength = 0; /* * We can (and do) expect apps to register any custom loaders before calling * one of the load() methods, but we can't have the 'factory loaders' * register themselves in their own static initializers: If the only * reference to a loader is in its own class, Java may never call its * initializer. */ static { new AdaptiveScalableTextureCompression().register(); new EricssonTextureCompression2().register(); new KTX().register(); } /** Utility class for reading big- and little-endian numbers from a header */ protected static final class Reader { private final byte[] data; // private final int length; private int readPointer; /** Wrap a Reader around a byte array */ protected Reader(byte[] data) { this.data = data; // this.length = data.length; this.readPointer = 0; } private byte read() { return data[readPointer++]; } protected static final int INTEGER_BYTES = Integer.SIZE / Byte.SIZE; protected static final int SHORT_BYTES = Short.SIZE / Byte.SIZE; /** * Read an int * * @param bytes * Should be in range 1..4. Not checked, and bad things can * happen if you pass invalid values! * @return A little-endian number from the byte array */ protected int read(int bytes) { return readLE(bytes); } /** * Read a little-endian int * * @param bytes * Should be in range 1..4. Not checked, and bad things can * happen if you pass invalid values! * @return A little-endian number from the byte array */ protected int readLE(int bytes) { int result = 0; for (int index = 0; index < bytes; ++index) { result |= ((int) read() & 0xff) << (index * Byte.SIZE); } return result; } /* * readBE() is slightly cheaper than readLE(): readBE() takes 4 * shift-left-by-8 ops to read an integer, while readLE() takes a * shift-by-0, a shift-by-8, a shift-by-16, and a shift-by-24. * * This suggests that it may make sense to implement readLE() as * Integer.reverseBytes(readBE(bytes)) - but simple benchmarking shows * that this is actually a bit slower. (Integer.reverseBytes() is * cleverly implemented, but it still takes 4 shifts, 3 |s, and 2 &s.) */ /** * Read a big-endian int * * @param bytes * Should be in range 1..4. Not checked, and bad things can * happen if you pass invalid values! * @return A big-endian number from the byte array */ protected int readBE(int bytes) { int result = 0; for (int index = 0; index < bytes; ++index) { result = (result << Byte.SIZE) | ((int) read() & 0xff); } return result; } /** * Read a long * * @param bytes * Should be in range 1..8. Not checked, and bad things can * happen if you pass invalid values! * @return A little-endian number from the byte array * @deprecated Sniffers need to be very fast! */ protected long readLong(int bytes) { long result = 0L; for (int index = 0; index < bytes; ++index) { result |= ((long) read() & 0xffL) << (index * Byte.SIZE); } return result; } /** Advance the read pointer */ protected void skip(int bytes) { readPointer += bytes; } /** Set the read pointer to the start of the stream */ protected void reset() { readPointer = 0; } /** * Get the current value of the read pointer. In conjunction with * {@link #setPosition(int)}, this can be used to'read ahead'. */ protected int getPosition() { return readPointer; } /** * Set the value of the read pointer. This can be used to return to a * previous {@link #getPosition()} after'reading ahead'. */ protected void setPosition(int position) { readPointer = position; } } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java ======================= <reponame>sidia-dev-team/GearVRf<filename>GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import org.gearvrf.GVRAndroidResource.TextureCallback; import org.gearvrf.animation.GVRAnimator; import org.gearvrf.asynchronous.GVRAsynchronousResourceLoader; import org.gearvrf.asynchronous.GVRCompressedTextureLoader; import org.gearvrf.jassimp.AiIOStream; import org.gearvrf.jassimp.AiIOSystem; import org.gearvrf.jassimp.AiTexture; import org.gearvrf.jassimp.Jassimp; import org.gearvrf.scene_objects.GVRModelSceneObject; import org.gearvrf.utility.FileNameUtils; import org.gearvrf.utility.GVRByteArray; import org.gearvrf.utility.Log; import org.gearvrf.utility.ResourceCache; import org.gearvrf.utility.ResourceCacheBase; import org.gearvrf.utility.Threads; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.nio.ByteBuffer; import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; /** * {@link GVRAssetLoader} provides methods for importing 3D models and textures. * <p> * Supports importing models from an application's resources (both * {@code assets} and {@code res/raw}), from directories on the device's SD * card and URLs on the internet that the application has permission to read. */ public final class GVRAssetLoader { /** * The priority used by * {@link #loadTexture(GVRAndroidResource, GVRAndroidResource.TextureCallback)} */ public static final int DEFAULT_PRIORITY = 0; /** * The default texture parameter instance for overloading texture methods * */ private final GVRTextureParameters mDefaultTextureParameters; /** * Loads textures and listens for texture load events. * Raises the "onAssetLoaded" event after all textures have been loaded. * This listener is NOT attached to the event manager. It is explicitly * called by GVRAssetLoader to get around the restriction that GVRContext * can only have a single listener for asset events. */ public static class AssetRequest implements IAssetEvents { protected final GVRContext mContext; protected final GVRScene mScene; protected final String mFileName; protected final IAssetEvents mUserHandler; protected final GVRResourceVolume mVolume; protected GVRSceneObject mModel = null; protected String mErrors; protected Integer mNumTextures; protected boolean mReplaceScene = false; protected boolean mCacheEnabled = true; protected EnumSet<GVRImportSettings> mSettings = null; /** * Request to load an asset and add it to the scene. * @param model GVRSceneObject to be the root of the loaded asset. * @param fileVolume GVRResourceVolume containing path to file * @param scene GVRScene to add the asset to. * @param userHandler user event handler to get asset events. * @param replaceScene true to replace entire scene with model, false to add model to scene */ public AssetRequest(GVRSceneObject model, GVRResourceVolume fileVolume, GVRScene scene, IAssetEvents userHandler, boolean replaceScene) { mScene = scene; mContext = model.getGVRContext(); mNumTextures = 0; mFileName = fileVolume.getFileName(); mUserHandler = userHandler; mModel = null; mErrors = ""; mReplaceScene = replaceScene; mVolume = fileVolume; Log.d(TAG, "ASSET: loading %s...", mFileName); } public boolean isCacheEnabled() { return mCacheEnabled; } public void useCache(boolean flag) { mCacheEnabled = true; } public GVRContext getContext() { return mContext; } public boolean replaceScene() { return mReplaceScene; } public GVRResourceVolume getVolume() { return mVolume; } public EnumSet<GVRImportSettings> getImportSettings() { return mSettings; } public void setImportSettings(EnumSet<GVRImportSettings> settings) { mSettings = settings; } public String getBaseName() { String fname = mVolume.getFileName(); int i = fname.lastIndexOf("/"); if (i > 0) { return fname.substring(i + 1); } return fname; } /** * Disable texture caching */ void disableTextureCache() { mCacheEnabled = false; } /** * Load a texture asynchronously with a callback. * @param request callback that indicates which texture to load */ public void loadTexture(TextureRequest request) { synchronized (mNumTextures) { GVRAndroidResource resource = null; ++mNumTextures; Log.d(TAG, "ASSET: loadTexture %s %d", request.TextureFile, mNumTextures); try { resource = mVolume.openResource(request.TextureFile); GVRAsynchronousResourceLoader.loadTexture(mContext, mCacheEnabled? mTextureCache : null, request, resource, DEFAULT_PRIORITY, GVRCompressedImage.BALANCED); } catch (IOException ex) { GVRAndroidResource r = new GVRAndroidResource(mContext, R.drawable.white_texture); GVRAsynchronousResourceLoader.loadTexture(mContext, mTextureCache, request, r, DEFAULT_PRIORITY, GVRCompressedImage.BALANCED); GVRImage whiteTex = getDefaultImage(mContext); if (whiteTex!= null) { request.loaded(whiteTex, null); } onTextureError(mContext, ex.getMessage(), request.TextureFile); } } } /** * Load an embedded RGBA texture from the JASSIMP AiScene. * An embedded texture is represented as an AiTexture object in Java. * The AiTexture contains the pixel data for the bitmap. * * @param request TextureRequest for the embedded texture reference. * The filename inside starts with '*' followed * by an integer texture index into AiScene embedded textures * @param aitex Assimp texture containing the pixel data * @return GVRTexture made from embedded texture */ public GVRTexture loadEmbeddedTexture(final TextureRequest request, final AiTexture aitex) throws IOException { GVRAndroidResource resource = null; GVRTexture bmapTex = request.Texture; GVRImage image; Log.d(TAG, "ASSET: loadEmbeddedTexture %s %d", request.TextureFile, mNumTextures); Map<String, GVRImage> texCache = GVRAssetLoader.getEmbeddedTextureCache(); synchronized (mNumTextures) { ++mNumTextures; } try { resource = new GVRAndroidResource(request.TextureFile); } catch (IOException ex) { request.failed(ex, resource); } synchronized (texCache) { image = texCache.get(request.TextureFile); if (image!= null) { Log.d(TAG, "ASSET: loadEmbeddedTexture found %s", resource.getResourceFilename()); bmapTex.setImage(image); request.loaded(image, resource); return bmapTex; } Bitmap bmap; if (aitex.getHeight() == 0) { ByteArrayInputStream input = new ByteArrayInputStream(aitex.getByteData()); bmap = BitmapFactory.decodeStream(input); } else { bmap = Bitmap.createBitmap(aitex.getWidth(), aitex.getHeight(), Bitmap.Config.ARGB_8888); bmap.setPixels(aitex.getIntData(), 0, aitex.getWidth(), 0, 0, aitex.getWidth(), aitex.getHeight()); } GVRBitmapImage bmaptex = new GVRBitmapImage(mContext); bmaptex.setFileName(resource.getResourceFilename()); bmaptex.setBitmap(bmap); image = bmaptex; Log.d(TAG, "ASSET: loadEmbeddedTexture saved %s", resource.getResourceFilename()); texCache.put(request.TextureFile, image); bmapTex.setImage(image); } request.loaded(image, resource); return bmapTex; } /** * Called when a model is successfully loaded. * @param context GVRContext which loaded the model * @param model root node of model hierarchy that was loaded * @param modelFile filename of model loaded */ public void onModelLoaded(GVRContext context, GVRSceneObject model, String modelFile) { mModel = model; Log.d(TAG, "ASSET: successfully loaded model %s %d", modelFile, mNumTextures); if (mUserHandler!= null) { mUserHandler.onModelLoaded(context, model, modelFile); } mContext.getEventManager().sendEvent(mContext, IAssetEvents.class, "onModelLoaded", new Object[]{mContext, model, modelFile}); if (mNumTextures == 0) { generateLoadEvent(); } else { Log.d(TAG, "ASSET: %s has %d outstanding textures", modelFile, mNumTextures); } } /** * Called when a texture is successfully loaded. * @param context GVRContext which loaded the texture * @param texture texture that was loaded * @param texFile filename of texture loaded */ public void onTextureLoaded(GVRContext context, GVRTexture texture, String texFile) { if (mUserHandler!= null) { mUserHandler.onTextureLoaded(context, texture, texFile); } mContext.getEventManager().sendEvent(mContext, IAssetEvents.class, "onTextureLoaded", new Object[] { mContext, texture, texFile }); synchronized (mNumTextures) { Log.e(TAG, "ASSET: Texture: successfully loaded texture %s %d", texFile, mNumTextures); if (mNumTextures >= 1) { if (--mNumTextures!= 0) { return; } } else { return; } } if (mModel!= null) { generateLoadEvent(); } } /** * Called when a model cannot be loaded. * @param context GVRContext which loaded the texture * @param error error message * @param modelFile filename of model loaded */ public void onModelError(GVRContext context, String error, String modelFile) { Log.e(TAG, "ASSET: ERROR: model %s did not load %s", modelFile, error); if (mUserHandler!= null) { mUserHandler.onModelError(context, error, modelFile); } mContext.getEventManager().sendEvent(mContext, IAssetEvents.class, "onModelError", new Object[] { mContext, error, modelFile }); mErrors += error + "\n"; mModel = null; mNumTextures = 0; generateLoadEvent(); } /** * Called when a texture cannot be loaded. * @param context GVRContext which loaded the texture * @param error error message * @param texFile filename of texture loaded */ public void onTextureError(GVRContext context, String error, String texFile) { mErrors += error + "\n"; if (mUserHandler!= null) { mUserHandler.onTextureError(context, error, texFile); } mContext.getEventManager().sendEvent(mContext, IAssetEvents.class, "onTextureError", new Object[] { mContext, error, texFile }); synchronized (mNumTextures) { Log.e(TAG, "ASSET: Texture: ERROR cannot load texture %s %d", texFile, mNumTextures); if (mNumTextures >= 1) { if (--mNumTextures!= 0) { return; } } else { return; } } if (mModel!= null) { generateLoadEvent(); } } /** * Called when the model and all of its textures have loaded. * @param context GVRContext which loaded the texture * @param model model that was loaded (will be null if model failed to load) * @param errors error messages (will be null if no errors) * @param modelFile filename of model loaded */ @Override public void onAssetLoaded(GVRContext context, GVRSceneObject model, String modelFile, String errors) { if (mUserHandler!= null) { mUserHandler.onAssetLoaded(context, model, modelFile, errors); } mContext.getEventManager().sendEvent(mContext, IAssetEvents.class, "onAssetLoaded", new Object[] { mContext, mModel, mFileName, errors }); } /** * Generate the onAssetLoaded event. * Add the model to the scene and start animations. */ private void generateLoadEvent() { String errors =!"".equals(mErrors)? mErrors : null; if (mModel!= null) { if ((mScene!= null)) { if (mReplaceScene) { GVRSceneObject mainCam = mModel.getSceneObjectByName("MainCamera"); GVRCameraRig modelCam = (mainCam!= null)? mainCam.getCameraRig() : null; mScene.clear(); if (modelCam!= null) { GVRCameraRig sceneCam = mScene.getMainCameraRig(); sceneCam.getTransform().setModelMatrix(mainCam.getTransform().getLocalModelMatrix()); sceneCam.setNearClippingDistance(modelCam.getNearClippingDistance()); sceneCam.setFarClippingDistance(modelCam.getFarClippingDistance()); sceneCam.setCameraRigType(modelCam.getCameraRigType()); } } /* * If the model does not already have a parent, * add it to the scene. */ if (mModel.getParent() == null) { Log.d(TAG, "ASSET: asset %s added to scene", mFileName); mScene.addSceneObject(mModel); } } /* * If the model has animations, start them now. */ GVRAnimator animator = (GVRAnimator) mModel.getComponent(GVRAnimator.getComponentType()); if ((animator!= null) && animator.autoStart()) { animator.start(); } } onAssetLoaded(mContext, mModel, mFileName, errors); } } /** * Texture load callback the generates asset events. */ public static class TextureRequest implements TextureCallback { public final String TextureFile; public final GVRTexture Texture; protected GVRTextureParameters mTexParams; protected AssetRequest mAssetRequest; private final TextureCallback mCallback; public TextureRequest(AssetRequest assetRequest, GVRTexture texture, String texFile) { mAssetRequest = assetRequest; TextureFile = texFile; Texture = texture; mCallback = null; Log.v("ASSET", "loadTexture " + TextureFile); } public TextureRequest(GVRAndroidResource resource, GVRTexture texture) { mAssetRequest = null; TextureFile = resource.getResourceFilename(); Texture = texture; mCallback = null; Log.v("ASSET", "loadTexture " + TextureFile); } public TextureRequest(GVRAndroidResource resource, GVRTexture texture, TextureCallback callback) { mAssetRequest = null; TextureFile = resource.getResourceFilename(); Texture = texture; mCallback = callback; Log.v("ASSET", "loadTexture " + TextureFile); } public void loaded(final GVRImage image, GVRAndroidResource resource) { GVRContext ctx = Texture.getGVRContext(); Texture.loaded(image, resource); if (mCallback!= null) { mCallback.loaded(image, resource); } if (mAssetRequest!= null) { mAssetRequest.onTextureLoaded(ctx, Texture, TextureFile); } else { ctx.getEventManager().sendEvent(ctx, IAssetEvents.class, "onTextureLoaded", new Object[] { ctx, Texture, TextureFile }); } } @Override public void failed(Throwable t, GVRAndroidResource resource) { GVRContext ctx = Texture.getGVRContext(); if (mCallback!= null) { mCallback.failed(t, resource); } if (mAssetRequest!= null) { mAssetRequest.onTextureError(ctx, t.getMessage(), TextureFile); GVRImage whiteTex = getDefaultImage(ctx); if (whiteTex!= null) { Texture.loaded(whiteTex, null); } } ctx.getEventManager().sendEvent(ctx, IAssetEvents.class, "onTextureError", new Object[] { ctx, t.getMessage(), TextureFile }); } @Override public boolean stillWanted(GVRAndroidResource androidResource) { return true; } } protected GVRContext mContext; protected static ResourceCache<GVRImage> mTextureCache = new ResourceCache<GVRImage>(); protected ResourceCacheBase<GVRMesh> mMeshCache = new ResourceCacheBase<>(); protected static HashMap<String, GVRImage> mEmbeddedCache = new HashMap<String, GVRImage>(); protected static GVRBitmapImage mDefaultImage = null; /** * When the application is restarted we recreate the texture cache * since all of the GL textures have been deleted. */ static { GVRContext.addResetOnRestartHandler(new Runnable() { @Override public void run() { mTextureCache = new ResourceCache<GVRImage>(); mEmbeddedCache = new HashMap<String, GVRImage>(); mDefaultImage = null; } }); } /** * Construct an instance of the asset loader * @param context GVRContext to get asset load events */ public GVRAssetLoader(GVRContext context) { mContext = context; mDefaultTextureParameters = new GVRTextureParameters(context); } /** * Get the embedded texture cache. * This is an internal routine used during asset loading for processing * embedded textures. * @return embedded texture cache */ static Map<String, GVRImage> getEmbeddedTextureCache() { return mEmbeddedCache; } private static GVRImage getDefaultImage(GVRContext ctx) { if (mDefaultImage == null) { try { Bitmap bmap = Bitmap.createBitmap(32, 32, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bmap); canvas.drawRGB(0xff, 0xff, 0xff); mDefaultImage = new GVRBitmapImage(ctx, bmap); } catch (Exception ex) { return null; } } return mDefaultImage; } /** * Loads file placed in the assets folder, as a {@link GVRBitmapImage} * with the user provided texture parameters. * The bitmap is loaded asynchronously. * <p> * This method automatically scales large images to fit the GPU's * restrictions and to avoid {@linkplain OutOfMemoryError out of memory * errors.} * * @param resource * A stream containing a bitmap texture. The * {@link GVRAndroidResource} class has six constructors to * handle a wide variety of Android resource types. Taking a * {@code GVRAndroidResource} here eliminates six overloads. * @param textureParameters * The texture parameter object which has all the values that * were provided by the user for texture enhancement. The * {@link GVRTextureParameters} class has methods to set all the * texture filters and wrap states. If this parameter is nullo, * default texture parameters are used. * @return The file as a texture, or {@code null} if the file can not be * decoded into a Bitmap. * @see GVRAssetLoader#getDefaultTextureParameters */ public GVRTexture loadTexture(GVRAndroidResource resource, GVRTextureParameters textureParameters) { GVRTexture texture = new GVRTexture(mContext, textureParameters); TextureRequest request = new TextureRequest(resource, texture); GVRAsynchronousResourceLoader.loadTexture(mContext, mTextureCache, request, resource, DEFAULT_PRIORITY, GVRCompressedImage.BALANCED); return texture; } /** * Loads file placed in the assets folder, as a {@link GVRBitmapTexture} * with the default texture parameters. * The bitmap is loaded asynchronously. * @param resource * A stream containing a bitmap texture. The * {@link GVRAndroidResource} class has six constructors to * handle a wide variety of Android resource types. Taking a * {@code GVRAndroidResource} here eliminates six overloads. * @return The file as a texture, or {@code null} if the file can not be * decoded into a Bitmap. * @see GVRAssetLoader#getDefaultTextureParameters */ public GVRTexture loadTexture(GVRAndroidResource resource) { GVRTexture texture = new GVRTexture(mContext, mDefaultTextureParameters); TextureRequest request = new TextureRequest(resource, texture); GVRAsynchronousResourceLoader.loadTexture(mContext, mTextureCache, request, resource, DEFAULT_PRIORITY, GVRCompressedImage.BALANCED); return texture; } /** * Loads a texture from a resource with a specified priority and quality. * <p> * The bitmap is loaded asynchronously. * This method can detect whether the resource file holds a compressed * texture (GVRF currently supports ASTC, ETC2, and KTX formats: * applications can add new formats by implementing * {@link GVRCompressedTextureLoader}): if the file is not a compressed * texture, it is loaded as a normal, bitmapped texture. This format * detection adds very little to the cost of loading even a compressed * texture, and it makes your life a lot easier: you can replace, say, * {@code res/raw/resource.png} with {@code res/raw/resource.etc2} without * having to change any code. * * @param resource * A stream containing a texture file. The * {@link GVRAndroidResource} class has six constructors to * handle a wide variety of Android resource types. Taking a * {@code GVRAndroidResource} here eliminates six overloads. * @param texparams * GVRTextureParameters object containing texture sampler attributes. * @param callback * Before loading, GVRF may call * {@link GVRAndroidResource.TextureCallback#stillWanted(GVRAndroidResource) * stillWanted()} several times (on a background thread) to give * you a chance to abort a'stale' load. * * Successful loads will call * {@link GVRAndroidResource.Callback#loaded(GVRHybridObject, GVRAndroidResource) * loaded()} on the GL thread; * * Any errors will call * {@link GVRAndroidResource.TextureCallback#failed(Throwable, GVRAndroidResource) * failed()}, with no promises about threading. * <p> * This method uses a throttler to avoid overloading the system. * If the throttler has threads available, it will run this * request immediately. Otherwise, it will enqueue the request, * and call * {@link GVRAndroidResource.TextureCallback#stillWanted(GVRAndroidResource) * stillWanted()} at least once (on a background thread) to give * you a chance to abort a'stale' load. * @param priority * This request's priority. Please see the notes on asynchronous * priorities in the <a href="package-summary.html#async">package * description</a>. Also, please note priorities only apply to * uncompressed textures (standard Android bitmap files, which * can take hundreds of milliseconds to load): compressed * textures load so quickly that they are not run through the * request scheduler. * @param quality * The compressed texture {@link GVRCompressedImage#mQuality * quality} parameter: should be one of * {@link GVRCompressedImage#SPEED}, * {@link GVRCompressedImage#BALANCED}, or * {@link GVRCompressedImage#QUALITY}, but other values are * 'clamped' to one of the recognized values. Please note that * this (currently) only applies to compressed textures; normal * {@linkplain GVRBitmapTexture bitmapped textures} don't take a * quality parameter. */ public GVRTexture loadTexture(GVRAndroidResource resource, TextureCallback callback, GVRTextureParameters texparams, int priority, int quality) { if (texparams == null) { texparams = mDefaultTextureParameters; } GVRTexture texture = new GVRTexture(mContext, texparams); TextureRequest request = new TextureRequest(resource, texture, callback); GVRAsynchronousResourceLoader.loadTexture(mContext, mTextureCache, request, resource, priority, quality); return texture; } /** * Loads a bitmap texture asynchronously with default priority and quality. * * This method can detect whether the resource file holds a compressed * texture (GVRF currently supports ASTC, ETC2, and KTX formats: * applications can add new formats by implementing * {@link GVRCompressedTextureLoader}): if the file is not a compressed * texture, it is loaded as a normal, bitmapped texture. This format * detection adds very little to the cost of loading even a compressed * texture, and it makes your life a lot easier: you can replace, say, * {@code res/raw/resource.png} with {@code res/raw/resource.etc2} without * having to change any code. * * @param callback * Before loading, GVRF may call * {@link GVRAndroidResource.TextureCallback#stillWanted(GVRAndroidResource) * stillWanted()} several times (on a background thread) to give * you a chance to abort a'stale' load. * * Successful loads will call * {@link GVRAndroidResource.Callback#loaded(GVRHybridObject, GVRAndroidResource) * loaded()} on the GL thread; * * any errors will call * {@link GVRAndroidResource.TextureCallback#failed(Throwable, GVRAndroidResource) * failed()}, with no promises about threading. * <p> * This method uses a throttler to avoid overloading the system. * If the throttler has threads available, it will run this * request immediately. Otherwise, it will enqueue the request, * and call * {@link GVRAndroidResource.TextureCallback#stillWanted(GVRAndroidResource) * stillWanted()} at least once (on a background thread) to give * you a chance to abort a'stale' load. * @param resource * Basically, a stream containing a texture file. The * {@link GVRAndroidResource} class has six constructors to * handle a wide variety of Android resource types. Taking a * {@code GVRAndroidResource} here eliminates six overloads. */ public GVRTexture loadTexture(GVRAndroidResource resource, TextureCallback callback) { GVRTexture texture = new GVRTexture(mContext, mDefaultTextureParameters); TextureRequest request = new TextureRequest(resource, texture, callback); GVRAsynchronousResourceLoader.loadTexture(mContext, mTextureCache, request, resource, DEFAULT_PRIORITY, GVRCompressedImage.BALANCED); return texture; } /** * Loads a cubemap texture asynchronously with default priority and quality. * <p> * This method can only load uncompressed cubemaps. To load a compressed * cubemap you can use {@link #loadCompressedCubemapTexture(GVRAndroidResource)}. * * @param callback * Before loading, GVRF may call * {@link GVRAndroidResource.TextureCallback#stillWanted(GVRAndroidResource) * stillWanted()} several times (on a background thread) to give * you a chance to abort a'stale' load. * * Successful loads will call * {@link GVRAndroidResource.Callback#loaded(GVRHybridObject, GVRAndroidResource) * loaded()} on the GL thread; * * any errors will call * {@link GVRAndroidResource.TextureCallback#failed(Throwable, GVRAndroidResource) * failed()}, with no promises about threading. * * <p> * This method uses a throttler to avoid overloading the system. * If the throttler has threads available, it will run this * request immediately. Otherwise, it will enqueue the request, * and call * {@link GVRAndroidResource.TextureCallback#stillWanted(GVRAndroidResource) * stillWanted()} at least once (on a background thread) to give * you a chance to abort a'stale' load. * @param resource * Basically, a stream containing a texture file. The * {@link GVRAndroidResource} class has six constructors to * handle a wide variety of Android resource types. Taking a * {@code GVRAndroidResource} here eliminates six overloads. */ public GVRTexture loadCubemapTexture(GVRAndroidResource resource, TextureCallback callback) { GVRTexture texture = new GVRTexture(mContext, mDefaultTextureParameters); TextureRequest request = new TextureRequest(resource, texture, callback); GVRAsynchronousResourceLoader.loadCubemapTexture(mContext, mTextureCache, request, resource, DEFAULT_PRIORITY, GVRCubemapImage.faceIndexMap); return texture; } /** * Simple, high-level method to load a cubemap texture asynchronously, for * use with {@link GVRMaterial#setMainTexture(GVRTexture)} and * {@link GVRMaterial#setTexture(String, GVRTexture)}. * * @param resource * A stream containing a zip file which contains six bitmaps. The * six bitmaps correspond to +x, -x, +y, -y, +z, and -z faces of * the cube map texture respectively. The default names of the * six images are "posx.png", "negx.png", "posy.png", "negx.png", * "posz.png", and "negz.png", which can be changed by calling * {@link GVRCubemapImage#setFaceNames(String[])}. * @return A {@link GVRTexture} that you can pass to methods like * {@link GVRMaterial#setMainTexture(GVRTexture)} * * @since 3.2 * * @throws IllegalArgumentException * If you 'abuse' request consolidation by passing the same * {@link GVRAndroidResource} descriptor to multiple load calls. * <p> * It's fairly common for multiple scene objects to use the same * texture or the same mesh. Thus, if you try to load, say, * {@code R.raw.whatever} while you already have a pending * request for {@code R.raw.whatever}, it will only be loaded * once; the same resource will be used to satisfy both (all) * requests. This "consolidation" uses * {@link GVRAndroidResource#equals(Object)}, <em>not</em> * {@code ==} (aka "reference equality"): The problem with using * the same resource descriptor is that if requests can't be * consolidated (because the later one(s) came in after the * earlier one(s) had already completed) the resource will be * reloaded... but the original descriptor will have been * closed. */ public GVRTexture loadCubemapTexture(GVRAndroidResource resource) { GVRTexture texture = new GVRTexture(mContext, mDefaultTextureParameters); TextureRequest request = new TextureRequest(resource, texture); GVRAsynchronousResourceLoader.loadCubemapTexture(mContext, mTextureCache, request, resource, DEFAULT_PRIORITY, GVRCubemapImage.faceIndexMap); return texture; } /** * Loads a compressed cubemap texture asynchronously with default priority and quality. * <p> * This method can only load compressed cubemaps. To load an un-compressed * cubemap you can use {@link #loadCubemapTexture(GVRAndroidResource)}. * * @param resource * Basically, a stream containing a texture file. The * {@link GVRAndroidResource} class has six constructors to * handle a wide variety of Android resource types. Taking a * {@code GVRAndroidResource} here eliminates six overloads. */ public GVRTexture loadCompressedCubemapTexture(GVRAndroidResource resource, TextureCallback callback) { GVRTexture texture = new GVRTexture(mContext, mDefaultTextureParameters); TextureRequest request = new TextureRequest(resource, texture, callback); GVRAsynchronousResourceLoader.loadCompressedCubemapTexture(mContext, mTextureCache, request, resource, DEFAULT_PRIORITY, GVRCubemapImage.faceIndexMap); return texture; } public GVRTexture loadCompressedCubemapTexture(GVRAndroidResource resource) { GVRTexture texture = new GVRTexture(mContext, mDefaultTextureParameters); TextureRequest request = new TextureRequest(resource, texture); GVRAsynchronousResourceLoader.loadCompressedCubemapTexture(mContext, mTextureCache, request, resource, DEFAULT_PRIORITY, GVRCubemapImage.faceIndexMap); return texture; } /** * Loads atlas information file placed in the assets folder. * <p> * Atlas information file contains in UV space the information of offset and * scale for each mesh mapped in some atlas texture. * The content of the file is at json format like: * <p> * [ {name: SUN, offset.x: 0.9, offset.y: 0.9, scale.x: 0.5, scale.y: 0.5}, * {name: EARTH, offset.x: 0.5, offset.y: 0.9, scale.x: 0.5, scale.y: 0.5} ] * * @param resource * A stream containing a text file on JSON format. * @since 3.3 * @return List of atlas information load. */ public List<GVRAtlasInformation> loadTextureAtlasInformation(GVRAndroidResource resource) throws IOException { List<GVRAtlasInformation> atlasInformation = GVRAsynchronousResourceLoader.loadAtlasInformation(resource.getStream()); resource.closeStream(); return atlasInformation; } // IO Handler for Jassimp static class ResourceStream implements AiIOStream { protected final GVRAndroidResource resource; private final ByteArrayOutputStream output = new ByteArrayOutputStream(); ResourceStream(GVRResourceVolume v, String path) throws IOException { resource = v.openResource(path); InputStream stream = resource.getStream(); if (stream == null) { throw new IOException("Cannot open " + path); } int read; byte[] data = new byte[1024]; while((read = stream.read(data, 0, data.length))!= -1) { output.write(data, 0, read); } output.flush(); resource.closeStream(); } public int getFileSize() { return output.size(); } public boolean read(ByteBuffer buffer) { if (output.size() > 0) { buffer.put(output.toByteArray()); return true; } return false; } }; // IO Handler for Jassimp static class ResourceVolumeIO implements AiIOSystem<ResourceStream> { protected Throwable lastError = null; protected final GVRResourceVolume volume; protected final HashMap<String, ResourceStream> cache = new HashMap<>(); ResourceVolumeIO(GVRResourceVolume v) { volume = v; } public char getOsSeparator() { return '/'; } public ResourceStream open(String path, String iomode) { ResourceStream rs = cache.get(path); if (rs!= null) { return rs; } try { rs = new ResourceStream(volume, path); cache.put(path, rs); return rs; } catch (IOException ex) { lastError = ex; return null; } } public void close(ResourceStream rs) { cache.remove(rs); } public boolean exists(String path) { return open(path, "r")!= null; } public Throwable getLastError() { return lastError; } }; /** * Loads a hierarchy of scene objects {@link GVRSceneObject} from a 3D model. * The model is not added to the current scene. * IAssetEvents are emitted to the event listener attached to the context. * This function blocks the current thread while loading the model * but loads the textures asynchronously in the background. * <p> * If you are loading large models, you can call {@link #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene)} * to load the model asychronously to avoid blocking the main thread. * @param filePath * A filename, relative to the root of the volume. * If the filename starts with "sd:" the file is assumed to reside on the SD Card. * If the filename starts with "http:" or "https:" it is assumed to be a URL. * Otherwise the file is assumed to be relative to the "assets" directory. * * @return A {@link GVRModelSceneObject} that contains the meshes with textures and bones * and animations. * @throws IOException if model file cannot be opened * */ public GVRModelSceneObject loadModel(final String filePath) throws IOException { return loadModel(filePath, (GVRScene) null); } /** * Loads a hierarchy of scene objects {@link GVRSceneObject} from a 3D model * and adds it to the specified scene. * IAssetEvents are emitted to event listener attached to the context. * This function blocks the current thread while loading the model * but loads the textures asynchronously in the background. * <p> * If you are loading large models, you can call {@link #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene)} * to load the model asychronously to avoid blocking the main thread. * @param filePath * A filename, relative to the root of the volume. * If the filename starts with "sd:" the file is assumed to reside on the SD Card. * If the filename starts with "http:" or "https:" it is assumed to be a URL. * Otherwise the file is assumed to be relative to the "assets" directory. * * @param scene * If present, this asset loader will wait until all of the textures have been * loaded and then it will add the model to the scene. * * @return A {@link GVRModelSceneObject} that contains the meshes with textures and bones * and animations. * @throws IOException * */ public GVRModelSceneObject loadModel(final String filePath, final GVRScene scene) throws IOException { GVRModelSceneObject model = new GVRModelSceneObject(mContext); AssetRequest assetRequest = new AssetRequest(model, new GVRResourceVolume(mContext, filePath), scene, null, false); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); assetRequest.setImportSettings(GVRImportSettings.getRecommendedSettings()); model.setName(assetRequest.getBaseName()); if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } return model; } /** * Loads a hierarchy of scene objects {@link GVRSceneObject} from a 3D model * replaces the current scene with it. * <p> * This function blocks the current thread while loading the model * but loads the textures asynchronously in the background. * IAssetEvents are emitted to the event listener attached to the context. * <p> * If you are loading large models, you can call {@link #loadScene(GVRSceneObject, GVRResourceVolume, GVRScene, IAssetEvents)} * to load the model asychronously to avoid blocking the main thread. * * @param filePath * A filename, relative to the root of the volume. * If the filename starts with "sd:" the file is assumed to reside on the SD Card. * If the filename starts with "http:" or "https:" it is assumed to be a URL. * Otherwise the file is assumed to be relative to the "assets" directory. * * @param scene * Scene to be replaced with the model. * * @return A {@link GVRModelSceneObject} that contains the meshes with textures and bones * and animations. * @throws IOException * */ public GVRModelSceneObject loadScene(final String filePath, final GVRScene scene) throws IOException { GVRModelSceneObject model = new GVRModelSceneObject(mContext); AssetRequest assetRequest = new AssetRequest(model, new GVRResourceVolume(mContext, filePath), scene, null, true); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); model.setName(assetRequest.getBaseName()); assetRequest.setImportSettings(GVRImportSettings.getRecommendedSettings()); if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } return model; } /** * Loads a hierarchy of scene objects {@link GVRSceneObject} from a 3D model * replaces the current scene with it. * <p> * This function loads the model and its textures asynchronously in the background * and will return before the model is loaded. * IAssetEvents are emitted to event listener attached to the context. * * @param model * Scene object to become the root of the loaded model. * This scene object will be named with the base filename of the loaded asset. * @param volume * A GVRResourceVolume based on the asset path to load. * This volume will be used as the base for loading textures * and other models contained within the model. * You can subclass GVRResourceVolume to provide custom IO. * @param scene * Scene to be replaced with the model. * @param handler * IAssetEvents handler to process asset loading events * @see #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene) */ public void loadScene(final GVRSceneObject model, final GVRResourceVolume volume, final GVRScene scene, final IAssetEvents handler) { Threads.spawn(new Runnable() { public void run() { AssetRequest assetRequest = new AssetRequest(model, volume, scene, handler, true); String filePath = volume.getFileName(); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); assetRequest.setImportSettings(GVRImportSettings.getRecommendedSettings()); model.setName(assetRequest.getBaseName()); try { if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } } catch (IOException ex) { // onModelError is generated in this case } } }); } /** * Loads a hierarchy of scene objects {@link GVRSceneObject} from a 3D model * replaces the current scene with it. * <p> * This function loads the model and its textures asynchronously in the background * and will return before the model is loaded. * IAssetEvents are emitted to event listener attached to the context. * * @param model * Scene object to become the root of the loaded model. * This scene object will be named with the base filename of the loaded asset. * @param volume * A GVRResourceVolume based on the asset path to load. * This volume will be used as the base for loading textures * and other models contained within the model. * You can subclass GVRResourceVolume to provide custom IO. * @param settings * Import settings controlling how assets are imported * @param scene * Scene to be replaced with the model. * @param handler * IAssetEvents handler to process asset loading events * @see #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene) */ public void loadScene(final GVRSceneObject model, final GVRResourceVolume volume, final EnumSet<GVRImportSettings> settings, final GVRScene scene, final IAssetEvents handler) { Threads.spawn(new Runnable() { public void run() { AssetRequest assetRequest = new AssetRequest(model, volume, scene, handler, true); String filePath = volume.getFileName(); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); assetRequest.setImportSettings(settings); model.setName(assetRequest.getBaseName()); try { if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } } catch (IOException ex) { // onModelError is generated in this case } } }); } /** * Loads a hierarchy of scene objects {@link GVRSceneObject} asymchronously from a 3D model * on the volume provided and adds it to the specified scene. * <p> * and will return before the model is loaded. * IAssetEvents are emitted to event listeners attached to the context. * The resource volume may reference res/raw in which case all textures * and other referenced assets must also come from res/raw. The asset loader * cannot load textures from the drawable directory. * * @param model * A GVRSceneObject to become the root of the loaded model. * @param volume * A GVRResourceVolume based on the asset path to load. * This volume will be used as the base for loading textures * and other models contained within the model. * You can subclass GVRResourceVolume to provide custom IO. * @param scene * If present, this asset loader will wait until all of the textures have been * loaded and then it will add the model to the scene. * * @see #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int) * @see #loadScene(GVRSceneObject, GVRResourceVolume, GVRScene, IAssetEvents) */ public void loadModel(final GVRSceneObject model, final GVRResourceVolume volume, final GVRScene scene) { Threads.spawn(new Runnable() { public void run() { String filePath = volume.getFileName(); AssetRequest assetRequest = new AssetRequest(model, volume, scene, null, false); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); model.setName(assetRequest.getBaseName()); assetRequest.setImportSettings(GVRImportSettings.getRecommendedSettings()); try { if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } } catch (IOException ex) { // onModelError is generated in this case. } } }); } /** * Loads a hierarchy of scene objects {@link GVRSceneObject} asymchronously from a 3D model * on the volume provided and adds it to the specified scene. * <p> * and will return before the model is loaded. * IAssetEvents are emitted to event listeners attached to the context. * The resource volume may reference res/raw in which case all textures * and other referenced assets must also come from res/raw. The asset loader * cannot load textures from the drawable directory. * * @param model * A GVRSceneObject to become the root of the loaded model. * @param volume * A GVRResourceVolume based on the asset path to load. * This volume will be used as the base for loading textures * and other models contained within the model. * You can subclass GVRResourceVolume to provide custom IO. * @param settings * Import settings controlling how assets are imported * @param scene * If present, this asset loader will wait until all of the textures have been * loaded and then it will add the model to the scene. * * @see #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int) * @see #loadScene(GVRSceneObject, GVRResourceVolume, EnumSet, GVRScene, IAssetEvents) */ public void loadModel(final GVRSceneObject model, final GVRResourceVolume volume, final EnumSet<GVRImportSettings> settings, final GVRScene scene) { Threads.spawn(new Runnable() { public void run() { String filePath = volume.getFileName(); AssetRequest assetRequest = new AssetRequest(model, volume, scene, null, false); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); model.setName(assetRequest.getBaseName()); assetRequest.setImportSettings(settings); try { if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } } catch (IOException ex) { // onModelError is generated in this case. } } }); } /** * Loads a hierarchy of scene objects {@link GVRSceneObject} from a 3D model. * <p> * This function blocks the current thread while loading the model * but loads the textures asynchronously in the background. * IAssetEvents are emitted to the event handler supplied first and then to * the event listener attached to the context. * <p> * If you are loading large models, you can call {@link #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene)} * to load the model asychronously to avoid blocking the main thread. * @param filePath * A filename, relative to the root of the volume. * If the filename starts with "sd:" the file is assumed to reside on the SD Card. * If the filename starts with "http:" or "https:" it is assumed to be a URL. * Otherwise the file is assumed to be relative to the "assets" directory. * Texture paths are relative to the directory the asset is loaded from. * * @param handler * IAssetEvents handler to process asset loading events * * @return A {@link GVRModelSceneObject} that contains the meshes with textures and bones * and animations. * @throws IOException * @see #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene) * @see #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int) */ public GVRModelSceneObject loadModel(String filePath, IAssetEvents handler) throws IOException { GVRModelSceneObject model = new GVRModelSceneObject(mContext); GVRResourceVolume volume = new GVRResourceVolume(mContext, filePath); AssetRequest assetRequest = new AssetRequest(model, volume, null, handler, false); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); model.setName(assetRequest.getBaseName()); assetRequest.setImportSettings(GVRImportSettings.getRecommendedSettings()); if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } return model; } /** * Loads a hierarchy of scene objects {@link GVRSceneObject} from a 3D model. * <p> * This function blocks the current thread while loading the model * but loads the textures asynchronously in the background. * IAssetEvents are emitted to the event handler supplied first and then to * the event listener attached to the context. * <p> * If you are loading large models, you can call {@link #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene)} * to load the model asychronously to avoid blocking the main thread. * * @param filePath * A filename, relative to the root of the volume. * If the filename starts with "sd:" the file is assumed to reside on the SD Card. * If the filename starts with "http:" or "https:" it is assumed to be a URL. * Otherwise the file is assumed to be relative to the "assets" directory. * Texture paths are relative to the directory the asset is loaded from. * * @param settings * Additional import {@link GVRImportSettings settings} * * @param cacheEnabled * If true, add the model's textures to the texture cache. * * @param scene * If present, this asset loader will wait until all of the textures have been * loaded and then adds the model to the scene. * * @return A {@link GVRModelSceneObject} that contains the meshes with textures and bones * and animations. * @throws IOException * @see #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene) * @see #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int) */ public GVRModelSceneObject loadModel(String filePath, EnumSet<GVRImportSettings> settings, boolean cacheEnabled, GVRScene scene) throws IOException { String ext = filePath.substring(filePath.length() - 3).toLowerCase(); GVRModelSceneObject model = new GVRModelSceneObject(mContext); AssetRequest assetRequest = new AssetRequest(model, new GVRResourceVolume(mContext, filePath), scene, null, false); model.setName(assetRequest.getBaseName()); assetRequest.setImportSettings(settings); assetRequest.useCache(cacheEnabled); if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } return model; } /** * Loads a hierarchy of scene objects {@link GVRSceneObject} from a 3D model * inside an Android resource. * <p> * This function blocks the current thread while loading the model * but loads the textures asynchronously in the background. * IAssetEvents are emitted to the event handler supplied first and then to * the event listener attached to the context. * <p> * If you are loading large models, you can call {@link #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene)} * to load the model asychronously to avoid blocking the main thread. * @param resource * GVRAndroidResource describing the asset. If it is a resource ID, * the file it references must have a valid extension because the * extension is used to determine what type of 3D file it is. * The resource may be from res/raw in which case all textures * and other referenced assets must also come from res/raw. * This function cannot load textures from the drawable directory - they must * be in res/raw. * * @param settings * Additional import {@link GVRImportSettings settings} * * @param cacheEnabled * If true, add the model's textures to the texture cache. * * @param scene * If present, this asset loader will wait until all of the textures have been * loaded and then add the model to the scene. * * @return A {@link GVRModelSceneObject} that contains the meshes with textures and bones * and animations. * @throws IOException * @see #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene) * @see #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int) */ public GVRModelSceneObject loadModel(GVRAndroidResource resource, EnumSet<GVRImportSettings> settings, boolean cacheEnabled, GVRScene scene) throws IOException { String filePath = resource.getResourceFilename(); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); GVRModelSceneObject model = new GVRModelSceneObject(mContext); GVRResourceVolume volume = new GVRResourceVolume(mContext, resource); AssetRequest assetRequest = new AssetRequest(model, volume, scene, null, false); if (!cacheEnabled) { assetRequest.disableTextureCache(); } model.setName(assetRequest.getBaseName()); assetRequest.setImportSettings(settings); assetRequest.useCache(cacheEnabled); if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } return model; } /** * Loads a scene object {@link GVRSceneObject} asynchronously from * a 3D model and raises asset events to a handler. * <p> * This function is a good choice for loading assets because * it does not block the thread from which it is initiated. * Instead, it runs the load request on a background thread * and issues events to the handler provided. * </p> * * @param fileVolume * GVRResourceVolume with the path to the model to load. * The filename is relative to the root of this volume. * The volume will be used to load models referenced by this model. * * @param model * {@link GVRModelSceneObject} that is the root of the hierarchy generated * by loading the 3D model. * * @param settings * Additional import {@link GVRImportSettings settings} * * @param cacheEnabled * If true, add the model's textures to the texture cache * * @param handler * IAssetEvents handler to process asset loading events * @see IAssetEvents #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int) */ public void loadModel(final GVRResourceVolume fileVolume, final GVRSceneObject model, final EnumSet<GVRImportSettings> settings, final boolean cacheEnabled, final IAssetEvents handler) { Threads.spawn(new Runnable() { public void run() { String filePath = fileVolume.getFileName(); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); AssetRequest assetRequest = new AssetRequest(model, fileVolume, null, handler, false); model.setName(assetRequest.getBaseName()); assetRequest.setImportSettings(settings); assetRequest.useCache(cacheEnabled); try { if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } } catch (IOException ex) { // onModelError is generated in this case } } }); } /** * Loads a file as a {@link GVRMesh}. * * Note that this method can be quite slow; we recommend never calling it * from the GL thread. The asynchronous version * {@link #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int)} is * better because it moves most of the work to a background thread, doing as * little as possible on the GL thread. * * @param androidResource * Basically, a stream containing a 3D model. The * {@link GVRAndroidResource} class has six constructors to * handle a wide variety of Android resource types. Taking a * {@code GVRAndroidResource} here eliminates six overloads. * @return The file as a GL mesh or null if mesh cannot be loaded. * * @since 1.6.2 */ public GVRMesh loadMesh(GVRAndroidResource androidResource) { return loadMesh(androidResource, GVRImportSettings.getRecommendedSettings()); } /** * Loads a {@link GVRMesh} from a 3D asset file synchronously. * <p> * It uses {@link #loadModel(GVRAndroidResource, EnumSet, boolean, GVRScene)} * internally to load the asset and then inspects the file to find the first mesh. * Note that this method can be quite slow; we recommend never calling it * from the GL thread. * The asynchronous version * {@link #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int)} is * better because it moves most of the work to a background thread, doing as * little as possible on the GL thread. * <p> * If you want to load a 3D model which has multiple meshes, the best choices are * {@link #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene)} which loads a * 3D model under the scene object you provide and adds it to the given scene or * {@link #loadScene(GVRSceneObject, GVRResourceVolume, GVRScene, IAssetEvents)} * which replaces the current scene with the 3D model. * </p> * @param androidResource * Basically, a stream containing a 3D model. The * {@link GVRAndroidResource} class has six constructors to * handle a wide variety of Android resource types. Taking a * {@code GVRAndroidResource} here eliminates six overloads. * * @param settings * Additional import {@link GVRImportSettings settings}. * @return The file as a GL mesh or null if mesh cannot be loaded. * * @since 3.3 * @see #loadScene(GVRSceneObject, GVRResourceVolume, GVRScene, IAssetEvents) * @see #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene) * @see #findMesh(GVRSceneObject) */ public GVRMesh loadMesh(GVRAndroidResource androidResource, EnumSet<GVRImportSettings> settings) { GVRMesh mesh = mMeshCache.get(androidResource); if (mesh == null) { try { GVRSceneObject model = loadModel(androidResource, settings, true, null); mesh = findMesh(model); if (mesh!= null) { mMeshCache.put(androidResource, mesh); } else { throw new IOException("No mesh found in model " + androidResource.getResourceFilename()); } } catch (IOException ex) { mContext.getEventManager().sendEvent(this, IAssetEvents.class, "onModelError", new Object[] { mContext, ex.getMessage(), androidResource.getResourceFilename()}); return null; } } return mesh; } /** * Finds the first mesh in the given model. * @param model root of a model loaded by the asset loader. * @return GVRMesh found or null if model does not contain meshes * @see #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int) */ public GVRMesh findMesh(GVRSceneObject model) { class MeshFinder implements GVRSceneObject.ComponentVisitor { private GVRMesh meshFound = null; public GVRMesh getMesh() { return meshFound; } public boolean visit(GVRComponent comp) { GVRRenderData rdata = (GVRRenderData) comp; meshFound = rdata.getMesh(); return (meshFound == null); } }; MeshFinder findMesh = new MeshFinder(); model.forAllComponents(findMesh, GVRRenderData.getComponentType()); return findMesh.getMesh(); } /** * Loads a mesh file, asynchronously, at an explicit priority. * <p> * This method is generally going to be the most convenient for * asynchronously loading a single mesh from a 3D asset file. * It uses {@link #loadModel(GVRAndroidResource, EnumSet, boolean, GVRScene)} * internally to load the asset and then inspects the file to find the first mesh. * <p> * To asynchronously load an entire 3D model, you should use {@link #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene)}. * It does not require a callback. Instead you pass it an existing scene object and it loads the model * under tha node. * <p> * Model and mesh loading can take * hundreds - and even thousands - of milliseconds, and so should not be * done on the GL thread in either {@link GVRMain#onInit(GVRContext) * onInit()} or {@link GVRMain#onStep() onStep()} unless you use the asychronous functions. * <p> * This function improves throughput in three ways. First, by * doing all the work on a background thread, then delivering the loaded * mesh to the GL thread on a {@link GVRContext#runOnGlThread(Runnable) * runOnGlThread()} callback. Second, it uses a throttler to avoid * overloading the system and/or running out of memory. Third, it does *'request consolidation' - if you issue any requests for a particular file * while there is still a pending request, the file will only be read once, * and each callback will get the same {@link GVRMesh}. * * @param callback * App supplied callback, with three different methods. * <ul> * <li>Before loading, GVRF may call * {@link GVRAndroidResource.MeshCallback#stillWanted(GVRAndroidResource) * stillWanted()} (on a background thread) to give you a chance * to abort a'stale' load. * * <li>Successful loads will call * {@link GVRAndroidResource.Callback#loaded(GVRHybridObject, GVRAndroidResource) * loaded()} on the GL thread. * * <li>Any errors will call * {@link GVRAndroidResource.MeshCallback#failed(Throwable, GVRAndroidResource) * failed(),} with no promises about threading. * </ul> * @param resource * Basically, a stream containing a 3D model. The * {@link GVRAndroidResource} class has six constructors to * handle a wide variety of Android resource types. Taking a * {@code GVRAndroidResource} here eliminates six overloads. * @param priority * This request's priority. Please see the notes on asynchronous * priorities in the <a href="package-summary.html#async">package * description</a>. * * @throws IllegalArgumentException * If either {@code callback} or {@code resource} is * {@code null}, or if {@code priority} is out of range - or if * you 'abuse' request consolidation by passing the same * {@link GVRAndroidResource} descriptor to multiple load calls. * <p> * It's fairly common for multiple scene objects to use the same * texture or the same mesh. Thus, if you try to load, say, * {@code R.raw.whatever} while you already have a pending * request for {@code R.raw.whatever}, it will only be loaded * once; the same resource will be used to satisfy both (all) * requests. This "consolidation" uses * {@link GVRAndroidResource#equals(Object)}, <em>not</em> * {@code ==} (aka "reference equality"): The problem with using * the same resource descriptor is that if requests can't be * consolidated (because the later one(s) came in after the * earlier one(s) had already completed) the resource will be * reloaded... but the original descriptor will have been * closed. * @since 3.3 * @see #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene) * @see #loadScene(GVRSceneObject, GVRResourceVolume, GVRScene, IAssetEvents) */ public void loadMesh(GVRAndroidResource.MeshCallback callback, GVRAndroidResource resource, int priority) throws IllegalArgumentException { GVRAsynchronousResourceLoader.loadMesh(mContext, callback, resource, priority); } /** * Loads a scene object {@link GVRSceneObject} from a 3D model. * * @param request * AssetRequest with the filename, relative to the root of the volume. * @param model * GVRModelSceneObject that is the root of the loaded asset * @return A {@link GVRModelSceneObject} that contains the meshes with textures and bones * and animations. * @throws IOException * */ private GVRSceneObject loadJassimpModel(AssetRequest request, GVRSceneObject model) throws IOException { Jassimp.setWrapperProvider(GVRJassimpAdapter.sWrapperProvider); org.gearvrf.jassimp.AiScene assimpScene = null; String filePath = request.getBaseName(); GVRJassimpAdapter jassimpAdapter = new GVRJassimpAdapter(this, filePath); model.setName(filePath); ResourceVolumeIO jassimpIO = new ResourceVolumeIO(request.getVolume()); try { assimpScene = Jassimp.importFile(FileNameUtils.getFilename(filePath), jassimpAdapter.toJassimpSettings(request.getImportSettings()), jassimpIO); } catch (IOException ex) { String errmsg = "Cannot load model: " + ex.getMessage() + " " + jassimpIO.getLastError(); request.onModelError(mContext, errmsg, filePath); throw new IOException(errmsg); } if (assimpScene == null) { String errmsg = "Cannot load model: " + filePath; request.onModelError(mContext, errmsg, filePath); throw new IOException(errmsg); } boolean startAnimations = request.getImportSettings().contains(GVRImportSettings.START_ANIMATIONS); jassimpAdapter.processScene(request, model, assimpScene, request.getVolume(), startAnimations); request.onModelLoaded(mContext, model, filePath); return model; } GVRSceneObject loadX3DModel(GVRAssetLoader.AssetRequest assetRequest, GVRSceneObject root) throws IOException { Method loadMethod = null; try { final Class<?> loaderClass = Class.forName("org.gearvrf.x3d.X3DLoader"); loadMethod = loaderClass.getDeclaredMethod("load", GVRContext.class, GVRAssetLoader.AssetRequest.class, GVRSceneObject.class); } catch (Exception e) { throw new IOException("X3D extension not available; can't load X3D models! " + e); } try { return (GVRSceneObject) loadMethod.invoke(null, mContext, assetRequest, root); } catch (InvocationTargetException te) { Throwable e = te.getCause(); Throwable cause = (e!= null)? e : te; throw new IOException("Cannot load X3D model: " + cause); } catch (IllegalAccessException ae) { throw new IOException("Cannot load X3D model: " + ae); } } public static File downloadFile(Context context, String urlString) { URL url = null; try { url = new URL(urlString); } catch (IOException e) { Log.e(TAG, "URL error: ", urlString); return null; } String directoryPath = context.getCacheDir().getAbsolutePath(); // add a uuid value for the url to prevent aliasing from files sharing // same name inside one given app String outputFilename = directoryPath + File.separator + UUID.nameUUIDFromBytes(urlString.getBytes()).toString() + FileNameUtils.getURLFilename(urlString); Log.d(TAG, "URL filename: %s", outputFilename); File localCopy = new File(outputFilename); if (localCopy.exists()) { return localCopy; } InputStream input = null; // Output stream to write file OutputStream output = null; try { input = new BufferedInputStream(url.openStream(), 8192); output = new FileOutputStream(outputFilename); byte data[] = new byte[1024]; int count; while ((count = input.read(data))!= -1) { // writing data to file output.write(data, 0, count); } } catch (IOException e) { Log.e(TAG, "Failed to download: ", urlString); return null; } finally { if (input!= null) { try { input.close(); } catch (IOException e) { } } if (output!= null) { try { output.close(); } catch (IOException e) { } } } return new File(outputFilename); } public GVRTextureParameters getDefaultTextureParameters() { return mDefaultTextureParameters; } private final static String TAG = "GVRAssetLoader"; } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncCubemapTexture.java ======================= /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.asynchronous; import java.io.IOException; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import org.gearvrf.GVRAndroidResource; import org.gearvrf.GVRAndroidResource.CancelableCallback; import org.gearvrf.GVRContext; import org.gearvrf.GVRCubemapImage; import org.gearvrf.asynchronous.Throttler.AsyncLoader; import org.gearvrf.asynchronous.Throttler.AsyncLoaderFactory; import org.gearvrf.asynchronous.Throttler.GlConverter; import org.gearvrf.utility.FileNameUtils; import android.graphics.Bitmap; import android.graphics.BitmapFactory; /** * Async resource loading: cube map textures. * * Since ZipInputStream does not support mark() and reset(), we directly use * BitmapFactory.decodeStream() in loadResource(). * * @since 1.6.9 */ class AsyncCubemapTexture { private static final String TAG = AsyncCubemapTexture.class.getSimpleName(); /* * The API */ static void loadTexture(GVRContext gvrContext, CancelableCallback<GVRCubemapImage> callback, GVRAndroidResource resource, int priority, Map<String, Integer> map) { faceIndexMap = map; AsyncManager.get().getScheduler().registerCallback(gvrContext, TEXTURE_CLASS, callback, resource, priority); } private static Map<String, Integer> faceIndexMap; private static final Class<GVRCubemapImage> TEXTURE_CLASS = GVRCubemapImage.class; /* * Singleton */ private static AsyncCubemapTexture sInstance = new AsyncCubemapTexture(); /** * Gets the {@link AsyncCubemapTexture} singleton for loading bitmap textures. * @return The {@link AsyncCubemapTexture} singleton. */ public static AsyncCubemapTexture get() { return sInstance; } private AsyncCubemapTexture() { AsyncManager.get().registerDatatype(TEXTURE_CLASS, new AsyncLoaderFactory<GVRCubemapImage, Bitmap[]>() { @Override AsyncLoader<GVRCubemapImage, Bitmap[]> threadProc( GVRContext gvrContext, GVRAndroidResource request, CancelableCallback<GVRCubemapImage> cancelableCallback, int priority) { return new AsyncLoadCubemapTextureResource(gvrContext, request, cancelableCallback, priority); } }); } /* * Asynchronous loader for uncompressed cubemap */ private static class AsyncLoadCubemapTextureResource extends AsyncLoader<GVRCubemapImage, Bitmap[]> { private static final GlConverter<GVRCubemapImage, Bitmap[]> sConverter = new GlConverter<GVRCubemapImage, Bitmap[]>() { @Override public GVRCubemapImage convert(GVRContext gvrContext, Bitmap[] bitmapArray) { return new GVRCubemapImage(gvrContext, bitmapArray); } }; protected AsyncLoadCubemapTextureResource(GVRContext gvrContext, GVRAndroidResource request, CancelableCallback<GVRCubemapImage> callback, int priority) { super(gvrContext, sConverter, request, callback); } @Override protected Bitmap[] loadResource() throws IOException { Bitmap[] bitmapArray = new Bitmap[6]; ZipInputStream zipInputStream = null; try { ZipEntry zipEntry = null; zipInputStream = new ZipInputStream(resource.getStream()); while ((zipEntry = zipInputStream.getNextEntry())!= null) { String imageName = zipEntry.getName(); String imageBaseName = FileNameUtils.getBaseName(imageName); Integer imageIndex = faceIndexMap.get(imageBaseName); if (imageIndex == null) { continue; } bitmapArray[imageIndex] = BitmapFactory .decodeStream(zipInputStream); } for(int i=0; i < bitmapArray.length; i++) { if(bitmapArray[i] == null) { for(Map.Entry<String,Integer> entry:faceIndexMap.entrySet()) { if(entry.getValue() == i) { throw new IllegalArgumentException("Could not find texture " + "corresponding to " + entry.getKey() + " in the cubemap " + "texture"); } } } } } finally { zipInputStream.close(); resource.closeStream(); } return bitmapArray; } } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/utility/RecycleBin.java ======================= <filename>GVRf/Framework/framework/src/main/java/org/gearvrf/utility/RecycleBin.java /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.utility; import java.lang.ref.Reference; import java.lang.ref.SoftReference; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; /** * A recycle bin is a place you can put buffers and other data structures that * you would just as soon not allocate again if you don't have to. It's not * keyed like a cache, though. * * <p> * This class is a recycle bin generator: regular reference bins, soft reference * bins, and weak reference bins. * * <p> * Regular references are sometimes called hard references. The garbage * collector looks at them, and keeps their referent in memory. * * <p> * A soft reference is a special class that tells the garbage collector that it * can free the referent, if it has to, but you'd really rather it didn't. If * the garbage collector does free the referent, it will update the soft * reference, so you can always tell whether your soft cached item is still in * memory. * * <p> * A weak reference is another special class. The garbage collector will free * its referent in the next garbage collection, just as if there were no * reference at all, but it will update the soft reference, so you can always * tell whether your weak cached item is still in memory. * * @param <T> * Item to bin. */ public abstract class RecycleBin<T> { /** * Get and remove an item from the bin, or return null. * * @return Cached item, or null */ public abstract T get(); /** * Add an item to the bin. Bin makes no attempt to reset values. * * @param item * Data structure you could reuse */ public abstract void put(T item); /** Returns a wrapper that synchronizes get and put operations */ public RecycleBin<T> synchronize() { return new SynchronizedRecycleBin<T>(this); } /** * A hard reference bin. Being in this bin will keep an X from being freed. * * @param <X> * Type of data to bin * @return A hard RecycleBin<X> */ public static <X> RecycleBin<X> hard() { return new RegularReferenceBin<X>(); } /** * A soft reference bin. Being in this bin is a hint to the garbage * collector that we would really prefer that these X were not freed. * * @param <X> * Type of data to bin * @return A soft RecycleBin<X> */ public static <X> RecycleBin<X> soft() { return new SpecialReferenceBin.Soft<X>(); } /** * A weak reference bin. Being in this bin will not keep an X from being * freed at the next garbage collection. * * @param <X> * Type of data to bin * @return A weak RecycleBin<X> */ public static <X> RecycleBin<X> weak() { return new SpecialReferenceBin.Weak<X>(); } private static class RegularReferenceBin<T> extends RecycleBin<T> { private List<T> bin = new ArrayList<T>(); @Override public T get() { int size = bin.size(); if (size <= 0) { return null; } else { T item = bin.get(size - 1); bin.remove(size - 1); return item; } } @Override public void put(T item) { bin.add(item); } } private static abstract class SpecialReferenceBin<T> extends RecycleBin<T> { protected Set<Reference<T>> bin = new HashSet<Reference<T>>(); @Override public T get() { T result = null; Reference<T> resultReference = null; List<Reference<T>> dereferenced = new ArrayList<Reference<T>>( bin.size()); for (Reference<T> reference : bin) { T referent = reference.get(); if (referent!= null) { result = referent; resultReference = reference; break; } else { dereferenced.add(reference); } } bin.removeAll(dereferenced); bin.remove(resultReference); return result; } private static class Soft<T> extends SpecialReferenceBin<T> { @Override public void put(T item) { bin.add(new SoftReference<T>(item)); } } private static class Weak<T> extends SpecialReferenceBin<T> { @Override public void put(T item) { bin.add(new WeakReference<T>(item)); } } } private static class SynchronizedRecycleBin<T> extends RecycleBin<T> { private final RecycleBin<T> bin; public SynchronizedRecycleBin(RecycleBin<T> bin) { this.bin = bin; } @Override public synchronized T get() { return bin.get(); } @Override public synchronized void put(T item) { bin.put(item); } } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncCompressedTexture.java ======================= /* Copyright 2016 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.asynchronous; import java.io.IOException; import org.gearvrf.GVRAndroidResource; import org.gearvrf.GVRCompressedImage; import org.gearvrf.GVRContext; import org.gearvrf.GVRAndroidResource.CancelableCallback; import org.gearvrf.asynchronous.Throttler.AsyncLoader; import org.gearvrf.asynchronous.Throttler.AsyncLoaderFactory; import org.gearvrf.asynchronous.Throttler.GlConverter; import org.gearvrf.utility.Log; /** * Async resource loading: compressed textures. * */ class AsyncCompressedTexture { /* * The API */ static void loadTexture(GVRContext gvrContext, CancelableCallback<GVRCompressedImage> callback, GVRAndroidResource resource, int priority) { AsyncManager.get().getScheduler().registerCallback(gvrContext, TEXTURE_CLASS, callback, resource, priority); } /* * Singleton */ private static final Class<GVRCompressedImage> TEXTURE_CLASS = GVRCompressedImage.class; private static AsyncCompressedTexture sInstance = new AsyncCompressedTexture(); /** * Gets the {@link AsynCompressedTexture} singleton for loading compressed textures. * * @return The {@link AsynCompressedTexture} singleton. */ public static AsyncCompressedTexture get() { return sInstance; } private AsyncCompressedTexture() { AsyncManager.get().registerDatatype(TEXTURE_CLASS, new AsyncLoaderFactory<GVRCompressedImage, CompressedTexture>() { @Override AsyncLoader<GVRCompressedImage, CompressedTexture> threadProc( GVRContext gvrContext, GVRAndroidResource request, CancelableCallback<GVRCompressedImage> callback, int priority) { return new AsyncLoadTextureResource(gvrContext, request, callback, priority); } }); } /* * Asynchronous loader */ private static class AsyncLoadTextureResource extends AsyncLoader<GVRCompressedImage, CompressedTexture> { private static final GlConverter<GVRCompressedImage, CompressedTexture> sConverter = new GlConverter<GVRCompressedImage, CompressedTexture>() { @Override public GVRCompressedImage convert(GVRContext gvrContext, CompressedTexture compressedTexture) { return compressedTexture == null? null : compressedTexture.toTexture(gvrContext, GVRCompressedImage.BALANCED); } }; protected AsyncLoadTextureResource(GVRContext gvrContext, GVRAndroidResource request, CancelableCallback<GVRCompressedImage> callback, int priority) { super(gvrContext, sConverter, request, callback); } @Override protected CompressedTexture loadResource() { GVRCompressedTextureLoader loader = resource.getCompressedLoader(); CompressedTexture compressedTexture = null; try { compressedTexture = CompressedTexture .parse(resource.getStream(), false, loader); Log.d("ASYNC", "parse compressed texture %s", resource); } catch (IOException e) { e.printStackTrace(); } finally { resource.closeStream(); } return compressedTexture; } } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiClassLoaderIOSystem.java ======================= <gh_stars>100-1000 /* --------------------------------------------------------------------------- Open Asset Import Library - Java Binding (jassimp) --------------------------------------------------------------------------- Copyright (c) 2006-2017, 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. --------------------------------------------------------------------------- */ package org.gearvrf.jassimp; import java.io.IOException; import java.io.InputStream; import java.net.URL; /** * IOSystem based on the Java classloader.<p> * * This IOSystem allows loading models directly from the * classpath. No extraction to the file system is * necessary. * * @author <NAME> * */ public class AiClassLoaderIOSystem implements AiIOSystem<AiInputStreamIOStream> { private final Class<?> clazz; private final ClassLoader classLoader; /** * Construct a new AiClassLoaderIOSystem.<p> * * This constructor uses a ClassLoader to resolve * resources. * * @param classLoader classLoader to resolve resources. */ public AiClassLoaderIOSystem(ClassLoader classLoader) { this.clazz = null; this.classLoader = classLoader; } /** * Construct a new AiClassLoaderIOSystem.<p> * * This constructor uses a Class to resolve * resources. * * @param class<?> class to resolve resources. */ public AiClassLoaderIOSystem(Class<?> clazz) { this.clazz = clazz; this.classLoader = null; } @Override public AiInputStreamIOStream open(String filename, String ioMode) { try { InputStream is; if(clazz!= null) { is = clazz.getResourceAsStream(filename); } else if (classLoader!= null) { is = classLoader.getResourceAsStream(filename); } else { System.err.println("[" + getClass().getSimpleName() + "] No class or classLoader provided to resolve " + filename); return null; } if(is!= null) { return new AiInputStreamIOStream(is); } else { System.err.println("[" + getClass().getSimpleName() + "] Cannot find " + filename); return null; } } catch (IOException e) { e.printStackTrace(); return null; } } @Override public void close(AiInputStreamIOStream file) { } @Override public boolean exists(String path) { URL url = null; if(clazz!= null) { url = clazz.getResource(path); } else if (classLoader!= null) { url = classLoader.getResource(path); } if(url == null) { return false; } else { return true; } } @Override public char getOsSeparator() { return '/'; } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/IViewEvents.java ======================= /* Copyright 2016 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf; import android.view.View; import org.gearvrf.scene_objects.GVRViewSceneObject; /** * This interface defines the callback interface of an Android {@code View} * that is inflated by a {@link GVRViewSceneObject}. */ public interface IViewEvents extends IEvents { void onInitView(GVRViewSceneObject sceneObject, View view); void onStartRendering(GVRViewSceneObject sceneObject, View view); } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncBitmapTexture.java ======================= <gh_stars>100-1000 /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.asynchronous; import static android.opengl.GLES20.GL_MAX_TEXTURE_SIZE; import static android.opengl.GLES20.GL_NO_ERROR; import static android.opengl.GLES20.glGetError; import static android.opengl.GLES20.glGetIntegerv; import static org.gearvrf.utility.Threads.threadId; import java.io.FileDescriptor; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import org.gearvrf.GVRAndroidResource; import org.gearvrf.GVRAndroidResource.CancelableCallback; import org.gearvrf.GVRBitmapImage; import org.gearvrf.GVRContext; import org.gearvrf.asynchronous.Throttler.AsyncLoader; import org.gearvrf.asynchronous.Throttler.AsyncLoaderFactory; import org.gearvrf.asynchronous.Throttler.GlConverter; import org.gearvrf.utility.Exceptions; import org.gearvrf.utility.Log; import org.gearvrf.utility.RecycleBin; import org.gearvrf.utility.Threads; import android.app.Activity; import android.app.ActivityManager; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.BitmapFactory; import android.graphics.BitmapFactory.Options; import android.graphics.BitmapRegionDecoder; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; import android.view.Display; import android.view.WindowManager; import android.content.pm.ApplicationInfo; /** * Async resource loading: bitmap textures. * * <p> * Should always call either {@link #setup(Context)} or * {@link #setup(Context, ImageSizePolicy)} before first use; the default * settings are very conservative, and will usually give much smaller textures * than necessary. * * @since 1.6.1 */ class AsyncBitmapTexture { /* * The API */ static void loadTexture(GVRContext gvrContext, CancelableCallback<GVRBitmapImage> callback, GVRAndroidResource resource, int priority) { AsyncManager.get().getScheduler().registerCallback(gvrContext, TEXTURE_CLASS, callback, resource, priority); } private static final Class<GVRBitmapImage> TEXTURE_CLASS = GVRBitmapImage.class; /* * Singleton */ private static AsyncBitmapTexture sInstance = new AsyncBitmapTexture(); /** * Gets the {@link AsyncBitmapTexture} singleton for loading bitmap textures. * @return The {@link AsyncBitmapTexture} singleton. */ public static AsyncBitmapTexture get() { return sInstance; } private AsyncBitmapTexture() { AsyncManager.get().registerDatatype(TEXTURE_CLASS, new AsyncLoaderFactory<GVRBitmapImage, Bitmap>() { @Override AsyncLoader<GVRBitmapImage, Bitmap> threadProc(GVRContext gvrContext, GVRAndroidResource request, CancelableCallback<GVRBitmapImage> callback, int priority) { return new AsyncLoadTextureResource(gvrContext, request, callback, priority); } }); } /* * Static constants */ private static final String TAG = Log.tag(AsyncBitmapTexture.class); /** Ridiculous amounts of detail about decodeFile() */ protected static final boolean VERBOSE_DECODE = false; private static final int DECODE_BUFFER_SIZE = 1024 * 16; protected static final boolean RUNTIME_ASSERTIONS = Threads.RUNTIME_ASSERTIONS; protected static final boolean CHECK_ARGUMENTS = Threads.RUNTIME_ASSERTIONS; /** A very low value, for testing */ private static final int DEFAULT_GL_MAX_TEXTURE_SIZE = 1024; /** * Can only load textures whose width and height are both less than * {@link #glMaxTextureSize}. The default value is almost certainly too * small; the actual value is set by {@link #onGlInitialization()} */ static int glMaxTextureSize = DEFAULT_GL_MAX_TEXTURE_SIZE; /** * Largest image that we will load into memory. * * A multiple of the "memory class" - <i>e.g.</i> 7.5% of a 32M heap is a * 2.4M image; 6% is 1.92M */ private static final float MAXIMUM_IMAGE_FACTOR = 0.625f; /** * When {@link #fractionalDecode(FractionalDecodeShim, Options, int, int)} * reads large bitmaps one'stripe' at a time, this is the maximum number of * pixels in a stripe. */ private static final int SLICE_SIZE = 1024 * 1024; /* * static field(s) and setup */ /** * After {@link #setup(Context)} has been called, the computed maximum image * size, in bytes. Compiled in value allows image loading to work (albeit * with very conservative default settings) if setup() is not called. */ protected static int maxImageSize = 1024 * 1024; // bytes /** * Either {@link #setup(Context)} or * {@link #setup(Context, ImageSizePolicy)} <em>should</em> be called before * first use; the default settings are very conservative, and will usually * give much smaller textures than necessary. */ static Context setup(GVRContext context) { return setup(context, null); } /** * Either {@link #setup(Context)} or * {@link #setup(Context, ImageSizePolicy)} <em>should</em> be called before * first use; the default settings are very conservative, and will usually * give much smaller textures than necessary. */ static Context setup(GVRContext gvrContext, ImageSizePolicy sizePolicy) { Context androidContext = gvrContext.getContext(); Memory.setup(androidContext); if (sizePolicy == null) { sizePolicy = new DefaultImageSizePolicy(); } Context applicationContext = androidContext.getApplicationContext(); // Should only be null in a unit test applicationContext = applicationContext == null? androidContext : applicationContext; getScreenSize(applicationContext); int heapSize = Memory.getMemoryClass(); maxImageSize = (int) (heapSize * sizePolicy.getMaximumImageFactor()); Log.d(TAG, "Set maxImageSize == %, d", maxImageSize); gvrContext.runOnGlThread(new Runnable() { @Override public void run() { onGlInitialization(); } }); return applicationContext; } /** * Returns screen height and width * * @param context * Any non-null Android Context * @return.x is screen width;.y is screen height. */ private static Point getScreenSize(Context context) { return getScreenSize(context, null); } /** * Returns screen height and width * * @param context * Any non-null Android Context * @param p * Optional Point to reuse. If null, a new Point will be created. * @return.x is screen width;.y is screen height. */ private static Point getScreenSize(Context context, Point p) { if (p == null) { p = new Point(); } WindowManager windowManager = (WindowManager) context .getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); display.getSize(p); return p; } /** * This method must be called, on the GL thread, at least once after * initialization: it is safe to call it more than once. * * Not calling this method leaves {@link #glMaxTextureSize} set to a default * value, which may be smaller than necessary. */ private static void onGlInitialization() { if (glUninitialized) { glGetError(); // reset any previous error int[] size = new int[] { -1 }; glGetIntegerv(GL_MAX_TEXTURE_SIZE, size, 0); int errorCode = glGetError(); if (errorCode!= GL_NO_ERROR) { throw Exceptions.RuntimeAssertion( "Error %d getting max texture size", errorCode); } int maxTextureSize = size[0]; if (maxTextureSize <= 0) { throw Exceptions.RuntimeAssertion( "Invalid max texture size %d", maxTextureSize); } glMaxTextureSize = maxTextureSize; Log.d(TAG, "Actual GL_MAX_TEXTURE_SIZE = %d", glMaxTextureSize); glUninitialized = false; } } private static boolean glUninitialized = true; private static class DefaultImageSizePolicy implements ImageSizePolicy { @Override public float getMaximumImageFactor() { return MAXIMUM_IMAGE_FACTOR; } } private static class Memory { private static final String TAG = Log.tag(Memory.class); private static int memoryClass = 0; /** * Unit tests may create mainActivity several times in the same process. * We don't want to run setup more than once. */ private static boolean initialized = false; /** * {@link #getMemoryClass()} will not be accurate until you call * {@link #setup(Context)} */ static synchronized void setup(Context context) { if (initialized) { return; } getMemoryClass(context); initialized = true; } private static void getMemoryClass(Context context) { ActivityManager activityManager = (ActivityManager) context .getSystemService(Activity.ACTIVITY_SERVICE); ApplicationInfo info = context.getApplicationInfo(); if((info.flags & ApplicationInfo.FLAG_LARGE_HEAP) == ApplicationInfo.FLAG_LARGE_HEAP) { memoryClass = activityManager.getLargeMemoryClass() * 1024 * 1024; } else { memoryClass = activityManager.getMemoryClass() * 1024 * 1024; } Log.d(TAG, "MemoryClass = %dM", memoryClass / (1024 * 1024)); } /** Heap size, in bytes */ static int getMemoryClass() { return memoryClass; } } /* * Asynchronous loader */ private static class AsyncLoadTextureResource extends AsyncLoader<GVRBitmapImage, Bitmap> { private static final GlConverter<GVRBitmapImage, Bitmap> sConverter = new GlConverter<GVRBitmapImage, Bitmap>() { @Override public GVRBitmapImage convert(GVRContext gvrContext, Bitmap bitmap) { return new GVRBitmapImage(gvrContext, bitmap); } }; protected AsyncLoadTextureResource(GVRContext gvrContext, GVRAndroidResource request, CancelableCallback<GVRBitmapImage> callback, int priority) { super(gvrContext, sConverter, request, callback); } @Override protected Bitmap loadResource() throws IOException { Bitmap bitmap; String resourceName = resource.getResourceFilename(); if (resourceName.toLowerCase().endsWith("tga")) { // decodeStream for sure do not support tga bitmap = decodeStreamTGA(resource.getStream()); } else { bitmap = decodeStream(resource.getStream(), glMaxTextureSize, glMaxTextureSize, true, null, false); } resource.closeStream(); return bitmap; } } static Bitmap decodeStreamTGA(InputStream stream) throws IOException { Bitmap bitmap = null; byte[] headerTGA = new byte[18]; stream.read(headerTGA); int type = headerTGA[2] & 0xFF; // uncompressed RGB tga if (type == 2) { int depth = headerTGA[16] & 0xFF; int descriptor = headerTGA[17] & 0xFF; int width = (headerTGA[12] & 0xFF) | (headerTGA[13] & 0xFF) << 8; int height = (headerTGA[14] & 0xFF) | (headerTGA[15] & 0xFF) << 8; try { bitmap = decodeStreamRGB(stream, width, height, depth, descriptor); } catch (Exception ex) { Log.d(TAG, "Exception reading TGA file" + ex.getMessage()); } } else { Log.d(TAG, "TGA format not supported: type is not uncompressed RGB"); } return bitmap; } private static final int RIGHT_ORIGIN = 0x10; private static final int UPPER_ORIGIN = 0x20; static Bitmap decodeStreamRGB(InputStream stream, int width, int height, int depth, int descriptor) throws IOException { Bitmap bitmap = null; byte rgb[]; byte data[]; int currentHeight = 0; int size = width * height * 4; int t; if (depth == 24) { rgb = new byte[size]; data = new byte[width * 3]; if ((descriptor & RIGHT_ORIGIN) == 0) { if ((descriptor & UPPER_ORIGIN)!= 0) { currentHeight = 0; while ((currentHeight < height) && (stream.read(data)!= -1)) { for (int i = 0; i < width; i++) { byte r = data[i * 3 + 0]; byte g = data[i * 3 + 1]; byte b = data[i * 3 + 2]; byte a = (byte) 0xFF; t = (width * currentHeight + i) * 4; rgb[t + 0] = b; rgb[t + 1] = g; rgb[t + 2] = r; rgb[t + 3] = a; } currentHeight++; } } else { currentHeight = height - 1; while ((currentHeight >= 0) && (stream.read(data)!= -1)) { for (int i = 0; i < width; i++) { byte r = data[i * 3 + 0]; byte g = data[i * 3 + 1]; byte b = data[i * 3 + 2]; byte a = (byte) 0xFF; t = (width * currentHeight + i) * 4; rgb[t + 0] = b; rgb[t + 1] = g; rgb[t + 2] = r; rgb[t + 3] = a; } currentHeight--; } } } else { if ((descriptor & UPPER_ORIGIN)!= 0) { currentHeight = 0; while ((currentHeight < height) && (stream.read(data)!= -1)) { for (int i = width - 1; i >= 0; i--) { byte r = data[i * 3 + 0]; byte g = data[i * 3 + 1]; byte b = data[i * 3 + 2]; byte a = (byte) 0xFF; t = (width * currentHeight + i) * 4; rgb[t + 0] = b; rgb[t + 1] = g; rgb[t + 2] = r; rgb[t + 3] = a; } currentHeight++; } } else { currentHeight = height - 1; while ((currentHeight >= 0) && (stream.read(data)!= -1)) { for (int i = 0; i < width; i++) { byte r = data[i * 3 + 0]; byte g = data[i * 3 + 1]; byte b = data[i * 3 + 2]; byte a = (byte) 0xFF; t = (width * currentHeight + i) * 4; rgb[t + 0] = b; rgb[t + 1] = g; rgb[t + 2] = r; rgb[t + 3] = a; } currentHeight--; } } } } else if (depth == 32) { rgb = new byte[width * height * 4]; data = new byte[width * 4]; if ((descriptor & RIGHT_ORIGIN) == 0) { if ((descriptor & UPPER_ORIGIN)!= 0) { currentHeight = 0; while ((currentHeight < height) && (stream.read(data)!= -1)) { for (int i = 0; i < width; i++) { byte r = data[i * 3 + 0]; byte g = data[i * 3 + 1]; byte b = data[i * 3 + 2]; byte a = data[i * 3 + 3]; t = (width * currentHeight + i) * 4; rgb[t + 0] = b; rgb[t + 1] = g; rgb[t + 2] = r; rgb[t + 3] = a; } currentHeight++; } } else { currentHeight = height - 1; while ((currentHeight >= 0) && (stream.read(data)!= -1)) { for (int i = 0; i < width; i++) { byte r = data[i * 3 + 0]; byte g = data[i * 3 + 1]; byte b = data[i * 3 + 2]; byte a = data[i * 3 + 3]; t = (width * currentHeight + i) * 4; rgb[t + 0] = b; rgb[t + 1] = g; rgb[t + 2] = r; rgb[t + 3] = a; } currentHeight--; } } } else { if ((descriptor & UPPER_ORIGIN)!= 0) { currentHeight = 0; while ((currentHeight < height) && (stream.read(data)!= -1)) { for (int i = 0; i < width; i++) { byte r = data[i * 3 + 0]; byte g = data[i * 3 + 1]; byte b = data[i * 3 + 2]; byte a = data[i * 3 + 3]; t = (width * currentHeight + i) * 4; rgb[t + 0] = b; rgb[t + 1] = g; rgb[t + 2] = r; rgb[t + 3] = a; } currentHeight++; } } else { while ((currentHeight >= 0) && (stream.read(data)!= -1)) { currentHeight = height - 1; for (int i = 0; i < width; i++) { byte r = data[i * 3 + 0]; byte g = data[i * 3 + 1]; byte b = data[i * 3 + 2]; byte a = data[i * 3 + 3]; t = (width * currentHeight + i) * 4; rgb[t + 0] = b; rgb[t + 1] = g; rgb[t + 2] = r; rgb[t + 3] = a; } currentHeight--; } } } } else { return null; } bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); bitmap.copyPixelsFromBuffer(ByteBuffer.wrap(rgb)); if(depth == 24) { bitmap.setHasAlpha(false); } return bitmap; } /* * decodeStream */ /** * A wrapper around * {@link android.graphics.BitmapFactory#decodeStream(InputStream) * BitmapFactory.decodeStream} that uses an * {@link android.graphics.BitmapFactory.Options} <code>inTempStorage</code> * decode buffer. On low memory, returns half (quarter, eighth,...) size * images. * <p> * If {@code stream} is a {@link FileInputStream} and is at offset 0 (zero), * uses * {@link android.graphics.BitmapFactory#decodeFileDescriptor(FileDescriptor) * BitmapFactory.decodeFileDescriptor()} instead of * {@link android.graphics.BitmapFactory#decodeStream(InputStream) * BitmapFactory.decodeStream()}. * * @param stream * Bitmap stream * @param requestedWidth * If >= 0, specifies a target width; returned Bitmap will be at * least this wide (unless we run out of memory) while preserving * the original aspect ratio. Image may be a good deal wider than * requestedWidth, as we only shrink by powers of two. * @param requestedHeight * If >= 0, specifies a target height; returned Bitmap will be at * least this high (unless we run out of memory) while preserving * the original aspect ratio. Image may be a good deal taller * than requestedHeight, as we only shrink by powers of two. * @param canShrink * On low memory, can we return half (quarter, eighth,...) size * image? If false, return null on any OutOfMemoryError * @param possibleAlternative * We may have a cached copy that's at least as big as the * largest possible decode: Passing in the cached bitmap (if any) * allows us to detect this before doing the second decode. * @param closeStream * If {@code true}, closes {@code stream} * @return Bitmap, or null if cannot be decoded into a bitmap */ static Bitmap decodeStream(InputStream stream, int requestedWidth, int requestedHeight, final boolean canShrink, Bitmap possibleAlternative, boolean closeStream) { BitmapFactory.Options options = standardBitmapFactoryOptions(); try { DecodeHelper helper; if (stream instanceof FileInputStream) { helper = new DecodeFileStreamHelper((FileInputStream) stream); } else { helper = new DecodeStreamHelper(stream); } helper.setInSampleSize(options, requestedWidth, requestedHeight); if (useAlternativeBitmap(possibleAlternative, options)) { return possibleAlternative; } do { try { return helper.decode(options, requestedWidth, requestedHeight); } catch (OutOfMemoryError m) { // Rewind stream to read again helper.rewind(); options.inSampleSize *= 2; // try again, at half-size } } while (canShrink); } catch (IOException e) { e.printStackTrace(); } finally { if (options!= null && options.inTempStorage!= null) { bufferBin.put(options.inTempStorage); } if (stream!= null && closeStream) { try { stream.close(); } catch (Exception e) { e.printStackTrace(); } } } return null; // OutOfMemoryError, canShrink == false } private static boolean useAlternativeBitmap(Bitmap possibleAlternative, BitmapFactory.Options options) { boolean result = possibleAlternative!= null && possibleAlternative.getWidth() >= options.outWidth / options.inSampleSize && possibleAlternative.getHeight() >= options.outHeight / options.inSampleSize; if (VERBOSE_DECODE) { // Condition split to silence warning if (result) { Log.d(TAG, "Thread %d: Skipping decode for %dx%d bitmap - using cached alternative", threadId(), options.outWidth / options.inSampleSize, options.outHeight / options.inSampleSize); } } return result; } private static Options standardBitmapFactoryOptions() { Options options = new Options(); options.inPurgeable = false; options.inDither = false; options.inPreferredConfig = Bitmap.Config.ARGB_8888; options.inTempStorage = bufferBin.get(); if (options.inTempStorage == null) { options.inTempStorage = new byte[DECODE_BUFFER_SIZE]; } return options; } private interface GetBounds { /** * Should just do the decodeX - may assume that * <code>options.inJustDecodeBounds == true;</code> */ void getBounds(Options options); } private static class GetStreamBounds implements GetBounds { private final InputStream stream; private GetStreamBounds(InputStream stream) { this.stream = stream; } @Override public void getBounds(Options options) { BitmapFactory.decodeStream(stream, null, options); } } private static void setInSampleSize(Options options, int requestedWidth, int requestedHeight, GetBounds get) { try { // Get the dimensions options.inJustDecodeBounds = true; get.getBounds(options); // Do we have a target size? if (requestedWidth == 0 && requestedHeight == 0) { options.inSampleSize = 1; // No: try for a full-size image } else { // Calculate the scale int scaleWidth = scale(requestedWidth, options.outWidth); int scaleHeight = scale(requestedHeight, options.outHeight); int scale = Math.max(Math.min(scaleWidth, scaleHeight), 1); options.inSampleSize = Integer.highestOneBit(scale); } if (VERBOSE_DECODE) { Log.d(TAG, "Thread %d: File is %dx%d. Request size is %dx%d; calculated size is %dx%d", threadId(), options.outWidth, options.outHeight, requestedWidth, requestedHeight, options.outWidth / options.inSampleSize, options.outHeight / options.inSampleSize); } while ((options.outWidth / options.inSampleSize) * (options.outHeight / options.inSampleSize) * 4 > maxImageSize) { if (VERBOSE_DECODE) { Log.d(TAG, "Thread %d: %dx%d is too big: reducing", threadId(), options.outWidth / options.inSampleSize, options.outHeight / options.inSampleSize); } options.inSampleSize *= 2; } if (VERBOSE_DECODE) { Log.d(TAG, "Thread %d: Requesting %dx%d copy of %dx%d image", threadId(), options.outWidth / options.inSampleSize, options.outHeight / options.inSampleSize, options.outWidth, options.outHeight); } } finally { options.inJustDecodeBounds = false; } } private static int scale(int requestedSize, int outSize) { if (requestedSize == 0) { // No request return 1; } else if (requestedSize < 0) { // Minimum size return outSize / -requestedSize; } else { // Maximum size int scale = Math.max(1, Integer.highestOneBit(outSize / requestedSize)); if (outSize / scale > requestedSize) { scale <<= 1; // double it } return scale; } } private static int scale(int requestedSize, float outSize) { return scale(requestedSize, (int) (outSize + 0.5f)); } private interface DecodeHelper { public void setInSampleSize(BitmapFactory.Options options, int requestedWidth, int requestedHeight) throws IOException; public Bitmap decode(BitmapFactory.Options options, int requestedWidth, int requestedHeight) throws IOException; public void rewind() throws IOException; } /** * Shim that lets * {@link AsyncBitmapTexture#fractionalDecode(FractionalDecodeShim, Options, int, int)} * work with either InputStream or FileDescriptor. */ private interface FractionalDecodeShim { /** * We don't need to (or can't) use a {@link BitmapRegionDecoder}: just * call a BitmapFactory decode method directly * */ Bitmap decode(Options options); /** * Call the appropriate {@link BitmapRegionDecoder} newInstance() * overload * * @return A new {@code BitmapRegionDecoder}, or {@code null} * "if the image format is not supported or can not be decoded." */ BitmapRegionDecoder newRegionDecoder(); } /** * Use {@link BitmapRegionDecoder} to read the bitmap in smallish slices, * and resize each slice so that the target bitmap matches requestedWidth or * requestedHeight in at least one dimension. */ private static Bitmap fractionalDecode(FractionalDecodeShim shim, Options options, int requestedWidth, int requestedHeight) { final int rawWidth = options.outWidth; final int rawHeight = options.outHeight; final float sampledWidth = (float) rawWidth / options.inSampleSize; final float sampledHeight = (float) rawHeight / options.inSampleSize; // Use the simple path, if we can/must if (requestedWidth == 0 || requestedHeight == 0 // || sampledWidth <= Math.abs(requestedWidth) || sampledHeight <= Math.abs(requestedHeight)) { if (VERBOSE_DECODE) { Log.d(TAG, "Can't use slice decoder: sampledWidth = %.0f, requestedWidth = %d; sampledHeight = %.0f, requestedHeight = %d", sampledWidth, requestedWidth, sampledHeight, requestedHeight); } return shim.decode(options); } // We must use a BitmapRegionDecoder to read and resize'slices' of the // input BitmapRegionDecoder decoder = shim.newRegionDecoder(); try { float scale = Math.max(scale(requestedWidth, sampledWidth), scale(requestedHeight, sampledHeight)); int scaledSliceWidth = roundUp(sampledWidth * scale); int slices = (decoder == null)? 1 : roundUp(sampledHeight / (SLICE_SIZE / sampledWidth)); int sliceRows = (int) (rawHeight / slices); float scaledSliceRows = sliceRows / options.inSampleSize * scale; Bitmap result = Bitmap.createBitmap((int) (sampledWidth * scale), (int) (sampledHeight * scale), Config.ARGB_8888); Canvas canvas = new Canvas(result); Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG); // Rect decode, uses 'raw' coordinates Rect decode = new Rect(0, 0, rawWidth, sliceRows); // RectF target, uses scaled coordinates RectF target = new RectF(0, 0, scaledSliceWidth, scaledSliceRows); Bitmap slice = options.inBitmap = null; boolean hasAlpha = false; for (int index = 0; index < slices; ++index) { slice = options.inBitmap = // (decoder == null)? shim.decode(options) : // decoder.decodeRegion(decode, options); hasAlpha |= slice.hasAlpha(); canvas.drawBitmap(slice, null, target, paint); decode.offset(0, sliceRows); target.offset(0, scaledSliceRows); } slice.recycle(); // log(TAG, // "fractionalDecode: result.hasAlpha() == %b, slices' hasAlpha == %b", // result.hasAlpha(), hasAlpha); result.setHasAlpha(hasAlpha); return result; } finally { if (decoder!= null) { decoder.recycle(); } } } private static int roundUp(float f) { // The (int) cast rounds towards 0 // http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.1.3 return (int) (f + 1.0 - Float.MIN_VALUE); } private static class FractionalDecodeStreamShim implements FractionalDecodeShim { private final InputStream mStream; public FractionalDecodeStreamShim(InputStream stream) { mStream = stream; } @Override public Bitmap decode(Options options) { return BitmapFactory.decodeStream(mStream, null, options); } @Override public BitmapRegionDecoder newRegionDecoder() { try { return BitmapRegionDecoder.newInstance(mStream, false); } catch (IOException e) { return null; } } } private static class FractionalDecodeDescriptorShim implements FractionalDecodeShim { private final FileDescriptor mDescriptor; public FractionalDecodeDescriptorShim(FileDescriptor descriptor) { mDescriptor = descriptor; } @Override public Bitmap decode(Options options) { return BitmapFactory.decodeFileDescriptor(mDescriptor, null, options); } @Override public BitmapRegionDecoder newRegionDecoder() { try { return BitmapRegionDecoder.newInstance(mDescriptor, false); } catch (IOException e) { return null; } } } private static class DecodeStreamHelper implements DecodeHelper { DecodeStreamHelper(InputStream stream) { mStream = stream; if (mStream.markSupported()) { mStream.mark(Integer.MAX_VALUE); } } @Override public void setInSampleSize(Options options, int requestedWidth, int requestedHeight) { AsyncBitmapTexture.setInSampleSize(options, requestedWidth, requestedHeight, new GetStreamBounds(mStream)); rewind(); } @Override public Bitmap decode(Options options, int requestedWidth, int requestedHeight) { return fractionalDecode(new FractionalDecodeStreamShim(mStream), options, requestedWidth, requestedHeight); } @Override public void rewind() { if (mStream.markSupported()) { try { mStream.reset(); } catch (IOException e) { e.printStackTrace(); } } } private final InputStream mStream; } private static class DecodeFileStreamHelper implements DecodeHelper { DecodeFileStreamHelper(FileInputStream stream) throws IOException { mStream = stream; mOffset = stream.getChannel().position(); } @Override public void setInSampleSize(Options options, int requestedWidth, int requestedHeight) throws IOException { // We'll need our original offset into the stream in order to rewind // for subsequent decode attempts. Also, getting the bitmap bounds // from the stream involves reading the stream, which moves our // offset into the stream. AsyncBitmapTexture.setInSampleSize(options, requestedWidth, requestedHeight, new GetStreamBounds(mStream)); mStream.getChannel().position(mOffset); } @Override public Bitmap decode(Options options, int requestedWidth, int requestedHeight) throws IOException { FractionalDecodeShim shim = (mOffset > 0) // Apparently if the file descriptor has been offset at // all, decodeFileDescriptor() doesn't work. ? new FractionalDecodeStreamShim(mStream) // When the stream is at position zero, we can use a // more optimal decode() : new FractionalDecodeDescriptorShim(mStream.getFD()); // } return fractionalDecode(shim, options, requestedWidth, requestedHeight); } @Override public void rewind() throws IOException { // Rewind stream to read again mStream.getChannel().position(mOffset); } private final long mOffset; private final FileInputStream mStream; } /** * A soft referenced set of <code>byte[DECODE_BUFFER_SIZE]</code> arrays.) */ private static RecycleBin<byte[]> bufferBin = RecycleBin.<byte[]> soft() .synchronize(); /* * Image size policy */ /** * {@link AsyncBitmapTexture#setup(Context)} creates a default version of * this to set the {@link AsyncBitmapTexture#maxImageSize}; call * {@link AsyncBitmapTexture#setup(Context, ImageSizePolicy)} with your own * {@link ImageSizePolicy} to specify a different ratio of heap size to * maximum image size. */ interface ImageSizePolicy { /** * Largest image that we will load into memory. * * A multiple of the "memory class" - <i>e.g.</i> 7.5% of a 32M heap is * a 2.4M image; 6% is 1.92M */ float getMaximumImageFactor(); } } ======================= File: GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/IoDeviceFactory.java ======================= /* * Copyright (c) 2016. Samsung Electronics Co., LTD * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.io.cursor3d; import org.gearvrf.utility.Log; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.BufferedWriter; import java.io.IOException; import java.io.StringWriter; class IoDeviceFactory { private static final String TAG = IoDeviceFactory.class.getSimpleName(); private static final String VENDOR_ID = "vendorId"; private static final String PRODUCT_ID = "productId"; private static final String DEVICE_ID = "deviceId"; private static final String PRIORITY = "priority"; private static final String VENDOR_NAME = "vendorName"; private static final String NAME = "name"; private static final String XML_START_TAG = "<io "; static final int INVALID_PRIORITY = -1; static PriorityIoDeviceTuple readIoDeviceFromSettingsXml(XmlPullParser parser) throws XmlPullParserException, IOException { IoDevice ioDevice = readIoDevice(parser); int priority; try { priority = Integer.parseInt(parser.getAttributeValue(XMLUtils.DEFAULT_XML_NAMESPACE, PRIORITY)); } catch (NumberFormatException e) { throw new XmlPullParserException("Invalid VendorId, ProductId or Priority for Io " + "device"); } XMLUtils.parseTillElementEnd(parser); return new PriorityIoDeviceTuple(priority, ioDevice); } private static IoDevice readIoDevice(XmlPullParser parser) throws XmlPullParserException, IOException { IoDevice ioDevice = new IoDevice(); try { ioDevice.setVendorId(Integer.parseInt(parser.getAttributeValue(XMLUtils .DEFAULT_XML_NAMESPACE, VENDOR_ID))); ioDevice.setProductId(Integer.parseInt(parser.getAttributeValue(XMLUtils .DEFAULT_XML_NAMESPACE, PRODUCT_ID))); } catch (NumberFormatException e) { throw new XmlPullParserException("Invalid VendorId, ProductId or Priority for Io " + "device"); } ioDevice.setDeviceId(parser.getAttributeValue(XMLUtils.DEFAULT_XML_NAMESPACE, DEVICE_ID)); if (ioDevice.getDeviceId() == null) { throw new XmlPullParserException("deviceId for cursors IO device not specified"); } ioDevice.setVendorName(parser.getAttributeValue(XMLUtils.DEFAULT_XML_NAMESPACE, VENDOR_NAME)); ioDevice.setName(parser.getAttributeValue(XMLUtils.DEFAULT_XML_NAMESPACE, NAME)); return ioDevice; } static IoDevice readIoDeviceFromIoXml(XmlPullParser parser) throws XmlPullParserException, IOException { IoDevice ioDevice = readIoDevice(parser); XMLUtils.parseTillElementEnd(parser); return ioDevice; } //TODO use XmlSerializer static void writeIoDevice(IoDevice ioDevice, BufferedWriter writer, int priority) throws IOException { writer.write(XML_START_TAG); XMLUtils.writeXmlAttribute(VENDOR_ID, ioDevice.getVendorId(), writer); XMLUtils.writeXmlAttribute(PRODUCT_ID, ioDevice.getProductId(), writer); XMLUtils.writeXmlAttribute(DEVICE_ID, ioDevice.getDeviceId(), writer); String name = ioDevice.getName(); if (name!= null) { XMLUtils.writeXmlAttribute(NAME, name, writer); } String vendorName = ioDevice.getVendorName(); if (vendorName!= null) { XMLUtils.writeXmlAttribute(VENDOR_NAME, vendorName, writer); } if (priority!= INVALID_PRIORITY) { XMLUtils.writeXmlAttribute(PRIORITY, priority, writer); } writer.write(XMLUtils.ELEMENT_END); } static String getXmlString(IoDevice ioDevice) { StringWriter stringWriter = new StringWriter(); BufferedWriter writer = new BufferedWriter(stringWriter); try { writeIoDevice(ioDevice, writer, INVALID_PRIORITY); writer.flush(); } catch (IOException e) { Log.d(TAG, "Cannot convert IoDevice to string:", e); } return stringWriter.toString(); } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java ======================= <gh_stars>100-1000 /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf; import org.gearvrf.utility.Log; import static org.gearvrf.utility.Assert.checkFloatNotNaNOrInfinity; import static org.gearvrf.utility.Assert.checkStringNotNullOrEmpty; /** Holds the GVRCameras. */ public class GVRCameraRig extends GVRComponent implements PrettyPrint { private GVRSceneObject headTransformObject; private GVRCamera leftCamera, rightCamera; private GVRPerspectiveCamera centerCamera; private GVRSceneObject leftCameraObject, rightCameraObject; private GVRSceneObject centerCameraObject; /** Ways to use the rotation sensor data. */ public abstract static class GVRCameraRigType { /** Rotates freely. Default. */ public abstract static class Free { public static final int ID = 0; } /** Yaw rotation (naively speaking, rotation by y-axis) only. */ public abstract static class YawOnly { public static final int ID = 1; } /** No roll rotation (naively speaking, rotation by z-axis). */ public abstract static class RollFreeze { public static final int ID = 2; } /** No rotation at all. */ public abstract static class Freeze { public static final int ID = 3; } /** Orbits the pivot. */ public abstract static class OrbitPivot { public static final int ID = 4; public static final String DISTANCE = "distance"; public static final String PIVOT = "pivot"; } }; static public long getComponentType() { long type = NativeCameraRig.getComponentType(); Log.d("ND", "ND: GVRCameraRig.getComponentType JAVA %d", type); return type; } /** * Constructs a camera rig with cameras attached. An owner scene object is automatically * created for the camera rig. * * Do not try to change the owner object of the camera rig - not supported currently and will * lead to native crashes. */ public static GVRCameraRig makeInstance(GVRContext gvrContext) { final GVRCameraRig result = gvrContext.getApplication().getDelegate().makeCameraRig(gvrContext); result.init(gvrContext); return result; } protected GVRCameraRig(GVRContext gvrContext) { super(gvrContext, NativeCameraRig.ctor()); } protected GVRCameraRig(GVRContext gvrContext, long ptr) { super(gvrContext, ptr); } /** Construction helper */ protected void init(GVRContext gvrContext) { /* * Create an object hierarchy * * [camera rig object] * | * [head transform object] * / | \ * [left cam obj] [right cam obj] [center cam obj] * * 1. camera rig object: used for camera rig moving and turning via * CameraRig.getTransform() * 2. head transform object: used internally to do sensor-based rotation */ setOwnerObject(new GVRSceneObject(gvrContext)); getOwnerObject().attachCameraRig(this); headTransformObject = new GVRSceneObject(gvrContext); addHeadTransformObject(); leftCameraObject = new GVRSceneObject(gvrContext); rightCameraObject = new GVRSceneObject(gvrContext); centerCameraObject = new GVRSceneObject(gvrContext); headTransformObject.addChildObject(leftCameraObject); headTransformObject.addChildObject(rightCameraObject); headTransformObject.addChildObject(centerCameraObject); } protected void addHeadTransformObject() { getOwnerObject().addChildObject(getHeadTransformObject()); } public final GVRSceneObject getHeadTransformObject() { return headTransformObject; } /** @return The {@link GVRCameraRigType type} of the camera rig. */ public int getCameraRigType() { return NativeCameraRig.getCameraRigType(getNative()); } /** * Set the {@link GVRCameraRigType type} of the camera rig. * * @param cameraRigType * The rig {@link GVRCameraRigType type}. */ public void setCameraRigType(int cameraRigType) { NativeCameraRig.setCameraRigType(getNative(), cameraRigType); } /** * @return Get the left {@link GVRCamera camera}, if one has been * {@link #attachLeftCamera(GVRCamera) attached}; {@code null} if * not. */ public GVRCamera getLeftCamera() { return leftCamera; } /** * @return Get the right {@link GVRCamera camera}, if one has been * {@link #attachRightCamera(GVRCamera) attached}; {@code null} if * not. */ public GVRCamera getRightCamera() { return rightCamera; } /** * @return Get the center {@link GVRPerspectiveCamera camera}, if one has been * {@link #attachCenterCamera(GVRPerspectiveCamera) attached}; {@code null} if * not. */ public GVRPerspectiveCamera getCenterCamera() { return centerCamera; } /** * @return The global default distance separating the left and right * cameras. */ public static float getDefaultCameraSeparationDistance() { return NativeCameraRig.getDefaultCameraSeparationDistance(); } /** * Sets the global default distance separating the left and right cameras. * * @param distance * Global default separation. */ public static void setDefaultCameraSeparationDistance(float distance) { NativeCameraRig.setDefaultCameraSeparationDistance(distance); } /** * @return The distance separating the left and right cameras of the camera * rig. */ public float getCameraSeparationDistance() { return NativeCameraRig.getCameraSeparationDistance(getNative()); } /** * Set the distance separating the left and right cameras of the camera rig. * * @param distance * Separation distance. */ public void setCameraSeparationDistance(float distance) { NativeCameraRig.setCameraSeparationDistance(getNative(), distance); } /** * @param key * Key of the {@code float} to get. * @return The {@code float} value associated with {@code key}. */ public float getFloat(String key) { return NativeCameraRig.getFloat(getNative(), key); } /** * Map {@code value} to {@code key}. * * @param key * Key to map {@code value} to. * @param value * The {@code float} value to map. */ public void setFloat(String key, float value) { checkStringNotNullOrEmpty("key", key); checkFloatNotNaNOrInfinity("value", value); NativeCameraRig.setFloat(getNative(), key, value); } /** * @param key * Key of the two-component {@code float} vector to get. * @return An two-element array representing the vector mapped to * {@code key}. */ public float[] getVec2(String key) { return NativeCameraRig.getVec2(getNative(), key); } /** * Map a two-component {@code float} vector to {@code key}. * * @param key * Key to map the vector to. * @param x * 'X' component of vector. * @param y * 'Y' component of vector. */ public void setVec2(String key, float x, float y) { checkStringNotNullOrEmpty("key", key); NativeCameraRig.setVec2(getNative(), key, x, y); } /** * @param key * Key of the three-component {@code float} vector to get. * @return An three-element array representing the vector mapped to * {@code key}. */ public float[] getVec3(String key) { return NativeCameraRig.getVec3(getNative(), key); } /** * Map a three-component {@code float} vector to {@code key}. * * @param key * Key to map the vector to. * @param x * 'X' component of vector. * @param y * 'Y' component of vector. * @param z * 'Z' component of vector. */ public void setVec3(String key, float x, float y, float z) { checkStringNotNullOrEmpty("key", key); NativeCameraRig.setVec3(getNative(), key, x, y, z); } /** * @param key * Key of the four-component {@code float} vector to get. * @return An four-element array representing the vector mapped to * {@code key}. */ public float[] getVec4(String key) { return NativeCameraRig.getVec4(getNative(), key); } /** * Map a four-component {@code float} vector to {@code key}. * * @param key * Key to map the vector to. * @param x * 'X' component of vector. * @param y * 'Y' component of vector. * @param z * 'Z' component of vector. * @param w * 'W' component of vector. */ public void setVec4(String key, float x, float y, float z, float w) { checkStringNotNullOrEmpty("key", key); NativeCameraRig.setVec4(getNative(), key, x, y, z, w); } /** * Attach a {@link GVRCamera camera} as the left camera of the camera rig. * * @param camera * {@link GVRCamera Camera} to attach. */ public void attachLeftCamera(GVRCamera camera) { if (camera.hasOwnerObject()) { camera.getOwnerObject().detachCamera(); } leftCameraObject.attachCamera(camera); leftCamera = camera; NativeCameraRig.attachLeftCamera(getNative(), camera.getNative()); } /** * Attach a {@link GVRCamera camera} as the right camera of the camera rig. * * @param camera * {@link GVRCamera Camera} to attach. */ public void attachRightCamera(GVRCamera camera) { if (camera.hasOwnerObject()) { camera.getOwnerObject().detachCamera(); } rightCameraObject.attachCamera(camera); rightCamera = camera; NativeCameraRig.attachRightCamera(getNative(), camera.getNative()); } /** * Attach a {@link GVRPerspectiveCamera camera} as the center camera of the camera rig. * * @param camera * {@link GVRPerspectiveCamera Camera} to attach. */ public void attachCenterCamera(GVRPerspectiveCamera camera) { if (camera.hasOwnerObject()) { camera.getOwnerObject().detachCamera(); } centerCameraObject.attachCamera(camera); centerCamera = camera; NativeCameraRig.attachCenterCamera(getNative(), camera.getNative()); } public void attachToParent(GVRSceneObject parentObject) { parentObject.addChildObject(getOwnerObject()); } public void detachFromParent(GVRSceneObject parentObject) { parentObject.removeChildObject(getOwnerObject()); } /** * Resets the rotation of the camera rig by multiplying further rotations by * the inverse of the current rotation. * <p> * Cancels the effect of prior calls to {@link #resetYaw()} and * {@link #resetYawPitch()}. */ public void reset() { NativeCameraRig.reset(getNative()); } /** * Resets the yaw of the camera rig by multiplying further changes in the * rig's yaw by the inverse of the current yaw. * <p> * Cancels the effect of prior calls to {@link #reset()} and * {@link #resetYawPitch()}. */ public void resetYaw() { NativeCameraRig.resetYaw(getNative()); } /** * Resets the yaw and pitch of the camera rig by multiplying further changes * in the rig's yaw and pitch by the inverse of the current yaw and pitch. * <p> * Cancels the effect of prior calls to {@link #reset()} and * {@link #resetYaw()}. */ public void resetYawPitch() { NativeCameraRig.resetYawPitch(getNative()); } /** * Sets the rotation and angular velocity data for the camera rig. This * should only be done in response to * {@link OvrRotationSensorListener#onRotationSensor(long, float, float, float, float, float, float, float) * OvrRotationSensorListener.onRotationSensor()}. * * @param timeStamp * Clock-time when the data was received, in nanoseconds. * @param w * The 'W' rotation component. * @param x * The 'X' rotation component. * @param y * The 'Y' rotation component. * @param z * The 'Z' rotation component. * @param gyroX * Angular velocity on the 'X' axis. * @param gyroY * Angular velocity on the 'Y' axis. * @param gyroZ * Angular velocity on the 'Z' axis. */ void setRotationSensorData(long timeStamp, float w, float x, float y, float z, float gyroX, float gyroY, float gyroZ) { NativeCameraRig.setRotationSensorData(getNative(), timeStamp, w, x, y, z, gyroX, gyroY, gyroZ); } /** * The direction the camera rig is looking at. In other words, the direction * of the local -z axis. * * @return Array with 3 floats corresponding to a normalized direction * vector. ([0] : x, [1] : y, [2] : z) */ public float[] getLookAt() { return NativeCameraRig.getLookAt(getNative()); } /** * Replace the current {@link GVRTransform transform} for owner object of * the camera rig. * * @param transform * New transform. */ void attachTransform(GVRTransform transform) { if (getOwnerObject()!= null) { getOwnerObject().attachTransform(transform); } } /** * Remove the object's (owner object of camera rig) {@link GVRTransform * transform}. * */ void detachTransform() { if (getOwnerObject()!= null) { getOwnerObject().detachTransform(); } } /** * Get the {@link GVRTransform}. * * * @return The current {@link GVRTransform transform} of owner object of * camera rig. Applying transform to owner object of camera rig * moves it. If no transform is currently attached to the object, * returns {@code null}. */ public GVRTransform getTransform() { if (getOwnerObject()!= null) { return getOwnerObject().getTransform(); } return null; } /** * Add {@code child} as a child of this camera rig owner object. * * @param child * {@link GVRSceneObject Object} to add as a child of this camera * rig owner object. */ public void addChildObject(GVRSceneObject child) { headTransformObject.addChildObject(child); } /** * Remove {@code child} as a child of this camera rig owner object. * * @param child * {@link GVRSceneObject Object} to remove as a child of this * camera rig owner object. */ public void removeChildObject(GVRSceneObject child) { headTransformObject.removeChildObject(child); } /** * Get the number of child objects that belongs to owner object of this * camera rig. * * @return Number of {@link GVRSceneObject objects} added as children of * this camera rig owner object. */ public int getChildrenCount() { return headTransformObject.getChildrenCount(); } /** * Remove all children that have been added to the owner object of this camera rig; except the * camera objects. */ public void removeAllChildren() { for (final GVRSceneObject so : headTransformObject.getChildren()) { final boolean notCamera = (so!= leftCameraObject && so!= rightCameraObject && so!= centerCameraObject); if (notCamera) { headTransformObject.removeChildObject(so); } } } /** * Get the head {@link GVRTransform transform} for setting sensor data. In contrast, * use {@link #getTransform()} for additional camera positioning, such as the game * character moving and turning. * * @return The head {@link GVRTransform transform} object. */ public GVRTransform getHeadTransform() { return getHeadTransformObject().getTransform(); } /** * Update the rotation transform from the latest sensor data on file */ void updateRotation() { NativeCameraRig.updateRotation(getNative()); } /** * @return Distance from the origin to the near clipping plane for the * camera rig. */ public float getNearClippingDistance() { if(leftCamera instanceof GVRCameraClippingDistanceInterface) { return ((GVRCameraClippingDistanceInterface)leftCamera).getNearClippingDistance(); } return 0.0f; } /** * Sets the distance from the origin to the near clipping plane for the * whole camera rig. * * @param near * Distance to the near clipping plane. */ public void setNearClippingDistance(float near) { if(leftCamera instanceof GVRCameraClippingDistanceInterface && centerCamera instanceof GVRCameraClippingDistanceInterface && rightCamera instanceof GVRCameraClippingDistanceInterface) { ((GVRCameraClippingDistanceInterface)leftCamera).setNearClippingDistance(near); centerCamera.setNearClippingDistance(near); ((GVRCameraClippingDistanceInterface)rightCamera).setNearClippingDistance(near); } } /** * @return Distance from the origin to the far clipping plane for the * camera rig. */ public float getFarClippingDistance() { if(leftCamera instanceof GVRCameraClippingDistanceInterface) { return ((GVRCameraClippingDistanceInterface)leftCamera).getFarClippingDistance(); } return 0.0f; } /** * Sets the distance from the origin to the far clipping plane for the * whole camera rig. * * @param far * Distance to the far clipping plane. */ public void setFarClippingDistance(float far) { if(leftCamera instanceof GVRCameraClippingDistanceInterface && centerCamera instanceof GVRCameraClippingDistanceInterface && rightCamera instanceof GVRCameraClippingDistanceInterface) { ((GVRCameraClippingDistanceInterface)leftCamera).setFarClippingDistance(far); centerCamera.setFarClippingDistance(far); ((GVRCameraClippingDistanceInterface)rightCamera).setFarClippingDistance(far); } } /** * Prints the {@link GVRCameraRig} object with indentation. * * @param sb * The {@code StringBuffer} object to receive the output. * * @param indent * Size of indentation in number of spaces. */ @Override public void prettyPrint(StringBuffer sb, int indent) { sb.append(Log.getSpaces(indent)); sb.append(getClass().getSimpleName()); sb.append(System.lineSeparator()); sb.append(Log.getSpaces(indent + 2)); sb.append("type: "); sb.append(getCameraRigType()); sb.append(System.lineSeparator()); sb.append(Log.getSpaces(indent + 2)); sb.append("lookAt: "); float[] lookAt = getLookAt(); for (float vecElem : lookAt) { sb.append(vecElem); sb.append(" "); } sb.append(System.lineSeparator()); sb.append(Log.getSpaces(indent + 2)); sb.append("leftCamera: "); if (leftCamera == null) { sb.append("null"); sb.append(System.lineSeparator()); } else { sb.append(System.lineSeparator()); leftCamera.prettyPrint(sb, indent + 4); } sb.append(Log.getSpaces(indent + 2)); sb.append("rightCamera: "); if (rightCamera == null) { sb.append("null"); sb.append(System.lineSeparator()); } else { sb.append(System.lineSeparator()); rightCamera.prettyPrint(sb, indent + 4); } } @Override public String toString() { StringBuffer sb = new StringBuffer(); prettyPrint(sb, 0); return sb.toString(); } } class NativeCameraRig { static native long ctor(); static native void updateRotation(long cameraRig); static native int getCameraRigType(long cameraRig); static native void setCameraRigType(long cameraRig, int cameraRigType); static native float getDefaultCameraSeparationDistance(); static native void setDefaultCameraSeparationDistance(float distance); static native float getCameraSeparationDistance(long cameraRig); static native void setCameraSeparationDistance(long cameraRig, float distance); static native float getFloat(long cameraRig, String key); static native void setFloat(long cameraRig, String key, float value); static native float[] getVec2(long cameraRig, String key); static native void setVec2(long cameraRig, String key, float x, float y); static native float[] getVec3(long cameraRig, String key); static native void setVec3(long cameraRig, String key, float x, float y, float z); static native float[] getVec4(long cameraRig, String key); static native void setVec4(long cameraRig, String key, float x, float y, float z, float w); static native void attachLeftCamera(long cameraRig, long camera); static native void attachRightCamera(long cameraRig, long camera); static native void attachCenterCamera(long cameraRig, long camera); static native void reset(long cameraRig); static native void resetYaw(long cameraRig); static native void resetYawPitch(long cameraRig); static native void setRotationSensorData(long cameraRig, long timeStamp, float w, float x, float y, float z, float gyroX, float gyroY, float gyroZ); static native float[] getLookAt(long cameraRig); static native long getComponentType(); } ======================= File: GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/RhinoScriptEngine.java ======================= /* * Copyright (C) 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * 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 Sun Microsystems nor the names of * is 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. */ package org.gearvrf.script.javascript; import javax.script.*; import org.gearvrf.script.javascript.util.*; import org.mozilla.javascript.*; import java.lang.reflect.Method; import java.io.*; import java.util.*; /** * Implementation of <code>ScriptEngine</code> using the Mozilla Rhino * interpreter. * * @author <NAME> * @author <NAME> * @version 1.0 * @since 1.6 * * Modified for phobos to remove some of the restrictions. * Modified to allow subclassing and preprocessing of script source code. * Modified to avoid using the RhinoTopLevel class, since that introduces * a circularity that prevents objects from being garbage collected. * * @author Roberto Chinnici * */ public class RhinoScriptEngine extends AbstractScriptEngine implements Invocable, Compilable { public static final boolean DEBUG = false; private static final String TOPLEVEL_SCRIPT_NAME = "META-INF/toplevel.js"; /* Scope where standard JavaScript objects and our * extensions to it are stored. Note that these are not * user defined engine level global variables. These are * variables have to be there on all compliant ECMAScript * scopes. We put these standard objects in this top level. */ private ScriptableObject topLevel; /* map used to store indexed properties in engine scope * refer to comment on 'indexedProps' in ExternalScriptable.java. */ private Map indexedProps; private ScriptEngineFactory factory; private InterfaceImplementor implementor; /* // in Phobos we want to support all javascript features static { ContextFactory.initGlobal(new ContextFactory() { protected Context makeContext() { Context cx = super.makeContext(); cx.setClassShutter(RhinoClassShutter.getInstance()); cx.setWrapFactory(RhinoWrapFactory.getInstance()); return cx; } public boolean hasFeature(Context cx, int feature) { // we do not support E4X (ECMAScript for XML)! if (feature == Context.FEATURE_E4X) { return false; } else { return super.hasFeature(cx, feature); } } }); } static { if (USE_INTERPRETER) { ContextFactory.initGlobal(new ContextFactory() { protected Context makeContext() { Context cx = super.makeContext(); cx.setOptimizationLevel(-1); return cx; } }); } } */ /** * Creates a new instance of RhinoScriptEngine */ public RhinoScriptEngine() { Context cx = enterContext(); try { /* * RRC - modified this code to register JSAdapter and some functions * directly, without using a separate RhinoTopLevel class */ topLevel = new ImporterTopLevel(cx, false); new LazilyLoadedCtor(topLevel, "JSAdapter", "com.sun.phobos.script.javascript.JSAdapter", false); // add top level functions String names[] = { "bindings", "scope", "sync" }; topLevel.defineFunctionProperties(names, RhinoScriptEngine.class, ScriptableObject.DONTENUM); processAllTopLevelScripts(cx); } finally { cx.exit(); } indexedProps = new HashMap(); //construct object used to implement getInterface implementor = new InterfaceImplementor(this) { protected Object convertResult(Method method, Object res) throws ScriptException { Class desiredType = method.getReturnType(); if (desiredType == Void.TYPE) { return null; } else { return Context.jsToJava(res, desiredType); } } }; } public Object eval(Reader reader, ScriptContext ctxt) throws ScriptException { Object ret; Context cx = enterContext(); try { Scriptable scope = getRuntimeScope(ctxt); scope.put("context", scope, ctxt); // NOTE (RRC) - why does it look straight into the engine instead of asking // the given ScriptContext object? // Modified to use the context // String filename = (String) get(ScriptEngine.FILENAME); String filename = null; if (ctxt!= null && ctxt.getBindings(ScriptContext.ENGINE_SCOPE)!= null) { filename = (String) ctxt.getBindings(ScriptContext.ENGINE_SCOPE).get(ScriptEngine.FILENAME); } if (filename == null) { filename = (String) get(ScriptEngine.FILENAME); } filename = filename == null? "<Unknown source>" : filename; ret = cx.evaluateReader(scope, preProcessScriptSource(reader), filename, 1, null); } catch (JavaScriptException jse) { if (DEBUG) jse.printStackTrace(); int line = (line = jse.lineNumber()) == 0? -1 : line; Object value = jse.getValue(); String str = (value!= null && value.getClass().getName().equals("org.mozilla.javascript.NativeError")? value.toString() : jse.toString()); throw new ExtendedScriptException(jse, str, jse.sourceName(), line); } catch (RhinoException re) { if (DEBUG) re.printStackTrace(); int line = (line = re.lineNumber()) == 0? -1 : line; throw new ExtendedScriptException(re, re.toString(), re.sourceName(), line); } catch (IOException ee) { throw new ScriptException(ee); } finally { cx.exit(); } return unwrapReturnValue(ret); } public Object eval(String script, ScriptContext ctxt) throws ScriptException { if (script == null) { throw new NullPointerException("null script"); } return eval(preProcessScriptSource(new StringReader(script)), ctxt); } public ScriptEngineFactory getFactory() { if (factory!= null) { return factory; } else { return new RhinoScriptEngineFactory(); } } public Bindings createBindings() { return new SimpleBindings(); } //Invocable methods public Object invokeFunction(String name, Object... args) throws ScriptException, NoSuchMethodException { return invokeMethod(null, name, args); } public Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException { Context cx = enterContext(); try { if (name == null) { throw new NullPointerException("method name is null"); } if (thiz!= null &&!(thiz instanceof Scriptable)) { thiz = cx.toObject(thiz, topLevel); } Scriptable engineScope = getRuntimeScope(context); Scriptable localScope = (thiz!= null)? (Scriptable) thiz : engineScope; Object obj = ScriptableObject.getProperty(localScope, name); if (! (obj instanceof Function)) { throw new NoSuchMethodException("no such method: " + name); } Function func = (Function) obj; Scriptable scope = func.getParentScope(); if (scope == null) { scope = engineScope; } Object result = func.call(cx, scope, localScope, wrapArguments(args)); return unwrapReturnValue(result); } catch (JavaScriptException jse) { if (DEBUG) jse.printStackTrace(); int line = (line = jse.lineNumber()) == 0? -1 : line; Object value = jse.getValue(); String str = (value!= null && value.getClass().getName().equals("org.mozilla.javascript.NativeError")? value.toString() : jse.toString()); throw new ExtendedScriptException(jse, str, jse.sourceName(), line); } catch (RhinoException re) { if (DEBUG) re.printStackTrace(); int line = (line = re.lineNumber()) == 0? -1 : line; throw new ExtendedScriptException(re, re.toString(), re.sourceName(), line); } finally { cx.exit(); } } public <T> T getInterface(Class<T> clasz) { try { return implementor.getInterface(null, clasz); } catch (ScriptException e) { return null; } } public <T> T getInterface(Object thiz, Class<T> clasz) { if (thiz == null) { throw new IllegalArgumentException("script object can not be null"); } try { return implementor.getInterface(thiz, clasz); } catch (ScriptException e) { return null; } } private static final String printSource = "function print(str) { \n" + " if (typeof(str) == 'undefined') { \n" + " str = 'undefined'; \n" + " } else if (str == null) { \n" + " str = 'null'; \n" + " } \n" + " context.getWriter().write(String(str)); \n" + "}"; Scriptable getRuntimeScope(ScriptContext ctxt) { if (ctxt == null) { throw new NullPointerException("null script context"); } // we create a scope for the given ScriptContext Scriptable newScope = new ExternalScriptable(ctxt, indexedProps); // Set the prototype of newScope to be 'topLevel' so that // JavaScript standard objects are visible from the scope. newScope.setPrototype(topLevel); // define "context" variable in the new scope newScope.put("context", newScope, ctxt); // define "print" function in the new scope Context cx = enterContext(); // Disable optimization for android cx.setOptimizationLevel(-1); try { cx.evaluateString(newScope, printSource, "print", 1, null); } finally { cx.exit(); } return newScope; } //Compilable methods public CompiledScript compile(String script) throws ScriptException { return compile(preProcessScriptSource(new StringReader(script))); } public CompiledScript compile(java.io.Reader script) throws ScriptException { CompiledScript ret = null; Context cx = enterContext(); try { String filename = (String) get(ScriptEngine.FILENAME); if (filename == null) { filename = "<Unknown Source>"; } Scriptable scope = getRuntimeScope(context); Script scr = cx.compileReader(scope, preProcessScriptSource(script), filename, 1, null); ret = new RhinoCompiledScript(this, scr); } catch (Exception e) { if (DEBUG) e.printStackTrace(); throw new ScriptException(e); } finally { cx.exit(); } return ret; } //package-private helpers static Context enterContext() { // call this always so that initializer of this class runs // and initializes custom wrap factory and class shutter. return Context.enter(); } void setEngineFactory(ScriptEngineFactory fac) { factory = fac; } Object[] wrapArguments(Object[] args) { if (args == null) { return Context.emptyArgs; } Object[] res = new Object[args.length]; for (int i = 0; i < res.length; i++) { res[i] = Context.javaToJS(args[i], topLevel); } return res; } Object unwrapReturnValue(Object result) { if (result instanceof Wrapper) { result = ( (Wrapper) result).unwrap(); } return result instanceof Undefined? null : result; } protected Reader preProcessScriptSource(Reader reader) throws ScriptException { return reader; } protected void processAllTopLevelScripts(Context cx) { processTopLevelScript(TOPLEVEL_SCRIPT_NAME, cx); } protected void processTopLevelScript(String scriptName, Context cx) { InputStream toplevelScript = this.getClass().getClassLoader().getResourceAsStream(scriptName); if (toplevelScript!= null) { Reader reader = new InputStreamReader(toplevelScript); try { cx.evaluateReader(topLevel, reader, scriptName, 1, null); } catch (Exception e) { if (DEBUG) e.printStackTrace(); } finally { try { toplevelScript.close(); } catch (IOException e) { } } } } /** * The bindings function takes a JavaScript scope object * of type ExternalScriptable and returns the underlying Bindings * instance. * * var page = scope(pageBindings); * with (page) { * // code that uses page scope * } * var b = bindings(page); * // operate on bindings here. */ public static Object bindings(Context cx, Scriptable thisObj, Object[] args, Function funObj) { if (args.length == 1) { Object arg = args[0]; if (arg instanceof Wrapper) { arg = ((Wrapper)arg).unwrap(); } if (arg instanceof ExternalScriptable) { ScriptContext ctx = ((ExternalScriptable)arg).getContext(); Bindings bind = ctx.getBindings(ScriptContext.ENGINE_SCOPE); return Context.javaToJS(bind, ScriptableObject.getTopLevelScope(thisObj)); } } return cx.getUndefinedValue(); } /** * The scope function creates a new JavaScript scope object * with given Bindings object as backing store. This can be used * to create a script scope based on arbitrary Bindings instance. * For example, in webapp scenario, a 'page' level Bindings instance * may be wrapped as a scope and code can be run in JavaScripe 'with' * statement: * * var page = scope(pageBindings); * with (page) { * // code that uses page scope * } */ public static Object scope(Context cx, Scriptable thisObj, Object[] args, Function funObj) { if (args.length == 1) { Object arg = args[0]; if (arg instanceof Wrapper) { arg = ((Wrapper)arg).unwrap(); } if (arg instanceof Bindings) { ScriptContext ctx = new SimpleScriptContext(); ctx.setBindings((Bindings)arg, ScriptContext.ENGINE_SCOPE); Scriptable res = new ExternalScriptable(ctx); res.setPrototype(ScriptableObject.getObjectPrototype(thisObj)); res.setParentScope(ScriptableObject.getTopLevelScope(thisObj)); return res; } } return cx.getUndefinedValue(); } /** * The sync function creates a synchronized function (in the sense * of a Java synchronized method) from an existing function. The * new function synchronizes on the <code>this</code> object of * its invocation. * js> var o = { f : sync(function(x) { * print("entry"); * Packages.java.lang.Thread.sleep(x*1000); * print("exit"); * })}; * js> thread(function() {o.f(5);}); * entry * js> thread(function() {o.f(5);}); * js> * exit * entry * exit */ public static Object sync(Context cx, Scriptable thisObj, Object[] args, Function funObj) { if (args.length == 1 && args[0] instanceof Function) { return new Synchronizer((Function)args[0]); } else { throw Context.reportRuntimeError("wrong argument(s) for sync"); } } public static void main(String[] args) throws Exception { if (args.length == 0) { System.out.println("No file specified"); return; } InputStreamReader r = new InputStreamReader(new FileInputStream(args[0])); ScriptEngine engine = new RhinoScriptEngine(); SimpleScriptContext context = new SimpleScriptContext(); engine.put(ScriptEngine.FILENAME, args[0]); engine.eval(r, context); // added this statement to save some typing to most script authors context.getWriter().flush(); } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/CLIException.java ======================= <reponame>sidia-dev-team/GearVRf /* * This file is part of the Cliche project, licensed under MIT License. * See LICENSE.txt file in root folder of Cliche sources. */ package org.gearvrf.debug.cli; /** * * Root exception for Cliche. * * @author ASG */ public class CLIException extends Exception { public CLIException() { super(); } public CLIException(String message) { super(message); } public CLIException(Throwable cause) { super(cause); } public CLIException(String message, Throwable cause) { super(message, cause); } public static CLIException createCommandNotFound(String commandName) { return new CLIException("Unknown command: " + Token.escapeString(commandName)); } public static CLIException createCommandNotFoundForArgNum(String commandName, int argCount) { return new CLIException("There's no command " + Token.escapeString(commandName) + " taking " + argCount + " arguments"); } public static CLIException createAmbiguousCommandExc(String commandName, int argCount) { return new CLIException("Ambiguous command " + Token.escapeString(commandName) + " taking " + argCount + " arguments"); } } ======================= File: GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/RouteAnimation.java ======================= /* Copyright 2016 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.x3d; import org.gearvrf.animation.keyframe.GVRKeyFrameAnimation; /** * * @author m1.williams * Handles those <ROUTE>s that setup animations as opposed to Sensors * such as TouchSensors. * When this <ROUTE> is accessed in the parser and during the animation * loop, we have access to turning animations off and on. */ public class RouteAnimation extends Route { // If a ROUTE is associated with GVRKeyFrameAnimation, then // this value will point to it. // Assists with Touch Sensors private GVRKeyFrameAnimation gvrKeyFrameAnimation = null; public RouteAnimation(String fromNode, String fromField, String toNode, String toField) { super(fromNode, fromField, toNode, toField); } public void setGVRKeyFrameAnimation(GVRKeyFrameAnimation gvrKeyFrameAnimation) { this.gvrKeyFrameAnimation = gvrKeyFrameAnimation; } public GVRKeyFrameAnimation getGVRKeyFrameAnimation() { return this.gvrKeyFrameAnimation; } } ======================= File: GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/SettingsParser.java ======================= /* * Copyright (c) 2016. Samsung Electronics Co., LTD * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.io.cursor3d; import android.content.Context; import org.gearvrf.GVRContext; import org.gearvrf.utility.Log; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.util.List; import java.util.Map; class SettingsParser { private static final String TAG = SettingsParser.class.getSimpleName(); private static final String FILE_ENCODING = "UTF-8"; // XML Elements private static final String SETTINGS = "settings"; private static final String THEME = "theme"; private static final String CURSOR = "cursor"; private static final String GLOBAL = "global"; private static final String XML_START_TAG = "<settings>"; private static final String XML_END_TAG = "</settings>"; static void parseSettings(GVRContext context, CursorManager cursorManager) throws XmlPullParserException, IOException { InputStream in = getSettingsStream(context.getContext()); try { XmlPullParser parser = XMLUtils.initiateParser(in); readSettings(parser, context, cursorManager); } finally { if (in!= null) { in.close(); } } } private static InputStream getSettingsStream(Context context) throws IOException { File settingsFile = new File(context.getFilesDir() + "/" + CursorManager.SETTINGS_SOURCE); if (settingsFile.exists()) { Log.d(TAG, "The file exists"); return context.openFileInput(CursorManager.SETTINGS_SOURCE); } else { Log.d(TAG, "The file does not exist, opening " + CursorManager.SETTINGS_SOURCE); return context.getAssets().open(CursorManager.SETTINGS_SOURCE); } } //TODO: use a utility to read XML and convert to Object and use Objects to write XML private static void readSettings(XmlPullParser parser, GVRContext context, CursorManager cursorManager) throws XmlPullParserException, IOException { Map<String, CursorTheme> themes = cursorManager.getThemeMap(); parser.require(XmlPullParser.START_TAG, null, SETTINGS); while (parser.next()!= XmlPullParser.END_TAG) { if (parser.getEventType() == XmlPullParser.TEXT) { continue; } else if (parser.getEventType()!= XmlPullParser.START_TAG) { throw new XmlPullParserException("Cannot find start tag"); } String name = parser.getName(); Log.d(TAG, "Reading tag:" + name); // Starts by looking for the entry tag if (name.equals(GLOBAL)) { GlobalSettingsFactory.readGlobalSettings(parser); } else if (name.equals(THEME)) { Log.d(TAG, "Reading the theme tag"); CursorTheme theme = CursorThemeFactory.readTheme(parser, context); themes.put(theme.getId(), theme); } else if (name.equals(CURSOR)) { Log.d(TAG, "Reading the cursor tag"); cursorManager.addCursor(CursorFactory.readCursor(parser, context, cursorManager)); } } if (0 == cursorManager.getCursorCount()) { throw new XmlPullParserException("No cursors specified in settings.xml"); } } static void saveSettings(Context context, CursorManager cursorManager) throws IOException { Map<String, CursorTheme> themes = cursorManager.getThemeMap(); List<Cursor> cursors = cursorManager.getActiveCursors(); BufferedWriter writer = null; try { FileOutputStream outputStream = context.openFileOutput(CursorManager.SETTINGS_SOURCE, Context.MODE_PRIVATE); OutputStreamWriter ow = new OutputStreamWriter(outputStream, FILE_ENCODING); writer = new BufferedWriter(ow); writer.write(XML_START_TAG); GlobalSettingsFactory.writeGlobalSettings(writer); for (CursorTheme theme : themes.values()) { CursorThemeFactory.writeCursorTheme(theme, writer); } for (Cursor cursor : cursors) { CursorFactory.writeCursor(cursor, writer); } final List<Cursor> unusedCursorsCopy = cursorManager.getInactiveCursors(); for (Cursor cursor : unusedCursorsCopy) { CursorFactory.writeCursor(cursor, writer); } writer.write(XML_END_TAG); } finally { if (writer!= null) { writer.close(); } } } } ======================= File: GVRf/Framework/backend_monoscopic/src/main/java/org/gearvrf/MonoscopicInternalSensorListener.java ======================= <filename>GVRf/Framework/backend_monoscopic/src/main/java/org/gearvrf/MonoscopicInternalSensorListener.java<gh_stars>100-1000 /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.os.Build; import org.joml.Quaternionf; /** A listener for a TYPE_ROTATION_VECTOR type sensor. */ class MonoscopicInternalSensorListener implements SensorEventListener { private static final float SQRT_OF_HALF = (float)Math.sqrt(0.5); private static final Quaternionf COORDINATE_QUATERNION = new Quaternionf(0.0f, 0.0f, -SQRT_OF_HALF, SQRT_OF_HALF); private static final Quaternionf OFFSET_QUATERNION = new Quaternionf(0.0f, SQRT_OF_HALF, 0.0f, SQRT_OF_HALF); private static final Quaternionf CONSTANT_EXPRESSION = new Quaternionf().set(COORDINATE_QUATERNION).invert() .mul(OFFSET_QUATERNION); private MonoscopicRotationSensor mSensor; private final Quaternionf mQuaternion = new Quaternionf(); public MonoscopicInternalSensorListener(MonoscopicRotationSensor sensor) { mSensor = sensor; } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } @Override public void onSensorChanged(SensorEvent event) { float w; float x = event.values[0]; float y = event.values[1]; float z = event.values[2]; if (Build.VERSION.SDK_INT < 18) { w = getQuaternionW(event.values[0], event.values[1], event.values[2]); } else { w = event.values[3]; } mQuaternion.set(x, y, z, w); CONSTANT_EXPRESSION.mul(mQuaternion, mQuaternion); mQuaternion.mul(COORDINATE_QUATERNION); mSensor.onInternalRotationSensor(GVRTime.getCurrentTime(), mQuaternion.w, mQuaternion.x, mQuaternion.y, mQuaternion.z, 0.0f, 0.0f, 0.0f); } /** * Finds the missing value. Seems to lose a degree of freedom, but it * doesn't. That degree of freedom is already lost by the sensor. */ private float getQuaternionW(float x, float y, float z) { return (float) Math.cos(Math.asin(Math.sqrt(x * x + y * y + z * z))); } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRNodeAnimationController.java ======================= <gh_stars>0 package org.gearvrf.animation.keyframe; import java.util.ArrayList; import java.util.List; import org.gearvrf.GVRSceneObject; import org.joml.Matrix4f; /** * Controls node animation. * * A node animation continuously changes the Transform of a target {@link GVRSceneObject}. * The {@link GVRKeyFrameAnimation} can be obtained from {@linkplain org.gearvrf.scene_objects.GVRModelSceneObject * GVRModelSceneObject} using API as {@linkplain org.gearvrf.GVRContext#loadModel(String) GVRContext.loadModel}. <p> * * In order to import FBX animation correctly, it is required that key frames only use Euler angles within the * range [0, 360) degrees. To avoid ambiguity, the angle difference between two adjacent key frames should be less * than 180 degrees per component. */ public class GVRNodeAnimationController extends GVRAnimationController { private static final String TAG = GVRNodeAnimationController.class.getSimpleName(); protected GVRSceneObject sceneRoot; protected class AnimationItem { GVRSceneObject target; int channelId; AnimationItem(GVRSceneObject target, int channelId) { this.target = target; this.channelId = channelId; } } protected List<AnimationItem> animatedNodes; /** * Constructs a list of animated {@link GVRSceneObject}. * * @param sceneRoot The scene root. * @param animation The animation object. */ public GVRNodeAnimationController(GVRSceneObject sceneRoot, GVRKeyFrameAnimation animation) { super(animation); this.sceneRoot = sceneRoot; animatedNodes = new ArrayList<AnimationItem>(); if (animation!= null) { scanTree(sceneRoot); } } /* Returns true if subtree contains renderables */ protected boolean scanTree(GVRSceneObject node) { boolean containsRenderable = node.getRenderData()!= null; for (GVRSceneObject child : node.getChildren()) { containsRenderable |= scanTree(child); } // Find channel Id int channelId = animation.findChannel(node.getName()); if (channelId!= -1 && containsRenderable) { animatedNodes.add(new AnimationItem(node, channelId)); } return containsRenderable; } /** * Update node transforms to a tick. * @param animationTick * The tick to animate to. */ @Override protected void animateImpl(float animationTick) { Matrix4f[] animationTransform = animation.getTransforms(animationTick); for (AnimationItem item : animatedNodes) { item.target.getTransform().setModelMatrix(animationTransform[item.channelId]); } } } ======================= File: GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MField.java ======================= /* Copyright 2016 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.x3d.data_types; import java.util.ArrayList; /** * Defines the X3D MField data type * Per X3D spec, all Multi-Field (MF) datatypes are to implement these methods * http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/sai/MField.html */ public interface MField { /** * Removes all values in the field array, changing the array size to zero. */ public abstract void clear(); /** * Remove one element of the field array at index position, if found. Initial element is at index 0. * @param index - position of element in field array that gets removed */ public abstract void remove(int index); /** * Get the size of the underlying data array. * The size is the number of elements for that data type. * So for an MFFloat the size would be the number of float values, * but for an MFVec3f, it is the number of vectors in the * returned array (where a vector is 3 consecutive array indexes in a flat array). * @return */ public abstract int size(); } ======================= File: GVRf/Framework/backend_monoscopic/src/main/java/org/gearvrf/MonoscopicRotationSensorListener.java ======================= <filename>GVRf/Framework/backend_monoscopic/src/main/java/org/gearvrf/MonoscopicRotationSensorListener.java<gh_stars>100-1000 /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf; /** * Notification interface for {@link MonoscopicRotationSensor rotation sensor} data * events. */ interface MonoscopicRotationSensorListener { /** * Called when the active rotation sensor has generated data. Orientation is * passed as components of a quaternion. The angular velocity of the device * is passed separately for each axis; when the internal rotation sensor is * being used, these will always be {@code 0.0f}. * * @param timeStamp * Clock-time when the data was received, in nanoseconds. * @param w * The 'W' rotation component. * @param x * The 'X' rotation component. * @param y * The 'Y' rotation component. * @param z * The 'Z' rotation component. * @param gyroX * Angular velocity on the 'X' axis. * @param gyroY * Angular velocity on the 'Y' axis. * @param gyroZ * Angular velocity on the 'Z' axis. */ void onRotationSensor(long timeStamp, float w, float x, float y, float z, float gyroX, float gyroY, float gyroZ); } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRMorphController.java ======================= package org.gearvrf.animation.keyframe; import org.gearvrf.GVRMeshMorph; import org.gearvrf.PrettyPrint; import org.gearvrf.utility.Log; /** * Describes the animation of a set of floating point values. */ public final class GVRMorphController implements PrettyPrint { private static final String TAG = GVRMorphController.class.getSimpleName(); protected float[] mKeys; protected GVRFloatAnimation mKeyInterpolator; protected float[] mCurrentValues; /** * Constructor. * * @param keyData blend weight keys * @param keySize number of floats per key */ public GVRMorphController(GVRMeshMorph target, float[] keyData, int keySize) { mKeys = keyData; mKeyInterpolator = new GVRFloatAnimation(keyData, keySize); mCurrentValues = new float[keySize - 1]; } public void animate(float animationTime) { mKeyInterpolator.animate(animationTime, mCurrentValues); } @Override public void prettyPrint(StringBuffer sb, int indent) { sb.append(Log.getSpaces(indent)); sb.append(GVRMorphController.class.getSimpleName()); } @Override public String toString() { StringBuffer sb = new StringBuffer(); prettyPrint(sb, 0); return sb.toString(); } } ======================= File: GVRf/Extensions/MixedReality/src/main/java/org/gearvrf/mixedreality/arcore/ARCoreSession.java ======================= /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.mixedreality.arcore; import android.app.Activity; import android.graphics.Bitmap; import android.opengl.Matrix; import android.view.Surface; import com.google.ar.core.Anchor; import com.google.ar.core.ArCoreApk; import com.google.ar.core.AugmentedImage; import com.google.ar.core.AugmentedImageDatabase; import com.google.ar.core.Camera; import com.google.ar.core.Config; import com.google.ar.core.Frame; import com.google.ar.core.HitResult; import com.google.ar.core.Plane; import com.google.ar.core.Pose; import com.google.ar.core.Session; import com.google.ar.core.TrackingState; import com.google.ar.core.exceptions.CameraNotAvailableException; import com.google.ar.core.exceptions.UnavailableApkTooOldException; import com.google.ar.core.exceptions.UnavailableArcoreNotInstalledException; import com.google.ar.core.exceptions.UnavailableSdkTooOldException; import com.google.ar.core.exceptions.UnavailableUserDeclinedInstallationException; import org.gearvrf.GVRCameraRig; import org.gearvrf.GVRContext; import org.gearvrf.GVRDrawFrameListener; import org.gearvrf.GVRExternalTexture; import org.gearvrf.GVRMaterial; import org.gearvrf.GVRMeshCollider; import org.gearvrf.GVRPicker; import org.gearvrf.GVRRenderData; import org.gearvrf.GVRScene; import org.gearvrf.GVRSceneObject; import org.gearvrf.GVRTexture; import org.gearvrf.mixedreality.GVRAnchor; import org.gearvrf.mixedreality.GVRAugmentedImage; import org.gearvrf.mixedreality.GVRHitResult; import org.gearvrf.mixedreality.GVRLightEstimate; import org.gearvrf.mixedreality.GVRPlane; import org.gearvrf.mixedreality.IAnchorEventsListener; import org.gearvrf.mixedreality.IAugmentedImageEventsListener; import org.gearvrf.mixedreality.ICloudAnchorListener; import org.gearvrf.mixedreality.IPlaneEventsListener; import org.gearvrf.mixedreality.MRCommon; import org.gearvrf.mixedreality.CameraPermissionHelper; import org.gearvrf.utility.Log; import org.joml.Math; import org.joml.Matrix4f; import org.joml.Quaternionf; import org.joml.Vector2f; import org.joml.Vector3f; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; public class ARCoreSession extends MRCommon { private static float PASSTHROUGH_DISTANCE = 100.0f; private static float AR2VR_SCALE = 100; private Session mSession; private boolean mInstallRequested; private Config mConfig; private GVRScene mVRScene; private GVRSceneObject mARPassThroughObject; private Frame mLastARFrame; private Frame arFrame; private ARCoreHandler mARCoreHandler; private boolean mEnableCloudAnchor; /* From AR to GVR space matrices */ private float[] mGVRModelMatrix = new float[16]; private float[] mARViewMatrix = new float[16]; private float[] mGVRCamMatrix = new float[16]; private float[] mModelViewMatrix = new float[16]; private Vector3f mDisplayGeometry; private ARCoreHelper mArCoreHelper; private final HashMap<Anchor, ICloudAnchorListener> pendingAnchors = new HashMap<>(); public ARCoreSession(GVRContext gvrContext, boolean enableCloudAnchor) { super(gvrContext); mSession = null; mLastARFrame = null; mVRScene = gvrContext.getMainScene(); mArCoreHelper = new ARCoreHelper(gvrContext, mVRScene); mEnableCloudAnchor = enableCloudAnchor; } @Override protected void onResume() { Log.d(TAG, "onResumeAR"); if (mSession == null) { if (!checkARCoreAndCamera()) { return; } // Create default config and check if supported. mConfig = new Config(mSession); if (mEnableCloudAnchor) { mConfig.setCloudAnchorMode(Config.CloudAnchorMode.ENABLED); } mConfig.setUpdateMode(Config.UpdateMode.LATEST_CAMERA_IMAGE); if (!mSession.isSupported(mConfig)) { showSnackbarMessage("This device does not support AR", true); } mSession.configure(mConfig); } showLoadingMessage(); try { mSession.resume(); } catch (CameraNotAvailableException e) { e.printStackTrace(); } mGvrContext.runOnGlThread(new Runnable() { @Override public void run() { try { onInitARCoreSession(mGvrContext); } catch (CameraNotAvailableException e) { e.printStackTrace(); } } }); } @Override public void onPause() { Log.d(TAG, "onPause"); if (mSession!= null) { mSession.pause(); } } private boolean checkARCoreAndCamera() { Activity activity = mGvrContext.getApplication().getActivity(); Exception exception = null; String message = null; try { switch (ArCoreApk.getInstance().requestInstall(activity,!mInstallRequested)) { case INSTALL_REQUESTED: mInstallRequested = true; return false; case INSTALLED: break; } // ARCore requires camera permissions to operate. If we did not yet obtain runtime // permission on Android M and above, now is a good time to ask the user for it. if (!CameraPermissionHelper.hasCameraPermission(activity)) { CameraPermissionHelper.requestCameraPermission(activity); return false; } mSession = new Session(/* context= */ activity); } catch (UnavailableArcoreNotInstalledException | UnavailableUserDeclinedInstallationException e) { message = "Please install ARCore"; exception = e; } catch (UnavailableApkTooOldException e) { message = "Please update ARCore"; exception = e; } catch (UnavailableSdkTooOldException e) { message = "Please update this app"; exception = e; } catch (Exception e) { message = "This device does not support AR"; exception = e; } if (message!= null) { showSnackbarMessage(message, true); android.util.Log.e(TAG, "Exception creating session", exception); return false; } return true; } private void showSnackbarMessage(String message, boolean finishOnDismiss) { Log.d(TAG, message); if (finishOnDismiss) { //FIXME: finish(); } } private void showLoadingMessage() { showSnackbarMessage("Searching for surfaces...", false); } private void onInitARCoreSession(GVRContext gvrContext) throws CameraNotAvailableException { GVRTexture passThroughTexture = new GVRExternalTexture(gvrContext); mSession.setCameraTextureName(passThroughTexture.getId()); // FIXME: detect VR screen aspect ratio. Using empirical 16:9 aspect ratio /* Try other aspect ration whether virtual objects looks jumping ou sliding during camera's rotation. */ mSession.setDisplayGeometry(Surface.ROTATION_90, 160, 90); mLastARFrame = mSession.update(); mDisplayGeometry = configDisplayGeometry(mLastARFrame.getCamera()); mSession.setDisplayGeometry(Surface.ROTATION_90, (int)mDisplayGeometry.x, (int)mDisplayGeometry.y); /* To render texture from phone's camera */ mARPassThroughObject = new GVRSceneObject(gvrContext, mDisplayGeometry.x, mDisplayGeometry.y, passThroughTexture, GVRMaterial.GVRShaderType.OES.ID); mARPassThroughObject.getRenderData().setRenderingOrder(GVRRenderData.GVRRenderingOrder.BACKGROUND); mARPassThroughObject.getRenderData().setDepthTest(false); mARPassThroughObject.getTransform().setPosition(0, 0, mDisplayGeometry.z); mARPassThroughObject.attachComponent(new GVRMeshCollider(gvrContext, true)); mVRScene.addSceneObject(mARPassThroughObject); /* AR main loop */ mARCoreHandler = new ARCoreHandler(); gvrContext.registerDrawFrameListener(mARCoreHandler); mGVRCamMatrix = mVRScene.getMainCameraRig().getHeadTransform().getModelMatrix(); updateAR2GVRMatrices(mLastARFrame.getCamera(), mVRScene.getMainCameraRig()); } public class ARCoreHandler implements GVRDrawFrameListener { @Override public void onDrawFrame(float v) { try { arFrame = mSession.update(); } catch (CameraNotAvailableException e) { e.printStackTrace(); mGvrContext.unregisterDrawFrameListener(this); return; } Camera arCamera = arFrame.getCamera(); if (arFrame.getTimestamp() == mLastARFrame.getTimestamp()) { // FIXME: ARCore works at 30fps. return; } if (arCamera.getTrackingState()!= TrackingState.TRACKING) { // Put passthrough object in from of current VR cam at paused states. updateAR2GVRMatrices(arCamera, mVRScene.getMainCameraRig()); updatePassThroughObject(mARPassThroughObject); return; } // Update current AR cam's view matrix. arCamera.getViewMatrix(mARViewMatrix, 0); // Update passthrough object with last VR cam matrix updatePassThroughObject(mARPassThroughObject); mArCoreHelper.updatePlanes(mSession.getAllTrackables(Plane.class), mARViewMatrix, mGVRCamMatrix, AR2VR_SCALE); mArCoreHelper.updateAugmentedImages(arFrame.getUpdatedTrackables(AugmentedImage.class)); mArCoreHelper.updateAnchors(mARViewMatrix, mGVRCamMatrix, AR2VR_SCALE); updateCloudAnchors(arFrame.getUpdatedAnchors()); mLastARFrame = arFrame; // Update current VR cam's matrix to next update of passtrhough and virtual objects. // AR/30fps vs VR/60fps mGVRCamMatrix = mVRScene.getMainCameraRig().getHeadTransform().getModelMatrix(); } } private void updateAR2GVRMatrices(Camera arCamera, GVRCameraRig cameraRig) { arCamera.getViewMatrix(mARViewMatrix, 0); mGVRCamMatrix = cameraRig.getHeadTransform().getModelMatrix(); } private void updatePassThroughObject(GVRSceneObject object) { Matrix.setIdentityM(mModelViewMatrix, 0); Matrix.translateM(mModelViewMatrix, 0, 0, 0, mDisplayGeometry.z); Matrix.multiplyMM(mGVRModelMatrix, 0, mGVRCamMatrix, 0, mModelViewMatrix, 0); object.getTransform().setModelMatrix(mGVRModelMatrix); } private static Vector3f configDisplayGeometry(Camera arCamera) { float near = 0.1f; float far = 100.0f; // Get phones' cam projection matrix. float[] m = new float[16]; arCamera.getProjectionMatrix(m, 0, near, far); Matrix4f projmtx = new Matrix4f(); projmtx.set(m); float aspectRatio = projmtx.m11()/projmtx.m00(); float arCamFOV = projmtx.perspectiveFov(); float quadDistance = PASSTHROUGH_DISTANCE; float quadHeight = new Float(2 * quadDistance * Math.tan(arCamFOV * 0.5f)); float quadWidth = quadHeight * aspectRatio; android.util.Log.d(TAG, "ARCore configured to: passthrough[w: " + quadWidth + ", h: " + quadHeight +", z: " + quadDistance + "], cam fov: " +Math.toDegrees(arCamFOV) + ", aspect ratio: " + aspectRatio); return new Vector3f(quadWidth, quadHeight, -PASSTHROUGH_DISTANCE); } @Override protected GVRSceneObject onGetPassThroughObject() { return mARPassThroughObject; } @Override protected void onRegisterPlaneListener(IPlaneEventsListener listener) { mArCoreHelper.registerPlaneListener(listener); } @Override protected void onRegisterAnchorListener(IAnchorEventsListener listener) { mArCoreHelper.registerAnchorListener(listener); } @Override protected void onRegisterAugmentedImageListener(IAugmentedImageEventsListener listener) { mArCoreHelper.registerAugmentedImageListener(listener); } @Override protected ArrayList<GVRPlane> onGetAllPlanes() { return mArCoreHelper.getAllPlanes(); } @Override protected GVRAnchor onCreateAnchor(float[] pose, GVRSceneObject sceneObject) { float[] translation = new float[3]; float[] rotation = new float[4]; convertMatrixPoseToVector(pose, translation, rotation); Anchor anchor = mSession.createAnchor(new Pose(translation, rotation)); return mArCoreHelper.createAnchor(anchor, sceneObject); } @Override protected void onUpdateAnchorPose(GVRAnchor anchor, float[] pose) { float[] translation = new float[3]; float[] rotation = new float[4]; convertMatrixPoseToVector(pose, translation, rotation); Anchor arAnchor = mSession.createAnchor(new Pose(translation, rotation)); mArCoreHelper.updateAnchorPose((ARCoreAnchor)anchor, arAnchor); } @Override protected void onRemoveAnchor(GVRAnchor anchor) { mArCoreHelper.removeAnchor((ARCoreAnchor)anchor); } /** * This method hosts an anchor. The {@code listener} will be invoked when the results are * available. */ @Override synchronized protected void onHostAnchor(GVRAnchor anchor, ICloudAnchorListener listener) { Anchor newAnchor = mSession.hostCloudAnchor(((ARCoreAnchor)anchor).getAnchorAR()); pendingAnchors.put(newAnchor, listener); } /** * This method resolves an anchor. The {@code listener} will be invoked when the results are * available. */ synchronized protected void onResolveCloudAnchor(String anchorId, ICloudAnchorListener listener) { Anchor newAnchor = mSession.resolveCloudAnchor(anchorId); pendingAnchors.put(newAnchor, listener); } /** Should be called with the updated anchors available after a {@link Session#update()} call. */ synchronized void updateCloudAnchors(Collection<Anchor> updatedAnchors) { for (Anchor anchor : updatedAnchors) { if (pendingAnchors.containsKey(anchor)) { Anchor.CloudAnchorState cloudState = anchor.getCloudAnchorState(); if (isReturnableState(cloudState)) { ICloudAnchorListener listener = pendingAnchors.remove(anchor); GVRAnchor newAnchor = mArCoreHelper.createAnchor(anchor, null); listener.onTaskComplete(newAnchor); } } } } /** Used to clear any currently registered listeners, so they wont be called again. */ synchronized void clearListeners() { pendingAnchors.clear(); } private static boolean isReturnableState(Anchor.CloudAnchorState cloudState) { switch (cloudState) { case NONE: case TASK_IN_PROGRESS: return false; default: return true; } } @Override protected void onSetEnableCloudAnchor(boolean enableCloudAnchor) { mEnableCloudAnchor = enableCloudAnchor; } @Override protected GVRHitResult onHitTest(GVRSceneObject sceneObj, GVRPicker.GVRPickedObject collision) { if (sceneObj!= mARPassThroughObject) return null; Vector2f tapPosition = convertToDisplayGeometrySpace(collision.getHitLocation()); List<HitResult> hitResult = arFrame.hitTest(tapPosition.x, tapPosition.y); return mArCoreHelper.hitTest(hitResult); } @Override protected GVRLightEstimate onGetLightEstimate() { return mArCoreHelper.getLightEstimate(arFrame.getLightEstimate()); } @Override protected void onSetAugmentedImage(Bitmap image) { ArrayList<Bitmap> imagesList = new ArrayList<>(); imagesList.add(image); onSetAugmentedImages(imagesList); } @Override protected void onSetAugmentedImages(ArrayList<Bitmap> imagesList) { AugmentedImageDatabase augmentedImageDatabase = new AugmentedImageDatabase(mSession); for (Bitmap image: imagesList) { augmentedImageDatabase.addImage("image_name", image); } mConfig.setAugmentedImageDatabase(augmentedImageDatabase); mSession.configure(mConfig); } @Override protected ArrayList<GVRAugmentedImage> onGetAllAugmentedImages() { return mArCoreHelper.getAllAugmentedImages(); } private Vector2f convertToDisplayGeometrySpace(float[] hitPoint) { final float hitX = hitPoint[0] + 0.5f * mDisplayGeometry.x; final float hitY = mDisplayGeometry.y - hitPoint[1] - 0.5f * mDisplayGeometry.y; return new Vector2f(hitX, hitY); } private void convertMatrixPoseToVector(float[] pose, float[] translation, float[] rotation) { Vector3f vectorTranslation = new Vector3f(); Quaternionf quaternionRotation = new Quaternionf(); Matrix4f matrixPose = new Matrix4f(); matrixPose.set(pose); matrixPose.getTranslation(vectorTranslation); translation[0] = vectorTranslation.x; translation[1] = vectorTranslation.y; translation[2] = vectorTranslation.z; matrixPose.getNormalizedRotation(quaternionRotation); rotation[0] = quaternionRotation.x; rotation[1] = quaternionRotation.y; rotation[2] = quaternionRotation.z; rotation[3] = quaternionRotation.w; } } ======================= File: GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRPhysicsContext.java ======================= <reponame>sidia-dev-team/GearVRf<gh_stars>100-1000 package org.gearvrf.physics; /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import android.os.Handler; import android.os.HandlerThread; /** * This class represents the Physics context * with its own main loop. */ public class GVRPhysicsContext { private static GVRPhysicsContext mInstance; private final HandlerThread mHandlerThread; private final Handler mHandler; public static GVRPhysicsContext getInstance() { if (mInstance == null) { mInstance = new GVRPhysicsContext(); } return mInstance; } private GVRPhysicsContext() { mHandlerThread = new HandlerThread("gvrf-physics"); mHandlerThread.start(); mHandler = new Handler(mHandlerThread.getLooper()); } public boolean runOnPhysicsThread(Runnable r) { return mHandler.post(r); } public boolean runDelayedOnPhysicsThread(Runnable r, long delayMillis) { return mHandler.postDelayed(r, delayMillis); } public boolean runAtTimeOnPhysicsThread(Runnable r, long uptimeMillis) { return mHandler.postAtTime(r, uptimeMillis); } public void removeTask(Runnable r) { mHandler.removeCallbacks(r); } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/GVRRenderTexture.java ======================= /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf; /** Frame Buffer object. */ public class GVRRenderTexture extends GVRTexture { /** * Constructs a GVRRenderTexture for a frame buffer of the specified size. * * @param gvrContext * Current gvrContext * @param width * Width of the frame buffer. * @param height * Height of the frame buffer. */ public GVRRenderTexture(GVRContext gvrContext, int width, int height) { super(gvrContext, NativeRenderTexture.ctor(width, height)); mWidth = width; mHeight = height; } /** * Constructs a GVRRenderTexture for a frame buffer of the specified size, * with MSAA enabled at the specified sample count. * * @param gvrContext * Current gvrContext * @param width * Width of the frame buffer. * @param height * Height of the frame buffer. * @param sampleCount * MSAA sample count. */ public GVRRenderTexture(GVRContext gvrContext, int width, int height, int sampleCount) { this(gvrContext,width,height,sampleCount,1); } public GVRRenderTexture(GVRContext gvrContext, int width, int height, int sampleCount, int number_views) { super(gvrContext, NativeRenderTexture.ctorMSAA(width, height, sampleCount, number_views)); mWidth = width; mHeight = height; } public GVRRenderTexture(GVRContext gvrContext, int width, int height, long ptr){ super(gvrContext,ptr); mWidth = width; mHeight= height; } /** * Constructs a GVRRenderTexture for a frame buffer of the specified size, * with MSAA enabled at the specified sample count, and with specified color * format, depth format, resolution depth and texture parameters. * * @param gvrContext * Current gvrContext * @param width * Width of the frame buffer. * @param height * Height of the frame buffer. * @param sampleCount * MSAA sample count. * @param colorFormat * GVR color format. * See {@linkplain org.gearvrf.utility.VrAppSettings.EyeBufferParams.ColorFormat ColorFormat}. * @param depthFormat * Depth format. * See {@linkplain org.gearvrf.utility.VrAppSettings.EyeBufferParams.DepthFormat DepthFormat}. * @param resolveDepth * If true, resolves the depth buffer into a texture. * @param parameters * Texture parameters. See {@link GVRTextureParameters}. * */ public GVRRenderTexture(GVRContext gvrContext, int width, int height, int sampleCount, int colorFormat, int depthFormat, boolean resolveDepth, GVRTextureParameters parameters) { this(gvrContext, width, height, sampleCount, colorFormat, depthFormat, resolveDepth, parameters, 1); } /** * Constructs a GVRRenderTexture for a frame buffer of the specified size, * with MSAA enabled at the specified sample count, and with specified color * format, depth format, resolution depth and texture parameters. * * @param gvrContext * Current gvrContext * @param width * Width of the frame buffer. * @param height * Height of the frame buffer. * @param sampleCount * MSAA sample count. * @param colorFormat * GVR color format. * See {@linkplain org.gearvrf.utility.VrAppSettings.EyeBufferParams.ColorFormat ColorFormat}. * @param depthFormat * Depth format. * See {@linkplain org.gearvrf.utility.VrAppSettings.EyeBufferParams.DepthFormat DepthFormat}. * @param resolveDepth * If true, resolves the depth buffer into a texture. * @param parameters * Texture parameters. See {@link GVRTextureParameters}. * @param numberViews * If multiview, it should be 2 or else 1. */ public GVRRenderTexture(GVRContext gvrContext, int width, int height, int sampleCount, int colorFormat, int depthFormat, boolean resolveDepth, GVRTextureParameters parameters, int numberViews) { super(gvrContext, NativeRenderTexture.ctorWithParameters(width, height, sampleCount, colorFormat, depthFormat, resolveDepth, parameters.getCurrentValuesArray(), numberViews)); mWidth = width; mHeight = height; } GVRRenderTexture(GVRContext gvrContext, long ptr) { super(gvrContext, ptr); } /** * Return the width of GVRRenderTexture (FBO) */ public int getWidth() { return mWidth; } /** * Return the height of GVRRenderTexture (FBO) */ public int getHeight() { return mHeight; } void beginRendering() { NativeRenderTexture.beginRendering(getNative()); } void endRendering() { NativeRenderTexture.endRendering(getNative()); } /** * Return the render texture. * * @param readbackBuffer * A preallocated IntBuffer to receive the data from the texture. Its capacity should * be width * height. The output pixel format is GPU format GL_RGBA packed as an 32-bit * integer. * * @return true if successful. */ boolean readRenderResult(int[] readbackBuffer) { return NativeRenderTexture.readRenderResult(getNative(), readbackBuffer); } /** * Bind the framebuffer for this GVRRenderTexture. * * Before calling this, remember to retrieve the currently bound framebuffer (with glGetIntegerv(GL_FRAMEBUFFER_BINDING, int[])) so you can restore it after issuing calls to this GVRRenderTexture. */ public void bind() { NativeRenderTexture.bind(getNative()); } private int mWidth, mHeight; } class NativeRenderTexture { static native long ctor(int width, int height); static native long ctorMSAA(int width, int height, int sampleCount, int number_views); static native long ctorWithParameters(int width, int height, int sampleCount, int colorFormat, int depthFormat, boolean resolveDepth, int[] parameters, int number_views); static native long ctorArray(int width, int height, int samples, int layers); static native void beginRendering(long ptr); static native void endRendering(long ptr); static native boolean readRenderResult(long ptr, int[] readbackBuffer); static native void bind(long ptr); } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRMorphAnimation.java ======================= package org.gearvrf.animation; import org.gearvrf.GVRHybridObject; import org.gearvrf.GVRMeshMorph; import org.gearvrf.PrettyPrint; import org.gearvrf.animation.keyframe.GVRFloatAnimation; import org.gearvrf.utility.Log; /** * Describes the animation of a set of floating point values. */ public final class GVRMorphAnimation extends GVRAnimation implements PrettyPrint { private static final String TAG = GVRMorphAnimation.class.getSimpleName(); protected float[] mKeys; protected GVRFloatAnimation mKeyInterpolator; protected float[] mCurrentValues; /** * Constructor. * * @param keyData blend weight keys * @param keySize number of floats per key */ public GVRMorphAnimation(GVRMeshMorph target, float[] keyData, int keySize) { super(target, keyData[keyData.length - keySize] - keyData[0]); mKeys = keyData; mKeyInterpolator = new GVRFloatAnimation(keyData, keySize); mCurrentValues = new float[keySize - 1]; } public void animate(GVRHybridObject object, float animationTime) { GVRMeshMorph morph = (GVRMeshMorph) mTarget; mKeyInterpolator.animate(animationTime * mDuration, mCurrentValues); morph.setWeights(mCurrentValues); } @Override public void prettyPrint(StringBuffer sb, int indent) { sb.append(Log.getSpaces(indent)); sb.append(GVRMorphAnimation.class.getSimpleName()); } @Override public String toString() { StringBuffer sb = new StringBuffer(); prettyPrint(sb, 0); return sb.toString(); } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/GVRExternalScene.java ======================= <gh_stars>100-1000 package org.gearvrf; import org.gearvrf.GVRBehavior; import org.gearvrf.GVRSceneObject; import org.gearvrf.animation.GVRAnimator; import org.gearvrf.utility.Log; import org.gearvrf.GVRContext; import java.io.IOException; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; /** * Component which loads an asset under it's owner. * This allows you to reference external assets from your * scene more easily and defer their loading. * @see GVRAssetLoader */ public class GVRExternalScene extends GVRBehavior { private static final String TAG = Log.tag(GVRExternalScene.class); static private long TYPE_EXTERNALSCENE = newComponentType(GVRExternalScene.class); private String mFilePath; private boolean mReplaceScene; private EnumSet<GVRImportSettings> mImportSettings = null; public final GVRResourceVolume mVolume; /** * Constructs an external scene component to load the given asset file. * @param ctx GVRContext that owns this component * @param filePath full path to the asset to load * @param replaceScene true to replace the current scene, false to just add the model */ public GVRExternalScene(GVRContext ctx, String filePath, boolean replaceScene) { super(ctx); mType = getComponentType(); mVolume = new GVRResourceVolume(ctx, filePath); mFilePath = filePath; mReplaceScene = replaceScene; mImportSettings = GVRImportSettings.getRecommendedSettings(); } /** * Constructs an external scene component to load the given asset file. * @param volume GVRResourceVolume containing the path of the asset. * @param replaceScene true to replace the current scene, false to just add the model */ public GVRExternalScene(GVRResourceVolume volume, boolean replaceScene) { super(volume.gvrContext); mType = getComponentType(); mVolume = volume; mFilePath = volume.getFullPath(); mReplaceScene = replaceScene; mImportSettings = GVRImportSettings.getRecommendedSettings(); } /** * Constructs an external scene component to load the given asset file. * @param volume GVRResourceVolume containing the path of the asset. * @param settings import settings * @param replaceScene true to replace the current scene, false to just add the model */ public GVRExternalScene(GVRResourceVolume volume, EnumSet<GVRImportSettings> settings, boolean replaceScene) { super(volume.gvrContext); mImportSettings = settings; mType = getComponentType(); mVolume = volume; mFilePath = volume.getFullPath(); mReplaceScene = replaceScene; } static public long getComponentType() { return TYPE_EXTERNALSCENE; } /** * Determines whether the loaded asset should replace the whole scene or not. * @return true to replace scene, false to just load the model into the current scene. */ public boolean replaceScene() { return mReplaceScene; } /** * Gets the path to the asset to be loaded by this component. * If the path begins with "http:" or "https:" it is assumed to * be a URL. If it starts with "sd:", it references assets on * the SD card. Otherwise assets are assumed to be in the "assets" directory. * @return path to external asset */ public String getFilePath() { return mFilePath; } /** * Get the GVRAnimator containing the animations for the loaded asset. * @return GVRAnimator if available, else null */ public GVRAnimator getAnimator() { return (GVRAnimator) getOwnerObject().getComponent(GVRAnimator.getComponentType()); } /** * Get the GVRCameraRig for the main camera of the loaded asset. * * @return camere rig of main camera or null if not available */ public GVRCameraRig getCameraRig() { return (GVRCameraRig) getOwnerObject().getComponent(GVRCameraRig.getComponentType()); } /** * Loads the asset referenced by the file name * under the owner of this component. * If this component was constructed to replace the scene with * the asset, the scene will contain only the owner of this * component upon return. Otherwise, the loaded asset is a * child of this component's owner. * * Loading the asset is performed in a separate thread. * This function returns before the asset has finished loading. * IAssetEvents are emitted to the event listener on the context. * * @param scene scene to add the model to, null is permissible * @return always true */ public boolean load(GVRScene scene) { GVRAssetLoader loader = getGVRContext().getAssetLoader(); if (scene == null) { scene = getGVRContext().getMainScene(); } if (mReplaceScene) { loader.loadScene(getOwnerObject(), mVolume, mImportSettings, scene, null); } else { loader.loadModel(getOwnerObject(), mVolume, mImportSettings, scene); } return true; } /** * Loads the asset referenced by the file name * under the owner of this component. * If this component was constructed to replace the scene with * the asset, the main scene of the current context * will contain only the owner of this * component upon return. Otherwise, the loaded asset is a * child of this component's owner. * * Loading the asset is performed in a separate thread. * This function returns before the asset has finished loading. * IAssetEvents are emitted to the input event handler and * to any event listener on the context. * * @param handler * IAssetEvents handler to process asset loading events */ public void load(IAssetEvents handler) { GVRAssetLoader loader = getGVRContext().getAssetLoader(); if (mReplaceScene) { loader.loadScene(getOwnerObject(), mVolume, mImportSettings, getGVRContext().getMainScene(), handler); } else { loader.loadModel(mVolume, getOwnerObject(), mImportSettings, true, handler); } } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/GVRFutureOnGlThread.java ======================= /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf; import java.util.concurrent.Callable; import java.util.concurrent.CancellationException; import java.util.concurrent.RunnableFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; /** * This is a special RunnableFuture implementation ONLY FOR the case that when * in a non-GL thread you want to push a asynchronous call with return value to * GL thread, ex. trying to update bitmap of a texture in input event thread. * * Please be aware that this is not a common Future implementation. It is not * recommended to use this class for common Future use like * Thread.start(GVRFutureOnGlThread). * * The most common use cases should be with GVRContext.runOnGlThread. You can * submit the call request through GVRContext.runOnGlThread(GVRFutureOnGlThread) * and get the result with get() method. Just be careful that it's best to call * GVRContext.runOnGlThread(GVRFutureOnGlThread) when * GVRContext.isCurrentThreadGLThread() returns false since you can directly * call GVRFutureOnGlThread.run() while in GL thread. * */ public class GVRFutureOnGlThread<T> implements RunnableFuture<T> { private Callable<T> mCallable; private T t; private boolean mIsDone; private boolean mIsStarted; private boolean mIsCancelled; private final Object[] lock = new Object[0]; /** * Construct a call request. * * @param callable * The call you want to make happen in GL thread. */ public GVRFutureOnGlThread(Callable<T> callable) { mCallable = callable; } /** * Where the call actually happens. If you submit the call through * GVRContext.runOnGlThread(). This will be automatically called in GL * thread. You can also directly call this function while in GL thread. */ @Override public void run() { synchronized (lock) { if (mIsDone || mIsCancelled) { return; } mIsStarted = true; } try { t = mCallable.call(); } catch (Exception e) { e.printStackTrace(); } synchronized (lock) { mIsDone = true; lock.notifyAll(); } } /** * The result we get after run() successfully executed. * * @return The result from the Callable we put in. * @throws InterruptedException * @throws CancellationException * If the task was successfully cancelled. */ @Override public T get() throws InterruptedException { try { get(0, null); } catch (TimeoutException e) { e.printStackTrace(); } return t; } /** * Normally, a Future.cancel(true) means you can force interrupt the thread * which is running the request.But GVRFutureOnGlThread will probably run on * GL thread. An Interruption on GL thread means forced stop on the app. So * currently we only support the cancellation before the task get executed. * * @return if the cancellation request is successful. */ @Override public boolean cancel(boolean mayInterruptIfRunning) { synchronized (lock) { if (!mIsStarted) { mIsCancelled = true; lock.notifyAll(); } } return mIsCancelled; } /** * To see if the task is successfully cancelled or not. * * @return If current task is cancelled. */ @Override public boolean isCancelled() { return mIsCancelled; } /** * To see if current task is done. * * @return If current task is done. */ @Override public boolean isDone() { return mIsDone; } /** * To get the result we get from run(). With timeout request. * * @param timeout * The timeout number. * @param unit * The time unit bound to timeout number. * @return The result from the Callable we put in. * * @throws InterruptedException * When this thread is interrupted while waiting. * @throws CancellationException * When the callable task got successfully cancelled. * @throws TimeOutException * When the execution of the callable call() out of timeout * limitation. */ @Override public T get(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { synchronized (lock) { if (mIsCancelled) { throw new CancellationException( "The task on GVRFutureOnGlThread has already been cancelled."); } if (mIsDone) { return t; } if(unit == null){ lock.wait(); }else{ lock.wait(unit.convert(timeout, TimeUnit.MILLISECONDS)); } if (mIsCancelled) { throw new CancellationException( "The task on GVRFutureOnGlThread has already been cancelled."); } if (!mIsDone) { throw new TimeoutException("Request time out for" + unit.convert(timeout, TimeUnit.MILLISECONDS) + "ms"); } return t; } } } ======================= File: GVRf/Framework/framework/src/main/java/org/gearvrf/GVRColliderGroup.java ======================= /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * Holds any number of {@linkplain GVRCollider} instances * * Ray casting is computationally expensive. Rather than probing the entire * scene graph, GVRF requires you to mark parts of the scene as "pickable" by * adding their meshes (or, more cheaply if less precisely, their * {@linkplain GVRMesh#getBoundingBox() bounding box}) to a * {@link GVRCollider}; * {@linkplain GVRSceneObject#attachCollider(GVRCollider)} * attaching that collider to a {@linkplain GVRSceneObject scene object}; and * setting the collider's {@linkplain #setEnable(boolean) enabled flag.} * * One can use this class to specify multiple colliders for a * single {@link GVRSceneObject}. */ public class GVRColliderGroup extends GVRCollider implements IComponentGroup<GVRCollider> { /** * Default implementation for IComponentGroup that * maintains an iterable list of components. * * @param <T> class of component in the group */ private final static class Group<T extends GVRComponent> implements Iterable<T> { List<T> mComponents = new ArrayList<T>(); public Iterator<T> iterator() { Iterator<T> iter = new Iterator<T>() { int mIndex = 0; public boolean hasNext() { return mIndex < getSize(); } public T next() { if (mIndex < getSize()) { return mComponents.get(mIndex++); } return null; } }; return iter; } public void addChild(T child) { mComponents.add(child); } public void removeChild(T child) { mComponents.remove(child); } public int getSize() { return mComponents.size(); } public T getChildAt(int index) { return mComponents.get(index); } }; Group<GVRCollider> mGroup = new Group<>(); /** * Constructor * * @param gvrContext Current {@link GVRContext} */ public GVRColliderGroup(GVRContext gvrContext) { super(gvrContext, NativeColliderGroup.ctor()); } /** * Add a {@link GVRCollider} to this collider-group * * @param collider The {@link GVRCollider} to add */ public void addCollider(GVRCollider collider) { mGroup.addChild(collider); NativeComponent.addChildComponent(getNative(), collider.getNative()); } public void addChildComponent(GVRCollider collider) { mGroup.addChild(collider); NativeComponent.addChildComponent(getNative(), collider.getNative()); } public int getSize() { return mGroup.getSize(); } public GVRCollider getChildAt(int index) { return mGroup.getChildAt(index); } public Iterator<GVRCollider> iterator() { return mGroup.iterator(); } /** * Remove a {@link GVRCollider} from this collider-group. * * No exception is thrown if the collider is not held by this collider-group. * * @param collider The {@link GVRCollider} to remove * */ public void removeCollider(GVRCollider collider) { mGroup.removeChild(collider); NativeComponent.removeChildComponent(getNative(), collider.getNative()); } public void removeChildComponent(GVRCollider collider) { mGroup.removeChild(collider); NativeComponent.removeChildComponent(getNative(), collider.getNative()); } } class NativeColliderGroup { static native long ctor(); } ======================= File: GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRFixedConstraint.java ======================= <filename>GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRFixedConstraint.java /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.physics; import org.gearvrf.GVRContext; /** * Represents a constraint that forces two {@linkplain GVRRigidBody rigid bodies} to keep same * distance and same rotation in respect to each other. */ public class GVRFixedConstraint extends GVRConstraint { /** * Constructs new instance of fixed constraint. * * @param gvrContext the context of the app * @param rigidBodyB the second rigid body (not the owner) in this constraint */ public GVRFixedConstraint(GVRContext gvrContext, GVRRigidBody rigidBodyB) { this(gvrContext, Native3DFixedConstraint.ctor(rigidBodyB.getNative())); mBodyB = rigidBodyB; } /** Used only by {@link GVRPhysicsLoader} */ GVRFixedConstraint(GVRContext gvrContext, long nativeConstraint) { super(gvrContext, nativeConstraint); } } class Native3DFixedConstraint { static native long ctor( long rbB); } ======================= File: GVRf/Extensions/MixedReality/src/main/java/org/gearvrf/mixedreality/arcore/ARCoreHelper.java ======================= <reponame>sidia-dev-team/GearVRf /* Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gearvrf.mixedreality.arcore; import com.google.ar.core.Anchor; import com.google.ar.core.AugmentedImage; import com.google.ar.core.HitResult; import com.google.ar.core.LightEstimate; import com.google.ar.core.Plane; import com.google.ar.core.Trackable; import com.google.ar.core.TrackingState; import org.gearvrf.GVRContext; import org.gearvrf.GVRScene; import org.gearvrf.GVRSceneObject; import org.gearvrf.mixedreality.GVRAnchor; import org.gearvrf.mixedreality.GVRAugmentedImage; import org.gearvrf.mixedreality.GVRHitResult; import org.gearvrf.mixedreality.GVRLightEstimate; import org.gearvrf.mixedreality.GVRPlane; import org.gearvrf.mixedreality.GVRTrackingState; import org.gearvrf.mixedreality.IAnchorEventsListener; import org.gearvrf.mixedreality.IAugmentedImageEventsListener; import org.gearvrf.mixedreality.IPlaneEventsListener; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; public class ARCoreHelper { private GVRContext mGvrContext; private GVRScene mGvrScene; private Map<Plane, ARCorePlane> mArPlanes; private Map<AugmentedImage, ARCoreAugmentedImage> mArAugmentedImages; private List<ARCoreAnchor> mArAnchors; private ArrayList<IPlaneEventsListener> planeEventsListeners = new ArrayList<>(); private ArrayList<IAnchorEventsListener> anchorEventsListeners = new ArrayList<>(); private ArrayList<IAugmentedImageEventsListener> augmentedImageEventsListeners = new ArrayList<>(); public ARCoreHelper(GVRContext gvrContext, GVRScene gvrScene) { mGvrContext = gvrContext; mGvrScene = gvrScene; mArPlanes = new HashMap<>(); mArAugmentedImages = new HashMap<>(); mArAnchors = new ArrayList<>(); } public void updatePlanes(Collection<Plane> allPlanes, float[] arViewMatrix, float[] vrCamMatrix, float scale) { ARCorePlane arCorePlane; for (Plane plane: allPlanes) { if (plane.getTrackingState()!= TrackingState.TRACKING || mArPlanes.containsKey(plane)) { continue; } arCorePlane = createPlane(plane); // FIXME: New planes are updated two times arCorePlane.update(arViewMatrix, vrCamMatrix, scale); notifyPlaneDetectionListeners(arCorePlane); } for (Plane plane: mArPlanes.keySet()) { arCorePlane = mArPlanes.get(plane); if (plane.getTrackingState() == TrackingState.TRACKING && arCorePlane.getTrackingState()!= GVRTrackingState.TRACKING) { arCorePlane.setTrackingState(GVRTrackingState.TRACKING); notifyPlaneStateChangeListeners(arCorePlane, GVRTrackingState.TRACKING); } else if (plane.getTrackingState() == TrackingState.PAUSED && arCorePlane.getTrackingState()!= GVRTrackingState.PAUSED) { arCorePlane.setTrackingState(GVRTrackingState.PAUSED); notifyPlaneStateChangeListeners(arCorePlane, GVRTrackingState.PAUSED); } else if (plane.getTrackingState() == TrackingState.STOPPED && arCorePlane.getTrackingState()!= GVRTrackingState.STOPPED) { arCorePlane.setTrackingState(GVRTrackingState.STOPPED); notifyPlaneStateChangeListeners(arCorePlane, GVRTrackingState.STOPPED); } if (plane.getSubsumedBy()!= null && arCorePlane.getParentPlane() == null) { arCorePlane.setParentPlane(mArPlanes.get(plane.getSubsumedBy())); notifyMergedPlane(arCorePlane, arCorePlane.getParentPlane()); } arCorePlane.update(arViewMatrix, vrCamMatrix, scale); } } public void updateAugmentedImages(Collection<AugmentedImage> allAugmentedImages){ ARCoreAugmentedImage arCoreAugmentedImage; for (AugmentedImage augmentedImage: allAugmentedImages) { if (augmentedImage.getTrackingState()!= TrackingState.TRACKING || mArAugmentedImages.containsKey(augmentedImage)) { continue; } arCoreAugmentedImage = createAugmentedImage(augmentedImage); notifyAugmentedImageDetectionListeners(arCoreAugmentedImage); mArAugmentedImages.put(augmentedImage, arCoreAugmentedImage); } for (AugmentedImage augmentedImage: mArAugmentedImages.keySet()) { arCoreAugmentedImage = mArAugmentedImages.get(augmentedImage); if (augmentedImage.getTrackingState() == TrackingState.TRACKING && arCoreAugmentedImage.getTrackingState()!= GVRTrackingState.TRACKING) { arCoreAugmentedImage.setTrackingState(GVRTrackingState.TRACKING); notifyAugmentedImageStateChangeListeners(arCoreAugmentedImage, GVRTrackingState.TRACKING); } else if (augmentedImage.getTrackingState() == TrackingState.PAUSED && arCoreAugmentedImage.getTrackingState()!= GVRTrackingState.PAUSED) { arCoreAugmentedImage.setTrackingState(GVRTrackingState.PAUSED); notifyAugmentedImageStateChangeListeners(arCoreAugmentedImage, GVRTrackingState.PAUSED); } else if (augmentedImage.getTrackingState() == TrackingState.STOPPED && arCoreAugmentedImage.getTrackingState()!= GVRTrackingState.STOPPED) { arCoreAugmentedImage.setTrackingState(GVRTrackingState.STOPPED); notifyAugmentedImageStateChangeListeners(arCoreAugmentedImage, GVRTrackingState.STOPPED); } } } public void updateAnchors(float[] arViewMatrix, float[] vrCamMatrix, float scale) { for (ARCoreAnchor anchor: mArAnchors) { Anchor arAnchor = anchor.getAnchorAR(); if (arAnchor.getTrackingState() == TrackingState.TRACKING && anchor.getTrackingState()!= GVRTrackingState.TRACKING) { anchor.setTrackingState(GVRTrackingState.TRACKING); notifyAnchorStateChangeListeners(anchor, GVRTrackingState.TRACKING); } else if (arAnchor.getTrackingState() == TrackingState.PAUSED && anchor.getTrackingState()!= GVRTrackingState.PAUSED) { anchor.setTrackingState(GVRTrackingState.PAUSED); notifyAnchorStateChangeListeners(anchor, GVRTrackingState.PAUSED); } else if (arAnchor.getTrackingState() == TrackingState.STOPPED && anchor.getTrackingState()!= GVRTrackingState.STOPPED) { anchor.setTrackingState(GVRTrackingState.STOPPED); notifyAnchorStateChangeListeners(anchor, GVRTrackingState.STOPPED); } anchor.update(arViewMatrix, vrCamMatrix, scale); } } public ArrayList<GVRPlane> getAllPlanes() { ArrayList<GVRPlane> allPlanes = new ArrayList<>(); for (Plane plane: mArPlanes.keySet()) { allPlanes.add(mArPlanes.get(plane)); } return allPlanes; } public ArrayList<GVRAugmentedImage> getAllAugmentedImages() { ArrayList<GVRAugmentedImage> allAugmentedImages = new ArrayList<>(); for (AugmentedImage augmentedImage: mArAugmentedImages.keySet()) { allAugmentedImages.add(mArAugmentedImages.get(augmentedImage)); } return allAugmentedImages; } public ARCorePlane createPlane(Plane plane) { ARCorePlane arCorePlane = new ARCorePlane(mGvrContext, plane); mArPlanes.put(plane, arCorePlane); return arCorePlane; } public ARCoreAugmentedImage createAugmentedImage(AugmentedImage augmentedImage) { ARCoreAugmentedImage arCoreAugmentedImage = new ARCoreAugmentedImage(augmentedImage); return arCoreAugmentedImage; } public GVRAnchor createAnchor(Anchor arAnchor, GVRSceneObject sceneObject) { ARCoreAnchor arCoreAnchor = new ARCoreAnchor(mGvrContext); arCoreAnchor.setAnchorAR(arAnchor); mArAnchors.add(arCoreAnchor); if (sceneObject!= null) { arCoreAnchor.attachSceneObject(sceneObject); } return arCoreAnchor; } public void updateAnchorPose(ARCoreAnchor anchor, Anchor arAnchor) { if (anchor.getAnchorAR()!= null) { anchor.getAnchorAR().detach(); } anchor.setAnchorAR(arAnchor); } public void removeAnchor(ARCoreAnchor anchor) { anchor.getAnchorAR().detach(); mArAnchors.remove(anchor); mGvrScene.removeSceneObject(anchor); } public GVRHitResult hitTest(List<HitResult> hitResult) { for (HitResult hit : hitResult) { // Check if any plane was hit, and if it was hit inside the plane polygon Trackable trackable = hit.getTrackable(); // Creates an anchor if a plane or an oriented point was hit. if ((trackable instanceof Plane && ((Plane) trackable).isPoseInPolygon(hit.getHitPose())) && ((Plane) trackable).getSubsumedBy() == null) { GVRHitResult gvrHitResult = new GVRHitResult(); float[] hitPose = new float[16]; hit.getHitPose().toMatrix(hitPose, 0); gvrHitResult.setPose(hitPose); gvrHitResult.setDistance(hit.getDistance()); gvrHitResult.setPlane(mArPlanes.get(trackable)); return gvrHitResult; } } return null; } public GVRLightEstimate getLightEstimate(LightEstimate lightEstimate) { ARCoreLightEstimate arCoreLightEstimate = new ARCoreLightEstimate(); GVRLightEstimate.GVRLightEstimateState state; arCoreLightEstimate.setPixelIntensity(lightEstimate.getPixelIntensity()); state = (lightEstimate.getState() == LightEstimate.State.VALID)? GVRLightEstimate.GVRLightEstimateState.VALID : GVRLightEstimate.GVRLightEstimateState.NOT_VALID; arCoreLightEstimate.setState(state); return arCoreLightEstimate; } public void registerPlaneListener(IPlaneEventsListener listener) { planeEventsListeners.add(listener); } public void registerAnchorListener(IAnchorEventsListener listener) { anchorEventsListeners.add(listener); } public void registerAugmentedImageListener(IAugmentedImageEventsListener listener) { augmentedImageEventsListeners.add(listener); } private void notifyPlaneDetectionListeners(GVRPlane plane) { for (IPlaneEventsListener listener: planeEventsListeners) { listener.onPlaneDetection(plane); } } private void notifyPlaneStateChangeListeners(GVRPlane plane, GVRTrackingState trackingState) { for (IPlaneEventsListener listener: planeEventsListeners) { listener.onPlaneStateChange(plane, trackingState); } } private void notifyMergedPlane(GVRPlane childPlane, GVRPlane parentPlane) { for (IPlaneEventsListener listener: planeEventsListeners) { listener.onPlaneMerging(childPlane, parentPlane); } } private void notifyAnchorStateChangeListeners(GVRAnchor anchor, GVRTrackingState trackingState) { for (IAnchorEventsListener listener: anchorEventsListeners) { listener.onAnchorStateChange(anchor, trackingState); } } private void notifyAugmentedImageDetectionListeners(GVRAugmentedImage image) { for (IAugmentedImageEventsListener listener: augmentedImageEventsListeners) { listener.onAugmentedImageDetection(image); } } private void notifyAugmentedImageStateChangeListeners(GVRAugmentedImage image, GVRTrackingState trackingState) { for (IAugmentedImageEventsListener listener: augmentedImageEventsListeners) { listener.onAugmentedImage
65,700
thestackv1_concat_by_repo-long/65536-65536
\src\jorphan\src\main\java\org\apache\jorphan\util\JMeterError.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\JMeterException.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\JMeterException.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\JMeterStopTestException.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\JMeterStopTestException.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\JMeterStopTestNowException.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\JMeterStopTestNowException.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\JMeterStopThreadException.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\JMeterStopThreadException.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\JOrphanUtils.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\JOrphanUtils.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\ThreadDumper.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\ThreadDumper.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\XMLBuffer.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\jorphan\util\XMLBuffer.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\log\ContextMap.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\log\ContextMap.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\log\LogEvent.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\log\LogEvent.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\log\LogTarget.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\log\LogTarget.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\log\Logger.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\log\Logger.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\log\Priority.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\jorphan\src\main\java\org\apache\log\Priority.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a> <hr size="1" width="100%" align="left"> </body> </html> ======================= File: src/core/build/reports/tests/test/index.html ======================= <filename>src/core/build/reports/tests/test/index.html <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="x-ua-compatible" content="IE=edge"/> <title>Test results - Test Summary</title> <link href="css/base-style.css" rel="stylesheet" type="text/css"/> <link href="css/style.css" rel="stylesheet" type="text/css"/> <script src="js/report.js" type="text/javascript"></script> </head> <body> <div id="content"> <h1>Test Summary</h1> <div id="summary"> <table> <tr> <td> <div class="summaryGroup"> <table> <tr> <td> <div class="infoBox" id="tests"> <div class="counter">260</div> <p>tests</p> </div> </td> <td> <div class="infoBox" id="failures"> <div class="counter">0</div> <p>failures</p> </div> </td> <td> <div class="infoBox" id="ignored"> <div class="counter">0</div> <p>ignored</p> </div> </td> <td> <div class="infoBox" id="duration"> <div class="counter">16.965s</div> <p>duration</p> </div> </td> </tr> </table> </div> </td> <td> <div class="infoBox success" id="successRate"> <div class="percent">100%</div> <p>successful</p> </div> </td> </tr> </table> </div> <div id="tabs"> <ul class="tabLinks"> <li> <a href="#tab0">Packages</a> </li> <li> <a href="#tab1">Classes</a> </li> </ul> <div id="tab0" class="tab"> <h2>Packages</h2> <table> <thead> <tr> <th>Package</th> <th>Tests</th> <th>Failures</th> <th>Ignored</th> <th>Duration</th> <th>Success rate</th> </tr> </thead> <tbody> <tr> <td class="success"> <a href="packages/org.apache.jmeter.html">org.apache.jmeter</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>0.986s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.engine.html">org.apache.jmeter.engine</a> </td> <td>7</td> <td>0</td> <td>0</td> <td>3.029s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.engine.util.html">org.apache.jmeter.engine.util</a> </td> <td>10</td> <td>0</td> <td>0</td> <td>0.115s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.gui.html">org.apache.jmeter.gui</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>2.164s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.gui.logging.html">org.apache.jmeter.gui.logging</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.002s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.gui.util.html">org.apache.jmeter.gui.util</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.804s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.listeners.html">org.apache.jmeter.listeners</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0.060s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.report.core.html">org.apache.jmeter.report.core</a> </td> <td>32</td> <td>0</td> <td>0</td> <td>0.417s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.report.dashboard.html">org.apache.jmeter.report.dashboard</a> </td> <td>7</td> <td>0</td> <td>0</td> <td>0.048s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.report.processor.html">org.apache.jmeter.report.processor</a> </td> <td>19</td> <td>0</td> <td>0</td> <td>0.614s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.report.processor.graph.impl.html">org.apache.jmeter.report.processor.graph.impl</a> </td> <td>8</td> <td>0</td> <td>0</td> <td>0.279s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.resources.html">org.apache.jmeter.resources</a> </td> <td>13</td> <td>0</td> <td>0</td> <td>0.988s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.samplers.html">org.apache.jmeter.samplers</a> </td> <td>29</td> <td>0</td> <td>0</td> <td>4.532s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.save.html">org.apache.jmeter.save</a> </td> <td>11</td> <td>0</td> <td>0</td> <td>0.008s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.services.html">org.apache.jmeter.services</a> </td> <td>23</td> <td>0</td> <td>0</td> <td>0.179s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.testbeans.gui.html">org.apache.jmeter.testbeans.gui</a> </td> <td>6</td> <td>0</td> <td>0</td> <td>0.224s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.testelement.html">org.apache.jmeter.testelement</a> </td> <td>7</td> <td>0</td> <td>0</td> <td>0.002s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.testelement.property.html">org.apache.jmeter.testelement.property</a> </td> <td>19</td> <td>0</td> <td>0</td> <td>0.019s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.threads.html">org.apache.jmeter.threads</a> </td> <td>22</td> <td>0</td> <td>0</td> <td>0.042s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.util.html">org.apache.jmeter.util</a> </td> <td>22</td> <td>0</td> <td>0</td> <td>2.430s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.util.keystore.html">org.apache.jmeter.util.keystore</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>0.013s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jorphan.html">org.apache.jorphan</a> </td> <td>4</td> <td>0</td> <td>0</td> <td>0.004s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jorphan.reflect.html">org.apache.jorphan.reflect</a> </td> <td>6</td> <td>0</td> <td>0</td> <td>0.006s</td> <td class="success">100%</td> </tr> </tbody> </table> </div> <div id="tab1" class="tab"> <h2>Classes</h2> <table> <thead> <tr> <th>Class</th> <th>Tests</th> <th>Failures</th> <th>Ignored</th> <th>Duration</th> <th>Success rate</th> </tr> </thead> <tbody> <tr> <td class="success"> <a href="classes/org.apache.jmeter.JMeterTest.html">org.apache.jmeter.JMeterTest</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>0.986s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.engine.DistributedRunnerTest.html">org.apache.jmeter.engine.DistributedRunnerTest</a> </td> <td>4</td> <td>0</td> <td>0</td> <td>0.237s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.engine.LocalHostTest.html">org.apache.jmeter.engine.LocalHostTest</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>2.737s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.engine.TestTreeCloner.html">org.apache.jmeter.engine.TestTreeCloner</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.055s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.engine.util.TestValueReplacer.html">org.apache.jmeter.engine.util.TestValueReplacer</a> </td> <td>10</td> <td>0</td> <td>0</td> <td>0.115s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.gui.HtmlReportGUISpec.html">org.apache.jmeter.gui.HtmlReportGUISpec</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>2.164s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.gui.logging.TestGuiLogEventAppender.html">org.apache.jmeter.gui.logging.TestGuiLogEventAppender</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.002s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.gui.util.JSyntaxTextAreaTest.html">org.apache.jmeter.gui.util.JSyntaxTextAreaTest</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.804s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.listeners.TestResultAction.html">org.apache.jmeter.listeners.TestResultAction</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0.060s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.core.ConvertersSpec.html">org.apache.jmeter.report.core.ConvertersSpec</a> </td> <td>14</td> <td>0</td> <td>0</td> <td>0.029s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.core.CsvSampleReaderTest.html">org.apache.jmeter.report.core.CsvSampleReaderTest</a> </td> <td>6</td> <td>0</td> <td>0</td> <td>0.326s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.core.SampleMetadataParserSpec.html">org.apache.jmeter.report.core.SampleMetadataParserSpec</a> </td> <td>6</td> <td>0</td> <td>0</td> <td>0.045s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.core.SampleMetadataTest.html">org.apache.jmeter.report.core.SampleMetadataTest</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.core.TestCsvSampleWriter.html">org.apache.jmeter.report.core.TestCsvSampleWriter</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0.017s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.dashboard.ApdexPerTransactionTest.html">org.apache.jmeter.report.dashboard.ApdexPerTransactionTest</a> </td> <td>7</td> <td>0</td> <td>0</td> <td>0.048s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.processor.ApdexSummaryConsumerSpec.html">org.apache.jmeter.report.processor.ApdexSummaryConsumerSpec</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.143s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.processor.ErrorsSummaryConsumerTest.html">org.apache.jmeter.report.processor.ErrorsSummaryConsumerTest</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.061s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.processor.FieldSampleComparatorSpec.html">org.apache.jmeter.report.processor.FieldSampleComparatorSpec</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>0.013s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.processor.ListResultDataSpec.html">org.apache.jmeter.report.processor.ListResultDataSpec</a> </td> <td>4</td> <td>0</td> <td>0</td> <td>0.004s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.processor.Top5ErrorsBySamplerConsumerSpec.html">org.apache.jmeter.report.processor.Top5ErrorsBySamplerConsumerSpec</a> </td> <td>4</td> <td>0</td> <td>0</td> <td>0.382s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.processor.Top5ErrorsSummaryDataSpec.html">org.apache.jmeter.report.processor.Top5ErrorsSummaryDataSpec</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0.011s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.processor.graph.impl.CustomGraphConsumerTest.html">org.apache.jmeter.report.processor.graph.impl.CustomGraphConsumerTest</a> </td> <td>6</td> <td>0</td> <td>0</td> <td>0.018s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.report.processor.graph.impl.ResponseTimePercentilesOverTimeGraphConsumerSpec.html">org.apache.jmeter.report.processor.graph.impl.ResponseTimePercentilesOverTimeGraphConsumerSpec</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.261s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.resources.PackageTest.html">org.apache.jmeter.resources.PackageTest</a> </td> <td>12</td> <td>0</td> <td>0</td> <td>0.133s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.resources.ResourceKeyUsageTest.html">org.apache.jmeter.resources.ResourceKeyUsageTest</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.855s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.samplers.TestDataStrippingSampleSender.html">org.apache.jmeter.samplers.TestDataStrippingSampleSender</a> </td> <td>4</td> <td>0</td> <td>0</td> <td>0.027s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.samplers.TestSampleResult.html">org.apache.jmeter.samplers.TestSampleResult</a> </td> <td>18</td> <td>0</td> <td>0</td> <td>4.475s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.samplers.TestSampleSaveConfiguration.html">org.apache.jmeter.samplers.TestSampleSaveConfiguration</a> </td> <td>7</td> <td>0</td> <td>0</td> <td>0.030s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.save.TestCSVSaveService.html">org.apache.jmeter.save.TestCSVSaveService</a> </td> <td>11</td> <td>0</td> <td>0</td> <td>0.008s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.services.FileServerSpec.html">org.apache.jmeter.services.FileServerSpec</a> </td> <td>23</td> <td>0</td> <td>0</td> <td>0.179s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.testbeans.gui.TestBooleanPropertyEditor.html">org.apache.jmeter.testbeans.gui.TestBooleanPropertyEditor</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.004s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.testbeans.gui.TestComboStringEditor.html">org.apache.jmeter.testbeans.gui.TestComboStringEditor</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.207s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.testbeans.gui.TestFieldStringEditor.html">org.apache.jmeter.testbeans.gui.TestFieldStringEditor</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.013s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.testelement.PackageTest.html">org.apache.jmeter.testelement.PackageTest</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.002s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.testelement.TestNumberProperty.html">org.apache.jmeter.testelement.TestNumberProperty</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.testelement.property.AbstractPropertyTest.html">org.apache.jmeter.testelement.property.AbstractPropertyTest</a> </td> <td>6</td> <td>0</td> <td>0</td> <td>0.009s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.testelement.property.MapPropertyTest.html">org.apache.jmeter.testelement.property.MapPropertyTest</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.002s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.testelement.property.PackageTest.html">org.apache.jmeter.testelement.property.PackageTest</a> </td> <td>11</td> <td>0</td> <td>0</td> <td>0.008s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.threads.TestJMeterContextService.html">org.apache.jmeter.threads.TestJMeterContextService</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.threads.TestJMeterThread.html">org.apache.jmeter.threads.TestJMeterThread</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>0.028s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.threads.TestTestCompiler.html">org.apache.jmeter.threads.TestTestCompiler</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.002s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.threads.TestUnmodifiableJMeterVariables.html">org.apache.jmeter.threads.TestUnmodifiableJMeterVariables</a> </td> <td>17</td> <td>0</td> <td>0</td> <td>0.012s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.util.JSR223TestElementTest.html">org.apache.jmeter.util.JSR223TestElementTest</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.557s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.util.PackageTest.html">org.apache.jmeter.util.PackageTest</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.005s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.util.StringUtilitiesTest.html">org.apache.jmeter.util.StringUtilitiesTest</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0.005s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.util.TestJMeterUtils.html">org.apache.jmeter.util.TestJMeterUtils</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>0.005s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.util.XPathUtilTest.html">org.apache.jmeter.util.XPathUtilTest</a> </td> <td>11</td> <td>0</td> <td>0</td> <td>1.858s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.util.keystore.JmeterKeyStoreSpec.html">org.apache.jmeter.util.keystore.JmeterKeyStoreSpec</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>0.013s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.TestXMLBuffer.html">org.apache.jorphan.TestXMLBuffer</a> </td> <td>4</td> <td>0</td> <td>0</td> <td>0.004s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.reflect.TestFunctor.html">org.apache.jorphan.reflect.TestFunctor</a> </td> <td>6</td> <td>0</td> <td>0</td> <td>0.006s</td> <td class="success">100%</td> </tr> </tbody> </table> </div> </div> <div id="footer"> <p> <div> <label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> </label> </div>Generated by <a href="http://www.gradle.org">Gradle 6.0.1</a> at 13/04/2020 01:21:56</p> </div> </div> </body> </html> ======================= File: src/jorphan/build/reports/tests/test/index.html ======================= <gh_stars>0 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="x-ua-compatible" content="IE=edge"/> <title>Test results - Test Summary</title> <link href="css/base-style.css" rel="stylesheet" type="text/css"/> <link href="css/style.css" rel="stylesheet" type="text/css"/> <script src="js/report.js" type="text/javascript"></script> </head> <body> <div id="content"> <h1>Test Summary</h1> <div id="summary"> <table> <tr> <td> <div class="summaryGroup"> <table> <tr> <td> <div class="infoBox" id="tests"> <div class="counter">202</div> <p>tests</p> </div> </td> <td> <div class="infoBox" id="failures"> <div class="counter">0</div> <p>failures</p> </div> </td> <td> <div class="infoBox" id="ignored"> <div class="counter">2</div> <p>ignored</p> </div> </td> <td> <div class="infoBox" id="duration"> <div class="counter">21.849s</div> <p>duration</p> </div> </td> </tr> </table> </div> </td> <td> <div class="infoBox skipped" id="successRate"> <div class="percent">100%</div> <p>successful</p> </div> </td> </tr> </table> </div> <div id="tabs"> <ul class="tabLinks"> <li> <a href="#tab0">Ignored tests</a> </li> <li> <a href="#tab1">Packages</a> </li> <li> <a href="#tab2">Classes</a> </li> </ul> <div id="tab0" class="tab"> <h2>Ignored tests</h2> <ul class="linkList"> <li> <a href="classes/org.apache.jorphan.math.TestStatCalculator.html">TestStatCalculator</a>. <a href="classes/org.apache.jorphan.math.TestStatCalculator.html#testMedianBug61071()">testMedianBug61071()</a> </li> <li> <a href="classes/org.apache.jorphan.math.TestStatCalculator.html">TestStatCalculator</a>. <a href="classes/org.apache.jorphan.math.TestStatCalculator.html#testPercentagePointBug()">testPercentagePointBug()</a> </li> </ul> </div> <div id="tab1" class="tab"> <h2>Packages</h2> <table> <thead> <tr> <th>Package</th> <th>Tests</th> <th>Failures</th> <th>Ignored</th> <th>Duration</th> <th>Success rate</th> </tr> </thead> <tbody> <tr> <td class="success"> <a href="packages/org.apache.commons.cli.avalon.html">org.apache.commons.cli.avalon</a> </td> <td>37</td> <td>0</td> <td>0</td> <td>0.115s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jorphan.collections.html">org.apache.jorphan.collections</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0.017s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jorphan.exec.html">org.apache.jorphan.exec</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>19.894s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jorphan.gui.html">org.apache.jorphan.gui</a> </td> <td>37</td> <td>0</td> <td>0</td> <td>0.884s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jorphan.io.html">org.apache.jorphan.io</a> </td> <td>16</td> <td>0</td> <td>0</td> <td>0.475s</td> <td class="success">100%</td> </tr> <tr> <td class="skipped"> <a href="packages/org.apache.jorphan.math.html">org.apache.jorphan.math</a> </td> <td>10</td> <td>0</td> <td>2</td> <td>0.015s</td> <td class="skipped">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jorphan.reflect.html">org.apache.jorphan.reflect</a> </td> <td>4</td> <td>0</td> <td>0</td> <td>0.009s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jorphan.util.html">org.apache.jorphan.util</a> </td> <td>90</td> <td>0</td> <td>0</td> <td>0.440s</td> <td class="success">100%</td> </tr> </tbody> </table> </div> <div id="tab2" class="tab"> <h2>Classes</h2> <table> <thead> <tr> <th>Class</th> <th>Tests</th> <th>Failures</th> <th>Ignored</th> <th>Duration</th> <th>Success rate</th> </tr> </thead> <tbody> <tr> <td class="success"> <a href="classes/org.apache.commons.cli.avalon.ClutilTestCase.html">org.apache.commons.cli.avalon.ClutilTestCase</a> </td> <td>37</td> <td>0</td> <td>0</td> <td>0.115s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.collections.PackageTest.html">org.apache.jorphan.collections.PackageTest</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0.017s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.exec.TestKeyToolUtils.html">org.apache.jorphan.exec.TestKeyToolUtils</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>19.894s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.gui.MinMaxLongRendererTest.html">org.apache.jorphan.gui.MinMaxLongRendererTest</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0.657s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.gui.ObjectTableModelTest.html">org.apache.jorphan.gui.ObjectTableModelTest</a> </td> <td>6</td> <td>0</td> <td>0</td> <td>0.081s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.gui.ObjectTableSorterTest.html">org.apache.jorphan.gui.ObjectTableSorterTest</a> </td> <td>26</td> <td>0</td> <td>0</td> <td>0.146s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.io.TextFileSpec.html">org.apache.jorphan.io.TextFileSpec</a> </td> <td>16</td> <td>0</td> <td>0</td> <td>0.475s</td> <td class="success">100%</td> </tr> <tr> <td class="skipped"> <a href="classes/org.apache.jorphan.math.TestStatCalculator.html">org.apache.jorphan.math.TestStatCalculator</a> </td> <td>10</td> <td>0</td> <td>2</td> <td>0.015s</td> <td class="skipped">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.reflect.TestClassTools.html">org.apache.jorphan.reflect.TestClassTools</a> </td> <td>4</td> <td>0</td> <td>0</td> <td>0.009s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.util.ConverterSpec.html">org.apache.jorphan.util.ConverterSpec</a> </td> <td>32</td> <td>0</td> <td>0</td> <td>0.101s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.util.TestConverter.html">org.apache.jorphan.util.TestConverter</a> </td> <td>8</td> <td>0</td> <td>0</td> <td>0.038s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jorphan.util.TestJorphanUtils.html">org.apache.jorphan.util.TestJorphanUtils</a> </td> <td>50</td> <td>0</td> <td>0</td> <td>0.301s</td> <td class="success">100%</td> </tr> </tbody> </table> </div> </div> <div id="footer"> <p> <div> <label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> </label> </div>Generated by <a href="http://www.gradle.org">Gradle 6.0.1</a> at 13/04/2020 01:22:30</p> </div> </div> </body> </html> ======================= File: src/protocol/http/build/reports/tests/test/index.html ======================= <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="x-ua-compatible" content="IE=edge"/> <title>Test results - Test Summary</title> <link href="css/base-style.css" rel="stylesheet" type="text/css"/> <link href="css/style.css" rel="stylesheet" type="text/css"/> <script src="js/report.js" type="text/javascript"></script> </head> <body> <div id="content"> <h1>Test Summary</h1> <div id="summary"> <table> <tr> <td> <div class="summaryGroup"> <table> <tr> <td> <div class="infoBox" id="tests"> <div class="counter">629</div> <p>tests</p> </div> </td> <td> <div class="infoBox" id="failures"> <div class="counter">0</div> <p>failures</p> </div> </td> <td> <div class="infoBox" id="ignored"> <div class="counter">3</div> <p>ignored</p> </div> </td> <td> <div class="infoBox" id="duration"> <div class="counter">52.396s</div> <p>duration</p> </div> </td> </tr> </table> </div> </td> <td> <div class="infoBox skipped" id="successRate"> <div class="percent">100%</div> <p>successful</p> </div> </td> </tr> </table> </div> <div id="tabs"> <ul class="tabLinks"> <li> <a href="#tab0">Ignored tests</a> </li> <li> <a href="#tab1">Packages</a> </li> <li> <a href="#tab2">Classes</a> </li> </ul> <div id="tab0" class="tab"> <h2>Ignored tests</h2> <ul class="linkList"> <li> <a href="classes/org.apache.jmeter.protocol.http.control.DnsManagerTest.html">DnsManagerTest</a>. <a href="classes/org.apache.jmeter.protocol.http.control.DnsManagerTest.html#badDnsInCustomResolverShouldFailHttpSampler(String, WireMockServer)[2]">[2] Java</a> </li> <li> <a href="classes/org.apache.jmeter.protocol.http.sampler.SamplingNamingTest.html">SamplingNamingTest</a>. <a href="classes/org.apache.jmeter.protocol.http.sampler.SamplingNamingTest.html#testBug63364[Run 0: implementation:HttpClient4]">testBug63364[Run 0: implementation:HttpClient4]</a> </li> <li> <a href="classes/org.apache.jmeter.protocol.http.sampler.SamplingNamingTest.html">SamplingNamingTest</a>. <a href="classes/org.apache.jmeter.protocol.http.sampler.SamplingNamingTest.html#testBug63364[Run 1: implementation:Java]">testBug63364[Run 1: implementation:Java]</a> </li> </ul> </div> <div id="tab1" class="tab"> <h2>Packages</h2> <table> <thead> <tr> <th>Package</th> <th>Tests</th> <th>Failures</th> <th>Ignored</th> <th>Duration</th> <th>Success rate</th> </tr> </thead> <tbody> <tr> <td class="success"> <a href="packages/org.apache.jmeter.curl.html">org.apache.jmeter.curl</a> </td> <td>55</td> <td>0</td> <td>0</td> <td>1.104s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.gui.action.html">org.apache.jmeter.gui.action</a> </td> <td>21</td> <td>0</td> <td>0</td> <td>0.507s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.protocol.http.config.html">org.apache.jmeter.protocol.http.config</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0.006s</td> <td class="success">100%</td> </tr> <tr> <td class="skipped"> <a href="packages/org.apache.jmeter.protocol.http.control.html">org.apache.jmeter.protocol.http.control</a> </td> <td>122</td> <td>0</td> <td>1</td> <td>39.992s</td> <td class="skipped">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.protocol.http.control.gui.html">org.apache.jmeter.protocol.http.control.gui</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.085s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.protocol.http.modifier.html">org.apache.jmeter.protocol.http.modifier</a> </td> <td>35</td> <td>0</td> <td>0</td> <td>1.057s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.protocol.http.parser.html">org.apache.jmeter.protocol.http.parser</a> </td> <td>161</td> <td>0</td> <td>0</td> <td>1.944s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.protocol.http.proxy.html">org.apache.jmeter.protocol.http.proxy</a> </td> <td>17</td> <td>0</td> <td>0</td> <td>1.640s</td> <td class="success">100%</td> </tr> <tr> <td class="skipped"> <a href="packages/org.apache.jmeter.protocol.http.sampler.html">org.apache.jmeter.protocol.http.sampler</a> </td> <td>113</td> <td>0</td> <td>2</td> <td>5.603s</td> <td class="skipped">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.protocol.http.util.html">org.apache.jmeter.protocol.http.util</a> </td> <td>69</td> <td>0</td> <td>0</td> <td>0.105s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.protocol.http.util.accesslog.html">org.apache.jmeter.protocol.http.util.accesslog</a> </td> <td>13</td> <td>0</td> <td>0</td> <td>0.024s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.protocol.http.visualizers.html">org.apache.jmeter.protocol.http.visualizers</a> </td> <td>14</td> <td>0</td> <td>0</td> <td>0.007s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.resources.html">org.apache.jmeter.resources</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.321s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="packages/org.apache.jmeter.testelement.html">org.apache.jmeter.testelement</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.001s</td> <td class="success">100%</td> </tr> </tbody> </table> </div> <div id="tab2" class="tab"> <h2>Classes</h2> <table> <thead> <tr> <th>Class</th> <th>Tests</th> <th>Failures</th> <th>Ignored</th> <th>Duration</th> <th>Success rate</th> </tr> </thead> <tbody> <tr> <td class="success"> <a href="classes/org.apache.jmeter.curl.BasicCurlParserTest.html">org.apache.jmeter.curl.BasicCurlParserTest</a> </td> <td>55</td> <td>0</td> <td>0</td> <td>1.104s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.gui.action.ParseCurlCommandActionTest.html">org.apache.jmeter.gui.action.ParseCurlCommandActionTest</a> </td> <td>21</td> <td>0</td> <td>0</td> <td>0.507s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.config.MultipartUrlConfigTest.html">org.apache.jmeter.protocol.http.config.MultipartUrlConfigTest</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>0.004s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.config.UrlConfigTest.html">org.apache.jmeter.protocol.http.config.UrlConfigTest</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.002s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.control.DNSCacheManagerSpec.html">org.apache.jmeter.protocol.http.control.DNSCacheManagerSpec</a> </td> <td>11</td> <td>0</td> <td>0</td> <td>0.545s</td> <td class="success">100%</td> </tr> <tr> <td class="skipped"> <a href="classes/org.apache.jmeter.protocol.http.control.DnsManagerTest.html">org.apache.jmeter.protocol.http.control.DnsManagerTest</a> </td> <td>2</td> <td>0</td> <td>1</td> <td>6.384s</td> <td class="skipped">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.control.TestAuthManager.html">org.apache.jmeter.protocol.http.control.TestAuthManager</a> </td> <td>6</td> <td>0</td> <td>0</td> <td>0.014s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.control.TestAuthManagerThreadIteration.html">org.apache.jmeter.protocol.http.control.TestAuthManagerThreadIteration</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.003s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.control.TestAuthorization.html">org.apache.jmeter.protocol.http.control.TestAuthorization</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.124s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.control.TestCacheManagerHC4.html">org.apache.jmeter.protocol.http.control.TestCacheManagerHC4</a> </td> <td>25</td> <td>0</td> <td>0</td> <td>15.875s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.control.TestCacheManagerThreadIteration.html">org.apache.jmeter.protocol.http.control.TestCacheManagerThreadIteration</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0.084s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.control.TestCacheManagerUrlConnection.html">org.apache.jmeter.protocol.http.control.TestCacheManagerUrlConnection</a> </td> <td>24</td> <td>0</td> <td>0</td> <td>15.862s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.control.TestCookieManagerThreadIteration.html">org.apache.jmeter.protocol.http.control.TestCookieManagerThreadIteration</a> </td> <td>4</td> <td>0</td> <td>0</td> <td>0.106s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.control.TestHC4CookieManager.html">org.apache.jmeter.protocol.http.control.TestHC4CookieManager</a> </td> <td>33</td> <td>0</td> <td>0</td> <td>0.150s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.control.TestHTTPMirrorThread.html">org.apache.jmeter.protocol.http.control.TestHTTPMirrorThread</a> </td> <td>9</td> <td>0</td> <td>0</td> <td>0.845s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.control.gui.TestHttpTestSampleGui.html">org.apache.jmeter.protocol.http.control.gui.TestHttpTestSampleGui</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.085s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.modifier.TestAnchorModifier.html">org.apache.jmeter.protocol.http.modifier.TestAnchorModifier</a> </td> <td>18</td> <td>0</td> <td>0</td> <td>1.042s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.modifier.TestURLRewritingModifier.html">org.apache.jmeter.protocol.http.modifier.TestURLRewritingModifier</a> </td> <td>17</td> <td>0</td> <td>0</td> <td>0.015s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.parser.TestBaseParser.html">org.apache.jmeter.protocol.http.parser.TestBaseParser</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.001s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.parser.TestBug60842HtmlParser.html">org.apache.jmeter.protocol.http.parser.TestBug60842HtmlParser</a> </td> <td>46</td> <td>0</td> <td>0</td> <td>0.558s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.parser.TestCssParser.html">org.apache.jmeter.protocol.http.parser.TestCssParser</a> </td> <td>4</td> <td>0</td> <td>0</td> <td>0.838s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.parser.TestHTMLParser.html">org.apache.jmeter.protocol.http.parser.TestHTMLParser</a> </td> <td>103</td> <td>0</td> <td>0</td> <td>0.544s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.parser.TestHtmlParsingUtils.html">org.apache.jmeter.protocol.http.parser.TestHtmlParsingUtils</a> </td> <td>6</td> <td>0</td> <td>0</td> <td>0.003s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.proxy.TestHttpRequestHdr.html">org.apache.jmeter.protocol.http.proxy.TestHttpRequestHdr</a> </td> <td>10</td> <td>0</td> <td>0</td> <td>1.000s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.proxy.TestProxyControl.html">org.apache.jmeter.protocol.http.proxy.TestProxyControl</a> </td> <td>7</td> <td>0</td> <td>0</td> <td>0.640s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.sampler.PackageTest.html">org.apache.jmeter.protocol.http.sampler.PackageTest</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.099s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.sampler.ParallelResourcesAndIpSource.html">org.apache.jmeter.protocol.http.sampler.ParallelResourcesAndIpSource</a> </td> <td>16</td> <td>0</td> <td>0</td> <td>2.190s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.sampler.PostWriterTest.html">org.apache.jmeter.protocol.http.sampler.PostWriterTest</a> </td> <td>8</td> <td>0</td> <td>0</td> <td>0.036s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.sampler.PutWriterTest.html">org.apache.jmeter.protocol.http.sampler.PutWriterTest</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.001s</td> <td class="success">100%</td> </tr> <tr> <td class="skipped"> <a href="classes/org.apache.jmeter.protocol.http.sampler.SamplingNamingTest.html">org.apache.jmeter.protocol.http.sampler.SamplingNamingTest</a> </td> <td>2</td> <td>0</td> <td>2</td> <td>0s</td> <td class="skipped">-</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.sampler.TestDecompression.html">org.apache.jmeter.protocol.http.sampler.TestDecompression</a> </td> <td>8</td> <td>0</td> <td>0</td> <td>0.498s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.sampler.TestHTTPHC4Impl.html">org.apache.jmeter.protocol.http.sampler.TestHTTPHC4Impl</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>1.559s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.sampler.TestHTTPSamplers.html">org.apache.jmeter.protocol.http.sampler.TestHTTPSamplers</a> </td> <td>18</td> <td>0</td> <td>0</td> <td>0.007s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.sampler.TestHTTPSamplersAgainstHttpMirrorServer.html">org.apache.jmeter.protocol.http.sampler.TestHTTPSamplersAgainstHttpMirrorServer</a> </td> <td>53</td> <td>0</td> <td>0</td> <td>0.363s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.sampler.TestHttpWebdav.html">org.apache.jmeter.protocol.http.sampler.TestHttpWebdav</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.001s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.sampler.TestSerializedHTTPSampler.html">org.apache.jmeter.protocol.http.sampler.TestSerializedHTTPSampler</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.849s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.util.HTTPUtilsSpec.html">org.apache.jmeter.protocol.http.util.HTTPUtilsSpec</a> </td> <td>58</td> <td>0</td> <td>0</td> <td>0.102s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.util.TestHTTPArgument.html">org.apache.jmeter.protocol.http.util.TestHTTPArgument</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>0.001s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.util.TestHTTPFileArg.html">org.apache.jmeter.protocol.http.util.TestHTTPFileArg</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>0s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.util.TestHTTPFileArgs.html">org.apache.jmeter.protocol.http.util.TestHTTPFileArgs</a> </td> <td>5</td> <td>0</td> <td>0</td> <td>0.002s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.util.accesslog.TestLogFilter.html">org.apache.jmeter.protocol.http.util.accesslog.TestLogFilter</a> </td> <td>6</td> <td>0</td> <td>0</td> <td>0.004s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.util.accesslog.TestSessionFilter.html">org.apache.jmeter.protocol.http.util.accesslog.TestSessionFilter</a> </td> <td>3</td> <td>0</td> <td>0</td> <td>0.019s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.util.accesslog.TestTCLogParser.html">org.apache.jmeter.protocol.http.util.accesslog.TestTCLogParser</a> </td> <td>4</td> <td>0</td> <td>0</td> <td>0.001s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.protocol.http.visualizers.RequestViewHTTPTest.html">org.apache.jmeter.protocol.http.visualizers.RequestViewHTTPTest</a> </td> <td>14</td> <td>0</td> <td>0</td> <td>0.007s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.resources.ResourceKeyUsageTestHttp.html">org.apache.jmeter.resources.ResourceKeyUsageTestHttp</a> </td> <td>1</td> <td>0</td> <td>0</td> <td>0.321s</td> <td class="success">100%</td> </tr> <tr> <td class="success"> <a href="classes/org.apache.jmeter.testelement.TestHeaderManager.html">org.apache.jmeter.testelement.TestHeaderManager</a> </td> <td>2</td> <td>0</td> <td>0</td> <td>0.001s</td> <td class="success">100%</td> </tr> </tbody> </table> </div> </div> <div id="footer"> <p> <div> <label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> </label> </div>Generated by <a href="http://www.gradle.org">Gradle 6.0.1</a> at 13/04/2020 01:23:07</p> </div> </div> </body> </html> ======================= File: src/components/build/reports/checkstyle/main.html ======================= <reponame>carlost1204/jmeter5 <html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style type="text/css"> .bannercell { border: 0px; padding: 0px; } body { margin-left: 10; margin-right: 10; font:normal 80% arial,helvetica,sanserif; background-color:#FFFFFF; color:#000000; } .a td { background: #efefef; } .b td { background: #fff; } th, td { text-align: left; vertical-align: top; } th { font-weight:bold; background: #ccc; color: black; } table, th, td { font-size:100%; border: none } table.log tr td, tr th { } h2 { font-weight:bold; font-size:140%; margin-bottom: 5; } h3 { font-size:100%; font-weight:bold; background: #525D76; color: white; text-decoration: none; padding: 5px; margin-right: 2px; margin-left: 2px; margin-bottom: 0; } </style> </head> <body> <a name="top"></a> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td class="bannercell" rowspan="2"></td><td class="text-align:right"> <h2>CheckStyle Audit</h2> </td> </tr> <tr> <td class="text-align:right">Designed for use with <a href="http://checkstyle.sourceforge.net/">CheckStyle</a> and <a href="http://jakarta.apache.org">Ant</a>.</td> </tr> </table> <hr size="1"> <h3>Summary</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Files</th><th>Errors</th> </tr> <tr class="a"> <td>217</td><td>0</td> </tr> </table> <hr size="1" width="100%" align="left"> <h3>Files</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Name</th><th>Errors</th> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BSFAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BSFAssertion.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BSFAssertionBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BSFAssertionBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BeanShellAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BeanShellAssertion.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\CompareAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\CompareAssertion.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\CompareAssertionBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\CompareAssertionBeanInfo.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\DurationAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\DurationAssertion.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\HTMLAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\HTMLAssertion.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSONPathAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSONPathAssertion.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSR223Assertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSR223Assertion.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSR223AssertionBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSR223AssertionBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\LogErrorHandler.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\LogErrorHandler.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\MD5HexAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\MD5HexAssertion.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\ResponseAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\ResponseAssertion.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SMIMEAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SMIMEAssertion.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SMIMEAssertionTestElement.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SMIMEAssertionTestElement.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SizeAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SizeAssertion.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SubstitutionElement.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SubstitutionElement.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XMLAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XMLAssertion.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XMLSchemaAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XMLSchemaAssertion.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XPath2Assertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XPath2Assertion.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XPathAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XPathAssertion.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\AssertionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\AssertionGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\BeanShellAssertionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\BeanShellAssertionGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\DurationAssertionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\DurationAssertionGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\HTMLAssertionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\HTMLAssertionGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\JSONPathAssertionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\JSONPathAssertionGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\MD5HexAssertionGUI.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\MD5HexAssertionGUI.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\SMIMEAssertionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\SMIMEAssertionGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\SizeAssertionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\SizeAssertionGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLAssertionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLAssertionGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLConfPanel.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLConfPanel.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLSchemaAssertionGUI.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLSchemaAssertionGUI.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPath2AssertionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPath2AssertionGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPath2Panel.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPath2Panel.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPathAssertionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPathAssertionGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPathPanel.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPathPanel.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\jmespath\JMESPathAssertion.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\jmespath\JMESPathAssertion.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\jmespath\gui\JMESPathAssertionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\jmespath\gui\JMESPathAssertionGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\CSVDataSet.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\CSVDataSet.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\CSVDataSetBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\CSVDataSetBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\KeystoreConfig.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\KeystoreConfig.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\KeystoreConfigBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\KeystoreConfigBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\RandomVariableConfig.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\RandomVariableConfig.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\RandomVariableConfigBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\RandomVariableConfigBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\CriticalSectionController.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\CriticalSectionController.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ForeachController.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ForeachController.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\IncludeController.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\IncludeController.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\InterleaveControl.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\InterleaveControl.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ModuleController.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ModuleController.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\OnceOnlyController.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\OnceOnlyController.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\RandomController.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\RandomController.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\RandomOrderController.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\RandomOrderController.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\SwitchController.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\SwitchController.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ThroughputController.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ThroughputController.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\CriticalSectionControllerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\CriticalSectionControllerGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ForeachControlPanel.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ForeachControlPanel.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\IncludeControllerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\IncludeControllerGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\InterleaveControlGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\InterleaveControlGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ModuleControllerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ModuleControllerGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\OnceOnlyControllerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\OnceOnlyControllerGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\RandomControlGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\RandomControlGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\RandomOrderControllerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\RandomOrderControllerGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\SwitchControllerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\SwitchControllerGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ThroughputControllerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ThroughputControllerGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\TreeNodeWrapper.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\TreeNodeWrapper.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BSFPostProcessor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BSFPostProcessor.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BSFPostProcessorBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BSFPostProcessorBeanInfo.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BeanShellPostProcessor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BeanShellPostProcessor.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BeanShellPostProcessorBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BeanShellPostProcessorBeanInfo.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BoundaryExtractor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BoundaryExtractor.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\DebugPostProcessor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\DebugPostProcessor.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\DebugPostProcessorBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\DebugPostProcessorBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\Extractor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\Extractor.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\HtmlExtractor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\HtmlExtractor.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSR223PostProcessor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSR223PostProcessor.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSR223PostProcessorBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSR223PostProcessorBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSoupExtractor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSoupExtractor.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JoddExtractor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JoddExtractor.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\RegexExtractor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\RegexExtractor.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\XPath2Extractor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\XPath2Extractor.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\XPathExtractor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\XPathExtractor.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\BoundaryExtractorGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\BoundaryExtractorGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\HtmlExtractorGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\HtmlExtractorGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\RegexExtractorGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\RegexExtractorGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\XPath2ExtractorGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\XPath2ExtractorGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\XPathExtractorGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\XPathExtractorGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathCache.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathCache.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathCacheLoader.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathCacheLoader.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathExtractor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathExtractor.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\gui\JMESPathExtractorGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\gui\JMESPathExtractorGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\JSONManager.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\JSONManager.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\JSONPostProcessor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\JSONPostProcessor.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\gui\JSONPostProcessorGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\gui\JSONPostProcessorGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\AbstractRenderAsJsonRenderer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\AbstractRenderAsJsonRenderer.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\RenderAsJmesPathRenderer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\RenderAsJmesPathRenderer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\RenderAsJsonRenderer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\RenderAsJsonRenderer.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\gui\action\ExportTransactionAndSamplerNames.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\gui\action\ExportTransactionAndSamplerNames.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BSFPreProcessor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BSFPreProcessor.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BSFPreProcessorBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BSFPreProcessorBeanInfo.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BeanShellPreProcessor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BeanShellPreProcessor.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BeanShellPreProcessorBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BeanShellPreProcessorBeanInfo.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\CounterConfig.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\CounterConfig.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\JSR223PreProcessor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\JSR223PreProcessor.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\JSR223PreProcessorBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\JSR223PreProcessorBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\SampleTimeout.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\SampleTimeout.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\UserParameters.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\UserParameters.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\CounterConfigGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\CounterConfigGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\SampleTimeoutGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\SampleTimeoutGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\UserParametersGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\UserParametersGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\reporters\MailerModel.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\reporters\MailerModel.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\reporters\MailerResultCollector.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\reporters\MailerResultCollector.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\sampler\DebugSampler.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\sampler\DebugSampler.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\sampler\DebugSamplerBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\sampler\DebugSamplerBeanInfo.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\sampler\TestAction.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\sampler\TestAction.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\sampler\gui\TestActionGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\sampler\gui\TestActionGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\thinktime\DefaultThinkTimeCreator.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\thinktime\DefaultThinkTimeCreator.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\BSFTimer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\BSFTimer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\BSFTimerBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\BSFTimerBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\BeanShellTimer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\BeanShellTimer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\BeanShellTimerBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\BeanShellTimerBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\ConstantThroughputTimer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\ConstantThroughputTimer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\ConstantThroughputTimerBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\ConstantThroughputTimerBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\ConstantTimer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\ConstantTimer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\GaussianRandomTimer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\GaussianRandomTimer.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\JSR223Timer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\JSR223Timer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\JSR223TimerBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\JSR223TimerBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\PoissonRandomTimer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\PoissonRandomTimer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\RandomTimer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\RandomTimer.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\SyncTimer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\SyncTimer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\SyncTimerBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\SyncTimerBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\UniformRandomTimer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\UniformRandomTimer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\gui\AbstractRandomTimerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\gui\AbstractRandomTimerGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\gui\ConstantTimerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\gui\ConstantTimerGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\gui\GaussianRandomTimerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\gui\GaussianRandomTimerGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\gui\PoissonRandomTimerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\gui\PoissonRandomTimerGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\gui\UniformRandomTimerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\gui\UniformRandomTimerGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\ConstantPoissonProcessGenerator.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\ConstantPoissonProcessGenerator.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\DurationProvider.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\DurationProvider.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\EventProducer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\EventProducer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\PreciseThroughputTimer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\PreciseThroughputTimer.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\PreciseThroughputTimerBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\PreciseThroughputTimerBeanInfo.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\ThroughputProvider.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\timers\poissonarrivals\ThroughputProvider.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\validation\ComponentTreeClonerForValidation.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\validation\ComponentTreeClonerForValidation.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\AccumListener.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\AccumListener.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\AssertionVisualizer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\AssertionVisualizer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\AxisGraph.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\AxisGraph.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\BSFListener.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\BSFListener.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\BSFListenerBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\BSFListenerBeanInfo.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\BarGraph.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\BarGraph.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\BeanShellListener.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\BeanShellListener.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\BeanShellListenerBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\BeanShellListenerBeanInfo.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\ComparisonVisualizer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\ComparisonVisualizer.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\Graph.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\Graph.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\GraphListener.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\GraphListener.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\GraphVisualizer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\GraphVisualizer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\JSR223Listener.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\JSR223Listener.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\JSR223ListenerBeanInfo.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\JSR223ListenerBeanInfo.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\LineGraph.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\LineGraph.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\MailerVisualizer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\MailerVisualizer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\PropertyControlGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\PropertyControlGui.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsBoundaryExtractor.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsBoundaryExtractor.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsCssJQuery.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsCssJQuery.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsDocument.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsDocument.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsHTML.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsHTML.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsHTMLFormatted.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsHTMLFormatted.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsHTMLWithEmbedded.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsHTMLWithEmbedded.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsJSON.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsJSON.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsRegexp.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsRegexp.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsText.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsText.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsXML.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsXML.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsXPath.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsXPath.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsXPath2.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderAsXPath2.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderInBrowser.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RenderInBrowser.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RequestPanel.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RequestPanel.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RequestView.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RequestView.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RequestViewRaw.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RequestViewRaw.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RespTimeGraphChart.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RespTimeGraphChart.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RespTimeGraphDataBean.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RespTimeGraphDataBean.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RespTimeGraphLineBean.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RespTimeGraphLineBean.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RespTimeGraphVisualizer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\RespTimeGraphVisualizer.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\ResultRenderer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\ResultRenderer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SamplerResultTab.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SamplerResultTab.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SearchTextExtension.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SearchTextExtension.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SearchTreePanel.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SearchTreePanel.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SearchableTreeNode.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SearchableTreeNode.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SimpleDataWriter.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SimpleDataWriter.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\StatGraphProperties.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\StatGraphProperties.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\StatGraphVisualizer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\StatGraphVisualizer.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\StatVisualizer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\StatVisualizer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SummaryReport.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\SummaryReport.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\TableVisualizer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\TableVisualizer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\TreeNodeRenderer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\TreeNodeRenderer.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\ViewResultsFullVisualizer.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\ViewResultsFullVisualizer.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\XMLDefaultMutableTreeNode.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\XMLDefaultMutableTreeNode.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\AbstractBackendListenerClient.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\AbstractBackendListenerClient.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\BackendListener.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\BackendListener.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\BackendListenerClient.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\BackendListenerClient.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\BackendListenerContext.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\BackendListenerContext.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\BackendListenerGui.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\BackendListenerGui.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\ErrorMetric.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\ErrorMetric.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\SamplerMetric.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\SamplerMetric.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\UserMetric.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\UserMetric.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\WindowMode.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\WindowMode.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\AbstractGraphiteMetricsSender.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\AbstractGraphiteMetricsSender.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\GraphiteBackendListenerClient.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\GraphiteBackendListenerClient.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\GraphiteMetricsSender.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\GraphiteMetricsSender.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\PickleGraphiteMetricsSender.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\PickleGraphiteMetricsSender.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\SocketConnectionInfos.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\SocketConnectionInfos.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\SocketOutputStream.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\SocketOutputStream.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\SocketOutputStreamPoolFactory.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\SocketOutputStreamPoolFactory.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\TextGraphiteMetricsSender.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\graphite\TextGraphiteMetricsSender.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\influxdb\AbstractInfluxdbMetricsSender.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\influxdb\AbstractInfluxdbMetricsSender.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\influxdb\HttpMetricsSender.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\influxdb\HttpMetricsSender.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\influxdb\InfluxdbBackendListenerClient.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\influxdb\InfluxdbBackendListenerClient.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\influxdb\InfluxdbMetricsSender.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\influxdb\InfluxdbMetricsSender.java</a></td><td>0</td> </tr> <tr class="b"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\influxdb\UdpMetricsSender.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\backend\influxdb\UdpMetricsSender.java</a></td><td>0</td> </tr> <tr class="a"> <td><a href="#f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\utils\Colors.java">C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\visualizers\utils\Colors.java</a></td><td>0</td> </tr> </table> <hr size="1" width="100%" align="left"> <a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BSFAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BSFAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BSFAssertionBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BSFAssertionBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BeanShellAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\BeanShellAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\CompareAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\CompareAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\CompareAssertionBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\CompareAssertionBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\DurationAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\DurationAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\HTMLAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\HTMLAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSONPathAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSONPathAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSR223Assertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSR223Assertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSR223AssertionBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\JSR223AssertionBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\LogErrorHandler.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\LogErrorHandler.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\MD5HexAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\MD5HexAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\ResponseAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\ResponseAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SMIMEAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SMIMEAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SMIMEAssertionTestElement.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SMIMEAssertionTestElement.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SizeAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SizeAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SubstitutionElement.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\SubstitutionElement.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XMLAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XMLAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XMLSchemaAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XMLSchemaAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XPath2Assertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XPath2Assertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XPathAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\XPathAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\AssertionGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\AssertionGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\BeanShellAssertionGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\BeanShellAssertionGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\DurationAssertionGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\DurationAssertionGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\HTMLAssertionGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\HTMLAssertionGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\JSONPathAssertionGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\JSONPathAssertionGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\MD5HexAssertionGUI.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\MD5HexAssertionGUI.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\SMIMEAssertionGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\SMIMEAssertionGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\SizeAssertionGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\SizeAssertionGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLAssertionGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLAssertionGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLConfPanel.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLConfPanel.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLSchemaAssertionGUI.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XMLSchemaAssertionGUI.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPath2AssertionGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPath2AssertionGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPath2Panel.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPath2Panel.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPathAssertionGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPathAssertionGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPathPanel.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\gui\XPathPanel.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\jmespath\JMESPathAssertion.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\jmespath\JMESPathAssertion.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\jmespath\gui\JMESPathAssertionGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\assertions\jmespath\gui\JMESPathAssertionGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\CSVDataSet.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\CSVDataSet.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\CSVDataSetBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\CSVDataSetBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\KeystoreConfig.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\KeystoreConfig.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\KeystoreConfigBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\KeystoreConfigBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\RandomVariableConfig.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\RandomVariableConfig.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\RandomVariableConfigBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\config\RandomVariableConfigBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\CriticalSectionController.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\CriticalSectionController.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ForeachController.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ForeachController.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\IncludeController.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\IncludeController.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\InterleaveControl.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\InterleaveControl.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ModuleController.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ModuleController.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\OnceOnlyController.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\OnceOnlyController.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\RandomController.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\RandomController.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\RandomOrderController.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\RandomOrderController.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\SwitchController.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\SwitchController.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ThroughputController.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\ThroughputController.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\CriticalSectionControllerGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\CriticalSectionControllerGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ForeachControlPanel.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ForeachControlPanel.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\IncludeControllerGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\IncludeControllerGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\InterleaveControlGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\InterleaveControlGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ModuleControllerGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ModuleControllerGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\OnceOnlyControllerGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\OnceOnlyControllerGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\RandomControlGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\RandomControlGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\RandomOrderControllerGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\RandomOrderControllerGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\SwitchControllerGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\SwitchControllerGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ThroughputControllerGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\ThroughputControllerGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\TreeNodeWrapper.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\control\gui\TreeNodeWrapper.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BSFPostProcessor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BSFPostProcessor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BSFPostProcessorBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BSFPostProcessorBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BeanShellPostProcessor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BeanShellPostProcessor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BeanShellPostProcessorBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BeanShellPostProcessorBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BoundaryExtractor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\BoundaryExtractor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\DebugPostProcessor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\DebugPostProcessor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\DebugPostProcessorBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\DebugPostProcessorBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\Extractor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\Extractor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\HtmlExtractor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\HtmlExtractor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSR223PostProcessor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSR223PostProcessor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSR223PostProcessorBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSR223PostProcessorBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSoupExtractor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JSoupExtractor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JoddExtractor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\JoddExtractor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\RegexExtractor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\RegexExtractor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\XPath2Extractor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\XPath2Extractor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\XPathExtractor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\XPathExtractor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\BoundaryExtractorGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\BoundaryExtractorGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\HtmlExtractorGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\HtmlExtractorGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\RegexExtractorGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\RegexExtractorGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\XPath2ExtractorGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\XPath2ExtractorGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\XPathExtractorGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\gui\XPathExtractorGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathCache.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathCache.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathCacheLoader.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathCacheLoader.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathExtractor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\JMESPathExtractor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\gui\JMESPathExtractorGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jmespath\gui\JMESPathExtractorGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\JSONManager.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\JSONManager.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\JSONPostProcessor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\JSONPostProcessor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\gui\JSONPostProcessorGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\jsonpath\gui\JSONPostProcessorGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\AbstractRenderAsJsonRenderer.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\AbstractRenderAsJsonRenderer.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\RenderAsJmesPathRenderer.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\RenderAsJmesPathRenderer.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\RenderAsJsonRenderer.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\extractor\json\render\RenderAsJsonRenderer.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\gui\action\ExportTransactionAndSamplerNames.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\gui\action\ExportTransactionAndSamplerNames.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BSFPreProcessor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BSFPreProcessor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BSFPreProcessorBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BSFPreProcessorBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BeanShellPreProcessor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BeanShellPreProcessor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BeanShellPreProcessorBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\BeanShellPreProcessorBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\CounterConfig.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\CounterConfig.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\JSR223PreProcessor.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\JSR223PreProcessor.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\JSR223PreProcessorBeanInfo.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\JSR223PreProcessorBeanInfo.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\SampleTimeout.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\SampleTimeout.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\UserParameters.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\UserParameters.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\CounterConfigGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\CounterConfigGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\SampleTimeoutGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\SampleTimeoutGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\UserParametersGui.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\modifiers\gui\UserParametersGui.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\reporters\MailerModel.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\reporters\MailerModel.java</h3> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> <th>Error Description</th><th>Line</th> </tr> </table> <a href="#top">Back to top</a><a name="f-C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\reporters\MailerResultCollector.java"></a> <h3>File C:\Users\Carlos\Downloads\apache-jmeter-5.2.1_src\apache-jmeter-5.2.1\src\components\src\main\java\org\apache\jmeter\reporters
66,614
thestackv1_concat_by_repo-long/65536-65536
start --> <section class="pcoded-main-container"> <div class="pcoded-content"> <!-- [ breadcrumb ] start --> <div class="page-header"> <div class="page-block"> <div class="row align-items-center"> <div class="col-md-12"> <div class="page-header-title"> <h5 class="m-b-10">Header</h5> </div> <ul class="breadcrumb"> <li class="breadcrumb-item"><a href="{{URL::to('/ustaad/dashboard')}}"><i class="fa fa-home"></i></a></li> <li class="breadcrumb-item"><a href="#!">Header</a></li> <li class="breadcrumb-item"><a href="#!">First Nav Bar</a></li> </ul> </div> </div> </div> </div> <!-- [ breadcrumb ] end --> <!-- [ Main Content ] start --> <div class="row"> <div class="col-md-6"> <div class="card"> <div class="card-header"> Change Social Media Icons </div> <div class="card-body"> <form class="socialForm" action="" method="post"> <div class="alignleft actions bulkactions"> <label for="bulk-action-selector-top" class="d-block ">Select Social Media</label> <select name="iconName" class="form-control w-75 d-inline-block socialIcon" id="bulk-action-selector-top"> <option value="-1">Select</option> <option class="Twitter" value="Twitter">Twitter</option> <option class="Youtube" value="Youtube">Youtube</option> <option class="Facebook" value="Facebook">Facebook</option> <option class="LinkedIn" value="LinkedIn">LinkedIn</option> <option class="GooglePlus" value="GooglePlus">Google Plus</option> <option class="Pinterest" value="Pinterest">Pinterest</option> <option class="Snapchat" value="Snapchat">Snapchat</option> <option class="Tiktok" value="Tiktok">Tiktok</option> <option class="Instagram" value="Instagram">Instagram</option> </select> </div> <div class="form-group pt-4"> <label for="" class="">Enter Link </label> <input type="url" name="link" class="form-control socialLink" placeholder="Enter Link" required> </div> <input type="submit" id="doaction" class="btn btn-outline-primary mt-4 socialButton" value="Apply"> </form> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-header"> List of Social Media </div> <div class="card-body"> <table id="user-list-table" class="table nowrap"> <thead class="bg-primary text-white"> <tr> <th class="w-30">Title</th> <th>Link</th> <th>Date</th> <th>Action</th> </tr> </thead> <tbody class="border border-primary"> @foreach($totalData as $data) <tr> <td> {{$data->iconName}} </td> <td class="tdLinkScroll"> {{$data->link}} </td> <td> {{$data->updated_at->format("d/m/Y")}} </td> <td> <a href="#"> <i class="far fa-edit text-success mr-2 editlink" value="{{$data->id}}"></i> </a> <a href="{{URL::to('/ustaad/firstNav/trash')}}/{{$data->id}}" class="addAction"> <i class="fa fa-times text-danger"></i> </a> </td> </tr> @endforeach </tbody> <tfoot> <tr> <th class="w-30">Title</th> <th>Link</th> <th>Date</th> <th>Action</th> </tr> </tfoot> </table> </div> </div> </div> </div> <!-- [ Main Content ] end --> </div> </section> <!-- [ Main Content ] end --> @include('admin.include.footer') <script> $(".editlink").on("click",function(){ var id = $(this).attr('value'); var icon = $(this).parent().parent().parent().children()[0].innerText; var link = $(this).parent().parent().parent().children()[1].innerText; $(".socialIcon").find("."+icon).attr("selected",true); $(".socialLink").val(link); $(".socialButton").val("Update"); $(".socialButton").attr("class","btn btn-outline-danger mt-4 socialButton"); $(".socialForm").attr("action","{{URL::to('/ustaad/firstNav/edit/')}}/"+id+""); }); </script> ======================= File: resources/views/htmlPages/schoolboy-made-72million-forex-trading-lunch-breaks.blade.php ======================= @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>School’boy made $72million from Forex Trading on his lunch breaks</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <p> This is news of the Year 2014 A School Boy make $72 Million From Forex Trading on his school lunch break, </p> <p> He is Muslim and his name is <NAME>, He start Forex Trading at the age of nine and He earn 72 Million Dollar at the age of 17 year. He trades stocks at on his Lunch breaks at New York Stuyvesant High school, Now he plan to earn $1 BN with his friends, we wish him best luck and also pray for him </p> <div> <ul> <li>M<NAME>, 17, started dabbling in penny stocks at the age of nine</li> <li>He trades stocks on lunch breaks at New York’s Stuyvesant High School</li> <li>Has made 8-figures trading – rumored to be as much as $72 million</li> <li>Has bought BMW and Manhattan apartment</li> <li>He cites his inspiration as billionaire hedge finder <NAME>, 60</li> <li>Mohammed’s parents are immigrants from Bengal region of South Asia</li> <li>Student hopes to start hedge fund next year and make $1 bn with friends</li> <li>On his Instamatic profile, he has written: ‘More money, less problems’</li> </ul> </div> <br><br> <div class="text-center"> <img src="{{URL::to('/public/assets/assets/img/blog-post/17-year-old-boy-become-multi-millionair-17-in-urdu.jpg')}}"> </div> <br> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> @include('inc.footer') ======================= File: app/Http/Controllers/SlidingImagesController.php ======================= <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\SlidingImagesModel; use App\Models\TrashModel; class SlidingImagesController extends Controller { public function Index(Request $request){ $images = SlidingImagesModel::orderBy('id','desc')->where('trash',0)->get(); return view('admin.sliding-images',compact("images")); } public function Add(Request $request){ if ($request->file("file_photo")!= null) { $path = $request->file("file_photo")->store("WebImages"); $SliderImage = $path; } $image = new SlidingImagesModel; $image->image = $SliderImage; $image->save(); $success = "This slider has been added successfully."; $request->session()->put("success",$success); $images = SlidingImagesModel::all(); return view('admin.sliding-images',compact("images")); } public function Edit(Request $request, $id){ $image = SlidingImagesModel::where('id',$id)->first(); return view('admin.edit-slide-img',compact("image")); } public function ProcessEdit(Request $request, $id){ if ($request->file("file_photo")!= null) { $path = $request->file("file_photo")->store("WebImages"); $SliderImage = $path; }else{ $preimage = SlidingImagesModel::where('id',$id)->first(); $SliderImage = $preimage->image; } $image = SlidingImagesModel::where('id',$id)->first(); $image->image = $SliderImage; $image->title = $request->title; $image->link = $request->link; $image->description = $request->description; $image->save(); $success = "This slider has been updated successfully."; $request->session()->put("success",$success); return view('admin.edit-slide-img',compact("image")); } public function ProcessRemove(Request $request, $id){ $Trash = TrashModel::where('deleteId',$id)->where('category',"Sliding Images")->first(); $Trash->delete(); $image = SlidingImagesModel::where('id',$id)->first(); $image->delete(); $error = "This slider has been deleted successfully."; $request->session()->put("error",$error); return redirect('ustaad/sliding-images'); } public function Trash(Request $request, $id){ $user = $request->session()->get("admin"); $data = SlidingImagesModel::find($id); $data->trash = 1; $data->save(); $Trash = new TrashModel; $Trash->adminTableId = $user->id; $Trash->trashItem = "sliding-images"; $Trash->category = "Sliding Images"; $Trash->deleteId = $id; $Trash->deleteTitle = $data->iconName; $Trash->save(); $error = "This slider has been deleted successfully."; $request->session()->put("error",$error); return redirect('ustaad/sliding-images'); } public function TrashRestore(Request $request, $id){ $data = SlidingImagesModel::find($id); $data->trash = 0; $data->save(); $Trash = TrashModel::where('deleteId',$id)->where('category',"Sliding Images")->first(); $Trash->delete(); $success = "This slider has been restore successfully."; $request->session()->put("success",$success); return back(); } } ======================= File: resources/views/htmlPages/market-reviews-euro-dollar-yen.blade.php ======================= @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>Market reviews Euro/Dollar, Dollar Yen and more</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <p> The yen retreated against its major peers on Tuesday, as risk appetite was relatively positive and trading was quiet, which reduced appetite for the safe haven currency. </p> <p> Dollar / yen managed to surpass 104; a level that served as resistance in previous sessions as positive sentiment about the greenback continued. Two developments helped the greenback the previous day. First of all, the Markit manufacturing PMI for October came in at 53.2 versus 51.5 expected – the highest in 12 months. Secondly, Chicago Fed President <NAME> said he expected 3 rate hikes from now until the end of 2017, which was in line with other recent Fed speakers that called for tighter policy. On the other hand, <NAME> of the St Louis Fed said that only one interest rate hike is necessary for now and that low interest rates will likely be the norm during the next two to three years. </p> <p> Euro / dollar from its part was holding above its lows around 1.0860 by trading at 1.0880. The euro was supported by the previous day’s Markit flash PMI reports that showed the Eurozone economy doing well. The euro also posted gains against the yen by reaching 113.60 compared to Friday’s low of 112.60. Euro / pound was marginally below 0.89. </p> <p> The Canadian dollar was volatile as the US dollar strengthened to a 7-month high of 1.3396 versus the loonie in late US trading. Then, a speech by the Bank of Canada Governor <NAME> seemed to indicate that the Bank would refrain from adding more stimulus to the economy, by saying one should wait during for the next “18 months”. The loonie strengthened back to 1.3276, only to weaken again to 1.3361 as the Governor clarified that his comments were not about monetary policy but rather about the economy’s output gap (a measure of how quickly the economy is growing compared to its potential growth rate). Failure by the EU to ratify its free trade agreement with Canada has also been weighing on the loonie lately. </p> <p> Looking ahead, the German IFO business survey will be closely watched for signs that it matches the optimism displayed in yesterday’s Markit surveys. IFO business climate is expected to hold steady at 109.5. Later in the day during the US session, Consumer Confidence for October by the Conference Board is expected to dip compared to the previous month’s 9-year high. ECB Chief Mario Draghi will also give a speech after the European close. </p> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> @include('inc.footer') ======================= File: resources/views/htmlPages/exness-and-raheel-nawaz-is-organizing-seminar-in-gujranwala-pakistan.blade.php ======================= @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>Exness and <NAME> is organized Seminar</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <div> <img src="{{URL::to('/public/assets/assets/img/blog-post/exness.jpg')}}" class="img-fluid"> </div> <p> Exness and partner <NAME> is organizing event on 7th February 2016. The event is going to be held In Gujranwala, “Hotel crown city”. We are going to have following programs. </p> <p> Aim is to communicate with exness partners and clients, sort it our there issues, Direct communication with exness representation and shares future plan.. </p> <div> <img src="{{URL::to('/public/assets/assets/img/blog-post/ustad.jpg')}}" class="img-fluid"> </div> <p> Exness and Mr <NAME> “The CEO of Forexustaad.com” organized an event about Forex trading. </p> <p> This event was organized in “ The city of Eagles” Gujranwala (Pakistan). In this event people who love to learn Forex trading come from all over the country. In this session they learnt about, ”what is Forex Trading? How can they do Forex Trading? The source person Mr <NAME> told the audience about the advantages of Forex trading. The beginning procedure was told them in such a way that most of the people who were not knew “Forex” before it, learnt it and understood it very easily. It was a detailed sessions about Forex by comparing it with real market business. There was a light atmosphere,where there every one </p> <p> was in a passion to learn. In this cool atmosphere people take tea with bakery items. After some minute,s relaxation break Mr <NAME> invited a presenter from Exness “ The Forex Company” who officially delivered a presentation about Exness and Forex Market. The people there asked questions which they had have in their mind and the presenter give them answers in a very easy,simple and understanding way. People were learning and having fun with the interesting questions of audience. After the completion of presentation there was been given an opportunity to open a bonus account. With the opening of this account people got $30 as a gift from Exness. There were a lot of gifts from this company such as T-Shirts, notepads, pens etc. After this learningful session people take a delicious dinner, with many kinds of food. And in this way, Exness and Mr <NAME> made the day of audience. It was not only a Learning session but a get-toge questioning session, a gift day and a Bonus Party. May both of them prosper more. </p> <div class="text-center"> <iframe width="576" height="315" src="https://www.youtube.com/embed/ygDZbpZ2Ics" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> @include('inc.footer') ======================= File: resources/views/htmlPages/fundamental-analysis-forex-trading.blade.php ======================= @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>Fundamental Analysis for Forex Trading, A Free Video for Newbie in urdu/hindi</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <p> Dear Friends 99% traders fail and they loss all there funds in Forex trading, I know you also worry about your future in Forex Market, Yo want to answer?? why your Stop loss hit early and why you loss your all money in Forex Market, Today try to Find your all answer in our Fundamental Analysis webinar, In this Video (webinar) I will teach you how to do Fundamental Analysis for your Forex Trading and stop losing money in Forex Market. </p> <div class="text-center"> <img src="{{URL::to('/public/assets/assets/img/blog-post/fundamental-analysis.jpg')}}"> </div> <p> I will teach you which time is best for entering in Forex market and which or where you stop Trading and exit safely from Forex market, Basically that all Fundamental Analysis. </p> <h4> What is Candlestick Strategy in urdu/Hindi </h4> <br> <h3 class="text-center"> What is Fundamental Analysis? </h3> <p> This is type of market analysis which examination of the underlying forces that affect the well being of the economy, industry groups, and companies. As with most Fundamental analysis, the goal is to derive a forecast and profit from future price movements, Basically if we look at Economic Analysis, Industry Analysis, Company Analysis, GDP, Inflation, Government Policy, Economic Policy, RBI Policy, Financial Analysis and Growth of industry that all call Fundamental analysis in Forex Trading. </p> <h4>In this video (webinar) I will teach you about ………</h4> <br> <div> <ul> <li>What is Fundamental analysis and how to do (basics only)?</li> <li>How much Type of News and how news affect on market?</li> <li>What is forexfactory.com and how to use for Forex Trading?</li> <li>What is imports of Calendar in Forex Trading?</li> <li>What is Sessions?</li> <li>which is Best time for trading?</li> </ul> </div> <br> <p> <strong>Pleas note :</strong> This is a sponsor webinar so pleas says Thanks to my sponsor and also pray for him.You must Leave a message in Comment Box for our sponsor </p> <div> <iframe src="https://player.vimeo.com/video/126562298" frameborder="0" allowfullscreen="allowfullscreen" name="fitvid0" width="100%" height="380"></iframe> </div> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> @include('inc.footer') ======================= File: app/Models/GalleryImagesDetailModel.php ======================= <reponame>Technow-Pakistan/Forexustaad-v5 <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class GalleryImagesDetailModel extends Model { protected $table = "gallery_image_detail"; protected $fillable = ["title","alt","caption","imgPath"]; } ======================= File: app/Models/ClientMemberModel.php ======================= <?php namespace App\Models; use App\Models\ClientRegistrationModel; use Illuminate\Database\Eloquent\Model; class ClientMemberModel extends Model { protected $table = "client_member"; protected $fillable = ["member"]; public function GetNumberOfClient(){ $get = ClientRegistrationModel::where('memberType',$this->id)->get(); return count($get); } } ======================= File: app/Models/LogoPanelModel.php ======================= <reponame>Technow-Pakistan/Forexustaad-v5 <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class LogoPanelModel extends Model { protected $table = "logo_images"; protected $fillable = ["logo","active","trash"]; } ======================= File: app/Http/Controllers/BrokerTopInformationController.php ======================= <filename>app/Http/Controllers/BrokerTopInformationController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\BrokerCompanyInformationModel; use App\Models\BrokerCommissionsFeesModel; use App\Models\BrokerDepositModel; use App\Models\BrokerAccountInfoModel; use App\Models\BrokerTradableAssetsModel; use App\Models\BrokerTradingPlatformModel; use App\Models\BrokerTradingFeaturesModel; use App\Models\BrokerCustomerServicesModel; use App\Models\BrokerReserchEducationModel; use App\Models\BrokerPromotionModel; use App\Models\NotificationModel; use App\Models\MetaTagsModel; class BrokerTopInformationController extends Controller { public function Index(Request $request, $id){ return view('admin.add-broker',compact('id')); } public function Add(Request $request){ $data = $request->all(); $userID = $request->session()->get('admin'); $data['userId'] = $userID->id; if ($userID['memberId'] == 6 ) { $data['pending'] = 1; } if ($request->file("file_photo")!= null) { $path = $request->file("file_photo")->store("BrokerImages"); $companyImage = $path; $data["image"] = $companyImage; } if ($request->neverEnd == 1) { $data["start"] = null; $data["end"] = null; } $broker = new BrokerCompanyInformationModel; $broker->fill($data); $broker->save(); $id = $broker->id; $brokerTitle = $broker->title; $broker = new BrokerDepositModel; $broker->brokerId = $id; $broker->save(); $broker = new BrokerCommissionsFeesModel; $broker->brokerId = $id; $broker->save(); $broker = new BrokerAccountInfoModel; $broker->brokerId = $id; $broker->save(); $broker = new BrokerTradableAssetsModel; $broker->brokerId = $id; $broker->save(); $broker = new BrokerTradingPlatformModel; $broker->brokerId = $id; $broker->save(); $broker = new BrokerTradingFeaturesModel; $broker->brokerId = $id; $broker->save(); $broker = new BrokerCustomerServicesModel; $broker->brokerId = $id; $broker->save(); $broker = new BrokerReserchEducationModel; $broker->brokerId = $id; $broker->save(); $broker = new BrokerPromotionModel; $broker->brokerId = $id; $broker->save(); // meta Tags save start $BrokerNewPages = ['brokerDetail@','brokerNews@','brokerPromotion@','brokerTraining@','brokerReview@']; for ($i=0; $i < 5; $i++) { $newMeta = new MetaTagsModel; $newMeta->name_page = $BrokerNewPages[$i]. $brokerTitle; $newMeta->main = 0; $newMeta->save(); } // meta Tags save end if ($userID['memberId'] == 6 ) { $notification = new NotificationModel; $notification->userId = $userID->id; $notification->text = "add a new broker $brokerTitle"; $notification->link = "ustaad/brokersDetail/$id"; $previousData = NotificationModel::where('link',$notification->link)->first(); if ($previousData) { $previousData->delete(); } $notification->save(); } $success = "New broker has been added successfully."; $request->session()->put("success",$success); return redirect("ustaad/editBroker/".$id)->with(['activeFormsData'=>$request->activeForm]); } public function AddDeposit(Request $request){ if (!isset($request->brokerId)) { $error = "Please Enter Broker Company Information First"; return view('admin.add-broker',compact('error')); } $data = $request->all(); $userID = $request->session()->get('admin'); $broker = BrokerDepositModel::where('id',$request->brokerId)->first(); if ($userID['memberId'] == 6 && $broker->editId == null) { $editData = new BrokerDepositModel; $data['editId'] = $broker->id; $data['pending'] = 1; $data['brokerId'] = $broker->brokerId; $editData->fill($data); $editData->save(); }else{ $data['brokerId'] = $broker->brokerId; $broker->fill($data); $broker->save(); } $id = $broker->brokerId; if ($userID['memberId'] == 6 ) { $title = BrokerCompanyInformationModel::find($id); $notification = new NotificationModel; $notification->userId = $userID->id; $notification->text = "Edit a Deposit section in $title->title broker"; $notification->link = "ustaad/brokersDetail/$title->id"; $previousData = NotificationModel::where('link',$notification->link)->first(); if ($previousData) { $previousData->delete(); } $notification->save(); } $success = "This broker information has been added successfully."; $request->session()->put("success",$success); return redirect("ustaad/editBroker/".$id)->with(['activeFormsData'=>$request->activeForm]); } public function AddCommission(Request $request){ if (!isset($request->brokerId)) { $error = "Please Enter Broker Company Information First"; return view('admin.add-broker',compact('error')); } $data = $request->all(); $userID = $request->session()->get('admin'); $broker = BrokerCommissionsFeesModel::where('id',$request->brokerId)->first(); if ($userID['memberId'] == 6 && $broker->editId == null) { $editData = new BrokerCommissionsFeesModel; $data['editId'] = $broker->id; $data['pending'] = 1; $data['brokerId'] = $broker->brokerId; $editData->fill($data); $editData->save(); }else{ $data['brokerId'] = $broker->brokerId; $broker->fill($data); $broker->save(); } $id = $broker->brokerId; if ($userID['memberId'] == 6 ) { $title = BrokerCompanyInformationModel::find($id); $notification = new NotificationModel; $notification->userId = $userID->id; $notification->text = "Edit a Commission section in $title->title broker"; $notification->link = "ustaad/brokersDetail/$title->id"; $previousData = NotificationModel::where('link',$notification->link)->first(); if ($previousData) { $previousData->delete(); } $notification->save(); } $success = "This broker information has been added successfully."; $request->session()->put("success",$success); return redirect("ustaad/editBroker/".$id)->with(['activeFormsData'=>$request->activeForm]); } public function AddAccountInfo(Request $request){ if (!isset($request->brokerId)) { $error = "Please Enter Broker Company Information First"; return view('admin.add-broker',compact('error')); } $data = $request->all(); $userID = $request->session()->get('admin'); $broker = BrokerAccountInfoModel::where('id',$request->brokerId)->first(); if ($userID['memberId'] == 6 && $broker->editId == null) { $editData = new BrokerAccountInfoModel; $data['editId'] = $broker->id; $data['pending'] = 1; $data['brokerId'] = $broker->brokerId; $editData->fill($data); $editData->save(); }else{ $data['brokerId'] = $broker->brokerId; $broker->fill($data); $broker->save(); } $id = $broker->brokerId; if ($userID['memberId'] == 6 ) { $title = BrokerCompanyInformationModel::find($id); $notification = new NotificationModel; $notification->userId = $userID->id; $notification->text = "Edit a Account Info section in $title->title broker"; $notification->link = "ustaad/brokersDetail/$title->id"; $previousData = NotificationModel::where('link',$notification->link)->first(); if ($previousData) { $previousData->delete(); } $notification->save(); } $success = "This broker information has been added successfully."; $request->session()->put("success",$success); return redirect("ustaad/editBroker/".$id)->with(['activeFormsData'=>$request->activeForm]); } public function AddTradableAssets(Request $request){ if (!isset($request->brokerId)) { $error = "Please Enter Broker Company Information First"; return view('admin.add-broker',compact('error')); } $data = $request->all(); $userID = $request->session()->get('admin'); $broker = BrokerTradableAssetsModel::where('id',$request->brokerId)->first(); if ($userID['memberId'] == 6 && $broker->editId == null) { $editData = new BrokerTradableAssetsModel; $data['editId'] = $broker->id; $data['pending'] = 1; $data['brokerId'] = $broker->brokerId; $editData->fill($data); $editData->save(); }else{ $data['brokerId'] = $broker->brokerId; $broker->fill($data); $broker->save(); } $id = $broker->brokerId; if ($userID['memberId'] == 6 ) { $title = BrokerCompanyInformationModel::find($id); $notification = new NotificationModel; $notification->userId = $userID->id; $notification->text = "Edit a Tradable Assets section in $title->title broker"; $notification->link = "ustaad/brokersDetail/$title->id"; $previousData = NotificationModel::where('link',$notification->link)->first(); if ($previousData) { $previousData->delete(); } $notification->save(); } $success = "This broker information has been added successfully."; $request->session()->put("success",$success); return redirect("ustaad/editBroker/".$id)->with(['activeFormsData'=>$request->activeForm]); } public function AllowBrokerProcess(Request $request, $id){ $broker = BrokerCompanyInformationModel::find($id); $broker->pending = 0; $broker->save(); $success = "This broker information has been added successfully."; $request->session()->put("success",$success); return back(); } public function StarBrokerProcess(Request $request, $id){ $broker = BrokerCompanyInformationModel::find($id); $broker->star = 1; $broker->save(); $success = "This broker information has been added successfully."; $request->session()->put("success",$success); return back(); } public function UnStarBrokerProcess(Request $request, $id){ $broker = BrokerCompanyInformationModel::find($id); $broker->star = 0; $broker->save(); $success = "This broker information has been added successfully."; $request->session()->put("success",$success); return back(); } // Broker Detail Allow functions public function BrokerCompanyInformationAllow(Request $request, $id){ $broker = BrokerCompanyInformationModel::find($id); if ($broker->editId == null) { $data = BrokerCompanyInformationModel::where('editId',$broker->id)->first(); $changeId = $data->id; $data->delete(); $broker->pending = 0; $broker->editId = null; $broker->id = $changeId; $broker->save(); }else{ $broker->pending = 0; $broker->save(); } return back(); } public function BrokerDepositAllow(Request $request, $id){ $broker = BrokerDepositModel::find($id); if ($broker->editId!= null) { $data = BrokerDepositModel::where('id',$broker->editId)->first(); $changeId = $data->id; $data->delete(); $broker->pending = 0; $broker->editId = null; $broker->id = $changeId; $broker->save(); }else{ $broker->pending = 0; $broker->save(); } return back(); } public function BrokerCommissionAllow(Request $request, $id){ $broker = BrokerCommissionsFeesModel::find($id); if ($broker->editId!= null) { $data = BrokerCommissionsFeesModel::where('id',$broker->editId)->first(); $changeId = $data->id; $data->delete(); $broker->pending = 0; $broker->editId = null; $broker->id = $changeId; $broker->save(); }else{ $broker->pending = 0; $broker->save(); } return back(); } public function BrokerAccountInfoAllow(Request $request, $id){ $broker = BrokerAccountInfoModel::find($id); if ($broker->editId!= null) { $data = BrokerAccountInfoModel::where('id',$broker->editId)->first(); $changeId = $data->id; $data->delete(); $broker->pending = 0; $broker->editId = null; $broker->id = $changeId; $broker->save(); }else{ $broker->pending = 0; $broker->save(); } return back(); } public function BrokerTradableAssetsAllow(Request $request, $id){ $broker = BrokerTradableAssetsModel::find($id); if ($broker->editId!= null) { $data = BrokerTradableAssetsModel::where('id',$broker->editId)->first(); $changeId = $data->id; $data->delete(); $broker->pending = 0; $broker->editId = null; $broker->id = $changeId; $broker->save(); }else{ $broker->pending = 0; $broker->save(); } return back(); } } ======================= File: app/Models/FooterCopyRightModel.php ======================= <filename>app/Models/FooterCopyRightModel.php<gh_stars>0 <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class FooterCopyRightModel extends Model { protected $table = "footer_copy_right"; protected $fillable = ["description","description2"]; } ======================= File: resources/views/htmlPages/deposit-money-exness-pakistan.blade.php ======================= @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>How to Deposit and Withdraw money in exness from Pakistan</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <p> In this Post I will teach you how to money deposit in your exness account from Pakistan via Excard. </p> <p> Like You want invest in PKR and also withdraw in Pak rupess then no problem it’s very easy </p> <p> you may invest in exness via easy paisa, Omni or any Bank account, you just need to watch video and learn </p> <p> how to invest dollar in Exness.com. If you don’t Know about Forex then you must watch this Video link below </p> <div class="text-center"> <img src="{{URL::to('/public/assets/assets/img/blog-post/exness-to-Pakistani-rupes.jpg')}}" class="img-fluid"> </div> <h4> What is Forex Trading in Urdu </h4> <p> Dosto Ajj mein app ko exness me paisy invest and withdraw karny ky bary me bataoo ga, ky kisy app exness me apny Pakistani rupess deposit kar sakty ho and kisy aon rupess ko withdraw kar sakty ho, ye bohat asan kam hai app Easy paisa, Omni and kisi be Bank account sy ye kam kar sakty ho, mein app ki help karo ga es kam me app just Video dikho and learn more ….. Thank you </p> <h5> For more information feel free to contact us. </h5> <br> <ul> <li>Contact: <NAME> </li> <li>24/7 Live Support</li> <li>E-mail: <EMAIL></li> <li>Skype: Raheel6542380</li> <li>Cell #: +92-345-6542380</li> </ul> <h5 class="text-center"> General rules for depositing and withdrawing funds </h5> <br> <ol> <li>The term “instant” shall be understood to mean that a transaction is carried out within a few seconds without manual processing by financial department specialists.</li> <li>Funds may only be withdrawn to clients’ personal accounts in order to ensure financial security and prevent money laundering.</li> <li>The company will not accept direct payments or payments to third parties; clients are given all necessary information in their personal area when completing a transaction.</li> <li>Deposits and withdrawals may be made 24 hours a day, 7 days a week. If a deposit or withdrawal is not carried out instantly, it will be completed within 24 hours.</li> <li>The company shall not be liable for delays in processing deposits and withdrawals if such delays are caused by the payment system.</li> <li>Internal transfers between accounts of the same type are performed instantly. Internal transfers are not available to clients who use credit cards to fund their trading accounts.</li> <li>If a client funds his/her trading account using multiple payment systems or multiple wallets within the same payment system, funds must be withdrawn in proportion to the amounts deposited.</li> <li>The company retains the right to change the processing time for deposits and withdrawals without notifying clients in advance</li> <li>e company may place limits on the payment systems available to clients from certain countries.</li> </ol> <br> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> @include('inc.footer') ======================= File: resources/views/mac.blade.php ======================= <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script src="{{URL::to('/public/assets/assets/js/jquery-3.2.1.min.js')}}"></script> </head> <body> <script> $(document).ready(function () { $('#btnGetIpDetail').click(function () { if ($('#txtIP').val() == '') { alert('IP address is reqired'); return false; } $.getJSON("http://ip-api.io/3/json" + $('#192.168.3.11').val(), function (result) { alert('City Name:'+ result.city) console.log(result); }); }); }); </script> </body> </html> ======================= File: resources/views/admin/header-banner.blade.php ======================= <reponame>Technow-Pakistan/Forexustaad-v5<gh_stars>0 @include('admin.include.header') <!-- [ Main Content ] start --> <section class="pcoded-main-container"> <div class="pcoded-content"> <!-- [ breadcrumb ] start --> <div class="page-header"> <div class="page-block"> <div class="row align-items-center"> <div class="col-md-12"> <div class="page-header-title"> <h5 class="m-b-10">Header Banner</h5> </div> <ul class="breadcrumb"> <li class="breadcrumb-item"> <a href="{{URL::to('/ustaad/dashboard')}}"><i class="fa fa-home"></i></a> </li> <li class="breadcrumb-item"> <a href="#!">Header Banner</a> </li> <!-- <li class="breadcrumb-item"> <a href="#!"></a> </li> --> </ul> </div> </div> </div> </div> <!-- [ breadcrumb ] end --> <!-- [ Main Content ] start --> <div class="row"> <div class="col-md-6"> <div class="card"> <div class="card-header">Left Banner</div> <div class="card-body"> <form action="" class="firstForm bannerLeftForm" method="post" enctype="multipart/form-data"> <div class="form-group"> <span> <div class="bannerLeftTitle"> <img id="slider1" src="" class="img-fluid" alt="your image" /> </div> </span> <div class="custom-file my-3 h-100"> <input type="file" class="form-control h-100" name="file_photo" id="file1"> </div> <div class="fileError1 text-danger text-right"></div> </div> <div class="form-group pt-2"> <label for="">Enter Link</label> <input type="link" name="link" class="form-control fileLink bannerLeftLink"> </div> <div class="form-group pt-2"> <label for="">Enter HTMLLink</label> <textarea name="htmlLink" class="form-control htmlLink bannerLeftHtmlLink"></textarea> </div> <div class="form-group pt-2"> <label for="" class="">Start Date </label> <input type="date" class="form-control bannerLeftStart" name="start" required> </div> <div class="form-group pt-2"> <label for="" class="">End Date </label> <input type="date" class="form-control bannerLeftEnd" name="end" required> </div> <div class="form-group pt-2"> <label for="" class="">Active </label> <input type="checkbox" class="bannerLeftActive" value="0" name="active"> </div> <input type="submit" class="btn btn-info mt-3 bannerLeftButton" value="Upload"> <p class="error1 text-danger"></p> </form> <table class="table mt-5"> <thead class="bg-primary text-white"> <tr> <th>Image</th> <th>Start</th> <th>End</th> <th>Active</th> <th>Action</th> </tr> </thead> <tbody class="border border-primary"> @foreach($totalData as $data) <tr> <td> @if($data->banner!= null) <a href="{{$data->link}}"> <img id="slider1" src="{{URL::to('/storage/app')}}/{{$data->banner}}" class="img-fluid" width="100px" height="100px" alt="your image" /> </a> @else <div class="bannerContactHtmlLink"> @php echo $data->htmlLink; @endphp </div> @endif </td> <td> {{$data->start}} </td> <td> {{$data->end}} </td> <td> @if($data->active == 0) Active @endif </td> <td> <a href="#"> <i class="far fa-edit text-success mr-2 editLeftlink" value="{{$data->id}}"></i> </a> <a href="{{URL::to('/ustaad/banner/header-banner/left/trash')}}/{{$data->id}}" class="addAction" data-toggle="modal" data-target="#myModal"> <i class="fa fa-times text-danger"></i> </a> </td> </tr> @endforeach </tbody> </table> </div> </div> </div> <div class="col-md-6"> <div class="card"> <div class="card-header">Right Banner</div> <div class="card-body"> <form action="{{URL::to('ustaad/banner/header-banner/right')}}" method="post" class="Form2 bannerRightForm" enctype="multipart/form-data"> <div class="form-group"> <span> <div class="bannerRightTitle"> <img id="slider1" src="" class="img-fluid" alt="your image" /> </div> </span> <div class="custom-file my-3 h-100"> <input type="file" class="form-control h-100" name="file_photo" id="file2"> </div> <div class="fileError2 text-danger text-right"></div> </div> <div class="form-group pt-2"> <label for="">Enter Link</label> <input type="link" name="link" class="form-control fileLink2 bannerRightLink"> </div> <div class="form-group pt-2"> <label for="">Enter HTMLLink</label> <textarea name="htmlLink" class="form-control htmlLink2 bannerRightHtmlLink"></textarea> </div> <div class="form-group pt-2"> <label for="" class="">Start Date </label> <input type="date" class="form-control bannerRightStart" name="start" required> </div> <div class="form-group pt-2"> <label for="" class="">End Date</label> <input type="date" class="form-control bannerRightEnd" name="end" required> </div> <div class="form-group pt-2"> <label for="" class="">Active </label> <input type="checkbox" class="bannerRightActive" value="0" name="active"> </div> <input type="submit" class="btn btn-info mt-3 bannerRightButton" value="Upload"> <p class="error2 text-danger"></p> </form> <table class="table mt-5"> <thead class="bg-primary text-white"> <tr> <th>Image</th> <th>Start</th> <th>End</th> <th>Active</th> <th>Action</th> </tr> </thead> <tbody class="border border-primary"> @foreach($totalRightData as $data) <tr> <td> @if($data->banner!= null) <a href="{{$data->link}}"> <img id="slider1" src="{{URL::to('/storage/app')}}/{{$data->banner}}" class="img-fluid" width="100px" height="100px" alt="your image" /> </a> @else <div class="bannerContactRightHtmlLink"> @php echo $data->htmlLink; @endphp </div> @endif </td> <td> {{$data->start}} </td> <td> {{$data->end}} </td> <td> @if($data->active == 0) Active @endif </td> <td> <a href="#"> <i class="far fa-edit text-success mr-2 editRightlink" value="{{$data->id}}"></i> </a> <a href="{{URL::to('/ustaad/banner/header-banner/right/trash')}}/{{$data->id}}" class="addAction" data-toggle="modal" data-target="#myModal"> <i class="fa fa-times text-danger"></i> </a> </td> </tr> @endforeach </tbody> </table> </div> </div> </div> </div> <!-- [ Main Content ] end --> </div> </section> <!-- [ Main Content ] end --> @include('admin.include.footer') <!-- edit left Content --> <script> $(".bannerLeftTitle").hide(); $(".editLeftlink").on("click",function(){ var id = $(this).attr('value'); var title = $(this).parent().parent().parent()[0].children[0].innerHTML; title = title.trim(); var start = $(this).parent().parent().parent()[0].children[1].innerText; var end = $(this).parent().parent().parent()[0].children[2].innerText; var active = $(this).parent().parent().parent()[0].children[3].innerText; $(".bannerLeftTitle").show(); $(".bannerLeftTitle").html(title); $(".bannerLeftStart").val(start); $(".bannerLeftEnd").val(end); if (active == "Active") { $(".bannerLeftActive").attr("checked",true) }else{ $(".bannerLeftActive").attr("checked",false) } $(".bannerLeftButton").val("Update"); $(".bannerLeftButton").attr("class","btn btn-outline-danger mt-4 bannerLeftButton"); $(".bannerLeftForm").attr("action","{{URL::to('/ustaad/banner/header-banner/edit-left')}}/"+id+""); var Link = $(".bannerLeftTitle").find('a').attr('href'); var htmlLink = $(".bannerLeftTitle").find(".bannerContactHtmlLink"); if(htmlLink.length!= 0){ var htmlLinkdata = $(".bannerContactHtmlLink").html(); htmlLinkdata = htmlLinkdata.trim(); $(".bannerLeftLink").val(""); $(".bannerLeftHtmlLink").val(htmlLinkdata); }else{ $(".bannerLeftLink").val(Link); $(".bannerLeftHtmlLink").val(""); $("#file1").attr("id"," "); } console.log(Link); console.log(htmlLink); }); </script> <!-- edit right Content --> <script> $(".bannerRightTitle").hide(); $(".editRightlink").on("click",function(){ var id2 = $(this).attr('value'); var title2 = $(this).parent().parent().parent()[0].children[0].innerHTML; title2 = title2.trim(); var start2 = $(this).parent().parent().parent()[0].children[1].innerText; var end2 = $(this).parent().parent().parent()[0].children[2].innerText; var active2 = $(this).parent().parent().parent()[0].children[3].innerText; $(".bannerRightTitle").show(); $(".bannerRightTitle").html(title2); $(".bannerRightStart").val(start2); $(".bannerRightEnd").val(end2); if (active2 == "Active") { $(".bannerRightActive").attr("checked",true) }else{ $(".bannerRightActive").attr("checked",false) } $(".bannerRightButton").val("Update"); $(".bannerRightButton").attr("class","btn btn-outline-danger mt-4 bannerRightButton"); $(".bannerRightForm").attr("action","{{URL::to('/ustaad/banner/header-banner/edit-right')}}/"+id2+""); var Link2 = $(".bannerRightTitle").find('a').attr('href'); var htmlLink2 = $(".bannerRightTitle").find(".bannerContactRightHtmlLink"); if(htmlLink2.length!= 0){ var htmlLinkdata2 = $(".bannerContactRightHtmlLink").html(); htmlLinkdata2 = htmlLinkdata2.trim(); $(".bannerRightLink").val(""); $(".bannerRightHtmlLink").val(htmlLinkdata2); }else{ $(".bannerRightLink").val(Link2); $(".bannerRightHtmlLink").val(""); $("#file2").attr("id"," "); } console.log(Link2); console.log(htmlLink2); }); </script> <script> // check file error1 var _URL = window.URL || window.webkitURL; var fileError1 = 0; $("#file1").change(function (e) { console.log("asd"); var file, img; if ((file = this.files[0])) { img = new Image(); var objectUrl = _URL.createObjectURL(file); fileError1 = 0; img.onload = function () { if(this.width > this.height ){ console.log("asd1"); $(".fileError1").html(""); fileError1 = 0; }else{ console.log("asd0"); $(".fileError1").html("Your select an invalid image"); fileError1 = 1; } _URL.revokeObjectURL(objectUrl); }; img.src = objectUrl; } }); // check htmllink or imageurl in form1 $(".error1").hide(); $(".firstForm").on("submit",function(e){ var data = $(".htmlLink").val(); var len = $("#file1")[0].files.length; if (data == "" && len == 0) { e.preventDefault(); $(".error1").show(); $(".error1").html("Pealse enter Image or HTMLLink."); } if (data!= "" && len!= 0 ) { e.preventDefault(); $(".error1").show(); $(".error1").html("Pealse enter any one Image or HTMLLink."); } if (len!= 0){ if(fileError1!= 0){ e.preventDefault(); $(".error1").show(); $(".error1").html("Pealse enter valid Image or HTMLLink."); } var link = $(".fileLink").val(); if(link == ""){ e.preventDefault(); $(".error1").show(); $(".error1").html("Pealse enter Link with Image"); } } }); // check file error2 var _URL = window.URL || window.webkitURL; var fileError2 = 0; $("#file2").change(function (e) { console.log("asd"); var file, img; if ((file = this.files[0])) { img = new Image(); var objectUrl = _URL.createObjectURL(file); fileError2 = 0; img.onload = function () { if(this.width > this.height ){ console.log("asd1"); $(".fileError2").html(""); fileError2 = 0; }else{ console.log("asd0"); $(".fileError2").html("Your select an invalid image"); fileError2 = 1; } _URL.revokeObjectURL(objectUrl); }; img.src = objectUrl; } }); // check htmllink or imageurl in form1 $(".error2").hide(); $(".Form2").on("submit",function(e){ var data2 = $(".htmlLink2").val(); var len2 = $("#file2")[0].files.length; if (data2 == "" && len2 == 0) { e.preventDefault(); $(".error2").show(); $(".error2").html("Pealse enter Image or HTMLLink."); } if (data2!= "" && len2!= 0 ) { e.preventDefault(); $(".error2").show(); $(".error2").html("Pealse enter any one Image or HTMLLink."); } if (len2!= 0){ if(fileError2!= 0){ e.preventDefault(); $(".error2").show(); $(".error2").html("Pealse enter valid Image or HTMLLink."); } var link2 = $(".fileLink2").val(); if(link2 == ""){ e.preventDefault(); $(".error2").show(); $(".error2").html("Pealse enter Link with Image"); } } }); </script> ======================= File: app/Models/BlogPostAllTagsModel.php ======================= <gh_stars>0 <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class BlogPostAllTagsModel extends Model { protected $table="blog_post_all_tags"; protected $fillable = ["tagName"]; } ======================= File: resources/views/admin/signals/edit-signal.blade.php ======================= @php $value =Session::get('admin'); @endphp @include('admin.include.header') <!-- [ Main Content ] start --> <section class="pcoded-main-container"> <div class="pcoded-content"> <!-- [ breadcrumb ] start --> <div class="page-header"> <div class="page-block"> <div class="row align-items-center"> <div class="col-md-12"> <div class="page-header-title"> <h5 class="m-b-10">Forex Signals</h5> </div> <ul class="breadcrumb"> <li class="breadcrumb-item"> <a href="{{URL::to('/ustaad/dashboard')}}"><i class="fa fa-home"></i></a> </li> <li class="breadcrumb-item"><a href="{{URL::to('/ustaad/signals')}}">All Signals</a></li> <li class="breadcrumb-item"> <a href="#!">Edit Signal</a> </li> </ul> </div> </div> </div> </div> <!-- [ breadcrumb ] end --> <!-- [ Main Content ] start --> <div class="card"> <div class="card-body"> <form action="" method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-md-12"> <div class="form-group"> <!-- User Selection for signal view --> <label for="">Order Type</label> <select class="form-control" name="orderType" required> <option value="Market Execution" {{$data->orderType == "Market Execution"?'selected' : ''}}>Market Execution</option> <option value="Pending Order" {{$data->orderType == "Pending Order" ?'selected' : ''}}>Pending Order</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <!-- User Selection for signal view --> <label for="">Select User</label> <select class="form-control" name="selectUser" required=""> <option value="Register User" {{$data->selectUser == "Register User"?'selected' : ''}}>Register User</option> <option value="VIP Member" {{$data->selectUser == "VIP Member" ?'selected' : ''}}>VIP Member</option> <option value="Free User" {{$data->selectUser == "Free User"?'selected' : ''}}>Free User</option> </select> <small class="text-warning">Select for whom is this signal for? </small> </div> </div> <div class="col-md-6"> <div class="form-group"> <!-- Buy or sell Button --> <label for="">Buy Or Sell? </label> <select class="form-control" name="buySale" required=""> <option></option> <option value="Buy" {{$data->buySale == "Buy"?'selected' : ''}}> Buy</option> <option value="Sell" {{$data->buySale == "Sell"?'selected' : ''}}> Sell</option> <option value="Buy limit" {{$data->buySale == "Buy limit"?'selected' : ''}}>Buy limit</option> <option value="Sell limit" {{$data->buySale == "Sell limit"?'selected' : ''}}> Sell limit</option> <option value="Buy Stop" {{$data->buySale == "Buy Stop"?'selected' : ''}}> Buy Stop</option> <option value="Sell Stop" {{$data->buySale == "Sell Stop"?'selected' : ''}}> Sell Stop</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="">Select Category & Pair </label> <div class="d-flex justify-content-start"> <select name="fieldtwo" id="fieldtwo" class="form-control leftSelectParir"> @foreach($totalCategory as $category) @if($category->id == $SelectedPair->categoryId) @php $data2345 = $category->id; @endphp @endif <option value="{{$category->id}}" {{$category->id == $SelectedPair->categoryId?'selected' : ''}}>{{$category->category}}</option> @endforeach </select> <select name="forexPairs" id="findtwo" class="form-control js-example-tags rightSelectParir"> @foreach($totalData as $data12) @if($data2345 == $data12->categoryId) <option value="{{$data12->id}}" {{$data12->id == $data->forexPairs?'selected' : ''}}>{{$data12->pair}}</option> @endif @endforeach </select> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <!-- Enter Stop lose for Signal --> <label>Price</label> <input type="text" required="" name="price" value="{{$data->price}}" placeholder="0.23242" class="form-control"> <!-- <small>Closed</small> --> </div> </div> <div class="col-md-6"> <div class="form-group"> <!-- Enter Stop lose for Signal --> <label>Stop Lose</label> <input type="text" required="" name="stopLose" value="{{$data->stopLose}}" placeholder="0.23242" class="form-control"> <small>Closed</small> </div> </div> <div class="col-md-6"> <div class="form-group"> <!-- Enter the estimate profit --> @php $profits = explode('@',$data->takeProfit); @endphp @for($i=1; $i<=count($profits); $i++) <div class="dynamic-field" id="dynamic-field-{{$i}}"> <label>Take Profit {{$i!= 1? $i : ''}}</label> @php $ic = $i -1; @endphp <input type="text" name="takeProfit[]" value="{{$profits[$ic]}}" placeholder="0.234334" required="" class="form-control"> </div> @endfor <!-- when user click on add new please on append of id aff show a new Take profit text field we can add multiple profit --> <div class="text-right clearfix" id="aff"> <span class="float-left"><small>Sale Trade</small></span> <div class="float-right"> <div class="clearfix"> <div class="float-left"> </div> <div class="float-right"> <a type="button" class="border-0 text-success mr-2" id="add-button"><i class="fa fa-plus"></i></a> <a type="button" class="border-0 text-danger" id="remove-button"><i class="fa fa-minus"></i></a> </div> </div> </div> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="">Select Date</label> <input type="date" class="form-control" name="date" value="{{$data->date}}"> <small class="text-info">Select how long this signal will be valid</small> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="">Select time</label> <input type="time" class="form-control" name="time" value="{{$data->time}}"> <small class="text-danger">Select how long this signal will be valid (formate : 5:00 PM)</small> </div> </div> <!-- this field is not required --> <div class="col-md-6"> <div class="form-group"> <label>Result</label> <select name="result" class="form-control"> <option value="">None</option> <option value="Manually Closed" {{$data->result == "Manually Closed"?'selected' : ''}}>Manually Closed</option> @for($i=1; $i<=count($profits); $i++) @if($i == 1 && $data->result == "TP Hit") <option value="{{$i}} TP Hit" selected>{{$i}} TP Hit</option> @else <option value="{{$i}} TP Hit" {{$data->result == "$i TP Hit"?'selected' : ''}}>{{$i}} TP Hit</option> @endif @endfor <option value="SL Hit" {{$data->result =="SL Hit" ?'selected' : ''}}>SL Hit</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>PIPs</label> <input type="text" class="form-control" name="pips" value="{{$data->pips}}"> </div> </div> <div class="col-md-8"> <div class="form-group"> <label>Enter your Comments about Signal</label> <textarea class="form-control" name="comments" rows="5">{{$data->comments}}</textarea> </div> </div> </div> <div class="col-md-12"> <div class="form-group"> <label>Enter Image and Article</label> <textarea class="form-control" name="editor1"> @php $detailDescription = html_entity_decode($data->detailDescription); echo $detailDescription; @endphp </textarea> </div> </div> <div class="form-group"> <label>Expired</label> <input type="checkbox" name="expired" id="expired" value="1" {{$data->expired == 1? 'checked' : ''}}> @if($value['memberId']!= 7 && $data->pending == 1) <label class="ml-3">Allow</label> <input type="checkbox" name="pending" id="pending" value="0"> @endif </div> <p class="submit text-right"> <input type="submit" name="submit" id="submit" class="btn btn-outline-primary" value="Update"> <span class="spinner"></span> <input type="reset" name="reset" id="reset" class="btn btn-outline-danger" value="reset"> <span class="spinner"></span> </p> </form> </div> </div> <!-- [ Main Content ] end --> </div> </section> <!-- [ Main Content ] end --> <style> .leftSelectParir{ border-radius:5px 0px 0px 5px; } .rightSelectParir{ border-radius:0px 5px 5px 0px; } </style> @include('admin.include.footer') <script> // description Limit var count = $(".description").val(); var len = count.length; len = 990 - len; $(".descriptionCount").html("remaining: " + len); $(".description").on("keyup",function(){ var count = $(".description").val(); var len = count.length; if(len == 0){ $(".descriptionCount").hide(); }else{ $(".descriptionCount").show(); } len = 990 - len; $(".descriptionCount").html("remaining: " + len); }); // title Limit var count = $(".titleCountFlied").val(); var len = count.length; len = 580 - len; $(".titleCount").html("remaining: " + len); $(".titleCountFlied").on("keyup",function(){ var count = $(".titleCountFlied").val(); var len = count.length; if(len == 0){ $(".titleCount").hide(); }else{ $(".titleCount").show(); } len = 580 - len; $(".titleCount").html("remaining: " + len); }); </script> <script type='text/javascript'> <?php $php_array1 = $totalCategory; $js_array1 = json_encode($php_array1); echo "var javascript_array1 = ". $js_array1. ";\n"; $php_array2 = $totalData; $js_array2 = json_encode($php_array2); echo "var javascript_array2 = ". $js_array2. ";\n"; ?> $("#fieldtwo").on('change',function(){ var selectedOption = $("#fieldtwo").val(); $("#findtwo").html(""); for (let i = 0; i < javascript_array2.length; i++){ if (javascript_array2[i].categoryId == selectedOption) { $("#findtwo").prepend("<option value='"+javascript_array2[i].id+"'>"+javascript_array2[i].pair+"</option>"); } } }) </script> <script> $(".js-example-tags").select2({ tags: true }); $(document).ready(function() { var buttonAdd = $("#add-button"); var buttonRemove = $("#remove-button"); var className = ".dynamic-field"; var count = 0; var field = ""; var maxFields = 5; function totalFields() { return $(className).length; } function addNewField() { count = totalFields() + 1; field = $("#dynamic-field-1").clone(); field.attr("id", "dynamic-field-" + count); field.children("label").text("Take Profit " + count); field.find("input").val(""); $(className + ":last").after($(field)); } function removeLastField() { if (totalFields() > 1) { $(className + ":last").remove(); } } function enableButtonRemove() { if (totalFields() === 2) { buttonRemove.removeAttr("disabled"); buttonRemove.addClass("text-danger"); } } function disableButtonRemove() { if (totalFields() === 1) { buttonRemove.attr("disabled", "disabled"); buttonRemove.removeClass("text-light"); } } function disableButtonAdd() { if (totalFields() === maxFields) { buttonAdd.attr("disabled", "disabled"); buttonAdd.removeClass("text-light"); } } function enableButtonAdd() { if (totalFields() === (maxFields - 1)) { buttonAdd.removeAttr("disabled"); buttonAdd.addClass("text-success"); } } buttonAdd.click(function() { addNewField(); enableButtonRemove(); disableButtonAdd(); }); buttonRemove.click(function() { removeLastField(); disableButtonRemove(); enableButtonAdd(); }); }); </script> ======================= File: app/Http/Controllers/FooterController.php ======================= <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\FooterDescriptionModel; use App\Models\FooterContactModel; use App\Models\FooterWebinarModel; use App\Models\FooterCopyRightModel; use App\Models\OtherPagesContentModel; class FooterController extends Controller { public function Index(Request $request){ $otherPagesContent = OtherPagesContentModel::all(); $Description = FooterDescriptionModel::all(); $Contact = FooterContactModel::all(); $Webinar = FooterWebinarModel::all(); $copyRight = FooterCopyRightModel::where('id',1)->first(); return view('admin.edit-footer',compact('Description','Contact','Webinar','copyRight','otherPagesContent')); } public function Webinar(Request $request){ for ($i=1; $i <=5 ; $i++) { $webinar = "webinar". $i; $newWebinar = FooterWebinarModel::where('id',$i)->first(); $newWebinar->webinar = $request->$webinar; $newWebinar->area = $request->area; $newWebinar->save(); } $success = "This information has been updated successfully."; $request->session()->put("success",$success); return back(); } public function Contact(Request $request){ for ($i=1; $i <=4 ; $i++) { $contact = "contact". $i; $newContact = FooterContactModel::where('id',$i)->first(); $newContact->contact = $request->$contact; $newContact->area = $request->area; $newContact->save(); } $success = "This information has been updated successfully."; $request->session()->put("success",$success); return back(); } public function Description(Request $request){ for ($i=1; $i <=1 ; $i++) { $description = htmlentities($request->editor1); $newDescription = FooterDescriptionModel::where('id',$i)->first(); $newDescription->description = $description; $newDescription->area = $request->area; $newDescription->save(); } $success = "This information has been updated successfully."; $request->session()->put("success",$success); return back(); } public function CopyRight(Request $request){ $copyRight = FooterCopyRightModel::where('id',1)->first(); if ($request->editor3!= null){ $description = htmlentities($request->editor3); $copyRight->description = $description; } if ($request->editor2!= null){ $description2 = htmlentities($request->editor2); $copyRight->description2 = $description2; } $copyRight->save(); $success = "This information has been updated successfully."; $request->session()->put("success",$success); return back(); } } ======================= File: app/Models/FundamentalModel.php ======================= <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use App\Models\AdminModel; class FundamentalModel extends Model { protected $table = "fundamental"; protected $fillable = ["title","image","detailDescription","status","userId","position","embed"]; public function GetAdminMember(){ $member = AdminModel::where('id',$this->userId)->first(); return $member; } } ======================= File: app/Http/Controllers/BlogPostController.php ======================= <gh_stars>0 <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\BlogPostModel; use App\Models\BlogPostVisibilityModel; use App\Models\BlogPostTagsModel; use App\Models\BlogPostAllTagsModel; use App\Models\BlogPostMainCategoryModel; use App\Models\BlogPostSubCategoryModel; use App\Models\BlogPostAllMainCategoryModel; use App\Models\BlogPostAllSubCategoryModel; use App\Models\ClientMemberModel; use App\Models\ClientNotificationModel; use App\Models\PusherModel; use App\Models\MetaTagsModel; use App\Models\MetaKeywordsModel; class BlogPostController extends Controller { public function New(Request $request, $id){ $newMeta = null; $allTags = BlogPostAllTagsModel::all(); $allMainCategory = BlogPostAllMainCategoryModel::all(); $allSubCategory = BlogPostAllSubCategoryModel::all(); $ClientMember = ClientMemberModel::all(); return view('admin.add-post',compact('id','allTags','allSubCategory','allMainCategory','ClientMember','newMeta')); } public function Add(Request $request){ $data = $request->all(); // Add New Main Category if($data["newMainCategory"]!= "null"){ $newMainCategory = $data["newMainCategory"]; $newMainCategory = explode("@",$newMainCategory); for ($i=1; $i < count($newMainCategory) ; $i++) { $CategoryExist = BlogPostAllMainCategoryModel::where('categoryName',$newMainCategory[$i])->first(); if ($CategoryExist == null ) { $blogPostNewMainCategory = new BlogPostAllMainCategoryModel; $blogPostNewMainCategory->categoryName = $newMainCategory[$i]; $blogPostNewMainCategory->save(); // meta Tags save start $newMeta = new MetaTagsModel; $newMeta->name_page = "blogCategory@". $blogPostNewMainCategory->categoryName; $newMeta->main = 1; $newMeta->save(); // meta Tags save end } } } // Add New Sub Category if($data["newSubCategory"]!= "null"){ $newSubCategory = $data["newSubCategory"]; $newSubCategory = explode(",",$newSubCategory); for ($i=1; $i < count($newSubCategory) ; $i++) { $newSubParentCategory = explode("@",$newSubCategory[$i]); $SubCategoryExist = BlogPostAllSubCategoryModel::where('categoryName',$newSubParentCategory[0])->where('parentCategory',$newSubParentCategory[1])->first(); if ($SubCategoryExist == null ) { $blogPostNewSubCategory = new BlogPostAllSubCategoryModel; $blogPostNewSubCategory->categoryName = $newSubParentCategory[0]; $blogPostNewSubCategory->parentCategory = $newSubParentCategory[1]; $blogPostNewSubCategory->save(); } } } // Publish if ($request->publishNow == 1) { $data["publishDate"] = date("Y-m-d"); $data["publishTime"] = date("H:i:s"); } // Permalink $permalink = $request->permalink; $permalink = explode("/",$permalink); $data['permalink'] = end($permalink); // Img if ($request->file("img")!= null) { $path = $request->file("img")->store("PostImages"); $blogPostImage = $path; $data['image'] = $blogPostImage; } // ckeditor Description $detailDescription = htmlentities($request->editor1); $data['detailDescription'] = $detailDescription; // add Post data $blogPost = new BlogPostModel; $blogPost->fill($data); $blogPost->save(); // meta Tags save start for ($i=0; $i < count($request->metaKeywords); $i++) { $find = MetaKeywordsModel::where('name',$request->metaKeywords[$i])->first(); if($find == null){ $key = new MetaKeywordsModel; $key->name = $request->metaKeywords[$i]; $key->save(); } } $newMeta = new MetaTagsModel; $newMeta->name_page = "blogPost@". $blogPost->id; $newMeta->description = $blogPost->description; $newMeta->title = $blogPost->mainTitle; $newMeta->image = $blogPost->image; $newMeta->keywordsimp = implode(",",$request->metaKeywords); $newMeta->save(); // meta Tags save end $postId = $blogPost->id; // Add Post Visibility $visibility = $request->visibility; for ($i=0; $i < count($visibility) ; $i++) { $blogPostVisibility = new BlogPostVisibilityModel; $blogPostVisibility->visibility = $visibility[$i]; $blogPostVisibility->postId = $postId; $blogPostVisibility->save(); } // Add Post Tags $tag = $request->tag; for ($i=0; $i < sizeof($tag) ; $i++) { $blogPostTag = new BlogPostTagsModel; $blogPostTag->tag = $tag[$i]; $blogPostTag->postId = $postId; $blogPostTag->save(); $allTag = BlogPostAllTagsModel::where('tagName',$tag[$i])->first(); if($allTag == null){ $newTag = new BlogPostAllTagsModel; $newTag->tagName = $tag[$i]; $newTag->save(); } } // Add Post Main Category $mainCategory = $request->category; if($mainCategory!= null){ for ($i=0; $i < count($mainCategory) ; $i++) { $blogPostmainCategory = new BlogPostMainCategoryModel; $blogPostmainCategory->mainCategory = $mainCategory[$i]; $blogPostmainCategory->postId = $postId; $blogPostmainCategory->save(); } } // Add Post Sub Category $subCategory = $request->subCategory; if($subCategory!= null){ for ($i=0; $i < count($subCategory) ; $i++) { $blogPostsubCategory = new BlogPostSubCategoryModel; $blogPostsubCategory->subCategory = $subCategory[$i]; $blogPostsubCategory->postId = $postId; $blogPostsubCategory->save(); } } $success = "This post has been saved successfully."; $request->session()->put("success",$success); if ($blogPost->pending == 0) { // Pusher Notification Start $url = $blogPost->permalink; $category = BlogPostMainCategoryModel::where('postId',$blogPost->id)->first(); $adminData = $request->session()->get("admin"); $messageData['userId'] = $adminData['id']; $messageData['userType'] = 0; $messageData['message'] = "Added a New Blog."; $messageData['link'] = "Post". "/". $url ; $clientNotification = new ClientNotificationModel; $clientNotification->fill($messageData); $clientNotification->save(); $messageData['id'] = $clientNotification->id; PusherModel::BoardCast("firstChannel1","firstEvent1",["message" => $messageData]); // Pusher Notification End } return back(); } public function Edit(Request $request, $id){ $allTags = BlogPostAllTagsModel::all(); $name_page = "blogPost@". $id; $newMeta = MetaTagsModel::where('name_page',$name_page)->first(); $allMainCategory = BlogPostAllMainCategoryModel::all(); $allSubCategory = BlogPostAllSubCategoryModel::all(); $ClientMember = ClientMemberModel::all(); $blogPostData = BlogPostModel::where('id',$id)->first(); $visibilityPostData = BlogPostVisibilityModel::where('postId',$id)->get(); $tagsPostData = BlogPostTagsModel::where('postId',$id)->get(); $mainCategoryPostData = BlogPostMainCategoryModel::where('postId',$id)->get(); $subCategoryPostData = BlogPostSubCategoryModel::where('postId',$id)->get(); return view('admin.edit-post',compact('id','allTags','allSubCategory','allMainCategory','blogPostData','visibilityPostData','tagsPostData','mainCategoryPostData','subCategoryPostData','ClientMember','id','newMeta')); } public function EditProcess(Request $request, $id){ $data = $request->all(); // Add New Main Category if($data["newMainCategory"]!= "null"){ $newMainCategory = $data["newMainCategory"]; $newMainCategory = explode("@",$newMainCategory); for ($i=1; $i < count($newMainCategory) ; $i++) { $CategoryExist = BlogPostAllMainCategoryModel::where('categoryName',$newMainCategory[$i])->first(); if ($CategoryExist == null ) { $blogPostNewMainCategory = new BlogPostAllMainCategoryModel; $blogPostNewMainCategory->categoryName = $newMainCategory[$i]; $blogPostNewMainCategory->save(); // meta Tags save start $newMeta = new MetaTagsModel; $newMeta->name_page = "blogCategory@". $blogPostNewMainCategory->categoryName; $newMeta->main = 1; $newMeta->save(); // meta Tags save end } } } // Add New Sub Category if($data["newSubCategory"]!= "null"){ $newSubCategory = $data["newSubCategory"]; $newSubCategory = explode(",",$newSubCategory); for ($i=1; $i < count($newSubCategory) ; $i++) { $newSubParentCategory = explode("@",$newSubCategory[$i]); $SubCategoryExist = BlogPostAllSubCategoryModel::where('categoryName',$newSubParentCategory[0])->where('parentCategory',$newSubParentCategory[1])->first(); if ($SubCategoryExist == null ) { $blogPostNewSubCategory = new BlogPostAllSubCategoryModel; $blogPostNewSubCategory->categoryName = $newSubParentCategory[0]; $blogPostNewSubCategory->parentCategory = $newSubParentCategory[1]; $blogPostNewSubCategory->save(); } } } // Publish if ($request->publishNow == 1) { $data["publishDate"] = date("Y-m-d"); $data["publishTime"] = date("H:i:s"); }else{ $data["publishNow"] = 0; } // Permalink $permalink = $request->permalink; $permalink = explode("/",$permalink); $data['permalink'] = end($permalink); // Img if ($request->file("img")!= null) { $path = $request->file("img")->store("PostImages"); $blogPostImage = $path; $data['image'] = $blogPostImage; } // stickToTop if ($request->stickToTop == null) { $data['stickToTop'] = 0; } // pending if ($request->pending == null) { $data['pending'] = 1; } // comment if ($request->comment == null) { $data['comment'] = 0; } // ckeditor Description $detailDescription = htmlentities($request->editor1); $data['detailDescription'] = $detailDescription; // add Post data $blogPost = BlogPostModel::where('id',$id)->first(); $blogPost->fill($data); $blogPost->save(); // meta Tags save start for ($i=0; $i < count($request->metaKeywords); $i++) { $find = MetaKeywordsModel::where('name',$request->metaKeywords[$i])->first(); if($find == null){ $key = new MetaKeywordsModel; $key->name = $request->metaKeywords[$i]; $key->save(); } } $name_page = "blogPost@". $id; $newMeta = MetaTagsModel::where('name_page',$name_page)->first(); if($newMeta == null){ $newMeta = new MetaTagsModel; } $newMeta->name_page = "blogPost@". $id; $newMeta->description = $blogPost->description; $newMeta->title = $blogPost->mainTitle; $newMeta->image = $blogPost->image; $newMeta->keywordsimp = implode(",",$request->metaKeywords); $newMeta->save(); // meta Tags save end $postId = $blogPost->id; // Delete Previous Visibility $blogPostPreviousVisibility = BlogPostVisibilityModel::where('postId',$postId)->get(); for ($i=0; $i < count($blogPostPreviousVisibility) ; $i++) { $blogPostPreviousVisibility[$i]->delete(); } // Add Post Visibility $visibility = $request->visibility; for ($i=0; $i < count($visibility) ; $i++) { $blogPostVisibility = new BlogPostVisibilityModel; $blogPostVisibility->visibility = $visibility[$i]; $blogPostVisibility->postId = $postId; $blogPostVisibility->save(); } // Delete Previous Tag $blogPostPreviousTag = BlogPostTagsModel::where('postId',$postId)->get(); for ($i=0; $i < count($blogPostPreviousTag) ; $i++) { $blogPostPreviousTag[$i]->delete(); } // Add Post Tags $tag = $request->tag; for ($i=0; $i < sizeof($tag) ; $i++) { $blogPostTag = new BlogPostTagsModel; $blogPostTag->tag = $tag[$i]; $blogPostTag->postId = $postId; $blogPostTag->save(); $allTag = BlogPostAllTagsModel::where('tagName',$tag[$i])->first(); if($allTag == null){ $newTag = new BlogPostAllTagsModel; $newTag->tagName = $tag[$i]; $newTag->save(); } } // Delete Previous Main Category $blogPostPreviousMainCategory = BlogPostMainCategoryModel::where('postId',$postId)->get(); for ($i=0; $i < count($blogPostPreviousMainCategory) ; $i++) { $blogPostPreviousMainCategory[$i]->delete(); } // Add Post Main Category $mainCategory = $request->category; if($mainCategory!= null){ for ($i=0; $i < count($mainCategory) ; $i++) { $blogPostmainCategory = new BlogPostMainCategoryModel; $blogPostmainCategory->mainCategory = $mainCategory[$i]; $blogPostmainCategory->postId = $postId; $blogPostmainCategory->save(); } } // Delete Previous Sub Category $blogPostPreviousSubCategory = BlogPostSubCategoryModel::where('postId',$postId)->get(); for ($i=0; $i < count($blogPostPreviousSubCategory) ; $i++) { $blogPostPreviousSubCategory[$i]->delete(); } // Add Post Sub Category $subCategory = $request->subCategory; if($subCategory!= null){ for ($i=0; $i < count($subCategory) ; $i++) { $blogPostsubCategory = new BlogPostSubCategoryModel; $blogPostsubCategory->subCategory = $subCategory[$i]; $blogPostsubCategory->postId = $postId; $blogPostsubCategory->save(); } } $success = "This post has been updated successfully."; $request->session()->put("success",$success); // Pusher Notification Start $url = $blogPost->permalink; $category = BlogPostMainCategoryModel::where('postId',$blogPost->id)->first(); $adminData = $request->session()->get("admin"); $messageData['userId'] = $adminData['id']; $messageData['userType'] = 0; $messageData['message'] = "Edit a Blog."; $messageData['link'] = "Posts". "/". $category->mainCategory. "/". $url ; $clientNotification = new ClientNotificationModel; $clientNotification->fill($messageData); $clientNotification->save(); $messageData['id'] = $clientNotification->id; PusherModel::BoardCast("firstChannel1","firstEvent1",["message" => $messageData]); // Pusher Notification End return back(); } } ======================= File: resources/views/admin/add-tag.blade.php ======================= @include('admin.include.header') <!-- [ Main Content ] start --> <section class="pcoded-main-container"> <div class="pcoded-content"> <!-- [ breadcrumb ] start --> <div class="page-header"> <div class="page-block"> <div class="row align-items-center"> <div class="col-md-12"> <div class="page-header-title"> <h5 class="m-b-10">Tags</h5> </div> <ul class="breadcrumb"> <li class="breadcrumb-item"> <a href="{{URL::to('/ustaad/dashboard')}}"><i class="fa fa-home"></i></a> </li> <li class="breadcrumb-item"><a href="#!">Posts</a></li> <li class="breadcrumb-item"> <a href="#!">Tags</a> </li> </ul> </div> </div> </div> </div> <!-- [ breadcrumb ] end --> <!-- [ Main Content ] start --> <div class="row"> <div class="col-sm-12 col-xl-4 col-md-12 "> <div class="form-wrap"> <h5 class="text-dark pb-2">Add New Tag</h5> <form id="addtag" method="post" action="" class=""> <div class="form-group"> <label for="tag-name" class="form-control-label">Name</label> <input name="name" class="form-control " id="tag-name" type="text" value="" size="40" aria-required="true" required> <small>The name is how it appears on your site.</small> </div> <div class="form-group"> <label for="tag-slug" class="form-control-label">Slug</label> <input name="slug" id="tag-slug" type="text" class="form-control" value="" size="40" required> <small>The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.</small> </div> <div class="form-group"> <label for="tag-description" class="form-control-label">Description</label> <textarea name="description" class="form-control" id="tag-description" rows="5" cols="40" required></textarea> <small>The description is not prominent by default; however, some themes may show it.</small> </div> <p class="submit"> <input type="submit" name="submit" id="submit" class="btn btn-outline-primary" value="Add New Tag"> <span class="spinner"></span> </p> </form> </div> </div> <div class="col-xl-8 col-md-12 col-sm-12"> <div class="card"> <div class="card-body"> <form id="posts-filter" method="get"> <div class="row"> <div class="col-6"> <div class="alignleft pt-2 actions bulkactions"> <select name="action" class="form-control w-75 d-inline-block" id="bulk-action-selector-top"> <option value="-1">Bulk Actions</option> <option value="trash">Delete</option> </select> <input type="submit" id="doaction" class="btn btn-outline-primary" value="Apply"> </div> </div> <div class="col-6"> <div class=" clearfix pt-2"> <div class="float-right"> <p class="search-box form-group d-flex"> <input type="search" id="post-search-input" name="s" class=" mr-2 form-control" value="" placeholder="Search..."> <input type="submit" id="search-submit" class="btn btn-outline-primary" value="Search Posts"> </p> </div> </div> </div> </div> <br class="clear"> <div class=" p-3"> <table class="table"> <thead class="bg-primary text-white"> <tr> <th class="w-25">Name</th> <th>Description</th> <th>Slug</th> <th>Count</th> <th>Action</th> </tr> </thead> <tbody class="border border-primary"> @foreach($totalData as $data) <tr> <td class="w-25">{{$data->name}}</td> <td>{{$data->description}}</td> <td><small>{{$data->slug}}</small></td> <td>3</td> <td> <a href="#"> <i class="far fa-edit text-success mr-2"></i> </a> <a href="{{URL::to('/ustaad/tag/delete')}}/{{$data->id}}"> <i class="fa fa-times text-danger"></i> </a> </td> </tr> @endforeach </tbody> </table> </div> </form> </div> </div> </div> </div> <!-- [ Main Content ] end --> </div> </section> <!-- [ Main Content ] end --> @include('admin.include.footer') ======================= File: app/Models/MainMenuModel.php ======================= <reponame>Technow-Pakistan/Forexustaad-v5 <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use App\Models\SubMenuModel; class MainMenuModel extends Model { protected $table = "mainmenu"; protected $fillable = ["menu","link",'trash','upper']; public function GetSubMenu(){ $get = SubMenuModel::where('mainmenuId',$this->id)->where('trash',0)->get(); return $get; } } ======================= File: app/Http/Controllers/ApiRightController.php ======================= <filename>app/Http/Controllers/ApiRightController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\ApiRightModel; use App\Models\TrashModel; class ApiRightController extends Controller { public function Index(Request $request){ $totalData = ApiRightModel::orderBy('id','desc')->where('trash',0)->get(); return view('admin.api-right-side-bar',compact("totalData")); } public function Add(Request $request){ $api = new ApiRightModel; $api->fill($request->all()); $api->save(); $success = "This api has been added successfully."; $request->session()->put("success",$success); return back(); } public function delete(Request $request, $id){ $Trash = TrashModel::where('deleteId',$id)->where('category',"Api Right")->first(); $Trash->delete(); $data = ApiRightModel::find($id); $data->delete(); $error = "This api has been delete successfully."; $request->session()->put("error",$error); return back(); } public function EditProcess(Request $request, $id){ $data = ApiRightModel::find($id); $data->fill($request->all()); $data->save(); $success = "This api has been updated successfully."; $request->session()->put("success",$success); return back(); } public function Trash(Request $request, $id){ $user = $request->session()->get("admin"); $data = ApiRightModel::find($id); $data->trash = 1; $data->save(); $Trash = new TrashModel; $Trash->adminTableId = $user->id; $Trash->trashItem = "api/api-right"; $Trash->category = "Api Right"; $Trash->deleteId = $id; $Trash->deleteTitle = $data->title; $Trash->save(); $error = "This api has been delete successfully."; $request->session()->put("error",$error); return back(); } public function TrashRestore(Request $request, $id){ $data = ApiRightModel::find($id); $data->trash = 0; $data->save(); $Trash = TrashModel::where('deleteId',$id)->where('category',"Api Right")->first(); $Trash->delete(); $success = "This api has been restore successfully."; $request->session()->put("success",$success); return back(); } } ======================= File: resources/views/admin/emailInbox.blade.php ======================= @include('admin.include.header') <!-- [ Main Content ] start --> <section class="pcoded-main-container"> <div class="pcoded-content"> <!-- [ breadcrumb ] start --> <div class="page-header"> <div class="page-block"> <div class="row align-items-center"> <div class="col-md-12"> <div class="page-header-title"> <h5 class="m-b-10">Inbox</h5> </div> <ul class="breadcrumb"> <li class="breadcrumb-item"><a href="{{URL::to('/ustaad/dashboard')}}"><i class="fa fa-home"></i></a></li> <li class="breadcrumb-item"><a href="#!">Contact</a></li> <li class="breadcrumb-item"><a href="#!">Inbox</a></li> </ul> </div> </div> </div> </div> <!-- [ breadcrumb ] end --> <!-- [ Main Content ] start --> <form action="" class="InboxSentForm" method="post"> <div class="row"> <div class="col-sm-12"> <div class="card email-card"> <div class="card-header"> <div class="mail-header"> <div class="row align-items-center"> <!-- [ inbox-left section ] start --> <div class="col-xl-2 col-md-3"> <a href="{{URL::to('/ustaad/dashboard')}}" class="b-brand"> <div class="b-bg"> F </div> <span class="b-title text-muted">Forexustaad</span> </a> </div> <!-- [ inbox-left section ] end --> <!-- [ inbox-right section ] start --> <div class="col-xl-10 col-md-9"> <div class="input-group mb-0"> <div class="input-group-prepend"> <label class="input-group-text" for="inputGroupSelect01"><i class="fa fa-search"></i></label> </div> <select class="custom-select" id="inputGroupSelect01"> <option selected>Search...</option> <option value="1">One</option> <option value="2">Two</option> <option value="3">Three</option> </select> </div> </div> <!-- [ inbox-right section ] end --> </div> </div> </div> <div class="card-body"> <div class="mail-body"> <div class="row"> <!-- [ inbox-left section ] start --> <div class="col-xl-2 col-md-3"> <div class="mb-3"> <a href="{{URL::to('/ustaad/contact/emailCompose')}}" class="btn waves-effect waves-light btn-rounded btn-outline-primary">+ Compose</a> </div> <ul class="mb-2 nav nav-tab flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical"> <li class="nav-item mail-section inboxData"> <a class="nav-link text-left active" id="v-pills-home-tab" data-toggle="pill" href="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="false"> <span><i class="fa fa-envelope"></i>Inbox</span> <span class="float-right">{{$totalInboxNumber}}</span> </a> </li> <li class="nav-item mail-section inboxData"> <a class="nav-link text-left" id="v-pills-starred-tab" data-toggle="pill" href="#v-pills-starred" role="tab"> <span><i class="fa fa-star"></i> Starred</span> </a> </li> <li class="nav-item mail-section inboxData"> <a class="nav-link text-left" id="v-pills-settings-tab" data-toggle="pill" href="#v-pills-mail" role="tab"> <span><i class="fa fa-paper-plane"></i> Sent Mail</span> </a> </li> <li class="nav-item mail-section inboxData"> <a class="nav-link text-left" id="v-pills-messages-tab" data-toggle="pill" href="#v-pills-draft" role="tab"> <span><i class="fa fa-file-alt"></i> Drafts</span> </a> </li> <li class="nav-item mail-section inboxData UnTrashData"> <a class="nav-link text-left" id="v-pills-Trash-tab" data-toggle="pill" href="#v-pills-Trash" role="tab"> <span><i class="fa fa-trash"></i> Trash</span> </a> </li> </ul> </div> <!-- [ inbox-left section ] end --> <!-- [ inbox-right section ] start --> <div class="col-xl-10 col-md-9 inbox-right"> <div class="email-btn"> <button type="submit" class="btn waves-effect waves-light btn-icon btn-rounded btn-outline-secondary mb-2 "><i class="fa fa-trash"></i></button> <button type="submit" class="btn waves-effect waves-light btn-icon btn-rounded btn-outline-secondary mb-2" id="UnTrashData"><i class="fa fa-trash-restore"></i></button> </div> <div class="tab-content p-0" id="v-pills-tabContent"> <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab"> <div class="tab-content" id="pills-tabContent"> <div class="tab-pane fade show active" id="pills-primary" role="tabpanel" aria-labelledby="pills-primary-tab"> <div class="mail-body-content table-responsive"> <table class="table"> <tbody> @php $countCheck = 0; @endphp @foreach($totalData as $data) @if($data->trashMail == 0) <tr class="{{$data->read == 1?'read' : 'unread'}}" link="{{$data->read == 1? '' : $data->id}}"> <td> <div class="check-star"> <div class="form-group d-inline"> <div class="checkbox checkbox-primary checkbox-fill d-inline"> <input type="checkbox" name="inbox[]" id="checkbox-s-infill-{{$countCheck}}" value="{{$data->id}}"> <label for="checkbox-s-infill-{{$countCheck}}" class="cr"></label> </div> </div> <a href="{{URL::to('/ustaad/contact/starMessage')}}/{{$data->id}}"><i class="{{$data->star == 1? 'fa fa-star text-c-yellow' : 'far fa-star'}} ml-2"></i></a> </div> </td> <td><a href="{{URL::to('ustaad/contact/emailRead')}}/{{$data->id}}">{{$data->email}}</a></td> <td><a href="{{URL::to('ustaad/contact/emailRead')}}/{{$data->id}}">{{$data->name}}</a></td> <td><a href="{{URL::to('ustaad/contact/emailRead')}}/{{$data->id}}">{{$data->created_at->format("dM,Y h:i a")}}</a></td> </tr> @php $countCheck++ @endphp @endif @endforeach </tbody> </table> </div> </div> </div> </div> <div class="tab-pane fade" id="v-pills-starred" role="tabpanel"> <p class="mb-0"> <div class="tab-pane fade show active" id="pills-starred" role="tabpanel"> <div class="mail-body-content table-responsive"> <table class="table"> <tbody> @foreach($totalData as $data) @if($data->star == 1 && $data->trashMail == 0) <tr class="{{$data->read == 1?'read' : 'unread'}}"> <td> <div class="check-star"> <div class="form-group d-inline"> <div class="checkbox checkbox-primary checkbox-fill d-inline"> <input type="checkbox" name="inbox[]" id="checkbox-s-infill-{{$countCheck}}" value="{{$data->id}}"> <label for="checkbox-s-infill-{{$countCheck}}" class="cr"></label> </div> </div> <a href="{{URL::to('/ustaad/contact/starMessage')}}/{{$data->id}}"><i class="fa fa-star text-c-yellow ml-2"></i></a> </div> </td> <td><a href="{{URL::to('ustaad/contact/emailRead')}}/{{$data->id}}">{{$data->email}}</a></td> <td><a href="{{URL::to('ustaad/contact/emailRead')}}/{{$data->id}}">{{$data->name}}</a></td> <td><a href="{{URL::to('ustaad/contact/emailRead')}}/{{$data->id}}">{{$data->created_at->format("dM,Y h:i a")}}</a></td> </tr> @php $countCheck++ @endphp @endif @endforeach </tbody> </table> </div> </div> </div> <div class="tab-pane fade" id="v-pills-mail" role="tabpanel"> <div class="mail-body-content table-responsive"> <table class="table"> <tbody> @foreach($totalCompose as $data) @if($data->draft == 0 && $data->trashMail == 0) <tr class="read"> <td> <div class="check-star"> <div class="form-group d-inline"> <div class="checkbox checkbox-primary checkbox-fill d-inline"> <input type="checkbox" name="sent[]" id="checkbox-s-infill-{{$countCheck}}" value="{{$data->id}}"> <label for="checkbox-s-infill-{{$countCheck}}" class="cr"></label> <a href="{{URL::to('ustaad/contact/sendEmailRead')}}/{{$data->id}}">{{$data->emailTo}}</a></td> </div> </div> </div> <td><a href="{{URL::to('ustaad/contact/sendEmailRead')}}/{{$data->id}}">{{$data->subject}}</a></td> <td><a href="{{URL::to('ustaad/contact/sendEmailRead')}}/{{$data->id}}">{{$data->created_at->format("dM,Y h:i a")}}</a></td> </tr> @php $countCheck++ @endphp @endif @endforeach </tbody> </table> </div> </div> <div class="tab-pane fade" id="v-pills-draft" role="tabpanel"> <div class="mail-body-content table-responsive"> <table class="table"> <tbody> @foreach($totalCompose as $data) @if($data->draft == 1 && $data->trashMail == 0) <tr class="read"> <td> <div class="check-star"> <div class="form-group d-inline"> <div class="checkbox checkbox-primary checkbox-fill d-inline"> <input type="checkbox" name="sent[]" id="checkbox-s-infill-{{$countCheck}}" value="{{$data->id}}"> <label for="checkbox-s-infill-{{$countCheck}}" class="cr"></label> <a href="{{URL::to('/ustaad/contact/draftEmailRead')}}/{{$data->id}}" class="email-name waves-effect">{{$data->emailTo}}</a> </div> </div> </div> </td> <td> <a href="{{URL::to('/ustaad/contact/draftEmailRead')}}/{{$data->id}}" class="email-name waves-effect">{{$data->message}}</a> </td> <td class="email-time">{{$data->created_at->format("dM,Y h:i a")}}</td> </tr> @php $countCheck++ @endphp @endif @endforeach </tbody> </table> </div> </div> <div class="tab-pane fade" id="v-pills-Trash" role="tabpanel"> <div class="mail-body-content table-responsive"> <table class="table"> <tbody> @foreach($totalCompose as $data) @if($data->trashMail == 1) <tr class="read"> <td> <div class="check-star"> <div class="form-group d-inline"> <div class="checkbox checkbox-primary checkbox-fill d-inline"> <input type="checkbox" name="sentTrash[]" id="checkbox-s-infill-{{$countCheck}}" value="{{$data->id}}"> <label for="checkbox-s-infill-{{$countCheck}}" class="cr"></label> <a href="{{URL::to('ustaad/contact')}}/{{$data->draft == 1? 'draftEmailRead' :'sendEmailRead'}}/{{$data->id}}">{{$data->emailTo}}</a> </div> </div> </div> </td> <td><a href="{{URL::to('ustaad/contact')}}/{{$data->draft == 1? 'draftEmailRead' :'sendEmailRead'}}/{{$data->id}}">{{$data->subject}}</a></td> <td><a href="{{URL::to('ustaad/contact')}}/{{$data->draft == 1? 'draftEmailRead' :'sendEmailRead'}}/{{$data->id}}">{{$data->created_at->format("dM,Y h:i a")}}</a></td> </tr> @php $countCheck++ @endphp @endif @endforeach @foreach($totalData as $data) @if($data->trashMail == 1) <tr class="{{$data->read == 1?'read' : 'unread'}}"> <td> <div class="check-star"> <div class="form-group d-inline"> <div class="checkbox checkbox-primary checkbox-fill d-inline"> <input type="checkbox" name="inboxTrash[]" id="checkbox-s-infill-{{$countCheck}}" value="{{$data->id}}"> <label for="checkbox-s-infill-{{$countCheck}}" class="cr"></label> <a href="{{URL::to('ustaad/contact/emailRead')}}/{{$data->id}}">{{$data->email}}</a> </div> </div> </div> </td> <td><a href="{{URL::to('ustaad/contact/emailRead')}}/{{$data->id}}">{{$data->name}}</a></td> <td><a href="{{URL::to('ustaad/contact/emailRead')}}/{{$data->id}}">{{$data->created_at->format("dM,Y h:i a")}}</a></td> </tr> @php $countCheck++ @endphp @endif @endforeach </tbody> </table> </div> </div> </div> </div> <!-- [ inbox-right section ] end --> </div> </div> </di </div> </div> </div> </form> <!-- [ Main Content ] end --> </div> </section> @include('admin.include.footer') <style> .Cursor{ cursor: pointer; } </style> <script> $("#UnTrashData").hide(); $("#UnTrashData").on("click",function() { $(".InboxSentForm").attr("action","{{URL::to('ustaad/contact/unTrash')}}"); }) $(".InboxSentForm").on("submit",function(e) { if ($(".InboxSentForm input:checkbox:checked").length <= 0) { e.preventDefault(); } }) $(".inboxData").on("click",function() { $("#UnTrashData").hide(); $(".InboxSentForm").attr("action","{{URL::to('ustaad/contact/')}}"); $('input[type="checkbox"]').each(function() { this.checked = false; }); }) $(".UnTrashData").on("click",function() { $("#UnTrashData").show(); $(".InboxSentForm").attr("action","{{URL::to('ustaad/contact/')}}"); $('input[type="checkbox"]').each(function() { this.checked = false; }); }) </script> ======================= File: app/Models/BrokerReviewModel.php ======================= <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use App\Models\BrokerCompanyInformationModel; class BrokerReviewModel extends Model { protected $table="broker_review"; protected $fillable = ["image","brokerId","description","videoCode","link","ReviewTitle","shortDescription","trash","pending"]; public function GetBrokerInfo(){ $data = BrokerCompanyInformationModel::where('id',$this->brokerId)->first(); return $data; } } ======================= File: resources/views/admin/broker/category.blade.php ======================= <reponame>Technow-Pakistan/Forexustaad-v5<filename>resources/views/admin/broker/category.blade.php @php $value =Session::get('admin'); @endphp @include('admin.include.header') <!-- [ Main Content ] start --> <section class="pcoded-main-container"> <div class="pcoded-content"> <!-- [ breadcrumb ] start --> <div class="page-header"> <div class="page-block"> <div class="row align-items-center"> <div class="col-md-12"> <div class="page-header-title"> <h5 class="m-b-10">Add Broker</h5> </div> <ul class="breadcrumb"> <li class="breadcrumb-item"> <a href="{{URL::to('/ustaad/dashboard')}}"><i class="fa fa-home"></i></a> </li> <li class="breadcrumb-item"><a href="{{URL::to('/ustaad/allbrokers')}}/{{$value['memberId']}}">All Broker</a></li> <li class="breadcrumb-item"> <a href="#!">Add Broker</a> </li> </ul> </div> </div> </div> </div> <!-- [ breadcrumb ] end --> <!-- [ Main Content ] start --> <div class="row"> <!-- <div class="col-12 mt-4"> <h4 class="mb-0">Text alignment</h4> <p class="text-muted mt-0 font-12">You can quickly change the text alignment<code>.text-center.text-right</code>.</p> </div> --> @php $i=0 @endphp @foreach($totalData as $data) <div class="col-md-3"> <div class="card text-center"> <a href="{{URL::to('ustaad/broker/add')}}/{{$data->id}}"> <div class="card-body addn"> <i class=" fab fa-blogger text-danger"></i> <h4 class="card-title">{{$data->category}}</h4> </div> </a> </div> </div> @endforeach </div> <!-- [ Main Content ] end --> </div> </section> <!-- [ Main Content ] end --> @include('admin.include.footer') ======================= File: app/Models/SignalRatingModel.php ======================= <?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class SignalRatingModel extends Model { protected $table = "signal_rating"; protected $fillable = ["rating","userId","signalId"]; } ======================= File: resources/views/strategies/viewAll.blade.php ======================= @include ('inc/header') <!-- Content are --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include ('inc/home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> @if($MidBannerHomeActive) <div class="mb-5"> <a href="{{$MidBannerHomeActive->link}}" target="_blank"> <img src="{{URL::to('storage/app')}}/{{$MidBannerHomeActive->image}}" width="100%"> </a> </div> @endif <div class="row "> <div class="col-sm-12"> <div class="news_us"> <div class="content_area_heading large-heading text-center"> <h1 class="heading_title wow animated fadeInUp"> Our Strategies </h1> <div class="heading_border wow animated fadeInUp"> <span class="one"></span><span class="two"></span><span class="three"></span> </div> </div> </div> </div> @foreach($Strategies as $data) @php $url = str_replace(" ","-",$data->title); @endphp <div class=" col-sm-12 col-md-6 bg-light"> <div class="wow animated fadeInUp mt-1"> <div class="re_img w-100 p-4"> <a href="{{URL::to('strategies')}}/{{$url}}"> <img src="{{URL::to('/storage/app')}}/{{$data->image}}" > </a> </div> <div class="container-fluid "> <div class="row"> <div class="col-sm-12 "> <div class="new_description-details"> <h6> <a href="{{URL::to('strategies')}}/{{$url}}"> {{$data->title}} </a> </h6> <p> {{$data->shortDescription}} </p> </div> </div> </div> </div> </div> </div> @endforeach </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include ('inc/home-right-sidebar') </div> </div> </section> @include ('inc/footer') ======================= File: app/Models/HeaderLeftBannerModel.php ======================= <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class HeaderLeftBannerModel extends Model { protected $table = "header_left_banner"; protected $fillable = ["banner","start","end","link","htmlLink","trash","active"]; } ======================= File: app/Http/Controllers/HeaderBannerController.php ======================= <reponame>Technow-Pakistan/Forexustaad-v5<filename>app/Http/Controllers/HeaderBannerController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\HeaderLeftBannerModel; use App\Models\HeaderRightBannerModel; use App\Models\TrashModel; class HeaderBannerController extends Controller { public function Index(Request $request){ $totalData = HeaderLeftBannerModel::orderBy('id','desc')->where('trash',0)->get(); $totalRightData = HeaderRightBannerModel::orderBy('id','desc')->where('trash',0)->get(); return view('admin.header-banner',compact('totalData','totalRightData')); } public function Add(Request $request){ $banner = new HeaderLeftBannerModel; if($request->file("file_photo")!= null){ $path = $request->file("file_photo")->store("WebImages"); $bannerImage = $path; $banner->banner = $bannerImage; } if($request->active == 0){ $oldData = HeaderLeftBannerModel::where('active',0)->first(); if($oldData){ $oldData->active = 1; $oldData->save(); } $banner->active = 0; } $banner->start = $request->start; $banner->end = $request->end; $banner->link = $request->link; $banner->htmlLink = $request->htmlLink; $banner->save(); $success = "This banner has been added successfully."; $request->session()->put("success",$success); return back(); } public function deleteLeft(Request $request, $id){ $Trash = TrashModel::where('deleteId',$id)->where('category',"Header Left Banner")->first(); $Trash->delete(); $data = HeaderLeftBannerModel::find($id); $data->delete(); $error = "This banner has been deleted successfully."; $request->session()->put("error",$error); return back(); } public function EditLeft(Request $request, $id){ $data = HeaderLeftBannerModel::find($id); $data2 = $request->all(); if($request->active == 0){ $oldData = HeaderLeftBannerModel::where('active',0)->first(); if($oldData){ $oldData->active = 1; $oldData->save(); } $data2['active'] = 0; }else { $data2['active'] = 1; } $data->fill($data2); $data->save(); $success = "This banner has been updated successfully."; $request->session()->put("success",$success); return back(); } public function TrashLeft(Request $request, $id){ $user = $request->session()->get("admin"); $data = HeaderLeftBannerModel::find($id); $data->trash = 1; $data->save(); $Trash = new TrashModel; $Trash->adminTableId = $user->id; $Trash->trashItem = "banner/header-banner/left"; $Trash->category = "Header Left Banner"; $Trash->deleteId = $id; $Trash->deleteTitle = $data->title; $Trash->save(); $error = "This banner has been deleted successfully."; $request->session()->put("error",$error); return back(); } public function TrashLeftRestore(Request $request, $id){ $data = HeaderLeftBannerModel::find($id); $data->trash = 0; $data->save(); $Trash = TrashModel::where('deleteId',$id)->where('category',"Header Left Banner")->first(); $Trash->delete(); $success = "This banner has been restore successfully."; $request->session()->put("success",$success); return back(); } public function AddRight(Request $request){ if ($request->file("file_photo")!= null) { $path = $request->file("file_photo")->store("WebImages"); $bannerImage = $path; } if($request->active == 0){ $oldData = HeaderRightBannerModel::where('active',0)->first(); if($oldData){ $oldData->active = 1; $oldData->save(); } } $banner->active = 0; $banner = new HeaderRightBannerModel; if (isset($bannerImage)) { $banner->banner = $bannerImage; } $banner->start = $request->start; $banner->end = $request->end; $banner->link = $request->link; $banner->htmlLink = $request->htmlLink; $banner->save(); $success = "This banner has been added successfully."; $request->session()->put("success",$success); return back(); } public function deleteRight(Request $request, $id){ $Trash = TrashModel::where('deleteId',$id)->where('category',"Header Right Banner")->first(); $Trash->delete(); $data = HeaderRightBannerModel::find($id); $data->delete(); $error = "This banner has been deleted successfully."; $request->session()->put("error",$error); return back(); } public function EditRight(Request $request, $id){ $data = HeaderRightBannerModel::find($id); $data2 = $request->all(); if($request->active == 0){ $oldData = HeaderRightBannerModel::where('active',0)->first(); if($oldData){ $oldData->active = 1; $oldData->save(); } $data2['active'] = 0; }else { $data2['active'] = 1; } $data->fill($data2); $data->save(); $success = "This banner has been updated successfully."; $request->session()->put("success",$success); return back(); } public function TrashRight(Request $request, $id){ $user = $request->session()->get("admin"); $data = HeaderRightBannerModel::find($id); $data->trash = 1; $data->save(); $Trash = new TrashModel; $Trash->adminTableId = $user->id; $Trash->trashItem = "banner/header-banner/right"; $Trash->category = "Header Right Banner"; $Trash->deleteId = $id; $Trash->deleteTitle = $data->title; $Trash->save(); $error = "This banner has been deleted successfully."; $request->session()->put("error",$error); return back(); } public function TrashRightRestore(Request $request, $id){ $data = HeaderRightBannerModel::find($id); $data->trash = 0; $data->save(); $Trash = TrashModel::where('deleteId',$id)->where('category',"Header Right Banner")->first(); $Trash->delete(); $success = "This banner has been restore successfully."; $request->session()->put("success",$success); return back(); } } ======================= File: resources/views/htmlPages/how-to-choose-a-forex-broker-webinar-ready.blade.php ======================= <gh_stars>0 @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>How to Choose a Forex Broker webinar ready</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <h4 class="text-center"> <strong> In this webinar you learn how does a Forex “newbie” pick a broker? We are organize this webinar to help you to select a best broker available in the forex market </strong> </h4> <br> <h5 class="text-center"> You will never got information like this before so pleas watch our video and learn much more about how to choose Broker and what is requirements checked before joining any Forex broker market </h5> <br> <h6 class="text-center"> Register your webinar </h6> <br> <div class="text-center"> <a href="how-to-choose-a-forex-broker-in-urdu-webinar.html"><button type="button" class="btn btn-primary btn-lg">Register your Webinar</button></a> </div> <br> <p> InshaAllah this is information helped you to find 100% perfect broker for your Forex Trading life time </p> <p> Noow webinar video is available for watching, How to Choose a Forex Broker in urdu (webinar) </p> <p> If you want to know all these thing which I describe up, then you must Unlock this video by click on any like button about Forex trading, </p> <p> I Also share some basic information about Forex trading like what is Ask Price, Bid Price and Spread in this video </p> <p> If you want you watch video just click on How to Choose a Forex Broker in urdu (webinar),You must watch this webinar and also share with you friends, thank you </p> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> ======================= File: resources/views/htmlPages/what-is-candlestick-strategy-in-urduhindi-part-1.blade.php ======================= @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>what is Candlestick Strategy in urdu/Hindi part 1</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <p> Technical analysis is an observation of combination of chart patterns, Candlestick formations and indicators. Together with chart patterns, candlestick formations can give traders the indication of next movements of the markets, this one is very helpful and useful for traders, I use this strategy and earn many pips. </p> <h5 class="text-center"> <strong> First we start from Basics of Candlestick </strong> </h5> <div> <ul> <h3><li>What is Candlestick</li></h3> <ul> <li>This is only a Forex Trading strategy, in candlestick strategy have many different patterns Like :</li> <ul> <li>Hammer</li> <li>Shooting star</li> <li>Pin bar</li> <li>Bullish engulfing</li> </ul> </ul> <h3><li>What is Bullish</li></h3> <ul> <li>Forex Trader who believe that a stock price will increase over time are said to be bullish. Trader who buy calls are bullish</li> </ul> <h3><li>What is Bearish</li></h3> <ul> <li>Forex Trader who believe that a stock price will decline are said to be bearish</li> </ul> </ul> </div> <p> <strong> In this webinar I will cover the candlestick basics as well as most important bullish and bearish reversal patterns </strong> </p> <div> <ul> <h2> <li>Bullish Reversals</li> </h2> <h2> <li>Bearish Reversals</li> </h2> </ul> </div> <h3 class="text-center"> This video locked, Pleas click on Like button for unlock and watch this video </h3> <br> <div> <iframe width="100%" height="315" src="https://www.youtube.com/embed/pmL632FYHfc" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div> <br> <h6 class="text-center"> Learn and share this post with your friends and also write below your e mail address for new updates </h6> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> @include('inc.footer') ======================= File: resources/views/admin/add-broker.blade.php ======================= <gh_stars>0 @php $value =Session::get('admin'); @endphp @include('admin.include.header') <!-- [ Main Content ] start --> <section class="pcoded-main-container"> <div class="pcoded-content"> <!-- [ breadcrumb ] start --> <div class="page-header"> <div class="page-block"> <div class="row align-items-center"> <div class="col-md-12"> <div class="page-header-title"> <h5 class="m-b-10">Add Broker</h5> </div> <ul class="breadcrumb"> <li class="breadcrumb-item"> <a href="{{URL::to('/ustaad/dashboard')}}"><i class="fa fa-home"></i></a> </li> <li class="breadcrumb-item"><a href="{{URL::to('/ustaad/allbrokers')}}/{{$value['memberId']}}">All Broker</a></li> <li class="breadcrumb-item"> <a href="#!">Broker Details</a> </li> </ul> </div> </div> </div> </div> <!-- [ breadcrumb ] end --> <!-- [ Main Content ] start --> <div class="row"> <div class="col-sm-12"> <div class="card tabs-card"> <div class="card-body"> <!-- Nav tabs --> @isset($error) <div class="alert alert-danger"> {{$error}} </div> @endisset <!-- Tab panes --> <div class="row"> <div class="col-md-12"> <div class="progress-group"> <div class="wrapper"> <div class="step step01 complete"><progress class="progress progress1" value="0" max="100" aria-describedby="Step 01"></progress> <div class="progress-circle"></div> </div> <div class="step step02 complete"><progress class="progress progress2" value="0" max="100" aria-describedby="Step 02"></progress> <div class="progress-circle"></div> </div> <div class="step step03 complete"><progress class="progress progress3" value="0" max="100" aria-describedby="Step 03"></progress> <div class="progress-circle"></div> </div> <div class="step step04"><progress class="progress progress4" value="0" max="100" aria-describedby="Step 04"></progress> <div class="progress-circle"></div> </div> <div class="step step05"><progress class="progress progress5" value="0" max="100" aria-describedby="Step 05"></progress> <div class="progress-circle"></div> </div> </div> </div> <div class="progress-labels"> <div class="label">Step 01</div> <div class="label">Step 02</div> <div class="label">Step 03</div> <div class="label">Step 04</div> <div class="label">Step 05</div> </div> </div> <div class="col-md-3 mt-4" style="border-right:1px solid lightgray"> <ul class="nav nav-pills nav-fill mb-3" role="tablist"> <li class="nav-item"> <a class="nav-link active" data-toggle="tab" href="#COMPANYINFORMATION" role="tab">COMPANY INFORMATION </a> <div class="slide bg-c-blue"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#DEPOSIT" role="tab">DEPOSIT & WITHDRAWAL </a> <div class="slide bg-c-green"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#COMMISSIONS" role="tab">COMMISSIONS & FEES </a> <div class="slide bg-c-red"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#ACCOUNT" role="tab">ACCOUNT INFORMATION </a> <div class="slide bg-c-yellow"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#TRADABLE" role="tab">TRADABLE ASSETS</a> <div class="slide bg-c-yellow"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#TRADINGPLATFORMS" role="tab">TRADING PLATFORMS </a> <div class="slide bg-c-blue"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#TRADINGFEATURES " role="tab">TRADING FEATURES </a> <div class="slide bg-c-green"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#CUSTOMER" role="tab">CUSTOMER SERVICE </a> <div class="slide bg-c-red"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#RESEARCH" role="tab">RESEARCH & EDUCATION </a> <div class="slide bg-c-yellow"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#PROMOTIONS" role="tab">PROMOTIONS</a> <div class="slide bg-c-yellow"></div> </li> </ul> </div> <div class="col-md-9"> <div class="tab-content"> <div class="tab-pane active" id="COMPANYINFORMATION" role="tabpanel"> <div class=""> <div class="card-header text-danger f-26"> COMPANY INFORMATION </div> <div class="card-body"> <form action="{{URL::to('ustaad/broker/addBroker')}}" class="FormSubmit" method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label for="">Company Name</label> <input type="text" name="title" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">Company Logo (size must in 50 Kbs)</label> <input type="file" name="file_photo" id="file_photo" onChange="return validate()" class="form-control h-100" required> <p id="file_error" class="text-danger text-right m-0"></p> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">REGULATIONS</label> <input type="text" name="regulations" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">HEADQUARTERS COUNTRY</label> <input type="text" name="headquaters" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">FOUNDATION YEAR</label> <input type="text" name="foundation" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">PUBLICLY TRADED</label> <input type="text" name="traded" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">NUMBER OF EMPLOYEES</label> <input type="text" name="employees" class="form-control" required> </div> </div> <div class="col-sm-6"> </div> <div class="col-sm-4"> Never End <input type="checkbox" name="neverEnd" id="neverEnd" value="1"> </div> <div class="col-sm-4 txtTime"> <div class="form-group"> <label for="">Start Date</label> <input type="date" name="start" class="form-control" id="startDatetime"> </div> </div> <div class="col-sm-4 txtTime"> <div class="form-group"> <label for="">End Date</label> <input type="date" name="end" class="form-control" id="endDatetime"> </div> </div> </div> <div> <input type="hidden" name="activeForm" class="form-control" value="COMPANY INFORMATION"> <input type="hidden" name="categoryId" class="form-control" value="{{$id}}"> <input type="submit" id="doaction" class="btn btn-outline-primary" value="Save"> <p id="form_error" class="text-danger text-right m-0"></p> </div> </form> </div> </div> </div> <div class="tab-pane" id="DEPOSIT" role="tabpanel"> <div class=""> <div class="card-header text-danger f-26"> DEPOSIT & WITHDRAWAL </div> <div class="card-body"> <form action="{{URL::to('ustaad/broker/addDeposit')}}" method="post"> <div class="form-group"> <label for="">DEPOSIT OPTIONS</label> <input type="text" name="deposit" class="form-control" required> </div> <div class="form-group"> <label for="">WITHDRAWAL OPTIONS</label> <input type="text" name="withdrawal" class="form-control"> </div> @isset($id) <input type="hidden" name="brokerId" value="{{$id}}"> @endisset <div> <input type="hidden" name="activeForm" class="form-control" value="DEPOSIT & WITHDRAWAL"> <input type="submit" id="doaction" class="btn btn-outline-primary" value="Save"> </div> </form> </div> </div> </div> <div class="tab-pane" id="COMMISSIONS" role="tabpanel"> <div class=""> <div class="card-header text-danger f-26"> COMMISSIONS & FEES </div> <div class="card-body"> <form action="{{URL::to('ustaad/broker/addCommission')}}" method="post"> <div class="form-group"> <label for="">COMMISSION ON TRADES</label> <input type="text" name="commission" class="form-control"> </div> <div class="form-group"> <label for="">FIXED SPREADS</label> <input type="text" name="spread" class="form-control"> <div> </div> </div> @isset($id) <input type="hidden" name="brokerId" value="{{$id}}"> @endisset <div> <input type="hidden" name="activeForm" class="form-control" value="COMMISSIONS & FEES"> <input type="submit" id="doaction" class="btn btn-outline-primary" value="Save"> </div> </form> </div> </div> </div> <div class="tab-pane" id="ACCOUNT" role="tabpanel"> <div class=""> <div class="card-header text-danger f-26"> ACCOUNT INFORMATION </div> <div class="card-body"> <form action="{{URL::to('ustaad/broker/addAccountInfo')}}" method="post"> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADING DESK TYPE</label> <input type="text" name="trade" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">MIN DEPOSIT</label> <input type="text" name="min" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">MAX LEVERAGE</label> <input type="text" name="max" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">MINI ACCOUNT</label> <input type="text" name="mini" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">PREMIUM ACCOUNT</label> <input type="text" name="premium" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">DEMO ACCOUNT</label> <input type="text" name="demo" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">ISLAMIC ACCOUNT</label> <input type="text" name="islamic" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">SEGREGATED ACCOUNT</label> <input type="text" name="segregated" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">MANAGED ACCOUNT</label> <input type="text" name="managed" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">SUITABLE FOR BEGINNERS</label> <input type="text" name="beginner" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">SUITABLE FOR PROFESSIONALS</label> <input type="text" name="professional" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">SUITABLE FOR SCALPING</label> <input type="text" name="scalping" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">SUITABLE FOR DAILY TRADING</label> <input type="text" name="daily" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">SUITABLE FOR WEEKLY TRADING</label> <input type="text" name="weekly" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">SUITABLE FOR SWING TRADING</label> <input type="text" name="swing" class="form-control" required> <div> </div> </div> </div> </div> @isset($id) <input type="hidden" name="brokerId" value="{{$id}}"> @endisset <div> <input type="hidden" name="activeForm" class="form-control" value="ACCOUNT INFORMATION"> <input type="submit" id="doaction" class="btn btn-outline-primary" value="Save"> </div> </form> </div> </div> </div> <div class="tab-pane" id="TRADABLE" role="tabpanel"> <div class=""> <div class="card-header text-danger f-26"> TRADABLE ASSETS </div> <div class="card-body"> <form action="{{URL::to('ustaad/broker/addTradableAssets')}}" method="post"> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADES CURRENCIES</label> <input type="text" name="currency" class="form-control" required required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADES COMMODITIES</label> <input type="text" name="tradeCommodities" class="form-control" required required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADES INDICES</label> <input type="text" name="tradeIndices" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADES STOCKS</label> <input type="text" name="tradeStocks" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADES CRYPTOCURRENCY</label> <input type="text" name="cryptocurrency" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADES ETF'S</label> <input type="text" name="etfs" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADES BONDS</label> <input type="text" name="tradeBonds" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADES FUTURES</label> <input type="text" name="tradeFuture" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADES OPTIONS</label> <input type="text" name="options" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">SUPPORTED CRYPTOCOINS</label> <input type="text" name="cryptocoins" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">NUMBER OF TRADABLE ASSETS</label> <input type="text" name="tradableassets" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">NUMBER OF CURRENCY PAIRS</label> <input type="text" name="currencypairs" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">NUMBER OF CRYPTOCURRENCIES</label> <input type="text" name="cryptocurrencies" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">NUMBER OF STOCKS</label> <input type="text" name="NoOfStocks" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">NUMBER OF INDICES</label> <input type="text" name="noOfIndices" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">NUMBER OF COMMODITIES</label> <input type="text" name="noOfCommodities" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">NUMBER OF FUTURES</label> <input type="text" name="noOfFutures" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">NUMBER OF OPTIONS</label> <input type="text" name="noOfOptions" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">NUMBER OF BONDS</label> <input type="text" name="noOfBonds" class="form-control" required> <div> </div> </div> </div> </div> @isset($id) <input type="hidden" name="brokerId" value="{{$id}}"> @endisset <div> <input type="hidden" name="activeForm" class="form-control" value="TRADABLE ASSETS"> <input type="submit" id="doaction" class="btn btn-outline-primary" value="Save"> </div> </form> </div> </div> </div> <div class="tab-pane " id="TRADINGPLATFORMS" role="tabpanel"> <div class=""> <div class="card-header text-danger f-26"> TRADING PLATFORMS </div> <div class="card-body"> <form action="{{URL::to('ustaad/broker/addPlatform')}}" method="post" > <div class="form-group"> <label for="">TRADING PLATFORMS</label> <input type="text" name="platform" class="form-control" required> </div> <div class="form-group"> <label for="">OS COMPATIBILITY</label> <input type="text" name="os" class="form-control" required> </div> <div class="form-group"> <label for="">MOBILE TRADING</label> <input type="text" name="mobile" class="form-control" required> </div> <div class="form-group"> <label for="">TRADING PLATFORM SUPPORTED LANGUAGES</label> <textarea name="language" id="language" class="form-control" cols="30" rows="10" required></textarea> </div> @isset($id) <input type="hidden" name="brokerId" value="{{$id}}"> @endisset <div> <input type="hidden" name="activeForm" class="form-control" value="TRADING PLATFORMS"> <input type="submit" id="doaction" class="btn btn-outline-primary" value="Save"> </div> </form> </div> </div> </div> <div class="tab-pane" id="TRADINGFEATURES" role="tabpanel"> <div class=""> <div class="card-header text-danger f-26"> TRADING FEATURES </div> <div class="card-body"> <form action="{{URL::to('ustaad/broker/addFeature')}}" method="post" > <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label for="">EDUCATIONAL SERVICES</label> <input type="text" name="educationServices" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">SOCIAL TRADING / COPY TRADING</label> <input type="text" name="social" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADING SIGNALS</label> <input type="text" name="signals" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">EMAIL ALERTS</label> <input type="text" name="email" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">GUARANTEED STOP LOSS</label> <input type="text" name="stop" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">GUARANTEED LIMIT ORDERS</label> <input type="text" name="limited" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">GUARANTEED FILLS / LIQUIDITY</label> <input type="text" name="guaranteed" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">OCO ORDERS</label> <input type="text" name="oco" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRAILING SP/TP</label> <input type="text" name="trailings" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">AUTOMATED TRADING</label> <input type="text" name="automated" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">API TRADING</label> <input type="text" name="api" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">VPS SERVICES</label> <input type="text" name="vps" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADING FROM CHART</label> <input type="text" name="chart" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">INTEREST ON MARGIN</label> <input type="text" name="margin" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">OFFERS HEDGING</label> <input type="text" name="hedging" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">OFFERS PROMOTIONS</label> <input type="text" name="promotions" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">ONE-CLICK TRADING</label> <input type="text" name="oneClick" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">EXPERT ADVISORS (EA)</label> <input type="text" name="advisors" class="form-control" required> <div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">OTHER TRADING FEATURES</label> <input type="text" name="features" class="form-control" required> <div> </div> </div> </div> </div> @isset($id) <input type="hidden" name="brokerId" value="{{$id}}"> @endisset <div> <input type="hidden" name="activeForm" class="form-control" value="TRADING FEATURES"> <input type="submit" id="doaction" class="btn btn-outline-primary" value="Save"> </div> </form> </div> </div> </div> <div class="tab-pane" id="CUSTOMER" role="tabpanel"> <div class=""> <div class="card-header text-danger f-26"> CUSTOMER SERVICE </div> <div class="card-body"> <form action="{{URL::to('ustaad/broker/addCustomerServices')}}" method="post" > <div class="form-group"> <label for="">CUSTOMER SUPPORT LANGUAGES</label> <textarea name="languages" class="form-control" id="" cols="30" rows="10" required></textarea> </div> <div class="form-group"> <label for="">24H SUPPORT</label> <input type="text" name="supports" class="form-control" required> </div> <div class="form-group"> <label for="">SUPPORT DURING WEEKENDS</label> <input type="text" name="weekend" class="form-control" required> </div> <div class="form-group"> <label for="">LIVE CHAT</label> <input type="text" name="chat" class="form-control" id="" required> </div> @isset($id) <input type="hidden" name="brokerId" value="{{$id}}"> @endisset <div> <input type="hidden" name="activeForm" class="form-control" value="CUSTOMER SERVICE"> <input type="submit" id="doaction" class="btn btn-outline-primary" value="Save"> </div> </form> </div> </div> </div> <div class="tab-pane" id="RESEARCH" role="tabpanel"> <div class=""> <div class="card-header text-danger f-26"> RESEARCH & EDUCATION </div> <div class="card-body"> <form action="{{URL::to('ustaad/broker/addResearchEducation')}}" method="post" > <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label for="">DAILY MARKET COMMENTARY</label> <input type="text" name="commentary" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">NEWS (TOP-TIER SOURCES)</label> <input type="text" name="news" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">AUTOCHARTIST</label> <input type="text" name="autochartist" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">TRADING CENTRAL (RECOGNIA)</label> <input type="text" name="tradingCentral" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">DELKOS RESEARCH</label> <input type="text" name="delkos" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">ACUITY TRADING</label> <input type="text" name="acuity" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">WEBINARS</label> <input type="text" name="webinars" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">VIDEO EDUCATION</label> <input type="text" name="education" class="form-control" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label for="">ECONOMIC CALENDAR</label> <input type="text" name="calendar" class="form-control" required> </div> </div> </div> @isset($id) <input type="hidden" name="brokerId" value="{{$id}}"> @endisset <div> <input type="hidden" name="activeForm" class="form-control" value="RESEARCH & EDUCATION"> <input type="submit" id="doaction" class="btn btn-outline-primary" value="Save"> </div> </form> </div> </div> </div> <div class="tab-pane" id="PROMOTIONS" role="tabpanel"> <div class=""> <div class="card-header text-danger f-26"> PROMOTIONS </div> <div class="card-body"> <form action="{{URL::to('ustaad/broker/addPromotion')}}" method="post" > <div class="form-group"> <label for="">PROMOTIONS</label> <input type="text" name="promotions" class="form-control" required> </div> <div class="form-group"> <label for="">READ REVIEW</label> <input type="text" name="review" class="form-control" required required> </div> <div class="form-group"> <label for="">Link</label> <input type="text" name="link" class="form-control" required required> </div> @isset($id) <input type="hidden" name="brokerId" value="{{$id}}"> @endisset <div> <input type="hidden" name="activeForm" class="form-control" value="PROMOTIONS"> <input type="submit" id="doaction" class="btn btn-outline-primary" value="Save"> </div> </form> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <!-- [ Main Content ] end --> </div> </section> <!-- [ Main Content ] end --> @include('admin.include.footer') <script> $("#neverEnd").click(function(){ if(this.checked){ $(".txtTime").hide(); $("#startDatetime").attr("required",false); $("#endDatetime").prop("required",false); }else{ $(".txtTime").show(); $("#startDatetime").attr("required",true); $("#endDatetime").prop("required",true); } }) </script> <style> .nav-fill.nav-item.nav-link{ padding:15px; } .nav-fill.nav-item.active{ color:#4099ff; background-color:white; } /* Progress Bar */ .progress { display: vertical; width: 100%; height: 12px; position: relative; z-index: 5; padding-right: 8px; padding-top: 2px; } @media all and (min--moz-device-pixel-ratio:0) and (min-resolution: 3e1dpcm) { .progress { height: 10px; } } .progress[value] { background-color: transparent; border: 0; appearance: none; border-radius: 0; } .progress[value]::-ms-fill { background-color: #0074d9; border: 0; } .progress[value]::-moz-progress-bar { background-color: #0074d9; margin-right: 8px; } .progress[value]::-webkit-progress-inner-element { background-color: #eee; } .progress[value]::-webkit-progress-value { background-color: #0074d9; } .progress[value]::-webkit-progress-bar { background-color: #eee; } .progress-circle { width: 24px; height: 24px; position: absolute; right: 3px; top: -5px; z-index: 5; border-radius: 50%; } .progress-circle:before { content: ""; width: 6px; height: 6px; background: white; border-radius: 50%; display: block; transform: translate(-50%, -50%); position: absolute; left: 50%; top: 50%; } .progress-group { margin-top: 36px; } @media (max-width: 991px) { .progress-group { margin-left: -18px; margin-right: -18px; flex-basis: 100%; padding: 18px; } } @media (max-width: 768px) { .progress-group { padding: 18px 18px 0; margin-bottom: 12px; } } .progress-group.title { margin-bottom: 18px; } .progress-group.wrapper { background: white; border: 1px solid #eee; border-radius: 12px; height: 14px; display: flex; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.3)); } .progress-group.step { width: 20%; position: relative; } .progress-group.step:after { content: ""; height: 30px; width: 30px; background: white; border-radius: 50%; display: block; position: absolute; right: 0; top: 50%; transform: translateY(-50%); } .progress-group.step:first-of-type.progress { padding-left: 4px; } .progress-group.step:first-of-type.progress[value]::-moz-progress-bar { border-radius: 5px 0 0 5px; } .progress-group.step:first-of-type.progress[value]::-webkit-progress-value { border-radius: 5px 0 0 5px; } .progress-group.step:not(:first-of-type).progress[value]::-moz-progress-bar { border-radius: 0; } .progress-group.step:not(:first-of-type).progress[value]::-webkit-progress-value { border-radius: 0; } .progress-group.step.progress[value] +.progress-circle { background: #eee; } .progress-group.step.step01.progress[value]::-moz-progress-bar { background-color: #010c4e; } .progress-group.step.step01.progress[value]::-webkit-progress-value { background-color: #010c4e; } .progress-group.step.step01.progress[value="100"] +.progress-circle { background-color: #010c4e; } .progress-group.step.step02.progress[value]::-moz-progress-bar { background-color: #002d88; } .progress-group.step.step02.progress[value]::-webkit-progress-value { background-color: #002d88; } .progress-group.step.step02.progress[value="100"] +.progress-circle { background-color: #002d88; } .progress-group.step.step03.progress[value]::-moz-progress-bar { background-color: #017aa9; } .progress-group.step.step03.progress[value]::-webkit-progress-value { background-color: #017aa9; } .progress-group.step.step03.progress[value="100"] +.progress-circle { background-color: #017aa9; } .progress-group.step.step04.progress[value]::-moz-progress-bar { background-color: #03c2b2; } .progress-group.step.step04.progress[value]::-webkit-progress-value { background-color: #03c2b2; } .progress-group.step.step04.progress[value="100"] +.progress-circle { background-color: #03c2b2; } .progress-group.step.step05.progress[value]::-moz-progress-bar { background-color: #05e8b0; } .progress-group.step.step05.progress[value]::-webkit-progress-value { background-color: #05e8b0; } .progress-group.step.step05.progress[value="100"] +.progress-circle { background-color: #05e8b0; } .progress-labels { display: flex; justify-content: space-between; } .progress-labels.label { text-align: center; text-transform: uppercase; margin: 12px 0; width: 20%; font-size: 11px; padding-right: 24px; font-weight: 600; opacity: 0.7; } .page-title { letter-spacing: -0.05rem; } </style> <script> let submitInner = 0; function validate() { $("#file_error").html(""); console.log("dsa"); submitInner = 0; var file_size = $('#file_photo')[0].files[0].size; if(file_size>50000) { submitInner = 1; $("#file_error").html("File size is greater than 50KB"); return false; } return true; } $(".FormSubmit").on("submit",function(e){ if (submitInner!= 0) { e.preventDefault(); $("#form_error").html(""); $("#form_error").html("File size is greater than 50KB"); } }) </script> ======================= File: app/Models/FirstNavBarModel.php ======================= <reponame>Technow-Pakistan/Forexustaad-v5 <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class FirstNavBarModel extends Model { protected $table = "firstnavbar"; protected $fillable = ["iconName","link","trash"]; } ======================= File: resources/views/admin/feature/edit.blade.php ======================= @include('admin.include.header') @php $value =Session::get('admin'); $count = 0; $url = "new"; @endphp @isset($fundamental->id) @php $url = "edit/". $fundamental->id; $count++; @endphp @endisset <!-- [ Main Content ] start --> <section class="pcoded-main-container"> <div class="pcoded-content"> <!-- [ breadcrumb ] start --> <div class="page-header"> <div class="page-block"> <div class="row align-items-center"> <div class="col-md-12"> <div class="page-header-title"> <h5 class="m-b-10">Videos</h5> </div> <ul class="breadcrumb"> <li class="breadcrumb-item"> <a href="{{URL::to('/ustaad/dashboard')}}"><i class="fa fa-home"></i></a> </li> <li class="breadcrumb-item"><a href="{{URL::to('/ustaad/feature-video')}}">All Feature Video</a></li> <li class="breadcrumb-item"> <a href="#!">Edit Video</a> </li> </ul> </div> </div> </div> </div> <!-- [ breadcrumb ] end --> <!-- [ Main Content ] start --> <div class="card"> <div class="card-body"> <div class="row"> <div class="col-sm-12 col-xl-12 col-md-12 "> <div class="form-wrap"> <form method="post" action="" class="" enctype="multipart/form-data"> <div class="form-group"> <label for="fundamental-name" class="form-control-label">Title</label> <input name="name" class="form-control" value="{{$video->name}}" type="text" required> </div> <div class="form-group"> <img src="{{URL::to('storage/app')}}/{{$video->thumbnail}}" width="100px" height="100px" alt=""> <input type="file" class="form-control h-100" name="thumbnail" id="customFile"> </div> <div class="form-group"> <label for="">Embed Code</label> <div> <textarea name="embed" id="" class="form-control" required>{{$video->embed}}</textarea> </div> </div> <br> <p class="submit"> <input type="submit" id="submit" class="btn btn-outline-primary" value="Save"> <span class="spinner"></span> </p> </form> </div> </div> </div> </div> </div> <!-- [ Main Content ] end --> </div> </section> <!-- [ Main Content ] end --> @include('admin.include.footer') ======================= File: resources/views/htmlPages/draw-perfect-trend-line.blade.php ======================= @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>How to draw a perfect trend-line</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <strong> <h3 class="text-center"> it’s only for Forex Fun, how to draw a perfect trend-line </h3> </strong> <h5 class="text-center"> pleas don’t try at home, its only forex fun, we want to make fun at our weekend so if you have Forex Trading funny staff like that then share with use we post with your name, Thank you </h5> <br><br> <div class="text-center"> <img src="{{URL::to('/public/assets/assets/img/blog-post/forex-fun.jpg')}}" class="img-fluid"> </div> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> @include('inc.footer') ======================= File: resources/views/htmlPages/always-trad-with-stop-loss.blade.php ======================= <reponame>Technow-Pakistan/Forexustaad-v5 @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>Always trad with stop loss in Forex trading</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <h3 class="text-center"> I teach in my webinar you always trad with stop loss, look at image below and get some idea, </h3> <br> <h3 class="text-center"> you must Always trad with Sl if you not bear wash you trading account. this is very imported point </h3> <br> <h3 class="text-center"> you must listed this point in your rule </h3> <br><br> <div class="text-center"> <img src="{{URL::to('/public/assets/assets/img/blog-post/Trad-with-stop-los.jpg')}}" class="img-fluid"> </div> <br><br> <h4 class="text-center"> <strong> If you like this Picture then you must share with your friends </strong> </h4> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> @include('inc.footer') ======================= File: resources/views/admin/latestCommentPage.blade.php ======================= <gh_stars>0 @include('admin.include.header') <!-- [ Main Content ] start --> <div class="pcoded-main-container"> <div class="pcoded-content"> <!-- [ Main Content ] start --> <div class="row"> <!-- tabs card start --> <div class="col-sm-12"> <div class="card tabs-card"> <div class="card-body"> <!-- Nav tabs --> <ul class="nav nav-pills nav-fill mb-3" role="tablist"> <li class="nav-item"> <a class="nav-link active" data-toggle="tab" href="#latest3" role="tab"><i class="fa fa-chart-line m-r-10"></i>Latest Comments</a> <div class="slide bg-c-blue"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#home3" role="tab"><i class="fa fa-chart-line m-r-10"></i>Signal Comments</a> <div class="slide bg-c-blue"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#profile3" role="tab"><i class="fa fa-blogger m-r-10"></i>Blog Comments</a> <div class="slide bg-c-green"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#messages3" role="tab"><i class="fa fa-school m-r-10"></i>Advance Training Comments</a> <div class="slide bg-c-red"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#settings3" role="tab"><i class="fa fa-school m-r-10"></i>Basic Training Comments</a> <div class="slide bg-c-yellow"></div> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#settings4" role="tab"><i class="fa fa-school m-r-10"></i>Habbit Training Comments</a> <div class="slide bg-c-yellow"></div> </li> </ul> <!-- Tab panes --> <div class="tab-content"> <div class="tab-pane active" id="latest3" role="tabpanel"> <div class="table-responsive"> <table class="table"> <thead> <tr> <th> Latest Comments </th> <th> Page Name </th> <th> Operations </th> </tr> </thead> <tbody> @foreach($wholeCommentData as $data) @php $pageName = $data->getPageName(); $member = $data->getMemberInformation(); if($member){ if($member->image == null){ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); }else{ $memberImage = URL::to("storage/app". "/".$member->image); } }else{ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); } @endphp <tr> <td> <a href="{{URL::to('ustaad/signals/comment/')}}/{{$data->objectId}}" class="d-flex"> <div> <img class="rounded-circle" style="width:40px;" src="{{$memberImage}}" alt="activity-user"> </div> <div class="ml-4"> <h6 class="mb-1">{{$member!= null? $member->name : 'Admin'}}</h6> <p class="m-0 text-dark" style="white-space:normal">{{$data->comment}}</p> </div> </a> </td> <td class="text-black"> {{$pageName->page_name}} </td> <td> <a href="{{URL::to('ustaad/comment/edit')}}/{{$data->id}}"><i class="far fa-edit text-success mr-2 editlink" value="16"></i></a> <a href="{{URL::to('ustaad/comment/delete')}}/{{$data->id}}" class="addAction" data-toggle="modal" data-target="#myModal"><i class="fa fa-trash text-danger"></i></a> </td> </tr> @endforeach </tbody> </table> </div> </div> <div class="tab-pane" id="home3" role="tabpanel"> <div class="table-responsive"> <table class="table"> <thead> <tr> <th> Signal Comments </th> <th> Operations </th> </tr> </thead> <tbody> @foreach($signalLatestComments as $data) @php $member = $data->getMemberInformation(); if($member){ if($member->image == null){ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); }else{ $memberImage = URL::to("storage/app". "/".$member->image); } }else{ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); } @endphp <tr> <td> <a href="{{URL::to('ustaad/signals/comment/')}}/{{$data->objectId}}" class="d-flex"> <div> <img class="rounded-circle" style="width:40px;" src="{{$memberImage}}" alt="activity-user"> </div> <div class="ml-4"> <h6 class="mb-1">{{$member!= null? $member->name : 'Admin'}}</h6> <p class="m-0 text-dark" style="white-space:normal">{{$data->comment}}</p> </div> </a> </td> <td> <a href="{{URL::to('ustaad/comment/edit')}}/{{$data->id}}"><i class="far fa-edit text-success mr-2 editlink" value="16"></i></a> <a href="{{URL::to('ustaad/comment/delete')}}/{{$data->id}}" class="addAction" data-toggle="modal" data-target="#myModal"><i class="fa fa-trash text-danger"></i></a> </td> </tr> @endforeach </tbody> </table> </div> </div> <div class="tab-pane" id="profile3" role="tabpanel"> <div class="table-responsive"> <table class="table"> <thead> <tr> <th> Blog Comments </th> <th> Operations </th> </tr> </thead> <tbody> @foreach($BlogPostLatestComments as $data) @php $member = $data->getMemberInformation(); if($member){ if($member->image == null){ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); }else{ $memberImage = URL::to("storage/app". "/".$member->image); } }else{ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); } @endphp <tr> <td> <a href="{{URL::to('ustaad/post/comment/')}}/{{$data->objectId}}" class="d-flex"> <div> <img class="rounded-circle" style="width:40px;" src="{{$memberImage}}" alt="activity-user"> </div> <div class="ml-4"> <h6 class="mb-1">{{$member!= null? $member->name : 'Admin'}}</h6> <p class="m-0 text-dark" style="white-space:normal">{{$data->comment}}</p> </div> </a> </td> <td> <a href="{{URL::to('ustaad/comment/edit')}}/{{$data->id}}"><i class="far fa-edit text-success mr-2 editlink" value="16"></i></a> <a href="{{URL::to('ustaad/comment/delete')}}/{{$data->id}}" class="addAction" data-toggle="modal" data-target="#myModal"><i class="fa fa-trash text-danger"></i></a> </td> </tr> @endforeach </tbody> </table> </div> </div> <div class="tab-pane" id="messages3" role="tabpanel"> <div class="table-responsive"> <table class="table"> <thead> <tr> <th> Advance Training Latest Comments </th> <th> Operations </th> </tr> </thead> <tbody> @foreach($AdvanceTrainingLatestComments as $data) @php $member = $data->getMemberInformation(); if($member){ if($member->image == null){ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); }else{ $memberImage = URL::to("storage/app". "/".$member->image); } }else{ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); } @endphp <tr> <td> <a href="{{URL::to('ustaad/advance/comment')}}/{{$data->objectId}}" class="d-flex"> <div> <img class="rounded-circle" style="width:40px;" src="{{$memberImage}}" alt="activity-user"> </div> <div class="ml-4"> <h6 class="mb-1">{{$member!= null? $member->name : 'Admin'}}</h6> <p class="m-0 text-dark" style="white-space:normal">{{$data->comment}}</p> </div> </a> </td> <td> <a href="{{URL::to('ustaad/comment/edit')}}/{{$data->id}}"><i class="far fa-edit text-success mr-2 editlink" value="16"></i></a> <a href="{{URL::to('ustaad/comment/delete')}}/{{$data->id}}" class="addAction" data-toggle="modal" data-target="#myModal"><i class="fa fa-trash text-danger"></i></a> </td> </tr> @endforeach </tbody> </table> </div> </div> <div class="tab-pane" id="settings3" role="tabpanel"> <div class="table-responsive"> <table class="table"> <thead> <tr> <th> Basic Training Latest Comments </th> <th> Operations </th> </tr> </thead> <tbody> @foreach($BasicTrainingLatestComments as $data) @php $member = $data->getMemberInformation(); if($member){ if($member->image == null){ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); }else{ $memberImage = URL::to("storage/app". "/".$member->image); } }else{ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); } @endphp <tr> <td> <a href="{{URL::to('ustaad/basic/comment')}}/{{$data->objectId}}" class="d-flex"> <div> <img class="rounded-circle" style="width:40px;" src="{{$memberImage}}" alt="activity-user"> </div> <div class="ml-4"> <h6 class="mb-1">{{$member!= null? $member->name : 'Admin'}}</h6> <p class="m-0 text-dark" style="white-space:normal">{{$data->comment}}</p> </div> </a> </td> <td> <a href="{{URL::to('ustaad/comment/edit')}}/{{$data->id}}"><i class="far fa-edit text-success mr-2 editlink" value="16"></i></a> <a href="{{URL::to('ustaad/comment/delete')}}/{{$data->id}}" class="addAction" data-toggle="modal" data-target="#myModal"><i class="fa fa-trash text-danger"></i></a> </td> </tr> @endforeach </tbody> </table> </div> </div> <div class="tab-pane" id="settings4" role="tabpanel"> <div class="table-responsive"> <table class="table"> <thead> <tr> <th> Habbit Training Latest Comments </th> <th> Operations </th> </tr> </thead> <tbody> @foreach($HabbitTrainingLatestComments as $data) @php $member = $data->getMemberInformation(); if($member){ if($member->image == null){ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); }else{ $memberImage = URL::to("storage/app". "/".$member->image); } }else{ $memberImage = URL::to("public/assets/assets/img/user1.jpg"); } @endphp <tr> <td> <a href="{{URL::to('ustaad/habbit/comment')}}/{{$data->objectId}}" class="d-flex"> <div> <img class="rounded-circle" style="width:40px;" src="{{$memberImage}}" alt="activity-user"> </div> <div class="ml-4"> <h6 class="mb-1">{{$member!= null? $member->name : 'Admin'}}</h6> <p class="m-0 text-dark" style="white-space:normal">{{$data->comment}}</p> </div> </a> </td> <td> <a href="{{URL::to('ustaad/comment/edit')}}/{{$data->id}}"><i class="far fa-edit text-success mr-2 editlink" value="16"></i></a> <a href="{{URL::to('ustaad/comment/delete')}}/{{$data->id}}" class="addAction" data-toggle="modal" data-target="#myModal"><i class="fa fa-trash text-danger"></i></a> </td> </tr> @endforeach </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- tabs card end --> </div> @include('admin.include.footer') <script> $('.table').DataTable(); </script> ======================= File: resources/views/htmlPages/forex-trading-stop-loss.blade.php ======================= <gh_stars>0 @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>Forex Trading without stop loss</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <p> Forex Trading karty time Stop loss zaror set kya karo warna app ka be ye he hall ho ga jo es bandy ky sath howa hai. account wast and pata nai kya kya. so think about it </p> <div class="text-center"> <img src="{{URL::to('/public/assets/assets/img/blog-post/Forex-without-stop-los.jpg')}}"> </div> <p> <strong>Share this post on your Wall with your friends</strong> </p> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> @include('inc.footer') ======================= File: app/Models/AdminModel.php ======================= <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use App\Models\AdminMemberModel; use App\Models\AdminMemberDetailModel; class AdminModel extends Model { protected $table = "admin"; protected $fillable = ["username","email","password","memberId","status","verified"]; public function GetMember(){ $member = AdminMemberModel::where('id',$this->memberId)->first(); return $member; } public function GetMemberDetail(){ $member = AdminMemberDetailModel::where('adminTableId',$this->id)->first(); return $member; } } ======================= File: app/Http/Controllers/AdminController.php ======================= <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\File; use App\Models\AdminModel; use App\Models\AdminMemberModel; use App\Models\AdminMemberDetailModel; use App\Models\ClientRegistrationModel; use App\Models\ClientAccountDetailModel; use App\Models\ClientMemberModel; use App\Models\TrashModel; use App\Models\TrashGalleryModel; use App\Models\BlogPostModel; use App\Models\BrokerCompanyInformationModel; use App\Models\NonRegisterVisitorModel; use App\Models\NotificationModel; use App\Models\PusherModel; use App\Models\SignalsModel; use App\Models\ClientNotificationModel; use Illuminate\Support\Facades\Mail; use App\Mail\SubscriberMail; use App\Models\AllCommentsModel; class AdminController extends Controller { public function GetPusherName(Request $request,$message,$message2){ PusherModel::BoardCast("firstChannel1","firstEvent1",["message" => $message,"message2" => $message2]); } public function ReconformationMail(Request $request, $id){ $registration = ClientRegistrationModel::where('id',$id)->first(); Mail::to($registration->email)->send(new SubscriberMail($registration)); $success = "Confirmation mail send again successfully."; $request->session()->put("success",$success); return back(); } public function NotificationView(Request $request, $id){ $notification = NotificationModel::find($id); if ($notification) { $link = $notification->link; $notification->delete(); return redirect($link); }else{ $error = "This notification is not exist any more."; $request->session()->put("error",$error); } return redirect('/ustaad'); } public function DeleteClientAccount(Request $request, $id){ $notification = ClientAccountDetailModel::find($id); $notification->delete(); $error = "Data has been deleted successfully."; $request->session()->put("error",$error); return back(); } public function NotificationDelete(Request $request){ if (isset($request->notification)){ for ($i=0; $i < count($request->notification) ; $i++) { $notification = NotificationModel::find($request->notification[$i]); $notification->delete(); } } $error = "Data has been deleted successfully."; $request->session()->put("error",$error); return back(); } public function ViewClientProfile(Request $request, $id){ $totalClientInfo = ClientRegistrationModel::where('id',$id)->first(); $clientAccount = ClientAccountDetailModel::where('clientId',$id)->get(); $clientMember = ClientMemberModel::where('id',$totalClientInfo->memberType)->first(); return view('admin.client.user-profile',compact('totalClientInfo','clientMember','clientAccount')); } public function ClientProfileAccountVerified(Request $request, $id){ $clientAccount = ClientAccountDetailModel::find($id); $clientAccount->verified = $request->verified; $clientAccount->save(); $brokerInfo = BrokerCompanyInformationModel::find($clientAccount->brokerId); if($request->verified == 1){ $success = "Account has been verified successfully."; $request->session()->put("success",$success); $PusherMessage = "Your $brokerInfo->title Account Verified."; }else { $error = "Account has been rejected successfully."; $request->session()->put("error",$error); $PusherMessage = "Your $brokerInfo->title Account Rejected."; } // Pusher Notification Start $clientInfo = ClientRegistrationModel::find($clientAccount->clientId); $messageData['email'] = $clientInfo->email; $adminData = $request->session()->get("admin"); $messageData['userId'] = $adminData['id']; $messageData['userType'] = 0; $messageData['message'] = $PusherMessage; $messageData['link'] = "user-profile"; $clientNotification = new ClientNotificationModel; $clientNotification->fill($messageData); $clientNotification->save(); $messageData['id'] = $clientNotification->id; PusherModel::BoardCast($clientInfo->email,"firstEvent",["message" => $messageData]); // Pusher Notification End return back(); } public function ClientProfileaccountdepositConfirm(Request $request, $id){ $clientAccount = ClientAccountDetailModel::find($id); $clientAccount->depositConfirm = $request->depositConfirm; $clientAccount->save(); $brokerInfo = BrokerCompanyInformationModel::find($clientAccount->brokerId); if($request->depositConfirm == 1){ $success = "Account Depostit is right."; $request->session()->put("success",$success); $PusherMessage = "Your $brokerInfo->title Account Deposite Verified."; }else { $error = "Account Depostit is wrong."; $request->session()->put("error",$error); $PusherMessage = "Your $brokerInfo->title Account Deposite Rejected."; } // Pusher Notification Start $clientInfo = ClientRegistrationModel::find($clientAccount->clientId); $messageData['email'] = $clientInfo->email; $adminData = $request->session()->get("admin"); $messageData['userId'] = $adminData['id']; $messageData['userType'] = 0; $messageData['message'] = $PusherMessage; $messageData['link'] = "user-profile"; $clientNotification = new ClientNotificationModel; $clientNotification->fill($messageData); $clientNotification->save(); $messageData['id'] = $clientNotification->id; PusherModel::BoardCast($clientInfo->email,"firstEvent",["message" => $messageData]); // Pusher Notification End return back(); } public function ChangeMemberType(Request $request, $id){ $totalClientInfo = ClientRegistrationModel::where('id',$id)->first(); $totalClientInfo->memberType = $request->memberType; $totalClientInfo->save(); $success = "Member Type has been changed successfully."; $request->session()->put("success",$success); // Pusher Notification Start if($totalClientInfo->memberType == 1) { $PusherMessage = "Oops! You Become Suscriber."; }elseif($totalClientInfo->memberType == 2){ $PusherMessage = "Congrats! You Become Our VIP Member."; }elseif($totalClientInfo->memberType == 3){ $PusherMessage = "Congrats! You Become Our Paid Member."; }else{ $PusherMessage = "Oops"; } $messageData['email'] = $totalClientInfo->email; $adminData = $request->session()->get("admin"); $messageData['userId'] = $adminData['id']; $messageData['userType'] = 0; $messageData['message'] = $PusherMessage; $messageData['link'] = "user-profile"; $clientNotification = new ClientNotificationModel; $clientNotification->fill($messageData); $clientNotification->save(); $messageData['id'] = $clientNotification->id; PusherModel::BoardCast($totalClientInfo->email,"firstEvent",["message" => $messageData]); // Pusher Notification End return back(); } public function Index(Request $request){ $username = $request->username; $password = $request->password; $info = AdminModel::where('username',$username)->where('password',$password)->first(); if($info){ $request->session()->put("admin",$info); return redirect("ustaad/dashboard"); }else{ $info2 = AdminModel::where('email',$username)->where('password',$password)->first(); if($info2){ $request->session()->put("admin",$info2); return redirect("ustaad/dashboard"); }else{ $message = "Username or Password wrong"; return view('admin.login',compact('message')); } } } public function Login(Request $request){ if($request->session()->has("admin")){ return redirect("ustaad/dashboard"); }else{ return view('admin.login'); } } public function GetLatestComment(Request $request){ $signalLatestComments = AllCommentsModel::orderBy('id','desc')->where('commentPageId', 1)->get(); $AdvanceTrainingLatestComments = AllCommentsModel::orderBy('id','desc')->where('commentPageId', 6)->get(); $BasicTrainingLatestComments = AllCommentsModel::orderBy('id','desc')->where('commentPageId', 5)->get(); $HabbitTrainingLatestComments = AllCommentsModel::orderBy('id','desc')->where('commentPageId', 7)->get(); $BlogPostLatestComments = AllCommentsModel::orderBy('id','desc')->where('commentPageId', 4)->get(); $wholeCommentData = AllCommentsModel::orderBy('created_at','desc')->where('commentPageId', 1)->orWhere('commentPageId', 4)->orWhere('commentPageId', 5)->orWhere('commentPageId', 6)->orWhere('commentPageId', 7)->get(); return view('admin.latestCommentPage',compact('signalLatestComments','wholeCommentData','AdvanceTrainingLatestComments','BasicTrainingLatestComments','HabbitTrainingLatestComments','BlogPostLatestComments')); } public function Dashboard(Request $request){ if(!$request->session()->has("admin")){ return redirect("ustaad"); }else{ $admin = $request->session()->get("admin"); if($admin['memberId'] == 3 || $admin['memberId'] == 5){ return redirect("ustaad/allCategories"); }elseif($admin['memberId'] == 6){ return redirect("ustaad/broker/category"); }elseif($admin['memberId'] == 7){ return redirect("ustaad/signals"); }elseif($admin['memberId'] == 9){ return redirect("ustaad/firstNav"); }elseif($admin['memberId'] == 10){ return redirect("ustaad/meta-tags"); }elseif($admin['memberId'] == 11){ return redirect("ustaad/latestComments"); } }; $lastMonth = date("m",strtotime("0 months")); $lastYear = date("Y",strtotime("0 months")); $TotalClientNumber = ClientRegistrationModel::count(); $MonthlyClientNumber = ClientRegistrationModel::whereMonth("created_at",$lastMonth)->whereYear("created_at",$lastYear)->count(); $ToDayClientNumber = ClientRegistrationModel::whereDay("created_at",date("d",strtotime("0 days")))->whereMonth("created_at",$lastMonth)->whereYear("created_at",$lastYear)->count(); $WeeklyClientNumber = ClientRegistrationModel::where("created_at",">=",date("Y-m-d h:i:s ",strtotime("-7 days")))->count(); $TotalAdminUsersNumber = AdminModel::count(); $MonthlyAdminUsersNumber = AdminModel::whereMonth("created_at",$lastMonth)->whereYear("created_at",$lastYear)->count(); $TotalPostNumber = BlogPostModel::count(); $MonthlyPostNumber = BlogPostModel::where('status',1)->where('pending',1)->whereDate('publishDate', '<=', date("Y-m-d"))->count(); $TotalBrokerNumber = BrokerCompanyInformationModel::count(); $MonthlyBrokerNumber = BrokerCompanyInformationModel::where("trash",0)->where("pending",0)->count(); // Active Visitors Graph Data $activeUserGraphAllDataArray = array(); $activeUserGraphFirstData = NonRegisterVisitorModel::orderBy('id','asc')->first(); if($activeUserGraphFirstData){ $firstDate = $activeUserGraphFirstData->created_at->format("Y-m-d"); }else { $firstDate = date("Y-m-d"); } $loopCount = abs(strtotime(date("Y-m-d")) - strtotime($firstDate)); $days = round($loopCount / (60 * 60 * 24)); for ($i=0; $i <= $days ; $i++) { $endTime = strtotime("$i days", strtotime($firstDate)); $countofStrtotitme = NonRegisterVisitorModel::where('strtotime',$endTime)->count(); $temporaryData = array(); $endstrtotime = $endTime. "000"; array_push($temporaryData,$endstrtotime,$countofStrtotitme); array_push($activeUserGraphAllDataArray,$temporaryData); } $activeSignalData = SignalsModel::orderBy('id','desc')->take(10)->get(); $wholeCommentData = AllCommentsModel::orderBy('created_at','desc')->orWhere('commentPageId', 1)->orWhere('commentPageId', 4)->orWhere('commentPageId', 5)->orWhere('commentPageId', 6)->orWhere('commentPageId', 7)->take(50)->get(); return view('admin.index',compact('wholeCommentData','activeSignalData','activeUserGraphAllDataArray','TotalClientNumber','MonthlyClientNumber','ToDayClientNumber','WeeklyClientNumber','TotalAdminUsersNumber','MonthlyAdminUsersNumber','TotalBrokerNumber','MonthlyBrokerNumber','TotalPostNumber','MonthlyPostNumber')); } public function Logout(Request $request){ $request->session()->pull("admin"); return redirect("ustaad"); } public function Trash(Request $request){ $totalData = TrashModel::all(); return view('admin.all-trash',compact('totalData')); } public function TrashGallery(Request $request){ $totalData = TrashGalleryModel::all(); return view('admin.trashGallery',compact('totalData')); } public function TrashGalleryImageDelete(Request $request, $id){ $title = str_replace("@-","/",$id); $path = "storage/app/". $title; if(File::exists($path)) { File::delete($path); $data = TrashGalleryModel::where('image',$title)->first(); $data->delete(); } $error = "Image has been deleted successfully."; $request->session()->put("error",$error); return back(); } public function TrashGalleryImageRestore(Request $request, $id){ $title = str_replace("@-","/",$id); $data = TrashGalleryModel::where('image',$title)->first(); $path = "storage/app/". $title; $changes = explode("/",$title); $belongs = $changes[0]; $changes[0] = $data->belongs; $newPath = implode("/",$changes); $changePath = "storage/app/". $newPath; if(File::exists($path)) { rename($path,$changePath); $data->delete(); } $success = "Image has been restore successfully."; $request->session()->put("success",$success); return back(); } public function ViewClientProfileKeywordProcess(Request $request, $id){ $data = $request->keywords; $keywords = implode(",",$data); $totalClientInfo = ClientRegistrationModel::where('id',$id)->first(); $totalClientInfo->keywords = $keywords; $totalClientInfo->save(); $success = "This client Keywords save successfully."; $request->session()->put("success",$success); return back(); } } ======================= File: resources/views/admin/user-card.blade.php ======================= <gh_stars>0 @include('admin.include.header') <!-- [ Main Content ] start --> <div class="pcoded-main-container"> <div class="pcoded-content"> <!-- [ breadcrumb ] start --> <div class="page-header"> <div class="page-block"> <div class="row align-items-center"> <div class="col-md-12"> <div class="page-header-title"> <h5>User card</h5> </div> <ul class="breadcrumb"> <li class="breadcrumb-item"><a href="{{URL::to('/ustaad/dashboard')}}"><i class="fa fa-home"></i></a></li> <li class="breadcrumb-item"><a href="{{URL::to('/ustaad/member/userList')}}">All Users</a></li> <li class="breadcrumb-item"><a href="#!">User card</a></li> </ul> </div> </div> </div> </div> <!-- [ breadcrumb ] end --> <!-- [ Main Content ] start --> <div class="row"> <div class="col-md-12"> <div class="card"> <form class="pt-5 ml-5 mr-5" action="" method="post"> <div class="row"> @php $count=0; $selected=0; if(isset($member)){ $count=1; $verified = $member->verified; $selected=$member->memberId; } @endphp <div class="col-lg-6 col-md-6 col-sm-12 col-12"> <label for="user_login">Username<span class="text-danger">*</span></label> <input type="text" name="username" value="{{$count!= 0? $member->username : '' }}" class="form-control" required> </div> <div class="col-lg-6 col-md-6 col-sm-12 col-12"> <label for="user_login">Email<span class="text-danger">*</span></label> <input type="text" name="email" value="{{$count!= 0? $member->email : '' }}" class="form-control" required> </div> <div class="col-lg-6 col-md-6 col-sm-12 col-12"> <label for="user_login">First Name<span class="text-danger">*</span></label> <input type="text" name="firstName" value="{{$count!= 0? $memberDetail->firstName : '' }}" class="form-control" required> </div> <div class="col-lg-6 col-md-6 col-sm-12 col-12"> <label for="user_login">Last Name<span class="text-danger">*</span></label> <input type="text" name="lastName" value="{{$count!= 0? $memberDetail->lastName : '' }}" class="form-control" required> </div> <div class="col-lg-6 col-md-6 col-sm-12 col-12"> <label for="user_login">Website</label> <input type="text" name="website" value="{{$count!= 0? $memberDetail->website : '' }}" class="form-control"> </div> @if($member->id!= 1) <div class="col-lg-6 col-md-6 col-sm-12 col-12"> <label for="user_login">Password<span class="text-danger">*</span></label> <input type="password" name="password" class="form-control" {{$count!= 0? '' :'required' }}> </div> @endif <div class="col-lg-6 col-md-6 col-sm-12 col-12"> <label for="user_login">Phone Number<span class="text-danger">*</span></label> <input type="text" name="mobile" value="{{$count!= 0? $memberDetail->mobile : '' }}" class="form-control" required> </div> @if($member->id!= 1) <div class="col-lg-6 col-md-6 col-sm-12 col-12"> <label for="user_login">Role<span class="text-danger">*</span></label> <select class="form-control memberId12" name="memberId"> @foreach($memberData as $member) @if($member->member!= "Admin") <option value="{{$member->id}}"{{$selected == $member->id?'selected' : '' }}>{{$member->member}}</option> @endif @endforeach </select> </div> @endif <div class="col-lg-12 col-md-12 col-sm-12 col-12"> <label for="user_login">Address<span class="text-danger">*</span></label> <input type="text" name="address" value="{{$count!= 0? $memberDetail->address : '' }}" class="form-control" required> </div> <div class="col-lg-12 col-md-12 col-sm-12 col-12"> <p class="verifiedSignal"><br> Verified <input type="checkbox" name="verified" value="1" {{$count!= 0? ($verified == 1? 'checked' : '') : ''}}> </p> </div> </div><br> <p class="submit"> <input type="submit" name="submit" id="submit" class="btn btn-outline-primary" value="save"> <span class="spinner"></span> <!-- <input type="reset" name="reset" id="reset" class="btn btn-outline-danger" value="reset"> <span class="spinner"></span> --> </p> </form> </div> </div> </div> <!-- [ Main Content ] end --> </div> </div> <!-- [ Main Content ] end --> @include('admin.include.footer') <script> $(".verifiedSignal").hide(); var data = $(".memberId12").val(); console.log(data); if (data == 7) { $(".verifiedSignal").show(); } $(".memberId12").on("change",function() { var data = $(this).val(); if (data == 7) { $(".verifiedSignal").show(); }else{ $(".verifiedSignal").hide(); } }) </script> ======================= File: app/Http/Controllers/ComposeEmailController.php ======================= <filename>app/Http/Controllers/ComposeEmailController.php<gh_stars>0 <?php namespace App\Http\Controllers; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Models\ComposeEmailModel; use App\Models\UserContactModel; use Illuminate\Support\Facades\Mail; class ComposeEmailController extends Controller { public function Index(Request $request){ return view('admin.emailCompose'); } public function DraftMail(Request $request){ $data = $request->all(); $data["draft"] = 1; $Email = new ComposeEmailModel; $Email->fill($data); $Email->save(); $success = "Your mail has been saved in draft folder."; $request->session()->put("success",$success); return back(); } public function SendMail(Request $request){ $data = $request->all(); $data["draft"] = 0; $Email = new ComposeEmailModel; $Email->fill($data); $Email->save(); Mail::send([],[], function($message) use($Email) { $message->to($Email->emailTo); $message->from('<EMAIL>'); if ($Email->emailCc!= null) { $message->from($Email->emailCc); } if ($Email->emailBcc!= null) { $message->from($Email->emailBcc); } $message->subject($Email->subject); $message->setBody($Email->message); }); $success = "Your mail has been sent successfully."; $request->session()->put("success",$success); return redirect("ustaad/contact/emailCompose"); } public function SendMailDirect(Request $request){ $data = $request->all(); $data["draft"] = 0; $Email = new ComposeEmailModel; $Email->fill($data); $Email->save(); Mail::send([],[], function($message) use($Email) { $message->to($Email->emailTo); $message->from('<EMAIL>'); $message->subject(""); $message->setBody($Email->message); }); return back(); } public function SendEmailRead(Request $request, $id){ $urlDelete = "sendEmailRead/delete"; $dataSend = ComposeEmailModel::where('id',$id)->first(); $totalData = UserContactModel::orderBy("id","desc")->get(); $totalCompose = ComposeEmailModel::orderBy("id","desc")->get(); return view('admin.sendEmailRead',compact('dataSend',"totalData","totalCompose","urlDelete")); } public function draftEmailRead(Request $request, $id){ $data = ComposeEmailModel::where('id',$id)->first(); return view('admin.emailCompose',compact('data')); } public function draftEmailSave(Request $request, $id){ $data = $request->all(); $Email = ComposeEmailModel::where('id',$id)->first(); $Email->fill($data); $Email->save(); return back(); } public function draftEmailSend(Request $request, $id){ $data = $request->all(); $data["draft"] = 0; $Email = ComposeEmailModel::where('id',$id)->first(); $Email->fill($data); $Email->save(); Mail::send([],[], function($message) use($Email) { $message->to($Email->emailTo); $message->from('<EMAIL>'); if ($Email->emailCc!= null) { $message->from($Email->emailCc); } if ($Email->emailBcc!= null) { $message->from($Email->emailBcc); } $message->subject($Email->subject); $message->setBody($Email->message); }); $success = "Your mail has been sent successfully."; $request->session()->put("success",$success); return redirect("ustaad/contact/emailCompose"); } public function EmailReply(Request $request, $id){ $info = UserContactModel::find($id); return view('admin.emailCompose',compact('info')); } } ======================= File: resources/views/htmlPages/what-is-forex-trading-in-urdu-webinar.blade.php ======================= <filename>resources/views/htmlPages/what-is-forex-trading-in-urdu-webinar.blade.php @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>What is Forex Trading in Urdu (webinar)</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <div class="text-center"> <img src="{{URL::to('/public/assets/assets/img/blog-post/Forexustaad.jpg')}}" class="img-fluid"> </div> <br><br> <h4> <strong> Salam o alikom Dear friends </strong> </h4> <br> <p> <strong> Today webinar is Totally about Forex trading and it’s full with information about Forex trading, in this video you find your all question Like </strong> </p> <div> <ol> <li><strong>What is Forex?</strong></li> <ul> <li>Foreign Exchange Market which is commonly known as “Forex” it’s also called FX Market and Currency Market, is a global financial market where different Currencies of the world are traded in pairs</li> </ul><br> <li><strong>Size of Forex market?</strong></li> <ul> <li>Watch Video by click on like button</li> </ul><br> <li><strong>Where is forex Located?</strong></li> <ul> <li>Watch Video by click on like button</li> </ul><br> <li><strong>What is Traded in Forex?</strong></li> <li><strong>What is Currencies?</strong></li> <li><strong>What is Currencies Pair</strong></li> <li><strong>What is forex trading plan</strong></li> <li><strong>What is forex trading Strategy</strong></li> <li><strong>What is Candlestick Strategy</strong></li> <li><strong>What is Fundamental Trading Strategy</strong></li> </ol> </div> <p> Pleas Note Video is Locked, it’s very easy to unlock video just click on any one like button to unlock the video </p> <br><br> <div> <iframe width="100%" height="315" src="https://www.youtube.com/embed/X9JClP-XMyc" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> @include('inc.footer') ======================= File: app/Models/AllCommentLikeModel.php ======================= <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class AllCommentLikeModel extends Model { protected $table = "all_comment_like"; protected $fillable = ["liked","userId","allCommentId"]; } ======================= File: app/Http/Controllers/FirstNavBarController.php ======================= <filename>app/Http/Controllers/FirstNavBarController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\FirstNavBarModel; use App\Models\TrashModel; class FirstNavBarController extends Controller { public function Index(Request $request){ $totalData = FirstNavBarModel::orderBy('id','desc')->where('trash',0)->get(); return view('admin.firstNav',compact('totalData')); } public function create(Request $request){ $data = new FirstNavBarModel; $data->iconName = $request->iconName; $data->link = $request->link; $data->save(); $success = "Your data has been saved successfully."; $request->session()->put("success",$success); $totalData = FirstNavBarModel::all(); return view('admin.firstNav',compact('totalData')); } public function delete(Request $request, $id){ $Trash = TrashModel::where('deleteId',$id)->where('category',"Navbar Icons")->first(); $Trash->delete(); $data = FirstNavBarModel::find($id); $data->delete(); $error = "Your data has been deleted successfully."; $request->session()->put("error",$error); return back(); } public function edit(Request $request, $id){ $data = FirstNavBarModel::find($id); $data->fill($request->all()); $data->save(); $success = "Your data has been updated successfully."; $request->session()->put("success",$success); return back(); } public function Trash(Request $request, $id){ $user = $request->session()->get("admin"); $data = FirstNavBarModel::find($id); $data->trash = 1; $data->save(); $Trash = new TrashModel; $Trash->adminTableId = $user->id; $Trash->trashItem = "firstNav"; $Trash->category = "Navbar Icons"; $Trash->deleteId = $id; $Trash->deleteTitle = $data->iconName; $Trash->save(); $error = "Your data has been deleted successfully."; $request->session()->put("error",$error); return back(); } public function TrashRestore(Request $request, $id){ $data = FirstNavBarModel::find($id); $data->trash = 0; $data->save(); $Trash = TrashModel::where('deleteId',$id)->where('category',"Navbar Icons")->first(); $Trash->delete(); $success = "Your data has been restore successfully."; $request->session()->put("success",$success); return back(); } } ======================= File: app/Http/Controllers/AnalysisController.php ======================= <?php namespace App\Http\Controllers; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Models\AnalysisModel; use App\Models\ClientNotificationModel; use App\Models\PusherModel; use App\Models\MetaTagsModel; use App\Models\MetaKeywordsModel; use App\Models\AllCommentsModel; class AnalysisController extends Controller { public function ViewAll(Request $request){ $meta = MetaTagsModel::where('name_page','Fundamental-Analysis')->first(); $Analysis = AnalysisModel::orderBy('id','desc')->where('status',1)->get(); return view('home.analysis.all',compact('Analysis','meta')); } public function ViewDetail(Request $request,$id){ $title = str_replace("-"," ",$id); $analysis = AnalysisModel::where('title',$title)->where('status',1)->first(); if ($analysis) { $name_page = "Analysis@". $analysis->id; $meta = MetaTagsModel::where('name_page',$name_page)->first(); $comments = AllCommentsModel::orderBy('id','desc')->where('commentPageId', 2)->where('objectId', $analysis->id)->get(); return view('home.analysis.view',compact('analysis','title','meta','comments')); }else { $error = "This url does not exit."; $request->session()->put("error",$error); return redirect("/"); } } // Admin Panel public function Index(Request $request){ $Analysis = AnalysisModel::orderBy('id','desc')->get(); return view('admin.analysis.all',compact('Analysis')); } public function Add(Request $request){ $newMeta = null; return view('admin.analysis.add',compact('newMeta')); } public function AddProcess(Request $request){ $data = $request->all(); if ($request->file("file_photo")!= null) { $path = $request->file("file_photo")->store("PostImages"); $Image = $path; } $description = htmlentities($request->editor1); $data['image'] = $Image; $data['detailDescription'] = $description; $news = new AnalysisModel; $news->fill($data); $news->save(); // meta Tags save start for ($i=0; $i < count($request->metaKeywords); $i++) { $find = MetaKeywordsModel::where('name',$request->metaKeywords[$i])->first(); if($find == null){ $key = new MetaKeywordsModel; $key->name = $request->metaKeywords[$i]; $key->save(); } } $newMeta = new MetaTagsModel; $newMeta->name_page = "Analysis@". $news->id; $newMeta->description = $news->description; $newMeta->title = $news->title; $newMeta->image = $news->image; $newMeta->keywordsimp = implode(",",$request->metaKeywords); $newMeta->save(); // meta Tags save end $success = "This analysis has been added successfully."; $request->session()->put("success",$success); // Pusher Notification Start $url = str_replace(" ", "-",$news->title); $adminData = $request->session()->get("admin"); $messageData['userId'] = $adminData['id']; $messageData['userType'] = 0; $messageData['message'] = "Added a New Analysis."; $messageData['link'] = "analysis". "/". $url; $clientNotification = new ClientNotificationModel; $clientNotification->fill($messageData); $clientNotification->save(); $messageData['id'] = $clientNotification->id; PusherModel::BoardCast("firstChannel1","firstEvent1",["message" => $messageData]); // Pusher Notification End return back(); } public function EditProcess(Request $request, $id){ $data = $request->all(); if ($request->file("file_photo")!= null) { $path = $request->file("file_photo")->store("PostImages"); $Image = $path; $data['image'] = $Image; } $description = htmlentities($request->editor1); $data['detailDescription'] = $description; $news = AnalysisModel::find($id); $news->fill($data); $news->save(); $success = "This analysis has been Updated successfully."; $request->session()->put("success",$success); // meta Tags save start for ($i=0; $i < count($request->metaKeywords); $i++) { $find = MetaKeywordsModel::where('name',$request->metaKeywords[$i])->first(); if($find == null){ $key = new MetaKeywordsModel; $key->name = $request->metaKeywords[$i]; $key->save(); } } $name_page = "Analysis@". $id; $newMeta = MetaTagsModel::where('name_page',$name_page)->first(); if($newMeta == null){ $newMeta = new MetaTagsModel; } $newMeta->name_page = "Analysis@". $id; $newMeta->description = $news->description; $newMeta->title = $news->title; $newMeta->image = $news->image; $newMeta->keywordsimp = implode(",",$request->metaKeywords); $newMeta->save(); // meta Tags save end // Pusher Notification Start $url = str_replace(" ", "-",$news->title); $adminData = $request->session()->get("admin"); $messageData['userId'] = $adminData['id']; $messageData['userType'] = 0; $messageData['message'] = "Edit a Analysis."; $messageData['link'] = "analysis". "/". $url; $clientNotification = new ClientNotificationModel; $clientNotification->fill($messageData); $clientNotification->save(); $messageData['id'] = $clientNotification->id; PusherModel::BoardCast("firstChannel1","firstEvent1",["message" => $messageData]); // Pusher Notification End return back(); } public function Edit(Request $request, $id){ $analysis = AnalysisModel::find($id); $name_page = "Analysis@". $id; $newMeta = MetaTagsModel::where('name_page',$name_page)->first(); return view('admin.analysis.add',compact('analysis','newMeta')); } public function Deactive(Request $request, $id){ $Analysis = AnalysisModel::find($id); $Analysis->status = 0; $Analysis->save(); $error = "This analysis has been deactive successfully."; $request->session()->put("error",$error); return back(); } public function Active(Request $request, $id){ $Analysis = AnalysisModel::find($id); $Analysis->status = 1; $Analysis->save(); $success = "This analysis has been active successfully."; $request->session()->put("success",$success); return back(); } } ======================= File: resources/views/errors/500.blade.php ======================= <!DOCTYPE html> <html lang="en"> <head> <title>Forexustaad Admin panel</title> <!-- Meta --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="description" content="" /> <meta name="keywords" content=""> <!-- Favicon icon --> <link rel="icon" href="{{URL::to('public/assets/assets/img/favicon.png')}}" type="image/x-icon"> <!-- vendor css --> <link rel="stylesheet" href="{{URL::to('public/assets/assets/css/style.css')}}"> </head> <!-- [ offline-ui ] start --> <div class="auth-wrapper maintance"> <div class="container"> <div class="row justify-content-center"> <div class="col-md-8"> <div class="text-center"> <!-- <img src="assets/images/maintance/404.png" alt="" class="img-fluid"> --> <div class=""> <img src="{{URL::to('public/assets/assets/img/404.png')}}" class="img-fluid h-75" alt=""> </div> <p align="center"> <a href="{{URL::to('/')}}">Go To Home Page</a> </p> </div> </div> </div> </div> </div> <!-- [ offline-ui ] end --> <!-- Required Js --> <script src="{{URL::to('public/assets/assets/js/vendor-all.min.js')}}"></script> <script src="{{URL::to('public/assets/assets/js/plugins/bootstrap.min.js')}}"></script> </body> </html> ======================= File: resources/views/pusherMessage.blade.php ======================= <gh_stars>0 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <h1>Listening my message</h1> <script src="https://js.pusher.com/7.0/pusher.min.js"></script> <script> // Enable pusher logging - don't include this in production Pusher.logToConsole = false; var pusher = new Pusher("{{env('PUSHER_APP_KEY')}}", { cluster: "{{env('PUSHER_APP_CLUSTER')}}" }); var channel = pusher.subscribe("{{$channel}}"); channel.bind("{{$event}}", function(data) { console.log((data)); }); </script> </body> </html> ======================= File: resources/views/htmlPages/become-successful-forex-trader.blade.php ======================= <filename>resources/views/htmlPages/become-successful-forex-trader.blade.php<gh_stars>0 @include ('inc/header') <!-- Content Area --> <div class="content_area"> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include('inc.home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> <div class="family"> <div> <h4>What is Forex and How To Become a Successful Forex Trader (Urdu/hindi)</h4> </div> <div class="post_representor"> <ul class=""> <li><i class="far fa-user"></i> <NAME></li> <li><i class="far fa-clock"></i> September 2, 2015</li> </ul> <div id="shareLink" align="right"></div> </div> <div class="pt-4"> <p> So far, we have talked about the Forex market, money management and candlestick signals and Trading strategy in our videos. In this video we will talk about the a plan to become a professional and successful Forex Trader. one thing is you know about the Forex market and trading techniques but to use what you know and make money is another thing. </p> <ol> <h4> <li>Decision:-</li> </h4> <p> Your first step should be making the decision seriously, whether you really want to become a Forex Trader and make money with it or not. It is on your decision that Forex Trading supposed to be you full time work for you in future, or you only want to give Forex Trading a try and see how it works. But if you don’t take it seriously results will not be serious either. </p> <h4> <li>Learning :-</li> </h4> <p> After a serious decision, your next step should be learn about the currency market and currency trading.Exactly what you should have to learn and from where you should learn to become a currency trader? </p> <p> i will not recommend You to read e-books or every articles on internet to learn just what is the currency market and where it is. The currency market is a market where we can trade the currencies against each other. </p> <p> It is where you can buy and sell currencies against each other easily. About the currency pairs, they created just for convenience of trader. As trader have to buy currency and pay another currency in against, so currencies are placed in pairs to make it easier. Example, EUR/USD is a currency pair. </p> <p> It is where you can buy and sell currencies against each other easily. About the currency pairs, they created just for convenience of trader. As trader have to buy currency and pay another currency in against, so currencies are placed in pairs to make it easier. Example, EUR/USD is a currency pair. </p> <p> Meta Trader is the common but most famous platform for trading. It is user-friendly and it is very useful to analyze the price charts and find the trade setups. Even if your broker is not supporting Meta Trader, you can still use the Meta Trader of any other broker to analyze the price charts, and use your broker’s platform only when you want to take a position. </p> <p> Next you need learn about the price chart and how it works. you have to know the different kinds of charts and time frames. </p> <h4> You have to learn the following things </h4> <ol> <li>Technical analysis. </li> <li>Fundamental analysis.</li> <li>Set the stop loss and target orders</li> <li>The patterns like head, shoulders, triangle, double bottoms and double top</li> <li>To calculate the position size, position risk and reward ratio</li> <li>The candlestick signals and patterns</li> <li>learning all these basic things from internet can take more then a week or two.</li> </ol> <p> After learning these basic things, you have to choose a trading system and start </p> <br> practicing it <br> <p> Best Forex Trading system is the simplest one. No need to choose complicated trading system. </p> <h4> <li>Demo Trading :-</li> </h4> <p> Your next step should be opening a demo trading account and start practicing on it. </p> <p> make sure you demo account size and leverage should be exactly the same as the live account you will have in future. Do not open demo account with $10,000 if your live account will be $1000 account. </p> <p> start trading on demo account for 3 months, if you gets success on the first month. Then try it for another one month with new demo account. If your 2nd month is also went positive again open a demo account with same size and try it for 3rd month. If you get constant 3 month success you are ready to rock and roll on the live trading account. </p> <p> For getting more confidence you can repeat this steps for another 3 months and judge yourself that whether you have control on your emotions or not, before opening live account. when you got full control you have mastered Forex Trading system and you are ready to go live </p> <div class="text-center"> <img src="{{URL::to('/public/assets/assets/img/blog-post/forex-vs-stocks-fight.jpg')}}" class="img-fluid"> </div> <h4> <li>Live Trading:-</li> </h4> <p> When you got success in 3 month demo trading and you are ready to open a live account. Make sure you are opening with the same size as the demo account was having. and you will have to take this live account as an other demo account. </p> <p> Make sure you opened this account with the money affordable to lose, otherwise you can have fear of losing money that will not let you act properly. </p> <p> You should trade on this Live account just like you trading on a demo account, without any fear or tension. </p> <p> Repeat your live trading success for 3 straight months. Prove to yourself that you can accurately follow your trading system without any facing any problem. </p> <p> You become a Real Forex Trader when you have trust and confidence in your heart.you can easily make money every month when you reach this point. </p> <p> After you reaching to this point successfully, just stick to your trading system and you Plan to keep making money, Don’t get sidetracked by anything. When you make money with your Forex Trading system, you should stick to it and don’t changed it. if you do so you will lose you money. </p> </ol> <br> <h5 class="text-center"> Watch Video about How To Become a Successful Forex Trader (Urdu/hindi) </h5> <div> <iframe width="100%" height="315" src="https://www.youtube.com/embed/6FokO8ntMvo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 order-3 order-lg-3"> @include('inc.home-right-sidebar') </div> </div> </div> </section> <!-- <div id="particles-js" style="height: 0;"></div> --> </div> @include('inc.footer') ======================= File: resources/views/home/index.blade.php ======================= @include ('inc/header') <div class="content_area"> <div class="banner_area"> <div class="container"> <div class="row"> <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 col-6 order-2 order-lg-1"> <div class="text-center"> @isset($MainLeftBanner) @if($MainLeftBanner->htmlLink == null ) <a href="{{$MainLeftBanner->link}}"> <img src="{{URL::to('/storage/app')}}/{{$MainLeftBanner->banner}}" width="160" height="600" alt="" /> </a> @else @php echo $MainLeftBanner->htmlLink; @endphp @endif @endisset </div> </div> <div class="col-lg-8 col-md-12 order-1 order-lg-2"> <div class="home-slider"> <div id="carouselExampleIndicators" class="carousel slide carousel-fade" data-ride="carousel" data-interval="100000"> <ol class="carousel-indicators"> @for($i=0; $i < count($SlidingImagesData); $i++) <li data-target="#carouselExampleIndicators" data-slide-to="{{$i}}" class="{{$i == 0? 'active' : ''}}"></li> <!-- <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> --> @endfor </ol> <div class="carousel-inner"> @php $activeSlidingImage = 1; @endphp @foreach($SlidingImagesData as $imageData) <div class="carousel-item {{$activeSlidingImage == 1? 'active' : ''}}"> <img src="{{URL::to('storage/app')}}/{{$imageData->image}}" class="d-block w-100 wow animated" alt="slide1" style="visibility: visible;"> <div class="carousel-caption d-flex slide1 last-slide"> <div class="row no-gutters w-100 slide_row"> <div class="col-lg-12"> <div class="slide_content text-md-left text-sm-left"> <h1><span class="highlight secondary-color">{{$imageData->title}}</h1> <p>{{$imageData->description}}</p> <a class="btn btn-primary btn-radial" href="{{$imageData->link}}" role="button">Learn More</a> </div> </div> </div> </div> @php $activeSlidingImage++; @endphp <div class="bannner-info"> <ul> <li> <a href="#">www.forexustaad.com</a> </li> <li> <a href="#">+44 7459065360</a> </li> <li> <a href="#"><EMAIL></a> </li> </ul> </div> </div> @endforeach </div> </div> </div> </div> <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6 col-6 order-3 order-lg-3"> <div class="text-center"> @isset($MainRightBanner) @if($MainRightBanner->htmlLink == null ) <a href="{{$MainRightBanner->link}}"> <img src="{{URL::to('/storage/app')}}/{{$MainRightBanner->banner}}" width="160" height="600" alt="" /> </a> @else @php echo $MainRightBanner->htmlLink; @endphp @endif @endisset </div> </div> </div> </div> </div> <!-- ticker rates add--> @if ($MainHomeApi!= null) <div class="ticker"> <div class="list-wrpaaer"> <ul id="marquee-horizontal"> <li class="list-ite"> @php echo $MainHomeApi->link @endphp </li> </ul> </div> </div> @endif <!-- /.End of tricker --> <section class="after_banner_content_area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-3 col-md-6 col-sm-12 order-2 order-lg-1"> @include ('inc/home-left-sidebar') </div> <div class="col-lg-6 col-md-12 order-1 order-lg-2"> @if($MidBannerHomeActive) <div class="mb-5"> <a href="{{$MidBannerHomeActive->link}}" target="_blank"> <img src="{{URL::to('storage/app')}}/{{$MidBannerHomeActive->image}}" width="100%"> </a> </div> @endif <section class="what-is"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-6 col-md-6 col-sm-6 col-12 order-2 order-sm-1"> <div class="content_area py-5"> <div class="content_area_heading"> <h1 class="heading_title wow animated fadeInUp"> Message From CEO </h1> <div class="heading_border wow animated fadeInUp"> <span class="two"></span><span class="three"></span> </div> </div> <div class="content_area_text wow animated fadeInUp"> <p> My Goal is to educate everyone about forex and help them reshape their future by teaching them how they can be financially in-depended and successful in life. </p> </div> </div> </div> <div class="col-lg-6 col-md-6 col-sm-6 text-center p-0 order-1 order-sm-2"> <div class="icon_area"> <img src="{{URL::to('/public/assets/assets/img/img-head.png')}}" class="wow animated fadeInUp"> </div> </div> </div> </div> </section> @if(Session::has('client') && count($featureVideos) > 0) <section class="news-slid features"> <div class="container"> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-12 order-2 order-sm-1"> <div style="margin:0px auto"> <section class="vid-main-wrapper clearfix"> <!-- THE YOUTUBE PLAYER --> <div class="vid-container"> <div class="fluid-width-video-wrapper" style="padding-top: 55%;"> @php echo $featureVideos[0]->embed; @endphp </div> </div> </section> <section id="extra wrapper" style="position: relative; padding-right: 44px; padding-left: 48px; background: #f6f6f6; height:152px;"> <!-- CUSTOM ARROWS --> <button title="Next" class="swiper-custom-next" style="position: absolute; padding: 10px 2px; right: 1px;top: 32%; display: inline-block;cursor: pointer;"> <svg style="position: relative; top: 1px;" xmlns="" width="16" height="16" viewBox="0 0 16 16"><g class="nc-icon-wrapper" fill="#111111"><polygon fill="#111111" points="4.9,15.7 3.4,14.3 9.7,8 3.4,1.7 4.9,0.3 12.6,8 "></polygon></g></svg> </button> <button title="Prev" class="swiper-custom-prev" style="position: absolute; padding: 10px 2px; left: 2px; top: 35%; display: inline-block;cursor: pointer;font-size: 15px;"> <svg xmlns="" width="16" height="16" viewBox="0 0 16 16"><g class="nc-icon-wrapper" fill="#111111"><polygon fill="#111111" points="11.1,15.7 3.4,8 11.1,0.3 12.6,1.7 6.3,8 12.6,14.3 "></polygon></g></svg> </button> <!-- Swiper --> <nav class="swiper-container swiper-container-videos slider-produtos-destaque" style="top: 8px;"> <ol class="swiper-wrapper" style="list-style-type: none; padding: 0px;"> @foreach($featureVideos as $video) @php $replceString = str_replace("\"","dsa-a",$video->embed); $explode5 = explode("dsa-a",$replceString); @endphp <li class="swiper-slide" style="width: 130px;"> <a class="" href="javascript:void();" onClick="document.getElementById('vid_frame').src='{{$explode5[5]}}'"> <span class="vid-thumb"> <img src="{{URL::to('storage/app')}}/{{$video->thumbnail}}" style="width: 120px;height: 90px;"/> </span> <p class="desc">{{$video->name}}</p> </a> </li> @endforeach </ol> </nav> </section> </div> </div> </div> </div> </section> @endif @php $dataSignalsCount = 0; @endphp @foreach($StarSignalsHome as $data) @php $dataSignalsCount++ @endphp @if($dataSignalsCount == 1) <section class="features"> <div class="container"> <div class="content_area_heading large-heading text-center"> <h1 class="heading_title wow animated fadeInUp"> Latest Signals </h1> <div class="heading_border wow animated fadeInUp"> <span class="one"></span><span class="two"></span><span class="three"></span> </div> </div> <div class="row justify-content-center"> @endif @php $url = $data->GetURL(); $loginClientData = Session::get('client'); $go = 1; $go3 = 1; $profits = explode('@',$data->takeProfit); $time1 = strtotime($data->time); $time = date('h:i A', $time1); $date1 = strtotime($data->date); $date = date('d M Y', $date1); if($data->date == date("Y-m-d")){ if($data->time >= date("H:i:s")){ $go = 0; $go3 = 3; } } if($data->date > date("Y-m-d")){ $go = 0; $go3 = 3; } $timeDate1 = strtotime(date("Y-m-d H:i:s")); $timeDate2 = strtotime($data->created_at->format("Y-m-d H:i:s")); $minsDate = ($timeDate1 - $timeDate2) / 60; $pair = $data->getPair(); $flags = explode("/",$pair->pair); @endphp @if($go == 0) <div class="col-xl-4 col-lg-6 col-md-7 col-sm-8 col-12 h-100"> <div class="features_inner text-center wow animated fadeInLeft"> <div class="services_wrapper"> <div class=""> <div class="services_icon"> @if($pair->image == null) @foreach($flags as $flag) @php $flag4 = str_replace(' ', '', $flag) @endphp <img src="{{URL::to('storage/app/signalFlag')}}/{{$flag4}}.jpg" width="50" height="35" alt=""> &nbsp;&nbsp; @endforeach @else <img src="{{URL::to('storage/app')}}/{{$pair->image}}" width="100" height="35" alt=""> @endif </div> </div> <div class="feature_content"> <h3 class="content_title"> {{$pair->pair}} <br> {{$data->selectUser}} <br> @if($go == 0) @if($data->selectUser == "Register User" &&!Session::has('client')) <a href="#!" class="LoginButton" data-toggle="modal" data-target="#requestQuoteModal">View Signal</a> @elseif($data->selectUser == "VIP Member") @if(!Session::has('client')) <a href="#!" class="LoginButton" data-toggle="modal" data-target="#requestQuoteModal">View Signal</a> @elseif(isset($loginClientData->memberType)) @if($loginClientData->memberType == 1) <a href="#!" onclick="snackbar1()">View Signal</a> @else <a href="{{URL::to('signal')}}/{{$url}}">View Signal</a> @endif @endif @else <a href="{{URL::to('signal')}}/{{$url}}">View Signal</a> @endif @endif </h3> </div> </div> </div> </div> @endif @if(count($StarSignalsHome) == $dataSignalsCount ) </div> </div> </section> @endif @endforeach <section class="mt-4"> <div class="row"> <div class="col-sm-12"> @foreach($AllHomeApi as $TopApi) @if($TopApi->area == "Top") @if($TopApi->id!= $MainHomeApi->id) @php echo $TopApi->link @endphp @endif @endif @endforeach </div> </div> </section> @if(count($LatestBlogsData) > 0) <section class="our_news"> <div class="container"> <div class="row"> <div class="col-sm-12"> <div class="news_us"> <div class="content_area_heading large-heading text-center"> <h1 class="heading_title wow animated fadeInUp"> Our Latest News </h1> <div class="heading_border wow animated fadeInUp"> <span class="one"></span><span class="two"></span><span class="three"></span> </div> </div> </div> </div> <div class="col-sm-12"> <div class="news_responsive news_slider bullet_style wow animated fadeInUp"> @foreach ($LatestBlogsData as $value) @php $category = $value->GetCategory(); $go = 1; if($value->publishDate == date("Y-m-d")){ if($value->publishTime >= date("H:i:s")){ $go = 0; } } $paymentDate = date('Y-m-d'); $paymentDate=date('Y-m-d', strtotime($paymentDate)); //echo $paymentDate; // echos today! $contractDateBegin = date('Y-m-d', strtotime($value->publishDate)); @endphp @if($go == 1) @if($paymentDate >= $contractDateBegin) <div class="slide position-relative news"> <div class="new_img"> <img src="{{URL::to('storage/app')}}/{{$value->image}}"> </div> <div class="new_description-details"> <h6> <a href="{{URL::to('/Post')}}/{{$value->permalink}}"> {{$value->mainTitle}} </a> </h6> <p> {{$value->description}} </p> </div> </div> @endif @endif @endforeach </div> <div class="new_btn text-right wow animated fadeInUp"> <a href="{{URL::to('/blog-post.html')}}">Show More News <i class="fa fa-chevron-right"></i></a> </div> </div> </div> </div> </section> @endif @if(count($LatestFundamental) > 0) <section class="analysis"> <div class="container"> <div class="content_area_heading large-heading text-center"> <h1 class="heading_title wow animated fadeInUp"> Fundamental History </h1> <div class="heading_border wow animated fadeInUp"> <span class="one"></span><span class="two"></span><span class="three"></span> </div> </div> <div class="row"> @foreach ($LatestFundamental as $fundamental) @php $url = str_replace(" ","-",$fundamental->title); $admin = $fundamental->GetAdminMember(); @endphp <div class="col-md-6"> <div class="media"> <img class="mr-3" src="{{URL::to('storage/app')}}/{{$fundamental->image}}" alt="Generic placeholder image"> <div class="media-body"> <p class="date m-0">{{$fundamental->created_at->format('M d, Y')}}</p> <h6 class="m-0"><a href="{{URL::to('/fundamental')}}/{{$url}}">{{$fundamental->title}}</a></h6> <p class="m-0 nameby">{{$admin->username}}</p> </div> </div> </div> @endforeach </div> </div> </section> @endif @if(count($LatestAnalysis) > 0) <section class="analysis"> <div class="container"> <div class="content_area_heading large-heading text-center"> <h1 class="heading_title wow animated fadeInUp"> Analysis & Opinion </h1> <div class="heading_border wow animated fadeInUp"> <span class="one"></span><span class="two"></span><span class="three"></span> </div> </div> <div class="row"> @foreach($LatestAnalysis as $data) @php $url = str_replace(" ","-",$data->title); @endphp <div class=" col-sm-12 col-md-6"> <div class="wow animated fadeInUp mt-1 bg-light"> <div class="container-fluid "> <div class="row"> <div class="col-sm-12 "> <div class="new_description-details"> <h6> <a href="{{URL::to('analysis')}}/{{$url}}"> {{$data->title}} </a> </h6> <p> {{$data->description}} <a href="{{URL::to('analysis')}}/{{$url}}">Learn more</a> </p> </div> </div> </div> </div> <div class="re_img w-100 p-4"> <a href="{{URL::to('analysis')}}/{{$url}}"> <img src="{{URL::to('/storage/app')}}/{{$data->image}}" width="100%" height="125px" > </a> </div> </div> </div> @endforeach </div> </div> </section> @endif <!-- education Tabs --> <section> <div class="row"> <div class="col-md-12"> <ul class="nav nav-tabs" id="myTab" role="tablist"> <li class="nav-item"> <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Basic Training</a> </li> @if(Session::has('client')) <li class="nav-item"> <a class="nav-link" id="advance-tab" data-toggle="tab" href="#advance" role="tab" aria-controls="advance" aria-selected="false">Advance Training</a> </li> @endif <li class="nav-item"> <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact" aria-selected="false">Habbit Training</a> </li> </ul> <div class="tab-content" id="myTabContent"> <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab"> <div id="catab9" class="cat-tabs-wrap cat-tabs-wrap1" style="display: block;"> <div> <ul> @php $icount = 0 @endphp @foreach($LatestBasicTraining as $basic) @php $title = str_replace(' ','-',$basic->title); $img12 = $basic->embed; $img123 = explode ("/",$img12); if(isset($img123[4])){ $img1234 = explode (" ",$img123[4]); $img12345 = strlen($img1234[0]); $img123456 = substr($img1234[0],0,--$img12345); $img123456 = "http://i.ytimg.com/vi/". $img123456. "/hqdefault.jpg"; }else if($basic->thumbnail!= null){ $img123456 = URL::to('storage/app'). '/'. $basic->thumbnail; }else{ $img123456 = null; } $icount++ @endphp @if($icount == 1) <li class="first-news"> <div class="post-thumbnail tie-appear"> <a href="{{URL::to('/Basic')}}/{{$title}}" rel="bookmark"> <img width="310" height="165" src="{{$img123456}}" class="attachment-tie-medium size-tie-medium wp-post-image tie-appear" alt="" loading="lazy"> <span class="fa overlay-icon"></span> </a> </div> <h2 class="post-box-title"><a href="{{URL::to('/Basic')}}/{{$title}}" rel="bookmark">{{$basic->title}}</a></h2> <p class="post-meta"> <span title="Nice" class="post-single-rate post-small-rate stars-small"> <span style="width: 78.571428571429%"></span> </span> <span class="tie-date">{{$basic->created_at->format('M d,Y
66,066
thestackv1_concat_by_repo-long/65536-65536
Repo: VoQuocViet/megafashion ======================= File: public/mega/module/content.php ======================= <div class="container"> <div class="row"> <div class="std"> <div class="best-pro col-lg-12"> <div class="slider-items-products"> <div class="new_title center"> <h2>Best sellers</h2> </div> <div id="best-seller-slider" class="product-flexslider hidden-buttons"> <div class="slider-items slider-width-col4"> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product1.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"> <span> Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price" id="product-price-1"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product2.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="grid.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:0%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price" id="old-price-2"> $567.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price" id="product-price-2"> $456.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product3.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="grid.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:20%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price"> $167.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price"> $99.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="grid.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> <strong></strong> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product5.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="grid.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:0%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$225.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product4.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="grid.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product6.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="grid.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> </div> </div> </div> </div> <div class="featured-pro col-lg-12"> <div class="slider-items-products"> <div class="new_title center"> <h2>Featured Products</h2> </div> <div id="featured-slider" class="product-flexslider hidden-buttons"> <div class="slider-items slider-width-col4"> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product17.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="grid.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product2.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="grid.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:0%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price"> $567.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price"> $456.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product13.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="grid.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:20%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price"> $167.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price"> $99.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> <strong></strong> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product3.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="grid.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:0%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$225.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product9.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="grid.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product19.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="grid.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> </div> </div> </div> </div> </div> </div> </div> ======================= File: application/views/mega/home/detail.php ======================= <!DOCTYPE html> <html lang="en"> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack --> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="google-site-verification" content="9mwgXr3AkgEIeolSvfLX3OIZ3MVPpRZtV9cbnfdTkHM" /> <meta name="description" content="Biệt thự nghỉ dưỡng Lê Hoàng đem đến cho gia đình bạn những phút giây bên nhau GẮN KẾT YÊU THƯƠNG – NÂNG TẦM HẠNH PHÚC." /> <meta name="keywords" content="Shop thời trang, Khách sạn Đà Lạt, Đà Lạt Hotel, Đà Lạt Villa, Khách sạn trung tâm Đà Lạt, Đặt phòng Đà Lạt, Khách sạn tại Đà Lạt" /> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/style.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/bootstrap.min.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/slider.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/owl.carousel.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/owl.theme.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/flexslider.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/font-awesome.css" type="text/css"> <link href='https://fonts.googleapis.com/css?family=Bitter:400,700,400italic' rel='stylesheet' type='text/css'> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> <!-- Favicons Icon --> <link rel="icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> <script src="<?php echo public_url()?>/mega/bootstrap/dist/js/bootstrap.js"></script> <script src="<?php echo public_url()?>/mega/js/jquery.js"></script> <script> jQuery(document).ready(function($) { //selector đến menu cần làm việc var TopFixMenu = $("#nav1"); // dùng sự kiện cuộn chuột để bắt thông tin đã cuộn được chiều dài là bao nhiêu. $(window).scroll(function() { // Nếu cuộn được hơn 150px rồi if($(this).scrollTop()>100) { // Tiến hành show menu ra TopFixMenu.show(); } // Ngược lại, nhỏ hơn 150px thì hide menu đi. else { TopFixMenu.show(); } } ) $(window).resize(function(){ if($(window).width() < 768 ) { $('.slider-intro').hide(); } else { $('.slider-intro').show(); }; }); }) </script> <title>Thời Trang Trẻ| <?php echo $product->name?></title> <link rel="icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> </head> <body class="cms-index-index"> <div class="page"> <!-- Header --> <header class="header-container"> <?php $this->load->view('mega/header');?> </header> <!-- end header --> <!-- Navbar --> <nav> <?php $this->load->view('mega/menu')?> </nav> <!-- end nav --> <!-- end breadcrumbs --> <div class="breadcrumbs"> <div class="container"> <div class="row"> <ul> <li class="home"> <a href="<?php echo mega_url('home');?>" title="Go to Home Page">Home</a><span>&raquo;</span></li> <li class=""> <a href="" title="Go to Home Page"> <?php foreach ($list as $row):?> <?php if($product->catalog_id == $row->id )?> <?php echo $row->name?> <?php endforeach;?> </a><span>&raquo;</span> </li> <li class="category13"><strong> <?php echo $product->name?> </strong></li> </ul> </div> </div> </div> <!-- end breadcrumbs --> <!-- main-container --> <section class="main-container col1-layout"> <div class="main container"> <div class="col-main"> <div class="row"> <div class="product-view"> <div class="product-essential"> <form action="#" method="post" id="product_addtocart_form"> <input name="form_key" value="<KEY>" type="hidden"> <div class="product-img-box col-sm-4 col-xs-12"> <div class="new-label new-top-left"> New </div> <div class="product-image"> <div class="large-image"> <a href="<?php echo public_url()?>/mega/products-images/product4.jpg" class="cloud-zoom" id="zoom1" rel="useWrapper: false, adjustY:0, adjustX:20"> <img alt="product-image" src="<?php echo base_url()?>/upload/product/<?php echo $product->image_link?>"> </a> </div> <div class="flexslider flexslider-thumb"> <ul class="previews-list slides"> <li><a href='<?php echo base_url()?>/upload/product/<?php echo $product->image_link?>' class='cloud-zoom-gallery' rel="useZoom: 'zoom1', smallImage: '<?php echo base_url()?>/upload/product/<?php echo $product->image_link?>' "><img src="<?php echo base_url()?>/upload/product/<?php echo $product->image_link?>" alt="Thumbnail 1"/></a></li> <li><a href='<?php echo public_url()?>/mega/products-images/product10.jpg' class='cloud-zoom-gallery' rel="useZoom: 'zoom1', smallImage: '<?php echo public_url()?>/mega/products-images/product10.jpg' "><img src="<?php echo public_url()?>/mega/products-images/product10.jpg" alt="Thumbnail 2"/></a></li> <li><a href='<?php echo public_url()?>/mega/products-images/product3.jpg' class='cloud-zoom-gallery' rel="useZoom: 'zoom1', smallImage: '<?php echo public_url()?>/mega/products-images/product3.jpg' "><img src="<?php echo public_url()?>/mega/products-images/product3.jpg" alt="Thumbnail 1"/></a></li> <li><a href='<?php echo public_url()?>/mega/products-images/product4.jpg' class='cloud-zoom-gallery' rel="useZoom: 'zoom1', smallImage: '<?php echo public_url()?>/mega/products-images/product4.jpg' "><img src="<?php echo public_url()?>/mega/products-images/product4.jpg" alt="Thumbnail 2"/></a></li> <li><a href='<?php echo public_url()?>/mega/products-images/product5.jpg' class='cloud-zoom-gallery' rel="useZoom: 'zoom1', smallImage: '<?php echo public_url()?>/mega/products-images/product5.jpg' "><img src="<?php echo public_url()?>/mega/products-images/product5.jpg" alt="Thumbnail 2"/></a></li> </ul> </div> </div> <!-- end: more-images --> <div class="clear"></div> </div> <div class="product-shop col-sm-5 col-xs-12"> <div class="product-next-prev"> <a class="product-next" href="#"><span></span></a> <a class="product-prev" href="#"><span></span></a> </div> <div class="product-name"> <h1><?php echo $product->name?></h1> </div> <div class="short-description"> <p> <?php echo $product->meta_desc?> </p> </div> <div class="ratings"> <div class="rating-box"> <div style="width:60%" class="rating"></div> </div> <p class="rating-links"> <a href="#"><?php echo $product->view?> Review(s)</a> <span class="separator">|</span> <a href="#">Add Your Review</a> </p> </div> <p class="availability in-stock">Availability: <span>In Stock</span></p> <div class="price-block"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price"> $<?php echo $product->price?> </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price"> <?php echo $product->price- $product->discount?> </span> </p> </div> </div> <div class="add-to-box"> <div class="add-to-cart"> <label>Qty :</label> <select> <option>1</option> <option>2 </option> <option>3</option> <option>4</option> <option>5 </option> <option>6</option> <option>7</option> <option>8 </option> <option>9</option> <option>10</option> </select> </div> <button type="button" title="Add to Cart" class="button btn-cart" onClick="productAddToCartForm.submit(this)"><span>Add to Cart</span></button> </div> <div class="email-addto-box"> <p class="email-friend"><a href="#" data-toggle="tooltip" data-placement="top" data-original-title="Email to a Friend"><span></span></a></p> <ul class="add-to-links"> <li><span class="separator">|</span> <a class="link-compare" href="compare.php" data-toggle="tooltip" data-placement="top" data-original-title="Add to Compare"></a></li> <li> <a class="link-wishlist" href="wishlist.php" data-toggle="tooltip" data-placement="top" data-original-title="Add to Wishlist"></a></li> </ul> </div> <div class="toggle-content"> <div class="toggle toggle-white"> <h4 class="trigger"><a href="#">Product Description</a></h4> <div style="display: none;" class="toggle_container tabcontent"> <div class="std"> <p><?php echo $product->content?><span class="read-more">… <a href="#">read more</a></span></p> <dl class="specs-table"> <dt>Detailing</dt> <dd>Clean and polish leather shoes regularly with quality shoe care products </dd> <dt>Fabric</dt> <dd>Leather leather shoes regularly with quality shoe care products. leather shoes regularly with quality shoe care products</dd> <dt>Care</dt> <dd>Clean and polish leather shoes regularly with quality shoe care products. Cushioned with Nike Lunarlon Technology for ultimate comfort</dd> </dl> <p>The perfect mix of portability and performance in a slim 1" form factor:</p> <p>Triangular shaped backpack/ shoulder bag with front zip open and croc textured finish. </p> <p>Made from water-repellent Squall fabric, this is one tough travel bag. The efficient bag sports a cushioned shoulder strap for carrying ease. With an exterior pocket running the length of the front and secure zipper closure. 100% nylon with polyester base. Spot clean. Imported.</p> </div> </div> </div> <div class="toggle toggle-white"> <h4 class="trigger"><a href="#">Additional Information</a></h4> <div style="display: none;" class="toggle_container "> <p>Triangular shaped backpack/ shoulder bag with front zip open and croc textured finish. </p> <p>Made from water-repellent Squall fabric, this is one tough travel bag. The efficient bag sports a cushioned shoulder strap for carrying ease. With an exterior pocket running the length of the front and secure zipper closure. 100% nylon with polyester base. Spot clean. Imported. </p> </div> </div> <div class="toggle toggle-white"> <h4 class="trigger"><a href="#">Product Tags</a></h4> <div style="display: none;" class="toggle_container "> <div class="box-collateral box-tags"> <div class="tags"> <div id="addTagForm"> <div class="form-add-tags"> <label for="productTagName">Add Tags:</label> <div class="input-box"> <input class="input-text required-entry" name="productTagName" id="productTagName" type="text"> <button type="button" title="Add Tags" class=" button btn-add" onClick="submitTagForm()"> <span>Add Tags</span> </button> </div> <!--input-box--> </div> </div> </div> <!--tags--> <p class="note">Use spaces to separate tags. Use single quotes (') for phrases.</p> </div> </div> </div> <div class="toggle toggle-white"> <h4 class="trigger"><a href="#">Custom Tab</a></h4> <div style="display: none;" class="toggle_container "> <p><strong>Lorem Ipsum</strong><span>&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span></p> </div> </div> </div> </div> <div class="product-img-box col-sm-3 col-xs-12"> <div class="product-additional"><span class="product-additional"><img alt="custom block" src="images/offer-banner5.png"></span></div> </div> </form> <!-- related Product Slider --> <div class="product-collateral"> <!-- related Product Slider --> <section class="related-pro"> <div class="slider-items-products"> <div class="new_title center"> <h2>Related Products</h2> </div> <div id="related-products-slider" class="product-flexslider hidden-buttons"> <div class="slider-items slider-width-col4 products-grid"> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product1.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price" id="product-price-1"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product3.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:0%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price" id="old-price-2"> $567.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price" id="product-price-2"> $456.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product4.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:20%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price"> $167.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price"> $99.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> <strong></strong> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product5.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:0%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$225.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product5.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product1.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> </div> </div> </div> </section> <!-- related Product Slider End --> <!-- Upsell Product Slider --> <section class="upsell-pro"> <div class="slider-items-products"> <div class="new_title center"> <h2>Upsell Products</h2> </div> <div id="upsell-products-slider" class="product-flexslider hidden-buttons"> <div class="slider-items slider-width-col4 products-grid"> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product2.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product6.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:0%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price"> $567.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price"> $456.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product4.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:20%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price"> $167.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price"> $99.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> <strong></strong> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product2.jpg" alt="Sample Product"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:0%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$225.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product10.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <div class="col-item"> <div class="item-inner"> <div class="item-img"> <div class="new-label new-top-left">New</div> <div class="item-img-info"> <a href="#" title="Sample Product" class="product-image"> <img src="<?php echo public_url()?>/mega/products-images/product3.jpg" alt="Sample Product"> </a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:80%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price" > <span class="price">$125.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </div> <!-- End Item --> </div> </div> </div> </section> <!-- Upsell Product Slider End --> </div> </div> </div> <div class="box-collateral box-reviews" id="customer-reviews"> <div class="page-title"> <h2>Reviews</h2> </div> <div class="box-reviews1"> <div class="form-add"> <form id="review-form" method="post" action="http://www.magikcommerce.com/review/product/post/id/176/"> <h3>Write Your Own Review</h3> <fieldset> <h4>How do you rate this product? <em class="required">*</em></h4> <span id="input-message-box"></span> <table id="product-review-table" class="data-table"> <colgroup> <col> <col> <col> <col> <col> <col> </colgroup> <thead> <tr class="first last"> <th>&nbsp;</th> <th><span class="nobr">1 *</span></th> <th><span class="nobr">2 *</span></th> <th><span class="nobr">3 *</span></th> <th><span class="nobr">4 *</span></th> <th><span class="nobr">5 *</span></th> </tr> </thead> <tbody> <tr class="first odd"> <th>Price</th> <td class="value"><input type="radio" class="radio" value="11" id="Price_1" name="ratings[3]"></td> <td class="value"><input type="radio" class="radio" value="12" id="Price_2" name="ratings[3]"></td> <td class="value"><input type="radio" class="radio" value="13" id="Price_3" name="ratings[3]"></td> <td class="value"><input type="radio" class="radio" value="14" id="Price_4" name="ratings[3]"></td> <td class="value last"><input type="radio" class="radio" value="15" id="Price_5" name="ratings[3]"></td> </tr> <tr class="even"> <th>Value</th> <td class="value"><input type="radio" class="radio" value="6" id="Value_1" name="ratings[2]"></td> <td class="value"><input type="radio" class="radio" value="7" id="Value_2" name="ratings[2]"></td> <td class="value"><input type="radio" class="radio" value="8" id="Value_3" name="ratings[2]"></td> <td class="value"><input type="radio" class="radio" value="9" id="Value_4" name="ratings[2]"></td> <td class="value last"><input type="radio" class="radio" value="10" id="Value_5" name="ratings[2]"></td> </tr> <tr class="last odd"> <th>Quality</th> <td class="value"><input type="radio" class="radio" value="1" id="Quality_1" name="ratings[1]"></td> <td class="value"><input type="radio" class="radio" value="2" id="Quality_2" name="ratings[1]"></td> <td class="value"><input type="radio" class="radio" value="3" id="Quality_3" name="ratings[1]"></td> <td class="value"><input type="radio" class="radio" value="4" id="Quality_4" name="ratings[1]"></td> <td class="value last"><input type="radio" class="radio" value="5" id="Quality_5" name="ratings[1]"></td> </tr> </tbody> </table> <input type="hidden" value="" class="validate-rating" name="validate_rating"> <div class="review1"> <ul class="form-list"> <li> <label class="required" for="nickname_field">Nickname<em>*</em></label> <div class="input-box"> <input type="text" class="input-text required-entry" id="nickname_field" name="nickname"> </div> </li> <li> <label class="required" for="summary_field">Summary<em>*</em></label> <div class="input-box"> <input type="text" class="input-text required-entry" id="summary_field" name="title"> </div> </li> </ul> </div> <div class="review2"> <ul> <li> <label class="label-wide" for="review_field">Review<em class="required">*</em></label> <div class="input-box"> <textarea class="required-entry" rows="3" cols="5" id="review_field" name="detail"></textarea> </div> </li> </ul> <div class="buttons-set"> <button class="button submit" title="Submit Review" type="submit"><span>Submit Review</span></button> </div> </div> </fieldset> </form> </div> </div> <div class="box-reviews2"> <h3>Customer Reviews</h3> <div class="box visible"> <ul> <li> <table class="ratings-table"> <colgroup> <col> <col> </colgroup> <tbody> <tr> <th>Value</th> <td><div class="rating-box"> <div class="rating" style="width:100%;"></div> </div></td> </tr> <tr> <th>Quality</th> <td><div class="rating-box"> <div class="rating" style="width:100%;"></div> </div></td> </tr> <tr> <th>Price</th> <td><div class="rating-box"> <div class="rating" style="width:100%;"></div> </div></td> </tr> </tbody> </table> <div class="review"> <h6><a href="#/catalog/product/view/id/61/">Excellent</a></h6> <small>Review by <span><NAME> </span>on 1/3/2014 </small> <div class="review-txt"> I have purchased shirts from Minimalism a few times and am never disappointed. The quality is excellent and the shipping is amazing. It seems like it's at your front door the minute you get off your pc. I have received my purchases within two days - amazing.</div> </div> </li> <li class="even"> <table class="ratings-table"> <colgroup> <col> <col> </colgroup> <tbody> <tr> <th>Value</th> <td><div class="rating-box"> <div class="rating" style="width:100%;"></div> </div></td> </tr> <tr> <th>Quality</th> <td><div class="rating-box"> <div class="rating" style="width:100%;"></div> </div></td> </tr> <tr> <th>Price</th> <td><div class="rating-box"> <div class="rating" style="width:80%;"></div> </div></td> </tr> </tbody> </table> <div class="review"> <h6><a href="#/catalog/product/view/id/60/">Amazing</a></h6> <small>Review by <span><NAME></span>on 1/3/2014 </small> <div class="review-txt"> Minimalism is the online! </div> </div> </li> </ul> </div> <div class="actions"> <a class="button view-all" id="revies-button"><span><span>View all</span></span></a> </div> </div> <div class="clear"></div> </div> </div> </div> </div> </section> <!-- End Two columns content --> <div class="brand-logo "> <div class="container"> <div class="row"> <div class="slider-items-products col-lg-12"> <div id="brand-logo-slider" class="product-flexslider hidden-buttons"> <div class="slider-items slider-width-col6"> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo1.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo2.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo3.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo4.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo5.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo6.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo1.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo4.png" alt="Image"></a> </div> <!-- End Item --> </div> </div> </div> </div> </div> </div> <!-- Footer --> <footer class="footer"> <div class="footer-middle"> <div class="container"> <div class="row"> <div class="col-lg-3 col-md-4 col-sm-4 col-xs-12"> <div class="footer-logo"><a href="index.php" title="Logo"><img src="images/logo.png" alt="logo"></a></div> <address> <i class="add-icon">&nbsp;</i>123 Main Street, Anytown, <br> &nbsp;CA 12345 USA </address> <div class="phone-footer"><i class="phone-icon">&nbsp;</i> +1 800 123 1234</div> <div class="email-footer"><i class="email-icon">&nbsp;</i> <a href="mailto:<EMAIL>"><EMAIL></a> </div> </div> <div class="col-lg-2 col-md-4 col-sm-4 col-xs-12"> <h4>Shopping Guide</h4> <ul class="links"> <li class="first"><a href="#" title="How to buy">How to buy</a></li> <li><a href="faq.php" title="FAQs">FAQs</a></li> <li><a href="#" title="Payment">Payment</a></li> <li><a href="#" title="Shipment&lt;/a&gt;">Shipment</a></li> <li><a href="#" title="Where is my order?">Where is my order?</a></li> <li class="last"><a href="#" title="Return policy">Return policy</a></li> </ul> </div> <div class="col-lg-2 col-md-4 col-sm-4 col-xs-12"> <h4>Style Advisor</h4> <ul class="links"> <li class="first"><a href="login.php" title="Your Account">Your Account</a></li> <li><a href="#" title="Information">Information</a></li> <li><a href="#" title="Addresses">Addresses</a></li> <li><a href="#" title="Addresses">Discount</a></li> <li><a href="#" title="Orders History">Orders History</a></li> <li class="last"><a href="#" title=" Additional Information">Additional Information</a></li> </ul> </div> <div class="col-lg-2 col-md-4 col-sm-3 col-xs-12"> <h4>Information</h4> <ul class="links"> <li class="first"><a href="sitemap.php" title="Site Map">Site Map</a></li> <li><a href="#/" title="Search Terms">Search Terms</a></li> <li><a href="#" title="Advanced Search">Advanced Search</a></li> <li><a href="contact_us.php" title="Contact Us">Contact Us</a></li> <li><a href="#" title="Suppliers">Suppliers</a></li> <li class=" last"><a href="#" title="Our stores" class="link-rss">Our stores</a></li> </ul> </div> <div class="col-lg-3 col-md-8 col-sm-9 col-xs-12"> <div class="block-subscribe"> <h4>Sign up for emails</h4> <div class="newsletter"> <form> <input type="text" placeholder="Enter your email" class="input-text required-entry validate-email" title="Sign up for our newsletter" id="newsletter1" name="email"> <button class="subscribe" title="Subscribe" type="submit"><span>Submit</span></button> </form> </div> </div> <div class="social"> <h4>Follow Us</h4> <ul> <li class="fb"><a href="#"></a></li> <li class="tw"><a href="#"></a></li> <li class="googleplus"><a href="#"></a></li> <li class="rss"><a href="#"></a></li> <li class="pintrest"><a href="#"></a></li> <li class="linkedin"><a href="#"></a></li> <li class="youtube"><a href="#"></a></li> </ul> </div> </div> </div> </div> </div> <div class="footer-bottom"> <div class="container"> <div class="row"> <div class="col-sm-4 col-xs-12 coppyright"> &copy; 2015 Magikcommerce. All Rights Reserved.</div> <div class="col-sm-8 col-xs-12 company-links"> <ul class="links"> <li><a href="#" title="Magento Themes">Magento Themes</a></li> <li><a href="#" title="Premium Themes">Premium Themes</a></li> <li><a href="#" title="Responsive Themes">Responsive Themes</a></li> <li class="last"><a href="#" title="Magento Extensions">Magento Extensions</a></li> </ul> </div> </div> </div> </div> </footer> <!-- End Footer --> </div> <div class="help_slider"> <div class="text alignleft">Need Help?</div> <div class="icons"> <a class="show_hide" id="questionbox-side-phonebutton" href="javascript:void(0)"><i class="icon-phones">&nbsp;</i></a> <a class="show_hide1" id="questionbox-side-emailbutton" href="javascript:void(0)"><i class="icon-email">&nbsp;</i></a> </div> </div> <div id="hideShow" class="right-side-content" style="display: none;"> <!--Contact Static Block --> <div class="slider-phone active"> <h2 class="">Talk To Us</h2> <h3 class="">Available 24/7</h3> <p class="textcenter"> Want to speak to someone? We're here 24/7 to answer any questions. Just call!<br> <br> <span class="phone-number"> +1 800 123 1234</span></p> <a id="hideDiv" class="slider-close" href="javascript:void(0)"></a> </div> <div class="slider-email hidden"> <h2 class="">Let us know how we can help you.</h2> <form action="#" enctype="application/x-www-form-urlencoded" method="post" id="form-contact-help_slider"> <div class="column sixty"> <div class=""> <ul> <li> <label>First Name</label> <input type="text" name="FirstName" class="required-entry"> <div class="clearfix"></div> </li> <li> <label>Last Name</label> <input type="text" name="LastName" class="required-entry"> <div class="clearfix"></div> </li> <li> <label>Email Address</label> <input type="email" name="Email" class="required-entry"> <div class="clearfix"></div> </li> <li> <label>Phone Number</label> <input type="text" name="Phone"> <div class="clearfix"></div> </li> </ul> </div> </div> <div class="column fourty last"> <div class="padding"> <textarea name="Contact_Form_Message__c" class="required-entry">How can we help you?</textarea> <div class="textright"> <button class="button btn-sent" title="Add to Cart" type="button"><span>Send</span></button> </div> </div> </div> </form> <div class="clearfix"></div> <a class="slider-close" href="#"></a></div> </div> <div id="hideShow1" style="display: none;"> <div class="right-side-content hidden1"> <div class="slider-email active"> <div id="messages_product_view"></div> <div id="formSuccess" style="display:none;">Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.</div> <form id="contactForm1" method="post"> <div class="column sixty"> <h2>TALK TO US</h2> <ul> <li> <label>Name<em class="required">*</em></label> <input name="name" id="name" title="Name" value="" class="input-text required-entry" type="text"> </li> <li> <label>Email<em class="required">*</em></label> <input name="email" id="email" title="Email" value="" class="input-text required-entry validate-email" type="text"> </li> <li> <label>Telephone</label> <input name="telephone" id="telephone" title="Telephone" value="" class="input-text" type="text"> </li> </ul> <p class="required">* Required Fields</p> </div> <!--column sixty--> <div class="column fourty last"> <div class="padding"> <label>Comment<em class="required">*</em></label> <textarea name="comment" title="Comment" class="required-entry input-text" cols="5" rows="3"></textarea> <div class="textright"> <input type="text" name="hideit" value="" style="display:none!important;"> <button type="submit" title="Submit" class="button btn-sent"><span>Submit</span></button> <img src="images/mgkloading1.php" alt="loader" id="loader" style="display:none;"> </div> <!--textright--> </div> <!--padding--> </div> <!--column fourty last--> </form> <a href="javascript:void(0)" id="hideDiv1" class="slider-close"></a> </div> <!--slider-email active--> </div> <!--right-side-content hidden1--> </div> <script type="text/javascript" src="<?php echo public_url()?>/mega/js/prototype.js"></script> <script type="text/javascript" src="<?php echo public_url()?>/mega/js/jquery.min.js"></script> <script type="text/javascript" src="<?php echo public_url()?>/mega/js/bootstrap.min.js"></script> <script type="text/javascript" src="<?php echo public_url()?>/mega/js/parallax.js"></script> <script type="text/javascript" src="<?php echo public_url()?>/mega/js/common.js"></script> <script type="text/javascript" src="<?php echo public_url()?>/mega/js/slider.js"></script> <script type="text/javascript" src="<?php echo public_url()?>/mega/js/owl.carousel.min.js"></script> <script type="text/javascript" src="<?php echo public_url()?>/mega/js/toggle.js"></script> <script type="text/javascript" src="<?php echo public_url()?>/mega/js/pro-img-slider.js"></script> <script type="text/javascript" src="<?php echo public_url()?>/mega/js/jquery.flexslider.js"></script> <script type="text/javascript" src="<?php echo public_url()?>/mega/js/cloud-zoom.js"></script> <script type="text/javascript"> //<![CDATA[ jQuery(function() { jQuery(".slideshow").cycle({ fx:'scrollHorz', easing: 'easeInOutCubic', timeout: 10000, speedOut: 800, speedIn: 800, sync: 1, pause: 1, fit: 0, pager: '#home-slides-pager', prev: '#home-slides-prev', next: '#home-slides-next' }); }); //]]> </script> <script> new UISearch( document.getElementById( 'form-search' ) ); </script> </body> <!-- Giao dien duoc chia se mien phi tai www.ptheme.net [Free HTML Download]. SKYPE[ptheme.net] - EMAIL[<EMAIL>].--> </html> ======================= File: public/mega/grid.php ======================= <filename>public/mega/grid.php <!DOCTYPE html> <html lang="en"> <!-- Giao dien duoc chia se mien phi tai www.ptheme.net [Free HTML Download]. SKYPE[ptheme.net] - EMAIL[<EMAIL>].--> <!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack --> <head> <meta charset="utf-8"> <!--[if IE]> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <![endif]--> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <title>Thời Trang Trẻ</title> <!-- Favicons Icon --> <link rel="icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> <!-- Mobile Specific --> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <!-- CSS Style --> <!--<link rel="stylesheet" href="css/animate.css" type="text/css">--> <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"> <link rel="stylesheet" href="css/owl.carousel.css" type="text/css"> <link rel="stylesheet" href="css/owl.theme.css" type="text/css"> <link rel="stylesheet" href="css/font-awesome.css" type="text/css"> <link rel="stylesheet" href="css/style.css" type="text/css"> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> <!-- Google Fonts --> <link href='https://fonts.googleapis.com/css?family=Bitter:400,700,400italic' rel='stylesheet' type='text/css'> </head> <body class="cms-index-index"> <div class="page"> <!-- Header --> <header class="header-container"> <?php include ("module/header.php");?> </header> <!-- end header --> <!-- Navbar --> <nav> <?php include ("module/menu.php");?> </nav> <!-- end nav --> <!-- breadcrumbs --> <div class="breadcrumbs"> <div class="container"> <div class="row"> <ul> <li class="home"> <a href="index.php" title="Go to Home Page">Home</a><span>&raquo; </span></li> <li class=""> <a href="grid.php" title="Go to Home Page">Women</a><span>&raquo; </span></li> <li class="category13"><strong>Tops &amp; Tees</strong></li> </ul> </div> </div> </div> <!-- End breadcrumbs --> <!-- Two columns content --> <div class="main-container col2-left-layout"> <div class="main container"> <div class="row"> <section class="col-main col-sm-9 col-sm-push-3"> <div class="category-title"> <h1>Tops &amp; Tees</h1> </div> <div class="category-description std"> <div class="slider-items-products"> <div id="category-desc-slider" class="product-flexslider hidden-buttons"> <div class="slider-items slider-width-col1"> <!-- Item --> <div class="item"> <a href="#x"><img alt="" src="images/women_banner.png"></a> <div class="cat-img-title cat-bg cat-box"> <h2 class="cat-heading">Category Banner</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> </div> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img alt="" src="images/women_banner1.png"></a> </div> <!-- End Item --> </div> </div> </div> </div> <div class="category-products"> <div class="toolbar"> <div class="sorter"> <div class="view-mode"> <span class="button button-active button-grid" title="Grid">Grid</span><a class="button button-list" title="List" href="list.php">List</a> </div> </div> <div id="sort-by"> <label class="left">Sort By: </label> <ul> <li><a href="#">Position<span class="right-arrow"></span></a> <ul> <li><a href="#">Name</a></li> <li><a href="#">Price</a></li> <li><a href="#">Position</a></li> </ul> </li> </ul> <a title="Set Descending Direction" href="#" class="button-asc left"><span class="glyphicon glyphicon-arrow-up" style="color:#999;font-size:11px;"></span></a> </div> <div class="pager"> <div class="pages"> <label>Page:</label> <ul class="pagination"> <li><a href="#">«</a></li> <li class="active"><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li><a href="#">»</a></li> </ul> </div> <div id="limiter"> <label>View: </label> <ul> <li><a href="#">15<span class="right-arrow"></span></a> <ul> <li><a href="#">20</a></li> <li><a href="#">30</a></li> <li><a href="#">35</a></li> </ul> </li> </ul> </div> </div> </div> <ul class="products-grid"> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product1.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$131.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="new-label new-top-right">New</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product2.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span id="old-price-2" class="price"> $367.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span id="product-price-2" class="price"> $256.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product3.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$131.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product4.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$131.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="new-label new-top-right">New</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product5.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price"> $367.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price"> $256.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product8.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$131.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product10.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$131.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="new-label new-top-right">New</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product11.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price"> $367.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price"> $256.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product5.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$131.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product9.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$131.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="new-label new-top-right">New</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product10.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <p class="old-price"> <span class="price-label">Regular Price:</span> <span class="price"> $367.00 </span> </p> <p class="special-price"> <span class="price-label">Special Price</span> <span class="price"> $256.00 </span> </p> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> <li class="item col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="col-item"> <div class="sale-label sale-top-right">Sale</div> <div class="item-inner"> <div class="item-img"> <div class="item-img-info"> <a href="product_detail.php" title="Sample Product" class="product-image"> <img src="products-images/product13.jpg" alt="Ut tincidunt tortor"></a> <div class="item-box-hover"> <div class="box-inner"> <div class="product-detail-bnt"><a href="quick_view.php" class="button detail-bnt"><span>Quick View</span></a></div> </div> </div> </div> </div> <div class="item-info"> <div class="info-inner"> <div class="item-title"> <a href="product_detail.php" title="Sample Product"> Sample Product </a> </div> <div class="item-content"> <div class="rating"> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:60%"></div> </div> <p class="rating-links"> <a href="#">1 Review(s)</a> <span class="separator">|</span> <a href="#">Add Review</a> </p> </div> </div> <div class="item-price"> <div class="price-box"> <span class="regular-price"> <span class="price">$131.00</span> </span> </div> </div> </div> </div> <div class="actions"><span class="add-to-links"> <a href="wishlist.php" class="link-wishlist" title="Add to Wishlist"><span>Add to Wishlist</span></a> <button type="button" title="Add to Cart" class="button btn-cart"><span>Add to Cart</span></button> <a href="compare.php" class="link-compare" title="Add to Compare"><span>Add to Compare</span></a></span> </div> </div> </div> </div> </li> </ul> </div> </section> <aside class="col-right sidebar col-sm-3 col-xs-12 col-sm-pull-9"> <div class="side-nav-categories"> <div class="block-title"> Categories </div> <!--block-title--> <!-- BEGIN BOX-CATEGORY --> <div class="box-content box-category"> <ul> <li> <a class="active" href="#/women.php">Women</a> <span class="subDropdown minus"></span> <ul class="level0_415" style="display:block"> <li> <a href="grid.php"> Tops </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Evening Tops </a> </li> <li> <a href="grid.php"> Shirts &amp; Blouses </a> </li> <li> <a href="grid.php"> Tunics </a> </li> <li> <a href="grid.php"> Vests </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Bags </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Bags </a> </li> <li> <a href="grid.php"> Designer Handbags </a> </li> <li> <a href="grid.php"> Purses </a> </li> <li> <a href="grid.php"> Shoulder Bags </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Shoes </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Flat Shoes </a> </li> <li> <a href="grid.php"> Flat Sandals </a> </li> <li> <a href="grid.php"> Boots </a> </li> <li> <a href="grid.php"> Heels </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Jewellery </a> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Bracelets </a> </li> <li> <a href="grid.php"> Necklaces &amp; Pendants </a> </li> <li> <a href="grid.php"> Pins &amp; Brooches </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Dresses </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Casual Dresses </a> </li> <li> <a href="grid.php"> Evening </a> </li> <li> <a href="grid.php"> Designer </a> </li> <li> <a href="grid.php"> Party </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Lingerie </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Bras </a> </li> <li> <a href="grid.php"> Bodies </a> </li> <li> <a href="grid.php"> Lingerie Sets </a> </li> <li> <a href="grid.php"> Shapewear </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Jackets </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Coats </a> </li> <li> <a href="grid.php"> Jackets </a> </li> <li> <a href="grid.php"> Leather Jackets </a> </li> <li> <a href="grid.php"> Blazers </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Swimwear </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Swimsuits </a> </li> <li> <a href="grid.php"> Beach Clothing </a> </li> <li> <a href="grid.php"> Bikinis </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> </ul> <!--level0--> </li> <!--level 0--> <li> <a href="grid.php">Men</a> <span class="subDropdown plus"></span> <ul class="level0_455" style="display:none"> <li> <a href="#/men/shoes.php"> Shoes </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Flat Shoes </a> </li> <li> <a href="grid.php"> Boots </a> </li> <li> <a href="grid.php"> Heels </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Jewellery </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Bracelets </a> </li> <li> <a href="grid.php"> Necklaces &amp; Pendants </a> </li> <li> <a href="grid.php"> Pins &amp; Brooches </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Dresses </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Casual Dresses </a> </li> <li> <a href="grid.php"> Evening </a> </li> <li> <a href="grid.php"> Designer </a> </li> <li> <a href="grid.php"> Party </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Jackets </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Coats </a> </li> <li> <a href="grid.php"> Jackets </a> </li> <li> <a href="grid.php"> Leather Jackets </a> </li> <li> <a href="grid.php"> Blazers </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Swimwear </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Swimsuits </a> </li> <li> <a href="grid.php"> Beach Clothing </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> </ul> <!--level0--> </li> <!--level 0--> <li> <a href="grid.php">Electronics</a> <span class="subDropdown plus"></span> <ul class="level0_482" style="display:none"> <li> <a href="grid.php"> Smartphones </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Samsung </a> </li> <li> <a href="grid.php"> Apple </a> </li> <li> <a href="grid.php"> Blackberry </a> </li> <li> <a href="grid.php"> Nokia </a> </li> <li> <a href="grid.php"> HTC </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Cameras </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> Digital Cameras </a> </li> <li> <a href="grid.php"> Camcorders </a> </li> <li> <a href="grid.php"> Lenses </a> </li> <li> <a href="grid.php"> Filters </a> </li> <li> <a href="grid.php"> Tripod </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> <li> <a href="grid.php"> Accesories </a> <span class="subDropdown plus"></span> <ul class="level1" style="display:none"> <li> <a href="grid.php"> HeadSets </a> </li> <li> <a href="grid.php"> Batteries </a> </li> <li> <a href="grid.php"> Screen Protectors </a> </li> <li> <a href="grid.php"> Memory Cards </a> </li> <li> <a href="grid.php"> Cases </a> </li> <!--end for-each --> </ul> <!--level1--> </li> <!--level1--> </ul> <!--level0--> </li> <!--level 0--> <li> <a href="grid.php">Digital</a> </li> <!--level 0--> <li class="last"> <a href="grid.php">Fashion</a> </li> <!--level 0--> </ul> </div> <!--box-content box-category--> </div> <div class="block block-layered-nav"> <div class="block-title">Shop By</div> <div class="block-content"> <p class="block-subtitle">Shopping Options</p> <dl id="narrow-by-list"> <dt class="odd">Price</dt> <dd class="odd"> <ol> <li> <a href="#"><span class="price">$0.00</span> - <span class="price">$99.99</span></a> (6) </li> <li> <a href="#"><span class="price">$100.00</span> and above</a> (6) </li> </ol> </dd> <dt class="even">Manufacturer</dt> <dd class="even"> <ol> <li> <a href="#">TheBrand</a> (9) </li> <li> <a href="#">Company</a> (4) </li> <li> <a href="#">LogoFashion</a> (1) </li> </ol> </dd> <dt class="odd">Color</dt> <dd class="odd"> <ol> <li> <a href="#">Green</a> (1) </li> <li> <a href="#">White</a> (5) </li> <li> <a href="#">Black</a> (5) </li> <li> <a href="#">Gray</a> (4) </li> <li> <a href="#">Dark Gray</a> (3) </li> <li> <a href="#">Blue</a> (1) </li> </ol> </dd> <dt class="last even">Size</dt> <dd class="last even"> <ol> <li> <a href="#">S</a> (6) </li> <li> <a href="#">M</a> (6) </li> <li> <a href="#">L</a> (4) </li> <li> <a href="#">XL</a> (4) </li> </ol> </dd> </dl> </div> </div> <div class="block block-subscribe"> <div class="block-title">Newsletter Sign Up</div> <form action="http://www.magikcommerce.com//newsletter/subscriber/new/" method="post" id="newsletter-validate-detail"> <div class="block-content"> <div class="form-subscribe-header"> Sign up for our newsletter:</div> <input type="text" name="email" id="newsletter" title="Sign up for our newsletter" class="input-text required-entry validate-email" placeholder="Enter your email address"> <div class="actions"> <button class="button button-subscribe" title="Submit" type="submit"><span>Subscribe</span></button> </div> </div> </form> </div> <div class="block block-cart"> <div class="block-title ">My Cart</div> <div class="block-content"> <div class="summary"> <p class="amount">There are <a href="#">2 items</a> in your cart.</p> <p class="subtotal"> <span class="label">Cart Subtotal:</span> <span class="price">$27.99</span> </p> </div> <div class="ajax-checkout"> <button type="submit" title="Submit" class="button button-checkout"><span>Checkout</span></button> </div> <p class="block-subtitle">Recently added item(s) </p> <ul> <li class="item"> <a class="product-image" title="Fisher-Price Bubble Mower" href="product_detail.php"><img width="60" alt="Fisher-Price Bubble Mower" src="products-images/product1.jpg"></a> <div class="product-details"> <div class="access"> <a class="btn-remove1" title="Remove This Item" href="#"> <span class="icon"></span> Remove </a> </div> <p class="product-name"> <a href="product_detail.php">Sample Product</a> </p> <strong>1</strong> x <span class="price">$19.99</span> </div> </li> <li class="item last"> <a class="product-image" title="Prince Lionheart Jumbo Toy Hammock" href="product_detail.php"><img width="60" alt="Prince Lionheart Jumbo Toy Hammock" src="products-images/product2.jpg"></a> <div class="product-details"> <div class="access"> <a class="btn-remove1" title="Remove This Item" href="#"> <span class="icon"></span> Remove </a> </div> <p class="product-name"> <a href="product_detail.php"> Sample Product </a> </p> <strong>1</strong> x <span class="price">$8.00</span> <!--access clearfix--> </div> </li> </ul> </div> </div> <div class="block block-compare"> <div class="block-title ">Compare Products (2)</div> <div class="block-content"> <ol id="compare-items"> <li class="item odd"> <input type="hidden" class="compare-item-id" value="2173"> <a href="#" title="Remove This Item" class="btn-remove1"></a> <a class="product-name" href="#"> Sofa with Box-Edge Polyester Wrapped Cushions</a> </li> <li class="item last even"> <input type="hidden" class="compare-item-id" value="2174"> <a href="#" title="Remove This Item" class="btn-remove1"></a> <a class="product-name" href="#"> Sofa with Box-Edge Down-Blend Wrapped Cushions</a> </li> </ol> <div class="ajax-checkout"> <button class="button button-compare" title="Submit" type="submit"><span>Compare</span></button> <button class="button button-clear" title="Submit" type="submit"><span>Clear</span></button> </div> </div> </div> <div class="block block-list block-viewed"> <div class="block-title"> Recently Viewed </div> <div class="block-content"> <ol id="recently-viewed-items"> <li class="item odd"> <p class="product-name"><a href="#"> Armchair with Box-Edge Upholstered Arm</a></p> </li> <li class="item even"> <p class="product-name"><a href="#"> Pearce Upholstered Slee pere</a></p> </li> <li class="item last odd"> <p class="product-name"><a href="#"> Sofa with Box-Edge Down-Blend Wrapped Cushions</a></p> </li> </ol> </div> </div> <div class="block block-poll"> <div class="block-title">Community Poll </div> <form onsubmit="return validatePollAnswerIsSelected();" method="post" action="#" id="pollForm"> <div class="block-content"> <p class="block-subtitle">What is your favorite Magento feature?</p> <ul id="poll-answers"> <li class="odd"> <input type="radio" value="5" id="vote_5" class="radio poll_vote" name="vote"> <span class="label"> <label for="vote_5">Layered Navigation</label> </span> </li> <li class="even"> <input type="radio" value="6" id="vote_6" class="radio poll_vote" name="vote"> <span class="label"> <label for="vote_6">Price Rules</label> </span> </li> <li class="odd"> <input type="radio" value="7" id="vote_7" class="radio poll_vote" name="vote"> <span class="label"> <label for="vote_7">Category Management</label> </span> </li> <li class="last even"> <input type="radio" value="8" id="vote_8" class="radio poll_vote" name="vote"> <span class="label"> <label for="vote_8">Compare Products</label> </span> </li> </ul> <div class="actions"> <button class="button button-vote" title="Vote" type="submit"><span>Vote</span></button> </div> </div> </form> </div> <div class="block block-tags"> <div class="block-title"> Popular Tags</div> <div class="block-content"> <ul class="tags-list"> <li><a style="font-size:98.3333333333%;" href="#tagId/23/">Camera</a></li> <li><a style="font-size:86.6666666667%;" href="#tagId/109/">Hohoho</a></li> <li><a style="font-size:145%;" href="#tagId/27/">SEXY</a></li> <li><a style="font-size:75%;" href="#tagId/61/">Tag</a></li> <li><a style="font-size:110%;" href="#tagId/29/">Test</a></li> <li><a style="font-size:86.6666666667%;" href="#tagId/17/">bones</a></li> <li><a style="font-size:110%;" href="#tagId/12/">cool</a></li> <li><a style="font-size:86.6666666667%;" href="#tagId/184/">cool t-shirt</a></li> <li><a style="font-size:86.6666666667%;" href="#tagId/173/">crap</a></li> <li><a style="font-size:86.6666666667%;" href="#tagId/41/">good</a></li> <li><a style="font-size:86.6666666667%;" href="#tagId/16/">green</a></li> <li><a style="font-size:86.6666666667%;" href="#tagId/5/">hip</a></li> <li><a style="font-size:75%;" href="#tagId/51/">laptop</a></li> <li><a style="font-size:75%;" href="#tagId/20/">mobile</a></li> <li><a style="font-size:75%;" href="#tagId/70/">nice</a></li> <li><a style="font-size:86.6666666667%;" href="#tagId/42/">phone</a></li> <li><a style="font-size:98.3333333333%;" href="#tagId/30/">red</a></li> <li><a style="font-size:86.6666666667%;" href="#tagId/28/">tight</a></li> <li><a style="font-size:75%;" href="#tagId/2/">trendy</a></li> <li><a style="font-size:86.6666666667%;" href="#tagId/4/">young</a></li> </ul> <div class="actions"> <a class="view-all" href="#">View All Tags</a> </div> </div> </div> <div class="block block-banner"><a href="#"><img src="images/block-banner.png" alt=""></a></div> </aside> </div> </div> </div> <!-- End Two columns content --> <div class="brand-logo "> <div class="container"> <div class="row"> <div class="slider-items-products col-lg-12"> <div id="brand-logo-slider" class="product-flexslider hidden-buttons"> <div class="slider-items slider-width-col6"> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo1.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo2.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo3.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo4.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo5.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo6.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo1.png" alt="Image"></a> </div> <!-- End Item --> <!-- Item --> <div class="item"> <a href="#x"><img src="images/b-logo4.png" alt="Image"></a> </div> <!-- End Item --> </div> </div> </div> </div> </div> </div> <!-- Footer --> <footer class="footer"> <?php include ("module/footer.php");?> </footer> <!-- End Footer --> </div> <div class="help_slider"> <div class="text alignleft">Need Help?</div> <div class="icons"> <a class="show_hide" id="questionbox-side-phonebutton" href="javascript:void(0)"><i class="icon-phones">&nbsp;</i></a> <a class="show_hide1" id="questionbox-side-emailbutton" href="javascript:void(0)"><i class="icon-email">&nbsp;</i></a> </div> </div> <div id="hideShow" class="right-side-content" style="display: none;"> <!--Contact Static Block --> <div class="slider-phone active"> <h2 class="">Talk To Us</h2> <h3 class="">Available 24/7</h3> <p class="textcenter"> Want to speak to someone? We're here 24/7 to answer any questions. Just call!<br> <br> <span class="phone-number"> +1 800 123 1234</span></p> <a id="hideDiv" class="slider-close" href="javascript:void(0)"></a> </div> <div class="slider-email hidden"> <h2 class="">Let us know how we can help you.</h2> <form action="#" enctype="application/x-www-form-urlencoded" method="post" id="form-contact-help_slider"> <div class="column sixty"> <div class=""> <ul> <li> <label>First Name</label> <input type="text" name="FirstName" class="required-entry"> <div class="clearfix"></div> </li> <li> <label>Last Name</label> <input type="text" name="LastName" class="required-entry"> <div class="clearfix"></div> </li> <li> <label>Email Address</label> <input type="email" name="Email" class="required-entry"> <div class="clearfix"></div> </li> <li> <label>Phone Number</label> <input type="text" name="Phone"> <div class="clearfix"></div> </li> </ul> </div> </div> <div class="column fourty last"> <div class="padding"> <textarea name="Contact_Form_Message__c" class="required-entry">How can we help you?</textarea> <div class="textright"> <button class="button btn-sent" title="Add to Cart" type="button"><span>Send</span></button> </div> </div> </div> </form> <div class="clearfix"></div> <a class="slider-close" href="#"></a></div> </div> <div id="hideShow1" style="display: none;"> <div class="right-side-content hidden1"> <div class="slider-email active"> <div id="messages_product_view"></div> <div id="formSuccess" style="display:none;">Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.</div> <form id="contactForm1" method="post"> <div class="column sixty"> <h2>TALK TO US</h2> <ul> <li> <label>Name<em class="required">*</em></label> <input name="name" id="name" title="Name" value="" class="input-text required-entry" type="text"> </li> <li> <label>Email<em class="required">*</em></label> <input name="email" id="email" title="Email" value="" class="input-text required-entry validate-email" type="text"> </li> <li> <label>Telephone</label> <input name="telephone" id="telephone" title="Telephone" value="" class="input-text" type="text"> </li> </ul> <p class="required">* Required Fields</p> </div> <!--column sixty--> <div class="column fourty last"> <div class="padding"> <label>Comment<em class="required">*</em></label> <textarea name="comment" title="Comment" class="required-entry input-text" cols="5" rows="3"></textarea> <div class="textright"> <input type="text" name="hideit" value="" style="display:none!important;"> <button type="submit" title="Submit" class="button btn-sent"><span>Submit</span></button> <img src="images/mgkloading1.php" alt="loader" id="loader" style="display:none;"> </div> <!--textright--> </div> <!--padding--> </div> <!--column fourty last--> </form> <a href="javascript:void(0)" id="hideDiv1" class="slider-close"></a> </div> <!--slider-email active--> </div> <!--right-side-content hidden1--> </div> <!-- JavaScript --> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/bootstrap.min.js"></script> <script type="text/javascript" src="js/parallax.js"></script> <script type="text/javascript" src="js/common.js"></script> <script type="text/javascript" src="js/revslider.php"></script> <script type="text/javascript" src="js/owl.carousel.min.js"></script> </body> <!-- Giao dien duoc chia se mien phi tai www.ptheme.net [Free HTML Download]. SKYPE[ptheme.net] - EMAIL[<EMAIL>].--> </html> ======================= File: public/mega/module/footer.php ======================= <div class="footer-middle"> <div class="container"> <div class="row"> <div class="col-lg-3 col-md-4 col-sm-4 col-xs-12"> <div class="footer-logo"><a href="index.php" title="Logo"><img src="images/logo.png" alt="logo"></a></div> <address> <i class="add-icon">&nbsp;</i>123 Main Street, Anytown, <br> &nbsp;CA 12345 USA </address> <div class="phone-footer"><i class="phone-icon">&nbsp;</i> +1 800 123 1234</div> <div class="email-footer"><i class="email-icon">&nbsp;</i> <a href="mailto:<EMAIL>"><EMAIL></a> </div> </div> <div class="col-lg-2 col-md-4 col-sm-4 col-xs-12"> <h4>Shopping Guide</h4> <ul class="links"> <li class="first"><a href="#" title="How to buy">How to buy</a></li> <li><a href="faq.php" title="FAQs">FAQs</a></li> <li><a href="#" title="Payment">Payment</a></li> <li><a href="#" title="Shipment</a>">Shipment</a></li> <li><a href="#" title="Where is my order?">Where is my order?</a></li> <li class="last"><a href="#" title="Return policy">Return policy</a></li> </ul> </div> <div class="col-lg-2 col-md-4 col-sm-4 col-xs-12"> <h4>Style Advisor</h4> <ul class="links"> <li class="first"><a href="#" title="Your Account">Your Account</a></li> <li><a href="#" title="Information">Information</a></li> <li><a href="#" title="Addresses">Addresses</a></li> <li><a href="#" title="Addresses">Discount</a></li> <li><a href="#" title="Orders History">Orders History</a></li> <li class="last"><a href="#" title=" Additional Information">Additional Information</a></li> </ul> </div> <div class="col-lg-2 col-md-4 col-sm-3 col-xs-12"> <h4>Information</h4> <ul class="links"> <li class="first"><a href="sitemap.php" title="Site Map">Site Map</a></li> <li><a href="#/" title="Search Terms">Search Terms</a></li> <li><a href="#" title="Advanced Search">Advanced Search</a></li> <li><a href="contact_us.php" title="Contact Us">Contact Us</a></li> <li><a href="#" title="Suppliers">Suppliers</a></li> <li class=" last"><a href="#" title="Our stores" class="link-rss">Our stores</a></li> </ul> </div> <div class="col-lg-3 col-md-8 col-sm-9 col-xs-12"> <div class="block-subscribe"> <h4>Sign up for emails</h4> <div class="newsletter"> <form> <input type="text" placeholder="Enter your email" class="input-text required-entry validate-email" title="Sign up for our newsletter" id="newsletter1" name="email"> <button class="subscribe" title="Subscribe" type="submit"><span>Submit</span></button> </form> </div> </div> <div class="social"> <h4>Follow Us</h4> <ul> <li class="fb"><a href="#"></a></li> <li class="tw"><a href="#"></a></li> <li class="googleplus"><a href="#"></a></li> <li class="rss"><a href="#"></a></li> <li class="pintrest"><a href="#"></a></li> <li class="linkedin"><a href="#"></a></li> <li class="youtube"><a href="#"></a></li> </ul> </div> </div> </div> </div> </div> <div class="footer-bottom"> <div class="container"> <div class="row"> <div class="col-sm-4 col-xs-12 coppyright"> © 2015 Magikcommerce. All Rights Reserved.</div> <div class="col-sm-8 col-xs-12 company-links"> <ul class="links"> <li><a href="#" title="Magento Themes">Magento Themes</a></li> <li><a href="#" title="Premium Themes">Premium Themes</a></li> <li><a href="#" title="Responsive Themes">Responsive Themes</a></li> <li class="last"><a href="#" title="Magento Extensions">Magento Extensions</a></li> </ul> </div> </div> </div> </div> ======================= File: application/views/admin/footer.php ======================= <reponame>VoQuocViet/megafashion<filename>application/views/admin/footer.php <div id="footer"> <div class="wrapper">Bản quyền &copy; 2016 <EMAIL></div> </div> ======================= File: application/controllers/admin/Catalog.php ======================= <?php /** * */ class Catalog extends My_Controller { function __construct() { parent::__construct(); $this->load->model('catalog_model'); } function index(){ // lấy ra tổng số danh mục $total = $this->catalog_model->get_total(); $this->data['total'] = $total; // lấy ra danh sách danh mục sản phẩm $list= $this->catalog_model->get_list(); $this->data['list'] = $list; //lay nội dung của biến message $message = $this->session->flashdata('message'); $this->data['message'] = $message; $this->data['temp'] = 'admin/catalog/index'; $this->load->view('admin/main', $this->data); } public function add() { $this->load->library('form_validation'); $this->load->helper('form'); if($this->input->post()) { $name = $this->form_validation->set_rules('name','Tên danh mục','required'); if($this->form_validation->run()) { $name = $this->input->post('name'); $sort_order = $this->input->post('sort_order'); $parent_id = $this->input->post('parent_id'); $data = array( 'name' => $name, 'sort_order' => $sort_order, 'parent_id' => $parent_id ); if($this->catalog_model->create($data)) { $this->session->set_flashdata('message','Thêm danh mục mới thành công'); } else { $this->session->set_flashdata('message','Thêm mới thất bại'); } redirect(admin_url('catalog')); } } // lấy ra danh sách danh mục cha $input = array(); $input['where'] = array('parent_id' =>0); $list= $this->catalog_model->get_list($input); $this->data['list'] = $list; $this->data['temp'] = 'admin/catalog/add'; $this->load->view('admin/main', $this->data); } public function edit() { $id= $this->uri->rsegment('3'); $id= intval($id); $this->load->library('form_validation'); $this->load->helper('form'); // lấy thông tin quản trị viên $info= $this->catalog_model->get_info($id); if(!$info) { $this->session->set_flashdata('message', 'Không tồn tại danh mục'); redirect(admin_url('catalog')); } $this->data['info']= $info; if($this->input->post()) { // validation form name and username $this->form_validation->set_rules('name','Tên danh mục','required'); $parent_id= $this->input->post['parent_id']; if($this->form_validation->run()) { // thêm vào csdl $name= $this->input->post('name'); $sort_order= $this->input->post('sort_order'); $parent_id= $this->input->post('parent_id'); $data= array( 'name' => $name, 'sort_order' => intval($sort_order), 'parent_id' => $parent_id ); if($this->catalog_model->update($id, $data)) { // tạo ra nội dung thông báo $this->session->set_flashdata('message','Cập nhật dữ liệu thành công'); } else{ $thí->session->set_flashdata('message','Cập nhật thất bại'); } redirect(admin_url('catalog')); } } $input = array(); $input['where'] = array('parent_id' =>0); $list= $this->catalog_model->get_list($input); $this->data['list'] = $list; $this->data['temp'] = 'admin/catalog/edit'; $this->load->view('admin/main', $this->data); } public function delete() { $id = $this->uri->rsegment('3'); $id = intval($id); //lay thong tin cua quan tri vien $info = $this->catalog_model->get_info($id); if(!$info) { $this->session->set_flashdata('message', 'Không tồn tại danh mục'); redirect(admin_url('catalog')); } //thuc hiện xóa $this->catalog_model->delete($id); $this->session->set_flashdata('message', 'Xóa dữ liệu thành công'); redirect(admin_url('catalog')); } } ======================= File: application/views/mega/head.php ======================= <reponame>VoQuocViet/megafashion<gh_stars>0 <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="google-site-verification" content="9mwgXr3AkgEIeolSvfLX3OIZ3MVPpRZtV9cbnfdTkHM" /> <meta name="description" content="Biệt thự nghỉ dưỡng Lê Hoàng đem đến cho gia đình bạn những phút giây bên nhau GẮN KẾT YÊU THƯƠNG – NÂNG TẦM HẠNH PHÚC." /> <meta name="keywords" content="Shop thời trang, Khách sạn Đà Lạt, Đà Lạt Hotel, Đà Lạt Villa, Khách sạn trung tâm Đà Lạt, Đặt phòng Đà Lạt, Khách sạn tại Đà Lạt" /> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/style.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/bootstrap.min.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/slider.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/owl.carousel.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/owl.theme.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/flexslider.css" type="text/css"> <link rel="stylesheet" href="<?php echo public_url()?>/mega/css/font-awesome.css" type="text/css"> <link href='https://fonts.googleapis.com/css?family=Bitter:400,700,400italic' rel='stylesheet' type='text/css'> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> <!-- Favicons Icon --> <link rel="icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> <script src="<?php echo public_url()?>/mega/bootstrap/dist/js/bootstrap.js"></script> <script src="<?php echo public_url()?>/mega/js/jquery.js"></script> <script> jQuery(document).ready(function($) { //selector đến menu cần làm việc var TopFixMenu = $("#nav1"); // dùng sự kiện cuộn chuột để bắt thông tin đã cuộn được chiều dài là bao nhiêu. $(window).scroll(function() { // Nếu cuộn được hơn 150px rồi if($(this).scrollTop()>100) { // Tiến hành show menu ra TopFixMenu.show(); } // Ngược lại, nhỏ hơn 150px thì hide menu đi. else { TopFixMenu.show(); } } ) $(window).resize(function(){ if($(window).width() < 768 ) { $('.slider-intro').hide(); } else { $('.slider-intro').show(); }; }); }) </script> <title>Thời Trang Trẻ| Thời Trang Thu- Đông</title> <link rel="icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> ======================= File: public/mega/index.php ======================= <!doctype html> <html> <head> <?php include ("module/head.php");?> </head> <body class="cms-index-index"> <div class="page"> <!-- Header --> <header class="header-container"> <?php include ("module/header.php");?> </header> <!-- end header --> <!-- Navbar --> <nav> <?php include ("module/menu.php");?> </nav> <!-- end nav --> <!-- Slider --> <section class="slider-intro"> <?php include ("module/slide.php");?> </section> <!-- end Slider --> <!-- service section --> <div class="service-section"> <?php include ("module/service.php");?> </div> <!-- End service section --> <!-- main container --> <section class="main-container col1-layout home-content-container"> <?php include ("module/content.php");?> </section> <!-- End main container --> <!-- content --> <div class="container"> <div class="row" style="height:300px;"> </div> </div> <!--end-content--> <footer class="footer"> <?php include ("module/footer.php");?> </footer> </div> <!-- JavaScript --> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/bootstrap.min.js"></script> <script type="text/javascript" src="js/parallax.js"></script> <script type="text/javascript" src="js/common.js"></script> <script type="text/javascript" src="js/slider.js"></script> <script type="text/javascript" src="js/owl.carousel.min.js"></script> <script type="text/javascript"> //<![CDATA[ jQuery(function() { jQuery(".slideshow").cycle({ fx:'scrollHorz', easing: 'easeInOutCubic', timeout: 10000, speedOut: 800, speedIn: 800, sync: 1, pause: 1, fit: 0, pager: '#home-slides-pager', prev: '#home-slides-prev', next: '#home-slides-next' }); }); //]]> </script> </body> </body> </html> ======================= File: application/views/mega/header.php ======================= <filename>application/views/mega/header.php<gh_stars>0 <div class="header-top"> <div class="container"> <div class="row"> <div class="col-lg-5 col-md-5 col-xs-6"> <!-- Header Language --> <div class="dropdown block-language-wrapper"> <a role="button" data-toggle="dropdown" data-target="#" class="block-language dropdown-toggle" href="#"> <img src="<?php echo public_url()?>/mega/images/english.png" alt="language"> English <i class="icon-angle-down"></i> </a> <ul class="dropdown-menu" role="menu"> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"><img src="<?php echo public_url()?>/mega/images/english.png" alt="language"> English </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"><img src="<?php echo public_url()?>/mega/images/francais.png" alt="language"> French </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"><img src="<?php echo public_url()?>/mega/images/german.png" alt="language"> German </a></li> </ul> </div> <!-- End Header Language --> <!-- Header Currency --> <div class="dropdown block-currency-wrapper"> <a role="button" data-toggle="dropdown" data-target="#" class="block-currency dropdown-toggle" href="#"> USD <i class="icon-angle-down"></i></a> <ul class="dropdown-menu" role="menu"> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"> $ - Dollar </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"> £ - Pound </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"> € - Euro </a></li> </ul> </div> <!-- End Header Currency --> </div> <div class="col-lg-7 col-md-7 col-xs-6"> <!-- Header Top Links --> <div class="toplinks"> <div class="links"> <div class="myaccount"><a title="My Account" href="login.php"><span>My Account</span></a></div> <div class="wishlist"><a title="My Wishlist" href="wishlist.php"><span>Wishlist</span></a></div> <div class="check"><a href="checkout.php" title="Checkout"><span>Checkout</span></a></div> <div class="demo"><a href="#" title="Demo"><span>Demo</span></a></div> <!-- Header Company --> <div class="dropdown block-company-wrapper hidden-xs"> <a role="button" data-toggle="dropdown" data-target="#" class="dropdown-toggle" href="#"> <span>Company</span> <i class="icon-angle-down"></i></a> <ul class="dropdown-menu" role="menu"> <li role="presentation"><a role="menuitem" tabindex="-1" href="about_us.php"> About Us </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"> Customer Service </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"> Privacy Policy </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="site_map.php">Site Map </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Search Terms </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Advanced Search </a></li> </ul> </div> <!-- End Header Company --> <div class="login"><a href="login.php"><span>Log In</span></a></div> </div> </div> <!-- End Header Top Links --> </div> </div> </div> </div> <div class="header container"> <div class="row"> <div class="col-lg-3 col-sm-4 col-md-3"> <!-- Header Logo --> <div class="logo"> <a title="Magento Commerce" href="index.php"><img alt="Magento Commerce" src="<?php echo public_url()?>/mega/images/logo.png"></a> </div> <!-- End Header Logo --> </div> <div class="col-lg-9 col-xs-12"> <div class="top-cart-contain"> <div class="mini-cart"> <div data-toggle="dropdown" data-hover="dropdown" class="basket dropdown-toggle"> <a href="#"><span>Shopping Cart (5)</span></a></div> <div> <div style="display: none;" class="top-cart-content arrow_box"> <div class="block-subtitle">Recently added item(s)</div> <ul id="cart-sidebar" class="mini-products-list"> <li class="item odd"> <a href="product_detail.php" title="Sample Product" class="product-image"><img src="<?php echo public_url()?>/mega/products-images/product3.jpg" alt="Sample Product" width="55"></a> <div class="product-details"> <a href="#" title="Remove This Item" onClick="" class="btn-remove1">Remove This Item</a> <a class="btn-edit" title="Edit item" href="#">Edit item</a> <p class="product-name"><a href="product_detail.php">Sample Product</a> </p> <strong>1</strong> x <span class="price">$20.00</span> </div> </li> <li class="item even"> <a href="product_detail.php" title="Sample Product" class="product-image"><img src="<?php echo public_url()?>/mega/products-images/product1.jpg" alt="Sample Product" width="55"></a> <div class="product-details"> <a href="#" title="Remove This Item" onClick="" class="btn-remove1">Remove This Item</a> <a class="btn-edit" title="Edit item" href="#">Edit item</a> <p class="product-name"><a href="product_detail.php">Sample Product</a> </p> <strong>1</strong> x <span class="price">$230.00</span> </div> </li> <li class="item last odd"> <a href="product_detail.php" title="Sample Product" class="product-image"><img src="<?php echo public_url()?>/mega/products-images/product5.jpg" alt="Sample Product" width="55"></a> <div class="product-details"> <a href="#" title="Remove This Item" onClick="" class="btn-remove1">Remove This Item</a><a class="btn-edit" title="Edit item" href="#">Edit item</a> <p class="product-name"><a href="product_detail.php">Sample Product</a> </p> <strong>2</strong> x <span class="price">$420.00</span> </div> </li> </ul> <div class="top-subtotal">Subtotal: <span class="price">$520.00</span></div> <div class="actions"> <button class="btn-checkout" ><span>Checkout</span></button> <button class="view-cart" ><span>View Cart</span></button> </div> </div> </div> </div> <div id="ajaxconfig_info" style="display:none"> <a href="#/"></a> <input value="" type="hidden"> <input id="enable_module" value="1" type="hidden"> <input class="effect_to_cart" value="1" type="hidden"> <input class="title_shopping_cart" value="Go to shopping cart" type="hidden"> </div> </div> </div> </div> </div> ======================= File: public/mega/module/menu.php ======================= <filename>public/mega/module/menu.php <div class="container"> <div class="nav-inner"> <!-- mobile-menu --> <div class="hidden-desktop" id="mobile-menu"> <ul class="navmenu"> <li> <div class="menutop"> <div class="toggle"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></div> </div> <ul style="display:none;" class="submenu"> <li> <ul class="topnav"> <li class="level0 nav-1 level-top first parent"> <a href="grid.php" class="level-top"> <span>Women</span> </a> <ul class="level0"> <li class="level1 nav-1-1 first parent"> <a href="grid.php"> <span>Stylish Bag</span> </a> <ul class="level1"> <li class="level2 nav-1-1-1 first"> <a href="grid.php"> <span>Clutch Handbags</span> </a> </li> <li class="level2 nav-1-1-2"> <a href="grid.php"> <span>Diaper Bags</span> </a> </li> <li class="level2 nav-1-1-3"> <a href="grid.php"> <span>Bags</span> </a> </li> <li class="level2 nav-1-1-4 last"> <a href="grid.php"> <span>Hobo Handbags</span> </a> </li> </ul> </li> <li class="level1 nav-1-2 parent"> <a href="grid.php"> <span>Material Bag</span> </a> <ul class="level1"> <li class="level2 nav-1-2-5 first"> <a href="grid.php"> <span>Beaded Handbags</span> </a> </li> <li class="level2 nav-1-2-6"> <a href="grid.php"> <span>Fabric Handbags</span> </a> </li> <li class="level2 nav-1-2-7"> <a href="grid.php"> <span>Handbags</span> </a> </li> <li class="level2 nav-1-2-8 last"> <a href="grid.php"> <span>Leather Handbags</span> </a> </li> </ul> </li> <li class="level1 nav-1-3 parent"> <a href="grid.php"> <span>Shoes</span> </a> <ul class="level1"> <li class="level2 nav-1-3-9 first"> <a href="grid.php"> <span>Flat Shoes</span> </a> </li> <li class="level2 nav-1-3-10"> <a href="grid.php"> <span>Flat Sandals</span> </a> </li> <li class="level2 nav-1-3-11"> <a href="grid.php"> <span>Boots</span> </a> </li> <li class="level2 nav-1-3-12 last"> <a href="grid.php"> <span>Heels</span> </a> </li> </ul> </li> <li class="level1 nav-1-4 parent"> <a href="grid.php"> <span>Jwellery</span> </a> <ul class="level1"> <li class="level2 nav-1-4-13 first"> <a href="grid.php"> <span>Bracelets</span> </a> </li> <li class="level2 nav-1-4-14"> <a href="grid.php"> <span>Necklaces &amp; Pendants</span> </a> </li> <li class="level2 nav-1-4-15"> <a href="grid.php"> <span>Pendants</span> </a> </li> <li class="level2 nav-1-4-16 last"> <a href="grid.php"> <span>Pins &amp; Brooches</span> </a> </li> </ul> </li> <li class="level1 nav-1-5 parent"> <a href="grid.php"> <span>Dresses</span> </a> <ul class="level1"> <li class="level2 nav-1-5-17 first"> <a href="grid.php"> <span>Casual Dresses</span> </a> </li> <li class="level2 nav-1-5-18"> <a href="grid.php"> <span>Evening</span> </a> </li> <li class="level2 nav-1-5-19"> <a href="grid.php"> <span>Designer</span> </a> </li> <li class="level2 nav-1-5-20 last"> <a href="grid.php"> <span>Party</span> </a> </li> </ul> </li> <li class="level1 nav-1-6 last parent"> <a href="grid.php"> <span>Swimwear</span> </a> <ul class="level1"> <li class="level2 nav-1-6-21 first"> <a href="grid.php"> <span>Swimsuits</span> </a> </li> <li class="level2 nav-1-6-22"> <a href="grid.php"> <span>Beach Clothing</span> </a> </li> <li class="level2 nav-1-6-23"> <a href="grid.php"> <span>Clothing</span> </a> </li> <li class="level2 nav-1-6-24 last"> <a href="grid.php"> <span>Bikinis</span> </a> </li> </ul> </li> </ul> </li> <li class="level0 nav-2 level-top parent"> <a href="grid.php" class="level-top"> <span>Men</span> </a> <ul class="level0"> <li class="level1 nav-2-1 first parent"> <a href="grid.php"> <span>Shoes</span> </a> <ul class="level1"> <li class="level2 nav-2-1-1 first"> <a href="grid.php"> <span>Sport Shoes</span> </a> </li> <li class="level2 nav-2-1-2"> <a href="grid.php"> <span>Casual Shoes</span> </a> </li> <li class="level2 nav-2-1-3"> <a href="grid.php"> <span>Leather Shoes</span> </a> </li> <li class="level2 nav-2-1-4 last"> <a href="grid.php"> <span>canvas shoes</span> </a> </li> </ul> </li> <li class="level1 nav-2-2 parent"> <a href="grid.php"> <span>Dresses</span> </a> <ul class="level1"> <li class="level2 nav-2-2-5 first"> <a href="grid.php"> <span>Casual Dresses</span> </a> </li> <li class="level2 nav-2-2-6"> <a href="grid.php"> <span>Evening</span> </a> </li> <li class="level2 nav-2-2-7"> <a href="grid.php"> <span>Designer</span> </a> </li> <li class="level2 nav-2-2-8 last"> <a href="grid.php"> <span>Party</span> </a> </li> </ul> </li> <li class="level1 nav-2-3 parent"> <a href="grid.php"> <span>Jackets</span> </a> <ul class="level1"> <li class="level2 nav-2-3-9 first"> <a href="grid.php"> <span>Coats</span> </a> </li> <li class="level2 nav-2-3-10"> <a href="grid.php"> <span>Formal Jackets</span> </a> </li> <li class="level2 nav-2-3-11"> <a href="grid.php"> <span>Leather Jackets</span> </a> </li> <li class="level2 nav-2-3-12 last"> <a href="grid.php"> <span>Blazers</span> </a> </li> </ul> </li> <li class="level1 nav-2-4 parent"> <a href="grid.php"> <span>Watches</span> </a> <ul class="level1"> <li class="level2 nav-2-4-13 first"> <a href="grid.php"> <span>Fastrack</span> </a> </li> <li class="level2 nav-2-4-14"> <a href="grid.php"> <span>Casio</span> </a> </li> <li class="level2 nav-2-4-15"> <a href="grid.php"> <span>Titan</span> </a> </li> <li class="level2 nav-2-4-16 last"> <a href="grid.php"> <span>Tommy-Hilfiger</span> </a> </li> </ul> </li> <li class="level1 nav-2-5 parent"> <a href="grid.php"> <span>Sunglasses</span> </a> <ul class="level1"> <li class="level2 nav-2-5-17 first"> <a href="grid.php"> <span><NAME></span> </a> </li> <li class="level2 nav-2-5-18"> <a href="grid.php"> <span>Fastrack</span> </a> </li> <li class="level2 nav-2-5-19"> <a href="grid.php"> <span>Police</span> </a> </li> <li class="level2 nav-2-5-20 last"> <a href="grid.php"> <span>Oakley</span> </a> </li> </ul> </li> <li class="level1 nav-2-6 last parent"> <a href="grid.php"> <span>Accessories</span> </a> <ul class="level1"> <li class="level2 nav-2-6-21 first"> <a href="grid.php"> <span>Backpacks</span> </a> </li> <li class="level2 nav-2-6-22"> <a href="grid.php"> <span>Wallets</span> </a> </li> <li class="level2 nav-2-6-23"> <a href="grid.php"> <span>Laptop Bags</span> </a> </li> <li class="level2 nav-2-6-24 last"> <a href="grid.php"> <span>Belts</span> </a> </li> </ul> </li> </ul> </li> <li class="level0 nav-3 level-top parent"> <a href="grid.php" class="level-top"> <span>Electronics</span> </a> <ul class="level0"> <li class="level1 nav-3-1 first parent"> <a href="grid.php"> <span>Mobiles</span> </a> <ul class="level1"> <li class="level2 nav-3-1-1 first"> <a href="grid.php"> <span>Samsung</span> </a> </li> <li class="level2 nav-3-1-2"> <a href="grid.php"> <span>Nokia</span> </a> </li> <li class="level2 nav-3-1-3"> <a href="grid.php"> <span>iPhone</span> </a> </li> <li class="level2 nav-3-1-4 last"> <a href="grid.php"> <span>Sony</span> </a> </li> </ul> </li> <li class="level1 nav-3-2 parent"> <a href="grid.php"> <span>Accessories</span> </a> <ul class="level1"> <li class="level2 nav-3-2-5 first"> <a href="grid.php"> <span>Mobile Memory Cards</span> </a> </li> <li class="level2 nav-3-2-6"> <a href="grid.php"> <span>Cases &amp; Covers</span> </a> </li> <li class="level2 nav-3-2-7"> <a href="grid.php"> <span>Mobile Headphones</span> </a> </li> <li class="level2 nav-3-2-8 last"> <a href="grid.php"> <span>Bluetooth Headsets</span> </a> </li> </ul> </li> <li class="level1 nav-3-3 parent"> <a href="grid.php"> <span>Cameras</span> </a> <ul class="level1"> <li class="level2 nav-3-3-9 first"> <a href="grid.php"> <span>Camcorders</span> </a> </li> <li class="level2 nav-3-3-10"> <a href="grid.php"> <span>Point &amp; Shoot</span> </a> </li> <li class="level2 nav-3-3-11"> <a href="grid.php"> <span>Digital SLR</span> </a> </li> <li class="level2 nav-3-3-12 last"> <a href="grid.php"> <span>Camera Accessories</span> </a> </li> </ul> </li> <li class="level1 nav-3-4 parent"> <a href="grid.php"> <span>Audio &amp; Video</span> </a> <ul class="level1"> <li class="level2 nav-3-4-13 first"> <a href="grid.php"> <span>MP3 Players</span> </a> </li> <li class="level2 nav-3-4-14"> <a href="grid.php"> <span>iPods</span> </a> </li> <li class="level2 nav-3-4-15"> <a href="grid.php"> <span>Speakers</span> </a> </li> <li class="level2 nav-3-4-16 last"> <a href="grid.php"> <span>Video Players</span> </a> </li> </ul> </li> <li class="level1 nav-3-5 parent"> <a href="grid.php"> <span>Computer</span> </a> <ul class="level1"> <li class="level2 nav-3-5-17 first"> <a href="grid.php"> <span>External Hard Disks</span> </a> </li> <li class="level2 nav-3-5-18"> <a href="grid.php"> <span>Pendrives</span> </a> </li> <li class="level2 nav-3-5-19"> <a href="grid.php"> <span>Headphones</span> </a> </li> <li class="level2 nav-3-5-20 last"> <a href="grid.php"> <span>PC Components</span> </a> </li> </ul> </li> <li class="level1 nav-3-6 last parent"> <a href="grid.php"> <span>Appliances </span> </a> <ul class="level1"> <li class="level2 nav-3-6-21 first"> <a href="grid.php"> <span>Vacuum Cleaners</span> </a> </li> <li class="level2 nav-3-6-22"> <a href="grid.php"> <span>Indoor Lighting</span> </a> </li> <li class="level2 nav-3-6-23"> <a href="grid.php"> <span>Kitchen Tools</span> </a> </li> <li class="level2 nav-3-6-24 last"> <a href="grid.php"> <span>Water Purifiers</span> </a> </li> </ul> </li> </ul> </li> <li class="level0 nav-4 level-top parent"> <a href="grid.php" class="level-top"> <span>Furniture</span> </a> <ul class="level0"> <li class="level1 nav-4-1 first parent"> <a href="grid.php"> <span>Living Room</span> </a> <ul class="level1"> <li class="level2 nav-4-1-1 first"> <a href="grid.php"> <span>Racks &amp; Cabinets</span> </a> </li> <li class="level2 nav-4-1-2"> <a href="grid.php"> <span>Sofas</span> </a> </li> <li class="level2 nav-4-1-3"> <a href="grid.php"> <span>Chairs</span> </a> </li> <li class="level2 nav-4-1-4 last"> <a href="grid.php"> <span>Tables</span> </a> </li> </ul> </li> <li class="level1 nav-4-2 parent"> <a href="grid.php"> <span>Dining &amp; Bar</span> </a> <ul class="level1"> <li class="level2 nav-4-2-5 first"> <a href="grid.php"> <span>Dining Table Sets</span> </a> </li> <li class="level2 nav-4-2-6"> <a href="grid.php"> <span>Serving Trolleys</span> </a> </li> <li class="level2 nav-4-2-7"> <a href="grid.php"> <span>Bar Counters</span> </a> </li> <li class="level2 nav-4-2-8 last"> <a href="grid.php"> <span>Dining Cabinets</span> </a> </li> </ul> </li> <li class="level1 nav-4-3 parent"> <a href="grid.php"> <span>Bedroom</span> </a> <ul class="level1"> <li class="level2 nav-4-3-9 first"> <a href="grid.php"> <span>Beds</span> </a> </li> <li class="level2 nav-4-3-10"> <a href="grid.php"> <span>Chest of Drawers</span> </a> </li> <li class="level2 nav-4-3-11"> <a href="grid.php"> <span>Wardrobes &amp; Almirahs</span> </a> </li> <li class="level2 nav-4-3-12 last"> <a href="grid.php"> <span>Nightstands</span> </a> </li> </ul> </li> <li class="level1 nav-4-4 last parent"> <a href="grid.php"> <span>Kitchen</span> </a> <ul class="level1"> <li class="level2 nav-4-4-13 first"> <a href="grid.php"> <span>Kitchen Racks</span> </a> </li> <li class="level2 nav-4-4-14"> <a href="grid.php"> <span>Kitchen Fittings</span> </a> </li> <li class="level2 nav-4-4-15"> <a href="grid.php"> <span>Wall Units</span> </a> </li> <li class="level2 nav-4-4-16 last"> <a href="grid.php"> <span>Benches &amp; Stools</span> </a> </li> </ul> </li> </ul> </li> <li class="level0 nav-5 level-top"> <a href="grid.php" class="level-top"> <span>Fashion</span> </a> </li> <li class="level0 nav-6 level-top first parent last"> <a class="level-top" href="#"> <span>Pages</span> </a> <ul class="level0"> <li class="level1 first"><a href="grid.php"><span>Grid</span></a></li> <li class="level1 nav-10-2"> <a href="list.php"> <span>List</span> </a> </li> <li class="level1 nav-10-3"> <a href="product_detail.php"> <span>Product Detail</span> </a> </li> <li class="level1 nav-10-4"> <a href="shopping_cart.php"> <span>Shopping Cart</span> </a> </li> <li class="level1 first"><a href="checkout.php"><span>Checkout</span></a> </li> <li class="level1 nav-10-4"> <a href="wishlist.php"> <span>Wishlist</span> </a> </li> <li class="level1"> <a href="dashboard.php"> <span>Dashboard</span> </a> </li> <li class="level1"> <a href="multiple_addresses.php"> <span>Multiple Addresses</span> </a> </li> <li class="level1"> <a href="about_us.php"> <span>About us</span> </a> </li> <li class="level1"> <a href="login.php"> <span>Login</span> </a> </li> <li class="level1"> <a href="compare.php"> <span>Compare</span> </a> </li> <li class="level1"> <a href="delivery.php"> <span>Delivery</span> </a> </li> <li class="level1"> <a href="faq.php"> <span>FAQ</span> </a> </li> <li class="level1"> <a href="quick_view.php"> <span>Quick view </span> </a> </li> <li class="level1"> <a href="newsletter.php"> <span>Newsletter</span> </a> </li> <li class="level1"><a href="blog.php"><span>Blog</span></a> </li> <li class="level1"><a href="contact_us.php"><span>Contact us</span></a> </li> <li class="level1"><a href="404error.php"><span>404 Error Page</span></a> </li> </ul> </li> </ul> </li> </ul> </li> </ul> <!--navmenu--> </div> <!--End mobile-menu --> <ul id="nav" class="hidden-xs"> <li id="nav-home" class="level0 parent drop-menu active"><a href="index.php"><span>Trang Chủ</span> </a> <ul class="level1" style="display: none;"> <li class="level1 first parent"><a href="index.php"><span>Full Width Layout</span></a> </li> <li class="level1 parent"><a href="http://htmldemo.magikcommerce.com/ecommerce/accord_html/boxed-width/red/index.php"><span>Boxed Layout</span></a> </li> <li class="level1 parent"><a href="http://htmldemo.magikcommerce.com/ecommerce/accord_html/full-width/blue/index.php"><span>Blue Color</span></a> </li> <li class="level1 parent"><a href="http://htmldemo.magikcommerce.com/ecommerce/accord_html/full-width/aqua/index.php"><span>Aqua Color</span></a> </li> <li class="level1 parent"><a href="http://htmldemo.magikcommerce.com/ecommerce/accord_html/full-width/orange/index.php"><span>Orange Color</span></a> </li> <li class="level1 parent"><a href="index.php"><span>Red Color</span></a> </li> <li class="level1 parent"><a href="http://htmldemo.magikcommerce.com/ecommerce/accord_html/full-width/green/index.php"><span>Green Color</span></a> </li> </ul> </li> <li class="level0 parent drop-menu"><a href="#"><span>Áo Nam</span> </a> <ul style="display: none;" class="level1"> <li class="level1 first"><a href="grid.php"><span>Grid</span></a></li> <li class="level1 nav-10-2"> <a href="list.php"> <span>List</span> </a> </li> <li class="level1 nav-10-3"> <a href="product_detail.php"> <span>Product Detail</span> </a> </li> <li class="level1 nav-10-4"> <a href="shopping_cart.php"> <span>Shopping Cart</span> </a> </li> <li class="level1 first parent"><a href="checkout.php"><span>Checkout</span></a> <ul class="level2"> <li class="level2 nav-2-1-1 first"><a href="checkout_method.php"><span>Checkout Method</span></a></li> <li class="level2 nav-2-1-5 last"><a href="checkout_billing_info.php"><span>Checkout Billing Info</span></a></li> </ul> </li> <li class="level1 nav-10-4"> <a href="wishlist.php"> <span>Wishlist</span> </a> </li> <li class="level1"> <a href="dashboard.php"> <span>Dashboard</span> </a> </li> <li class="level1"> <a href="multiple_addresses.php"> <span>Multiple Addresses</span> </a> </li> <li class="level1"> <a href="about_us.php"> <span>About us</span> </a> </li> <li class="level1"> <a href="login.php"> <span>Login</span> </a> </li> <li class="level1"> <a href="compare.php"> <span>Compare</span> </a> </li> <li class="level1"> <a href="delivery.php"> <span>Delivery</span> </a> </li> <li class="level1"> <a href="faq.php"> <span>FAQ</span> </a> </li> <li class="level1"> <a href="quick_view.php"> <span>Quick view </span> </a> </li> <li class="level1"> <a href="newsletter.php"> <span>Newsletter</span> </a> </li> <li class="level1 first parent"><a href="blog.php"><span>Blog</span></a> <ul class="level2"> <li class="level2 nav-2-1-1 first"><a href="blog_detail.php"><span>Blog Detail</span></a></li> </ul> </li> <li class="level1"><a href="contact_us.php"><span>Contact us</span></a> </li> <li class="level1"><a href="404error.php"><span>404 Error Page</span></a> </li> </ul> </li> <li class="level0 nav-5 level-top first"> <a href="grid.php" class="level-top"> <span>Aó Nữ</span> </a> <div style="display: none; left: 0px;" class="level0-wrapper dropdown-6col"> <div class="level0-wrapper2"> <div class="nav-block nav-block-center"> <ul class="level0"> <li class="level1 nav-6-1 first parent item"> <a href="grid.php"> <span>Styliest Bag </span> </a> <ul class="level1"> <li class="level2 nav-6-1-1 first"> <a href="grid.php"> <span>Clutch Handbags</span> </a> </li> <li class="level2 nav-6-1-2"> <a href="grid.php"> <span>Diaper Bags</span> </a> </li> <li class="level2 nav-6-1-2"> <a href="grid.php"> <span>Bags</span> </a> </li> <li class="level2 nav-6-1-3 last"> <a href="grid.php"> <span>Hobo Handbags</span> </a> </li> </ul> </li> <li class="level1 nav-6-2 parent item"> <a href="grid.php"> <span>Material Bag</span> </a> <ul class="level1"> <li class="level2 nav-6-2-4 first"> <a href="grid.php"> <span>Beaded Handbags</span> </a> </li> <li class="level2 nav-6-2-5"> <a href="grid.php"> <span>Fabric Handbags</span> </a> </li> <li class="level2 nav-6-2-5"> <a href="grid.php"> <span>Handbags</span> </a> </li> <li class="level2 nav-6-2-6 last"> <a href="grid.php"> <span>Leather Handbags</span> </a> </li> </ul> </li> <li class="level1 nav-6-3 parent item"> <a href="grid.php"> <span>Designer Bag</span> </a> <ul class="level1"> <li class="level2 nav-6-3-9 first"> <a href="grid.php"> <span>Flat Shoes</span> </a> </li> <li class="level2 nav-6-3-10"> <a href="grid.php"> <span>Flat Sandals</span> </a> </li> <li class="level2 nav-6-3-11"> <a href="grid.php"> <span>Boots</span> </a> </li> <li class="level2 nav-6-3-12 last"> <a href="grid.php"> <span>Heels</span> </a> </li> </ul> </li> <li class="level1 nav-6-4 parent item"> <a href="grid.php"> <span>Cotton Bag</span> </a> <ul class="level1"> <li class="level2 nav-6-4-13 first"> <a href="grid.php"> <span>Bracelets</span> </a> </li> <li class="level2 nav-6-4-14"> <a href="grid.php"> <span>Necklaces &amp; Pendants</span> </a> </li> <li class="level2 nav-6-4-14"> <a href="grid.php"> <span>Pendants</span> </a> </li> <li class="level2 nav-6-4-15 last"> <a href="grid.php"> <span>Pins &amp; Brooches</span> </a> </li> </ul> </li> <li class="level1 nav-6-5 last parent item"> <a href="grid.php"> <span>Swimwear</span> </a> <ul class="level1"> <li class="level2 nav-6-8-28 first"> <a href="grid.php"> <span>Swimsuits</span> </a> </li> <li class="level2 nav-6-8-29"> <a href="grid.php"> <span>Beach Clothing</span> </a> </li> <li class="level2 nav-6-8-29"> <a href="grid.php"> <span>Clothing</span> </a> </li> <li class="level2 nav-6-8-30 last"> <a href="grid.php"> <span>Bikinis</span> </a> </li> </ul> </li> </ul> </div> </div> <div class="nav-add"> <div class="push_item"> <div class="push_img"> <a href="#"> <img alt="" src="images/women_jwellery.png"> </a> </div> <div class="push_text">Lorem Ipsum is simply dummy text of the printing</div> </div> <div class="push_item"> <div class="push_img"> <a href="#"> <img alt="" src="images/women_bag.png"> </a> </div> <div class="push_text">Lorem Ipsum is simply dummy text of the printing</div> </div> <div class="push_item"> <div class="push_img"> <a href="#"> <img alt="" src="images/women_sandle.png"> </a> </div> <div class="push_text">Lorem Ipsum is simply dummy text of the printing</div> </div> <div class="push_item push_item_last"> <div class="push_img"> <a href="#"> <img alt="" src="images/women_top.png"> </a> </div> <div class="push_text">Lorem Ipsum is simply dummy text of the printing</div> </div> <br class="clear"> </div> </div> </li> <li class="level0 nav-7 level-top parent"> <a href="grid.php" class="level-top"> <span>Quần Nam</span> </a> <div style="display: none; left: 0px;" class="level0-wrapper dropdown-6col"> <div class="level0-wrapper2"> <div class="nav-block nav-block-center"> <ul class="level0"> <li class="level1 nav-7-1 first parent item"> <a href="grid.php"> <span>Gents Purses</span> </a> <ul class="level1"> <li class="level2 nav-7-3-15 first"> <a href="grid.php"> <span>Digital Cameras</span> </a> </li> <li class="level2 nav-7-3-16"> <a href="grid.php"> <span>Camcorders</span> </a> </li> <li class="level2 nav-7-3-17"> <a href="grid.php"> <span>Lenses</span> </a> </li> <li class="level2 nav-7-3-18"> <a href="grid.php"> <span>Filters</span> </a> </li> <li class="level2 nav-7-3-19 last"> <a href="grid.php"> <span>Tripods</span> </a> </li> </ul> </li> <li class="level1 nav-7-3 parent item"> <a href="grid.php"> <span>Gents Purses</span> </a> <ul class="level1"> <li class="level2 nav-7-3-15 first"> <a href="grid.php"> <span>Digital Cameras</span> </a> </li> <li class="level2 nav-7-3-16"> <a href="grid.php"> <span>Camcorders</span> </a> </li> <li class="level2 nav-7-3-17"> <a href="grid.php"> <span>Lenses</span> </a> </li> <li class="level2 nav-7-3-18"> <a href="grid.php"> <span>Filters</span> </a> </li> <li class="level2 nav-7-3-19 last"> <a href="grid.php"> <span>Tripods</span> </a> </li> </ul> </li> <li class="level1 nav-7-3 parent item"> <a href="grid.php"> <span>Gents Purses</span> </a> <ul class="level1"> <li class="level2 nav-7-3-15 first"> <a href="grid.php"> <span>Digital Cameras</span> </a> </li> <li class="level2 nav-7-3-16"> <a href="grid.php"> <span>Camcorders</span> </a> </li> <li class="level2 nav-7-3-17"> <a href="grid.php"> <span>Lenses</span> </a> </li> <li class="level2 nav-7-3-18"> <a href="grid.php"> <span>Filters</span> </a> </li> <li class="level2 nav-7-3-19 last"> <a href="grid.php"> <span>Tripods</span> </a> </li> </ul> </li> <li class="level1 nav-7-4 parent item"> <a href="grid.php"> <span>Gifts</span> </a> <ul class="level1"> <li class="level2 nav-7-2-8 first"> <a href="grid.php"> <span>Headsets</span> </a> </li> <li class="level2 nav-7-2-9"> <a href="grid.php"> <span>Batteries</span> </a> </li> <li class="level2 nav-7-2-10"> <a href="grid.php"> <span>Screen Protectors</span> </a> </li> <li class="level2 nav-7-2-11"> <a href="grid.php"> <span>Memory Cards</span> </a> </li> <li class="level2 nav-7-2-14 last"> <a href="grid.php"> <span>Cases</span> </a> </li> </ul> </li> <li class="level1 nav-7-4 last parent item"> <a href="grid.php"> <span>Accessories</span> </a> <ul class="level1"> <li class="level2 nav-7-2-8 first"> <a href="grid.php"> <span>Headsets</span> </a> </li> <li class="level2 nav-7-2-9"> <a href="grid.php"> <span>Batteries</span> </a> </li> <li class="level2 nav-7-2-10"> <a href="grid.php"> <span>Screen Protectors</span> </a> </li> <li class="level2 nav-7-2-11"> <a href="grid.php"> <span>Memory Cards</span> </a> </li> <li class="level2 nav-7-2-14 last"> <a href="grid.php"> <span>Cases</span> </a> </li> </ul> </li> </ul> </div> </div> </div> </li> <li class="level0 nav-6 level-top parent"> <a href="grid.php" class="level-top"> <span>Quần Nữ</span> </a> <div style="display: none; left: 0px;" class="level0-wrapper dropdown-6col"> <div class="level0-wrapper2"> <div class="nav-block nav-block-center grid13-8 itemgrid itemgrid-4col"> <ul class="level0"> <li class="level1 nav-6-3 parent item"> <a href="grid.php"> <span>Shoes </span> </a> <ul class="level1"> <li class="level2 nav-6-3-9 first"> <a href="grid.php"> <span>Flat Shoes</span> </a> </li> <li class="level2 nav-6-3-10"> <a href="grid.php"> <span>Flat Sandals</span> </a> </li> <li class="level2 nav-6-3-11"> <a href="grid.php"> <span>Boots</span> </a> </li> <li class="level2 nav-6-3-11"> <a href="grid.php"> <span>Boots</span> </a> </li> <li class="level2 nav-6-3-12 last"> <a href="grid.php"> <span>Heels</span> </a> </li> </ul> </li> <li class="level1 nav-6-4 parent item"> <a href="grid.php"> <span>Jewelry</span> </a> <ul class="level1"> <li class="level2 nav-6-4-13 first"> <a href="grid.php"> <span>Bracelets</span> </a> </li> <li class="level2 nav-6-4-14"> <a href="grid.php"> <span>Necklaces &amp; Pendants</span> </a> </li> <li class="level2 nav-6-4-14"> <a href="grid.php"> <span>Necklaces</span> </a> </li> <li class="level2 nav-6-4-14"> <a href="grid.php"> <span>Pendants</span> </a> </li> <li class="level2 nav-6-4-15 last"> <a href="grid.php"> <span>Pins &amp; Brooches</span> </a> </li> </ul> </li> <li class="level1 nav-6-5 parent item"> <a href="grid.php"> <span>Dresses</span> </a> <ul class="level1"> <li class="level2 nav-6-5-16 first"> <a href="grid.php"> <span>Casual Dresses</span> </a> </li> <li class="level2 nav-6-5-17"> <a href="grid.php"> <span>Evening</span> </a> </li> <li class="level2 nav-6-5-18"> <a href="grid.php"> <span>Designer</span> </a> </li> <li class="level2 nav-6-5-18"> <a href="grid.php"> <span>Designer</span> </a> </li> <li class="level2 nav-6-5-19 last"> <a href="grid.php"> <span>Party</span> </a> </li> </ul> </li> <li class="level1 nav-6-6 last parent item"> <a href="grid.php"> <span>Jackets</span> </a> <ul class="level1"> <li class="level2 nav-6-7-24 first"> <a href="grid.php"> <span>Coats</span> </a> </li> <li class="level2 nav-6-7-25"> <a href="grid.php"> <span>Jackets</span> </a> </li> <li class="level2 nav-6-7-26"> <a href="grid.php"> <span>Leather Jackets</span> </a> </li> <li class="level2 nav-6-7-26"> <a href="grid.php"> <span>Leather Jackets</span> </a> </li> <li class="level2 nav-6-7-27 last"> <a href="grid.php"> <span>Blazers</span> </a> </li> </ul> </li> </ul> </div> <div class="nav-block nav-block-right std grid12-3"> <a class="product-image" title="Stablished fact reader" href="#"> <img alt="Stablished fact reader" src="products-images/product2.jpg" width="150"></a> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="price-box"> <span class="regular-price"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> </li> <li class="level0 nav-7 level-top parent"> <a class="level-top" href="grid.php"> <span>Thời Trang Hè 2016</span> </a> <div class="level0-wrapper dropdown-6col" style="left: 0pt; display: none;"> <div class="level0-wrapper2"> <div class="nav-block nav-block-center grid12-8 itemgrid itemgrid-4col"> <ul class="level0"> <li class="level1 nav-7-1 first parent item"> <a href="grid.php"> <span>Smartphones</span> </a> <ul class="level1"> <li class="level2 nav-7-1-1 first"> <a href="grid.php"> <span>Samsung</span> </a> </li> <li class="level2 nav-7-1-2"> <a href="grid.php"> <span>Apple</span> </a> </li> <li class="level2 nav-7-1-4"> <a href="grid.php"> <span>BlackBerry</span> </a> </li> <li class="level2 nav-7-1-6"> <a href="grid.php"> <span>Nokia</span> </a> </li> <li class="level2 nav-7-1-7 last"> <a href="grid.php"> <span>HTC</span> </a> </li> </ul> </li> <li class="level1 nav-7-3 parent item"> <a href="grid.php"> <span>Cameras</span> </a> <ul class="level1"> <li class="level2 nav-7-3-15 first"> <a href="grid.php"> <span>Digital Cameras</span> </a> </li> <li class="level2 nav-7-3-16"> <a href="grid.php"> <span>Camcorders</span> </a> </li> <li class="level2 nav-7-3-17"> <a href="grid.php"> <span>Lenses</span> </a> </li> <li class="level2 nav-7-3-18"> <a href="grid.php"> <span>Filters</span> </a> </li> <li class="level2 nav-7-3-19 last"> <a href="grid.php"> <span>Tripods</span> </a> </li> </ul> </li> <li class="level1 nav-7-4 last parent item"> <a href="grid.php"> <span>Accessories</span> </a> <ul class="level1"> <li class="level2 nav-7-2-8 first"> <a href="grid.php"> <span>Headsets</span> </a> </li> <li class="level2 nav-7-2-9"> <a href="grid.php"> <span>Batteries</span> </a> </li> <li class="level2 nav-7-2-10"> <a href="grid.php"> <span>Screen Protectors</span> </a> </li> <li class="level2 nav-7-2-11"> <a href="grid.php"> <span>Memory Cards</span> </a> </li> <li class="level2 nav-7-2-14 last"> <a href="grid.php"> <span>Cases</span> </a> </li> </ul> </li> </ul> </div> <div class="nav-block nav-block-right std grid12-4"><a href="#/electronics/phone-accessories.php"><img src="images/menu_furniture.png" class="fade-on-hover" alt="product"></a> </div> </div> </div> </li> <li class="level0 nav-8 level-top"> <a href="grid.php" class="level-top"> <span>Váy Đầm</span> </a> </li> <li class="level0 nav-8 level-top"> <a href="grid.php" class="level-top"> <span>Giày Nam</span> </a> </li> <li class="nav-custom-link level0 level-top parent"> <a class="level-top" href="#"><span>Giày Nữ</span></a> <div style="display: none; left: 0px;" class="level0-wrapper"> <div class="header-nav-dropdown-wrapper clearer"> <div class="grid12-5"> <h4 class="heading">HTML5 + CSS3</h4> <div class="ccs3-html5-box"><em class="icon-html5">&nbsp;</em> <em class="icon-css3">&nbsp;</em></div> <p>Our designed to deliver almost everything you want to do online without requiring additional plugins.CSS3 has been split into "modules".</p> </div> <div class="grid12-5"> <h4 class="heading">Responsive Design</h4> <a href="#//"> <div class="icon-custom-reponsive"></div> </a> <p>Responsive design is a Web design to provide an optimal navigation with a minimum of resizing, and scrolling across a wide range of devices.</p> </div> <div class="grid12-5"> <h4 class="heading">Google Fonts</h4> <a href="#//"> <div class="icon-custom-google-font"></div> </a> <p>Our font delivery service is built upon a reliable, global network of servers. Our flexible solution provides multiple implementation options.</p> </div> <div class="grid12-5"> <h4 class="heading">Smart Product Grid</h4> <a href="#//"> <div class="icon-custom-grid"></div> </a> <p>Smart Product Grid is uses maximum available width of the screen to display content. It can be displayed on any screen or any devices.</p> </div> <br> </div> </div> </li> </ul> <!-- Search-col --> <!-- <div class="search-box"> <form action="http://htmldemo.magikcommerce.com/ecommerce/accord_html/full-width/red/cat" method="POST" id="search_mini_form" name="Categories"> <input type="text" placeholder="Search entire store here..." value="Search" maxlength="70" name="search" id="search"> <button class="btn btn-default search-btn-bg"> <span class="glyphicon glyphicon-search"></span>&nbsp;</button> </form> </div> --> <!-- End Search-col --> </div> </div> ======================= File: public/mega/checkout.php ======================= <!DOCTYPE html> <html lang="en"> <!-- Giao dien duoc chia se mien phi tai www.ptheme.net [Free HTML Download]. SKYPE[ptheme.net] - EMAIL[<EMAIL>].--> <!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack --> <head> <meta charset="utf-8"> <!--[if IE]> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <![endif]--> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <title>Accord, premium HTML5 &amp; CSS3 template</title> <!-- Favicons Icon --> <link rel="icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://demo.magikthemes.com/skin/frontend/base/default/favicon.ico" type="image/x-icon" /> <!-- Mobile Specific --> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <!-- CSS Style --> <!--<link rel="stylesheet" href="css/animate.css" type="text/css">--> <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"> <link rel="stylesheet" href="css/owl.carousel.css" type="text/css"> <link rel="stylesheet" href="css/owl.theme.css" type="text/css"> <link rel="stylesheet" href="css/font-awesome.css" type="text/css"> <link rel="stylesheet" href="css/style.css" type="text/css"> <!-- Google Fonts --> <link href='https://fonts.googleapis.com/css?family=Bitter:400,700,400italic' rel='stylesheet' type='text/css'> </head> <body class="cms-index-index"> <div class="page"> <!-- Header --> <header class="header-container"> <div class="header-top"> <div class="container"> <div class="row"> <div class="col-lg-5 col-md-5 col-xs-6"> <!-- Header Language --> <div class="dropdown block-language-wrapper"> <a role="button" data-toggle="dropdown" data-target="#" class="block-language dropdown-toggle" href="#"> <img src="images/english.png" alt="language"> English <i class="icon-angle-down"></i> </a> <ul class="dropdown-menu" role="menu"> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"><img src="images/english.png" alt="language"> English </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"><img src="images/francais.png" alt="language"> French </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"><img src="images/german.png" alt="language"> German </a></li> </ul> </div> <!-- End Header Language --> <!-- Header Currency --> <div class="dropdown block-currency-wrapper"> <a role="button" data-toggle="dropdown" data-target="#" class="block-currency dropdown-toggle" href="#"> USD <i class="icon-angle-down"></i></a> <ul class="dropdown-menu" role="menu"> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"> $ - Dollar </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"> £ - Pound </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"> € - Euro </a></li> </ul> </div> <!-- End Header Currency --> <div class="welcome-msg hidden-xs"> Default welcome msg! </div> </div> <div class="col-lg-7 col-md-7 col-xs-6"> <!-- Header Top Links --> <div class="toplinks"> <div class="links"> <div class="myaccount"><a title="My Account" href="login.php"><span>My Account</span></a></div> <div class="wishlist"><a title="My Wishlist" href="wishlist.php"><span>Wishlist</span></a></div> <div class="check"><a href="checkout.php" title="Checkout"><span>Checkout</span></a></div> <div class="demo"><a href="#" title="Demo"><span>Demo</span></a></div> <!-- Header Company --> <div class="dropdown block-company-wrapper hidden-xs"> <a role="button" data-toggle="dropdown" data-target="#" class="dropdown-toggle" href="#"> <span>Company</span> <i class="icon-angle-down"></i></a> <ul class="dropdown-menu" role="menu"> <li role="presentation"><a role="menuitem" tabindex="-1" href="about_us.php"> About Us </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"> Customer Service </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#"> Privacy Policy </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="site_map.php">Site Map </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Search Terms </a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Advanced Search </a></li> </ul> </div> <!-- End Header Company --> <div class="login"><a href="login.php"><span>Log In</span></a></div> </div> </div> <!-- End Header Top Links --> </div> </div> </div> </div> <div class="header container"> <div class="row"> <div class="col-lg-3 col-sm-4 col-md-3"> <!-- Header Logo --> <div class="logo"> <a title="Magento Commerce" href="index.php"><img alt="Magento Commerce" src="images/logo.png"></a> </div> <!-- End Header Logo --> </div> <div class="col-lg-9 col-xs-12"> <div class="top-cart-contain"> <div class="mini-cart"> <div data-toggle="dropdown" data-hover="dropdown" class="basket dropdown-toggle"> <a href="#"><span>Shopping Cart (5)</span></a></div> <div> <div style="display: none;" class="top-cart-content arrow_box"> <div class="block-subtitle">Recently added item(s)</div> <ul id="cart-sidebar" class="mini-products-list"> <li class="item odd"> <a href="product_detail.php" title="Sample Product" class="product-image"><img src="products-images/product3.jpg" alt="Sample Product" width="55"></a> <div class="product-details"> <a href="#" title="Remove This Item" onClick="" class="btn-remove1">Remove This Item</a> <a class="btn-edit" title="Edit item" href="#">Edit item</a> <p class="product-name"><a href="product_detail.php">Sample Product</a> </p> <strong>1</strong> x <span class="price">$20.00</span> </div> </li> <li class="item even"> <a href="product_detail.php" title="Sample Product" class="product-image"><img src="products-images/product1.jpg" alt="Sample Product" width="55"></a> <div class="product-details"> <a href="#" title="Remove This Item" onClick="" class="btn-remove1">Remove This Item</a> <a class="btn-edit" title="Edit item" href="#">Edit item</a> <p class="product-name"><a href="product_detail.php">Sample Product</a> </p> <strong>1</strong> x <span class="price">$230.00</span> </div> </li> <li class="item last odd"> <a href="product_detail.php" title="Sample Product" class="product-image"><img src="products-images/product5.jpg" alt="Sample Product" width="55"></a> <div class="product-details"> <a href="#" title="Remove This Item" onClick="" class="btn-remove1">Remove This Item</a><a class="btn-edit" title="Edit item" href="#">Edit item</a> <p class="product-name"><a href="product_detail.php">Sample Product</a> </p> <strong>2</strong> x <span class="price">$420.00</span> </div> </li> </ul> <div class="top-subtotal">Subtotal: <span class="price">$520.00</span></div> <div class="actions"> <button class="btn-checkout" type="button"><span>Checkout</span></button> <button class="view-cart" type="button"><span>View Cart</span></button> </div> </div> </div> </div> <div id="ajaxconfig_info" style="display:none"> <a href="#/"></a> <input value="" type="hidden"> <input id="enable_module" value="1" type="hidden"> <input class="effect_to_cart" value="1" type="hidden"> <input class="title_shopping_cart" value="Go to shopping cart" type="hidden"> </div> </div> </div> </div> </div> </header> <!-- end header --> <!-- Navbar --> <nav> <div class="container"> <div class="nav-inner"> <!-- mobile-menu --> <div class="hidden-desktop" id="mobile-menu"> <ul class="navmenu"> <li> <div class="menutop"> <div class="toggle"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></div> </div> <ul style="display:none;" class="submenu"> <li> <ul class="topnav"> <li class="level0 nav-1 level-top first parent"> <a href="grid.php" class="level-top"> <span>Women</span> </a> <ul class="level0"> <li class="level1 nav-1-1 first parent"> <a href="grid.php"> <span>Stylish Bag</span> </a> <ul class="level1"> <li class="level2 nav-1-1-1 first"> <a href="grid.php"> <span>Clutch Handbags</span> </a> </li> <li class="level2 nav-1-1-2"> <a href="grid.php"> <span>Diaper Bags</span> </a> </li> <li class="level2 nav-1-1-3"> <a href="grid.php"> <span>Bags</span> </a> </li> <li class="level2 nav-1-1-4 last"> <a href="grid.php"> <span>Hobo Handbags</span> </a> </li> </ul> </li> <li class="level1 nav-1-2 parent"> <a href="grid.php"> <span>Material Bag</span> </a> <ul class="level1"> <li class="level2 nav-1-2-5 first"> <a href="grid.php"> <span>Beaded Handbags</span> </a> </li> <li class="level2 nav-1-2-6"> <a href="grid.php"> <span>Fabric Handbags</span> </a> </li> <li class="level2 nav-1-2-7"> <a href="grid.php"> <span>Handbags</span> </a> </li> <li class="level2 nav-1-2-8 last"> <a href="grid.php"> <span>Leather Handbags</span> </a> </li> </ul> </li> <li class="level1 nav-1-3 parent"> <a href="grid.php"> <span>Shoes</span> </a> <ul class="level1"> <li class="level2 nav-1-3-9 first"> <a href="grid.php"> <span>Flat Shoes</span> </a> </li> <li class="level2 nav-1-3-10"> <a href="grid.php"> <span>Flat Sandals</span> </a> </li> <li class="level2 nav-1-3-11"> <a href="grid.php"> <span>Boots</span> </a> </li> <li class="level2 nav-1-3-12 last"> <a href="grid.php"> <span>Heels</span> </a> </li> </ul> </li> <li class="level1 nav-1-4 parent"> <a href="grid.php"> <span>Jwellery</span> </a> <ul class="level1"> <li class="level2 nav-1-4-13 first"> <a href="grid.php"> <span>Bracelets</span> </a> </li> <li class="level2 nav-1-4-14"> <a href="grid.php"> <span>Necklaces &amp; Pendants</span> </a> </li> <li class="level2 nav-1-4-15"> <a href="grid.php"> <span>Pendants</span> </a> </li> <li class="level2 nav-1-4-16 last"> <a href="grid.php"> <span>Pins &amp; Brooches</span> </a> </li> </ul> </li> <li class="level1 nav-1-5 parent"> <a href="grid.php"> <span>Dresses</span> </a> <ul class="level1"> <li class="level2 nav-1-5-17 first"> <a href="grid.php"> <span>Casual Dresses</span> </a> </li> <li class="level2 nav-1-5-18"> <a href="grid.php"> <span>Evening</span> </a> </li> <li class="level2 nav-1-5-19"> <a href="grid.php"> <span>Designer</span> </a> </li> <li class="level2 nav-1-5-20 last"> <a href="grid.php"> <span>Party</span> </a> </li> </ul> </li> <li class="level1 nav-1-6 last parent"> <a href="grid.php"> <span>Swimwear</span> </a> <ul class="level1"> <li class="level2 nav-1-6-21 first"> <a href="grid.php"> <span>Swimsuits</span> </a> </li> <li class="level2 nav-1-6-22"> <a href="grid.php"> <span>Beach Clothing</span> </a> </li> <li class="level2 nav-1-6-23"> <a href="grid.php"> <span>Clothing</span> </a> </li> <li class="level2 nav-1-6-24 last"> <a href="grid.php"> <span>Bikinis</span> </a> </li> </ul> </li> </ul> </li> <li class="level0 nav-2 level-top parent"> <a href="grid.php" class="level-top"> <span>Men</span> </a> <ul class="level0"> <li class="level1 nav-2-1 first parent"> <a href="grid.php"> <span>Shoes</span> </a> <ul class="level1"> <li class="level2 nav-2-1-1 first"> <a href="grid.php"> <span>Sport Shoes</span> </a> </li> <li class="level2 nav-2-1-2"> <a href="grid.php"> <span>Casual Shoes</span> </a> </li> <li class="level2 nav-2-1-3"> <a href="grid.php"> <span>Leather Shoes</span> </a> </li> <li class="level2 nav-2-1-4 last"> <a href="grid.php"> <span>canvas shoes</span> </a> </li> </ul> </li> <li class="level1 nav-2-2 parent"> <a href="grid.php"> <span>Dresses</span> </a> <ul class="level1"> <li class="level2 nav-2-2-5 first"> <a href="grid.php"> <span>Casual Dresses</span> </a> </li> <li class="level2 nav-2-2-6"> <a href="grid.php"> <span>Evening</span> </a> </li> <li class="level2 nav-2-2-7"> <a href="grid.php"> <span>Designer</span> </a> </li> <li class="level2 nav-2-2-8 last"> <a href="grid.php"> <span>Party</span> </a> </li> </ul> </li> <li class="level1 nav-2-3 parent"> <a href="grid.php"> <span>Jackets</span> </a> <ul class="level1"> <li class="level2 nav-2-3-9 first"> <a href="grid.php"> <span>Coats</span> </a> </li> <li class="level2 nav-2-3-10"> <a href="grid.php"> <span>Formal Jackets</span> </a> </li> <li class="level2 nav-2-3-11"> <a href="grid.php"> <span>Leather Jackets</span> </a> </li> <li class="level2 nav-2-3-12 last"> <a href="grid.php"> <span>Blazers</span> </a> </li> </ul> </li> <li class="level1 nav-2-4 parent"> <a href="grid.php"> <span>Watches</span> </a> <ul class="level1"> <li class="level2 nav-2-4-13 first"> <a href="grid.php"> <span>Fastrack</span> </a> </li> <li class="level2 nav-2-4-14"> <a href="grid.php"> <span>Casio</span> </a> </li> <li class="level2 nav-2-4-15"> <a href="grid.php"> <span>Titan</span> </a> </li> <li class="level2 nav-2-4-16 last"> <a href="grid.php"> <span>Tommy-Hilfiger</span> </a> </li> </ul> </li> <li class="level1 nav-2-5 parent"> <a href="grid.php"> <span>Sunglasses</span> </a> <ul class="level1"> <li class="level2 nav-2-5-17 first"> <a href="grid.php"> <span>Ray Ban</span> </a> </li> <li class="level2 nav-2-5-18"> <a href="grid.php"> <span>Fastrack</span> </a> </li> <li class="level2 nav-2-5-19"> <a href="grid.php"> <span>Police</span> </a> </li> <li class="level2 nav-2-5-20 last"> <a href="grid.php"> <span>Oakley</span> </a> </li> </ul> </li> <li class="level1 nav-2-6 last parent"> <a href="grid.php"> <span>Accessories</span> </a> <ul class="level1"> <li class="level2 nav-2-6-21 first"> <a href="grid.php"> <span>Backpacks</span> </a> </li> <li class="level2 nav-2-6-22"> <a href="grid.php"> <span>Wallets</span> </a> </li> <li class="level2 nav-2-6-23"> <a href="grid.php"> <span>Laptop Bags</span> </a> </li> <li class="level2 nav-2-6-24 last"> <a href="grid.php"> <span>Belts</span> </a> </li> </ul> </li> </ul> </li> <li class="level0 nav-3 level-top parent"> <a href="grid.php" class="level-top"> <span>Electronics</span> </a> <ul class="level0"> <li class="level1 nav-3-1 first parent"> <a href="grid.php"> <span>Mobiles</span> </a> <ul class="level1"> <li class="level2 nav-3-1-1 first"> <a href="grid.php"> <span>Samsung</span> </a> </li> <li class="level2 nav-3-1-2"> <a href="grid.php"> <span>Nokia</span> </a> </li> <li class="level2 nav-3-1-3"> <a href="grid.php"> <span>iPhone</span> </a> </li> <li class="level2 nav-3-1-4 last"> <a href="grid.php"> <span>Sony</span> </a> </li> </ul> </li> <li class="level1 nav-3-2 parent"> <a href="grid.php"> <span>Accessories</span> </a> <ul class="level1"> <li class="level2 nav-3-2-5 first"> <a href="grid.php"> <span>Mobile Memory Cards</span> </a> </li> <li class="level2 nav-3-2-6"> <a href="grid.php"> <span>Cases &amp; Covers</span> </a> </li> <li class="level2 nav-3-2-7"> <a href="grid.php"> <span>Mobile Headphones</span> </a> </li> <li class="level2 nav-3-2-8 last"> <a href="grid.php"> <span>Bluetooth Headsets</span> </a> </li> </ul> </li> <li class="level1 nav-3-3 parent"> <a href="grid.php"> <span>Cameras</span> </a> <ul class="level1"> <li class="level2 nav-3-3-9 first"> <a href="grid.php"> <span>Camcorders</span> </a> </li> <li class="level2 nav-3-3-10"> <a href="grid.php"> <span>Point &amp; Shoot</span> </a> </li> <li class="level2 nav-3-3-11"> <a href="grid.php"> <span>Digital SLR</span> </a> </li> <li class="level2 nav-3-3-12 last"> <a href="grid.php"> <span>Camera Accessories</span> </a> </li> </ul> </li> <li class="level1 nav-3-4 parent"> <a href="grid.php"> <span>Audio &amp; Video</span> </a> <ul class="level1"> <li class="level2 nav-3-4-13 first"> <a href="grid.php"> <span>MP3 Players</span> </a> </li> <li class="level2 nav-3-4-14"> <a href="grid.php"> <span>iPods</span> </a> </li> <li class="level2 nav-3-4-15"> <a href="grid.php"> <span>Speakers</span> </a> </li> <li class="level2 nav-3-4-16 last"> <a href="grid.php"> <span>Video Players</span> </a> </li> </ul> </li> <li class="level1 nav-3-5 parent"> <a href="grid.php"> <span>Computer</span> </a> <ul class="level1"> <li class="level2 nav-3-5-17 first"> <a href="grid.php"> <span>External Hard Disks</span> </a> </li> <li class="level2 nav-3-5-18"> <a href="grid.php"> <span>Pendrives</span> </a> </li> <li class="level2 nav-3-5-19"> <a href="grid.php"> <span>Headphones</span> </a> </li> <li class="level2 nav-3-5-20 last"> <a href="grid.php"> <span>PC Components</span> </a> </li> </ul> </li> <li class="level1 nav-3-6 last parent"> <a href="grid.php"> <span>Appliances </span> </a> <ul class="level1"> <li class="level2 nav-3-6-21 first"> <a href="grid.php"> <span>Vacuum Cleaners</span> </a> </li> <li class="level2 nav-3-6-22"> <a href="grid.php"> <span>Indoor Lighting</span> </a> </li> <li class="level2 nav-3-6-23"> <a href="grid.php"> <span>Kitchen Tools</span> </a> </li> <li class="level2 nav-3-6-24 last"> <a href="grid.php"> <span>Water Purifiers</span> </a> </li> </ul> </li> </ul> </li> <li class="level0 nav-4 level-top parent"> <a href="grid.php" class="level-top"> <span>Furniture</span> </a> <ul class="level0"> <li class="level1 nav-4-1 first parent"> <a href="grid.php"> <span>Living Room</span> </a> <ul class="level1"> <li class="level2 nav-4-1-1 first"> <a href="grid.php"> <span>Racks &amp; Cabinets</span> </a> </li> <li class="level2 nav-4-1-2"> <a href="grid.php"> <span>Sofas</span> </a> </li> <li class="level2 nav-4-1-3"> <a href="grid.php"> <span>Chairs</span> </a> </li> <li class="level2 nav-4-1-4 last"> <a href="grid.php"> <span>Tables</span> </a> </li> </ul> </li> <li class="level1 nav-4-2 parent"> <a href="grid.php"> <span>Dining &amp; Bar</span> </a> <ul class="level1"> <li class="level2 nav-4-2-5 first"> <a href="grid.php"> <span>Dining Table Sets</span> </a> </li> <li class="level2 nav-4-2-6"> <a href="grid.php"> <span>Serving Trolleys</span> </a> </li> <li class="level2 nav-4-2-7"> <a href="grid.php"> <span>Bar Counters</span> </a> </li> <li class="level2 nav-4-2-8 last"> <a href="grid.php"> <span>Dining Cabinets</span> </a> </li> </ul> </li> <li class="level1 nav-4-3 parent"> <a href="grid.php"> <span>Bedroom</span> </a> <ul class="level1"> <li class="level2 nav-4-3-9 first"> <a href="grid.php"> <span>Beds</span> </a> </li> <li class="level2 nav-4-3-10"> <a href="grid.php"> <span>Chest of Drawers</span> </a> </li> <li class="level2 nav-4-3-11"> <a href="grid.php"> <span>Wardrobes &amp; Almirahs</span> </a> </li> <li class="level2 nav-4-3-12 last"> <a href="grid.php"> <span>Nightstands</span> </a> </li> </ul> </li> <li class="level1 nav-4-4 last parent"> <a href="grid.php"> <span>Kitchen</span> </a> <ul class="level1"> <li class="level2 nav-4-4-13 first"> <a href="grid.php"> <span>Kitchen Racks</span> </a> </li> <li class="level2 nav-4-4-14"> <a href="grid.php"> <span>Kitchen Fittings</span> </a> </li> <li class="level2 nav-4-4-15"> <a href="grid.php"> <span>Wall Units</span> </a> </li> <li class="level2 nav-4-4-16 last"> <a href="grid.php"> <span>Benches &amp; Stools</span> </a> </li> </ul> </li> </ul> </li> <li class="level0 nav-5 level-top"> <a href="grid.php" class="level-top"> <span>Fashion</span> </a> </li> <li class="level0 nav-6 level-top first parent last"> <a class="level-top" href="#"> <span>Pages</span> </a> <ul class="level0"> <li class="level1 first"><a href="grid.php"><span>Grid</span></a></li> <li class="level1 nav-10-2"> <a href="list.php"> <span>List</span> </a> </li> <li class="level1 nav-10-3"> <a href="product_detail.php"> <span>Product Detail</span> </a> </li> <li class="level1 nav-10-4"> <a href="shopping_cart.php"> <span>Shopping Cart</span> </a> </li> <li class="level1 first"><a href="checkout.php"><span>Checkout</span></a> </li> <li class="level1 nav-10-4"> <a href="wishlist.php"> <span>Wishlist</span> </a> </li> <li class="level1"> <a href="dashboard.php"> <span>Dashboard</span> </a> </li> <li class="level1"> <a href="multiple_addresses.php"> <span>Multiple Addresses</span> </a> </li> <li class="level1"> <a href="about_us.php"> <span>About us</span> </a> </li> <li class="level1"> <a href="login.php"> <span>Login</span> </a> </li> <li class="level1"> <a href="compare.php"> <span>Compare</span> </a> </li> <li class="level1"> <a href="delivery.php"> <span>Delivery</span> </a> </li> <li class="level1"> <a href="faq.php"> <span>FAQ</span> </a> </li> <li class="level1"> <a href="quick_view.php"> <span>Quick view </span> </a> </li> <li class="level1"> <a href="newsletter.php"> <span>Newsletter</span> </a> </li> <li class="level1"><a href="blog.php"><span>Blog</span></a> </li> <li class="level1"><a href="contact_us.php"><span>Contact us</span></a> </li> <li class="level1"><a href="404error.php"><span>404 Error Page</span></a> </li> </ul> </li> </ul> </li> </ul> </li> </ul> <!--navmenu--> </div> <!--End mobile-menu --> <ul id="nav" class="hidden-xs"> <li class="level1" ><a href="index.php"><span>Home</span> </a> <ul class="level1" style="display: none;"> <li class="level1 first parent"><a href="index.php"><span>Full Width Layout</span></a> </li> <li class="level1 parent"><a href="http://htmldemo.magikcommerce.com/ecommerce/accord_html/boxed-width/red/index.php"><span>Boxed Layout</span></a> </li> <li class="level1 parent"><a href="http://htmldemo.magikcommerce.com/ecommerce/accord_html/full-width/blue/index.php"><span>Blue Color</span></a> </li> <li class="level1 parent"><a href="http://htmldemo.magikcommerce.com/ecommerce/accord_html/full-width/aqua/index.php"><span>Aqua Color</span></a> </li> <li class="level1 parent"><a href="http://htmldemo.magikcommerce.com/ecommerce/accord_html/full-width/orange/index.php"><span>Orange Color</span></a> </li> <li class="level1 parent"><a href="index.php"><span>Red Color</span></a> </li> <li class="level1 parent"><a href="http://htmldemo.magikcommerce.com/ecommerce/accord_html/full-width/green/index.php"><span>Green Color</span></a> </li> </ul> </li> <li class="level0 parent drop-menu"><a href="#"><span>Pages</span> </a> <ul style="display: none;" class="level1"> <li class="level1 first"><a href="grid.php"><span>Grid</span></a></li> <li class="level1 nav-10-2"> <a href="list.php"> <span>List</span> </a> </li> <li class="level1 nav-10-3"> <a href="product_detail.php"> <span>Product Detail</span> </a> </li> <li class="level1 nav-10-4"> <a href="shopping_cart.php"> <span>Shopping Cart</span> </a> </li> <li class="level1 first parent"><a href="checkout.php"><span>Checkout</span></a> <ul class="level2"> <li class="level2 nav-2-1-1 first"><a href="checkout_method.php"><span>Checkout Method</span></a></li> <li class="level2 nav-2-1-5 last"><a href="checkout_billing_info.php"><span>Checkout Billing Info</span></a></li> </ul> </li> <li class="level1 nav-10-4"> <a href="wishlist.php"> <span>Wishlist</span> </a> </li> <li class="level1"> <a href="dashboard.php"> <span>Dashboard</span> </a> </li> <li class="level1"> <a href="multiple_addresses.php"> <span>Multiple Addresses</span> </a> </li> <li class="level1"> <a href="about_us.php"> <span>About us</span> </a> </li> <li class="level1"> <a href="login.php"> <span>Login</span> </a> </li> <li class="level1"> <a href="compare.php"> <span>Compare</span> </a> </li> <li class="level1"> <a href="delivery.php"> <span>Delivery</span> </a> </li> <li class="level1"> <a href="faq.php"> <span>FAQ</span> </a> </li> <li class="level1"> <a href="quick_view.php"> <span>Quick view </span> </a> </li> <li class="level1"> <a href="newsletter.php"> <span>Newsletter</span> </a> </li> <li class="level1 first parent"><a href="blog.php"><span>Blog</span></a> <ul class="level2"> <li class="level2 nav-2-1-1 first"><a href="blog_detail.php"><span>Blog Detail</span></a></li> </ul> </li> <li class="level1"><a href="contact_us.php"><span>Contact us</span></a> </li> <li class="level1"><a href="404error.php"><span>404 Error Page</span></a> </li> </ul> </li> <li class="level0 nav-5 level-top first"> <a href="grid.php" class="level-top"> <span>Women</span> </a> <div style="display: none; left: 0px;" class="level0-wrapper dropdown-6col"> <div class="level0-wrapper2"> <div class="nav-block nav-block-center"> <ul class="level0"> <li class="level1 nav-6-1 first parent item"> <a href="grid.php"> <span>Styliest Bag </span> </a> <ul class="level1"> <li class="level2 nav-6-1-1 first"> <a href="grid.php"> <span>Clutch Handbags</span> </a> </li> <li class="level2 nav-6-1-2"> <a href="grid.php"> <span>Diaper Bags</span> </a> </li> <li class="level2 nav-6-1-2"> <a href="grid.php"> <span>Bags</span> </a> </li> <li class="level2 nav-6-1-3 last"> <a href="grid.php"> <span>Hobo Handbags</span> </a> </li> </ul> </li> <li class="level1 nav-6-2 parent item"> <a href="grid.php"> <span>Material Bag</span> </a> <ul class="level1"> <li class="level2 nav-6-2-4 first"> <a href="grid.php"> <span>Beaded Handbags</span> </a> </li> <li class="level2 nav-6-2-5"> <a href="grid.php"> <span>Fabric Handbags</span> </a> </li> <li class="level2 nav-6-2-5"> <a href="grid.php"> <span>Handbags</span> </a> </li> <li class="level2 nav-6-2-6 last"> <a href="grid.php"> <span>Leather Handbags</span> </a> </li> </ul> </li> <li class="level1 nav-6-3 parent item"> <a href="grid.php"> <span>Designer Bag</span> </a> <ul class="level1"> <li class="level2 nav-6-3-9 first"> <a href="grid.php"> <span>Flat Shoes</span> </a> </li> <li class="level2 nav-6-3-10"> <a href="grid.php"> <span>Flat Sandals</span> </a> </li> <li class="level2 nav-6-3-11"> <a href="grid.php"> <span>Boots</span> </a> </li> <li class="level2 nav-6-3-12 last"> <a href="grid.php"> <span>Heels</span> </a> </li> </ul> </li> <li class="level1 nav-6-4 parent item"> <a href="grid.php"> <span>Cotton Bag</span> </a> <ul class="level1"> <li class="level2 nav-6-4-13 first"> <a href="grid.php"> <span>Bracelets</span> </a> </li> <li class="level2 nav-6-4-14"> <a href="grid.php"> <span>Necklaces &amp; Pendants</span> </a> </li> <li class="level2 nav-6-4-14"> <a href="grid.php"> <span>Pendants</span> </a> </li> <li class="level2 nav-6-4-15 last"> <a href="grid.php"> <span>Pins &amp; Brooches</span> </a> </li> </ul> </li> <li class="level1 nav-6-5 last parent item"> <a href="grid.php"> <span>Swimwear</span> </a> <ul class="level1"> <li class="level2 nav-6-8-28 first"> <a href="grid.php"> <span>Swimsuits</span> </a> </li> <li class="level2 nav-6-8-29"> <a href="grid.php"> <span>Beach Clothing</span> </a> </li> <li class="level2 nav-6-8-29"> <a href="grid.php"> <span>Clothing</span> </a> </li> <li class="level2 nav-6-8-30 last"> <a href="grid.php"> <span>Bikinis</span> </a> </li> </ul> </li> </ul> </div> </div> <div class="nav-add"> <div class="push_item"> <div class="push_img"> <a href="#"> <img alt="" src="images/women_jwellery.png"> </a> </div> <div class="push_text">Lorem Ipsum is simply dummy text of the printing</div> </div> <div class="push_item"> <div class="push_img"> <a href="#"> <img alt="" src="images/women_bag.png"> </a> </div> <div class="push_text">Lorem Ipsum is simply dummy text of the printing</div> </div> <div class="push_item"> <div class="push_img"> <a href="#"> <img alt="" src="images/women_sandle.png"> </a> </div> <div class="push_text">Lorem Ipsum is simply dummy text of the printing</div> </div> <div class="push_item push_item_last"> <div class="push_img"> <a href="#"> <img alt="" src="images/women_top.png"> </a> </div> <div class="push_text">Lorem Ipsum is simply dummy text of the printing</div> </div> <br class="clear"> </div> </div> </li> <li class="level0 nav-7 level-top parent"> <a href="grid.php" class="level-top"> <span>Men</span> </a> <div style="display: none; left: 0px;" class="level0-wrapper dropdown-6col"> <div class="level0-wrapper2"> <div class="nav-block nav-block-center"> <ul class="level0"> <li class="level1 nav-7-1 first parent item"> <a href="grid.php"> <span>Gents Purses</span> </a> <ul class="level1"> <li class="level2 nav-7-3-15 first"> <a href="grid.php"> <span>Digital Cameras</span> </a> </li> <li class="level2 nav-7-3-16"> <a href="grid.php"> <span>Camcorders</span> </a> </li> <li class="level2 nav-7-3-17"> <a href="grid.php"> <span>Lenses</span> </a> </li> <li class="level2 nav-7-3-18"> <a href="grid.php"> <span>Filters</span> </a> </li> <li class="level2 nav-7-3-19 last"> <a href="grid.php"> <span>Tripods</span> </a> </li> </ul> </li> <li class="level1 nav-7-3 parent item"> <a href="grid.php"> <span>Gents Purses</span> </a> <ul class="level1"> <li class="level2 nav-7-3-15 first"> <a href="grid.php"> <span>Digital Cameras</span> </a> </li> <li class="level2 nav-7-3-16"> <a href="grid.php"> <span>Camcorders</span> </a> </li> <li class="level2 nav-7-3-17"> <a href="grid.php"> <span>Lenses</span> </a> </li> <li class="level2 nav-7-3-18"> <a href="grid.php"> <span>Filters</span> </a> </li> <li class="level2 nav-7-3-19 last"> <a href="grid.php"> <span>Tripods</span> </a> </li> </ul> </li> <li class="level1 nav-7-3 parent item"> <a href="grid.php"> <span>Gents Purses</span> </a> <ul class="level1"> <li class="level2 nav-7-3-15 first"> <a href="grid.php"> <span>Digital Cameras</span> </a> </li> <li class="level2 nav-7-3-16"> <a href="grid.php"> <span>Camcorders</span> </a> </li> <li class="level2 nav-7-3-17"> <a href="grid.php"> <span>Lenses</span> </a> </li> <li class="level2 nav-7-3-18"> <a href="grid.php"> <span>Filters</span> </a> </li> <li class="level2 nav-7-3-19 last"> <a href="grid.php"> <span>Tripods</span> </a> </li> </ul> </li> <li class="level1 nav-7-4 parent item"> <a href="grid.php"> <span>Gifts</span> </a> <ul class="level1"> <li class="level2 nav-7-2-8 first"> <a href="grid.php"> <span>Headsets</span> </a> </li> <li class="level2 nav-7-2-9"> <a href="grid.php"> <span>Batteries</span> </a> </li> <li class="level2 nav-7-2-10"> <a href="grid.php"> <span>Screen Protectors</span> </a> </li> <li class="level2 nav-7-2-11"> <a href="grid.php"> <span>Memory Cards</span> </a> </li> <li class="level2 nav-7-2-14 last"> <a href="grid.php"> <span>Cases</span> </a> </li> </ul> </li> <li class="level1 nav-7-4 last parent item"> <a href="grid.php"> <span>Accessories</span> </a> <ul class="level1"> <li class="level2 nav-7-2-8 first"> <a href="grid.php"> <span>Headsets</span> </a> </li> <li class="level2 nav-7-2-9"> <a href="grid.php"> <span>Batteries</span> </a> </li> <li class="level2 nav-7-2-10"> <a href="grid.php"> <span>Screen Protectors</span> </a> </li> <li class="level2 nav-7-2-11"> <a href="grid.php"> <span>Memory Cards</span> </a> </li> <li class="level2 nav-7-2-14 last"> <a href="grid.php"> <span>Cases</span> </a> </li> </ul> </li> </ul> </div> </div> </div> </li> <li class="level0 nav-6 level-top parent"> <a href="grid.php" class="level-top"> <span>Electronics</span> </a> <div style="display: none; left: 0px;" class="level0-wrapper dropdown-6col"> <div class="level0-wrapper2"> <div class="nav-block nav-block-center grid13-8 itemgrid itemgrid-4col"> <ul class="level0"> <li class="level1 nav-6-3 parent item"> <a href="grid.php"> <span>Shoes </span> </a> <ul class="level1"> <li class="level2 nav-6-3-9 first"> <a href="grid.php"> <span>Flat Shoes</span> </a> </li> <li class="level2 nav-6-3-10"> <a href="grid.php"> <span>Flat Sandals</span> </a> </li> <li class="level2 nav-6-3-11"> <a href="grid.php"> <span>Boots</span> </a> </li> <li class="level2 nav-6-3-11"> <a href="grid.php"> <span>Boots</span> </a> </li> <li class="level2 nav-6-3-12 last"> <a href="grid.php"> <span>Heels</span> </a> </li> </ul> </li> <li class="level1 nav-6-4 parent item"> <a href="grid.php"> <span>Jewelry</span> </a> <ul class="level1"> <li class="level2 nav-6-4-13 first"> <a href="grid.php"> <span>Bracelets</span> </a> </li> <li class="level2 nav-6-4-14"> <a href="grid.php"> <span>Necklaces &amp; Pendants</span> </a> </li> <li class="level2 nav-6-4-14"> <a href="grid.php"> <span>Necklaces</span> </a> </li> <li class="level2 nav-6-4-14"> <a href="grid.php"> <span>Pendants</span> </a> </li> <li class="level2 nav-6-4-15 last"> <a href="grid.php"> <span>Pins &amp; Brooches</span> </a> </li> </ul> </li> <li class="level1 nav-6-5 parent item"> <a href="grid.php"> <span>Dresses</span> </a> <ul class="level1"> <li class="level2 nav-6-5-16 first"> <a href="grid.php"> <span>Casual Dresses</span> </a> </li> <li class="level2 nav-6-5-17"> <a href="grid.php"> <span>Evening</span> </a> </li> <li class="level2 nav-6-5-18"> <a href="grid.php"> <span>Designer</span> </a> </li> <li class="level2 nav-6-5-18"> <a href="grid.php"> <span>Designer</span> </a> </li> <li class="level2 nav-6-5-19 last"> <a href="grid.php"> <span>Party</span> </a> </li> </ul> </li> <li class="level1 nav-6-6 last parent item"> <a href="grid.php"> <span>Jackets</span> </a> <ul class="level1"> <li class="level2 nav-6-7-24 first"> <a href="grid.php"> <span>Coats</span> </a> </li> <li class="level2 nav-6-7-25"> <a href="grid.php"> <span>Jackets</span> </a> </li> <li class="level2 nav-6-7-26"> <a href="grid.php"> <span>Leather Jackets</span> </a> </li> <li class="level2 nav-6-7-26"> <a href="grid.php"> <span>Leather Jackets</span> </a> </li> <li class="level2 nav-6-7-27 last"> <a href="grid.php"> <span>Blazers</span> </a> </li> </ul> </li> </ul> </div> <div class="nav-block nav-block-right std grid12-3"> <a class="product-image" title="Stablished fact reader" href="#"> <img alt="Stablished fact reader" src="products-images/product2.jpg" width="150"></a> <div class="item-title"> <a href="#" title="Sample Product"> Sample Product </a> </div> <div class="price-box"> <span class="regular-price"> <span class="price">$125.00</span> </span> </div> </div> </div> </div> </li> <li class="level0 nav-7 level-top parent"> <a class="level-top" href="grid.php"> <span>Furniture</span> </a> <div class="level0-wrapper dropdown-6col" style="left: 0pt; display: none;"> <div class="level0-wrapper2"> <div class="nav-block nav-block-center grid12-8 itemgrid itemgrid-4col"> <ul class="level0"> <li class="level1 nav-7-1 first parent item"> <a href="grid.php"> <span>Smartphones</span> </a> <ul class="level1"> <li class="level2 nav-7-1-1 first"> <a href="grid.php"> <span>Samsung</span> </a> </li> <li class="level2 nav-7-1-2"> <a href="grid.php"> <span>Apple</span> </a> </li> <li class="level2 nav-7-1-4"> <a href="grid.php"> <span>BlackBerry</span> </a> </li> <li class="level2 nav-7-1-6"> <a href="grid.php"> <span>Nokia</span> </a> </li> <li class="level2 nav-7-1-7 last"> <a href="grid.php"> <span>HTC</span> </a> </li> </ul> </li> <li class="level1 nav-7-3 parent item"> <a href="grid.php"> <span>Cameras</span> </a> <ul class="level1"> <li class="level2 nav-7-3-15 first"> <a href="grid.php"> <span>Digital Cameras</span> </a> </li> <li class="level2 nav-7-3-16"> <a href="grid.php"> <span>Camcorders</span> </a> </li> <li class="level2 nav-7-3-17"> <a href="grid.php"> <span>Lenses</span> </a> </li> <li class="level2 nav-7-3-18"> <a href="grid.php"> <span>Filters</span> </a> </li> <li class="level2 nav-7-3-19 last"> <a href="grid.php"> <span>Tripods</span> </a> </li> </ul> </li> <li class="level1 nav-7-4 last parent item"> <a href="grid.php"> <span>Accessories</span> </a> <ul class="level1"> <li class="level2 nav-7-2-8 first"> <a href="grid.php"> <span>Headsets
66,336
thestackv1_concat_by_repo-long/65536-65536
Repo: guoanhong/VizLens-public ======================= File: iOS/ApplianceReader/ARTarget.h ======================= // // ARTarget.h // ApplianceReader // #import <Foundation/Foundation.h> #import <CoreGraphics/CGGeometry.h> #pragma mark - Interface @interface ARTarget : NSObject @property (nonatomic, copy) NSString *name; @property (nonatomic) CGRect normalizedFrame; // Convenience. + (instancetype)targetWithTargetArray:(NSArray *)targetArray; @end ======================= File: iOS/ApplianceReader/ARInterface.h ======================= // // ARInterface.h // ApplianceReader // #import <Foundation/Foundation.h> #pragma mark - Interface @interface ARInterface : NSObject @property (nonatomic, copy) NSString *name; @property (nonatomic, copy) NSString *status; // Designated initializer. - (instancetype)initWithName:(NSString *)name status:(NSString *)status; // Convenience. + (instancetype)interfaceWithName:(NSString *)name status:(NSString *)status; @end ======================= File: iOS/ApplianceReader/ARAppDelegate.h ======================= // // ARAppDelegate.h // ApplianceReader // #import <UIKit/UIKit.h> #import "ARInterfaceFeedbackViewController.h" #pragma mark - Helpers NS_INLINE UIColor *blueColor() { return [UIColor colorWithRed:(38.0f / 255.0f) green:(139.0f / 255.0f) blue:(210.0f / 255.0f) alpha:1.0f]; } NS_INLINE UIColor *greenColor() { return [UIColor colorWithRed:(133.0f / 255.0f) green:(153.0f / 255.0f) blue:(0.0f / 255.0f) alpha:1.0f]; } NS_INLINE BOOL isOKHTTPURLResponse(NSURLResponse *urlResponse) { return [urlResponse isKindOfClass:[NSHTTPURLResponse class]] && ([(NSHTTPURLResponse *)urlResponse statusCode] == 200); } NS_INLINE UIColor *redColor() { return [UIColor colorWithRed:(220.0f / 255.0f) green:(50.0f / 255.0f) blue:(47.0f / 255.0f) alpha:1.0f]; } NS_INLINE UIColor *selectionColor() { return [UIColor colorWithRed:(147.0f / 255.0f) green:(161.0f / 255.0f) blue:(161.0f / 255.0f) alpha:1.0f]; } NS_INLINE UIColor *yellowColor() { return [UIColor colorWithRed:(181.0f / 255.0f) green:(137.0f / 255.0f) blue:(0.0f / 255.0f) alpha:1.0f]; } #pragma mark - Interface @interface ARAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; // Settings. @property (nonatomic) float feedbackDelay; @property (nonatomic) float imageCompression; @property (nonatomic, copy) NSString *imageSize; @property (nonatomic) BOOL polite; @property (nonatomic, copy) NSString *serverDomain; @property (nonatomic) BOOL sound; @property (nonatomic) float uploadDelay; @property (nonatomic, copy) NSString *userID; @end ======================= File: iOS/ApplianceReader/ARSettingsViewController.h ======================= // // ARSettingsViewController.h // ApplianceReader // #import <UIKit/UIKit.h> #pragma mark - Interface @interface ARSettingsViewController : UIViewController @end ======================= File: iOS/ApplianceReader/ARSlider.h ======================= <reponame>guoanhong/VizLens-public<filename>iOS/ApplianceReader/ARSlider.h // // ARSlider.h // ApplianceReader // #import <UIKit/UIKit.h> #pragma mark - Interface @interface ARSlider : UISlider @end ======================= File: iOS/ApplianceReader/ARCollectionViewInterfaceLayout.h ======================= // // ARCollectionViewInterfaceLayout.h // ApplianceReader // #import <UIKit/UIKit.h> #pragma mark - Collection View Interface Layout Data Source @protocol ARCollectionViewInterfaceLayoutDataSource <NSObject> @required - (CGSize)normalizedContentSizeForCollectionView:(nullable UICollectionView *)collectionView; - (nullable NSArray *)targetsForCollectionView:(nullable UICollectionView *)collectionView; @end #pragma mark - Interface @interface ARCollectionViewInterfaceLayout : UICollectionViewLayout @property (nonatomic, weak, nullable) id <ARCollectionViewInterfaceLayoutDataSource> interfaceLayoutDataSource; @end ======================= File: iOS/ApplianceReader/ARInterfaceListTableViewController.h ======================= // // ARInterfaceListTableViewController.h // ApplianceReader // #import <UIKit/UIKit.h> #pragma mark - Interface @interface ARInterfaceListTableViewController : UITableViewController @end ======================= File: iOS/ApplianceReader/ARTargetCollectionViewCell.h ======================= // // ARTargetCollectionViewCell.h // ApplianceReader // #import <UIKit/UIKit.h> #pragma mark - Interface @interface ARTargetCollectionViewCell : UICollectionViewCell @property (nonatomic, weak) IBOutlet UILabel *textLabel; @end ======================= File: iOS/ApplianceReader/ARInterfaceFeedbackViewController.h ======================= // // ARInterfaceFeedbackViewController.h // ApplianceReader // #import <UIKit/UIKit.h> @class ARInterface; #pragma mark - Constants typedef NS_ENUM(NSInteger, ARInterfaceFeedbackViewControllerMode) { ARInterfaceFeedbackViewControllerUndefinedMode = 0, ARInterfaceFeedbackViewControllerFeedbackMode, ARInterfaceFeedbackViewControllerCaptureMode, ARInterfaceFeedbackViewControllerRecaptureMode }; #pragma mark - Interface @interface ARInterfaceFeedbackViewController : UIViewController @property (nonatomic) ARInterface *interface; @property (nonatomic) ARInterfaceFeedbackViewControllerMode mode; @end ======================= File: iOS/ApplianceReader/ARDevViewController.h ======================= // // ARDevViewController.h // ApplianceReader // #import <UIKit/UIKit.h> #pragma mark - Interface @interface ARDevViewController : UIViewController @end ======================= File: CVServer/main_gpu.cpp ======================= <reponame>guoanhong/VizLens-public // #include <tesseract/baseapi.h> // #include <leptonica/allheaders.h> #include <sys/types.h> // #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> // #include <json/json.h> // #include <json/writer.h> #include <dirent.h> #include <stdio.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <fstream> #include <math.h> #include <vector> #include <string> #include <time.h> #include <algorithm> #include <string> #include <set> #include <unordered_set> #include <cstdlib> #include <cerrno> #include "curl/curl.h" // #include "curl/curl_easy.h" #include "opencv2/core/core.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/nonfree/nonfree.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/video/background_segm.hpp" #include <opencv2/gpu/gpu.hpp> #include "opencv2/nonfree/gpu.hpp" #include "sqlite3.h" #include "db_utils.hpp" #include "img_utils_gpu.hpp" // #include "lib/ocr_utils.hpp" #include "statemap_utils.hpp" #include "feedback_utils.hpp" #include "visualization.hpp" // TODO: define envpaths // #define PATH genenv("APP_PATH") #define DB "/home/guoanhong/Desktop/VizLensDynamic/WebServer/db/VizLensDynamic.db" #define imageDirBase "/home/guoanhong/Desktop/VizLensDynamic/WebServer/images_video/" #define dirBase "/home/guoanhong/Desktop/VizLensDynamic/CVServer/samples/" #define session_name "coffee_machine" using namespace cv; using namespace std; using namespace cv::gpu; // using namespace tesseract; const int MIN_FINGER_DEPTH = 20; const int MAX_FINGER_ANGLE = 60; const double PI = 3.1415926; bool isOpenDB = false; sqlite3 *dbfile; string id = "0"; string image = ""; string mode = "0"; string target = ""; string state = ""; string feedback = ""; string guidance = ""; int idle = 1; int curr_state_id = -1; void readme(); int skipFrames(VideoCapture capture, int num); bool hasEnding (std::string const &fullString, std::string const &ending) { if (fullString.length() >= ending.length()) { return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending)); } else { return false; } } // bool NotAlphaNumerical(char c) { // return!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') // || c =='' || c == '\n'); // } /** @function main */ int main(int argc, char** argv) { cout << "Start (dynamic display for GPU)"<< endl; string folder = "hcii_coffee"; // string(argv[1]); string video = "video_coffee_hard.MOV"; // string(argv[2]); // int ocr_mode = atoi(argv[2]); cv::gpu::printShortCudaDeviceInfo(cv::gpu::getDevice()); isOpenDB = ConnectDB(); if (isOpenDB) cout << "Connected Successful" << endl; else cout << "connection failed " << endl; vector<Mat> img_object_vector = vector<Mat>(); vector<vector<vector<int> > > button_map_vector = vector<vector<vector<int> > >(); vector<vector<string> > true_labels_vector = vector<vector<string> >(); vector<vector<vector<double> > > button_center_vector = vector<vector<vector<double> > >(); vector<double> avg_button_size_vector = vector<double>(); vector<GpuMat> img_object_gpu_vector = vector<GpuMat>(); vector<GpuMat> keypoints_object_gpu_vector = vector<GpuMat>(); vector<GpuMat> descriptors_object_gpu_vector = vector<GpuMat>(); vector<vector<KeyPoint> > keypoints_object_vector = vector<vector<KeyPoint> >(); vector<vector<float> > descriptors_object_vector = vector<vector<float> >(); // vector<string> ocr_object_vector = vector<string>(); /******************** Read Images ********************/ // JUDY int interface_id = getInterfaceId(); string interface_name = getInterfaceName(interface_id); // NOTE: in user testing, can either let user input/choose the current interface, // or detect the current interface and let the user confirm. // string dir = string(refImageDirBase) + string(session) + "/"; string dir = string(dirBase) + folder + "/images/"; // + interface_name + "/"; string dir_server = "/home/guoanhong/Desktop/VizLensDynamic/WebServer/images_reference/" + string(session_name) + "/"; vector<string> objectnames = vector<string>(); vector<string> filenames = vector<string>(); vector<string> files = vector<string>(); vector<string> description_text_vector = vector<string>(); vector<int> states = vector<int>(); vector<set<int>> transition_graph = vector<set<int>>(); vector<set<int>> reachable_states = vector<set<int>>(); vector<int> all_ids = vector<int>(); vector<Mat> new_img_pool; vector<vector<KeyPoint> > new_keypoints_pool = vector<vector<KeyPoint> >(); vector<vector<float> > new_descriptors_pool = vector<vector<float> >(); vector<GpuMat> new_img_pool_gpu; vector<GpuMat> new_keypoints_pool_gpu = vector<GpuMat>(); vector<GpuMat> new_descriptors_pool_gpu = vector<GpuMat>(); // vector<string> new_ocr_vector = vector<string>(); // /* Initialize screenmap visualization */ // Mat state_graph_pic = Mat::zeros( 250, 750, CV_8UC3 ); // getdir(dir,filenames); string read_mode = "db"; // = "local"; getRefImageFilenames(folder, dir_server, filenames, read_mode); sort(filenames.begin(), filenames.end()); // TESTING // return 0; // for (int i = 0; i < filenames.size(); i++) { // cout << filenames[i] << "\n"; // } ifstream inFile; inFile.open((dir_server + "log/state_map.txt").c_str()); string content((istreambuf_iterator<char>(inFile)), (istreambuf_iterator<char>())); inFile.close(); cout << "state map : " << content << endl; getTransitionGraph(content, transition_graph); initializeObjects(transition_graph, reachable_states); // ifstream inFileOCR; // inFileOCR.open(dir + "../log/ocr.txt"); // string line; // while (inFileOCR >> curr_ocr) { // ocr_object_vector.push_back(curr_ocr); // } // while (getline(inFileOCR, line)) // { // ocr_object_vector.push_back(line); // } // cout << ocr_object_vector.size() << endl; // // process pair (a,b) // inFileOCR.close(); // /* Initial visualization preparation */ // drawInitGraph(state_graph_pic, transition_graph); string ending = "jpg"; int prev_state_id = -1; // curr_state_id = -1; // NEEDED // SURF surf; // surf.hessianThreshold = 400; // int minHessian = 400; // SurfFeatureDetector detector(minHessian); SURF_GPU surf; surf.hessianThreshold = 400; // ORIGINAL: READ IN REFERENCE IMAGES int id_count = 0; for (unsigned int i = 0;i < filenames.size();i++) { if (hasEnding (filenames[i], ending)) { id_count++; cout << filenames[i] << endl; Mat img_object = imread(dir_server+filenames[i]); cout << dir_server+filenames[i] << endl; imshow("", img_object); files.push_back(filenames[i]); double ratio = img_object.rows > img_object.cols? 600.0 / (double)img_object.rows : 600.0 / (double) img_object.cols; // cout << img_object.shape << endl; Size img_object_size(img_object.cols * ratio, img_object.rows * ratio); //(150, 445) resize(img_object, img_object, img_object_size); img_object_vector.push_back(img_object); vector<vector<int> > button_map; vector<string> true_labels; vector<vector<double> > button_center; double avg_button_size; labels_hash(string(session_name), id_count - 1, img_object, ratio, button_map, true_labels, button_center, avg_button_size); // labels_hash(filenames[i].substr(0, filenames[i].size()- 4), img_object, ratio, button_map, true_labels, button_center, avg_button_size); button_map_vector.push_back(button_map); true_labels_vector.push_back(true_labels); button_center_vector.push_back(button_center); avg_button_size_vector.push_back(avg_button_size); cout << dir+filenames[i] << endl; lightingDetection(img_object); // Computer SURF keypoints and descriptors for object (reference) image GpuMat img_object_gpu; Mat img_object_gray; cvtColor(img_object, img_object_gray, CV_RGB2GRAY); img_object_gpu.upload(img_object_gray); GpuMat keypoints_object_gpu; GpuMat descriptors_object_gpu; // ORIGINAL surf(img_object_gpu, GpuMat(), keypoints_object_gpu, descriptors_object_gpu); // CPU ONLY // vector<KeyPoint> keypoints_object; // Mat descriptors_object; // SHOULD BE vector<float> // int minHessian = 400; // SurfFeatureDetector detector(minHessian); // detector.detect(img_object_gpu, keypoints_object); // printf("-- Keypoints Vector Size : %lu \n", keypoints_object.size() ); // //-- Step 2: Calculate reference descriptors (feature vectors) // SurfDescriptorExtractor extractor; // extractor.compute(img_object_gpu, keypoints_object, descriptors_object); img_object_gpu_vector.push_back(img_object_gpu); printf("-- Keypoints Vector Size : %lu \n", keypoints_object_gpu.cols ); // downloading objects results vector<KeyPoint> keypoints_object; vector<float> descriptors_object; // ORIGINAL surf.downloadKeypoints(keypoints_object_gpu, keypoints_object); surf.downloadDescriptors(descriptors_object_gpu, descriptors_object); all_ids.push_back(id_count - 1); objectnames.push_back(filenames[i].substr(0, filenames[i].size() - 4)); keypoints_object_vector.push_back(keypoints_object); descriptors_object_vector.push_back(descriptors_object); keypoints_object_gpu_vector.push_back(keypoints_object_gpu); descriptors_object_gpu_vector.push_back(descriptors_object_gpu); } } for (int i = 0; i < files.size(); ++i){ cout << files[i] << endl; } // TessBaseAPI *tess = new TessBaseAPI(); // // Initialize tesseract-ocr with English, without specifying tessdata path // if (tess->Init(NULL, "eng")) { // fprintf(stderr, "Could not initialize tesseract.\n"); // exit(1); // } // tess->SetVariable("tessedit_char_whitelist", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ?"); // unordered_set<string> dictionary; // init_dictionary(dictionary); GpuMat keypoints_scene_gpu; GpuMat descriptors_scene_gpu; int count = 0; clock_t last_time = clock(); string previous_guidance = ""; vector<Point2f> previous_fingertip_location(1); previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; int object_not_found = 1; int fingertip_not_found = 1; int fingertip_found = 1; int provide_guidance = 1; int no_button = 1; int db_object_found = -1; int db_finger_found = -1; int fingerx = -1; int fingery = -1; /******************** Read Scenes ********************/ // CPU ONLY // string video_name = string(dirBase) + folder + "/videos/" + video; // string(imageDirBase) + "video_coffee_hard.mov"; // VideoCapture capture(video_name); // // capture.open(0); // Capture from camera // if (!capture.isOpened()) { // throw "--(!) Error reading steam"; // } // int frame = 0; // int first_skip_frames = 0; // for (int i = 0; i < first_skip_frames; i++) { capture.grab(); } // frame += first_skip_frames; // Mat img_results = Mat::zeros( 750, 1200, CV_8UC3 ); if (hasReadyToReadObjects()) { int new_state; string new_name; Mat new_object; updateCroppedImage(dir_server, new_name, new_state, new_object); // Computer SURF keypoints and descriptors for object (reference) image GpuMat new_object_gpu; Mat new_object_gray; cvtColor(new_object_gpu, new_object_gray, CV_RGB2GRAY); new_object_gpu.upload(new_object_gray); GpuMat new_keypoints_object_gpu; GpuMat new_descriptors_object_gpu; // ORIGINAL surf(new_object_gpu, GpuMat(), new_keypoints_object_gpu, new_descriptors_object_gpu); // // CPU ONLY // vector<KeyPoint> new_keypoints_object; // Mat new_descriptors_object; // SHOULD BE vector<float> // int minHessian = 400; // SurfFeatureDetector detector(minHessian); // detector.detect(new_object_gpu, new_keypoints_object); // printf("-- Keypoints Vector Size : %lu \n", new_keypoints_object.size() ); // //-- Step 2: Calculate reference descriptors (feature vectors) // SurfDescriptorExtractor extractor; // extractor.compute(new_object_gpu, new_keypoints_object, new_descriptors_object); img_object_vector.push_back(new_object); img_object_gpu_vector.push_back(new_object_gpu); printf("-- Keypoints Vector Size new object : %lu \n", new_keypoints_object_gpu.cols ); // downloading objects results vector<KeyPoint> new_keypoints_object; vector<float> new_descriptors_object; // ORIGINAL surf.downloadKeypoints(new_keypoints_object_gpu, new_keypoints_object); surf.downloadDescriptors(new_descriptors_object_gpu, new_descriptors_object); all_ids.push_back(new_state); objectnames.push_back(new_name); keypoints_object_vector.push_back(new_keypoints_object); descriptors_object_vector.push_back(new_descriptors_object); keypoints_object_gpu_vector.push_back(new_keypoints_object_gpu); descriptors_object_gpu_vector.push_back(new_descriptors_object_gpu); // VizDynamic: May need crowdsourcing for labeling buttons in added image object vector<vector<int> > button_map; vector<string> true_labels; vector<vector<double> > button_center; double avg_button_size; double obj_ratio = new_object.rows > new_object.cols? 600.0 / (double)new_object.rows : 600.0 / (double) new_object.cols; Size object_size(new_object.cols * obj_ratio, new_object.rows * obj_ratio); //(150, 445) resize(new_object, new_object, object_size); labels_hash(string(session_name), new_state, new_object, obj_ratio, button_map, true_labels, button_center, avg_button_size); button_map_vector.push_back(button_map); true_labels_vector.push_back(true_labels); button_center_vector.push_back(button_center); avg_button_size_vector.push_back(avg_button_size); } for (int i = 0; i < all_ids.size(); i++) { description_text_vector.push_back(getStateDescription(i)); } int i; id = "0"; bool enableAddNewRefImage = false; for ( ; ; ) { try { // Scene doesn't read in valid image // Update cropped image doesn't change it to read string image_to_process; // ORIGINAL while (idle == 1) { if(clock() - last_time > (double)(0.05 * 1000000)) { count++; // cout << "GET IMAGE TO PROCESS" << endl; getImageToProcess(image_to_process); last_time = clock(); } } // int frames_skipped = 4; Mat img_scene = imread(imageDirBase + string(session_name) + "/" + image_to_process); cout << imageDirBase + string(session_name) + "/" + image_to_process << endl; cout << "reading img_scene" << endl; ++i; // CPU ONLY /* Use local videos for image stream */ // Mat img_scene; // int frames_skipped = 4; // for (int a = 0; a < frames_skipped - 1; a++) { // capture.grab(); // } // capture >> img_scene; // if (img_scene.empty()) break; /* Use local videos for image stream */ // Output scenes for debugging if (img_scene.empty()) { idle = 1; skipImage(); continue; } double scene_ratio = img_scene.rows > (double)img_scene.cols / 3 * 2? 500 / (double)img_scene.rows : 750 / (double)img_scene.cols; // img_scene.rows > img_scene.cols? 600.0 / (double)img_scene.rows : 600.0 / (double) img_scene.cols; Size img_scene_size(img_scene.cols * scene_ratio, img_scene.rows * scene_ratio); //(150, 445) resize(img_scene, img_scene, img_scene_size); // imshow("", img_scene); // frame += frames_skipped; // Size img_scene_size(360, 640); // cout << "--Size of frame is: "<< img_scene.cols << " " << img_scene.rows << endl; /* lighting -- lightingDetection(img_scene); */ // isStateProcessing(0); /****** START CLOCK *******/ clock_t tic = clock(); // Computer SURF keypoints and descriptors for scene (video) image GpuMat img_scene_gpu; Mat img_scene_gray; cvtColor(img_scene, img_scene_gray, CV_RGB2GRAY); // NEEDED img_scene_gpu.upload(img_scene_gray); surf(img_scene_gpu, GpuMat(), keypoints_scene_gpu, descriptors_scene_gpu); // // CPU ONLY // vector<KeyPoint> keypoints_scene; // Mat descriptors_scene; // SHOULD BE vector<float> // detector.detect(img_scene_gpu, keypoints_scene); // // printf("-- Keypoints Vector Size : %lu \n", keypoints_scene.size() ); // //-- Step 2: Calculate reference descriptors (feature vectors) // SurfDescriptorExtractor extractor; // extractor.compute(img_scene_gpu, keypoints_scene, descriptors_scene); cout << "FOUND " << keypoints_scene_gpu.cols << " keypoints on second image" << endl; if (keypoints_scene_gpu.empty()) { idle = 1; skipImage(); continue; } // downloading scene results vector<KeyPoint> keypoints_scene; vector<float> descriptors_scene; surf.downloadKeypoints(keypoints_scene_gpu, keypoints_scene); surf.downloadDescriptors(descriptors_scene_gpu, descriptors_scene); /******************** Start Matching ********************/ vector< DMatch > good_matches; int state_index = 0; Mat H; int inlier_max = -1; float ratio_max = 0; // THE ORIGINAL MATCHING PROCESS // for (int i = 0;i < files.size();i++) { //.... // } // // NEW MATCHING WITH THE "STEP" FILTER // vector<Mat> reachable_descriptors_object_gpu_vector; // if (prev_state_id >= 0) { // reachable_descriptors_object_gpu_vector = vector<Mat>(); // filterObjects(prev_state_id, reachable_states, reachable_descriptors_object_gpu_vector, descriptors_object_gpu_vector); // } else { // reachable_descriptors_object_gpu_vector = descriptors_object_gpu_vector; // } // vector<Mat> reachable_img_object_vector; // if (prev_state_id >= 0) { // reachable_img_object_vector = vector<Mat>(); // filterOriginalImgs(prev_state_id, reachable_states, reachable_img_object_vector, img_object_vector); // } else { // reachable_img_object_vector = img_object_vector; // } // vector<int> reachable_ids = all_ids; // if (prev_state_id >= 0) { // reachable_ids.resize(reachable_states[prev_state_id].size()); // copy(reachable_states[prev_state_id].begin(), reachable_states[prev_state_id].end(), reachable_ids.begin()); // } cout << "------------------------------------------\n"; cout << "Start Matching \n"; cout << "------------------------------------------\n"; for (int i = 0;i < descriptors_object_gpu_vector.size();i++) { // for (int i = 0;i < reachable_descriptors_object_gpu_vector.size();i++) { // matching descriptors BFMatcher_GPU matcher(NORM_L2); GpuMat trainIdx, distance; // // CPU ONLY // vector<DMatch> matches; // // matcher.match(reachable_descriptors_object_gpu_vector[i], descriptors_scene, matches); // matcher.match(descriptors_object_gpu_vector[i], descriptors_scene, matches); matcher.matchSingle(descriptors_object_gpu_vector[i], descriptors_scene_gpu, trainIdx, distance); vector<DMatch> matches; BFMatcher_GPU::matchDownload(trainIdx, distance, matches); vector< DMatch > tmp_good_matches; gpuFindGoodMatches(matches, tmp_good_matches); // DEBUG if (tmp_good_matches.size() < 4) { cout << "-- Skipping Image -- " << i << endl; continue; } // Find H Mat tempH; vector<uchar> inliers; findH(keypoints_object_vector[i], keypoints_scene, tmp_good_matches, tempH, inliers); // Only count non '\0' inliers int inliersCount = 0; for (int i = 0; i < inliers.size(); i++) { if (inliers[i]!= '\0') { inliersCount++; } } cout << "-- Match with Image -- " << i << endl; // cout << "OCR text: " << ocr_object_vector[i] << endl; cout << "Object keypoints: " << keypoints_object_vector[i].size() << endl; cout << "Scene keypoints: " << keypoints_scene.size() << endl; cout << "Good matches: " << tmp_good_matches.size() << endl; cout << "Inlier count: " << inliersCount << endl; // if (i == 0 || inliersCount > inlier_max) { // inlier_max = inliersCount; // state_index = i; // H = tempH; // } float currRatio = inliersCount / (float)tmp_good_matches.size(); // / ((float)keypoints_object_vector[i].size() + (float)keypoints_scene.size()); cout << "Ratio of Inlier: " << currRatio << endl; cout << endl; if (i == 0 || currRatio > ratio_max) { ratio_max = currRatio; inlier_max = inliersCount; state_index = i; H = tempH; } } /******************** OCR ********************/ // Mat img_scene_ocr; string text_scene; float ratio_lower = 0.5; float ratio_upper = 0.7; if (ratio_max < 0.7) { enableAddNewRefImage = false; /* if (ratio_lower < ratio_max && ratio_max < ratio_upper) { text_scene = ocr_find_text(tess, img_scene_gray, dictionary); cout << "OCR Output: " << text_scene << endl; } string text_object = ocr_object_vector.size() == 0? "" : ocr_object_vector[state_index]; float ocr_score = ocr_similarity_score(text_scene, text_object); int len_short = text_object.length() < text_scene.length()? text_object.length() : text_scene.length(); int len_long = text_object.length() + text_scene.length() - len_short; float ocr_ratio_short = ocr_score / len_short; float ocr_ratio_long = ocr_score / len_long; if (ratio_lower < ratio_max && ratio_max < ratio_upper) { cout << "OCR Ratio: " << ocr_ratio_short << ", " << ocr_ratio_long << endl; } bool ocr_not_found = text_object.length() == 0 || text_scene.length() == 0 || ocr_ratio_short <= 0.6 || ocr_ratio_long <= 0.5; */ /******************** ADD NEW REF IMAGE ********************/ // IF NOT FOUND, ADD IMAGE TO REFERENCE IMAGEm // int inlierThreshold = 20; // float ratioThreshold = 0.7; // float ocrThreashold = 0.7; /* if (ratio_lower < ratio_max && ratio_max < ratio_upper) { cout << "-- OCR SCORE --" << endl; cout << ocr_score << endl; } cout << "-- MAX RATIO --" << endl; cout << ratio_max << endl; cout << endl; if (ratio_max <= ratio_lower || (ratio_lower < ratio_max && ratio_max < ratio_upper && ocr_not_found)) { */ if (!enableAddNewRefImage) continue; // if (ratio_max < ratioThreshold) { // if (ratio_max <= 0.5 || (0.5 < ratio_max && ratio_max < 0.8 && ocr_score < ocrThreashold)) { // (inlier_max / (float)keypoints_scene.size() < ratioThreshold) { cout << "-- FOUND UNMATCHED IMAGE -- \n"; new_img_pool.push_back(img_scene); new_keypoints_pool.push_back(keypoints_scene); new_descriptors_pool.push_back(descriptors_scene); new_img_pool_gpu.push_back(img_scene_gpu); new_keypoints_pool_gpu.push_back(keypoints_scene_gpu); new_descriptors_pool_gpu.push_back(descriptors_scene_gpu); bool matched = checkNewImgFromPool(new_img_pool, new_img_pool_gpu, new_keypoints_pool, new_keypoints_pool_gpu, new_descriptors_pool, new_descriptors_pool_gpu, img_scene_gpu, keypoints_scene, descriptors_scene_gpu); if (matched) { cout << "UNMATCHED IMAGE MATCHED IN POOL \n"; Mat img_object = img_scene; img_object_vector.push_back(img_object); img_object_gpu_vector.push_back(img_scene_gpu); cout << "-- ADDING NEW REFERENCE IMAGE -- \n"; state_index = all_ids.size(); cout << "state_index = " << state_index << endl; // + ", Ratio = " + to_string(inlier_max / (float)keypoints_scene.size()) + "\n"; string new_name = state_index < 10? "New0" + to_string(state_index) + ".jpg" : "New" + to_string(state_index) + ".jpg"; string new_file = dir + new_name; sendTransitionInstructions("Adding new state, please wait."); if (read_mode == "local") { // files.push_back(new_name); imwrite(new_file, img_object); imwrite("../WebServer/images_original/" + string(session_name) + "/" + new_name, img_object); } else if (read_mode == "db") { // if (!isStateProcessing(state_index)) { cout << "HTTP request" << endl; // struct stat file_info; // FILE *fd; // fd = fopen("/Users/judy/Desktop/VizLens/VizLensDynamic/WebServer/images_original/New00.jpg", "r"); // fstat(fileno(fd), &file_info); // if(!fd) // return 1; /* can't continue */ // /* to get the file size */ // if(fstat(fileno(fd), &file_info)!= 0) // return 1; /* can't continue */ imwrite(new_file, img_object); imwrite("../WebServer/images_original/" + string(session_name) + "/" + new_name, img_object); CURL *hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST"); string url = "http://localhost:8888/VizLensDynamic/php/uploadOriginalforCVServer.php?userid=testuser&session=" + string(session_name) + "&stateid=" + to_string(state_index); curl_easy_setopt(hnd, CURLOPT_URL, url.c_str()); struct curl_slist *headers = NULL; // headers = curl_slist_append(headers, "postman-token: <PASSWORD>"); headers = curl_slist_append(headers, "cache-control: no-cache"); headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"); curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers); string upload_file = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"pictures[0]\"; filename=\"" + new_name + "\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--"; curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, upload_file.c_str()); // curl_easy_setopt(hnd, CURLOPT_READDATA, fd); // curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE,(curl_off_t)file_info.st_size); // curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); CURLcode ret = curl_easy_perform(hnd); /* istringstream myStream(dir + new_name + ".jpg"); int size = myStream.str().size(); char buf[50]; char *url = (char*)"http://localhost:8888/VizLensDynamic/php/uploadOriginal.php?userid=testuser&session=testsession&stateid=0"; try { curlpp::Cleanup cleaner; curlpp::Easy request; using namespace curlpp::Options; request.setOpt(new Url(url)); // request.setOpt(new Verbose(true)); list< string > headers; headers.push_back("cache-control: no-cache"); headers.push_back("Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"); // sprintf(buf, "Content-Length: %d", size); // headers.push_back(buf); curlpp::Forms formParts; formParts.push_back(new curlpp::FormParts::Content("Content-Type", "image/jpeg")); formParts.push_back(new curlpp::FormParts::Content("pictures[0]", "@"+ dir + new_name + ".jpg")); // formParts.push_back(new curlpp::FormParts::Content("filename", )); // formParts.push_back(new curlpp::FormParts::Content("picture[0]", new_name + ".jpg")); request.setOpt(new curlpp::options::HttpPost(formParts)); // request.setOpt(new curlpp::options::Verbose(true)); // request.setOpt(new InfileSize(size)); // request.setOpt(new Upload(true)); request.setOpt(new HttpHeader(headers)); request.perform(); cout << "Upload to database successful: " << state_index << endl; return 0; } catch ( curlpp::LogicError & e ) { std::cout << e.what() << std::endl; } catch ( curlpp::RuntimeError & e ) { std::cout << e.what() << std::endl; } */ // } } /* Add OCR */ // if (ratio_max <= 0.3) { // text_scene = ocr_find_text(tess, img_scene_gray, dictionary); // cout << "OCR Output: " << text_scene << endl; // } // TODO: Might need to change text_scene to updated OCR? Or not important? // ocr_object_vector.push_back(text_scene); addStateToTransitionGraph(interface_id, transition_graph, state_index); string out_string = storeTransitionGraph(transition_graph); ofstream file(dir_server + "log/state_map.txt"); if (file.is_open()) { file << out_string; } file.close(); // ofstream file_ocr(dir + "../log/ocr.txt"); // if (file_ocr.is_open()) { // for (int i = 0; i < ocr_object_vector.size(); i++) { // file_ocr << ocr_object_vector[i] << endl; // } // } // file_ocr.close(); // TODO: WAIT; PULL REFERENCE IMAGE FROM DB; UPDATE IMG_OBJECT updateCroppedImage(dir_server, new_name, state_index, img_object); enableAddNewRefImage = false; files.push_back(new_name); all_ids.push_back(state_index); objectnames.push_back(new_name); // Can add this line to store image locally // TODO: re-detect keypoints & descriptors keypoints_object_vector.push_back(keypoints_scene); descriptors_object_vector.push_back(descriptors_scene); keypoints_object_gpu_vector.push_back(keypoints_scene_gpu); descriptors_object_gpu_vector.push_back(descriptors_scene_gpu); // VizDynamic: May need crowdsourcing for labeling buttons in added image object vector<vector<int> > button_map; vector<string> true_labels; vector<vector<double> > button_center; double avg_button_size; double obj_ratio = img_object.rows > img_object.cols? 600.0 / (double)img_object.rows : 600.0 / (double) img_object.cols; Size object_size(img_object.cols * obj_ratio, img_object.rows * obj_ratio); //(150, 445) resize(img_object, img_object, object_size); labels_hash(string(session_name), state_index, img_object, obj_ratio, button_map, true_labels, button_center, avg_button_size); button_map_vector.push_back(button_map); true_labels_vector.push_back(true_labels); button_center_vector.push_back(button_center); avg_button_size_vector.push_back(avg_button_size); // cout << "BEFORE PUSHING \n"; // button_map_vector.push_back(button_map_vector[button_map_vector.size() - 1]); // true_labels_vector.push_back(true_labels_vector[true_labels_vector.size() - 1]); // button_center_vector.push_back(button_center_vector[button_center_vector.size() - 1]); // avg_button_size_vector.push_back(avg_button_size_vector[avg_button_size_vector.size() - 1]); // cout << "AFTER PUSHING \n"; // string tmp_string; // getImageToProcess(tmp_string); description_text_vector.push_back(getStateDescription(state_index)); sendTransitionInstructions("New state ready, please resume."); } else { continue; } } // Use the history of detected screens to determine the current screen and get rid of noises. // By JUDY if (states.size() == 6) { states.erase(states.begin()); } states.push_back(state_index); string matched_state; string current_state; int new_state_id = findCurrentState(states); if (new_state_id!= curr_state_id) { prev_state_id = curr_state_id; curr_state_id = new_state_id; // string description_text = ""; // sendStateDescription(curr_state_id); // feedback = description_text; } cout << "Current state id: "<< curr_state_id <<endl; enableAddNewRefImage = true; // cout << transition_graph.size() << endl; updateTransitionGraph(interface_id, transition_graph, prev_state_id, curr_state_id); cout << "Transition graph updated" << endl; string out_string = storeTransitionGraph(transition_graph); ofstream file(dir_server + "log/state_map.txt"); if (file.is_open()) { file << out_string; } file.close(); cout << "PREVIOUS STATE: " << prev_state_id << endl; cout << "CURRENT STATE: " << curr_state_id << " - " << current_state << endl; /******************** Send Feedback ********************/ // NEED TO FIX state_index // cout << img_object_vector.size() << "," << button_map_vector.size() << "," << true_labels_vector.size() << "," << button_center_vector.size() << "," << avg_button_size_vector.size() << endl; Mat img_object = img_object_vector[curr_state_id]; vector<vector<int> > button_map = button_map_vector[curr_state_id]; vector<string> true_labels = true_labels_vector[curr_state_id]; vector<vector<double> > button_center = button_center_vector[curr_state_id]; double avg_button_size = avg_button_size_vector[curr_state_id]; // double object_ratio = img_scene.rows > img_object.cols? 200.0 / (double)img_object.rows : 200.0 / (double) img_object.cols; // Size img_object_size(img_object.cols * object_ratio, img_object.rows * object_ratio); //(150, 445) // resize(img_object, img_object, img_object_size); // img_object.copyTo(img_results(Rect(0,0,img_object.cols, img_object.rows))); // img_scene.copyTo(img_results(Rect(img_object.cols,0,img_scene.cols, img_scene.rows))); // drawMatches( img_object, keypoints_object_vector[state_index], img_scene, keypoints_scene_gpu, // good_matches, img_results, Scalar::all(-1), Scalar::all(-1), // vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS ); // Mat img_results; // imshow("",img_scene); // imshow("", img_object); // DRAW MAT Mat img_results = Mat::zeros( 750, 1200, CV_8UC3 ); drawScreenMap(img_results, img_scene, img_object_vector, curr_state_id, all_ids); //// drawScreenMap(img_results, imgm_scene, reachable_img_object_vector, curr_state_id, reachable_ids); drawStateGraph(img_results, transition_graph, curr_state_id); displayLogOnScreen(img_results, interface_name, objectnames, states, matched_state, current_state, "");// ocr_object_vector[curr_state_id]); // FINGERTIP LOCATION // Get the corners from the object (reference) image vector<Point2f> object_corners(5); getImageCorners(img_object, object_corners); // Transform object corners to scene corners using H vector<Point2f> scene_corners(5); // Might be better to user perspectiveTransform, use direct ratio for faster speed and testing // float ratio = img_scene.cols / (float)img_object.cols; // for (int i = 0; i < 5; i++) scene_corners[i] = object_corners[i] * ratio; perspectiveTransform( object_corners, scene_corners, H); // cout << "Image corners: " << scene_corners[1] << scene_corners[2] << scene_corners[3] << scene_corners[4] << endl; int guidance_index = -2; // Set mode to -2 for testing if (stoi(mode) == 2) { guidance_index = getGuidanceIndex(true_labels, target); } vector<Point2f> fingertip_location(1); if (guidance_index == -1) { if (no_button % 5 == 1) { feedback = "no button"; } else { feedback = ""; } no_button++; } else { no_button = 1; Rect rect; if (!findRect(scene_corners, rect)) { db_object_found = 0; db_finger_found = -1; fingerx = -1; fingery = -1; fingertip_not_found = 0; fingertip_found = 1; provide_guidance = 1; previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; if (object_not_found % 5 == 0) { feedback = "no object"; object_not_found++; } else { feedback = ""; object_not_found++; } cout << "No Object" << endl ; } else { db_object_found = 1; object_not_found = 1; // // If found, draw rectangles around both images // drawRects(img_results, object_corners, scene_corners, img_object); // Warp scene image with finger to reference image size Mat img_skin; warpPerspective(img_scene, img_skin, H.inv(), img_object.size(), INTER_LINEAR, BORDER_CONSTANT); // printf("Elapsed: %f seconds\n", (double)(toc - tic) / CLOCKS_PER_SEC); // Filter skin color to get binary image Mat img_skin_binary; // skinColorAdjustment(img_object, img_skin); skinColorFilter(img_skin, img_skin_binary); // skinColorSubtractor(img_skin, img_object, img_skin_binary); // Find fingertip location in reference image fingertip_location[0].x = -1; fingertip_location[0].y = -1; findFingertipLocation(img_skin_binary, img_object.rows * img_object.cols, H, avg_button_size, fingertip_location); // Find relative fingertip location in scene image vector<Point2f> scene_fingertip_location(1); perspectiveTransform( fingertip_location, scene_fingertip_location, H); if (fingertip_location[0].x == -1 && fingertip_location[0].y == -1) { db_finger_found = 0; fingerx = -1; fingery = -1; previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; fingertip_found = 1; provide_guidance = 1; if (fingertip_not_found % 5 == 0) { feedback = "no finger"; fingertip_not_found++; } else { feedback = ""; fingertip_not_found++; } } else { db_finger_found = 1; fingerx = (int) fingertip_location[0].x; fingery = (int) fingertip_location[0].y; // Disable feedback for testing switch (stoi(mode)) { case 1: // Provide feedback if (fingertip_found % 5 == 0) { previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; fingertip_found++; } else { fingertip_found++; } fingertip_not_found = 1; feedback = getFeedback(button_map, true_labels, fingertip_location, previous_fingertip_location, avg_button_size); break; case 2: { // Provide guidance if (guidance_index!= -1) { previous_guidance = guidance; guidance = getGuidance(button_map, true_labels, button_center[guidance_index], fingertip_location, previous_fingertip_location, avg_button_size); } if (guidance.compare(previous_guidance)) { provide_guidance = 1; feedback = guidance; // feedback = feedback + getFeedback(button_map, true_labels, fingertip_location, previous_fingertip_location); } else { if (provide_guidance % 5 == 1) { feedback = guidance; provide_guidance++; } else { feedback = ""; provide_guidance++; } } break; } } previous_fingertip_location = fingertip_location; } printf("-- Object Test Point : %f %f \n", fingertip_location[0].x, fingertip_location[0].y); printf("-- Scene Test Point : %f %f \n", scene_fingertip_location[0].x, scene_fingertip_location[0].y); //smooth fingertip location - no need, just filter out unreasonable points //remove rightmost fingertip location - cut side part of reference image solves this problem drawFingertips(img_results, img_object_vector, curr_state_id, fingertip_location, scene_fingertip_location); cout << "-- Fingertip Location:" << fingertip_location << scene_fingertip_location << endl; if (state.compare(current_state)) { string currfeedback = description_text_vector[curr_state_id]; feedback = "State: " + currfeedback + " " + feedback; // getStateDescription(curr_state_id) state = current_state; } } } imshow( "Overall Results", img_results ); // anounceFeedback(feedback); cout << "Feedback: " << feedback << endl; clock_t toc = clock(); printf("Elapsed: %f seconds\n", (double)(toc - tic) / CLOCKS_PER_SEC); // ****** END CLOCK ****** updateImage(db_object_found, db_finger_found, fingerx, fingery); idle = 1; waitKey(1); // waits to display frame } catch (Exception &e) { idle = 1; skipImage(); // To be added when sqlite is back continue; } } // Store // storeTransitionGraph(dir, transition_graph); // Json::Value value_obj; // Json::StreamWriterBuilder builder; string out_string = storeTransitionGraph(transition_graph); ofstream file(dir_server + "log/state_map.txt"); if (file.is_open()) { file << out_string; } file.close(); // ofstream file_ocr(dir + "../log/ocr.txt"); // if (file_ocr.is_open()) { // for (int i = 0; i < ocr_object_vector.size(); i++) { // file_ocr << ocr_object_vector[i] << endl; // } // } // file_ocr.close(); waitKey(0); return 0; } ======================= File: CVServer/lib/statemap_utils.hpp ======================= /* State Map Headers */ #include <iostream> #include <set> #include "opencv2/highgui/highgui.hpp" using namespace cv; using namespace std; int findCurrentState(vector<int> states); Point2f findTransitionFingertipLocation(int new_id, vector<int> states, vector<Point2f> fingertip_locations); void getCandidateObjectIds(int curr_state_id, vector<int> all_ids, vector<map<int, int>> transition_graph, vector<int> &candidate_ids_object_vector); void getCandidateObjectDescriptors(vector<int> candidate_ids_object_vector, vector<Mat> descriptors_object_gpu_vector, vector<Mat> &candidate_descriptors_object_vector); void addStateToTransitionGraph(string session_name, vector<map<int, int>> &transition_graph, int new_state_id); void updateTransitionGraph(string session_name, vector<map<int, int>> &transition_graph, int curr_state_id, int new_state_id, int button_id); void initializeObjects(vector<set<int>> adjList, vector<set<int>> &reachable_states); void filterObjects(int prev_state_id, vector<set<int>> reachable_states, vector<Mat> &reachable_descriptors_object_gpu_vector, vector<Mat> descriptors_object_gpu_vector); void filterOriginalImgs(int prev_state_id, vector<set<int>> reachable_states, vector<Mat> &reachable_img_object_vector, vector<Mat> img_object_vector); // string storeTransitionGraph(vector<map<int, int>> transition_graph); int getExpectedNextState(vector<map<int, int>> transition_graph, int curr_state_id, int button_index); ======================= File: CVServer/lib/feedback_utils.cpp ======================= /* Feedback Utils Implementation */ #include "feedback_utils.hpp" #include <set> extern string id; extern string image; extern string mode; extern string target; extern string state; extern string feedback; extern string guidance; extern int idle; std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) { std::stringstream ss(s); std::string item; while (std::getline(ss, item, delim)) { elems.push_back(item); } return elems; } std::vector<std::string> split(const std::string &s, char delim) { std::vector<std::string> elems; split(s, delim, elems); return elems; } string getFeedback(vector<vector<int> > button_map, vector<string> true_labels, vector<Point2f> fingertip_location, vector<Point2f> previous_fingertip_location, double avg_button_size) { int y = floor(fingertip_location[0].x); int x = floor(fingertip_location[0].y); string feedback = ""; int magic_value = button_map[x][y]; int size = true_labels.size(); if (previous_fingertip_location[0].x == -1 && previous_fingertip_location[0].y == -1) { if (magic_value >= 10000) { feedback = "near " + true_labels[magic_value - 10000]; } else if (magic_value > size) { feedback = true_labels[magic_value / 100] + " and " + true_labels[magic_value % 100]; } else if (magic_value >= 0) { feedback = true_labels[magic_value]; } else if (magic_value == -1) { feedback = ""; } } else { int previous_y = floor(previous_fingertip_location[0].x); int previous_x = floor(previous_fingertip_location[0].y); int previous_magic_value = button_map[previous_x][previous_y]; double distance = sqrt( (previous_fingertip_location[0].x - fingertip_location[0].x) * (previous_fingertip_location[0].x - fingertip_location[0].x) + (previous_fingertip_location[0].y - fingertip_location[0].y) * (previous_fingertip_location[0].y - fingertip_location[0].y) ); double thres = avg_button_size * 0.3; //10 // Detect movement speed, if fast: say nothing; if slow: use words if (distance <= thres) { if (magic_value == previous_magic_value) { feedback = ""; } else { if (magic_value >= 10000) { feedback = "near " + true_labels[magic_value - 10000]; } else if (magic_value > size) { feedback = true_labels[magic_value / 100] + " and " + true_labels[magic_value % 100]; } else if (magic_value >= 0) { feedback = true_labels[magic_value]; } else if (magic_value == -1) { feedback = ""; } } } else { if (magic_value >= 10000) { feedback = ""; } else if (magic_value > size) { feedback = ""; } else if (magic_value >= 0) { feedback = ""; } else if (magic_value == -1) { feedback = ""; } } } return feedback; } int getGuidanceIndex(vector<string> true_labels, string targets) { transform(targets.begin(), targets.end(), targets.begin(), ::tolower); vector<string> target = split(targets, ';'); for (int i = 0; i < target.size(); i++) { for (int j = 0; j < true_labels.size(); j++) { if (!true_labels[j].compare(target[i])) { return j; } } } return -1; } int pathLength(vector<map<int, int>> transition_graph, int curr_id, int target_id) { if (curr_id == target_id) { return 0; } set<int> visited; vector<int> currLevel = vector<int>(); vector<int> nextLevel = vector<int>(); visited.insert(curr_id); currLevel.push_back(curr_id); int level = 0; while (visited.size() < transition_graph.size() && currLevel.size() > 0) { level++; for (int i = 0; i < currLevel.size(); i++) { int tmp_curr_id = currLevel[i]; map<int, int> neighbors = transition_graph[tmp_curr_id]; map<int, int>::iterator it; for (it = neighbors.begin(); it!= neighbors.end(); it++) { int state = it->second; if (state == target_id) return level; if (visited.find(state) == visited.end()) { visited.insert(state); nextLevel.push_back(state); } } } currLevel = nextLevel; nextLevel = vector<int>(); } return -1; } int getGuidanceIndexBasedOnExpectedPath(vector<int> state_path, vector<int> button_path, vector<map<int, int>> transition_graph, vector<vector<int>> button_id_vector, int curr_state_id, int &next_idx_on_path) { int guidance_button_id = -1; int target_state_id = state_path[next_idx_on_path]; if (curr_state_id == target_state_id) { guidance_button_id = button_path[next_idx_on_path]; next_idx_on_path++; if (next_idx_on_path >= state_path.size()) { cout << "No need to find guidance index since target is reached!" << endl; return -1; } } else { // Case 1: If the current state is not next target state // but it is somewhere on the path for (int i = 0; i < state_path.size(); i++) { if (curr_state_id == state_path[i]) { next_idx_on_path = i + 1; guidance_button_id = button_path[i]; } } // Case 2: If the current state is not on the path if (guidance_button_id == -1) { map<int, int> neighbors = transition_graph[curr_state_id]; int shortes_path = -1; map<int, int>::iterator it; for (it = neighbors.begin(); it!= neighbors.end(); it++) { int curr_button_id = it->first; // Start over if something goes wrong // Search to find shortest path from next state of curr_state_id to initial state int path_length = pathLength(transition_graph, it->second, state_path[0]); if (shortes_path == -1 || shortes_path > path_length) { guidance_button_id = curr_button_id; shortes_path = path_length; } } if (shortes_path < 0) { cout << "Did not find path from current state to next target state!" << endl; return -1; } next_idx_on_path = 0; cout << "Next button id to press: " << guidance_button_id << endl; } } // Find guidance button based on given button id vector<int> buttons = button_id_vector[curr_state_id]; for (int i = 0; i < buttons.size(); i++) { if (guidance_button_id == buttons[i]) { return i; } } cout << "Target button not found on current screen!" << endl; return -1; } string getGuidance(vector<vector<int> > button_map, vector<string> true_labels, vector<double> guidance_button_center, vector<Point2f> fingertip_location, vector<Point2f> previous_fingertip_location, double avg_button_size) { string feedback = ""; double guidance_distance = sqrt( (guidance_button_center[0] - fingertip_location[0].x) * (guidance_button_center[0] - fingertip_location[0].x) + (guidance_button_center[1] - fingertip_location[0].y) * (guidance_button_center[1] - fingertip_location[0].y) ); double inner_threshold = avg_button_size * 0.5; //20 double outer_threshold = avg_button_size * 1.5; //60 if (guidance_distance <= inner_threshold) { feedback = getFeedback(button_map, true_labels, fingertip_location, previous_fingertip_location, avg_button_size); } else if (guidance_distance <= outer_threshold) { feedback = getDirection(guidance_button_center, fingertip_location, avg_button_size); feedback = feedback + " slowly"; } else { feedback = getDirection(guidance_button_center, fingertip_location, avg_button_size); } return feedback; } string getDirection(vector<double> guidance_button_center, vector<Point2f> fingertip_location, double avg_button_size) { string feedback = ""; double threshold = avg_button_size * 0.3; //15 double x_diff = guidance_button_center[0] - fingertip_location[0].x; double y_diff = guidance_button_center[1] - fingertip_location[0].y; // abs(x_diff) for always longest distance if (abs(y_diff) > threshold) { feedback = y_diff < 0? "up" : "down"; } else { feedback = x_diff < 0? "left" : "right"; } return feedback; } void anounceFeedback(string feedback) { // Anounce feedback string stringstream ss; ss << "say \"" << feedback << "\""; system(ss.str().c_str()); } ======================= File: CVServer/lib/ocr_utils.hpp ======================= <reponame>guoanhong/VizLens-public #include <fstream> #include <iostream> #include <regex> #include <string> #include <unordered_set> #include <json/json.h> #include "cpp-base64/base64.h" #include "curl/curl.h" #include "opencv2/highgui/highgui.hpp" using namespace std; using namespace cv; void init_dictionary(unordered_set<string> &dictionary); void getScreenRegionFromImage(Mat img, string &screen_exist, vector<double> &screen_box); void getOCRTextFromImage(Mat img, string &fulltext); float ocr_similarity_score(string str1, string str2); ======================= File: CVServer/main_access.cpp ======================= #include <iostream> #include <unistd.h> #include "curl/curl.h" #include "opencv2/nonfree/nonfree.hpp" //#include <opencv2/gpu/gpu.hpp> //#include "opencv2/nonfree/gpu.hpp" #include "sqlite3.h" #include "lib/access/db_utils.hpp" #include "lib/access/img_utils.hpp" // #include "lib/ocr_utils.hpp" #include "lib/access/statemap_utils.hpp" #include "lib/access/feedback_utils.hpp" #include "lib/access/visualization.hpp" #define DB "../WebServer/db/VizLensDynamic.db" #define imageDirBase "../WebServer/images_video/" #define dirBase "./samples/" const string session_name = "coffee_machine"; const string read_mode = "db"; using namespace cv; using namespace std; //using namespace cv::gpu; // using namespace tesseract; const int MIN_FINGER_DEPTH = 20; const int MAX_FINGER_ANGLE = 60; const double PI = 3.1415926; bool isOpenDB = false; sqlite3 *dbfile; string id = "0"; string image = ""; string mode = "3"; // Guide by path mode string target = ""; string state = ""; string feedback = ""; string guidance = ""; int idle = 1; int curr_state_id = -1; Mat curr_state_img_scene; float benchmark_ratio = 1.0; void readme(); int skipFrames(VideoCapture capture, int num); /* hasEnding: Check for correct file format */ bool hasEnding (std::string const &fullString, std::string const &ending) { if (fullString.length() >= ending.length()) { return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending)); } else { return false; } } /* NotAlphaNumerical: Filter out special characters encounterd in OCR */ /* bool NotAlphaNumerical(char c) { return!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c =='' || c == '\n'); } */ /** @function main */ int main(int argc, char** argv) { // NOTE: These vectors are for testing only // To be removed vector<double> lighting_vector = vector<double>(); vector<float> ratio_vector = vector<float>(); cout << "Start (dynamic display)"<< endl; string folder = string(argv[1]); string video = string(argv[2]); // Example: "video_coffee_hard.MOV"; // METADATA: Thresholds float small_diff_ratio = 0.05; // If diff of current state and detected state is below this value, consider it a noise float match_expectation_ratio = 0.8; // If ratio of expected state is above this value, consider it a match float neighbor_ratio_threshold = 0.3; // If max ratio among neighbors is above this value, consider it a match // This value is set lower than that in build mode to allow more errors float matched_ratio_threshold = atof(argv[3]); // 0.3; // Above this value, consider it as a match /* Initialize vectors to store reference images and buttons */ vector<Mat> img_object_vector = vector<Mat>(); vector<vector<int>> button_id_vector = vector<vector<int>>(); vector<vector<vector<int> > > button_map_vector = vector<vector<vector<int> > >(); vector<vector<string> > true_labels_vector = vector<vector<string> >(); vector<vector<vector<double> > > button_center_vector = vector<vector<vector<double> > >(); vector<vector<vector<double> > > button_shape_vector = vector<vector<vector<double> > >(); vector<double> avg_button_size_vector = vector<double>(); vector<Mat> keypoints_object_gpu_vector = vector<Mat>(); vector<Mat> descriptors_object_gpu_vector = vector<Mat>(); vector<vector<KeyPoint> > keypoints_object_vector = vector<vector<KeyPoint> >(); vector<vector<float> > descriptors_object_vector = vector<vector<float> >(); // vector<string> ocr_object_vector = vector<string>(); /* Initialize vectors to store objects and transition graph */ vector<string> objectnames = vector<string>(); vector<string> filenames = vector<string>(); vector<string> files = vector<string>(); vector<string> description_text_vector = vector<string>(); vector<map<int, int>> transition_graph = vector<map<int, int>>(); // vector<set<int>> reachable_states = vector<set<int>>(); vector<int> all_ids = vector<int>(); vector<int> detected_states = vector<int>(); // Pool of detected states for smoothing vector<Point2f> detected_fingertip_locations = vector<Point2f>(); // Pool of fingertop locations mapped with ids /* Initialize vectors to store candidates of new reference images */ vector<Mat> new_img_pool; vector<vector<KeyPoint> > new_keypoints_pool = vector<vector<KeyPoint> >(); vector<Mat> new_descriptors_pool = vector<Mat>(); // vector<string> new_ocr_vector = vector<string>(); vector<int> state_path = vector<int>(); vector<int> button_path = vector<int>(); /******************** DB Connection ********************/ isOpenDB = ConnectDB(DB); if (isOpenDB) cout << "Connected Successful" << endl; else cout << "connection failed " << endl; /******************** Read Expected Path ******************/ getExpectedPath(state_path, button_path); if (state_path.size() == 0) { cout << "State path is empty!" << endl; return 1; } else if (state_path.size()!= button_path.size() + 1) { cout << "State path and button path not of expected size!" << endl; return 1; } int next_idx_on_path = 0; bool success = false; /******************** Read Reference Images (objects) ********************/ string dir = string(dirBase) + folder + "/images/"; string dir_server = "./../WebServer/images_reference/" + session_name + "/"; getRefImageFilenames(session_name, dir, filenames, read_mode); getTransitionGraph(session_name, read_mode, filenames, transition_graph); // TODO(judy): Need to read OCR from db; add an OCR column in objects table /* ifstream inFileOCR; inFileOCR.open(dir + "../log/ocr.txt"); string line; while (inFileOCR >> curr_ocr) { ocr_object_vector.push_back(curr_ocr); } while (getline(inFileOCR, line)) { ocr_object_vector.push_back(line); } cout << ocr_object_vector.size() << endl; inFileOCR.close(); */ /* Load object images from WebServer image_reference folder */ string ending = "jpg"; /* GPU code */ /* SURF surf; surf.hessianThreshold = 400; */ int minHessian = 400; SurfFeatureDetector detector(minHessian); int id_count = 0; for (unsigned int i = 0;i < filenames.size();i++) { if (hasEnding (filenames[i], ending)) { id_count++; cout << filenames[i] << endl; Mat img_object = imread(dir_server+filenames[i]); cout << dir_server+filenames[i] << endl; files.push_back(filenames[i]); double ratio = img_object.rows > img_object.cols? 600.0 / (double)img_object.rows : 600.0 / (double) img_object.cols; Size img_object_size(img_object.cols * ratio, img_object.rows * ratio); //(150, 445) resize(img_object, img_object, img_object_size); img_object_vector.push_back(img_object); vector<int> button_id; vector<vector<int> > button_map; vector<string> true_labels; vector<vector<double> > button_center; vector<vector<double> > button_shape; double avg_button_size; labels_hash(session_name, id_count - 1, img_object, ratio, button_id, button_map, true_labels, button_center, button_shape, avg_button_size); // labels_hash(filenames[i].substr(0, filenames[i].size()- 4), img_object, ratio, button_map, true_labels, button_center, avg_button_size); button_id_vector.push_back(button_id); button_map_vector.push_back(button_map); true_labels_vector.push_back(true_labels); button_center_vector.push_back(button_center); button_shape_vector.push_back(button_shape); avg_button_size_vector.push_back(avg_button_size); cout << dir+filenames[i] << endl; lightingDetection(img_object); /* Computer SURF keypoints and descriptors for object (reference) image */ Mat img_object_gpu; Mat img_object_gray; cvtColor(img_object, img_object_gray, CV_RGB2GRAY); /* GPU code */ /* img_object_gpu.upload(img_object_gray); cv::gpu::printShortCudaDeviceInfo(cv::gpu::getDevice()); */ img_object_gpu = img_object; Mat keypoints_object_gpu; Mat descriptors_object_gpu; /* GPU code */ // surf(img_object_gpu, Mat(), keypoints_object_gpu, descriptors_object_gpu); /* CPU code */ vector<KeyPoint> keypoints_object; Mat descriptors_object; // GPU: vector<float> int minHessian = 400; SurfFeatureDetector detector(minHessian); detector.detect(img_object_gpu, keypoints_object); printf("-- Keypoints Vector Size : %lu \n", keypoints_object.size() ); /* Calculate reference descriptors (feature vectors) */ SurfDescriptorExtractor extractor; extractor.compute(img_object_gpu, keypoints_object, descriptors_object); /* GPU code */ /* keypoints_object_gpu_vector.push_back(keypoints_object_gpu); descriptors_object_gpu_vector.push_back(descriptors_object_gpu); cout << "FOUND " << keypoints_object_gpu.cols << " keypoints on first image" << endl; // Download objects results vector<KeyPoint> tmp_keypoints_object; vector<float> tmp_descriptors_object; surf.downloadKeypoints(keypoints_object_gpu, tmp_keypoints_object); surf.downloadDescriptors(descriptors_object_gpu, tmp_descriptors_object); */ all_ids.push_back(id_count - 1); objectnames.push_back(filenames[i].substr(0, filenames[i].size() - 4)); keypoints_object_vector.push_back(keypoints_object); descriptors_object_gpu_vector.push_back(descriptors_object); } } // TODO(judy): Need to DEBUG this part if (hasReadyToReadObjects()) { int new_state; string new_name; Mat new_object; updateCroppedImage(session_name, dir_server, new_name, new_state, new_object); // Computer SURF keypoints and descriptors for object (reference) image Mat new_object_gpu; Mat new_object_gray; cvtColor(new_object, new_object_gray, CV_RGB2GRAY); // GPU code // img_object_gpu.upload(img_object_gray); // cv::gpu::printShortCudaDeviceInfo(cv::gpu::getDevice()); new_object_gpu = new_object; Mat new_keypoints_object_gpu; Mat new_descriptors_object_gpu; // GPU code // surf(img_object_gpu, Mat(), keypoints_object_gpu, descriptors_object_gpu); // CPU code vector<KeyPoint> new_keypoints_object; Mat new_descriptors_object; // GPU: vector<float> int minHessian = 400; SurfFeatureDetector detector(minHessian); detector.detect(new_object_gpu, new_keypoints_object); printf("-- Keypoints Vector Size : %lu \n", new_keypoints_object.size() ); // Calculate reference descriptors (feature vectors) SurfDescriptorExtractor extractor; extractor.compute(new_object_gpu, new_keypoints_object, new_descriptors_object); all_ids.push_back(new_state); objectnames.push_back(new_name); keypoints_object_vector.push_back(new_keypoints_object); descriptors_object_gpu_vector.push_back(new_descriptors_object); // VizDynamic: May need crowdsourcing for labeling buttons in added image object vector<int> button_id; vector<vector<int> > button_map; vector<string> true_labels; vector<vector<double> > button_center; vector<vector<double> > button_shape; double avg_button_size; double obj_ratio = new_object.rows > new_object.cols? 600.0 / (double)new_object.rows : 600.0 / (double) new_object.cols; Size object_size(new_object.cols * obj_ratio, new_object.rows * obj_ratio); //(150, 445) resize(new_object, new_object, object_size); labels_hash(session_name, new_state, new_object, obj_ratio, button_id, button_map, true_labels, button_center, button_shape, avg_button_size); button_map_vector.push_back(button_map); true_labels_vector.push_back(true_labels); button_center_vector.push_back(button_center); button_shape_vector.push_back(button_shape); avg_button_size_vector.push_back(avg_button_size); } for (int i = 0; i < all_ids.size(); i++) { description_text_vector.push_back(getStateDescription(session_name, i)); cout << "Description Text: " << description_text_vector[i] << endl; } /******************** Read Video (scenes) and Match with Reference Images (objects) ********************/ /* Initialize values of detected screen and fintertip location*/ Mat keypoints_scene_gpu; Mat descriptors_scene_gpu; int count = 0; clock_t last_time = clock(); string previous_guidance = ""; int prev_state_id = -1; // curr_state_id = -1; vector<Point2f> previous_fingertip_location(1); previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; int object_not_found = 1; int fingertip_not_found = 1; int fingertip_found = 1; int provide_guidance = 1; int no_button = 1; int db_object_found = -1; int db_finger_found = -1; int fingerx = -1; int fingery = -1; bool force_state_change = false; /* CPU code */ string video_name = string(dirBase) + folder + "/videos/" + video; VideoCapture capture(video_name); if (!capture.isOpened()) { throw "--(!) Error reading stream"; } int frame = 0; int first_skip_frames = 0; for (int i = 0; i < first_skip_frames; i++) { capture.grab(); } frame += first_skip_frames; Mat H; int i; id = "0"; /* Start capturing scenes and matching with reference images */ for ( ;!success ; ) { try { /* Read scene */ // Scene doesn't read in valid image // Update cropped image doesn't change it to read // Note: Need to add back for video streaming /* string image_to_process; // ORIGINAL while (idle == 1) { if(clock() - last_time > (double)(0.05 * 1000000)) { count++; getImageToProcess(image_to_process); last_time = clock(); } } // int frames_skipped = 4; Mat img_scene = imread(imageDirBase + session_name + "/" + image_to_process); cout << imageDirBase + session_name + "/" + image_to_process << endl; cout << "reading img_scene" << endl; */ ++i; // CPU code /* Use local videos for image stream */ Mat img_scene; String img_text; int frames_skipped = 4; for (int a = 0; a < frames_skipped - 1; a++) { capture.grab(); } capture >> img_scene; if (img_scene.empty()) break; /* Use local videos for image stream */ if (img_scene.empty()) { idle = 1; skipImage(); continue; } // frame += frames_skipped; /* lighting -- lightingDetection(img_scene); */ // isStateProcessing(0); /****** START CLOCK *******/ clock_t tic = clock(); clock_t toc = clock(); /* Computer SURF keypoints and descriptors for scene (video) image */ Mat img_scene_gpu; Mat img_scene_gray; cvtColor(img_scene, img_scene_gray, CV_RGB2GRAY); /* GPU code */ /* img_scene_gpu.upload(img_scene_gray); surf(img_scene_gpu, Mat(), keypoints_scene_gpu, descriptors_scene_gpu); */ img_scene_gpu = img_scene_gray; /* CPU code */ vector<KeyPoint> keypoints_scene; Mat descriptors_scene; // SHOULD BE vector<float> detector.detect(img_scene_gpu, keypoints_scene); SurfDescriptorExtractor extractor; extractor.compute(img_scene_gpu, keypoints_scene, descriptors_scene); cout << "FOUND " << keypoints_scene.size() << " keypoints on second image" << endl; // cout << "FOUND " << keypoints_scene_gpu.cols << " keypoints on second image" << endl; if (keypoints_scene.size() == 0) { idle = 1; skipImage(); continue; } /* GPU code: */ /* vector<KeyPoint> keypoints_scene; vector<float> descriptors_scene; surf.downloadKeypoints(keypoints_scene_gpu, keypoints_scene); surf.downloadDescriptors(descriptors_scene_gpu, descriptors_scene); */ /******************** Start Matching ********************/ // double lighting_scene = calculateLighting(img_scene); // FINGERTIP LOCATION Mat img_object; vector<vector<int> > button_map; vector<vector<double> > button_center; vector<vector<double> > button_shape; vector<string> true_labels; double avg_button_size; vector<Point2f> object_corners(5); vector<Point2f> scene_corners(5); vector<Point2f> fingertip_location(1); vector<Point2f> scene_fingertip_location(1); int button_index; int expected_state_id = -1; bool confirmed_curr_state = false; cout << "--------------------------------------------" << endl; cout << "---- Ratio Benchmark: " << benchmark_ratio << endl; // cout << "---- Lighting Stats: " << lighting_scene << endl; int state_index = 0; float ratio_max = 0; // Reduce search space: See if the scene stays on the same image // Reduce search space: See if the scene is the expected image if (curr_state_id >= 0 && matchesCurrentState(descriptors_scene, keypoints_scene, curr_state_img_scene, descriptors_object_gpu_vector[curr_state_id], keypoints_object_vector[curr_state_id], benchmark_ratio, match_expectation_ratio)) { confirmed_curr_state = true; state_index = curr_state_id; cout << "---- Successfully matched with CURRENT state" << endl; } else if (expected_state_id >= 0 && matchesExpectedState(descriptors_scene, keypoints_scene, descriptors_object_gpu_vector[expected_state_id], keypoints_object_vector[expected_state_id], benchmark_ratio, match_expectation_ratio)) { confirmed_curr_state = true; state_index = expected_state_id; cout << "---- Successfully matched with EXPECTED state" << endl; } else { int inlier_max = -1; vector< DMatch > good_matches; vector<int> candidate_ids_object_vector; vector<Mat> candidate_descriptors_object_vector; getCandidateObjectIds(curr_state_id, all_ids, transition_graph, candidate_ids_object_vector); getCandidateObjectDescriptors(candidate_ids_object_vector, descriptors_object_gpu_vector, candidate_descriptors_object_vector); for (int i = 0; i < candidate_ids_object_vector.size(); i++) { cout << "---- NEIGHBOR OF CURRENT STATE : " << candidate_ids_object_vector[i] << endl; } cout << "------------------------------------------\n"; cout << "Start Matching \n"; cout << "------------------------------------------\n"; float curr_state_ratio = 0.0; float expected_state_ratio = 0.0; for (int i = 0; i < candidate_descriptors_object_vector.size();i++) { // matching descriptors BFMatcher matcher(NORM_L2); Mat trainIdx, distance; /* CPU code */ vector<DMatch> matches; matcher.match(candidate_descriptors_object_vector[i], descriptors_scene, matches); // matcher.match(descriptors_object_gpu_vector[i], descriptors_scene, matches); vector< DMatch > tmp_good_matches; gpuFindGoodMatches(matches, tmp_good_matches); // Can't find any object that matches the current scene if (tmp_good_matches.size() < 4) { cout << "-- Skipping Image -- " << i << endl; continue; } // Find H Mat tempH; vector<uchar> inliers; findH(keypoints_object_vector[candidate_ids_object_vector[i]], keypoints_scene, tmp_good_matches, tempH, inliers); // Only count non '\0' inliers int inliersCount = 0; for (int i = 0; i < inliers.size(); i++) { if (inliers[i]!= '\0') { inliersCount++; } } cout << "-- Match with Image -- " << candidate_ids_object_vector[i] << endl; // cout << "OCR text: " << ocr_object_vector[i] << endl; cout << "Object keypoints: " << keypoints_object_vector[i].size() << endl; cout << "Scene keypoints: " << keypoints_scene.size() << endl; cout << "Good matches: " << tmp_good_matches.size() << endl; cout << "Inlier count: " << inliersCount << endl; /* Calculate ratio of inliers */ float currRatio = inliersCount / (float)tmp_good_matches.size(); // / ((float)keypoints_object_vector[i].size() + (float)keypoints_scene.size()); cout << "Ratio of Inlier: " << currRatio << endl; cout << endl; if (i == 0 || currRatio > ratio_max) { ratio_max = currRatio; inlier_max = inliersCount; state_index = candidate_ids_object_vector[i]; H = tempH; } if (candidate_ids_object_vector[i] == curr_state_id) { curr_state_ratio = currRatio; } if (candidate_ids_object_vector[i] == expected_state_id) { expected_state_ratio = currRatio; } } cout << "---- Max ratio within neighbors: " << ratio_max << endl; // lighting_vector.push_back(lighting_scene); // ratio_vector.push_back(ratio_max); // Check if candidates include a good option // If not, search the original pool of reference images // Smoothing to get rid of noise // For example, if curr state and new state have ratio 0.42 and 0.43, // stick with current state because this might be a noise. if (ratio_max > 0 && (ratio_max - curr_state_ratio) / ratio_max < small_diff_ratio && curr_state_ratio > benchmark_ratio * match_expectation_ratio) { state_index = curr_state_id; ratio_max = curr_state_ratio; } // Compare with expected next state given fingertip location bool correct_next_state = true; if (state_index!= curr_state_id) { if (curr_state_id < 0) { correct_next_state = false; } else { correct_next_state = (expected_state_id == state_index); } } // Note: correct_next_state should be true when the state remains unchanged if (!correct_next_state) { if (ratio_max > 0 && (ratio_max - expected_state_ratio) / ratio_max < small_diff_ratio && expected_state_ratio > benchmark_ratio * match_expectation_ratio) { state_index = expected_state_id; ratio_max = expected_state_ratio; } } // If current highest matching equals current state, then assume it's not changed; // Otherwise if lower than a threshold, match using the original pool of reference image if (state_index!= curr_state_id &&!correct_next_state && ratio_max < benchmark_ratio * neighbor_ratio_threshold) { cout << "Did not find a good match in neighbors of current state" << endl; cout << "Searching all reference images...." << endl; for (int i = 0; i < descriptors_object_gpu_vector.size(); i++) { // matching descriptors BFMatcher matcher(NORM_L2); Mat trainIdx, distance; /* CPU code */ vector<DMatch> matches; matcher.match(descriptors_object_gpu_vector[i], descriptors_scene, matches); // matcher.match(descriptors_object_gpu_vector[i], descriptors_scene, matches); vector< DMatch > tmp_good_matches; gpuFindGoodMatches(matches, tmp_good_matches); // Can't find any object that matches the current scene if (tmp_good_matches.size() < 4) { cout << "-- Skipping Image -- " << i << endl; continue; } // Find H Mat tempH; vector<uchar> inliers; findH(keypoints_object_vector[i], keypoints_scene, tmp_good_matches, tempH, inliers); // Only count non '\0' inliers int inliersCount = 0; for (int i = 0; i < inliers.size(); i++) { if (inliers[i]!= '\0') { inliersCount++; } } cout << "-- Match with Image -- " << i << endl; // cout << "OCR text: " << ocr_object_vector[i] << endl; cout << "Object keypoints: " << keypoints_object_vector[i].size() << endl; cout << "Scene keypoints: " << keypoints_scene.size() << endl; cout << "Good matches: " << tmp_good_matches.size() << endl; cout << "Inlier count: " << inliersCount << endl; /* Calculate ratio of inliers */ float currRatio = inliersCount / (float)tmp_good_matches.size(); // / ((float)keypoints_object_vector[i].size() + (float)keypoints_scene.size()); cout << "Ratio of Inlier: " << currRatio << endl; cout << endl; if (i == 0 || currRatio > ratio_max) { ratio_max = currRatio; inlier_max = inliersCount; state_index = all_ids[i]; H = tempH; } } } else { // Found in neighboring states confirmed_curr_state = true; } } // Through away current scene if max ratio is below certain threshold Rect rect; bool no_object =!findRect(scene_corners, rect) && (ratio_max < matched_ratio_threshold); // Do the following steps only if there's an object matched bool state_change = false; if (!no_object) { // Use the history of detected screens to determine the current screen and get rid of noises. // Point2f transition_fingertip_location; if (detected_states.size() == 6) { detected_states.erase(detected_states.begin()); // detected_fingertip_locations.erase(detected_fingertip_locations.begin()); } detected_states.push_back(state_index); // detected_fingertip_locations.push_back(fingertip_location[0]); string matched_state; string current_state; int new_state_id = findCurrentState(detected_states); state_change = (new_state_id!= curr_state_id); if (state_change || force_state_change) { prev_state_id = curr_state_id; curr_state_id = new_state_id; curr_state_img_scene = img_scene; benchmark_ratio = max(benchmark_ratio, ratio_max); force_state_change = false; // transition_fingertip_location = findTransitionFingertipLocation(new_state_id, detected_states, detected_fingertip_locations); } cout << "Current state id: "<< curr_state_id <<endl; } else { cout << "No object matched for current scene!" << endl; } /**** End of matching for lockStateTransition = false ****/ cout << "PREVIOUS STATE: " << prev_state_id << endl; cout << "CURRENT STATE: " << curr_state_id << endl; /******************** Fingertip Location ********************/ // As well as preparation for expected state in the next step // Also only do this when there's an object matched fingertip_location[0].x = -1; fingertip_location[0].y = -1; if (!no_object) { img_object = img_object_vector[curr_state_id]; button_map = button_map_vector[curr_state_id]; true_labels = true_labels_vector[curr_state_id]; button_center = button_center_vector[curr_state_id]; button_shape = button_shape_vector[curr_state_id]; avg_button_size = avg_button_size_vector[curr_state_id]; // Get the corners from the object (reference) image getImageCorners(img_object, object_corners); // Transform object corners to scene corners using H perspectiveTransform( object_corners, scene_corners, H); // Warp scene image with finger to reference image size Mat img_skin; warpPerspective(img_scene, img_skin, H.inv(), img_object.size(), INTER_LINEAR, BORDER_CONSTANT); // Filter skin color to get binary image Mat img_skin_binary; // skinColorAdjustment(img_object, img_skin); skinColorFilter(img_skin, img_skin_binary); // skinColorSubtractor(img_skin, img_object, img_skin_binary); findFingertipLocation(img_skin_binary, img_object.rows * img_object.cols, H, avg_button_size, fingertip_location); // Find relative fingertip location in scene image perspectiveTransform( fingertip_location, scene_fingertip_location, H); // Get index of button the finger is currently above button_index = getButtonIndex(fingertip_location[0], button_map, true_labels); // Get expected next state for next round of matching expected_state_id = getExpectedNextState(transition_graph, curr_state_id, button_index); cout << "Current button index: " << button_index << endl; cout << "Expected state id: " << expected_state_id << endl; } /******************** Send Feedback ********************/ // double object_ratio = img_scene.rows > img_object.cols? 200.0 / (double)img_object.rows : 200.0 / (double) img_object.cols; // Size img_object_size(img_object.cols * object_ratio, img_object.rows * object_ratio); //(150, 445) // resize(img_object, img_object, img_object_size); /* Old visualization drawMatches( img_object, keypoints_object_vector[state_index], img_scene, keypoints_scene_gpu, good_matches, img_results, Scalar::all(-1), Scalar::all(-1), vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS ); */ // Resize to fit expected size double scene_ratio = img_scene.rows > (double)img_scene.cols / 3 * 2? 500 / (double)img_scene.rows : 750 / (double)img_scene.cols; Size img_scene_size(img_scene.cols * scene_ratio, img_scene.rows * scene_ratio); //(150, 445) resize(img_scene, img_scene, img_scene_size); // DRAW MAT Mat img_results = Mat::zeros( 750, 1200, CV_8UC3 ); drawScreenMap(img_results, img_scene, img_object_vector, curr_state_id, all_ids); drawStateGraph(img_results, transition_graph, curr_state_id); // DISPLAY LOG /* if (!lockStateTransition) { displayLogOnScreen(img_results, objectnames, detected_states, "", "", "");// ocr_object_vector[curr_state_id]); } */ // // UPDATED FINGERTIP LOCATION // // Get the corners from the object (reference) image // getImageCorners(img_object, object_corners); // // Transform object corners to scene corners using H // perspectiveTransform( object_corners, scene_corners, H); int guidance_index = -2; // = -2; // Set mode to -2 for testing if (!no_object) { if (stoi(mode) == 2) { guidance_index = getGuidanceIndex(true_labels, target); } else if (stoi(mode) == 3) { // Using current screen id, find out what's the button to press to go to next state guidance_index = getGuidanceIndexBasedOnExpectedPath(state_path, button_path, transition_graph, button_id_vector, curr_state_id, next_idx_on_path); cout << "Guidance Mode: Based on Expected Path" << endl; cout << "Current State Id: " << curr_state_id << endl; cout << "Next Target State Id: " << state_path[next_idx_on_path] << endl; cout << "Guidance Button: " << guidance_index << endl; if (next_idx_on_path >= state_path.size()) { success = true; } } } // Originally declared here // vector<Point2f> fingertip_location(1); bool announcing_state = false; if (success) { string currfeedback = description_text_vector[curr_state_id]; feedback = "State: " + currfeedback + "; Successfully reached target state!"; cout << "Successfully reached target state! Done." << endl; } else if (guidance_index == -1) { if (no_button % 5 == 1) { feedback = "no button"; } else { feedback = ""; } no_button++; } else { no_button = 1; Rect rect; if (no_object ||!findRect(scene_corners, rect)) { db_object_found = 0; db_finger_found = -1; fingerx = -1; fingery = -1; fingertip_not_found = 0; fingertip_found = 1; provide_guidance = 1; previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; if (object_not_found % 5 == 0) { feedback = "no object"; object_not_found++; force_state_change = true; } else { feedback = ""; object_not_found++; } cout << "No Object" << endl ; } else { db_object_found = 1; object_not_found = 1; // Note: Not needed for here /* // Warp scene image with finger to reference image size Mat img_skin; warpPerspective(img_scene, img_skin, H.inv(), img_object.size(), INTER_LINEAR, BORDER_CONSTANT); // printf("Elapsed: %f seconds\n", (double)(toc - tic) / CLOCKS_PER_SEC); // Filter skin color to get binary image Mat img_skin_binary; // skinColorAdjustment(img_object, img_skin); skinColorFilter(img_skin, img_skin_binary); // skinColorSubtractor(img_skin, img_object, img_skin_binary); // Find fingertip location in reference image fingertip_location[0].x = -1; fingertip_location[0].y = -1; findFingertipLocation(img_skin_binary, img_object.rows * img_object.cols, H, avg_button_size, fingertip_location); // Find relative fingertip location in scene image vector<Point2f> scene_fingertip_location(1); perspectiveTransform( fingertip_location, scene_fingertip_location, H); */ scene_fingertip_location[0].x *= scene_ratio; scene_fingertip_location[0].y *= scene_ratio; if (state_change || force_state_change) { announcing_state = true; string currfeedback = description_text_vector[curr_state_id]; if (stoi(mode) == 1) { feedback = "State: " + currfeedback; } else if (stoi(mode) == 2 || stoi(mode) == 3) { feedback = "State: " + currfeedback; if (guidance_index >= 0) { feedback += "; Target: " + true_labels[guidance_index]; } } force_state_change = false; } else if (fingertip_location[0].x == -1 && fingertip_location[0].y == -1) { Point2f object_center_scene; object_center_scene = scene_corners[4]; feedback = ""; if (object_center_scene.y < 0) { feedback += "up "; } else if (object_center_scene.y > img_scene.rows) { feedback += "down "; } if (object_center_scene.x < 0) { feedback += "right"; } else if (object_center_scene.x > img_scene.cols) { feedback += "left"; } if (feedback.compare("")) { feedback = "Move phone to " + feedback; } else { db_finger_found = 0; fingerx = -1; fingery = -1; previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; fingertip_found = 1; provide_guidance = 1; if (fingertip_not_found % 5 == 0) { feedback = "no finger"; fingertip_not_found++; } else { feedback = ""; fingertip_not_found++; } } } else { db_finger_found = 1; fingerx = (int) fingertip_location[0].x; fingery = (int) fingertip_location[0].y; switch (stoi(mode)) { case 1: // Provide feedback if (fingertip_found % 5 == 0) { previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; fingertip_found++; } else { fingertip_found++; } fingertip_not_found = 1; feedback = getFeedback(button_map, true_labels, fingertip_location, previous_fingertip_location, avg_button_size); break; case 2: case 3: { // Provide guidance if (guidance_index!= -1) { previous_guidance = guidance; guidance = getGuidanceForPathMode(button_map, true_labels, button_center[guidance_index], button_shape[guidance_index], fingertip_location, previous_fingertip_location, avg_button_size, guidance_index); } if (guidance.compare(previous_guidance)) { provide_guidance = 1; feedback = guidance; // feedback = feedback + getFeedback(button_map, true_labels, fingertip_location, previous_fingertip_location); } else { if (provide_guidance % 5 == 1) { feedback = guidance; provide_guidance++; } else { feedback = ""; provide_guidance++; } } break; } } previous_fingertip_location = fingertip_location; } printf("-- Object Test Point : %f %f \n", fingertip_location[0].x, fingertip_location[0].y); printf("-- Scene Test Point : %f %f \n", scene_fingertip_location[0].x, scene_fingertip_location[0].y); //smooth fingertip location - no need, just filter out unreasonable points //remove rightmost fingertip location - cut side part of reference image solves this problem drawFingertips(img_results, img_object_vector, curr_state_id, fingertip_location, scene_fingertip_location); cout << "-- Fingertip Location:" << fingertip_location << scene_fingertip_location << endl; } } imshow( "Overall Results", img_results ); anounceFeedback(feedback); // cout << "Feedback: " << feedback << endl; // clock_t toc = clock(); // printf("Elapsed: %f seconds\n", (double)(toc - tic) / CLOCKS_PER_SEC); // ****** END CLOCK ****** // Note: Need to debug this and add this back updateImage(db_object_found, db_finger_found, fingerx, fingery); idle = 1; // Wait to let the iOS end announce state if (announcing_state || feedback.find("press it")!= string::npos) { sleep(1); // 1 second } waitKey(1); // waits to display frame } catch (Exception &e) { idle = 1; skipImage(); // To be added when sqlite is back // continue; } } // NOTE: To record data about lighting vs. max ratio within neighbors waitKey(0); return 0; } ======================= File: CVServer/lib/img_utils.hpp ======================= <gh_stars>0 /* Image Utils Header */ #include <iostream> #include "opencv2/highgui/highgui.hpp" #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/imgproc/imgproc.hpp" using namespace cv; using namespace std; double calculateLighting(Mat img); void lightingDetection(Mat img); void gpuFindGoodMatches(vector< DMatch > matches, vector< DMatch > &good_matches); void findH(vector<KeyPoint> keypoints_object, vector<KeyPoint> keypoints_scene, vector<DMatch> good_matches, Mat &H, vector<uchar> &inliers); void getImageCorners(Mat img_object, vector<Point2f> &object_corners); bool findRect(vector<Point2f> scene_corners, Rect &rect); void drawRects(Mat img_results, vector<Point2f> object_corners, vector<Point2f> scene_corners, Mat img_object); void skinColorAdjustment(Mat img_object, Mat &img_skin); void skinColorFilter(Mat img_skin, Mat &img_skin_binary); void skinColorSubtractor(Mat img_skin, Mat img_object, Mat &img_skin_binary); int angleBetween(Point tip, Point next, Point prev); void findConvexHullBasedFingertipLocation(vector<vector<Point> > contours, vector<vector<Point> > hull, int index_of_biggest_contour, double avg_button_size, vector<Point2f> &fingertip_location, Mat &draw_contours); void findConvexHullDefectBasedFingertipLocation(vector<vector<Point> > contours, vector<vector<Point> > hull, int index_of_biggest_contour, double avg_button_size, vector<Point2f> &fingertip_location, Mat &draw_contours); void findFingertipLocation (Mat img_skin_binary, int area, Mat H, double avg_button_size, vector<Point2f> &fingertip_location); bool checkNewImgFromPool(vector<Mat> &new_img_pool, vector<vector<KeyPoint>> &new_keypoints_pool, vector<Mat> &new_descriptors_pool, Mat &img_scene, vector<KeyPoint> &keypoints_scene, Mat &descriptors_scene); int getButtonIndex(Point2f fingertip_location, vector<vector<int> > button_map, vector<string> true_labels); bool matchesCurrentState(Mat descriptors_scene, vector<KeyPoint> keypoints_scene, Mat curr_state_img_scene, Mat descriptors_curr_state, vector<KeyPoint> keypoints_curr_state, float benchmark_ratio, float match_expectation_ratio); bool matchesExpectedState(Mat descriptors_scene, vector<KeyPoint> keypoints_scene, Mat descriptors_expected_state, vector<KeyPoint> keypoints_expected_state, float benchmark_ratio, float match_expectation_ratio); bool isNewState(float ratio_max, float ratio_lower, float ratio_upper, int state_index, Mat img_scene, vector<string> ocr_object_vector, float ocr_threshold_upper, float ocr_threshold_lower); // void detectScreen(Mat &img_scene, bool &is_cropped, bool &is_skipped); ======================= File: CVServer/lib/access/db_utils.hpp ======================= /* Database Utils Headers */ #include <dirent.h> #include <iostream> #include "sqlite3.h" #include "opencv2/highgui/highgui.hpp" using namespace cv; using namespace std; bool ConnectDB(const char* DB); void DisonnectDB(const char* DB); void getExpectedPath(vector<int> &state_path, vector<int> &button_path); void getRefImageFilenames(string session_name, string dir, vector<string> &filenames, string mode); void getTransitionGraph(string session_name, string read_mode, vector<string> filenames, vector<map<int, int>> &transition_graph); void getImageToProcess(string &image_to_process); int updateImage(int objectfound, int fingerfound, int fingerx, int fingery); int skipImage(); void sendTransitionInstructions(string session, string instruction); string getStateDescription(string session, int state_id); bool hasReadyToReadObjects(); void updateCroppedImage(string session, string dir_server, string &new_name, int &state_id, Mat &img_object); void labels_hash(string session_name, int state_index, Mat img_object, double ratio, vector<int> &button_id, vector<vector<int> > &button_map, vector<string> &true_labels, vector<vector<double> > &button_center, vector<vector<double> > &button_shape, double &avg_button_size); void addTransitionToDB(string session_name, int curr_state_id, int new_state_id, int button_id); ======================= File: CVServer-old/dynamic_display.cpp ======================= <filename>CVServer-old/dynamic_display.cpp #include <sys/types.h> #include <dirent.h> #include <stdio.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <fstream> #include <math.h> #include <vector> #include <string> #include <time.h> #include <algorithm> #include <string> #include "opencv2/core/core.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/nonfree/nonfree.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/video/background_segm.hpp" #include <opencv2/gpu/gpu.hpp> #include "opencv2/nonfree/gpu.hpp" #include "sqlite3.h" // TODO: define envpaths // #define PATH genenv("APP_PATH") #define DB "/home/guoanhong/Desktop/ApplianceReader/WebServer/db/ApplianceReader.db" #define refImageDirBase "/home/guoanhong/Desktop/ApplianceReader/WebServer/images_reference/" #define imageDirBase "/home/guoanhong/Desktop/ApplianceReader/WebServer/images_video/" #define session "dynamic" using namespace cv; using namespace std; using namespace cv::gpu; const int MIN_FINGER_DEPTH = 20; const int MAX_FINGER_ANGLE = 60; const double PI = 3.1415926; bool isOpenDB = false; sqlite3 *dbfile; string id = "0"; string image = ""; string mode = "0"; string target = ""; string state = ""; string feedback = ""; string guidance = ""; int idle = 1; bool ConnectDB (); void DisonnectDB (); void getImageToProcess(); int updateImage(int objectfound, int fingerfound, int fingerx, int fingery); int skipImage(); void readme(); void labels_hash(string session_name, Mat img_object, double ratio, vector<vector<int> > &button_map, vector<string> &true_labels, vector<vector<double> > &button_center, double &avg_button_size); int skipFrames(VideoCapture capture, int num); void lightingDetection(Mat img); void gpuFindGoodMatches(vector< DMatch > matches, vector< DMatch > &good_matches); void findH(vector<KeyPoint> keypoints_object, vector<KeyPoint> keypoints_scene, vector<DMatch> good_matches, Mat &H, vector<uchar> &inliers); void getImageCorners(Mat img_object, vector<Point2f> &object_corners); bool findRect(vector<Point2f> scene_corners, Rect &rect); void drawRects(Mat img_results, vector<Point2f> object_corners, vector<Point2f> scene_corners, Mat img_object); void skinColorAdjustment(Mat img_object, Mat &img_skin); void skinColorFilter(Mat img_skin, Mat &img_skin_binary); void skinColorSubtractor(Mat img_skin, Mat img_object, Mat &img_skin_binary); void findFingertipLocation (Mat img_skin_binary, int area, Mat H, double avg_button_size, vector<Point2f> &fingertip_location); string getFeedback(vector<vector<int> > button_map, vector<string> true_labels, vector<Point2f> fingertip_location, vector<Point2f> previous_fingertip_location, double avg_button_size); int getGuidanceIndex(vector<string> true_labels, string targets); string getGuidance(vector<vector<int> > button_map, vector<string> true_labels, vector<double> guidance_button_center, vector<Point2f> fingertip_location, vector<Point2f> previous_fingertip_location, double avg_button_size); string getDirection(vector<double> guidance_button_center, vector<Point2f> fingertip_location, double avg_button_size); void anounceFeedback(string feedback); void findConvexHullBasedFingertipLocation(vector<vector<Point> > contours, vector<vector<Point> > hull, int index_of_biggest_contour, double avg_button_size, vector<Point2f> &fingertip_location, Mat &draw_contours); void findConvexHullDefectBasedFingertipLocation(vector<vector<Point> > contours, vector<vector<Point> > hull, int index_of_biggest_contour, double avg_button_size, vector<Point2f> &fingertip_location, Mat &draw_contours); int angleBetween(Point tip, Point next, Point prev); void drawFingertips(Mat img_results, Mat img_object, vector<Point2f> fingertip_location, vector<Point2f> scene_fingertip_location); int getdir (string dir, vector<string> &files) { DIR *dp; struct dirent *dirp; if((dp = opendir(dir.c_str())) == NULL) { cout << "Error(" << errno << ") opening " << dir << endl; return errno; } while ((dirp = readdir(dp))!= NULL) { files.push_back(string(dirp->d_name)); } closedir(dp); return 0; } bool hasEnding (std::string const &fullString, std::string const &ending) { if (fullString.length() >= ending.length()) { return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending)); } else { return false; } } /** @function main */ int main(int argc, char** argv) { cout << "Start (dynamic display)"<< endl; isOpenDB = ConnectDB(); if (isOpenDB) cout << "Connected Successful" << endl; else cout << "connection failed " << endl; // cout << "Please input button index for guidance: "; // int guidance_index = -1; // scanf("%d", &guidance_index); vector<Mat> img_object_vector = vector<Mat>(); vector<vector<vector<int> > > button_map_vector = vector<vector<vector<int> > >(); vector<vector<string> > true_labels_vector = vector<vector<string> >(); vector<vector<vector<double> > > button_center_vector = vector<vector<vector<double> > >(); vector<double> avg_button_size_vector = vector<double>(); vector<GpuMat> keypoints_object_gpu_vector = vector<GpuMat>(); vector<GpuMat> descriptors_object_gpu_vector = vector<GpuMat>(); vector<vector<KeyPoint> > keypoints_object_vector = vector<vector<KeyPoint> >(); vector<vector<float> > descriptors_object_vector = vector<vector<float> >(); string dir = string(refImageDirBase) + string(session) + "/"; vector<string> filenames = vector<string>(); vector<string> files = vector<string>(); getdir(dir,filenames); string ending = "jpg"; SURF_GPU surf; surf.hessianThreshold = 400; for (unsigned int i = 0;i < filenames.size();i++) { if (hasEnding (filenames[i], ending)) { cout << filenames[i] << endl; Mat img_object = imread(dir+filenames[i]); files.push_back(filenames[i]); double ratio = img_object.rows > img_object.cols? 600.0 / (double)img_object.rows : 600.0 / (double) img_object.cols; // Size img_object_size(150, 445); //(150, 445) // resize(img_object, img_object, img_object_size); Size img_object_size(img_object.cols * ratio, img_object.rows * ratio); //(150, 445) resize(img_object, img_object, img_object_size); img_object_vector.push_back(img_object); vector<vector<int> > button_map; vector<string> true_labels; vector<vector<double> > button_center; double avg_button_size; labels_hash(filenames[i].substr(0, filenames[i].size()-9), img_object, ratio, button_map, true_labels, button_center, avg_button_size); button_map_vector.push_back(button_map); true_labels_vector.push_back(true_labels); button_center_vector.push_back(button_center); avg_button_size_vector.push_back(avg_button_size); cout << dir+filenames[i]; lightingDetection(img_object); // Computer SURF keypoints and descriptors for object (reference) image GpuMat img_object_gpu; Mat img_object_gray; cvtColor(img_object, img_object_gray, CV_RGB2GRAY); img_object_gpu.upload(img_object_gray); cv::gpu::printShortCudaDeviceInfo(cv::gpu::getDevice()); GpuMat keypoints_object_gpu; GpuMat descriptors_object_gpu; surf(img_object_gpu, GpuMat(), keypoints_object_gpu, descriptors_object_gpu); keypoints_object_gpu_vector.push_back(keypoints_object_gpu); descriptors_object_gpu_vector.push_back(descriptors_object_gpu); cout << "FOUND " << keypoints_object_gpu.cols << " keypoints on first image" << endl; // downloading objects results vector<KeyPoint> tmp_keypoints_object; vector<float> tmp_descriptors_object; surf.downloadKeypoints(keypoints_object_gpu, tmp_keypoints_object); surf.downloadDescriptors(descriptors_object_gpu, tmp_descriptors_object); keypoints_object_vector.push_back(tmp_keypoints_object); descriptors_object_vector.push_back(tmp_descriptors_object); } } for (int i = 0; i < files.size(); ++i){ cout << files[i] << endl; } GpuMat keypoints_scene_gpu; GpuMat descriptors_scene_gpu; int count = 0; clock_t last_time = clock(); printf("Gran = %f\n", 0.05 * 1000000); string previous_guidance = ""; vector<Point2f> previous_fingertip_location(1); previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; int object_not_found = 1; int fingertip_not_found = 1; int fingertip_found = 1; int provide_guidance = 1; int no_button = 1; int db_object_found = -1; int db_finger_found = -1; int fingerx = -1; int fingery = -1; for ( ; ; ) { try { while (idle == 1) { if(clock() - last_time > (double)(0.05 * 1000000)) { count++; getImageToProcess(); last_time = clock(); } } Mat img_scene = imread(imageDirBase+image); Size img_scene_size(360, 640); if (img_scene.empty()) break; // resize(img_scene, img_scene, img_scene_size); cout << "--Size of frame is: "<< img_scene.cols << " " << img_scene.rows << endl; lightingDetection(img_scene); /****** START CLOCK *******/ clock_t tic = clock(); // Computer SURF keypoints and descriptors for scene (video) image GpuMat img_scene_gpu; Mat img_scene_gray; cvtColor(img_scene, img_scene_gray, CV_RGB2GRAY); img_scene_gpu.upload(img_scene_gray); surf(img_scene_gpu, GpuMat(), keypoints_scene_gpu, descriptors_scene_gpu); cout << "FOUND " << keypoints_scene_gpu.cols << " keypoints on second image" << endl; if (keypoints_scene_gpu.cols == 0) { idle = 1; skipImage(); continue; } // downloading scene results vector<KeyPoint> keypoints_scene; vector<float> descriptors_scene; surf.downloadKeypoints(keypoints_scene_gpu, keypoints_scene); surf.downloadDescriptors(descriptors_scene_gpu, descriptors_scene); vector< DMatch > good_matches; int state_index = -1; Mat H; int inlier_max = -1; for (int i = 0;i < files.size();i++) { // matching descriptors BFMatcher_GPU matcher(NORM_L2); GpuMat trainIdx, distance; matcher.matchSingle(descriptors_object_gpu_vector[i], descriptors_scene_gpu, trainIdx, distance); vector<DMatch> matches; BFMatcher_GPU::matchDownload(trainIdx, distance, matches); vector< DMatch > tmp_good_matches; gpuFindGoodMatches(matches, tmp_good_matches); // Find H Mat tempH; vector<uchar> inliers; findH(keypoints_object_vector[i], keypoints_scene, tmp_good_matches, tempH, inliers); // Only count non '\0' inliers int inliersCount = 0; for (int i = 0; i < inliers.size(); i++) { if (inliers[i]!= '\0') { inliersCount++; } } cout << "Inlier count: " << i << " " << inliersCount << endl; if (i == 0 || inliersCount > inlier_max) { inlier_max = inliersCount; state_index = i; H = tempH; } // Mat img_results; /* drawMatches( img_object, keypoints_object, img_scene, keypoints_scene, good_matches, img_results, Scalar::all(-1), Scalar::all(-1), vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS ); */ } string current_state = files[state_index].substr(0, files[state_index].size() - 9); cout << "Current state: " << current_state << endl; Mat img_object = img_object_vector[state_index]; vector<vector<int> > button_map = button_map_vector[state_index]; vector<string> true_labels = true_labels_vector[state_index]; vector<vector<double> > button_center = button_center_vector[state_index]; double avg_button_size = avg_button_size_vector[state_index]; Mat img_results; // Get the corners from the object (reference) image vector<Point2f> object_corners(5); getImageCorners(img_object, object_corners); // Transform object corners to scene corners using H vector<Point2f> scene_corners(5); perspectiveTransform( object_corners, scene_corners, H); int guidance_index = -2; if (stoi(mode) == 2) { guidance_index = getGuidanceIndex(true_labels, target); } if (guidance_index == -1) { if (no_button % 5 == 1) { feedback = "no button"; } else { feedback = ""; } no_button++; } else { no_button = 1; Rect rect; if (!findRect(scene_corners, rect)) { db_object_found = 0; db_finger_found = -1; fingerx = -1; fingery = -1; fingertip_not_found = 0; fingertip_found = 1; provide_guidance = 1; previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; if (object_not_found % 5 == 0) { feedback = "no object"; object_not_found++; } else { feedback = ""; object_not_found++; } cout << "No Object" << endl ; } else { db_object_found = 1; object_not_found = 1; // If found, draw rectangles around both images drawRects(img_results, object_corners, scene_corners, img_object); // Warp scene image with finger to reference image size Mat img_skin; warpPerspective(img_scene, img_skin, H.inv(), img_object.size(), INTER_LINEAR, BORDER_CONSTANT); // Filter skin color to get binary image Mat img_skin_binary; skinColorAdjustment(img_object, img_skin); skinColorFilter(img_skin, img_skin_binary); // skinColorSubtractor(img_skin, img_object, img_skin_binary); // Find fingertip location in reference image vector<Point2f> fingertip_location(1); fingertip_location[0].x = -1; fingertip_location[0].y = -1; findFingertipLocation(img_skin_binary, img_object.rows * img_object.cols, H, avg_button_size, fingertip_location); if (fingertip_location[0].x == -1 && fingertip_location[0].y == -1) { db_finger_found = 0; fingerx = -1; fingery = -1; previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; fingertip_found = 1; provide_guidance = 1; if (fingertip_not_found % 5 == 0) { feedback = "no finger"; fingertip_not_found++; } else { feedback = ""; fingertip_not_found++; } } else { db_finger_found = 1; fingerx = (int) fingertip_location[0].x; fingery = (int) fingertip_location[0].y; switch (stoi(mode)) { case 1: // Provide feedback if (fingertip_found % 5 == 0) { previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; fingertip_found++; } else { fingertip_found++; } fingertip_not_found = 1; feedback = getFeedback(button_map, true_labels, fingertip_location, previous_fingertip_location, avg_button_size); break; case 2: { // Provide guidance if (guidance_index!= -1) { previous_guidance = guidance; guidance = getGuidance(button_map, true_labels, button_center[guidance_index], fingertip_location, previous_fingertip_location, avg_button_size); } if (guidance.compare(previous_guidance)) { provide_guidance = 1; feedback = guidance; // feedback = feedback + getFeedback(button_map, true_labels, fingertip_location, previous_fingertip_location); } else { if (provide_guidance % 5 == 1) { feedback = guidance; provide_guidance++; } else { feedback = ""; provide_guidance++; } } break; } } previous_fingertip_location = fingertip_location; } // Find relative fingertip location in scene image vector<Point2f> scene_fingertip_location(1); perspectiveTransform( fingertip_location, scene_fingertip_location, H); printf("-- Object Test Point : %f %f \n", fingertip_location[0].x, fingertip_location[0].y); printf("-- Scene Test Point : %f %f \n", scene_fingertip_location[0].x, scene_fingertip_location[0].y); //smooth fingertip location - no need, just filter out unreasonable points //remove rightmost fingertip location - cut side part of reference image solves this problem drawFingertips(img_results, img_object, fingertip_location, scene_fingertip_location); if (state.compare(current_state)) { feedback = "State: " + current_state + " " + feedback; state = current_state; } } } //-- Show detected matches // imshow( "Overall Results", img_results ); // anounceFeedback(feedback); cout << "Feedback: " << feedback << endl; clock_t toc = clock(); printf("Elapsed: %f seconds\n", (double)(toc - tic) / CLOCKS_PER_SEC); /****** END CLOCK *******/ updateImage(db_object_found, db_finger_found, fingerx, fingery); idle = 1; waitKey(1); // waits to display frame } catch (Exception &e) { idle = 1; skipImage(); continue; } } waitKey(0); return 0; } bool ConnectDB () { if ( sqlite3_open(DB, &dbfile) == SQLITE_OK ) { isOpenDB = true; return true; } return false; } void DisonnectDB () { if ( isOpenDB == true ) { sqlite3_close(dbfile); } } void getImageToProcess() { sqlite3_stmt *statement; char query[1000]; sprintf(query, "SELECT image, id, imageactive, target FROM images_video WHERE imageactive>0 AND id>%s ORDER BY id DESC", id.c_str()); // cout << query << endl; if ( sqlite3_prepare(dbfile, query, -1, &statement, 0 ) == SQLITE_OK ) { int firstResult = sqlite3_step(statement); if (firstResult == 100) { cout << "Got it." << endl; image = (char*)sqlite3_column_text(statement, 0); cout << image << endl; id = (char*)sqlite3_column_text(statement, 1); cout << id << endl; mode = (char*)sqlite3_column_text(statement, 2); cout << mode << endl; target = (char*)sqlite3_column_text(statement, 3); cout << target << endl; idle = 0; } else if (firstResult == 101) { // cout << "Nothing." << endl; } sqlite3_finalize(statement); } } int updateImage(int objectfound, int fingerfound, int fingerx, int fingery) { sqlite3_stmt *statement; int result; char query[1000]; sprintf(query, "UPDATE images_video SET imageactive=0," "feedback=\"%s\",feedbackactive=1,resulttime=current_timestamp, objectfound=%s, fingerfound=%s, fingertipx=%s, fingertipy=%s WHERE id=%s", feedback.c_str(), to_string(objectfound).c_str(), to_string(fingerfound).c_str(), to_string(fingerx).c_str(), to_string(fingery).c_str(), id.c_str()); cout << query << endl; { if(sqlite3_prepare(dbfile,query,-1,&statement,0)==SQLITE_OK) { int res = sqlite3_step(statement); result = res; sqlite3_finalize(statement); cout << "Update Image!" << endl; } return result; } cout << "Update Image!" << endl; return 0; } int skipImage() { sqlite3_stmt *statement; int result; char query[1000]; sprintf(query, "UPDATE images_video SET imageactive=0 WHERE id=%s", id.c_str()); cout << query << endl; { if(sqlite3_prepare(dbfile,query,-1,&statement,0)==SQLITE_OK) { int res = sqlite3_step(statement); result = res; sqlite3_finalize(statement); cout << "Skip Image!" << endl; } return result; } cout << "Skip Image!" << endl; return 0; } void readme(){ cout << " Usage:./ApplianceReader <reference image> <scene video> <labels.txt>" << endl; } std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) { std::stringstream ss(s); std::string item; while (std::getline(ss, item, delim)) { elems.push_back(item); } return elems; } std::vector<std::string> split(const std::string &s, char delim) { std::vector<std::string> elems; split(s, delim, elems); return elems; } void labels_hash(string session_name, Mat img_object, double ratio, vector<vector<int> > &button_map, vector<string> &true_labels, vector<vector<double> > &button_center, double &avg_button_size) { string x1, y1, x2, y2, label; vector<vector<string> > labels; sqlite3_stmt *statement; char query[1000]; sprintf(query, "SELECT x1, y1, x2, y2, label FROM object_buttons WHERE session=\"%s\"", session_name.c_str()); cout << query << endl; if ( sqlite3_prepare(dbfile, query, -1, &statement, 0 ) == SQLITE_OK ) { for (;;) { int nextResult = sqlite3_step(statement); if (nextResult == SQLITE_DONE) break; if (nextResult!= SQLITE_ROW) { printf("error: %s!\n", sqlite3_errmsg(dbfile)); break; } cout << "Got it." << endl; x1 = (char*)sqlite3_column_text(statement, 0); cout << x1 << endl; y1 = (char*)sqlite3_column_text(statement, 1); cout << y1 << endl; x2 = (char*)sqlite3_column_text(statement, 2); cout << x1 << endl; y2 = (char*)sqlite3_column_text(statement, 3); cout << y1 << endl; label = (char*)sqlite3_column_text(statement, 4); cout << label << endl; // push x1, y1, x2, y2, label into x and push to labels vector<string> x; x.push_back(x1); x.push_back(y1); x.push_back(x2); x.push_back(y2); x.push_back(label); labels.push_back(x); } sqlite3_finalize(statement); } else { cout << "Failed" << endl; } double sum_button_width = 0; // compute the centers of each button for (int i = 0; i < labels.size(); i++) { vector<string> tmp = labels[i]; double x1 = stod(tmp[0]) * ratio; double y1 = stod(tmp[1]) * ratio; double x2 = stod(tmp[2]) * ratio; double y2 = stod(tmp[3]) * ratio; double centerX = (x1 + x2) / 2; double centerY = (y1 + y2) / 2; vector<double> append = {centerX, centerY}; button_center.push_back(append); true_labels.push_back(tmp[4]); // push button labels sum_button_width += x2 - x1; } avg_button_size = sum_button_width / labels.size(); double threshold = avg_button_size; //55 cout << avg_button_size << endl; // Generate two dimensional array, assign class label cout << img_object.rows << " " << img_object.cols << endl; for (int i = 0; i < img_object.rows; i++) { vector<int> row; for (int j = 0; j < img_object.cols; j++) { int distance[labels.size()]; int idx_min1 = -1; double min_d1 = 100000; int idx_min2 = -1; double min_d2 = 100000; for (int k = 0; k < labels.size(); k++) { double centerX = button_center[k][0]; double centerY = button_center[k][1]; distance[k] = sqrt((centerX - j) * (centerX - j) + (centerY - i) * (centerY - i)); if (distance[k] < min_d2) { if (distance[k] < min_d1) { min_d2 = min_d1; min_d1 = distance[k]; idx_min2 = idx_min1; idx_min1 = k; } else { min_d2 = distance[k]; idx_min2 = k; } } } // check whether in the smallest distance vector<string> tmp = labels[idx_min1]; double x1 = stod(tmp[0]) * ratio; double y1 = stod(tmp[1]) * ratio; double x2 = stod(tmp[2]) * ratio; double y2 = stod(tmp[3]) * ratio; if (x1 <= j && j <= x2 && i >= y1 && i <= y2) { row.push_back(idx_min1); } else if (min_d1 > threshold) { row.push_back(-1); } else if (min_d2 > threshold) { row.push_back(idx_min1 + 10000); } else { row.push_back(idx_min1 * 100 + idx_min2); } } button_map.push_back(row); } // Print out button map for verification // for (int i = 0; i < img_object.rows; i++) { // for (int j = 0; j < img_object.cols; j++) { // cout << button_map[i][j] << " "; // } // cout << "end" << endl; // } } void lightingDetection(Mat img) { double img_mean = sum(img)[0] / (img.cols * img.rows); if (img_mean < 20) { cout << "Too dark!" << img_mean << endl; } else if (img_mean > 150) { cout << "Too bright!" << img_mean << endl; } else { cout << "Good lighting!" << img_mean << endl; } // When object is 87, good. When scene is at 125, a bit too bright. } void gpuFindGoodMatches(vector< DMatch > matches, vector< DMatch > &good_matches) { //-- Quick calculation of max and min distances between keypoints double max_dist = 0; double min_dist = 100; for (int i = 0; i < matches.size(); i++) { double dist = matches[i].distance; if (dist < min_dist) min_dist = dist; if (dist > max_dist) max_dist = dist; } printf("-- Max dist : %f \n", max_dist ); printf("-- Min dist : %f \n\n", min_dist ); //-- Draw only "good" matches (i.e. whose distance is less than 3*min_dist ) for (int i = 0; i < matches.size(); i++) { if (matches[i].distance < 3 * min_dist) { good_matches.push_back( matches[i]); } } } void findH(vector<KeyPoint> keypoints_object, vector<KeyPoint> keypoints_scene, vector<DMatch> good_matches, Mat &H, vector<uchar> &inliers) { //-- Localize the object vector<Point2f> obj; vector<Point2f> scene; for (int i = 0; i < good_matches.size(); i++) { //-- Get the keypoints from the good matches obj.push_back( keypoints_object[good_matches[i].queryIdx].pt ); scene.push_back( keypoints_scene[good_matches[i].trainIdx].pt ); } printf("Good Matches: %lu\n", good_matches.size()); int inliersCount = 0; cout << "FOUND " << keypoints_object.size() << " keypoints on first image" << endl; cout << "FOUND " << keypoints_scene.size() << " keypoints on second image" << endl; // Use RANSAC to find homography H = findHomography( obj, scene, CV_RANSAC, 3, inliers ); //cout << "H = "<< endl << " " << H << endl << endl; // // Only count non '\0' inliers // for (int i = 0; i < inliers.size(); i++) { // if (inliers[i]!= '\0') { // inliersCount++; // } // } // printf("-- Inlier size : %d \n\n", inliersCount ); } void getImageCorners(Mat img_object, vector<Point2f> &object_corners) { object_corners[0] = cvPoint( 0, 0 ); object_corners[1] = cvPoint( img_object.cols, 0 ); object_corners[2] = cvPoint( img_object.cols, img_object.rows ); object_corners[3] = cvPoint( 0, img_object.rows ); object_corners[4] = cvPoint( img_object.cols / 2, img_object.rows / 2); } bool findRect(vector<Point2f> scene_corners, Rect &rect) { int smallestX = 5000; int largestX = -1; int smallestY = 5000; int largestY = -1; for (int i = 0; i < 4; i++) { if (scene_corners[i].x < smallestX) { smallestX = scene_corners[i].x; } if (scene_corners[i].x > largestX) { largestX = scene_corners[i].x; } if (scene_corners[i].y < smallestY) { smallestY = scene_corners[i].y; } if (scene_corners[i].y > largestY) { largestY = scene_corners[i].y; } } rect = *new Rect(smallestX, smallestY, largestX - smallestX, largestY - smallestY); cout << "-- Rect: " << rect.x << " " << rect.y << " " << rect.width << " " << rect.height << endl ; if (rect.width < 50 || rect.height < 50) { return false; } return true; } void drawRects(Mat img_results, vector<Point2f> object_corners, vector<Point2f> scene_corners, Mat img_object) { //-- Draw lines between the corners (the object to be mapped - image_1 ) line( img_results, object_corners[0], object_corners[1], Scalar(0, 255, 0), 2 ); line( img_results, object_corners[1], object_corners[2], Scalar(0, 255, 0), 2 ); line( img_results, object_corners[2], object_corners[3], Scalar(0, 255, 0), 2 ); line( img_results, object_corners[3], object_corners[0], Scalar(0, 255, 0), 2 ); //-- Draw lines between the corners (the mapped object in the scene - image_2 ) line( img_results, scene_corners[0] + Point2f( img_object.cols, 0), scene_corners[1] + Point2f( img_object.cols, 0), Scalar(0, 255, 0), 2 ); line( img_results, scene_corners[1] + Point2f( img_object.cols, 0), scene_corners[2] + Point2f( img_object.cols, 0), Scalar( 0, 255, 0), 2 ); line( img_results, scene_corners[2] + Point2f( img_object.cols, 0), scene_corners[3] + Point2f( img_object.cols, 0), Scalar( 0, 255, 0), 2 ); line( img_results, scene_corners[3] + Point2f( img_object.cols, 0), scene_corners[0] + Point2f( img_object.cols, 0), Scalar( 0, 255, 0), 2 ); } void skinColorAdjustment(Mat img_object, Mat &img_skin) { Scalar img_object_mean = mean(img_object); Scalar img_skin_mean = mean(img_skin); img_skin = img_skin - (img_skin_mean - img_object_mean); // img_skin.convertTo(img_skin, -1, 0.5, 0); // imshow("img_skin_adjusted", img_skin); } void skinColorFilter(Mat img_skin, Mat &img_skin_binary) { GaussianBlur(img_skin, img_skin, Size(3,3), 0); Mat hsv; cvtColor(img_skin, hsv, CV_BGR2HSV); // imshow("img_skin", hsv); // Filter image color Scalar skin_lower_threshold = *new Scalar(0, 90, 60); Scalar skin_upper_threshold = *new Scalar(20, 150, 255); inRange(hsv, skin_lower_threshold, skin_upper_threshold, img_skin_binary); // Erode and dilate morphologyEx(img_skin_binary, img_skin_binary, CV_MOP_ERODE, Mat1b(3,3,1)); morphologyEx(img_skin_binary, img_skin_binary, CV_MOP_DILATE, Mat1b(5,5,1)); // imshow("img_skin_binary", img_skin_binary); } void skinColorSubtractor(Mat img_skin, Mat img_object, Mat &img_skin_binary) { absdiff(img_object, img_skin, img_skin_binary); // imshow("img_skin_binary_before", img_skin_binary); cvtColor(img_skin_binary, img_skin_binary, COLOR_RGB2GRAY); // Potential: add parallel calculation of different threshlds threshold(img_skin_binary, img_skin_binary, 80, 255, CV_THRESH_BINARY); // Erode and dilate morphologyEx(img_skin_binary, img_skin_binary, CV_MOP_ERODE, Mat1b(3,3,1)); morphologyEx(img_skin_binary, img_skin_binary, CV_MOP_DILATE, Mat1b(3,3,1)); // imshow("img_skin_binary_after", img_skin_binary); } void findFingertipLocation (Mat img_skin_binary, int area, Mat H, double avg_button_size, vector<Point2f> &fingertip_location) { Mat canny_output; vector<vector<Point> > contours; vector<Vec4i> hierarchy; findContours( img_skin_binary, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) ); int index_of_biggest_contour = -1; double size_of_biggest_contour = 0; for (int i = 0; i < contours.size(); i++) { if (contourArea(contours[i]) > size_of_biggest_contour) { size_of_biggest_contour = contourArea(contours[i]); index_of_biggest_contour = i; } } cout << "-- sizeOfBiggestContour = " << size_of_biggest_contour << endl; cout << "-- indexOfBiggestContour = " << index_of_biggest_contour << endl << endl; //0.002 if (size_of_biggest_contour > 0.002 * area) { Mat draw_contours = Mat::zeros( img_skin_binary.size(), CV_8UC3 ); vector<vector<Point> > hull(contours.size()); findConvexHullBasedFingertipLocation(contours, hull, index_of_biggest_contour, avg_button_size, fingertip_location, draw_contours); // findConvexHullDefectBasedFingertipLocation(contours, hull, index_of_biggest_contour, fingertip_location, draw_contours); // imshow("Contours", draw_contours); } } string getFeedback(vector<vector<int> > button_map, vector<string> true_labels, vector<Point2f> fingertip_location, vector<Point2f> previous_fingertip_location, double avg_button_size) { int y = floor(fingertip_location[0].x); int x = floor(fingertip_location[0].y); string feedback = ""; int magic_value = button_map[x][y]; int size = true_labels.size(); if (previous_fingertip_location[0].x == -1 && previous_fingertip_location[0].y == -1) { if (magic_value >= 10000) { feedback = "near " + true_labels[magic_value - 10000]; } else if (magic_value > size) { feedback = true_labels[magic_value / 100] + " and " + true_labels[magic_value % 100]; } else if (magic_value >= 0) { feedback = true_labels[magic_value]; } else if (magic_value == -1) { feedback = " "; } } else { int previous_y = floor(previous_fingertip_location[0].x); int previous_x = floor(previous_fingertip_location[0].y); int previous_magic_value = button_map[previous_x][previous_y]; double distance = sqrt( (previous_fingertip_location[0].x - fingertip_location[0].x) * (previous_fingertip_location[0].x - fingertip_location[0].x) + (previous_fingertip_location[0].y - fingertip_location[0].y) * (previous_fingertip_location[0].y - fingertip_location[0].y) ); double thres = avg_button_size * 0.3; //10 // Detect movement speed, if fast: say nothing; if slow: use words if (distance <= thres) { if (magic_value == previous_magic_value) { feedback = ""; } else { if (magic_value >= 10000) { feedback = "near " + true_labels[magic_value - 10000]; } else if (magic_value > size) { feedback = true_labels[magic_value / 100] + " and " + true_labels[magic_value % 100]; } else if (magic_value >= 0) { feedback = true_labels[magic_value]; } else if (magic_value == -1) { feedback = " "; } } } else { if (magic_value >= 10000) { feedback = ""; } else if (magic_value > size) { feedback = ""; } else if (magic_value >= 0) { feedback = ""; } else if (magic_value == -1) { feedback = ""; } } } return feedback; } int getGuidanceIndex(vector<string> true_labels, string targets) { transform(targets.begin(), targets.end(), targets.begin(), ::tolower); vector<string> target = split(targets, ';'); for (int i = 0; i < target.size(); i++) { for (int j = 0; j < true_labels.size(); j++) { if (!true_labels[j].compare(target[i])) { return j; } } } return -1; } string getGuidance(vector<vector<int> > button_map, vector<string> true_labels, vector<double> guidance_button_center, vector<Point2f> fingertip_location, vector<Point2f> previous_fingertip_location, double avg_button_size) { string feedback = ""; double guidance_distance = sqrt( (guidance_button_center[0] - fingertip_location[0].x) * (guidance_button_center[0] - fingertip_location[0].x) + (guidance_button_center[1] - fingertip_location[0].y) * (guidance_button_center[1] - fingertip_location[0].y) ); double inner_threshold = avg_button_size * 0.5; //20 double outer_threshold = avg_button_size * 1.5; //60 if (guidance_distance <= inner_threshold) { feedback = getFeedback(button_map, true_labels, fingertip_location, previous_fingertip_location, avg_button_size); } else if (guidance_distance <= outer_threshold) { feedback = getDirection(guidance_button_center, fingertip_location, avg_button_size); feedback = feedback + " slowly"; } else { feedback = getDirection(guidance_button_center, fingertip_location, avg_button_size); } return feedback; } string getDirection(vector<double> guidance_button_center, vector<Point2f> fingertip_location, double avg_button_size) { string feedback = ""; double threshold = avg_button_size * 0.3; //15 double x_diff = guidance_button_center[0] - fingertip_location[0].x; double y_diff = guidance_button_center[1] - fingertip_location[0].y; // abs(x_diff) for always longest distance if (abs(y_diff) > threshold) { feedback = y_diff < 0? "up" : "down"; } else { feedback = x_diff < 0? "left" : "right"; } return feedback; } void anounceFeedback(string feedback) { // Anounce feedback string stringstream ss; ss << "say \"" << feedback << "\""; system(ss.str().c_str()); } void drawFingertips(Mat img_results, Mat img_object, vector<Point2f> fingertip_location, vector<Point2f> scene_fingertip_location) { if (fingertip_location[0].x > 0 && fingertip_location[0].x < img_object.cols && fingertip_location[0].y > 0 && fingertip_location[0].y < img_object.rows) { line( img_results, fingertip_location[0] + Point2f(0, 0), scene_fingertip_location[0] + Point2f( img_object.cols, 0), Scalar(0, 255, 0), 4 ); circle(img_results, fingertip_location[0], 5, Scalar(0,0,255), 4, 8, 0); circle(img_results, scene_fingertip_location[0] + Point2f( img_object.cols, 0), 5, Scalar(0,0,255), 4, 8, 0); } } void findConvexHullBasedFingertipLocation(vector<vector<Point> > contours, vector<vector<Point> > hull, int index_of_biggest_contour, double avg_button_size, vector<Point2f> &fingertip_location, Mat &draw_contours) { // Find the convex hull object for each contour for (int i = 0; i < contours.size(); i++){ //find the hulls convexHull(contours[i], hull[i], true); } // Draw contours + hull results Scalar color = Scalar( 255, 0, 0 ); drawContours( draw_contours, contours, index_of_biggest_contour, color, 2, 8, vector<Vec4i>(), 0, Point() ); drawContours( draw_contours, hull, index_of_biggest_contour, color, 2, 8, vector<Vec4i>(), 0, Point() ); // Find and draw fingertip location - Based on Convex Hull double smallest_y = 3000; int smallest_y_hull_idx = -1; for (int i = 0; i < hull[index_of_biggest_contour].size(); i++) { Point pt = hull[index_of_biggest_contour][i]; if (pt.y < smallest_y) { smallest_y = pt.y; smallest_y_hull_idx = i; } } double offset = avg_button_size / 2 * 0.5; fingertip_location[0].x = hull[index_of_biggest_contour][smallest_y_hull_idx].x; fingertip_location[0].y = hull[index_of_biggest_contour][smallest_y_hull_idx].y + offset; // move fingertip location y down into the finger circle(draw_contours, fingertip_location[0], 7, Scalar(0,255, 0), 2, 8, 0); /* int previous_smallest_y_hull_id, next_smallest_y_hull_id; if (smallest_y_hull_idx!= -1) { previous_smallest_y_hull_id = smallest_y_hull_idx - 1 < 0? hull[index_of_biggest_contour].size() - 1 : smallest_y_hull_idx - 1; next_smallest_y_hull_id = smallest_y_hull_idx + 1 > hull[index_of_biggest_contour].size() - 1? 0 : smallest_y_hull_idx + 1; // circle(draw_contours, hull[index_of_biggest_contour][smallest_y_hull_idx], 7, Scalar(0,255, 0), 2, 8, 0); circle(draw_contours, hull[index_of_biggest_contour][previous_smallest_y_hull_id], 7, Scalar(255,0, 0), 2, 8, 0); circle(draw_contours, hull[index_of_biggest_contour][next_smallest_y_hull_id], 7, Scalar(0,0, 255), 2, 8, 0); } double dist_previous_current = sqrt((hull[index_of_biggest_contour][previous_smallest_y_hull_id].x - hull[index_of_biggest_contour][smallest_y_hull_idx].x) * (hull[index_of_biggest_contour][previous_smallest_y_hull_id].x - hull[index_of_biggest_contour][smallest_y_hull_idx].x) + (hull[index_of_biggest_contour][previous_smallest_y_hull_id].y - hull[index_of_biggest_contour][smallest_y_hull_idx].y) * (hull[index_of_biggest_contour][previous_smallest_y_hull_id].y - hull[index_of_biggest_contour][smallest_y_hull_idx].y) ); double dist_next_current = sqrt((hull[index_of_biggest_contour][next_smallest_y_hull_id].x - hull[index_of_biggest_contour][smallest_y_hull_idx].x) * (hull[index_of_biggest_contour][next_smallest_y_hull_id].x - hull[index_of_biggest_contour][smallest_y_hull_idx].x) + (hull[index_of_biggest_contour][next_smallest_y_hull_id].y - hull[index_of_biggest_contour][smallest_y_hull_idx].y) * (hull[index_of_biggest_contour][next_smallest_y_hull_id].y - hull[index_of_biggest_contour][smallest_y_hull_idx].y) ); // smallest y being the left most point if (dist_previous_current > dist_next_current) { fingertip_location[0].x = hull[index_of_biggest_contour][smallest_y_hull_idx].x + offset; fingertip_location[0].y = hull[index_of_biggest_contour][smallest_y_hull_idx].y + offset; } // smallest y being the right most point else { fingertip_location[0].x = hull[index_of_biggest_contour][smallest_y_hull_idx].x - offset; fingertip_location[0].y = hull[index_of_biggest_contour][smallest_y_hull_idx].y + offset; } */ } void findConvexHullDefectBasedFingertipLocation(vector<vector<Point> > contours, vector<vector<Point> > hull, int index_of_biggest_contour, double avg_button_size, vector<Point2f> &fingertip_location, Mat &draw_contours) { //Find the convex hull and defects object for each contour vector<vector<int> > hulls_I(contours.size()); vector<vector<Vec4i> > defects(contours.size()); vector<vector<Point> > defect_points(contours.size()); for (int i = 0; i <contours.size(); ++i){ //find the hulls convexHull(contours[i], hulls_I[i], true); convexHull(contours[i], hull[i], true); //find the defects if (contours[i].size() > 3 ) { convexityDefects(contours[i], hulls_I[i], defects[i]); } } //Draw contours + hull results Scalar color = Scalar( 255, 0, 0 ); drawContours( draw_contours, contours, index_of_biggest_contour, color, 1, 8, vector<Vec4i>(), 0, Point() ); drawContours( draw_contours, hull, index_of_biggest_contour, color, 1, 8, vector<Vec4i>(), 0, Point() ); vector<Point> tip_pts; vector<Point> fold_pts; vector<int> depths; vector<Point> fingertips; for (int k = 0; k < defects[index_of_biggest_contour].size(); k++) { int ind_0 = defects[index_of_biggest_contour][k][0]; int ind_1 = defects[index_of_biggest_contour][k][1]; int ind_2 = defects[index_of_biggest_contour][k][2]; tip_pts.push_back(contours[index_of_biggest_contour][ind_0]); tip_pts.push_back(contours[index_of_biggest_contour][ind_1]); fold_pts.push_back(contours[index_of_biggest_contour][ind_2]); depths.push_back(defects[index_of_biggest_contour][k][3]); } int numPoints = (int)fold_pts.size(); for (int i=0; i < numPoints; i++) { if (depths[i] < MIN_FINGER_DEPTH) continue; // look at fold points on either side of a tip int pdx = (i == 0)? (numPoints-1) : (i - 1); int sdx = (i == numPoints-1)? 0 : (i + 1); int angle = angleBetween(tip_pts[i], fold_pts[pdx], fold_pts[sdx]); cout << angle << " "; if (angle >= MAX_FINGER_ANGLE) // angle between finger and folds too wide continue; // this point is probably a fingertip, so add to list fingertips.push_back(tip_pts[i]); } for (int i = 0; i < fingertips.size(); i ++) { //circle(drawing,fingerTips[i],5,Scalar(0,0,255),-1); } //Find and draw fingertip location - Based on Convex Hull and Defects double smallest_y_fingertip = 3000; int smallest_y_fingertip_idx = -1; for (int i = 0; i < fingertips.size(); i++) { Point pt = fingertips[i]; if (pt.y < smallest_y_fingertip) { smallest_y_fingertip = pt.y; smallest_y_fingertip_idx = i; } } if (smallest_y_fingertip_idx!= -1) { circle(draw_contours, fingertips[smallest_y_fingertip_idx], 10, Scalar(0,255,0)); } fingertip_location[0].x = hull[index_of_biggest_contour][smallest_y_fingertip_idx].x; fingertip_location[0].y = hull[index_of_biggest_contour][smallest_y_fingertip_idx].y; } int angleBetween(Point tip, Point next, Point prev) { // calculate the angle between the tip and its neighboring folds // (in integer degrees) return abs((int) round((atan2(next.x - tip.x, next.y - tip.y) - atan2(prev.x - tip.x, prev.y - tip.y))*180/PI)); } ======================= File: CVServer/static.cpp ======================= <gh_stars>0 #include <sys/types.h> #include <dirent.h> #include <stdio.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <fstream> #include <math.h> #include <vector> #include <string> #include <time.h> #include <algorithm> #include <string> #include <set> #include "opencv2/core/core.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/nonfree/nonfree.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/video/background_segm.hpp" //#include <opencv2/gpu/gpu.hpp> //#include "opencv2/nonfree/gpu.hpp" // #include "sqlite3.h" // #include "lib/db_utils.hpp" #include "lib/img_utils.hpp" #include "lib/statemap_utils.hpp" #include "lib/feedback_utils.hpp" #include "lib/visualization.hpp" // TODO: define envpaths // #define PATH genenv("APP_PATH") #define DB "/home/guoanhong/Desktop/ApplianceReader/WebServer/db/ApplianceReader.db" #define refImageDirBase "/Users/judy/Desktop/VizLens/samples/images/" #define imageDirBase "/Users/judy/Desktop/VizLens/samples/videos" // VizLens Test/images_video/" #define session "" using namespace cv; using namespace std; //using namespace cv::gpu; const int MIN_FINGER_DEPTH = 20; const int MAX_FINGER_ANGLE = 60; const double PI = 3.1415926; bool isOpenDB = false; sqlite3 *dbfile; string id = "0"; string image = ""; string mode = "0"; string target = ""; string state = ""; string feedback = ""; string guidance = ""; int idle = 1; void readme(); int skipFrames(VideoCapture capture, int num); int getdir (string dir, vector<string> &files) { DIR *dp; struct dirent *dirp; if((dp = opendir(dir.c_str())) == NULL) { cout << "Error(" << errno << ") opening " << dir << endl; return errno; } while ((dirp = readdir(dp))!= NULL) { files.push_back(string(dirp->d_name)); } closedir(dp); return 0; } bool hasEnding (std::string const &fullString, std::string const &ending) { if (fullString.length() >= ending.length()) { return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending)); } else { return false; } } /** @function main */ int main(int argc, char** argv) { cout << "Start (dynamic display)"<< endl; // isOpenDB = ConnectDB(); // // if (isOpenDB) cout << "Connected Successful" << endl; // else cout << "connection failed " << endl; vector<Mat> img_object_vector = vector<Mat>(); vector<vector<vector<int> > > button_map_vector = vector<vector<vector<int> > >(); vector<vector<string> > true_labels_vector = vector<vector<string> >(); vector<vector<vector<double> > > button_center_vector = vector<vector<vector<double> > >(); vector<double> avg_button_size_vector = vector<double>(); vector<Mat> keypoints_object_gpu_vector = vector<Mat>(); vector<Mat> descriptors_object_gpu_vector = vector<Mat>(); vector<vector<KeyPoint> > keypoints_object_vector = vector<vector<KeyPoint> >(); vector<vector<float> > descriptors_object_vector = vector<vector<float> >(); /******************** Read Images ********************/ // JUDY int interface_id = getInterfaceId(); string interface_name = getInterfaceName(interface_id); // NOTE: in user testing, can either let user input/choose the current interface, // or detect the current interface and let the user confirm. // string dir = string(refImageDirBase) + string(session) + "/"; string dir = string(refImageDirBase) + string(session) + "/" + interface_name + "/"; vector<string> filenames = vector<string>(); vector<string> files = vector<string>(); vector<int> states = vector<int>(); vector<set<int>> transition_graph = vector<set<int>>(); vector<set<int>> reachable_states = vector<set<int>>(); vector<int> all_ids = vector<int>(); // /* Initialize screenmap visualization */ // Mat state_graph_pic = Mat::zeros( 250, 750, CV_8UC3 ); getdir(dir,filenames); sort(filenames.begin(), filenames.end()); // for (int i = 0; i < filenames.size(); i++) { // cout << filenames[i] << "\n"; // } getTransitionGraph(interface_id, transition_graph); initializeObjects(transition_graph, reachable_states); // /* Initial visualization preparation */ // drawInitGraph(state_graph_pic, transition_graph); string ending = "jpeg"; int prev_state_id = -1; int curr_state_id = -1; // NEEDED // SURF surf; // surf.hessianThreshold = 400; int minHessian = 400; SurfFeatureDetector detector(minHessian); for (unsigned int i = 0;i < filenames.size();i++) { if (hasEnding (filenames[i], ending)) { cout << filenames[i] << endl; Mat img_object = imread(dir+filenames[i]); files.push_back(filenames[i]); double ratio = img_object.rows > img_object.cols? 600.0 / (double)img_object.rows : 600.0 / (double) img_object.cols; Size img_object_size(img_object.cols * ratio, img_object.rows * ratio); //(150, 445) resize(img_object, img_object, img_object_size); img_object_vector.push_back(img_object); vector<vector<int> > button_map; vector<string> true_labels; vector<vector<double> > button_center; double avg_button_size; labels_hash(filenames[i].substr(0, filenames[i].size()-9), img_object, ratio, button_map, true_labels, button_center, avg_button_size); button_map_vector.push_back(button_map); true_labels_vector.push_back(true_labels); button_center_vector.push_back(button_center); avg_button_size_vector.push_back(avg_button_size); cout << dir+filenames[i]; lightingDetection(img_object); // Computer SURF keypoints and descriptors for object (reference) image Mat img_object_gpu; Mat img_object_gray; cvtColor(img_object, img_object_gray, CV_RGB2GRAY); // img_object_gpu.upload(img_object_gray); // cv::gpu::printShortCudaDeviceInfo(cv::gpu::getDevice()); img_object_gpu = img_object; Mat keypoints_object_gpu; Mat descriptors_object_gpu; // ORIGINAL // surf(img_object_gpu, Mat(), keypoints_object_gpu, descriptors_object_gpu); // CPU ONLY vector<KeyPoint> keypoints_object; Mat descriptors_object; // SHOULD BE vector<float> int minHessian = 400; SurfFeatureDetector detector(minHessian); detector.detect(img_object_gpu, keypoints_object); printf("-- Keypoints Vector Size : %lu \n", keypoints_object.size() ); //-- Step 2: Calculate reference descriptors (feature vectors) SurfDescriptorExtractor extractor; extractor.compute(img_object_gpu, keypoints_object, descriptors_object); // keypoints_object_gpu_vector.push_back(keypoints_object_gpu); // descriptors_object_gpu_vector.push_back(descriptors_object_gpu); // // cout << "FOUND " << keypoints_object_gpu.cols << " keypoints on first image" << endl; // // // downloading objects results // vector<KeyPoint> tmp_keypoints_object; // vector<float> tmp_descriptors_object; // ORIGINAL // surf.downloadKeypoints(keypoints_object_gpu, tmp_keypoints_object); // surf.downloadDescriptors(descriptors_object_gpu, tmp_descriptors_object); all_ids.push_back(i); keypoints_object_vector.push_back(keypoints_object); descriptors_object_gpu_vector.push_back(descriptors_object); } } for (int i = 0; i < files.size(); ++i){ cout << files[i] << endl; } Mat keypoints_scene_gpu; Mat descriptors_scene_gpu; int count = 0; clock_t last_time = clock(); printf("Gran = %f\n", 0.05 * 1000000); string previous_guidance = ""; vector<Point2f> previous_fingertip_location(1); previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; int object_not_found = 1; int fingertip_not_found = 1; int fingertip_found = 1; int provide_guidance = 1; int no_button = 1; int db_object_found = -1; int db_finger_found = -1; int fingerx = -1; int fingery = -1; /******************** Read Scenes ********************/ // CPU ONLY // VideoCapture capture("/Users/judy/Desktop/VizLens/VizLens Test/samples/iPhone_Microwave_Motion_Bright.mov"); // VideoCapture capture("/Users/judy/Desktop/VizLens/VizLens Test/samples/Untitled.mov"); // VideoCapture capture("/Users/judy/Desktop/VizLens/VizLens Test/samples/kiosk.mov"); // VideoCapture capture("/Users/judy/Desktop/VizLens/VizLens Test/samples/kiosk_fast.mov"); // VideoCapture capture("/Users/judy/Desktop/VizLens/VizLens Test/samples/checkout.mov"); // VideoCapture capture("/Users/judy/Desktop/VizLens/VizLens Test/samples/other.mov"); VideoCapture capture("/Users/judy/Desktop/VizLens/samples/videos/DynamicTest_images_video.m4v"); // capture.open(0); // Capture from camera if (!capture.isOpened()) { throw "--(!) Error reading steam"; } int frame = 0; int first_skip_frames = 0; for (int i = 0; i < first_skip_frames; i++) { capture.grab(); } frame += first_skip_frames; int i; for ( ; ; ) { try { // ORIGINAL // while (idle == 1) { // if(clock() - last_time > (double)(0.05 * 1000000)) { // count++; // getImageToProcess(); // last_time = clock(); // } // } // // Mat img_scene = imread(imageDirBase+image); // // TODO: Add get image // Mat img_scene; // if(!capture.read(img_scene)) // imshow("",img_scene); // ++i; // CPU ONLY Mat img_scene; int frames_skipped = 5; for (int a = 0; a < frames_skipped - 1; a++) { capture.grab(); } capture >> img_scene; if (img_scene.empty()) break; // Output scenes for debugging double scene_ratio = img_scene.rows > (double)img_scene.cols / 3 * 2? 500 / (double)img_scene.rows : 750 / (double)img_scene.cols; // img_scene.rows > img_scene.cols? 600.0 / (double)img_scene.rows : 600.0 / (double) img_scene.cols; Size img_scene_size(img_scene.cols * scene_ratio, img_scene.rows * scene_ratio); //(150, 445) resize(img_scene, img_scene, img_scene_size); // imshow("", img_scene); frame += frames_skipped; // Size img_scene_size(360, 640); if (img_scene.empty()) break; cout << "--Size of frame is: "<< img_scene.cols << " " << img_scene.rows << endl; lightingDetection(img_scene); /****** START CLOCK *******/ clock_t tic = clock(); // Computer SURF keypoints and descriptors for scene (video) image Mat img_scene_gpu; Mat img_scene_gray; cvtColor(img_scene, img_scene_gray, CV_RGB2GRAY); // NEEDED // img_scene_gpu.upload(img_scene_gray); // surf(img_scene_gpu, Mat(), keypoints_scene_gpu, descriptors_scene_gpu); img_scene_gpu = img_scene; // CPU ONLY vector<KeyPoint> keypoints_scene; Mat descriptors_scene; // SHOULD BE vector<float> detector.detect(img_scene_gpu, keypoints_scene); printf("-- Keypoints Vector Size : %lu \n", keypoints_scene.size() ); //-- Step 2: Calculate reference descriptors (feature vectors) SurfDescriptorExtractor extractor; extractor.compute(img_scene_gpu, keypoints_scene, descriptors_scene); // cout << "FOUND " << keypoints_scene_gpu.cols << " keypoints on second image" << endl; // // if (keypoints_scene_gpu.cols == 0) { // idle = 1; // skipImage(); // continue; // } // // downloading scene results // vector<KeyPoint> keypoints_scene; // vector<float> descriptors_scene; // // NEEDED // surf.downloadKeypoints(keypoints_scene_gpu, keypoints_scene); // surf.downloadDescriptors(descriptors_scene_gpu, descriptors_scene); /******************** Start Matching ********************/ vector< DMatch > good_matches; int state_index = -1; Mat H; int inlier_max = -1; // THE ORIGINAL MATCHING PROCESS // for (int i = 0;i < files.size();i++) { //.... // } // NEW MATCHING WITH THE "STEP" FILTER vector<Mat> reachable_descriptors_object_gpu_vector; if (prev_state_id >= 0) { reachable_descriptors_object_gpu_vector = vector<Mat>(); filterObjects(prev_state_id, reachable_states, reachable_descriptors_object_gpu_vector, descriptors_object_gpu_vector); } else { reachable_descriptors_object_gpu_vector = descriptors_object_gpu_vector; } vector<Mat> reachable_img_object_vector; if (prev_state_id >= 0) { reachable_img_object_vector = vector<Mat>(); filterOriginalImgs(prev_state_id, reachable_states, reachable_img_object_vector, img_object_vector); } else { reachable_img_object_vector = img_object_vector; } vector<int> reachable_ids = all_ids; if (prev_state_id >= 0) { reachable_ids.resize(reachable_states[prev_state_id].size()); copy(reachable_states[prev_state_id].begin(), reachable_states[prev_state_id].end(), reachable_ids.begin()); } for (int i = 0;i < reachable_descriptors_object_gpu_vector.size();i++) { // matching descriptors BFMatcher matcher(NORM_L2); Mat trainIdx, distance; // CPU ONLY vector<DMatch> matches; matcher.match(reachable_descriptors_object_gpu_vector[i], descriptors_scene, matches); vector< DMatch > tmp_good_matches; gpuFindGoodMatches(matches, tmp_good_matches); // DEBUG if (tmp_good_matches.size() < 5) { continue; } // Find H Mat tempH; vector<uchar> inliers; findH(keypoints_object_vector[i], keypoints_scene, tmp_good_matches, tempH, inliers); // Only count non '\0' inliers int inliersCount = 0; for (int i = 0; i < inliers.size(); i++) { if (inliers[i]!= '\0') { inliersCount++; } } cout << "Inlier count: " << i << " " << inliersCount << endl; if (i == 0 || inliersCount > inlier_max) { inlier_max = inliersCount; state_index = i; H = tempH; } } // Use the history of detected screens to determine the current screen and get rid of noises. // By JUDY if (states.size() == 6) { states.erase(states.begin()); } states.push_back(state_index); // states.push_back(matched_state); prev_state_id = curr_state_id; curr_state_id = findCurrentState(states); string matched_state = files[state_index].substr(0, files[state_index].size() - 9); string current_state = files[curr_state_id].substr(0, files[curr_state_id].size() - 9); cout << "CURRENT STATE: " << current_state << endl; /******************** Send Feedback ********************/ // NEED TO FIX state_index Mat img_object = img_object_vector[state_index]; vector<vector<int> > button_map = button_map_vector[state_index]; vector<string> true_labels = true_labels_vector[state_index]; vector<vector<double> > button_center = button_center_vector[state_index]; double avg_button_size = avg_button_size_vector[state_index]; // double object_ratio = img_scene.rows > img_object.cols? 200.0 / (double)img_object.rows : 200.0 / (double) img_object.cols; // Size img_object_size(img_object.cols * object_ratio, img_object.rows * object_ratio); //(150, 445) // resize(img_object, img_object, img_object_size); // DRAW MAT Mat img_results = Mat::zeros( 750, 1200, CV_8UC3 ); drawScreenMap(img_results, img_scene, reachable_img_object_vector, curr_state_id, reachable_ids); drawStateGraph(img_results, transition_graph, curr_state_id); displayLogOnScreen(img_results, interface_name, files, states, matched_state, current_state); // img_object.copyTo(img_results(Rect(0,0,img_object.cols, img_object.rows))); // img_scene.copyTo(img_results(Rect(img_object.cols,0,img_scene.cols, img_scene.rows))); // drawMatches( img_object, keypoints_object_vector[state_index], img_scene, keypoints_scene_gpu, // good_matches, img_results, Scalar::all(-1), Scalar::all(-1), // vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS ); // Mat img_results; // imshow("",img_scene); // imshow("", img_object); // Get the corners from the object (reference) image vector<Point2f> object_corners(5); getImageCorners(img_object, object_corners); // Transform object corners to scene corners using H vector<Point2f> scene_corners(5); perspectiveTransform( object_corners, scene_corners, H); // cout << "Image corners: " << scene_corners[1] << scene_corners[2] << scene_corners[3] << scene_corners[4] << endl; /* Not Needed for Viz Dynamic int guidance_index = -2; if (stoi(mode) == 2) { guidance_index = getGuidanceIndex(true_labels, target); } if (guidance_index == -1) { if (no_button % 5 == 1) { feedback = "no button"; } else { feedback = ""; } no_button++; } else { no_button = 1; Rect rect; if (!findRect(scene_corners, rect)) { db_object_found = 0; db_finger_found = -1; fingerx = -1; fingery = -1; fingertip_not_found = 0; fingertip_found = 1; provide_guidance = 1; previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; if (object_not_found % 5 == 0) { // feedback = "no object"; object_not_found++; } else { feedback = ""; object_not_found++; } // cout << "No Object" << endl ; } else { db_object_found = 1; object_not_found = 1; // If found, draw rectangles around both images drawRects(img_results, object_corners, scene_corners, img_object); // Warp scene image with finger to reference image size Mat img_skin; warpPerspective(img_scene, img_skin, H.inv(), img_object.size(), INTER_LINEAR, BORDER_CONSTANT); // Filter skin color to get binary image Mat img_skin_binary; skinColorAdjustment(img_object, img_skin); skinColorFilter(img_skin, img_skin_binary); // skinColorSubtractor(img_skin, img_object, img_skin_binary); // Find fingertip location in reference image vector<Point2f> fingertip_location(1); fingertip_location[0].x = -1; fingertip_location[0].y = -1; findFingertipLocation(img_skin_binary, img_object.rows * img_object.cols, H, avg_button_size, fingertip_location); if (fingertip_location[0].x == -1 && fingertip_location[0].y == -1) { db_finger_found = 0; fingerx = -1; fingery = -1; previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; fingertip_found = 1; provide_guidance = 1; if (fingertip_not_found % 5 == 0) { feedback = "no finger"; fingertip_not_found++; } else { feedback = ""; fingertip_not_found++; } } else { db_finger_found = 1; fingerx = (int) fingertip_location[0].x; fingery = (int) fingertip_location[0].y; switch (stoi(mode)) { case 1: // Provide feedback if (fingertip_found % 5 == 0) { previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; fingertip_found++; } else { fingertip_found++; } fingertip_not_found = 1; feedback = getFeedback(button_map, true_labels, fingertip_location, previous_fingertip_location, avg_button_size); break; case 2: { // Provide guidance if (guidance_index!= -1) { previous_guidance = guidance; guidance = getGuidance(button_map, true_labels, button_center[guidance_index], fingertip_location, previous_fingertip_location, avg_button_size); } if (guidance.compare(previous_guidance)) { provide_guidance = 1; feedback = guidance; // feedback = feedback + getFeedback(button_map, true_labels, fingertip_location, previous_fingertip_location); } else { if (provide_guidance % 5 == 1) { feedback = guidance; provide_guidance++; } else { feedback = ""; provide_guidance++; } } break; } } previous_fingertip_location = fingertip_location; } // Find relative fingertip location in scene image vector<Point2f> scene_fingertip_location(1); perspectiveTransform( fingertip_location, scene_fingertip_location, H); printf("-- Object Test Point : %f %f \n", fingertip_location[0].x, fingertip_location[0].y); printf("-- Scene Test Point : %f %f \n", scene_fingertip_location[0].x, scene_fingertip_location[0].y); //smooth fingertip location - no need, just filter out unreasonable points //remove rightmost fingertip location - cut side part of reference image solves this problem drawFingertips(img_results, img_object, fingertip_location, scene_fingertip_location); cout << "-- Fingertip Location:" << fingertip_location << scene_fingertip_location << endl; if (state.compare(current_state)) { feedback = "State: " + current_state + " " + feedback; state = current_state; } } } */ imshow( "Overall Results", img_results ); anounceFeedback(feedback); cout << "Feedback: " << feedback << endl; clock_t toc = clock(); printf("Elapsed: %f seconds\n", (double)(toc - tic) / CLOCKS_PER_SEC); /****** END CLOCK *******/ // updateImage(db_object_found, db_finger_found, fingerx, fingery); // To be added when sqlite is back idle = 1; waitKey(1); // waits to display frame } catch (Exception &e) { idle = 1; // skipImage(); // To be added when sqlite is back continue; } } waitKey(0); return 0; } ======================= File: CVServer/lib/db_utils.cpp ======================= /* Database Utils Implementation */ #include "db_utils.hpp" #include <fstream> #include <unistd.h> extern bool isOpenDB; extern sqlite3 *dbfile; extern string id; extern string image; extern string mode; extern string target; extern string state; extern string feedback; extern string guidance; extern int idle; extern int curr_state_id; using namespace std; bool ConnectDB(const char* DB) { if ( sqlite3_open(DB, &dbfile) == SQLITE_OK ) { isOpenDB = true; // sqlite3_busy_timeout(dbfile, 1000); // Wait 1000mS if busy return true; } return false; } void DisonnectDB(const char* DB) { if ( isOpenDB == true ) { sqlite3_close(dbfile); } } int getdir (string dir, vector<string> &files) { DIR *dp; struct dirent *dirp; if((dp = opendir(dir.c_str())) == NULL) { cout << "Error(" << errno << ") opening " << dir << endl; return errno; } while ((dirp = readdir(dp))!= NULL) { files.push_back(string(dirp->d_name)); } closedir(dp); return 0; } void getExpectedPath(vector<int> &state_path, vector<int> &button_path) { while (state_path.size() == 0) { ifstream inFilePath; inFilePath.open("../AgentWebhook/instructions.txt"); string line; // Read state path getline(inFilePath, line); stringstream states(line); cout << line << endl; while(states.good()) { string substr; getline(states, substr, ','); state_path.push_back(stoi(substr)); } // Read button path getline(inFilePath, line); stringstream buttons(line); while(buttons.good()) { string substr; getline(buttons, substr, ','); button_path.push_back(stoi(substr)); } inFilePath.close(); // state_path = {0, 1, 2, 3, 4, 13}; // button_path = {1, 6, 10, 17, 20}; } cout << "State path: "; for (int i = 0; i < state_path.size(); i++) { cout << state_path[i] << ", "; } cout << endl << "Button path: "; for (int i = 0; i < button_path.size(); i++) { cout << button_path[i] << ", "; } cout << endl; } void getRefImageFilenames(string session_name, string dir, vector<string> &filenames, string mode) { if (mode == "local") { /* Read reference images from given local directory in "local" mode */ getdir(dir, filenames); } else { /* Read from given session in database in "db" mode */ sqlite3_stmt *statement; char query[1000]; sprintf(query, "SELECT image FROM objects WHERE session=\'%s\' AND (status=\'ready\')", session_name.c_str()); cout << query << endl; if ( sqlite3_prepare(dbfile, query, -1, &statement, 0 ) == SQLITE_OK ) { while (true) { int nextResult = sqlite3_step(statement); if (nextResult == SQLITE_DONE) break; if (nextResult!= SQLITE_ROW) { printf("error: %s!\n", sqlite3_errmsg(dbfile)); break; } string curr_image; cout << "Got it." << endl; curr_image = (char*)sqlite3_column_text(statement, 0); filenames.push_back(curr_image); cout << curr_image << endl; // idle = 0; } sqlite3_finalize(statement); } } /* Make sure filenames are sorted */ sort(filenames.begin(), filenames.end()); cout << "Read Filenames From Database: " << filenames.size() << endl; for (int i = 0; i < filenames.size(); i++) { cout << filenames[i] << endl; } } void getTransitionGraph(string session_name, string read_mode, vector<string> filenames, vector<map<int, int>> &transition_graph) { /* Initialize empty transition graph for given number of states */ for (int i = 0; i < filenames.size(); i++) { map<int, int> nbrs; transition_graph.push_back(nbrs); } if (mode == "local") { // TODO: read local transition graph // (Right now start from empty) } else { /* Read from object_transitions table from db in "db" mode */ sqlite3_stmt *statement; char query[1000]; sprintf(query, "SELECT stateid, buttonid, targetstateid FROM object_transitions WHERE session=\'%s\'", session_name.c_str()); cout << query << endl; if ( sqlite3_prepare(dbfile, query, -1, &statement, 0 ) == SQLITE_OK ) { while (true) { int nextResult = sqlite3_step(statement); if (nextResult == SQLITE_DONE) break; if (nextResult!= SQLITE_ROW) { printf("error: %s!\n", sqlite3_errmsg(dbfile)); break; } int state_id = atoi((char*)sqlite3_column_text(statement, 0)); int button_id = atoi((char*)sqlite3_column_text(statement, 1)); int target_state_id = atoi((char*)sqlite3_column_text(statement, 2)); transition_graph[state_id][button_id] = target_state_id; cout << "state_id=" << state_id << "; button_id=" << button_id << "; target_state_id=" << target_state_id << endl; idle = 0; } sqlite3_finalize(statement); } } // DEBUG: print all states in the state diagram /* for (int i = 0; i < transition_graph.size(); i++) { cout << "Neighbors of state " << i << ": "; map<int, int>::iterator it; for (it = transition_graph[i].begin(); it!= transition_graph[i].end(); it++) { int state = it->second; // Access value (target state id) cout << state << " "; } cout << endl; } */ /* Manually constructed example statemap */ /* if (transition_graph.size() == 0) { int init0[] = {0}; set<int> nbrs0(init0, init0 + 1); transition_graph.push_back(nbrs0); } for (int i = 0; i < 11; i++) { int init[] = {i, i + 1}; set<int> nbrs(init, init + 2); transition_graph.push_back(nbrs); } int init[] = {11}; set<int> nbrs(init, init + 1); transition_graph.push_back(nbrs); int init0[] = {0, 1, 4}; set<int> nbrs0(init0, init0 + 3); transition_graph.push_back(nbrs0); int init1[] = {0, 1, 2, 3}; set<int> nbrs1(init1, init1 + 4); transition_graph.push_back(nbrs1); int init2[] = {1, 2}; set<int> nbrs2(init2, init2 + 2); transition_graph.push_back(nbrs2); int init3[] = {1, 3}; set<int> nbrs3(init3, init3 + 2); transition_graph.push_back(nbrs3); int init4[] = {0, 4}; set<int> nbrs4(init4, init4 + 2); transition_graph.push_back(nbrs4); */ } void getImageToProcess(string &image_to_process) { sqlite3_stmt *statement; char query[1000]; sprintf(query, "SELECT image, id, imageactive, target FROM images_video WHERE imageactive>0 AND id>%s ORDER BY id DESC", id.c_str()); // cout << query << endl; if ( sqlite3_prepare(dbfile, query, -1, &statement, 0 ) == SQLITE_OK ) { int firstResult = sqlite3_step(statement); if (firstResult == 100) { cout << "Got it." << endl; image_to_process = (char*)sqlite3_column_text(statement, 0); cout << "image to process: " << image_to_process << endl; id = (char*)sqlite3_column_text(statement, 1); cout << "id: " << id << endl; mode = (char*)sqlite3_column_text(statement, 2); cout << "mode: " << mode << endl; target = (char*)sqlite3_column_text(statement, 3); cout << "target: " << target << endl; idle = 0; } else if (firstResult == 101) { // cout << "Nothing." << endl; } sqlite3_finalize(statement); } } int updateImage(int objectfound, int fingerfound, int fingerx, int fingery) { sqlite3_stmt *statement; int result; char query[1000]; sprintf(query, "UPDATE images_video SET stateid=%d, imageactive=0," "feedback=\"%s\",feedbackactive=1,resulttime=current_timestamp, objectfound=%s, fingerfound=%s, fingertipx=%s, fingertipy=%s WHERE id=%s", curr_state_id, feedback.c_str(), to_string(objectfound).c_str(), to_string(fingerfound).c_str(), to_string(fingerx).c_str(), to_string(fingery).c_str(), id.c_str()); cout << query << endl; { if(sqlite3_prepare(dbfile,query,-1,&statement,0)==SQLITE_OK) { int res = sqlite3_step(statement); result = res; sqlite3_finalize(statement); cout << "Update Image!" << endl; } return result; } cout << "Update Image!" << endl; return 0; } int skipImage() { sqlite3_stmt *statement; int result; char query[1000]; sprintf(query, "UPDATE images_video SET imageactive=0 WHERE id=%s", id.c_str()); cout << query << endl; { if(sqlite3_prepare(dbfile,query,-1,&statement,0)==SQLITE_OK) { int res = sqlite3_step(statement); result = res; sqlite3_finalize(statement); cout << "Skip Image!" << endl; } return result; } cout << "Skip Image!" << endl; return 0; } void sendTransitionInstructions(string session, string instruction) { sqlite3_stmt *statement; int result; char query[1000]; sprintf(query, "UPDATE images_video SET feedback=\'%s\', feedbackactive=1, imageactive=0 WHERE session=\'%s\' AND id=%s", instruction.c_str(), session.c_str(), id.c_str()); cout << query << endl; { if(sqlite3_prepare(dbfile,query,-1,&statement,0)==SQLITE_OK) { int res = sqlite3_step(statement); result = res; sqlite3_finalize(statement); cout << "Sent waiting/resuming instructions!" << endl; } } } string getStateDescription(string session, int state_id) { // TODO: PULL STATE DESCRIPTION FROM DB ACCORDING TO STATE ID & ADD TO IMAGES_VIDEO DATABASE sqlite3_stmt *statement; char query1[1000]; sprintf(query1, "SELECT description FROM objects WHERE session=\'%s\' AND stateid=%d AND (status=\'ready\' OR status=\'readytoread\')", session.c_str(), state_id); cout << query1 << endl; string description_text; if ( sqlite3_prepare(dbfile, query1, -1, &statement, 0 ) == SQLITE_OK ) { int firstResult = sqlite3_step(statement); if (firstResult == 100) { cout << "Got it." << endl; description_text = (char*)sqlite3_column_text(statement, 0); cout << description_text << endl; sqlite3_finalize(statement); return description_text; } else if (firstResult == 101) { cout << "Nothing." << endl; } sqlite3_finalize(statement); } return "no description"; // int result; // char query2[1000]; // sprintf(query2, "UPDATE images_video SET stateid=%d, feedback=\'%s\', feedbackactive=1, imageactive=0 WHERE session=\'%s\' AND id=%s", state_id, description_text.c_str(), session.c_str(), id.c_str()); // cout << query2 << endl; // { // if(sqlite3_prepare(dbfile,query2,-1,&statement,0)==SQLITE_OK) { // int res = sqlite3_step(statement); // result = res; // sqlite3_finalize(statement); // cout << "Updated description!" << endl; // } // // return result; // } } bool hasReadyToReadObjects() { sqlite3_stmt *statement; char query[1000]; sprintf(query, "SELECT image FROM objects WHERE status=\'readytoread\'"); cout << query << endl; if ( sqlite3_prepare(dbfile, query, -1, &statement, 0 ) == SQLITE_OK ) { int firstResult = sqlite3_step(statement); if (firstResult == 100) { cout << "Got it." << endl; return true; // idle = 0; } else if (firstResult == 101) { } sqlite3_finalize(statement); } cout << "No new image to read!" << endl; return false; } void updateCroppedImage(string session, string dir_server, string &new_name, int &state_id, Mat &img_object) { sqlite3_stmt *statement; char query1[1000]; sprintf(query1, "SELECT image, stateid FROM objects WHERE session=\'%s\' AND status=\'readytoread\'", session.c_str()); cout << query1 << endl; while (true) { if ( sqlite3_prepare(dbfile, query1, -1, &statement, 0 ) == SQLITE_OK ) { int firstResult = sqlite3_step(statement); if (firstResult == 100) { cout << "Got it." << endl; new_name = (char*)sqlite3_column_text(statement, 0); cout << new_name << endl; state_id = atoi((char*)sqlite3_column_text(statement, 0)); img_object = imread(dir_server + new_name); // idle = 0; break; } else if (firstResult == 101) { // cout << "Nothing." << endl; } } sleep(1); } sqlite3_finalize(statement); int result; char query2[1000]; sprintf(query2, "UPDATE objects SET status=\'ready\' WHERE session=\'%s\' AND status=\'readytoread\'", session.c_str()); cout << query2 << endl; { if(sqlite3_prepare(dbfile,query2,-1,&statement,0)==SQLITE_OK) { int res = sqlite3_step(statement); result = res; sqlite3_finalize(statement); cout << "Updated to ready!" << endl; } } } void labels_hash(string session_name, int state_index, Mat img_object, double ratio, vector<int> &button_id, vector<vector<int> > &button_map, vector<string> &true_labels, vector<vector<double> > &button_center, double &avg_button_size) { string id, x1, y1, x2, y2, label; vector<vector<string> > labels; sqlite3_stmt *statement; // state_index = 0; char query[1000]; sprintf(query, "SELECT id, x1, y1, x2, y2, label FROM object_buttons WHERE session=\"%s\" AND stateid=%d", session_name.c_str(), state_index); cout << query << endl; if ( sqlite3_prepare(dbfile, query, -1, &statement, 0 ) == SQLITE_OK ) { // string x1s[] = {"12","449","886","13","454","889","3","440","870","167","705","84","507","927","86","505","928","82","507","922","83","502","917","79","724"}; // string y1s[] = {"378","384","387","794","800","803","1195","1200","1204","1551","1552","1968","1974","1978","2314","2317","2320","2659","2653","2658","2993","2990","2991","3389","3384"}; // string x2s[] = {"411","844","1280","415","844","1280","425","858","1282","582","1124","363","781","1202","356","791","1203","373","777","1208","368","785","1194","565","1196"}; // string y2s[] = {"614","614","624","1028","1033","1030","1430","1434","1436","1779","1780","2221","2225","2227","2565","2566","2567","2902","2902","2904","3250","3243","3234","3639","3638"}; // string label_input[] = {"baked potato","popcorn","pizza","beverage","frozen dinner","reheat","power level","time cook","time defrost","kitchen timer","weight defrost","1","2","3","4","5","6","7","8","9","clock","0","add 30 sec","stop clear","start pause"}; while (true) { int nextResult = sqlite3_step(statement); if (nextResult == SQLITE_DONE) break; if (nextResult!= SQLITE_ROW) { // printf("error: %s!\n", sqlite3_errmsg(dbfile)); break; } cout << "Got it." << endl; id = (char*)sqlite3_column_text(statement, 0); cout << id << endl; // x1 = x1s[i]; x1 = (char*)sqlite3_column_text(statement, 1); cout << x1 << endl; // y1 = y1s[i]; y1 = (char*)sqlite3_column_text(statement, 2); cout << y1 << endl; // x2 = x2s[i]; x2 = (char*)sqlite3_column_text(statement, 3); cout << x2 << endl; // y2 = y2s[i]; y2 = (char*)sqlite3_column_text(statement, 4); cout << y2 << endl; // label = label_input[i]; label = (char*)sqlite3_column_text(statement, 5); cout << label << endl; // push x1, y1, x2, y2, label into x and push to labels vector<string> x; x.push_back(x1); x.push_back(y1); x.push_back(x2); x.push_back(y2); x.push_back(label); labels.push_back(x); // Add button id to button ids button_id.push_back(stoi(id)); cout << "Got it." << endl; } sqlite3_finalize(statement); } else { cout << "Failed" << endl; } if (labels.size() == 0) return; double sum_button_width = 0; // compute the centers of each button for (int i = 0; i < labels.size(); i++) { vector<string> tmp = labels[i]; double x1 = stod(tmp[0]) * ratio; double y1 = stod(tmp[1]) * ratio; double x2 = stod(tmp[2]) * ratio; double y2 = stod(tmp[3]) * ratio; double centerX = (x1 + x2) / 2; double centerY = (y1 + y2) / 2; vector<double> append = {centerX, centerY}; button_center.push_back(append); true_labels.push_back(tmp[4]); // push button labels sum_button_width += x2 - x1; } avg_button_size = sum_button_width / labels.size(); double threshold = avg_button_size; //55 cout << avg_button_size << endl; // Generate two dimensional array, assign class label cout << img_object.rows << " " << img_object.cols << endl; for (int i = 0; i < img_object.rows; i++) { vector<int> row; for (int j = 0; j < img_object.cols; j++) { int distance[labels.size()]; int idx_min1 = -1; double min_d1 = 100000; int idx_min2 = -1; double min_d2 = 100000; for (int k = 0; k < labels.size(); k++) { double centerX = button_center[k][0]; double centerY = button_center[k][1]; distance[k] = sqrt((centerX - j) * (centerX - j) + (centerY - i) * (centerY - i)); if (distance[k] < min_d2) { if (distance[k] < min_d1) { min_d2 = min_d1; min_d1 = distance[k]; idx_min2 = idx_min1; idx_min1 = k; } else { min_d2 = distance[k]; idx_min2 = k; } } } // check whether in the smallest distance vector<string> tmp = labels[idx_min1]; double x1 = stod(tmp[0]) * ratio; double y1 = stod(tmp[1]) * ratio; double x2 = stod(tmp[2]) * ratio; double y2 = stod(tmp[3]) * ratio; if (x1 <= j && j <= x2 && i >= y1 && i <= y2) { row.push_back(idx_min1); } else if (min_d1 > threshold) { row.push_back(-1); } else if (min_d2 > threshold) { row.push_back(idx_min1 + 10000); } else { row.push_back(idx_min1 * 100 + idx_min2); } } button_map.push_back(row); } } void addTransitionToDB(string session_name, int curr_state_id, int new_state_id, int button_id) { sqlite3_stmt *statement; int result; char query[1000]; sprintf(query, "INSERT INTO object_transitions (session, stateid, buttonid, targetstateid, seqinfo) VALUES (\'%s\', %d, %d, %d, \'\')", session_name.c_str(), curr_state_id, button_id, new_state_id); cout << query << endl; { if (sqlite3_prepare(dbfile,query,-1,&statement,0)==SQLITE_OK) { int res = sqlite3_step(statement); result = res; sqlite3_finalize(statement); cout << "Inserted transition to table!" << endl; } } } ======================= File: CVServer/lib/access/img_utils.hpp ======================= <filename>CVServer/lib/access/img_utils.hpp<gh_stars>0 /* Image Utils Header */ #include <iostream> #include "opencv2/highgui/highgui.hpp" #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/imgproc/imgproc.hpp" #include <opencv2/gpu/gpu.hpp> #include "opencv2/nonfree/gpu.hpp" using namespace cv; using namespace std; using namespace cv::gpu; double calculateLighting(Mat img); void lightingDetection(Mat img); void gpuFindGoodMatches(vector< DMatch > matches, vector< DMatch > &good_matches); void findH(vector<KeyPoint> keypoints_object, vector<KeyPoint> keypoints_scene, vector<DMatch> good_matches, Mat &H, vector<uchar> &inliers); void getImageCorners(Mat img_object, vector<Point2f> &object_corners); bool findRect(vector<Point2f> scene_corners, Rect &rect); void drawRects(Mat img_results, vector<Point2f> object_corners, vector<Point2f> scene_corners, Mat img_object); void skinColorAdjustment(Mat img_object, Mat &img_skin); void skinColorFilter(Mat img_skin, Mat &img_skin_binary); void skinColorSubtractor(Mat img_skin, Mat img_object, Mat &img_skin_binary); int angleBetween(Point tip, Point next, Point prev); void findConvexHullBasedFingertipLocation(vector<vector<Point> > contours, vector<vector<Point> > hull, int index_of_biggest_contour, double avg_button_size, vector<Point2f> &fingertip_location, Mat &draw_contours); void findConvexHullDefectBasedFingertipLocation(vector<vector<Point> > contours, vector<vector<Point> > hull, int index_of_biggest_contour, double avg_button_size, vector<Point2f> &fingertip_location, Mat &draw_contours); void findFingertipLocation (Mat img_skin_binary, int area, Mat H, double avg_button_size, vector<Point2f> &fingertip_location); bool checkNewImgFromPool(vector<Mat> &new_img_pool, vector<vector<KeyPoint>> &new_keypoints_pool, vector<Mat> &new_descriptors_pool, Mat &img_scene, vector<KeyPoint> &keypoints_scene, Mat &descriptors_scene); int getButtonIndex(Point2f fingertip_location, vector<vector<int> > button_map, vector<string> true_labels); bool matchesCurrentState(Mat descriptors_scene, vector<KeyPoint> keypoints_scene, Mat curr_state_img_scene, Mat descriptors_curr_state, vector<KeyPoint> keypoints_curr_state, float benchmark_ratio, float match_expectation_ratio); bool matchesExpectedState(Mat descriptors_scene, vector<KeyPoint> keypoints_scene, Mat descriptors_expected_state, vector<KeyPoint> keypoints_expected_state, float benchmark_ratio, float match_expectation_ratio); // GPU versions bool matchesCurrentStateGPU(GpuMat descriptors_scene_gpu, vector<KeyPoint> keypoints_scene, Mat curr_state_img_scene, GpuMat descriptors_curr_state_gpu, vector<KeyPoint> keypoints_curr_state, float benchmark_ratio, float match_expectation_ratio); bool matchesExpectedStateGPU(GpuMat descriptors_scene_gpu, vector<KeyPoint> keypoints_scene, GpuMat descriptors_expected_state_gpu, vector<KeyPoint> keypoints_expected_state, float benchmark_ratio, float match_expectation_ratio); ======================= File: CVServer/lib/visualization.cpp ======================= <reponame>guoanhong/VizLens-public /* Visualization Implementation */ #include "visualization.hpp" extern string id; extern string image; extern string mode; extern string target; extern string state; extern string feedback; extern string guidance; extern int idle; void drawScreenMap(Mat img_results, Mat img_scene, vector<Mat> reachable_img_object_vector, int curr_state_id, vector<int> reachable_ids) { img_scene.copyTo(img_results(Rect(450, 250,img_scene.cols, img_scene.rows))); line(img_results, cvPoint(450, 0), cvPoint(450, 750), Scalar(0, 255, 0), 2); line(img_results, cvPoint(450, 250), cvPoint(1200, 250), Scalar(0, 255, 0), 2); int num_ref_img = (int)reachable_img_object_vector.size() > 5? (int)reachable_img_object_vector.size() : 5; int ref_height = 750 / num_ref_img - 4; int ref_width = ref_height * 3 / 2; for (int i = 0; i < reachable_img_object_vector.size(); i++) { Mat curr_object = reachable_img_object_vector[i]; double ratio = curr_object.rows > curr_object.cols * 2.0 / 3.0? ref_height / (double)curr_object.rows : ref_width / (double) curr_object.cols; Size curr_object_size(curr_object.cols * ratio, curr_object.rows * ratio); //(150, 445) resize(curr_object, curr_object, curr_object_size); int x0 = 225 - ref_width / 2; int y0 = i * (ref_height + 4) + 2; curr_object.copyTo(img_results(Rect(x0, y0, curr_object.cols, curr_object.rows))); if (i == curr_state_id) { // (i < reachable_ids.size() && reachable_ids[i] == curr_state_id) { line(img_results, cvPoint(x0, y0), cvPoint(x0 + curr_object.cols, y0), Scalar(0, 255, 0), 2); line(img_results, cvPoint(x0 + curr_object.cols, y0), cvPoint(x0 + curr_object.cols, y0 + curr_object.rows), Scalar(0, 255, 0), 2); line(img_results, cvPoint(x0 + curr_object.cols, y0 + curr_object.rows), cvPoint(x0, y0 + curr_object.rows), Scalar(0, 255, 0), 2); line(img_results, cvPoint(x0, y0 + curr_object.rows), cvPoint(x0, y0), Scalar(0, 255, 0), 2); } } } void drawStateGraph(Mat img_results, vector<map<int, int>> transition_graph, int curr_state_id) { int xOffset = 450; int yOffset = 0; // DEBUG: print all states in the state diagram /* for (int i = 0; i < transition_graph.size(); i++) { cout << "Neighbors of state " << i << ": "; map<int, int>::iterator it; for (it = transition_graph[i].begin(); it!= transition_graph[i].end(); it++) { int state = it->second; // Access value (target state id) cout << state << " "; } cout << endl; } */ vector<vector<int>> levels; set<int> visited; vector<int> currLevel; vector<int> prevLevel; visited.insert(0); currLevel.push_back(0); levels.push_back(currLevel); while (visited.size() < transition_graph.size() && currLevel.size() > 0) { vector<int> tmp; prevLevel = currLevel; currLevel = tmp; for (int i = 0; i < prevLevel.size(); i++) { map<int, int> neighbors = transition_graph[prevLevel[i]]; map<int, int>::iterator it; for (it = neighbors.begin(); it!= neighbors.end(); it++) { int state = it->second; // Access value (target state id) if (prevLevel[i] == state) continue; if (visited.find(state) == visited.end()) { visited.insert(state); currLevel.push_back(state); } } } sort(currLevel.begin(), currLevel.end()); levels.push_back(currLevel); } int radius = 20; int margin = 10; int gap = 5; int colWidth = 75; for (int previ = 0; previ < levels.size(); previ++) { for (int curri = levels.size() - 1; curri >= previ; curri--) { vector<int> prevLevel = levels[previ]; vector<int> currLevel = levels[curri]; for (int prevj = 0; prevj < prevLevel.size(); prevj++) { for (int currj = 0; currj < currLevel.size(); currj++) { if (previ == curri && prevj == currj) continue; bool found = false; map<int,int>::iterator it; for (it = transition_graph[prevLevel[prevj]].begin(); it!= transition_graph[prevLevel[prevj]].end(); ++it) { if (it->second == currLevel[currj]) { found = true; } } if (!found) continue; int x = margin + colWidth * curri + colWidth / 2; int y = margin + (currj * 2 + 1) * radius + (currj + 1) * gap;; int prevx = margin + colWidth * previ + colWidth / 2; int prevy = margin + (prevj * 2 + 1) * radius + (prevj + 1) * gap; if (curri - previ == 1) { line(img_results, cvPoint(xOffset + prevx, yOffset + prevy), cvPoint(xOffset + x, yOffset + y), Scalar(200, 200, 200), 2); } else { line(img_results, cvPoint(xOffset + prevx, yOffset + prevy), cvPoint(xOffset + x, yOffset + y), Scalar(180, 180, 180), 2); } } } } } for (int i = 0; i < levels.size(); i++) { vector<int> currLevel = levels[i]; for (int j = 0; j < currLevel.size(); j++) { int x = margin + colWidth * i + colWidth / 2; int y = margin + (j * 2 + 1) * radius + (j + 1) * gap; if (currLevel[j] == curr_state_id) { circle(img_results, cvPoint(xOffset + x, yOffset + y), radius, Scalar(0, 255, 0), CV_FILLED, 2); } else { circle(img_results, cvPoint(xOffset + x, yOffset + y), radius, Scalar(255, 255, 255), CV_FILLED, 2); } if (currLevel[j] <= 9) { putText(img_results, to_string(currLevel[j]), cvPoint(xOffset + x - radius / 2 + 3, yOffset + y + radius / 2 - 1), FONT_HERSHEY_PLAIN, 1.5, Scalar(0, 0, 0), 2); } else { putText(img_results, to_string(currLevel[j]), cvPoint(xOffset + x - radius / 2 - 5, yOffset + y + radius / 2 - 1), FONT_HERSHEY_PLAIN, 1.5, Scalar(0, 0, 0), 2); } } } } void displayLogOnScreen(Mat img_results, vector<string> objectnames, vector<int> states, string matched_state, string current_state, string ocr_text) { int xOffset = 450 + 20; int yOffset = 0 + 130; int margin = 10; int row = 20; putText(img_results, "Text: " + ocr_text, cvPoint(xOffset + margin, yOffset + margin + row * 1 + row / 2), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255, 255, 255), 1); string state_smoother; bool flag = false; for (int i = 0; i < states.size() - 1; i++) { state_smoother += objectnames[states[i]] + ", "; if (state_smoother.length() > 50) { putText(img_results, "State Smoother: " + state_smoother, cvPoint(xOffset + margin, yOffset + margin + row * 2 + row / 2), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255, 255, 255), 1); state_smoother = ""; flag = true; } } if (states.size() > 0) state_smoother += objectnames[states[states.size() - 1]]; // files[states[states.size() - 1]].substr(0, files[states[states.size() - 1]].size() - 9); if (flag) { putText(img_results, " " + state_smoother, cvPoint(xOffset + margin, yOffset + margin + row * 3 + row / 2), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255, 255, 255), 1); } else { putText(img_results, "State Smoother: " + state_smoother, cvPoint(xOffset + margin, yOffset + margin + row * 2 + row / 2), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255, 255, 255), 1); } putText(img_results, "Matched State: " + matched_state, cvPoint(xOffset + margin, yOffset + margin + row * 3 + row / 2), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255, 255, 255), 1); putText(img_results, "Current State: " + current_state, cvPoint(xOffset + margin, yOffset + margin + row * 4 + row / 2), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255, 255, 255), 1); // putText(img_results, "OCR: " + ocr_text, cvPoint(xOffset + margin, yOffset + margin + row * 3 + row / 2), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255, 255, 255), 1); } void drawFingertips(Mat img_results, vector<Mat> img_object_vector, int curr_state_id, vector<Point2f> fingertip_location, vector<Point2f> scene_fingertip_location) { Mat img_object = img_object_vector[curr_state_id]; if (fingertip_location[0].x > 0 && fingertip_location[0].x < img_object.cols && fingertip_location[0].y > 0 && fingertip_location[0].y < img_object.rows) { int num_ref_img = (int)img_object_vector.size() > 5? (int)img_object_vector.size() : 5; int ref_height = 750 / num_ref_img - 4; int ref_width = ref_height * 3 / 2; double ratio = img_object.rows > img_object.cols * 2.0 / 3.0? ref_height / (double)img_object.rows : ref_width / (double) img_object.cols; int xOffset = 225 - ref_width / 2; int yOffset = curr_state_id * (ref_height + 4) + 2; Point2f object_fingertip = fingertip_location[0] * ratio + Point2f(xOffset, yOffset); Point2f scene_fingertip = scene_fingertip_location[0] + Point2f( 450, 250); line( img_results, object_fingertip, scene_fingertip, Scalar(0, 255, 0), 4 ); circle(img_results, object_fingertip, 5, Scalar(0,0,255), 4, 8, 0); circle(img_results, scene_fingertip, 5, Scalar(0,0,255), 4, 8, 0); } } ======================= File: CVServer/lib/access/feedback_utils.hpp ======================= <filename>CVServer/lib/access/feedback_utils.hpp<gh_stars>0 /* Feedback Utils Headers */ #include <iostream> #include "opencv2/highgui/highgui.hpp" using namespace cv; using namespace std; string getFeedback(vector<vector<int> > button_map, vector<string> true_labels, vector<Point2f> fingertip_location, vector<Point2f> previous_fingertip_location, double avg_button_size); int getGuidanceIndex(vector<string> true_labels, string targets); int getGuidanceIndexBasedOnExpectedPath(vector<int> state_path, vector<int> button_path, vector<map<int, int>> transition_graph, vector<vector<int>> button_id_vector, int curr_state_id, int &next_idx_on_path); string getGuidance(vector<vector<int> > button_map, vector<string> true_labels, vector<double> guidance_button_center, vector<Point2f> fingertip_location, vector<Point2f> previous_fingertip_location, double avg_button_size); string getGuidanceForPathMode(vector<vector<int> > button_map, vector<string> true_labels, vector<double> guidance_button_center, vector<double> guidance_button_shape, vector<Point2f> fingertip_location, vector<Point2f> previous_fingertip_location, double avg_button_size, int guidance_index); string getDirection(vector<double> guidance_button_center, vector<Point2f> fingertip_location, double avg_button_size); string getDirectionForPathMode(vector<double> guidance_button_center, vector<double> guidance_button_shape, vector<Point2f> fingertip_location); void anounceFeedback(string feedback); ======================= File: CVServer/lib/statemap_utils.cpp ======================= /* State Map Implementation */ #include "statemap_utils.hpp" #include "db_utils.hpp" extern string id; extern string image; extern string mode; extern string target; extern string state; extern string feedback; extern string guidance; extern int idle; int findCurrentState(vector<int> states) { int majority; majority = states.back(); int count = 0; for (int i = 0; i < states.size(); ++i) { if (count == 0) { majority = states[i]; count = 1; } else if (states[i] == majority) { ++count; } else { --count; } } if (count == 0) { return states.back(); } return majority; } Point2f findTransitionFingertipLocation(int new_id, vector<int> states, vector<Point2f> fingertip_locations) { for (int i = 0; i < states.size(); i++) { if (states[i] == new_id) return fingertip_locations[i]; } return Point2f(0.f, 0.f); } void getCandidateObjectIds(int curr_state_id, vector<int> all_ids, vector<map<int, int>> transition_graph, vector<int> &candidate_ids_object_vector) { /* At the beginning, all reference images are candidates */ if (curr_state_id < 0) { candidate_ids_object_vector = all_ids; return; } /* Add all neighbors of the previous state to candidates */ map<int, int> neighbors = transition_graph[curr_state_id]; map<int, int>::iterator it; set<int> neighbor_ids; for (it = neighbors.begin(); it!= neighbors.end(); it++) { int target_state = it->second; // Access value (target state id) // This id is not added to candidates yet if (neighbor_ids.find(target_state) == neighbor_ids.end()) { neighbor_ids.insert(target_state); candidate_ids_object_vector.push_back(target_state); } } /* Add itself to candidates as well */ candidate_ids_object_vector.push_back(curr_state_id); } void getCandidateObjectDescriptors(vector<int> candidate_ids_object_vector, vector<Mat> descriptors_object_gpu_vector, vector<Mat> &candidate_descriptors_object_vector) { /* At the beginning, all reference images are candidates */ /* Might not work if (candidate_ids_object_vector.size() == descriptors_object_gpu_vector.size()) { candidate_descriptors_object_vector = descriptors_object_gpu_vector; return; } */ /* Add candidate descriptors according to ids */ for (int i = 0; i < candidate_ids_object_vector.size(); i++) { candidate_descriptors_object_vector.push_back(descriptors_object_gpu_vector[candidate_ids_object_vector[i]]); } } void addStateToTransitionGraph(string session_name, vector<map<int, int>> &transition_graph, int new_state_id) { // TODO(judy): Rewrite add transition graph using map<int, int> if (transition_graph.size() <= new_state_id) { map<int, int> new_neighbors = map<int, int>(); transition_graph.push_back(new_neighbors); } cout << "Added new state to transition graph" << endl; } void updateTransitionGraph(string session_name, vector<map<int, int>> &transition_graph, int curr_state_id, int new_state_id, int button_id) { // Add connection from curr state to new state if this is not the only state if (curr_state_id >= 0) { map<int,int>::iterator it = transition_graph[curr_state_id].begin(); transition_graph[curr_state_id].insert(it, pair<int,int>(button_id, new_state_id)); // Might need to update database for new transitions addTransitionToDB(session_name, curr_state_id, new_state_id, button_id); } // If find a new state, add it the the transition graph if (transition_graph.size() <= new_state_id) { map<int, int> new_state_map; transition_graph.push_back(new_state_map); } } void initializeObjects(vector<set<int>> adjList, vector<set<int>> &reachable_states) { // Allow states within 2 steps reachable_states = adjList; for (int i = 0; i < adjList.size(); ++i) { set<int> neighbors = reachable_states[i]; for (const int &neighbor : neighbors) { reachable_states[i].insert(reachable_states[neighbor].begin(), reachable_states[neighbor].end()); } } } void filterObjects(int prev_state_id, vector<set<int>> reachable_states, vector<Mat> &reachable_descriptors_object_gpu_vector, vector<Mat> descriptors_object_gpu_vector) { set<int> reachables = reachable_states[prev_state_id]; set<int>::iterator it; for (it = reachables.begin(); it!= reachables.end(); it++) { reachable_descriptors_object_gpu_vector.push_back(descriptors_object_gpu_vector[*it]); } } void filterOriginalImgs(int prev_state_id, vector<set<int>> reachable_states, vector<Mat> &reachable_img_object_vector, vector<Mat> img_object_vector) { set<int> reachables = reachable_states[prev_state_id]; set<int>::iterator it; for (it = reachables.begin(); it!= reachables.end(); it++) { reachable_img_object_vector.push_back(img_object_vector[*it]); } } /* string storeTransitionGraph(vector<map<int, int>> transition_graph) { string output; for (int i = 0; i < transition_graph.size(); i++) { // vector<int> curr_set(transition_graph.size()); // copy(transition_graph[i].begin(), transition_graph[i].end(), curr_set.begin()); ostringstream stream; copy(transition_graph[i].begin(), transition_graph[i].end(), ostream_iterator<int>(stream, " ")); string curr_set = stream.str().c_str(); output += to_string(transition_graph[i].size()) + " " + curr_set + "\n"; } return output; } */ int getExpectedNextState(vector<map<int, int>> transition_graph, int curr_state_id, int button_index) { map<int, int> neighbors = transition_graph[curr_state_id]; if (neighbors.find(button_index) == neighbors.end()) { cout << "NOT FOUND BUTTON INDEX IN NEIGHBORS" << endl; return -1; } cout << "FOUND " << button_index << endl; return neighbors[button_index]; } ======================= File: CVServer/lib/ocr_utils.cpp ======================= <reponame>guoanhong/VizLens-public #include "ocr_utils.hpp" using namespace std; using namespace Json; void init_dictionary(unordered_set<string> &dictionary) { ifstream infile("./words/words"); string currWord; while (infile >> currWord) { // cout << currWord << endl; dictionary.insert(currWord); } } bool isEmpty(char ch) { return ch =='' || ch == '?' || ch == '\n'; } bool isEmptyOrSingleCharacter(string st, int i) { if (isEmpty(st[i])) return true; bool leftIsEmpty = i == 0? true : isEmpty(st[i - 1]); bool rightIsEmpty = i == st.length() - 1? true : isEmpty(st[i + 1]); return leftIsEmpty && rightIsEmpty; } bool isValidWord(unordered_set<string> dictionary, string st) { return st.length() >= 3 && dictionary.find(st)!= dictionary.end(); } static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) { ((string*)userp)->append((char*)contents, size * nmemb); return size * nmemb; } string getBase64EncodingofImg(Mat img) { vector<uchar> buf; imencode(".jpg", img, buf); uchar *enc_msg = new uchar[buf.size()]; for (int i = 0; i < buf.size(); i++) { enc_msg[i] = buf[i]; } return base64_encode(enc_msg, buf.size()); } string parseOCRResponse(string content) { CharReaderBuilder builder; StreamWriterBuilder writeBuilder; CharReader * reader = builder.newCharReader(); Value root; string text, errors; bool parsingSuccessful = reader->parse(content.c_str(), content.c_str() + content.size(), &root, &errors); delete reader; if (!parsingSuccessful ) { cout << errors << endl; } const Value line = root["responses"][0]["fullTextAnnotation"]["text"]; writeBuilder.settings_["indentation"] = ""; text = writeString(writeBuilder, line); return regex_replace(text, regex(R"(\\n)"), " ");; } string parseSDResponse(string content, vector<double> &screen_box) { CharReaderBuilder builder; StreamWriterBuilder writeBuilder; CharReader * reader = builder.newCharReader(); Value root; string errors; bool parsingSuccessful = reader->parse(content.c_str(), content.c_str() + content.size(), &root, &errors); delete reader; if (!parsingSuccessful ) { cout << errors << endl; } const Value isScreenValue = root["isScreen"]; const Value topValue = root["Top"]; const Value leftValue = root["Left"]; const Value widthValue = root["Width"]; const Value heightValue = root["Height"]; writeBuilder.settings_["indentation"] = ""; string isScreen = writeString(writeBuilder, isScreenValue); screen_box[0] = stod(writeString(writeBuilder, topValue)); screen_box[1] = stod(writeString(writeBuilder, leftValue)); screen_box[2]= stod(writeString(writeBuilder, widthValue)); screen_box[3] = stod(writeString(writeBuilder, heightValue)); return isScreen; } void getScreenRegionFromImage(Mat img, string &screen_exist, vector<double> &screen_box) { // Base64 encoding string curlBase64 = getBase64EncodingofImg(img); // cout << "Encoded base64: " << curlBase64 << endl; // Send CURL request to Google Vision API String content; CURL *curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:8000/rest_apis/"); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &content); struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "cache-control: no-cache"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, curlBase64.c_str()); // curl_easy_setopt(hnd, CURLOPT_VERBOSE, 0L); CURLcode ret = curl_easy_perform(curl); curl_easy_cleanup(curl); // Parse JSON response screen_exist = parseSDResponse(content, screen_box); } void getOCRTextFromImage(Mat img, string &fulltext) { // Base64 encoding string curlBase64 = getBase64EncodingofImg(img); // cout << "Encoded base64: " << curlBase64 << endl; // Send CURL request to Google Vision API String content; string curlStr = "{\n \"requests\": [\n {\n \"image\": {\n \"content\": \"" + curlBase64 + "\"\n },\n \"features\": [\n {\n \"type\": \"TEXT_DETECTION\",\n \"maxResults\": 1\n }\n ],\n \"imageContext\": {\n \"languageHints\": [\n \"en\"\n ]\n }\n }\n ]\n}"; CURL *curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(curl, CURLOPT_URL, "https://vision.googleapis.com/v1/images:annotate?key="); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &content); struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "cache-control: no-cache"); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, curlStr.c_str()); // curl_easy_setopt(hnd, CURLOPT_VERBOSE, 0L); CURLcode ret = curl_easy_perform(curl); curl_easy_cleanup(curl); // Parse JSON response string text = parseOCRResponse(content); // Pass full string back for now fulltext = text; // Saved for future use } float ocr_similarity_score(string str1, string str2) { int len1 = str1.length(); int len2 = str2.length(); int LCS[len1 + 1][len2 + 1]; for (int i1 = 0; i1 <= len1; i1++) { for (int i2 = 0; i2 <= len2; i2++) { if (i1 == 0 || i2 == 0) { LCS[i1][i2] = 0; continue; } if (isEmptyOrSingleCharacter(str1, i1 - 1)) { LCS[i1][i2] = LCS[i1 - 1][i2]; continue; } if (isEmptyOrSingleCharacter(str2, i2 - 1)) { LCS[i1][i2] = LCS[i1][i2 - 1]; continue; } if (str1[i1 - 1] == str2[i2 - 1]) { LCS[i1][i2] = LCS[i1 - 1][i2 - 1] + 1; continue; } LCS[i1][i2] = LCS[i1 - 1][i2] > LCS[i1][i2 - 1]? LCS[i1 - 1][i2] : LCS[i1][i2 - 1]; } } // int len = (len1 + len2) / 2; // int len = len1 < len2? len1 : len2; // return LCS[len1][len2] / (float)len; return LCS[len1][len2]; } ======================= File: CVServer/main.cpp ======================= <gh_stars>0 #include <iostream> #include "curl/curl.h" #include "opencv2/nonfree/nonfree.hpp" //#include <opencv2/gpu/gpu.hpp> //#include "opencv2/nonfree/gpu.hpp" #include "sqlite3.h" #include "lib/db_utils.hpp" #include "lib/img_utils.hpp" #include "lib/ocr_utils.hpp" #include "lib/statemap_utils.hpp" #include "lib/feedback_utils.hpp" #include "lib/visualization.hpp" #define DB "../WebServer/db/VizLensDynamic.db" #define imageDirBase "../WebServer/images_video/" #define dirBase "./samples/" const string session_name = "coffee_machine"; const string read_mode = "db"; using namespace cv; using namespace std; //using namespace cv::gpu; // using namespace tesseract; const int MIN_FINGER_DEPTH = 20; const int MAX_FINGER_ANGLE = 60; const double PI = 3.1415926; bool isOpenDB = false; sqlite3 *dbfile; string id = "0"; string image = ""; string mode = "0"; string target = ""; string state = ""; string feedback = ""; string guidance = ""; int idle = 1; int curr_state_id = -1; Mat curr_state_img_scene; float benchmark_ratio = 0.0; void readme(); int skipFrames(VideoCapture capture, int num); /* hasEnding: Check for correct file format */ bool hasEnding (std::string const &fullString, std::string const &ending) { if (fullString.length() >= ending.length()) { return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending)); } else { return false; } } /* NotAlphaNumerical: Filter out special characters encounterd in OCR */ /* bool NotAlphaNumerical(char c) { return!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c =='' || c == '\n'); } */ /** @function main */ int main(int argc, char** argv) { // NOTE: These vectors are for testing only // To be removed vector<double> lighting_vector = vector<double>(); vector<float> ratio_vector = vector<float>(); cout << "Start (dynamic display)"<< endl; string folder = string(argv[1]); string video = string(argv[2]); // Example: "video_coffee_hard.MOV"; // int ocr_mode = atoi(argv[2]); string build_mode = string(argv[3]); // Generating state diagram or pure matching // METADATA: Thresholds float small_diff_ratio = 0.1; // If diff of current state and detected state is below this value, consider it a noise float match_expectation_ratio = 0.8; // If ratio of expected state is above this value, consider it a match float nonmatched_ratio_threshold = atof(argv[4]); // 0.3; // Below this value, consider it as a new state float matched_ratio_threshold = atof(argv[5]); // 0.5; // Above this value, consider it as a match float ocr_threshold_upper = 0.6; // Edit distance / length of short text must be above this value to be considered a match float ocr_threshold_lower = 0.5; // Edit distance / length of long text must be above this value to be considered a match /* Initialize vectors to store reference images and buttons */ vector<Mat> img_object_vector = vector<Mat>(); vector<vector<int>> button_id_vector = vector<vector<int>>(); vector<vector<vector<int> > > button_map_vector = vector<vector<vector<int> > >(); vector<vector<string> > true_labels_vector = vector<vector<string> >(); vector<vector<vector<double> > > button_center_vector = vector<vector<vector<double> > >(); vector<double> avg_button_size_vector = vector<double>(); vector<Mat> keypoints_object_gpu_vector = vector<Mat>(); vector<Mat> descriptors_object_gpu_vector = vector<Mat>(); vector<vector<KeyPoint> > keypoints_object_vector = vector<vector<KeyPoint> >(); vector<vector<float> > descriptors_object_vector = vector<vector<float> >(); vector<string> ocr_object_vector = vector<string>(); /* Initialize vectors to store objects and transition graph */ vector<string> objectnames = vector<string>(); vector<string> filenames = vector<string>(); vector<string> files = vector<string>(); vector<string> description_text_vector = vector<string>(); vector<map<int, int>> transition_graph = vector<map<int, int>>(); // vector<set<int>> reachable_states = vector<set<int>>(); vector<int> all_ids = vector<int>(); vector<int> detected_states = vector<int>(); // Pool of detected states for smoothing vector<Point2f> detected_fingertip_locations = vector<Point2f>(); // Pool of fingertop locations mapped with ids /* Initialize vectors to store candidates of new reference images */ vector<Mat> new_img_pool; vector<vector<KeyPoint> > new_keypoints_pool = vector<vector<KeyPoint> >(); vector<Mat> new_descriptors_pool = vector<Mat>(); // vector<string> new_ocr_vector = vector<string>(); /******************** DB Connection ********************/ isOpenDB = ConnectDB(); if (isOpenDB) cout << "Connected Successful" << endl; else cout << "connection failed " << endl; /******************** Read Reference Images (objects) ********************/ string dir = string(dirBase) + folder + "/images/"; string dir_server = "./../WebServer/images_reference/" + session_name + "/"; getRefImageFilenames(session_name, dir, filenames, read_mode); getTransitionGraph(session_name, read_mode, filenames, transition_graph); // NOTE: For testing only - record lighting vs. max ratio ofstream file_lighting(dir + "../log/lighting.txt"); // TODO(judy): Need to read OCR from db; add an OCR column in objects table /* ifstream inFileOCR; inFileOCR.open(dir + "../log/ocr.txt"); string line; while (inFileOCR >> curr_ocr) { ocr_object_vector.push_back(curr_ocr); } while (getline(inFileOCR, line)) { ocr_object_vector.push_back(line); } cout << ocr_object_vector.size() << endl; inFileOCR.close(); */ /* Load object images from WebServer image_reference folder */ string ending = "jpg"; /* GPU code */ /* SURF surf; surf.hessianThreshold = 400; */ int minHessian = 400; SurfFeatureDetector detector(minHessian); int id_count = 0; for (unsigned int i = 0;i < filenames.size();i++) { if (hasEnding (filenames[i], ending)) { id_count++; cout << filenames[i] << endl; Mat img_object = imread(dir_server+filenames[i]); cout << dir_server+filenames[i] << endl; files.push_back(filenames[i]); double ratio = img_object.rows > img_object.cols? 600.0 / (double)img_object.rows : 600.0 / (double) img_object.cols; Size img_object_size(img_object.cols * ratio, img_object.rows * ratio); //(150, 445) resize(img_object, img_object, img_object_size); img_object_vector.push_back(img_object); vector<int> button_id; vector<vector<int> > button_map; vector<string> true_labels; vector<vector<double> > button_center; double avg_button_size; labels_hash(session_name, id_count - 1, img_object, ratio, button_id, button_map, true_labels, button_center, avg_button_size); // labels_hash(filenames[i].substr(0, filenames[i].size()- 4), img_object, ratio, button_map, true_labels, button_center, avg_button_size); button_id_vector.push_back(button_id); button_map_vector.push_back(button_map); true_labels_vector.push_back(true_labels); button_center_vector.push_back(button_center); avg_button_size_vector.push_back(avg_button_size); cout << dir+filenames[i] << endl; lightingDetection(img_object); /* Computer SURF keypoints and descriptors for object (reference) image */ Mat img_object_gpu; Mat img_object_gray; cvtColor(img_object, img_object_gray, CV_RGB2GRAY); /* GPU code */ /* img_object_gpu.upload(img_object_gray); cv::gpu::printShortCudaDeviceInfo(cv::gpu::getDevice()); */ img_object_gpu = img_object; Mat keypoints_object_gpu; Mat descriptors_object_gpu; /* GPU code */ // surf(img_object_gpu, Mat(), keypoints_object_gpu, descriptors_object_gpu); /* CPU code */ vector<KeyPoint> keypoints_object; Mat descriptors_object; // GPU: vector<float> int minHessian = 400; SurfFeatureDetector detector(minHessian); detector.detect(img_object_gpu, keypoints_object); printf("-- Keypoints Vector Size : %lu \n", keypoints_object.size() ); /* Calculate reference descriptors (feature vectors) */ SurfDescriptorExtractor extractor; extractor.compute(img_object_gpu, keypoints_object, descriptors_object); /* GPU code */ /* keypoints_object_gpu_vector.push_back(keypoints_object_gpu); descriptors_object_gpu_vector.push_back(descriptors_object_gpu); cout << "FOUND " << keypoints_object_gpu.cols << " keypoints on first image" << endl; // Download objects results vector<KeyPoint> tmp_keypoints_object; vector<float> tmp_descriptors_object; surf.downloadKeypoints(keypoints_object_gpu, tmp_keypoints_object); surf.downloadDescriptors(descriptors_object_gpu, tmp_descriptors_object); */ all_ids.push_back(id_count - 1); objectnames.push_back(filenames[i].substr(0, filenames[i].size() - 4)); keypoints_object_vector.push_back(keypoints_object); descriptors_object_gpu_vector.push_back(descriptors_object); } } // TODO(judy): Need to DEBUG this part if (hasReadyToReadObjects()) { int new_state; string new_name; Mat new_object; updateCroppedImage(session_name, dir_server, new_name, new_state, new_object); // Computer SURF keypoints and descriptors for object (reference) image Mat new_object_gpu; Mat new_object_gray; cvtColor(new_object, new_object_gray, CV_RGB2GRAY); // GPU code // img_object_gpu.upload(img_object_gray); // cv::gpu::printShortCudaDeviceInfo(cv::gpu::getDevice()); new_object_gpu = new_object; Mat new_keypoints_object_gpu; Mat new_descriptors_object_gpu; // GPU code // surf(img_object_gpu, Mat(), keypoints_object_gpu, descriptors_object_gpu); // CPU code vector<KeyPoint> new_keypoints_object; Mat new_descriptors_object; // GPU: vector<float> int minHessian = 400; SurfFeatureDetector detector(minHessian); detector.detect(new_object_gpu, new_keypoints_object); printf("-- Keypoints Vector Size : %lu \n", new_keypoints_object.size() ); // Calculate reference descriptors (feature vectors) SurfDescriptorExtractor extractor; extractor.compute(new_object_gpu, new_keypoints_object, new_descriptors_object); all_ids.push_back(new_state); objectnames.push_back(new_name); keypoints_object_vector.push_back(new_keypoints_object); descriptors_object_gpu_vector.push_back(new_descriptors_object); // VizDynamic: May need crowdsourcing for labeling buttons in added image object vector<int> button_id; vector<vector<int> > button_map; vector<string> true_labels; vector<vector<double> > button_center; double avg_button_size; double obj_ratio = new_object.rows > new_object.cols? 600.0 / (double)new_object.rows : 600.0 / (double) new_object.cols; Size object_size(new_object.cols * obj_ratio, new_object.rows * obj_ratio); //(150, 445) resize(new_object, new_object, object_size); labels_hash(session_name, new_state, new_object, obj_ratio, button_id, button_map, true_labels, button_center, avg_button_size); button_map_vector.push_back(button_map); true_labels_vector.push_back(true_labels); button_center_vector.push_back(button_center); avg_button_size_vector.push_back(avg_button_size); } for (int i = 0; i < all_ids.size(); i++) { description_text_vector.push_back(getStateDescription(session_name, i)); cout << "Description Text: " << description_text_vector[i] << endl; } /* Initialize OCR */ // TODO(judy): This is temporary when we don't have OCR stored in DB. Once we have OCR always stored in DB, remove this part. for (int i = 0; i < img_object_vector.size(); i++) { Mat img_object = img_object_vector[i]; String text_object; getOCRTextFromImage(img_object, text_object); ocr_object_vector.push_back(text_object); cout << "OCR for ref image " << i << ": " << text_object << endl; // Test screen detection string screen_exist; vector<double> screen_box{-1, -1, -1, -1}; getScreenRegionFromImage(img_object, screen_exist, screen_box); int screen_top = screen_box[0] == -1? -1 : screen_box[0] * img_object.rows; int screen_left = screen_box[0] == -1? -1 : screen_box[1] * img_object.cols; int screen_width = screen_box[0] == -1? -1 : screen_box[2] * img_object.cols; int screen_height = screen_box[0] == -1? -1 : screen_box[3] * img_object.rows; cout << "Screen detection " << i << ": " << screen_exist << endl; cout << "Screen region " << i << ": " << endl; cout<< " Top: " << screen_top << endl; cout<< " Left: " << screen_left << endl; cout<< " Width: " << screen_width << endl; cout<< " Height:" << screen_height << endl; } /******************** Read Video (scenes) and Match with Reference Images (objects) ********************/ /* Initialize values of detected screen and fintertip location*/ Mat keypoints_scene_gpu; Mat descriptors_scene_gpu; int count = 0; clock_t last_time = clock(); string previous_guidance = ""; int prev_state_id = -1; // curr_state_id = -1; vector<Point2f> previous_fingertip_location(1); previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; int object_not_found = 1; int fingertip_not_found = 1; int fingertip_found = 1; int provide_guidance = 1; int no_button = 1; int db_object_found = -1; int db_finger_found = -1; int fingerx = -1; int fingery = -1; /* CPU code */ string video_name = string(dirBase) + folder + "/videos/" + video; VideoCapture capture(video_name); if (!capture.isOpened()) { throw "--(!) Error reading steam"; } int frame = 0; int first_skip_frames = 0; for (int i = 0; i < first_skip_frames; i++) { capture.grab(); } frame += first_skip_frames; Mat H; int i; id = "0"; /* Start capturing scenes and matching with reference images */ bool enableAddNewRefImage = true; bool lockStateTransition = false; for ( ; ; ) { try { /* Read scene */ // Scene doesn't read in valid image // Update cropped image doesn't change it to read // Note: Need to add back for video streaming /* string image_to_process; // ORIGINAL while (idle == 1) { if(clock() - last_time > (double)(0.05 * 1000000)) { count++; getImageToProcess(image_to_process); last_time = clock(); } } // int frames_skipped = 4; Mat img_scene = imread(imageDirBase + session_name + "/" + image_to_process); cout << imageDirBase + session_name + "/" + image_to_process << endl; cout << "reading img_scene" << endl; */ ++i; // CPU code /* Use local videos for image stream */ Mat img_scene; String img_text; int frames_skipped = 4; for (int a = 0; a < frames_skipped - 1; a++) { capture.grab(); } capture >> img_scene; if (img_scene.empty()) break; /* Use local videos for image stream */ if (img_scene.empty()) { idle = 1; skipImage(); continue; } // frame += frames_skipped; /* lighting -- lightingDetection(img_scene); */ // isStateProcessing(0); /****** FOREGROUND & BACKGROUND DETECTION, CROPPING ******/ string screen_exist; vector<double> screen_box{-1, -1, -1, -1}; getScreenRegionFromImage(img_scene, screen_exist, screen_box); // Transform from proportion to pixel, keeping -1 indicator int screen_top = screen_box[0] == -1? -1 : screen_box[0] * img_scene.rows; int screen_left = screen_box[0] == -1? -1 : screen_box[1] * img_scene.cols; int screen_width = screen_box[0] == -1? -1 : screen_box[2] * img_scene.cols; int screen_height = screen_box[0] == -1? -1 : screen_box[3] * img_scene.rows; cout << "Screen detection " << i << ": " << screen_exist << endl; cout << "Screen region " << i << ": " << endl; cout<< " Top: " << screen_top << endl; cout<< " Left: " << screen_left << endl; cout<< " Width: " << screen_width << endl; cout<< " Height:" << screen_height << endl; if (screen_exist == "0") { // Case 1: Not detected screen // Directly skip the current scene cout << "---- SCREEN NOT DETECTED! SKIPPING ----" << endl; continue; } else if (screen_box[0] >= 0) { // Case 2: Detected screen, with bounding box // Crop the image, use only detected screen for matching cout << "---- CROPPING ----" << endl; img_scene = img_scene(Rect(screen_left, screen_top, screen_width, screen_height)); } else { // Case 3: Detected screen, without bounding box // Do nothing, use raw scene for matching cout << "---- USING RAW SCENE ----" << endl; } /****** START CLOCK *******/ clock_t tic = clock(); clock_t toc = clock(); /* Computer SURF keypoints and descriptors for scene (video) image */ Mat img_scene_gpu; Mat img_scene_gray; cvtColor(img_scene, img_scene_gray, CV_RGB2GRAY); /* GPU code */ /* img_scene_gpu.upload(img_scene_gray); surf(img_scene_gpu, Mat(), keypoints_scene_gpu, descriptors_scene_gpu); */ img_scene_gpu = img_scene_gray; /* CPU code */ vector<KeyPoint> keypoints_scene; Mat descriptors_scene; // SHOULD BE vector<float> detector.detect(img_scene_gpu, keypoints_scene); SurfDescriptorExtractor extractor; extractor.compute(img_scene_gpu, keypoints_scene, descriptors_scene); cout << "FOUND " << keypoints_scene.size() << " keypoints on second image" << endl; // cout << "FOUND " << keypoints_scene_gpu.cols << " keypoints on second image" << endl; if (keypoints_scene.size() == 0) { idle = 1; skipImage(); continue; } /* GPU code: */ /* vector<KeyPoint> keypoints_scene; vector<float> descriptors_scene; surf.downloadKeypoints(keypoints_scene_gpu, keypoints_scene); surf.downloadDescriptors(descriptors_scene_gpu, descriptors_scene); */ // For now, do not call OCR on every scene // Might test with OCR-only metric in technical evaluation /* string text_scene; getOCRTextFromImage(img_scene, text_scene); cout << "Detected text: " << text_scene << endl; */ /******************** Start Matching ********************/ double lighting_scene = calculateLighting(img_scene); // FINGERTIP LOCATION Mat img_object; vector<vector<int> > button_map; vector<string> true_labels; double avg_button_size; vector<Point2f> object_corners(5); vector<Point2f> scene_corners(5); vector<Point2f> fingertip_location(1); vector<Point2f> scene_fingertip_location(1); int button_index; int expected_state_id = -1; bool confirmed_curr_state = false; if (curr_state_id >= 0) { button_map = button_map_vector[curr_state_id]; true_labels = true_labels_vector[curr_state_id]; img_object = img_object_vector[curr_state_id]; avg_button_size = avg_button_size_vector[curr_state_id]; // Might be better to user perspectiveTransform, use direct ratio for faster speed and testing // float ratio = img_scene.cols / (float)img_object.cols; // for (int i = 0; i < 5; i++) scene_corners[i] = object_corners[i] * ratio; // Get the corners from the object (reference) image getImageCorners(img_object, object_corners); // Transform object corners to scene corners using H perspectiveTransform( object_corners, scene_corners, H); // Warp scene image with finger to reference image size Mat img_skin; warpPerspective(img_scene, img_skin, H.inv(), img_object.size(), INTER_LINEAR, BORDER_CONSTANT); // Filter skin color to get binary image Mat img_skin_binary; // skinColorAdjustment(img_object, img_skin); skinColorFilter(img_skin, img_skin_binary); // skinColorSubtractor(img_skin, img_object, img_skin_binary); // Find fingertip location fingertip_location[0].x = -1; fingertip_location[0].y = -1; findFingertipLocation(img_skin_binary, img_object.rows * img_object.cols, H, avg_button_size, fingertip_location); // Find relative fingertip location in scene image // vector<Point2f> scene_fingertip_location(1); // perspectiveTransform( fingertip_location, scene_fingertip_location, H); button_index = getButtonIndex(fingertip_location[0], button_map, true_labels); expected_state_id = getExpectedNextState(transition_graph, curr_state_id, button_index); } cout << "Current button index: " << button_index << endl; cout << "Expected state id: " << expected_state_id << endl; // Only do matching if transition is not locked if (!lockStateTransition) { cout << "--------------------------------------------" << endl; cout << "---- Ratio Benchmark: " << benchmark_ratio << endl; cout << "---- Lighting Stats: " << lighting_scene << endl; int state_index = 0; float ratio_max = 0; // Reduce search space: See if the scene stays on the same image // Reduce search space: See if the scene is the expected image if (curr_state_id >= 0 && matchesCurrentState(descriptors_scene, keypoints_scene, curr_state_img_scene, descriptors_object_gpu_vector[curr_state_id], keypoints_object_vector[curr_state_id], benchmark_ratio, match_expectation_ratio)) { confirmed_curr_state = true; state_index = curr_state_id; cout << "---- Successfully matched with CURRENT state" << endl; } else if (expected_state_id >= 0 && matchesExpectedState(descriptors_scene, keypoints_scene, descriptors_object_gpu_vector[expected_state_id], keypoints_object_vector[expected_state_id], benchmark_ratio, match_expectation_ratio)) { confirmed_curr_state = true; state_index = expected_state_id; cout << "---- Successfully matched with EXPECTED state" << endl; } else { int inlier_max = -1; vector< DMatch > good_matches; vector<int> candidate_ids_object_vector; vector<Mat> candidate_descriptors_object_vector; getCandidateObjectIds(curr_state_id, all_ids, transition_graph, candidate_ids_object_vector); getCandidateObjectDescriptors(candidate_ids_object_vector, descriptors_object_gpu_vector, candidate_descriptors_object_vector); for (int i = 0; i < candidate_ids_object_vector.size(); i++) { cout << "---- NEIGHBOR OF CURRENT STATE : " << candidate_ids_object_vector[i] << endl; } // vector<int> reachable_ids = all_ids; // if (prev_state_id >= 0) { // reachable_ids.resize(reachable_states[prev_state_id].size()); // copy(reachable_states[prev_state_id].begin(), reachable_states[prev_state_id].end(), reachable_ids.begin()); // } cout << "------------------------------------------\n"; cout << "Start Matching \n"; cout << "------------------------------------------\n"; float curr_state_ratio = 0.0; float expected_state_ratio = 0.0; for (int i = 0; i < candidate_descriptors_object_vector.size();i++) { // for (int i = 0;i < descriptors_object_gpu_vector.size();i++) { // for (int i = 0;i < reachable_descriptors_object_gpu_vector.size();i++) { // matching descriptors BFMatcher matcher(NORM_L2); Mat trainIdx, distance; /* CPU code */ vector<DMatch> matches; matcher.match(candidate_descriptors_object_vector[i], descriptors_scene, matches); // matcher.match(descriptors_object_gpu_vector[i], descriptors_scene, matches); vector< DMatch > tmp_good_matches; gpuFindGoodMatches(matches, tmp_good_matches); // Can't find any object that matches the current scene if (tmp_good_matches.size() < 4) { cout << "-- Skipping Image -- " << i << endl; continue; } // Find H Mat tempH; vector<uchar> inliers; findH(keypoints_object_vector[candidate_ids_object_vector[i]], keypoints_scene, tmp_good_matches, tempH, inliers); // Only count non '\0' inliers int inliersCount = 0; for (int i = 0; i < inliers.size(); i++) { if (inliers[i]!= '\0') { inliersCount++; } } cout << "-- Match with Image -- " << candidate_ids_object_vector[i] << endl; // cout << "OCR text: " << ocr_object_vector[i] << endl; cout << "Object keypoints: " << keypoints_object_vector[i].size() << endl; cout << "Scene keypoints: " << keypoints_scene.size() << endl; cout << "Good matches: " << tmp_good_matches.size() << endl; cout << "Inlier count: " << inliersCount << endl; /* Calculate ratio of inliers */ float currRatio = inliersCount / (float)tmp_good_matches.size(); // / ((float)keypoints_object_vector[i].size() + (float)keypoints_scene.size()); cout << "Ratio of Inlier: " << currRatio << endl; cout << endl; if (i == 0 || currRatio > ratio_max) { ratio_max = currRatio; inlier_max = inliersCount; state_index = candidate_ids_object_vector[i]; H = tempH; } if (candidate_ids_object_vector[i] == curr_state_id) { curr_state_ratio = currRatio; } if (candidate_ids_object_vector[i] == expected_state_id) { expected_state_ratio = currRatio; } } cout << "---- Max ratio within neighbors: " << ratio_max << endl; // NOTE: This is for analyzing lighting vs. ratio // To be removed if (file_lighting.is_open()) { file_lighting << lighting_scene << "," << ratio_max << endl; } // lighting_vector.push_back(lighting_scene); // ratio_vector.push_back(ratio_max); // Check if candidates include a good option // If not, search the original pool of reference images // Smoothing to get rid of noise // For example, if curr state and new state have ratio 0.42 and 0.43, // stick with current state because this might be a noise. if (ratio_max > 0 && (ratio_max - curr_state_ratio) / ratio_max < small_diff_ratio && curr_state_ratio > benchmark_ratio * matched_ratio_threshold) { state_index = curr_state_id; ratio_max = curr_state_ratio; } // Compare with expected next state given fingertip location bool correct_next_state = true; if (state_index!= curr_state_id) { if (curr_state_id < 0) { correct_next_state = false; } else { correct_next_state = (expected_state_id == state_index); } } // Note: correct_next_state should be true when the state remains unchanged if (!correct_next_state) { if (ratio_max > 0 && (ratio_max - expected_state_ratio) / ratio_max < small_diff_ratio && expected_state_ratio > benchmark_ratio * matched_ratio_threshold) { state_index = expected_state_id; ratio_max = expected_state_ratio; } } // If current highest matching equals current state, then assume it's not changed; // Otherwise if lower than a threshold, match using the original pool of reference image if (state_index!= curr_state_id &&!correct_next_state && ratio_max < benchmark_ratio * matched_ratio_threshold) { cout << "Did not find a good match in neighbors of current state" << endl; cout << "Searching all reference images...." << endl; for (int i = 0; i < descriptors_object_gpu_vector.size(); i++) { // matching descriptors BFMatcher matcher(NORM_L2); Mat trainIdx, distance; /* CPU code */ vector<DMatch> matches; matcher.match(descriptors_object_gpu_vector[i], descriptors_scene, matches); // matcher.match(descriptors_object_gpu_vector[i], descriptors_scene, matches); vector< DMatch > tmp_good_matches; gpuFindGoodMatches(matches, tmp_good_matches); // Can't find any object that matches the current scene if (tmp_good_matches.size() < 4) { cout << "-- Skipping Image -- " << i << endl; continue; } // Find H Mat tempH; vector<uchar> inliers; findH(keypoints_object_vector[i], keypoints_scene, tmp_good_matches, tempH, inliers); // Only count non '\0' inliers int inliersCount = 0; for (int i = 0; i < inliers.size(); i++) { if (inliers[i]!= '\0') { inliersCount++; } } cout << "-- Match with Image -- " << i << endl; // cout << "OCR text: " << ocr_object_vector[i] << endl; cout << "Object keypoints: " << keypoints_object_vector[i].size() << endl; cout << "Scene keypoints: " << keypoints_scene.size() << endl; cout << "Good matches: " << tmp_good_matches.size() << endl; cout << "Inlier count: " << inliersCount << endl; /* Calculate ratio of inliers */ float currRatio = inliersCount / (float)tmp_good_matches.size(); // / ((float)keypoints_object_vector[i].size() + (float)keypoints_scene.size()); cout << "Ratio of Inlier: " << currRatio << endl; cout << endl; if (i == 0 || currRatio > ratio_max) { ratio_max = currRatio; inlier_max = inliersCount; state_index = all_ids[i]; H = tempH; } } // NOTE: For testing only if (file_lighting.is_open()) { file_lighting << lighting_scene << "," << ratio_max << endl; } } else { // Found in neighboring states confirmed_curr_state = true; } } /******************** OCR ********************/ float ratio_lower = nonmatched_ratio_threshold * benchmark_ratio; float ratio_upper = matched_ratio_threshold * benchmark_ratio; // Above matched_ratio_threshold * benchmark_ratio considered a match: this is consistent for all stages bool is_new_state =!confirmed_curr_state && isNewState(ratio_max, ratio_lower, ratio_upper, state_index, img_scene, ocr_object_vector, ocr_threshold_upper, ocr_threshold_lower); if (is_new_state) { /******************** ADD NEW REF IMAGE ********************/ // TESTING: disable add new image continue; if (!enableAddNewRefImage) continue; cout << "-- FOUND UNMATCHED IMAGE -- \n"; new_img_pool.push_back(img_scene); new_keypoints_pool.push_back(keypoints_scene); new_descriptors_pool.push_back(descriptors_scene); bool matched = checkNewImgFromPool(new_img_pool, new_keypoints_pool, new_descriptors_pool, img_scene, keypoints_scene, descriptors_scene); if (!matched) continue; if (matched) { // when we find a "stable" new state in the poll // vector<vector<int> > button_map; // vector<string> true_labels; // vector<vector<double> > button_center; // double avg_button_size; // labels_hash(filenames[i].substr(0, filenames[i].size()-9), img_object, ratio, button_map, true_labels, button_center, avg_button_size); // button_map_vector.push_back(button_map); // true_labels_vector.push_back(true_labels); // button_center_vector.push_back(button_center); // avg_button_size_vector.push_back(avg_button_size); // cout << dir+filenames[i]; // lightingDetection(img_object); // Computer SURF keypoints and descriptors for object (reference) image // Mat img_object_gpu; // Mat img_object_gray; // cvtColor(img_object, img_object_gray, CV_RGB2GRAY); // img_object_gpu = img_object; // Mat keypoints_object_gpu; // Mat descriptors_object_gpu; // ORIGINAL // surf(img_object_gpu, Mat(), keypoints_object_gpu, descriptors_object_gpu); // CPU ONLY // vector<KeyPoint> keypoints_object; // Mat descriptors_object; // SHOULD BE vector<float> // int minHessian = 400; // SurfFeatureDetector detector(minHessian); // detector.detect(img_object_gpu, keypoints_object); // printf("-- Keypoints Vector Size : %lu \n", keypoints_object.size() ); // //-- Step 2: Calculate reference descriptors (feature vectors) // SurfDescriptorExtractor extractor; // extractor.compute(img_object_gpu, keypoints_object, descriptors_object); // keypoints_object_gpu_vector.push_back(keypoints_object_gpu); // descriptors_object_gpu_vector.push_back(descriptors_object_gpu); // // cout << "FOUND " << keypoints_object_gpu.cols << " keypoints on first image" << endl; // // // downloading objects results // vector<KeyPoint> tmp_keypoints_object; // vector<float> tmp_descriptors_object; // ORIGINAL // surf.downloadKeypoints(keypoints_object_gpu, tmp_keypoints_object); // surf.downloadDescriptors(descriptors_object_gpu, tmp_descriptors_object); cout << "UNMATCHED IMAGE MATCHED IN POOL \n"; // Mat img_object = img_scene; img_object = img_scene; img_object_vector.push_back(img_object); cout << "-- ADDING NEW REFERENCE IMAGE -- \n"; state_index = all_ids.size(); cout << "state_index = " << state_index << endl; // + ", Ratio = " + to_string(inlier_max / (float)keypoints_scene.size()) + "\n"; string new_name = state_index < 10? "New0" + to_string(state_index) + ".jpg" : "New" + to_string(state_index) + ".jpg"; string new_file = dir + new_name; sendTransitionInstructions(session_name, "Adding new state, please wait."); if (read_mode == "local") { files.push_back(new_name); imwrite(new_file, img_object); imwrite("../WebServer/images_original/" + session_name + "/" + new_name, img_object); } else if (read_mode == "db") { files.push_back(new_name); imwrite(new_file, img_object); imwrite("../WebServer/images_original/" + session_name + "/" + new_name, img_object); // if (!isStateProcessing(state_index)) { cout << "HTTP request" << endl; // struct stat file_info; // FILE *fd; // fd = fopen("/Users/judy/Desktop/VizLens/VizLensDynamic/WebServer/images_original/New00.jpg", "r"); // fstat(fileno(fd), &file_info); // if(!fd) // return 1; /* can't continue */ // /* to get the file size */ // if(fstat(fileno(fd), &file_info)!= 0) // return 1; /* can't continue */ // imwrite(new_file, img_object); imwrite("../WebServer/images_original/" + session_name + "/" + new_name, img_object); CURL *hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST"); string url = "http://localhost:8888/VizLensDynamic/php/uploadOriginalforCVServer.php?userid=testuser&session=" + session_name + "&stateid=" + to_string(state_index); curl_easy_setopt(hnd, CURLOPT_URL, url.c_str()); struct curl_slist *headers = NULL; // headers = curl_slist_append(headers, "postman-token: 92191e21-8ce2-ff44-9c98-8cfd401b902f"); headers = curl_slist_append(headers, "cache-control: no-cache"); headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"); curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers); string upload_file = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"pictures[0]\"; filename=\"" + new_name + "\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--"; curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, upload_file.c_str()); // curl_easy_setopt(hnd, CURLOPT_READDATA, fd); // curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE,(curl_off_t)file_info.st_size); // curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); CURLcode ret = curl_easy_perform(hnd); // } cout << "Added new state to transition graph" << endl; } /* Add OCR */ /* if (ratio_max <= 0.3) { text_scene = ocr_find_text(tess, img_scene_gray, dictionary); cout << "OCR Output: " << text_scene << endl; } */ // TODO: Might need to change text_scene to updated OCR? Or not important? // ocr_object_vector.push_back(text_scene); addStateToTransitionGraph(session_name, transition_graph, state_index); // TODO: Need to store OCR to data base // ofstream file_ocr(dir + "../log/ocr.txt"); // if (file_ocr.is_open()) { // for (int i = 0; i < ocr_object_vector.size(); i++) { // file_ocr << ocr_object_vector[i] << endl; // } // } // file_ocr.close(); // TODO: WAIT; PULL REFERENCE IMAGE FROM DB; UPDATE IMG_OBJECT updateCroppedImage(session_name, dir_server, new_name, state_index, img_object); enableAddNewRefImage = false; // Add OCR of scene to vector; String text_scene; getOCRTextFromImage(img_scene, text_scene); files.push_back(new_name); all_ids.push_back(state_index); objectnames.push_back(new_name); ocr_object_vector.push_back(text_scene); // Can add this line to store image locally // TODO: re-detect keypoints & descriptors keypoints_object_vector.push_back(keypoints_scene); descriptors_object_gpu_vector.push_back(descriptors_scene); // VisDynamic: May need crowdsourcing for labeling buttons in added image object vector<int> button_id; vector<vector<int> > button_map; vector<string> true_labels; vector<vector<double> > button_center; double avg_button_size; double obj_ratio = img_object.rows > img_object.cols? 600.0 / (double)img_object.rows : 600.0 / (double) img_object.cols; Size object_size(img_object.cols * obj_ratio, img_object.rows * obj_ratio); //(150, 445) resize(img_object, img_object, object_size); labels_hash(session_name, state_index, img_object, obj_ratio, button_id, button_map, true_labels, button_center, avg_button_size); button_map_vector.push_back(button_map); true_labels_vector.push_back(true_labels); button_center_vector.push_back(button_center); avg_button_size_vector.push_back(avg_button_size); // cout << "BEFORE PUSHING \n"; // button_map_vector.push_back(button_map_vector[button_map_vector.size() - 1]); // true_labels_vector.push_back(true_labels_vector[true_labels_vector.size() - 1]); // button_center_vector.push_back(button_center_vector[button_center_vector.size() - 1]); // avg_button_size_vector.push_back(avg_button_size_vector[avg_button_size_vector.size() - 1]); // cout << "AFTER PUSHING \n"; // string tmp_string; // getImageToProcess(tmp_string); description_text_vector.push_back(getStateDescription(session_name, state_index)); sendTransitionInstructions(session_name, "New state ready, please resume."); } } // Use the history of detected screens to determine the current screen and get rid of noises. // Point2f transition_fingertip_location; if (detected_states.size() == 6) { detected_states.erase(detected_states.begin()); // detected_fingertip_locations.erase(detected_fingertip_locations.begin()); } detected_states.push_back(state_index); // detected_fingertip_locations.push_back(fingertip_location[0]); string matched_state; string current_state; int new_state_id = findCurrentState(detected_states); if (new_state_id!= curr_state_id) { prev_state_id = curr_state_id; curr_state_id = new_state_id; curr_state_img_scene = img_scene; benchmark_ratio = max(benchmark_ratio, ratio_max); // transition_fingertip_location = findTransitionFingertipLocation(new_state_id, detected_states, detected_fingertip_locations); } cout << "Current state id: "<< curr_state_id <<endl; enableAddNewRefImage = true; updateTransitionGraph(session_name, transition_graph, prev_state_id, curr_state_id); // Probably don't want to locally store transition graph /* cout << "Transition graph updated" << endl; string out_string = storeTransitionGraph(transition_graph); ofstream file(dir + "../log/state_map.txt"); if (file.is_open()) { file << out_string; } file.close(); */ } /**** End of matching for lockStateTransition = false ****/ cout << "PREVIOUS STATE: " << prev_state_id << endl; cout << "CURRENT STATE: " << curr_state_id << endl; /******************** Send Feedback ********************/ // NEED TO FIX state_index // Mat img_object = img_object_vector[curr_state_id]; img_object = img_object_vector[curr_state_id]; // vector<vector<int> > button_map = button_map_vector[curr_state_id]; // vector<string> true_labels = true_labels_vector[curr_state_id]; vector<vector<double> > button_center = button_center_vector[curr_state_id]; // double avg_button_size = avg_button_size_vector[curr_state_id]; avg_button_size = avg_button_size_vector[curr_state_id]; // double object_ratio = img_scene.rows > img_object.cols? 200.0 / (double)img_object.rows : 200.0 / (double) img_object.cols; // Size img_object_size(img_object.cols * object_ratio, img_object.rows * object_ratio); //(150, 445) // resize(img_object, img_object, img_object_size); /* Old visualization drawMatches( img_object, keypoints_object_vector[state_index], img_scene, keypoints_scene_gpu, good_matches, img_results, Scalar::all(-1), Scalar::all(-1), vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS ); */ // Resize to fit expected size double scene_ratio = img_scene.rows > (double)img_scene.cols / 3 * 2? 500 / (double)img_scene.rows : 750 / (double)img_scene.cols; Size img_scene_size(img_scene.cols * scene_ratio, img_scene.rows * scene_ratio); //(150, 445) resize(img_scene, img_scene, img_scene_size); // DRAW MAT Mat img_results = Mat::zeros( 750, 1200, CV_8UC3 ); drawScreenMap(img_results, img_scene, img_object_vector, curr_state_id, all_ids); drawStateGraph(img_results, transition_graph, curr_state_id); // DISPLAY LOG /* if (!lockStateTransition) { displayLogOnScreen(img_results, objectnames, detected_states, "", "", "");// ocr_object_vector[curr_state_id]); } */ // UPDATED FINGERTIP LOCATION // Get the corners from the object (reference) image getImageCorners(img_object, object_corners); // Transform object corners to scene corners using H perspectiveTransform( object_corners, scene_corners, H); int guidance_index = -2; // Set mode to -2 for testing if (stoi(mode) == 2) { guidance_index = getGuidanceIndex(true_labels, target); } // Originally declared here // vector<Point2f> fingertip_location(1); if (guidance_index == -1) { if (no_button % 5 == 1) { feedback = "no button"; } else { feedback = ""; } no_button++; } else { no_button = 1; Rect rect; if (!findRect(scene_corners, rect)) { db_object_found = 0; db_finger_found = -1; fingerx = -1; fingery = -1; fingertip_not_found = 0; fingertip_found = 1; provide_guidance = 1; previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; if (object_not_found % 5 == 0) { feedback = "no object"; object_not_found++; } else { feedback = ""; object_not_found++; } cout << "No Object" << endl ; } else { db_object_found = 1; object_not_found = 1; // Warp scene image with finger to reference image size Mat img_skin; warpPerspective(img_scene, img_skin, H.inv(), img_object.size(), INTER_LINEAR, BORDER_CONSTANT); // printf("Elapsed: %f seconds\n", (double)(toc - tic) / CLOCKS_PER_SEC); // Filter skin color to get binary image Mat img_skin_binary; // skinColorAdjustment(img_object, img_skin); skinColorFilter(img_skin, img_skin_binary); // skinColorSubtractor(img_skin, img_object, img_skin_binary); // Find fingertip location in reference image fingertip_location[0].x = -1; fingertip_location[0].y = -1; findFingertipLocation(img_skin_binary, img_object.rows * img_object.cols, H, avg_button_size, fingertip_location); // Find relative fingertip location in scene image vector<Point2f> scene_fingertip_location(1); perspectiveTransform( fingertip_location, scene_fingertip_location, H); if (fingertip_location[0].x == -1 && fingertip_location[0].y == -1) { Point2f object_center_scene; object_center_scene = scene_corners[4]; feedback = ""; if (object_center_scene.y < 0) { feedback += "up "; } else if (object_center_scene.y > img_scene.rows) { feedback += "down "; } if (object_center_scene.x < 0) { feedback += "right"; } else if (object_center_scene.x > img_scene.cols) { feedback += "left"; } if (feedback.compare("")) { feedback = "Move phone to " + feedback; } else { db_finger_found = 0; fingerx = -1; fingery = -1; previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; fingertip_found = 1; provide_guidance = 1; if (fingertip_not_found % 5 == 0) { feedback = "no finger"; fingertip_not_found++; } else { feedback = ""; fingertip_not_found++; } } } else { db_finger_found = 1; fingerx = (int) fingertip_location[0].x; fingery = (int) fingertip_location[0].y; switch (stoi(mode)) { case 1: // Provide feedback if (fingertip_found % 5 == 0) { previous_fingertip_location[0].x = -1; previous_fingertip_location[0].y = -1; fingertip_found++; } else { fingertip_found++; } fingertip_not_found = 1; feedback = getFeedback(button_map, true_labels, fingertip_location, previous_fingertip_location, avg_button_size); break; case 2: { // Provide guidance if (guidance_index!= -1) { previous_guidance = guidance; guidance = getGuidance(button_map, true_labels, button_center[guidance_index], fingertip_location, previous_fingertip_location, avg_button_size); } if (guidance.compare(previous_guidance)) { provide_guidance = 1; feedback = guidance; // feedback = feedback + getFeedback(button_map, true_labels, fingertip_location, previous
66,453
thestackv1_concat_by_repo-long/65536-65536
} @Override protected NClob doGetValue(ResultSet resultSet, int index) throws SQLException { return resultSet.getNClob(index); } @Override protected void doSetValue(PreparedStatement preparedStatement, int index, NClob value) throws SQLException { preparedStatement.setNClob(index, value); } @Override protected NClob doGetValue(CallableStatement callableStatement, int index) throws SQLException { return callableStatement.getNClob(index); } @Override protected String doConvertToLogFormat(NClob value) { return String.valueOf(value); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/metamodel/Person.java ======================= <reponame>orekyuu/doma<filename>doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/metamodel/Person.java package org.seasar.doma.internal.apt.processor.metamodel; import org.seasar.doma.Entity; @Entity public class Person { public Integer id; public Name name; } ======================= File: doma-core/src/test/java/org/seasar/doma/internal/jdbc/util/DatabaseObjectUtilTest.java ======================= package org.seasar.doma.internal.jdbc.util; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; public class DatabaseObjectUtilTest { @Test public void testGetQualifiedName() { String name = DatabaseObjectUtil.getQualifiedName(s -> "[" + s + "]", "aaa", "bbb", "ccc"); assertEquals("[aaa].[bbb].[ccc]", name); } @Test public void testGetQualifiedName_catalogIsNull() { String name = DatabaseObjectUtil.getQualifiedName(s -> "[" + s + "]", null, "bbb", "ccc"); assertEquals("[bbb].[ccc]", name); } @Test public void testGetQualifiedName_schemaIsNull() { String name = DatabaseObjectUtil.getQualifiedName(s -> "[" + s + "]", "aaa", null, "ccc"); assertEquals("[aaa].[ccc]", name); } @Test public void testGetQualifiedName_catalogAndSchemaIsNull() { String name = DatabaseObjectUtil.getQualifiedName(s -> "[" + s + "]", null, null, "ccc"); assertEquals("[ccc]", name); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/DaoMethodNotFoundException.java ======================= package org.seasar.doma.jdbc; import org.seasar.doma.message.Message; /** Thrown to indicate that the DAO method is not found. */ public class DaoMethodNotFoundException extends JdbcException { private static final long serialVersionUID = 1L; protected final String className; protected final String signature; public DaoMethodNotFoundException(Throwable cause, String className, String signature) { super(Message.DOMA2215, cause, className, signature, cause); this.className = className; this.signature = signature; } public String getClassName() { return className; } public String getSignature() { return signature; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/statement/Statement.java ======================= package org.seasar.doma.jdbc.criteria.statement; import java.util.function.Consumer; import org.seasar.doma.jdbc.Sql; /** * Represents the SQL statement built by the Criteria API. * * @param <RESULT> the result of the execution */ public interface Statement<RESULT> extends Buildable<Statement<RESULT>> { /** * Executes the SQL statement. * * @return the result */ RESULT execute(); @Override default Statement<RESULT> peek(Consumer<Sql<?>> consumer) { return Buildable.super.peek(consumer); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/TenantIdEntity.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.Entity; import org.seasar.doma.TenantId; @Entity public class TenantIdEntity { @TenantId String tenantDiscriminator; } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/dialect/Mssql2008ForUpdateTransformer.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.jdbc.dialect; import org.seasar.doma.internal.jdbc.sql.node.FragmentNode; import org.seasar.doma.internal.jdbc.sql.node.FromClauseNode; import org.seasar.doma.internal.jdbc.sql.node.SelectStatementNode; import org.seasar.doma.jdbc.SelectForUpdateType; import org.seasar.doma.jdbc.SqlNode; public class Mssql2008ForUpdateTransformer extends StandardForUpdateTransformer { public Mssql2008ForUpdateTransformer( SelectForUpdateType forUpdateType, int waitSeconds, String... aliases) { super(forUpdateType, waitSeconds, aliases); } @Override public SqlNode visitSelectStatementNode(SelectStatementNode node, Void p) { if (processed) { return node; } processed = true; StringBuilder buf = new StringBuilder(100).append("with (updlock, rowlock"); if (forUpdateType == SelectForUpdateType.NOWAIT) { buf.append(", nowait"); } buf.append(") "); FromClauseNode originalFrom = node.getFromClauseNode(); FromClauseNode from = new FromClauseNode(originalFrom.getWordNode()); for (SqlNode child : originalFrom.getChildren()) { from.appendNode(child); } from.appendNode(new FragmentNode(buf.toString())); SelectStatementNode result = new SelectStatementNode(); result.setSelectClauseNode(node.getSelectClauseNode()); result.setFromClauseNode(from); result.setWhereClauseNode(node.getWhereClauseNode()); result.setGroupByClauseNode(node.getGroupByClauseNode()); result.setHavingClauseNode(node.getHavingClauseNode()); result.setOrderByClauseNode(node.getOrderByClauseNode()); result.setOptionClauseNode(node.getOptionClauseNode()); return result; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/metamodel/EntityMetamodel.java ======================= package org.seasar.doma.jdbc.criteria.metamodel; import java.util.List; import org.seasar.doma.jdbc.entity.EntityType; public interface EntityMetamodel<ENTITY> { EntityType<ENTITY> asType(); List<PropertyMetamodel<?>> allPropertyMetamodels(); } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/sql/node/ParensNode.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/internal/jdbc/sql/node/ParensNode.java package org.seasar.doma.internal.jdbc.sql.node; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import org.seasar.doma.DomaNullPointerException; import org.seasar.doma.jdbc.SqlNodeVisitor; public class ParensNode extends AbstractSqlNode { protected final SqlLocation location; protected boolean attachedWithValue; protected boolean empty = true; protected final OtherNode openedParensNode; protected OtherNode closedParensNode; public ParensNode(SqlLocation location) { assertNotNull(location); this.location = location; openedParensNode = OtherNode.of("("); } public boolean isAttachedWithValue() { return attachedWithValue; } public void setAttachedWithValue(boolean attachedWithValue) { this.attachedWithValue = attachedWithValue; } public boolean isEmpty() { return empty; } public void setEmpty(boolean empty) { this.empty = empty; } public OtherNode getOpenedFragmentNode() { return openedParensNode; } public OtherNode getClosedFragmentNode() { return closedParensNode; } public SqlLocation getLocation() { return location; } public void close() { closedParensNode = OtherNode.of(")"); } @Override public <R, P> R accept(SqlNodeVisitor<R, P> visitor, P p) { if (visitor == null) { throw new DomaNullPointerException("visitor"); } return visitor.visitParensNode(this, p); } } ======================= File: doma-core/src/test/java/example/entity/_ImmutableEmp.java ======================= package example.entity; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.BiFunction; import javax.annotation.Generated; import org.seasar.doma.internal.jdbc.scalar.BasicScalar; import org.seasar.doma.jdbc.entity.AbstractEntityType; import org.seasar.doma.jdbc.entity.AssignedIdPropertyType; import org.seasar.doma.jdbc.entity.DefaultPropertyType; import org.seasar.doma.jdbc.entity.EntityPropertyType; import org.seasar.doma.jdbc.entity.GeneratedIdPropertyType; import org.seasar.doma.jdbc.entity.NamingType; import org.seasar.doma.jdbc.entity.PostDeleteContext; import org.seasar.doma.jdbc.entity.PostInsertContext; import org.seasar.doma.jdbc.entity.PostUpdateContext; import org.seasar.doma.jdbc.entity.PreDeleteContext; import org.seasar.doma.jdbc.entity.PreInsertContext; import org.seasar.doma.jdbc.entity.PreUpdateContext; import org.seasar.doma.jdbc.entity.Property; import org.seasar.doma.jdbc.entity.TenantIdPropertyType; import org.seasar.doma.jdbc.entity.VersionPropertyType; import org.seasar.doma.wrapper.BigDecimalWrapper; import org.seasar.doma.wrapper.IntegerWrapper; import org.seasar.doma.wrapper.StringWrapper; @Generated("") public class _ImmutableEmp extends AbstractEntityType<ImmutableEmp> { private static final _ImmutableEmp singleton = new _ImmutableEmp(); private final NamingType __namingType = NamingType.UPPER_CASE; public final AssignedIdPropertyType<ImmutableEmp, Integer, Integer> id = new AssignedIdPropertyType<>( ImmutableEmp.class, () -> new BasicScalar<>(IntegerWrapper::new), "id", "ID", __namingType, false); public final DefaultPropertyType<ImmutableEmp, String, String> name = new DefaultPropertyType<>( ImmutableEmp.class, () -> new BasicScalar<>(StringWrapper::new), "name", "NAME", __namingType, true, true, false); public final DefaultPropertyType<ImmutableEmp, BigDecimal, BigDecimal> salary = new DefaultPropertyType<>( ImmutableEmp.class, () -> new BasicScalar<>(BigDecimalWrapper::new), "salary", "SALARY", __namingType, true, true, false); public final VersionPropertyType<ImmutableEmp, Integer, Integer> version = new VersionPropertyType<>( ImmutableEmp.class, () -> new BasicScalar<>(IntegerWrapper::new), "version", "VERSION", __namingType, false); private final String __name = "Emp"; private final String __catalogName = null; private final String __schemaName = null; private final String __tableName = "EMP"; private final List<EntityPropertyType<ImmutableEmp,?>> __idPropertyTypes; private final List<EntityPropertyType<ImmutableEmp,?>> __entityPropertyTypes; private final Map<String, EntityPropertyType<ImmutableEmp,?>> __entityPropertyTypeMap; private _ImmutableEmp() { List<EntityPropertyType<ImmutableEmp,?>> __idList = new ArrayList<>(); __idList.add(id); __idPropertyTypes = Collections.unmodifiableList(__idList); List<EntityPropertyType<ImmutableEmp,?>> __list = new ArrayList<>(); __list.add(id); __list.add(name); __list.add(salary); __list.add(version); __entityPropertyTypes = Collections.unmodifiableList(__list); Map<String, EntityPropertyType<ImmutableEmp,?>> __map = new HashMap<>(); __map.put("id", id); __map.put("name", name); __map.put("salary", salary); __map.put("version", version); __entityPropertyTypeMap = Collections.unmodifiableMap(__map); } @Override public boolean isImmutable() { return false; } @Override public ImmutableEmp newEntity(Map<String, Property<ImmutableEmp,?>> args) { return new ImmutableEmp( (Integer) (args.containsKey("id")? args.get("id").get() : null), (String) (args.containsKey("name")? args.get("name").get() : null), (BigDecimal) (args.containsKey("salary")? args.get("salary").get() : null), (Integer) (args.containsKey("version")? args.get("version").get() : null)); } @Override public Class<ImmutableEmp> getEntityClass() { return ImmutableEmp.class; } @Override public String getName() { return __name; } @Override public List<EntityPropertyType<ImmutableEmp,?>> getEntityPropertyTypes() { return __entityPropertyTypes; } @Override public EntityPropertyType<ImmutableEmp,?> getEntityPropertyType(String propertyName) { return __entityPropertyTypeMap.get(propertyName); } @Override public void saveCurrentStates(ImmutableEmp __entity) {} @Override public ImmutableEmp getOriginalStates(ImmutableEmp entity) { return null; } @Override public GeneratedIdPropertyType<ImmutableEmp,?,?> getGeneratedIdPropertyType() { return null; } @Override public VersionPropertyType<ImmutableEmp,?,?> getVersionPropertyType() { return version; } @Override public TenantIdPropertyType<ImmutableEmp,?,?> getTenantIdPropertyType() { return null; } @Override public List<EntityPropertyType<ImmutableEmp,?>> getIdPropertyTypes() { return __idPropertyTypes; } @Override public void preInsert(ImmutableEmp entity, PreInsertContext<ImmutableEmp> context) {} @Override public void preUpdate(ImmutableEmp entity, PreUpdateContext<ImmutableEmp> context) {} @Override public void preDelete(ImmutableEmp entity, PreDeleteContext<ImmutableEmp> context) {} @Override public void postInsert(ImmutableEmp entity, PostInsertContext<ImmutableEmp> context) {} @Override public void postUpdate(ImmutableEmp entity, PostUpdateContext<ImmutableEmp> context) {} @Override public void postDelete(ImmutableEmp entity, PostDeleteContext<ImmutableEmp> context) {} @Override public String getCatalogName() { return __catalogName; } @Override public String getSchemaName() { return __schemaName; } @Override @Deprecated public String getTableName() { return __tableName; } @Override public String getTableName(BiFunction<NamingType, String, String> namingFunction) { if (__tableName.isEmpty()) { return namingFunction.apply(getNamingType(), getName()); } return __tableName; } @Override public NamingType getNamingType() { return __namingType; } @Override public boolean isQuoteRequired() { return false; } public static _ImmutableEmp getSingletonInternal() { return singleton; } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/sql/OptionalLongInOutParameter.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/internal/jdbc/sql/OptionalLongInOutParameter.java package org.seasar.doma.internal.jdbc.sql; import java.util.OptionalLong; import org.seasar.doma.internal.jdbc.scalar.OptionalLongScalar; import org.seasar.doma.jdbc.Reference; public class OptionalLongInOutParameter extends ScalarInOutParameter<Long, OptionalLong> { public OptionalLongInOutParameter(Reference<OptionalLong> reference) { super(new OptionalLongScalar(), reference); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/query/SqlFileScriptQueryMeta.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.apt.meta.query; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import org.seasar.doma.internal.apt.annot.ScriptAnnot; import org.seasar.doma.internal.jdbc.util.ScriptFileUtil; import org.seasar.doma.jdbc.SqlLogType; public class SqlFileScriptQueryMeta extends AbstractSqlFileQueryMeta { private ScriptAnnot scriptAnnot; public SqlFileScriptQueryMeta(TypeElement daoElement, ExecutableElement methodElement) { super(daoElement, methodElement); } void setScriptAnnot(ScriptAnnot scriptAnnot) { this.scriptAnnot = scriptAnnot; } public boolean getHaltOnError() { return scriptAnnot.getHaltOnErrorValue(); } public String getBlockDelimiter() { return scriptAnnot.getBlockDelimiterValue(); } public SqlLogType getSqlLogType() { return scriptAnnot.getSqlLogValue(); } @Override public String getPath() { if (sqlAnnot == null) { // script file path return ScriptFileUtil.buildPath(getDaoElement().getQualifiedName().toString(), getName()); } return buildQualifiedMethodName(); } @Override public <R> R accept(QueryMetaVisitor<R> visitor) { return visitor.visitSqlFileScriptQueryMeta(this); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/meta/NamingType3Entity.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.apt.meta; import org.seasar.doma.Entity; import org.seasar.doma.jdbc.entity.NamingType; @Entity(naming = NamingType.NONE) public class NamingType3Entity extends NamingType2Entity {} ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/annot/Annot.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.apt.annot; import javax.lang.model.element.AnnotationMirror; public interface Annot { AnnotationMirror getAnnotationMirror(); } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/type/PortableObjectType.java ======================= <reponame>orekyuu/doma package org.seasar.doma.jdbc.type; import java.sql.*; /** * A JDBC type for {@link Types#OTHER}. * * @see PreparedStatement#setObject(int, Object, int) */ public class PortableObjectType<T> extends AbstractJdbcType<T> { private final JdbcType<T> baseType; public PortableObjectType(JdbcType<T> baseType) { super(Types.OTHER); this.baseType = baseType; } @Override public T doGetValue(ResultSet resultSet, int index) throws SQLException { return baseType.getValue(resultSet, index); } @Override protected void doSetValue(PreparedStatement preparedStatement, int index, T value) throws SQLException { preparedStatement.setObject(index, value, this.type); } @Override protected T doGetValue(CallableStatement callableStatement, int index) throws SQLException { return baseType.getValue(callableStatement, index); } @Override protected String doConvertToLogFormat(T value) { return baseType.convertToLogFormat(value); } } ======================= File: doma-core/src/test/java/org/seasar/doma/jdbc/command/DeleteCommandTest.java ======================= <gh_stars>100-1000 package org.seasar.doma.jdbc.command; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; import example.entity.Emp; import example.entity._Emp; import java.lang.reflect.Method; import java.math.BigDecimal; import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; import org.seasar.doma.internal.jdbc.mock.BindValue; import org.seasar.doma.internal.jdbc.mock.MockConfig; import org.seasar.doma.internal.jdbc.mock.MockConnection; import org.seasar.doma.internal.jdbc.mock.MockPreparedStatement; import org.seasar.doma.jdbc.OptimisticLockException; import org.seasar.doma.jdbc.SqlLogType; import org.seasar.doma.jdbc.query.AutoDeleteQuery; @SuppressWarnings("OptionalGetWithoutIsPresent") public class DeleteCommandTest { private final MockConfig runtimeConfig = new MockConfig(); private Method method; @BeforeEach protected void setUp(TestInfo testInfo) { method = testInfo.getTestMethod().get(); } @Test public void testExecute() { Emp emp = new Emp(); emp.setId(1); emp.setName("hoge"); emp.setSalary(new BigDecimal(1000)); emp.setVersion(10); AutoDeleteQuery<Emp> query = new AutoDeleteQuery<>(_Emp.getSingletonInternal()); query.setMethod(method); query.setConfig(runtimeConfig); query.setEntity(emp); query.setCallerClassName("aaa"); query.setCallerMethodName("bbb"); query.setSqlLogType(SqlLogType.FORMATTED); query.prepare(); int rows = new DeleteCommand(query).execute(); query.complete(); assertEquals(1, rows); String sql = runtimeConfig.dataSource.connection.preparedStatement.sql; assertEquals("delete from EMP where ID =? and VERSION =?", sql); List<BindValue> bindValues = runtimeConfig.dataSource.connection.preparedStatement.bindValues; assertEquals(2, bindValues.size()); assertEquals(1, bindValues.get(0).getValue()); assertEquals(10, bindValues.get(1).getValue()); } @Test public void testExecute_throwsOptimisticLockException() { Emp emp = new Emp(); emp.setId(10); emp.setName("aaa"); emp.setVersion(100); MockPreparedStatement ps = new MockPreparedStatement(); ps.updatedRows = 0; runtimeConfig.dataSource.connection = new MockConnection(ps); AutoDeleteQuery<Emp> query = new AutoDeleteQuery<>(_Emp.getSingletonInternal()); query.setMethod(method); query.setConfig(runtimeConfig); query.setEntity(emp); query.setCallerClassName("aaa"); query.setCallerMethodName("bbb"); query.setSqlLogType(SqlLogType.FORMATTED); query.prepare(); DeleteCommand command = new DeleteCommand(query); try { command.execute(); fail(); } catch (OptimisticLockException expected) { } } @Test public void testExecute_suppressesOptimisticLockException() { Emp emp = new Emp(); emp.setId(10); emp.setName("aaa"); emp.setVersion(100); AutoDeleteQuery<Emp> query = new AutoDeleteQuery<>(_Emp.getSingletonInternal()); query.setMethod(method); query.setConfig(runtimeConfig); query.setEntity(emp); query.setCallerClassName("aaa"); query.setCallerMethodName("bbb"); query.setOptimisticLockExceptionSuppressed(true); query.setSqlLogType(SqlLogType.FORMATTED); query.prepare(); new DeleteCommand(query).execute(); query.complete(); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/entity/AbstractEntityListenerContext.java ======================= package org.seasar.doma.internal.jdbc.entity; import static org.seasar.doma.internal.util.AssertionUtil.*; import java.lang.reflect.Method; import org.seasar.doma.DomaNullPointerException; import org.seasar.doma.jdbc.Config; import org.seasar.doma.jdbc.entity.EntityType; public abstract class AbstractEntityListenerContext<E> { protected final EntityType<E> entityType; protected final Method method; protected final Config config; protected E newEntity; protected AbstractEntityListenerContext(EntityType<E> entityType, Method method, Config config) { assertNotNull(entityType, method, config); this.entityType = entityType; this.method = method; this.config = config; } @SuppressWarnings("BooleanMethodIsAlwaysInverted") protected boolean isPropertyDefinedInternal(String propertyName) { assertNotNull(propertyName); return entityType.getEntityPropertyType(propertyName)!= null; } public EntityType<E> getEntityType() { return entityType; } public Method getMethod() { return method; } public Config getConfig() { return config; } public E getNewEntity() { return this.newEntity; } public void setNewEntity(E newEntity) { if (newEntity == null) { throw new DomaNullPointerException("newEntity"); } this.newEntity = newEntity; } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/validator/BatchSqlValidator.java ======================= package org.seasar.doma.internal.apt.validator; import java.util.LinkedHashMap; import javax.lang.model.element.ExecutableElement; import javax.lang.model.type.TypeMirror; import javax.tools.Diagnostic.Kind; import org.seasar.doma.Suppress; import org.seasar.doma.internal.apt.Context; import org.seasar.doma.internal.jdbc.sql.node.EmbeddedVariableNode; import org.seasar.doma.internal.jdbc.sql.node.ForNode; import org.seasar.doma.internal.jdbc.sql.node.IfNode; import org.seasar.doma.message.Message; public class BatchSqlValidator extends SqlValidator { private boolean embeddedVariableWarningNotified; private boolean ifWarningNotified; private boolean forWarningNotified; private final Suppress suppress; public BatchSqlValidator( Context ctx, ExecutableElement methodElement, LinkedHashMap<String, TypeMirror> parameterTypeMap, String path, boolean expandable, boolean populatable) { super(ctx, methodElement, parameterTypeMap, path, expandable, populatable); suppress = methodElement.getAnnotation(Suppress.class); } @Override public Void visitEmbeddedVariableNode(EmbeddedVariableNode node, Void p) { if (!isSuppressed(Message.DOMA4181) &&!embeddedVariableWarningNotified) { ctx.getReporter().report(Kind.WARNING, Message.DOMA4181, methodElement, new Object[] {path}); embeddedVariableWarningNotified = true; } return super.visitEmbeddedVariableNode(node, p); } @Override public Void visitIfNode(IfNode node, Void p) { if (!isSuppressed(Message.DOMA4182) &&!ifWarningNotified) { ctx.getReporter().report(Kind.WARNING, Message.DOMA4182, methodElement, new Object[] {path}); ifWarningNotified = true; } return super.visitIfNode(node, p); } @Override public Void visitForNode(ForNode node, Void p) { if (!isSuppressed(Message.DOMA4183) &&!forWarningNotified) { ctx.getReporter().report(Kind.WARNING, Message.DOMA4183, methodElement, new Object[] {path}); forWarningNotified = true; } return super.visitForNode(node, p); } @SuppressWarnings("BooleanMethodIsAlwaysInverted") private boolean isSuppressed(Message message) { if (suppress!= null) { for (Message suppressMessage : suppress.messages()) { if (suppressMessage == message) { return true; } } } return false; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/statement/EmptySql.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/jdbc/criteria/statement/EmptySql.java package org.seasar.doma.jdbc.criteria.statement; import java.util.Collections; import java.util.List; import java.util.Objects; import org.seasar.doma.jdbc.InParameter; import org.seasar.doma.jdbc.Sql; import org.seasar.doma.jdbc.SqlKind; import org.seasar.doma.jdbc.SqlLogType; public class EmptySql implements Sql<InParameter<?>> { private static final String MESSAGE = "This SQL is empty because target entities are empty."; private final SqlKind sqlKind; public EmptySql(SqlKind sqlKind) { this.sqlKind = Objects.requireNonNull(sqlKind); } @Override public SqlKind getKind() { return sqlKind; } @Override public String getRawSql() { return MESSAGE; } @Override public String getFormattedSql() { return MESSAGE; } @Override public String getSqlFilePath() { return null; } @Override public List<InParameter<?>> getParameters() { return Collections.emptyList(); } @Override public SqlLogType getSqlLogType() { return SqlLogType.FORMATTED; } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/parameter/CallableSqlParameterMetaVisitor.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.apt.meta.parameter; public interface CallableSqlParameterMetaVisitor<R, P> { R visitBasicInParameterMeta(BasicInParameterMeta m, P p); R visitBasicOutParameterMeta(BasicOutParameterMeta m, P p); R visitBasicInOutParameterMeta(BasicInOutParameterMeta m, P p); R visitBasicListParameterMeta(BasicListParameterMeta m, P p); R visitBasicSingleResultParameterMeta(BasicSingleResultParameterMeta m, P p); R visitBasicResultListParameterMeta(BasicResultListParameterMeta m, P p); R visitDomainInParameterMeta(DomainInParameterMeta m, P p); R visitDomainOutParameterMeta(DomainOutParameterMeta m, P p); R visitDomainInOutParameterMeta(DomainInOutParameterMeta m, P p); R visitDomainListParameterMeta(DomainListParameterMeta m, P p); R visitDomainSingleResultParameterMeta(DomainSingleResultParameterMeta m, P p); R visitDomainResultListParameterMeta(DomainResultListParameterMeta m, P p); R visitEntityListParameterMeta(EntityListParameterMeta m, P p); R visitEntityResultListParameterMeta(EntityResultListParameterMeta m, P p); R visitMapListParameterMeta(MapListParameterMeta m, P p); R visitMapResultListParameterMeta(MapResultListParameterMeta m, P p); R visitOptionalBasicInParameterMeta(OptionalBasicInParameterMeta m, P p); R visitOptionalBasicOutParameterMeta(OptionalBasicOutParameterMeta m, P p); R visitOptionalBasicInOutParameterMeta(OptionalBasicInOutParameterMeta m, P p); R visitOptionalBasicListParameterMeta(OptionalBasicListParameterMeta m, P p); R visitOptionalBasicSingleResultParameterMeta(OptionalBasicSingleResultParameterMeta m, P p); R visitOptionalBasicResultListParameterMeta(OptionalBasicResultListParameterMeta m, P p); R visitOptionalDomainInParameterMeta(OptionalDomainInParameterMeta m, P p); R visitOptionalDomainOutParameterMeta(OptionalDomainOutParameterMeta m, P p); R visitOptionalDomainInOutParameterMeta(OptionalDomainInOutParameterMeta m, P p); R visitOptionalDomainListParameterMeta(OptionalDomainListParameterMeta m, P p); R visitOptionalDomainSingleResultParameterMeta(OptionalDomainSingleResultParameterMeta m, P p); R visitOptionalDomainResultListParameterMeta(OptionalDomainResultListParameterMeta m, P p); R visitOptionalIntInParameterMeta(OptionalIntInParameterMeta m, P p); R visitOptionalIntOutParameterMeta(OptionalIntOutParameterMeta m, P p); R visitOptionalIntInOutParameterMeta(OptionalIntInOutParameterMeta m, P p); R visitOptionalIntListParameterMeta(OptionalIntListParameterMeta m, P p); R visitOptionalIntSingleResultParameterMeta(OptionalIntSingleResultParameterMeta m, P p); R visitOptionalIntResultListParameterMeta(OptionalIntResultListParameterMeta m, P p); R visitOptionalLongInParameterMeta(OptionalLongInParameterMeta m, P p); R visitOptionalLongOutParameterMeta(OptionalLongOutParameterMeta m, P p); R visitOptionalLongInOutParameterMeta(OptionalLongInOutParameterMeta m, P p); R visitOptionalLongListParameterMeta(OptionalLongListParameterMeta m, P p); R visitOptionalLongSingleResultParameterMeta(OptionalLongSingleResultParameterMeta m, P p); R visitOptionalLongResultListParameterMeta(OptionalLongResultListParameterMeta m, P p); R visitOptionalDoubleInParameterMeta(OptionalDoubleInParameterMeta m, P p); R visitOptionalDoubleOutParameterMeta(OptionalDoubleOutParameterMeta m, P p); R visitOptionalDoubleInOutParameterMeta(OptionalDoubleInOutParameterMeta m, P p); R visitOptionalDoubleListParameterMeta(OptionalDoubleListParameterMeta m, P p); R visitOptionalDoubleSingleResultParameterMeta(OptionalDoubleSingleResultParameterMeta m, P p); R visitOptionalDoubleResultListParameterMeta(OptionalDoubleResultListParameterMeta m, P p); } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/ScalarSingleResultHandler.java ======================= package org.seasar.doma.internal.jdbc.command; import java.util.function.Supplier; import org.seasar.doma.internal.jdbc.scalar.Scalar; public class ScalarSingleResultHandler<BASIC, CONTAINER> extends AbstractSingleResultHandler<CONTAINER> { public ScalarSingleResultHandler(Supplier<Scalar<BASIC, CONTAINER>> supplier) { super( new ScalarIterationHandler<>( supplier, new SingleResultCallback<>(() -> supplier.get().getDefault()))); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/domain/LombokValueAccessorMethod_boolean.java ======================= <filename>doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/domain/LombokValueAccessorMethod_boolean.java package org.seasar.doma.internal.apt.processor.domain; import org.seasar.doma.Domain; import org.seasar.doma.internal.apt.lombok.Value; @Domain(valueType = boolean.class) @Value public class LombokValueAccessorMethod_boolean { @SuppressWarnings("unused") private boolean value; } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/AptIllegalOptionException.java ======================= package org.seasar.doma.internal.apt; public class AptIllegalOptionException extends RuntimeException { private static final long serialVersionUID = 1L; public AptIllegalOptionException(String message) { super(message); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/util/Zip.java ======================= package org.seasar.doma.internal.util; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import java.util.Iterator; import java.util.Spliterators; import java.util.stream.Stream; import java.util.stream.StreamSupport; public final class Zip { public static <T, U> Stream<Pair<T, U>> stream(Stream<T> first, Stream<U> second) { assertNotNull(first, second); return streamInternal(first.iterator(), second.iterator()); } public static <T, U> Stream<Pair<T, U>> stream(Iterable<T> first, Iterable<U> second) { assertNotNull(first, second); return streamInternal(first.iterator(), second.iterator()); } public static <T, U> Stream<Pair<T, U>> streamInternal(Iterator<T> first, Iterator<U> second) { Iterator<Pair<T, U>> iterator = new Iterator<Pair<T, U>>() { @Override public boolean hasNext() { return first.hasNext() && second.hasNext(); } @Override public Pair<T, U> next() { return new Pair<>(first.next(), second.next()); } }; return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/query/AbstractSqlFileQueryMeta.java ======================= package org.seasar.doma.internal.apt.meta.query; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import org.seasar.doma.internal.apt.annot.SqlAnnot; import org.seasar.doma.internal.jdbc.util.SqlFileUtil; abstract class AbstractSqlFileQueryMeta extends AbstractQueryMeta { SqlAnnot sqlAnnot; AbstractSqlFileQueryMeta(TypeElement daoElement, ExecutableElement methodElement) { super(daoElement, methodElement); } public SqlAnnot getSqlAnnot() { return sqlAnnot; } public void setSqlAnnot(SqlAnnot sqlAnnot) { this.sqlAnnot = sqlAnnot; } public String getPath() { if (sqlAnnot == null) { // sql file path return SqlFileUtil.buildPath(getDaoElement().getQualifiedName().toString(), getName()); } return buildQualifiedMethodName(); } String buildQualifiedMethodName() { return String.format("%s#%s", getDaoElement().getQualifiedName(), getName()); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/domain/DayConvertersProvider.java ======================= package org.seasar.doma.internal.apt.processor.domain; import org.seasar.doma.DomainConverters; @DomainConverters({MondayConverter.class, WednesdayConverter.class}) public class DayConvertersProvider {} ======================= File: doma-core/src/main/java/org/seasar/doma/SequenceGenerator.java ======================= package org.seasar.doma; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.seasar.doma.jdbc.id.BuiltinSequenceIdGenerator; import org.seasar.doma.jdbc.id.SequenceIdGenerator; /** * Indicates an identifier generator that uses a sequence. * * <p>The annotated field must be a member of an {@link Entity} annotated class. This annotation * must be used in conjunction with the {@link Id} annotation and the {@link GeneratedValue} * annotation. * * <pre> * &#064;Entity * public class Employee { * * &#064;Id * &#064;GeneratedValue(strategy = GenerationType.SEQUENCE) * &#064;SequenceGenerator(sequence = &quot;EMPLOYEE_SEQ&quot;) * Integer id; * * ... * } * </pre> */ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface SequenceGenerator { /** @return the catalog name. */ String catalog() default ""; /** @return the schema name. */ String schema() default ""; /** @return the sequence name. */ String sequence(); /** @return the initial value. */ long initialValue() default 1; /** @return the allocation size. */ long allocationSize() default 1; /** @return the implementation class of the {@link SequenceIdGenerator} interface. */ Class<? extends SequenceIdGenerator> implementer() default BuiltinSequenceIdGenerator.class; } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/PrimitivePropertyEntity.java ======================= package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.Entity; import org.seasar.doma.Id; import org.seasar.doma.Version; @Entity public class PrimitivePropertyEntity { @Id int id; boolean bool; @Version long version; public int getId() { return id; } public void setId(int id) { this.id = id; } public boolean isBool() { return bool; } public void setBool(boolean bool) { this.bool = bool; } public long getVersion() { return version; } public void setVersion(long version) { this.version = version; } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/id/IdentityIdGeneratorMeta.java ======================= package org.seasar.doma.internal.apt.meta.id; import org.seasar.doma.jdbc.id.BuiltinIdentityIdGenerator; public class IdentityIdGeneratorMeta implements IdGeneratorMeta { @Override public String getIdGeneratorClassName() { return BuiltinIdentityIdGenerator.class.getName(); } @Override public <R, P> R accept(IdGeneratorMetaVisitor<R, P> visitor, P p) { return visitor.visitIdentityIdGeneratorMeta(this, p); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/domain/package-info.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/jdbc/domain/package-info.java<gh_stars>100-1000 /** Provides the classes that are related to domains. */ package org.seasar.doma.jdbc.domain; ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/domain/UUIDConverter.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.apt.processor.domain; import java.util.UUID; import org.seasar.doma.ExternalDomain; import org.seasar.doma.jdbc.domain.DomainConverter; @ExternalDomain public class UUIDConverter implements DomainConverter<UUID, byte[]> { @Override public byte[] fromDomainToValue(UUID domain) { return null; } @Override public UUID fromValueToDomain(byte[] value) { return null; } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/domain/UnsupportedValueTypeDomain.java ======================= package org.seasar.doma.internal.apt.processor.domain; import java.math.BigDecimal; import org.seasar.doma.Domain; @Domain(valueType = Override.class) public class UnsupportedValueTypeDomain { private final BigDecimal value; public UnsupportedValueTypeDomain(BigDecimal value) { this.value = value; } public BigDecimal getValue() { return value; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/query/BatchUpdateQuery.java ======================= package org.seasar.doma.jdbc.query; public interface BatchUpdateQuery extends BatchModifyQuery { void incrementVersions(); } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/ResourcesTest.java ======================= package org.seasar.doma.internal.apt; import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.File; import java.io.InputStream; import java.nio.file.Path; import java.nio.file.Paths; import javax.tools.FileObject; import org.junit.jupiter.api.Test; public class ResourcesTest { @Test public void testFileObjectImpl_toUri() { Path path = Paths.get("aaa", "bbb"); FileObject fileObject = new Resources.FileObjectImpl(path); assertNotNull(fileObject.toUri()); } @Test public void testFileObjectImpl_getName() { Path path = Paths.get("aaa", "bbb"); FileObject fileObject = new Resources.FileObjectImpl(path); assertNotNull(fileObject.getName()); } @Test public void testFileObjectImpl_openInputStream() throws Exception { File file = File.createTempFile("aaa", null); try { FileObject fileObject = new Resources.FileObjectImpl(file.toPath()); try (InputStream is = fileObject.openInputStream()) { //noinspection ResultOfMethodCallIgnored is.read(); } } finally { //noinspection ResultOfMethodCallIgnored file.delete(); } } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/type/DateType.java ======================= package org.seasar.doma.jdbc.type; import java.sql.*; /** A JDBC type for {@link Types#DATE} and {@link Date}. */ public class DateType extends AbstractJdbcType<Date> { public DateType() { super(Types.DATE); } @Override public Date doGetValue(ResultSet resultSet, int index) throws SQLException { return resultSet.getDate(index); } @Override protected void doSetValue(PreparedStatement preparedStatement, int index, Date value) throws SQLException { preparedStatement.setDate(index, value); } @Override protected Date doGetValue(CallableStatement callableStatement, int index) throws SQLException { return callableStatement.getDate(index); } @Override protected String doConvertToLogFormat(Date value) { return "'" + value + "'"; } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/sql/node/OptionClauseNode.java ======================= package org.seasar.doma.internal.jdbc.sql.node; import org.seasar.doma.DomaNullPointerException; import org.seasar.doma.jdbc.SqlNodeVisitor; public class OptionClauseNode extends AbstractClauseNode { public OptionClauseNode(String word) { super(word); } public OptionClauseNode(WordNode wordNode) { super(wordNode); } @Override public <R, P> R accept(SqlNodeVisitor<R, P> visitor, P p) { if (visitor == null) { throw new DomaNullPointerException("visitor"); } return visitor.visitOptionClauseNode(this, p); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/BatchOptimisticLockException.java ======================= package org.seasar.doma.jdbc; import org.seasar.doma.message.Message; /** * Thrown to indicate that optimistic locking is failed in a batch processing. * * <p>{@link #getFormattedSql()} returns {@code null}. */ public class BatchOptimisticLockException extends OptimisticLockException { private static final long serialVersionUID = 1L; public BatchOptimisticLockException(SqlLogType logType, Sql<?> sql) { this(logType, sql.getKind(), sql.getRawSql(), sql.getSqlFilePath()); } public BatchOptimisticLockException( SqlLogType logType, SqlKind kind, String rawSql, String sqlFilePath) { super(Message.DOMA2028, kind, choiceSql(logType, rawSql, rawSql), sqlFilePath); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/NoDefaultConstructorTableIdGeneratorEntity.java ======================= package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.Entity; import org.seasar.doma.GeneratedValue; import org.seasar.doma.GenerationType; import org.seasar.doma.Id; import org.seasar.doma.TableGenerator; @Entity public class NoDefaultConstructorTableIdGeneratorEntity { @Id @GeneratedValue(strategy = GenerationType.TABLE) @TableGenerator(pkColumnValue = "aaa", implementer = NoDefaultConstructorTableIdGenerator.class) Integer id; } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/query/SetOperationBuilder.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/jdbc/criteria/query/SetOperationBuilder.java package org.seasar.doma.jdbc.criteria.query; import java.util.List; import java.util.Objects; import java.util.function.Function; import org.seasar.doma.internal.jdbc.sql.PreparedSqlBuilder; import org.seasar.doma.internal.util.Pair; import org.seasar.doma.jdbc.Config; import org.seasar.doma.jdbc.PreparedSql; import org.seasar.doma.jdbc.SqlKind; import org.seasar.doma.jdbc.SqlLogType; import org.seasar.doma.jdbc.criteria.context.OrderByItem; import org.seasar.doma.jdbc.criteria.context.SelectContext; import org.seasar.doma.jdbc.criteria.context.SetOperationContext; public class SetOperationBuilder { private final Config config; private final SetOperationContext<?> context; private final Function<String, String> commenter; private final PreparedSqlBuilder buf; public SetOperationBuilder( Config config, SetOperationContext<?> context, Function<String, String> commenter, SqlLogType sqlLogType) { this.config = Objects.requireNonNull(config); this.context = Objects.requireNonNull(context); this.commenter = Objects.requireNonNull(commenter); Objects.requireNonNull(sqlLogType); this.buf = new PreparedSqlBuilder(config, SqlKind.SELECT, sqlLogType); } public PreparedSql build() { context.accept( new SetOperationContext.Visitor<Void>() { @Override public Void visit(SetOperationContext.Select<?> select) { SelectContext context = select.context; SelectBuilder builder = new SelectBuilder(config, context, commenter, buf, new AliasManager(context)); builder.interpret(); return null; } @Override public Void visit(SetOperationContext.Union<?> union) { union("union", union.left, union.right, union.orderBy); return null; } @Override public Void visit(SetOperationContext.UnionAll<?> unionAll) { union("union all", unionAll.left, unionAll.right, unionAll.orderBy); return null; } private void union( String op, SetOperationContext<?> left, SetOperationContext<?> right, List<Pair<OrderByItem.Index, String>> orderBy) { String open; String close; if (orderBy.isEmpty()) { open = ""; close = ""; } else { open = "("; close = ")"; } buf.appendSql(open); left.accept(this); buf.appendSql(close + " " + op + " " + open); right.accept(this); buf.appendSql(close); orderBy(orderBy); } private void orderBy(List<Pair<OrderByItem.Index, String>> orderBy) { if (!orderBy.isEmpty()) { buf.appendSql(" order by "); for (Pair<OrderByItem.Index, String> pair : orderBy) { OrderByItem.Index index = pair.fst; buf.appendSql(String.valueOf(index.value)); buf.appendSql(" " + pair.snd + ", "); } buf.cutBackSql(2); } } }); return buf.build(commenter); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/scalar/ScalarException.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.jdbc.scalar; import org.seasar.doma.DomaException; import org.seasar.doma.message.Message; public class ScalarException extends DomaException { private static final long serialVersionUID = 1L; public ScalarException(Message messageCode, Object... args) { super(messageCode, args); } public ScalarException(Message messageCode, Throwable cause, Object... args) { super(messageCode, cause, args); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/query/ArrayCreateQuery.java ======================= package org.seasar.doma.jdbc.query; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import java.sql.Array; import java.sql.Connection; import java.sql.SQLException; public class ArrayCreateQuery extends AbstractCreateQuery<Array> { protected String typeName; protected Object[] elements; @Override public void prepare() { super.prepare(); assertNotNull(typeName, elements); } public String getTypeName() { return typeName; } public void setTypeName(String typeName) { this.typeName = typeName; } public Object[] getElements() { return elements; } public void setElements(Object[] elements) { this.elements = elements; } @Override public Array create(Connection connection) throws SQLException { return connection.createArrayOf(typeName, elements); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/BasicCollectorHandler.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.jdbc.command; import java.util.function.Supplier; import java.util.stream.Collector; import org.seasar.doma.internal.jdbc.scalar.BasicScalar; import org.seasar.doma.wrapper.Wrapper; public class BasicCollectorHandler<BASIC, RESULT> extends ScalarCollectorHandler<BASIC, BASIC, RESULT> { public BasicCollectorHandler( Supplier<Wrapper<BASIC>> supplier, Collector<BASIC,?, RESULT> collector) { super(() -> new BasicScalar<>(supplier), collector); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/metamodel/Salesman.java ======================= package org.seasar.doma.internal.apt.processor.metamodel; import org.seasar.doma.Entity; import org.seasar.doma.Metamodel; @SuppressWarnings("DefaultAnnotationParam") @Entity(metamodel = @Metamodel(prefix = "_", suffix = "")) public class Salesman {} ======================= File: doma-core/src/test/java/org/seasar/doma/internal/jdbc/command/ScriptTokenizerTest.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.jdbc.command; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.seasar.doma.internal.jdbc.command.ScriptTokenType.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class ScriptTokenizerTest { private ScriptTokenizer tokenizer; @BeforeEach public void setUp() { tokenizer = new ScriptTokenizer("/"); } @Test public void testGetToken_endOfLine() { tokenizer.addLine("aaa"); assertEquals(WORD, tokenizer.nextToken()); assertEquals("aaa", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); assertEquals("", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); assertEquals("", tokenizer.getToken()); } @Test public void testGetToken_endOfFile() { tokenizer.addLine("aaa"); assertEquals(WORD, tokenizer.nextToken()); assertEquals("aaa", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); assertEquals("", tokenizer.getToken()); tokenizer.addLine(null); assertEquals(END_OF_FILE, tokenizer.nextToken()); assertNull(tokenizer.getToken()); assertEquals(END_OF_FILE, tokenizer.nextToken()); assertNull(tokenizer.getToken()); } @Test public void testGetToken_lineComment() { tokenizer.addLine("aaa -- bbb /* ; "); assertEquals(WORD, tokenizer.nextToken()); assertEquals("aaa", tokenizer.getToken()); assertEquals(OTHER, tokenizer.nextToken()); assertEquals(" ", tokenizer.getToken()); assertEquals(LINE_COMMENT, tokenizer.nextToken()); assertEquals("-- bbb /* ; ", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); } @Test public void testGetToken_blockCommentInTwoLines() { tokenizer.addLine("aaa/*b"); assertEquals(WORD, tokenizer.nextToken()); assertEquals("aaa", tokenizer.getToken()); assertEquals(START_OF_BLOCK_COMMENT, tokenizer.nextToken()); assertEquals("/*", tokenizer.getToken()); assertEquals(BLOCK_COMMENT, tokenizer.nextToken()); assertEquals("b", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); assertEquals("", tokenizer.getToken()); tokenizer.addLine("bb*/ccc"); assertEquals(BLOCK_COMMENT, tokenizer.nextToken()); assertEquals("bb", tokenizer.getToken()); assertEquals(END_OF_BLOCK_COMMENT, tokenizer.nextToken()); assertEquals("*/", tokenizer.getToken()); assertEquals(WORD, tokenizer.nextToken()); assertEquals("ccc", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); } @Test public void testGetToken_blockCommentsInOneLine() { tokenizer.addLine("aaa/*bbb*/ccc/*ddd*/"); assertEquals(WORD, tokenizer.nextToken()); assertEquals("aaa", tokenizer.getToken()); assertEquals(START_OF_BLOCK_COMMENT, tokenizer.nextToken()); assertEquals("/*", tokenizer.getToken()); assertEquals(BLOCK_COMMENT, tokenizer.nextToken()); assertEquals("bbb", tokenizer.getToken()); assertEquals(END_OF_BLOCK_COMMENT, tokenizer.nextToken()); assertEquals("*/", tokenizer.getToken()); assertEquals(WORD, tokenizer.nextToken()); assertEquals("ccc", tokenizer.getToken()); assertEquals(START_OF_BLOCK_COMMENT, tokenizer.nextToken()); assertEquals("/*", tokenizer.getToken()); assertEquals(BLOCK_COMMENT, tokenizer.nextToken()); assertEquals("ddd", tokenizer.getToken()); assertEquals(END_OF_BLOCK_COMMENT, tokenizer.nextToken()); assertEquals("*/", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); } @Test public void testGetToken_statementDelimiter() { tokenizer.addLine("select * from aaa; "); assertEquals(WORD, tokenizer.nextToken()); assertEquals("select", tokenizer.getToken()); assertEquals(OTHER, tokenizer.nextToken()); assertEquals(" * ", tokenizer.getToken()); assertEquals(WORD, tokenizer.nextToken()); assertEquals("from", tokenizer.getToken()); assertEquals(OTHER, tokenizer.nextToken()); assertEquals(" ", tokenizer.getToken()); assertEquals(WORD, tokenizer.nextToken()); assertEquals("aaa", tokenizer.getToken()); assertEquals(STATEMENT_DELIMITER, tokenizer.nextToken()); assertEquals(";", tokenizer.getToken()); assertEquals(OTHER, tokenizer.nextToken()); assertEquals(" ", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); } @Test public void testGetToken_blockDelimiter() { tokenizer.addLine("aaa go"); assertEquals(WORD, tokenizer.nextToken()); assertEquals("aaa", tokenizer.getToken()); assertEquals(OTHER, tokenizer.nextToken()); assertEquals(" ", tokenizer.getToken()); assertEquals(WORD, tokenizer.nextToken()); assertEquals("go", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); assertEquals("", tokenizer.getToken()); tokenizer.addLine("/ "); assertEquals(BLOCK_DELIMITER, tokenizer.nextToken()); assertEquals("/ ", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); } @Test public void testGetToken_wordAndOther() { tokenizer.addLine("select,"); assertEquals(WORD, tokenizer.nextToken()); assertEquals("select", tokenizer.getToken()); assertEquals(OTHER, tokenizer.nextToken()); assertEquals(",", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); assertEquals("", tokenizer.getToken()); tokenizer.addLine("bbb"); assertEquals(WORD, tokenizer.nextToken()); assertEquals("bbb", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); } @Test public void testGetToken_quote() { tokenizer.addLine("'aaa'"); assertEquals(QUOTE, tokenizer.nextToken()); assertEquals("'aaa'", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); } @Test public void testGetToken_quoteNotClosed() { tokenizer.addLine("'aaa"); assertEquals(QUOTE, tokenizer.nextToken()); assertEquals("'aaa", tokenizer.getToken()); assertEquals(END_OF_LINE, tokenizer.nextToken()); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/query/BlobCreateQuery.java ======================= package org.seasar.doma.jdbc.query; import java.sql.Blob; import java.sql.Connection; import java.sql.SQLException; public class BlobCreateQuery extends AbstractCreateQuery<Blob> { @Override public Blob create(Connection connection) throws SQLException { return connection.createBlob(); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/EntityListenerProvider.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/jdbc/EntityListenerProvider.java<gh_stars>100-1000 package org.seasar.doma.jdbc; import java.util.function.Supplier; import org.seasar.doma.jdbc.entity.EntityListener; /** * A provider for an {@link EntityListener} object. * * @author backpaper0 */ public interface EntityListenerProvider { /** * Returns an {@link EntityListener} object. * * <p>This method must not return {@code null}. * * @param listenerClass the implementation class of {@link EntityListener} * @param listenerSupplier the {@link Supplier} object that provides an {@link EntityListener} * object * @param <ENTITY> the entity type * @param <LISTENER> the entity listener type * @return an {@link EntityListener} object */ default <ENTITY, LISTENER extends EntityListener<ENTITY>> LISTENER get( Class<LISTENER> listenerClass, Supplier<LISTENER> listenerSupplier) { return listenerSupplier.get(); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/type/ArrayType.java ======================= <reponame>orekyuu/doma package org.seasar.doma.jdbc.type; import java.sql.*; /** A JDBC type for {@link Types#ARRAY} and {@link Array}. */ public class ArrayType extends AbstractJdbcType<Array> { public ArrayType() { super(Types.ARRAY); } @Override protected Array doGetValue(ResultSet resultSet, int index) throws SQLException { return resultSet.getArray(index); } @Override protected void doSetValue(PreparedStatement preparedStatement, int index, Array value) throws SQLException { preparedStatement.setArray(index, value); } @Override protected Array doGetValue(CallableStatement callableStatement, int index) throws SQLException { return callableStatement.getArray(index); } @Override protected String doConvertToLogFormat(Array value) { return "'" + value + "'"; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/command/EntityKey.java ======================= package org.seasar.doma.jdbc.criteria.command; import java.util.Collections; import java.util.List; import java.util.Objects; import org.seasar.doma.jdbc.criteria.metamodel.EntityMetamodel; public final class EntityKey { private final EntityMetamodel<?> entityMetamodel; private final List<?> items; public EntityKey(EntityMetamodel<?> entityMetamodel, List<?> items) { this.entityMetamodel = Objects.requireNonNull(entityMetamodel); Objects.requireNonNull(items); this.items = Collections.unmodifiableList(items); } public EntityMetamodel<?> getEntityMetamodel() { return entityMetamodel; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof EntityKey)) return false; EntityKey entityKey = (EntityKey) o; return entityMetamodel.equals(entityKey.entityMetamodel) && items.equals(entityKey.items); } @Override public int hashCode() { return Objects.hash(entityMetamodel, items); } } ======================= File: doma-core/src/main/java/org/seasar/doma/Domain.java ======================= package org.seasar.doma; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Indicates a domain class. * * <p>The domain class is the user defined type that wraps a basic value. It can be mapped to a * database column. * * <p>Instantiation by constructor: * * <pre> * &#064;Domain(valueType = String.class) * public class PhoneNumber { * * private final String value; * * public PhoneNumber(String value) { * this.value = value; * } * * public String getValue() { * return value; * } * } * </pre> * * Instantiation by factory method: * * <pre> * &#064;Domain(valueType = String.class, factoryMethod = &quot;of&quot;) * public class PhoneNumber { * * private final String value; * * private PhoneNumber(String value) { * this.value = value; * } * * public String getValue() { * return value; * } * * public static PhoneNumber of(String value) { * return new PhoneNumber(value); * } * } * </pre> */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Domain { /** @return the value type that is wrapped by the domain class. */ Class<?> valueType(); /** * The factory method name. * * <p>The factory method that accepts the wrapped value as an argument. * * <p>The default value {@code "new"} means constructor usage. * * @return the method name */ String factoryMethod() default "new"; /** * The accessor method name. * * <p>The accessor method returns the wrapped value. * * @return the method name */ String accessorMethod() default "getValue"; /** @return whether the constructor or the factory method accepts {@code null} as an argument. */ boolean acceptNull() default false; } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/query/NClobCreateQuery.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/jdbc/query/NClobCreateQuery.java package org.seasar.doma.jdbc.query; import java.sql.Connection; import java.sql.NClob; import java.sql.SQLException; public class NClobCreateQuery extends AbstractCreateQuery<NClob> { @Override public NClob create(Connection connection) throws SQLException { return connection.createNClob(); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/OptionalLongSingleResultHandler.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/OptionalLongSingleResultHandler.java package org.seasar.doma.internal.jdbc.command; import java.util.OptionalLong; import org.seasar.doma.internal.jdbc.scalar.OptionalLongScalar; public class OptionalLongSingleResultHandler extends ScalarSingleResultHandler<Long, OptionalLong> { public OptionalLongSingleResultHandler() { super(OptionalLongScalar::new); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/BranchConverter.java ======================= <filename>doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/BranchConverter.java package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.jdbc.domain.DomainConverter; public class BranchConverter implements DomainConverter<Branch, String> { @Override public String fromDomainToValue(Branch domain) { return null; } @Override public Branch fromValueToDomain(String value) { return null; } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/dialect/MssqlPagingTransformer.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/internal/jdbc/dialect/MssqlPagingTransformer.java package org.seasar.doma.internal.jdbc.dialect; import org.seasar.doma.internal.jdbc.sql.node.FragmentNode; import org.seasar.doma.internal.jdbc.sql.node.OrderByClauseNode; import org.seasar.doma.internal.jdbc.sql.node.SelectStatementNode; import org.seasar.doma.jdbc.JdbcException; import org.seasar.doma.jdbc.SqlNode; import org.seasar.doma.message.Message; public class MssqlPagingTransformer extends Mssql2008PagingTransformer { private final boolean forceOffsetFetch; public MssqlPagingTransformer(long offset, long limit, boolean forceOffsetFetch) { super(offset, limit); this.forceOffsetFetch = forceOffsetFetch; } @Override public SqlNode visitSelectStatementNode(SelectStatementNode node, Void p) { if (processed) { return node; } processed = true; if (!forceOffsetFetch && offset <= 0) { return super.appendTopNode(node); } OrderByClauseNode originalOrderBy = node.getOrderByClauseNode(); if (originalOrderBy == null) { throw new JdbcException(Message.DOMA2201); } OrderByClauseNode orderBy = new OrderByClauseNode(originalOrderBy.getWordNode()); for (SqlNode child : originalOrderBy.getChildren()) { orderBy.appendNode(child); } String offset = this.offset <= 0? "0" : String.valueOf(this.offset); orderBy.appendNode(new FragmentNode(" offset ")); orderBy.appendNode(new FragmentNode(offset)); orderBy.appendNode(new FragmentNode(" rows")); if (this.limit > 0) { orderBy.appendNode(new FragmentNode(" fetch next ")); orderBy.appendNode(new FragmentNode(String.valueOf(this.limit))); orderBy.appendNode(new FragmentNode(" rows only")); } SelectStatementNode result = new SelectStatementNode(); result.setSelectClauseNode(node.getSelectClauseNode()); result.setFromClauseNode(node.getFromClauseNode()); result.setWhereClauseNode(node.getWhereClauseNode()); result.setGroupByClauseNode(node.getGroupByClauseNode()); result.setHavingClauseNode(node.getHavingClauseNode()); result.setOrderByClauseNode(orderBy); result.setForUpdateClauseNode(node.getForUpdateClauseNode()); result.setOptionClauseNode(node.getOptionClauseNode()); return result; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/command/BatchDeleteCommand.java ======================= package org.seasar.doma.jdbc.command; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; import org.seasar.doma.jdbc.PreparedSql; import org.seasar.doma.jdbc.query.BatchDeleteQuery; public class BatchDeleteCommand extends BatchModifyCommand<BatchDeleteQuery> { public BatchDeleteCommand(BatchDeleteQuery query) { super(query); } @Override protected int[] executeInternal(PreparedStatement preparedStatement, List<PreparedSql> sqls) throws SQLException { return executeBatch(preparedStatement, sqls); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/parameter/OptionalDoubleSingleResultParameterMeta.java ======================= package org.seasar.doma.internal.apt.meta.parameter; public class OptionalDoubleSingleResultParameterMeta implements SingleResultParameterMeta { @Override public <R, P> R accept(CallableSqlParameterMetaVisitor<R, P> visitor, P p) { return visitor.visitOptionalDoubleSingleResultParameterMeta(this, p); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/entity/EmbeddablePropertyMetaFactory.java ======================= package org.seasar.doma.internal.apt.meta.entity; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import javax.lang.model.element.VariableElement; import org.seasar.doma.internal.apt.AptException; import org.seasar.doma.internal.apt.Context; import org.seasar.doma.internal.apt.annot.ColumnAnnot; import org.seasar.doma.internal.apt.cttype.*; import org.seasar.doma.message.Message; class EmbeddablePropertyMetaFactory { private final Context ctx; private final VariableElement fieldElement; public EmbeddablePropertyMetaFactory(Context ctx, VariableElement fieldElement) { assertNotNull(ctx, fieldElement); this.ctx = ctx; this.fieldElement = fieldElement; } public EmbeddablePropertyMeta createEmbeddablePropertyMeta() { CtType ctType = ctx.getCtTypes().newCtType(fieldElement.asType(), new CtTypeValidator()); EmbeddablePropertyMeta embeddablePropertyMeta = new EmbeddablePropertyMeta(ctType); embeddablePropertyMeta.setName(fieldElement.getSimpleName().toString()); ColumnAnnot columnAnnot = ctx.getAnnotations().newColumnAnnot(fieldElement); if (columnAnnot!= null) { embeddablePropertyMeta.setColumnAnnot(columnAnnot); } return embeddablePropertyMeta; } private class CtTypeValidator extends SimpleCtTypeVisitor<Void, Void, AptException> { @Override protected Void defaultAction(CtType ctType, Void aVoid) throws AptException { throw new AptException(Message.DOMA4298, fieldElement, new Object[] {ctType.getType()}); } @Override public Void visitBasicCtType(BasicCtType ctType, Void aVoid) throws AptException { return null; } @Override public Void visitOptionalDoubleCtType(OptionalDoubleCtType ctType, Void aVoid) throws AptException { return null; } @Override public Void visitOptionalIntCtType(OptionalIntCtType ctType, Void aVoid) throws AptException { return null; } @Override public Void visitOptionalLongCtType(OptionalLongCtType ctType, Void aVoid) throws AptException { return null; } @Override public Void visitOptionalCtType(OptionalCtType optionalCtType, Void aVoid) throws AptException { if (optionalCtType.isRaw()) { throw new AptException( Message.DOMA4299, fieldElement, new Object[] {optionalCtType.getQualifiedName()}); } if (optionalCtType.hasWildcard()) { throw new AptException( Message.DOMA4301, fieldElement, new Object[] {optionalCtType.getQualifiedName()}); } return null; } @Override public Void visitDomainCtType(DomainCtType domainCtType, Void aVoid) throws AptException { if (domainCtType.isRaw()) { throw new AptException( Message.DOMA4295, fieldElement, new Object[] {domainCtType.getQualifiedName()}); } if (domainCtType.hasWildcard() || domainCtType.hasTypevar()) { throw new AptException( Message.DOMA4296, fieldElement, new Object[] {domainCtType.getQualifiedName()}); } return null; } @Override public Void visitEmbeddableCtType(EmbeddableCtType embeddableCtType, Void aVoid) throws AptException { throw new AptException( Message.DOMA4297, fieldElement, new Object[] {embeddableCtType.getType()}); } } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/cttype/OptionalCtType.java ======================= <filename>doma-processor/src/main/java/org/seasar/doma/internal/apt/cttype/OptionalCtType.java package org.seasar.doma.internal.apt.cttype; import static org.seasar.doma.internal.util.AssertionUtil.*; import javax.lang.model.type.TypeMirror; import org.seasar.doma.internal.apt.Context; public class OptionalCtType extends AbstractCtType { private final CtType elementCtType; OptionalCtType(Context ctx, TypeMirror type, CtType elementCtType) { super(ctx, type); assertNotNull(elementCtType); this.elementCtType = elementCtType; } public CtType getElementCtType() { return elementCtType; } public boolean isRaw() { return elementCtType.isNone(); } public boolean hasWildcard() { return elementCtType.isWildcard(); } @Override public <R, P, TH extends Throwable> R accept(CtTypeVisitor<R, P, TH> visitor, P p) throws TH { return visitor.visitOptionalCtType(this, p); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/embeddable/LombokValue.java ======================= package org.seasar.doma.internal.apt.processor.embeddable; import org.seasar.doma.Embeddable; import org.seasar.doma.internal.apt.lombok.Value; @Embeddable @Value public class LombokValue { @SuppressWarnings("unused") private String street; @SuppressWarnings("unused") private String city; public LombokValue(String street, String city) {} } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/OptionalLongResultListHandler.java ======================= <reponame>orekyuu/doma<filename>doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/OptionalLongResultListHandler.java package org.seasar.doma.internal.jdbc.command; import java.util.OptionalLong; import org.seasar.doma.internal.jdbc.scalar.OptionalLongScalar; public class OptionalLongResultListHandler extends ScalarResultListHandler<Long, OptionalLong> { public OptionalLongResultListHandler() { super(OptionalLongScalar::new); } } ======================= File: doma-core/src/test/java/org/seasar/doma/jdbc/entity/DefaultPropertyTypeTest.java ======================= package org.seasar.doma.jdbc.entity; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import org.junit.jupiter.api.Test; import org.seasar.doma.internal.jdbc.scalar.BasicScalar; import org.seasar.doma.wrapper.IntegerWrapper; import org.seasar.doma.wrapper.PrimitiveIntWrapper; import org.seasar.doma.wrapper.StringWrapper; public class DefaultPropertyTypeTest { private String hoge; private Foo foo; private int primitiveInt; private Integer integer; @SuppressWarnings("ConstantConditions") @Test public void testIsQuoteRequired_true() { boolean isQuoteRequired = true; DefaultPropertyType<DefaultPropertyTypeTest, String, String> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(StringWrapper::new), "hoge", "hoge", NamingType.NONE, true, true, isQuoteRequired); assertEquals("hoge", propertyType.getColumnName((n, t) -> t)); assertEquals("[hoge]", propertyType.getColumnName((n, t) -> t, s -> "[" + s + "]")); } @SuppressWarnings("ConstantConditions") @Test public void testIsQuoteRequired_false() { boolean isQuoteRequired = false; DefaultPropertyType<DefaultPropertyTypeTest, String, String> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(StringWrapper::new), "hoge", "hoge", NamingType.NONE, true, true, isQuoteRequired); assertEquals("hoge", propertyType.getColumnName((n, t) -> t)); assertEquals("hoge", propertyType.getColumnName((n, t) -> t, s -> "[" + s + "]")); } @Test public void testGetColumnName_naming_columnNameDefined() { DefaultPropertyType<DefaultPropertyTypeTest, String, String> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(StringWrapper::new), "hoge", "foo", NamingType.UPPER_CASE, true, true, false); assertEquals("foo", propertyType.getColumnName(NamingType::apply)); } @Test public void testGetColumnName_columnDefined() { DefaultPropertyType<DefaultPropertyTypeTest, String, String> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(StringWrapper::new), "hoge", "foo", NamingType.UPPER_CASE, true, true, false); assertEquals("foo", propertyType.getColumnName()); } @Test public void testGetColumnName_columnNotDefined() { DefaultPropertyType<DefaultPropertyTypeTest, String, String> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(StringWrapper::new), "hoge", "", NamingType.UPPER_CASE, true, true, false); assertEquals("HOGE", propertyType.getColumnName()); } @Test public void testGetColumnName_columnNotDefined_embeddableProperty() { DefaultPropertyType<DefaultPropertyTypeTest, String, String> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(StringWrapper::new), "foo.hoge", "", NamingType.UPPER_CASE, true, true, false); assertEquals("HOGE", propertyType.getColumnName()); } @Test public void testGetColumnName_quote_quoteRequired() { DefaultPropertyType<DefaultPropertyTypeTest, String, String> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(StringWrapper::new), "hoge", "", NamingType.UPPER_CASE, true, true, true); assertEquals("[HOGE]", propertyType.getColumnName(text -> "[" + text + "]")); } @Test public void testGetColumnName_quote_quoteNotRequired() { DefaultPropertyType<DefaultPropertyTypeTest, String, String> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(StringWrapper::new), "hoge", "", NamingType.UPPER_CASE, true, true, false); assertEquals("HOGE", propertyType.getColumnName(text -> "[" + text + "]")); } @Test public void testGetColumnName_naming_columnNotDefined() { DefaultPropertyType<DefaultPropertyTypeTest, String, String> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(StringWrapper::new), "hoge", "", NamingType.UPPER_CASE, true, true, false); assertEquals("HOGE", propertyType.getColumnName(NamingType::apply)); } @Test public void testGetColumnName_naming_quote_quoteRequired() { DefaultPropertyType<DefaultPropertyTypeTest, String, String> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(StringWrapper::new), "hoge", "", NamingType.UPPER_CASE, true, true, true); assertEquals("[HOGE]", propertyType.getColumnName(NamingType::apply, text -> "[" + text + "]")); } @Test public void testGetColumnName_naming_quote_quoteNotRequired() { DefaultPropertyType<DefaultPropertyTypeTest, String, String> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(StringWrapper::new), "hoge", "", NamingType.UPPER_CASE, true, true, false); assertEquals("HOGE", propertyType.getColumnName(NamingType::apply, text -> "[" + text + "]")); } @Test public void testPrimitivePropertyDefaultValue() { DefaultPropertyType<DefaultPropertyTypeTest, Integer, Integer> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(PrimitiveIntWrapper::new), "primitiveInt", "primitiveInt", NamingType.NONE, true, true, false); Property<DefaultPropertyTypeTest, Integer> property = propertyType.createProperty(); assertEquals(0, property.get()); } @Test public void testWrapperPropertyDefaultValue() { DefaultPropertyType<DefaultPropertyTypeTest, Integer, Integer> propertyType = new DefaultPropertyType<>( DefaultPropertyTypeTest.class, () -> new BasicScalar<>(IntegerWrapper::new), "integer", "integer", NamingType.NONE, true, true, false); Property<DefaultPropertyTypeTest, Integer> property = propertyType.createProperty(); assertNull(property.get()); } public static class Foo { String hoge; } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/expr/ExpressionReducer.java ======================= package org.seasar.doma.internal.expr; import static org.seasar.doma.internal.util.AssertionUtil.*; import java.util.Deque; import java.util.Iterator; import org.seasar.doma.internal.expr.node.AddOperatorNode; import org.seasar.doma.internal.expr.node.AndOperatorNode; import org.seasar.doma.internal.expr.node.CommaOperatorNode; import org.seasar.doma.internal.expr.node.DivideOperatorNode; import org.seasar.doma.internal.expr.node.EmptyNode; import org.seasar.doma.internal.expr.node.EqOperatorNode; import org.seasar.doma.internal.expr.node.ExpressionLocation; import org.seasar.doma.internal.expr.node.ExpressionNode; import org.seasar.doma.internal.expr.node.ExpressionNodeVisitor; import org.seasar.doma.internal.expr.node.FieldOperatorNode; import org.seasar.doma.internal.expr.node.FunctionOperatorNode; import org.seasar.doma.internal.expr.node.GeOperatorNode; import org.seasar.doma.internal.expr.node.GtOperatorNode; import org.seasar.doma.internal.expr.node.LeOperatorNode; import org.seasar.doma.internal.expr.node.LiteralNode; import org.seasar.doma.internal.expr.node.LtOperatorNode; import org.seasar.doma.internal.expr.node.MethodOperatorNode; import org.seasar.doma.internal.expr.node.ModOperatorNode; import org.seasar.doma.internal.expr.node.MultiplyOperatorNode; import org.seasar.doma.internal.expr.node.NeOperatorNode; import org.seasar.doma.internal.expr.node.NewOperatorNode; import org.seasar.doma.internal.expr.node.NotOperatorNode; import org.seasar.doma.internal.expr.node.OperatorNode; import org.seasar.doma.internal.expr.node.OrOperatorNode; import org.seasar.doma.internal.expr.node.ParensNode; import org.seasar.doma.internal.expr.node.StaticFieldOperatorNode; import org.seasar.doma.internal.expr.node.StaticMethodOperatorNode; import org.seasar.doma.internal.expr.node.SubtractOperatorNode; import org.seasar.doma.internal.expr.node.VariableNode; import org.seasar.doma.message.Message; public class ExpressionReducer implements ExpressionNodeVisitor<Void, Deque<ExpressionNode>> { public void reduce(OperatorNode operator, Deque<ExpressionNode> operands) { operator.accept(this, operands); } @Override public Void visitEqOperatorNode(EqOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitNeOperatorNode(NeOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitGeOperatorNode(GeOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitGtOperatorNode(GtOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitLeOperatorNode(LeOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitLtOperatorNode(LtOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitOrOperatorNode(OrOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitAndOperatorNode(AndOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitNotOperatorNode(NotOperatorNode node, Deque<ExpressionNode> p) { node.setNode(pop(node, p)); return null; } @Override public Void visitAddOperatorNode(AddOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitSubtractOperatorNode(SubtractOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitMultiplyOperatorNode(MultiplyOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitDivideOperatorNode(DivideOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitModOperatorNode(ModOperatorNode node, Deque<ExpressionNode> p) { node.setRightNode(pop(node, p)); node.setLeftNode(pop(node, p)); return null; } @Override public Void visitNewOperatorNode(NewOperatorNode node, Deque<ExpressionNode> p) { node.setParametersNode(pop(node, p)); return null; } @Override public Void visitMethodOperatorNode(MethodOperatorNode node, Deque<ExpressionNode> p) { node.setParametersNode(pop(node, p)); node.setTargetObjectNode(pop(node, p)); return null; } @Override public Void visitStaticMethodOperatorNode( StaticMethodOperatorNode node, Deque<ExpressionNode> p) { node.setParametersNode(pop(node, p)); return null; } @Override public Void visitFunctionOperatorNode(FunctionOperatorNode node, Deque<ExpressionNode> p) { node.setParametersNode(pop(node, p)); return null; } @Override public Void visitFieldOperatorNode(FieldOperatorNode node, Deque<ExpressionNode> p) { node.setTargetObjectNode(pop(node, p)); return null; } @Override public Void visitStaticFieldOperatorNode(StaticFieldOperatorNode node, Deque<ExpressionNode> p) { return null; } @Override public Void visitCommaOperatorNode(CommaOperatorNode node, Deque<ExpressionNode> p) { for (Iterator<ExpressionNode> it = p.descendingIterator(); it.hasNext(); ) { node.addNode(it.next()); it.remove(); } return null; } @Override public Void visitLiteralNode(LiteralNode node, Deque<ExpressionNode> p) { assertUnreachable(); return null; } @Override public Void visitVariableNode(VariableNode node, Deque<ExpressionNode> p) { assertUnreachable(); return null; } @Override public Void visitEmptyNode(EmptyNode node, Deque<ExpressionNode> p) { assertUnreachable(); return null; } @Override public Void visitParensNode(ParensNode node, Deque<ExpressionNode> p) { assertUnreachable(); return null; } protected ExpressionNode pop(OperatorNode node, Deque<ExpressionNode> p) { if (p.peek() == null) { ExpressionLocation location = node.getLocation(); throw new ExpressionException( Message.DOMA3010, location.getExpression(), location.getPosition(), node.getExpression()); } return p.pop(); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/cttype/BasicCtType.java ======================= package org.seasar.doma.internal.apt.cttype; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; import org.seasar.doma.internal.apt.Context; import org.seasar.doma.internal.apt.generator.Code; import org.seasar.doma.internal.jdbc.scalar.BasicScalarSuppliers; import org.seasar.doma.internal.jdbc.scalar.OptionalBasicScalarSuppliers; import org.seasar.doma.internal.util.Pair; import org.seasar.doma.internal.wrapper.WrapperSuppliers; public class BasicCtType extends AbstractCtType { private final TypeMirror boxedType; private final TypeElement wrapperTypeElement; BasicCtType(Context ctx, TypeMirror type, Pair<TypeElement, TypeMirror> wrapperElementAndType) { super(ctx, type); assertNotNull(wrapperElementAndType); this.boxedType = ctx.getMoreTypes().boxIfPrimitive(type); this.wrapperTypeElement = wrapperElementAndType.fst; } public TypeMirror getBoxedType() { return boxedType; } public Code getWrapperSupplierCode() { Class<?> clazz = WrapperSuppliers.class; String methodName = "of" + wrapperTypeElement.getSimpleName().toString().replace("Wrapper", ""); return new Code( p -> { if (isEnum()) { p.print("%1$s.%2$s(%3$s.class)", clazz, methodName, getQualifiedName()); } else { p.print("%1$s.%2$s()", clazz, methodName); } }); } public Code getScalarSupplierCode(boolean optional) { Class<?> clazz = optional? OptionalBasicScalarSuppliers.class : BasicScalarSuppliers.class; String methodName = "of" + wrapperTypeElement.getSimpleName().toString().replace("Wrapper", ""); return new Code( p -> { if (isEnum()) { p.print("%1$s.%2$s(%3$s.class)", clazz, methodName, getQualifiedName()); } else { p.print("%1$s.%2$s()", clazz, methodName); } }); } @Override public <R, P, TH extends Throwable> R accept(CtTypeVisitor<R, P, TH> visitor, P p) throws TH { return visitor.visitBasicCtType(this, p); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/parameter/OptionalIntResultListParameterMeta.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.apt.meta.parameter; public class OptionalIntResultListParameterMeta implements ResultListParameterMeta { @Override public <R, P> R accept(CallableSqlParameterMetaVisitor<R, P> visitor, P p) { return visitor.visitOptionalIntResultListParameterMeta(this, p); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/sql/ScalarSingleResultParameter.java ======================= package org.seasar.doma.internal.jdbc.sql; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import java.util.Optional; import org.seasar.doma.internal.jdbc.scalar.Scalar; import org.seasar.doma.jdbc.SingleResultParameter; import org.seasar.doma.jdbc.SqlParameterVisitor; import org.seasar.doma.wrapper.Wrapper; public class ScalarSingleResultParameter<BASIC, CONTAINER> implements SingleResultParameter<BASIC, CONTAINER> { protected final Scalar<BASIC, CONTAINER> scalar; public ScalarSingleResultParameter(Scalar<BASIC, CONTAINER> scalar) { assertNotNull(scalar); this.scalar = scalar; } @Override public Wrapper<BASIC> getWrapper() { return scalar.getWrapper(); } @Override public Object getValue() { return scalar.get(); } @Override public CONTAINER getResult() { return scalar.get(); } @Override public Optional<Class<?>> getDomainClass() { return scalar.getDomainClass(); } @Override public <R, P, TH extends Throwable> R accept(SqlParameterVisitor<R, P, TH> visitor, P p) throws TH { return visitor.visitSingleResultParameter(this, p); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/query/NClobCreateQueryMetaFactory.java ======================= package org.seasar.doma.internal.apt.meta.query; import java.sql.NClob; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import org.seasar.doma.internal.apt.Context; import org.seasar.doma.internal.apt.annot.NClobFactoryAnnot; public class NClobCreateQueryMetaFactory extends AbstractCreateQueryMetaFactory<NClobCreateQueryMeta> { public NClobCreateQueryMetaFactory( Context ctx, TypeElement daoElement, ExecutableElement methodElement) { super(ctx, daoElement, methodElement, NClob.class); } @Override public QueryMeta createQueryMeta() { NClobFactoryAnnot nClobFactoryAnnot = ctx.getAnnotations().newNClobFactoryAnnot(methodElement); if (nClobFactoryAnnot == null) { return null; } NClobCreateQueryMeta queryMeta = new NClobCreateQueryMeta(daoElement, methodElement); queryMeta.setNClobFactoryMirror(nClobFactoryAnnot); queryMeta.setQueryKind(QueryKind.NCLOB_FACTORY); doTypeParameters(queryMeta); doReturnType(queryMeta); doParameters(queryMeta); doThrowTypes(queryMeta); return queryMeta; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/command/ResultSetRowIndexConsumer.java ======================= package org.seasar.doma.jdbc.command; @FunctionalInterface public interface ResultSetRowIndexConsumer { void accept(Long index, Boolean next); } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/domain/NotPersistentValueObject.java ======================= package org.seasar.doma.internal.apt.processor.domain; public class NotPersistentValueObject {} ======================= File: doma-core/src/main/java/org/seasar/doma/wrapper/StringWrapper.java ======================= package org.seasar.doma.wrapper; import org.seasar.doma.DomaNullPointerException; /** A wrapper for the {@link String} class. */ public class StringWrapper extends AbstractWrapper<String> { public StringWrapper() { super(String.class); } public StringWrapper(String value) { super(String.class, value); } @Override public <R, P, Q, TH extends Throwable> R accept(WrapperVisitor<R, P, Q, TH> visitor, P p, Q q) throws TH { if (visitor == null) { throw new DomaNullPointerException("visitor"); } return visitor.visitStringWrapper(this, p, q); } } ======================= File: doma-core/src/main/java/org/seasar/doma/TenantId.java ======================= <gh_stars>100-1000 package org.seasar.doma; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Indicates the tenant id. * * <p>The annotated field must be a member of an {@link Entity} annotated class. * * <p>The column mapped to the annotated field is included in WHERE clause in auto-generated SQL * statements * * <pre> * &#064;Entity * public class Employee { * ... * * &#064;TenantId * String tenantId; * } * </pre> */ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) @EntityField public @interface TenantId {} ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/scalar/OptionalLongScalarSuppliers.java ======================= package org.seasar.doma.internal.jdbc.scalar; import java.util.OptionalLong; import java.util.function.Supplier; public final class OptionalLongScalarSuppliers { public static Supplier<Scalar<Long, OptionalLong>> of() { return OptionalLongScalar::new; } } ======================= File: doma-core/src/main/java/org/seasar/doma/wrapper/UtilDateWrapper.java ======================= <reponame>orekyuu/doma package org.seasar.doma.wrapper; import java.util.Date; import org.seasar.doma.DomaNullPointerException; /** A wrapper for the {@link Date} class. */ public class UtilDateWrapper extends AbstractWrapper<Date> { public UtilDateWrapper() { super(Date.class); } public UtilDateWrapper(Date value) { super(Date.class, value); } @Override protected Date doGetCopy() { Date original = get(); if (original == null) { return null; } return new Date(original.getTime()); } @Override public <R, P, Q, TH extends Throwable> R accept(WrapperVisitor<R, P, Q, TH> visitor, P p, Q q) throws TH { if (visitor == null) { throw new DomaNullPointerException("visitor"); } return visitor.visitUtilDateWrapper(this, p, q); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/option/package-info.java ======================= /** Provides options used to build the criteria query statement. */ package org.seasar.doma.jdbc.criteria.option; ======================= File: doma-mock/src/main/java/org/seasar/doma/internal/jdbc/mock/ColumnMetaData.java ======================= package org.seasar.doma.internal.jdbc.mock; public class ColumnMetaData { protected final String label; public ColumnMetaData(String label) { this.label = label; } public String getLabel() { return label; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/UnknownColumnException.java ======================= <reponame>orekyuu/doma package org.seasar.doma.jdbc; import org.seasar.doma.message.Message; /** Thrown to indicate that there is the column that is unknown to an entity. */ public class UnknownColumnException extends JdbcException { private static final long serialVersionUID = 1L; protected final String columnName; protected final String expectedPropertyName; protected final String entityClassName; protected final SqlKind kind; protected final String rawSql; protected final String formattedSql; protected final String sqlFilePath; public UnknownColumnException( SqlLogType logType, String columnName, String expectedPropertyName, String entityClassName, SqlKind kind, String rawSql, String formattedSql, String sqlFilePath) { super( Message.DOMA2002, columnName, expectedPropertyName, entityClassName, sqlFilePath, choiceSql(logType, rawSql, formattedSql)); this.columnName = columnName; this.expectedPropertyName = expectedPropertyName; this.entityClassName = entityClassName; this.kind = kind; this.rawSql = rawSql; this.formattedSql = formattedSql; this.sqlFilePath = sqlFilePath; } /** * Returns the SQL kind. * * @return the SQL kind */ public SqlKind getKind() { return kind; } /** * Returns the entity class name. * * @return the entity class name */ public String getEntityClassName() { return entityClassName; } /** * Returns the unknown column name. * * @return the unknown column name */ public String getColumnName() { return columnName; } /** * Returns the expected property name that is mapped to the unknown column name. * * @return the expected property name */ public String getExpectedPropertyName() { return expectedPropertyName; } /** * Returns the raw SQL string. * * @return the raw SQL string */ public String getRawSql() { return rawSql; } /** * Returns the formatted SQL string * * @return the formatted SQL or {@code null} if this exception is thrown in the batch process */ public String getFormattedSql() { return formattedSql; } /** * Returns the SQL file path. * * @return the SQL file path or {@code null} if the SQL is auto generated */ public String getSqlFilePath() { return sqlFilePath; } } ======================= File: doma-mock/src/main/java/org/seasar/doma/internal/jdbc/mock/BindValue.java ======================= package org.seasar.doma.internal.jdbc.mock; public class BindValue { protected final String typeName; protected final int index; protected final Object value; protected final Integer sqlType; public BindValue(String typeName, int index, Object value) { this.typeName = typeName; this.index = index; this.value = value; this.sqlType = null; } public BindValue(int index, int sqlType) { this.typeName = null; this.index = index; this.value = null; this.sqlType = sqlType; } public String getTypeName() { return typeName; } public int getIndex() { return index; } public Object getValue() { return value; } public Integer getSqlType() { return sqlType; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/command/AssociateCommand.java ======================= package org.seasar.doma.jdbc.criteria.command; import static java.util.stream.Collectors.toList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.BiFunction; import org.seasar.doma.internal.util.Pair; import org.seasar.doma.jdbc.command.Command; import org.seasar.doma.jdbc.command.SelectCommand; import org.seasar.doma.jdbc.criteria.context.SelectContext; import org.seasar.doma.jdbc.criteria.metamodel.EntityMetamodel; import org.seasar.doma.jdbc.entity.EntityType; import org.seasar.doma.jdbc.query.Query; import org.seasar.doma.jdbc.query.SelectQuery; public class AssociateCommand<ENTITY> implements Command<List<ENTITY>> { private final SelectContext context; private final SelectQuery query; private final EntityMetamodel<ENTITY> entityMetamodel; public AssociateCommand( SelectContext context, SelectQuery query, EntityMetamodel<ENTITY> entityMetamodel) { this.context = Objects.requireNonNull(context); this.query = Objects.requireNonNull(query); this.entityMetamodel = Objects.requireNonNull(entityMetamodel); } @Override @SuppressWarnings("unchecked") public List<ENTITY> execute() { Map<EntityKey, Object> cache = new LinkedHashMap<>(); SelectCommand<List<EntityPool>> command = new SelectCommand<>( query, new EntityPoolIterationHandler(context.getProjectionEntityMetamodels())); List<EntityPool> entityPools = command.execute(); for (EntityPool entityPool : entityPools) { Map<EntityMetamodel<?>, Pair<EntityKey, Object>> associationCandidate = new LinkedHashMap<>(); for (Map.Entry<EntityKey, EntityData> e : entityPool.entrySet()) { EntityKey key = e.getKey(); EntityData data = e.getValue(); Object entity = cache.computeIfAbsent( key, k -> { EntityMetamodel<?> entityMetamodel = k.getEntityMetamodel(); EntityType<Object> entityType = (EntityType<Object>) entityMetamodel.asType(); Object newEntity = entityType.newEntity(data.getStates()); if (!entityType.isImmutable()) { entityType.saveCurrentStates(newEntity); } return newEntity; }); associationCandidate.put(key.getEntityMetamodel(), new Pair<>(key, entity)); } associate(cache, associationCandidate); } return (List<ENTITY>) cache.entrySet().stream() .filter(e -> e.getKey().getEntityMetamodel() == entityMetamodel) .map(Map.Entry::getValue) .collect(toList()); } private void associate( Map<EntityKey, Object> cache, Map<EntityMetamodel<?>, Pair<EntityKey, Object>> associationCandidate) { for (Map.Entry<Pair<EntityMetamodel<?>, EntityMetamodel<?>>, BiFunction<Object, Object, Object>> e : context.associations.entrySet()) { Pair<EntityMetamodel<?>, EntityMetamodel<?>> metamodelPair = e.getKey(); BiFunction<Object, Object, Object> associator = e.getValue(); Pair<EntityKey, Object> keyAndEntity1 = associationCandidate.get(metamodelPair.fst); Pair<EntityKey, Object> keyAndEntity2 = associationCandidate.get(metamodelPair.snd); if (keyAndEntity1 == null || keyAndEntity2 == null) { continue; } Object newEntity = associator.apply(keyAndEntity1.snd, keyAndEntity2.snd); if (newEntity!= null) { cache.replace(keyAndEntity1.fst, newEntity); associationCandidate.replace(metamodelPair.fst, new Pair<>(keyAndEntity1.fst, newEntity)); } } } @Override public Query getQuery() { return query; } } ======================= File: doma-core/src/test/java/org/seasar/doma/wrapper/PrimitiveBooleanWrapperTest.java ======================= package org.seasar.doma.wrapper; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; class PrimitiveBooleanWrapperTest { @Test void set() { PrimitiveBooleanWrapper wrapper = new PrimitiveBooleanWrapper(); wrapper.set(true); assertEquals(true, wrapper.get()); wrapper.set(false); assertEquals(false, wrapper.get()); } @Test void set_null() { PrimitiveBooleanWrapper wrapper = new PrimitiveBooleanWrapper(); wrapper.set(null); assertEquals(false, wrapper.get()); } @Test void getDefault() { PrimitiveBooleanWrapper wrapper = new PrimitiveBooleanWrapper(); assertEquals(false, wrapper.getDefault()); } @Test void isPrimitiveWrapper() { PrimitiveBooleanWrapper wrapper = new PrimitiveBooleanWrapper(); assertTrue(wrapper.isPrimitiveWrapper()); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/error/Person.java ======================= package org.seasar.doma.internal.apt.processor.error; @MyAnnotation public class Person {} ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/ScriptException.java ======================= package org.seasar.doma.jdbc; import org.seasar.doma.message.Message; /** Thrown to indicate that the one of SQL statements in a script file throws an exception. */ public class ScriptException extends JdbcException { private static final long serialVersionUID = 1L; protected final String rawSql; protected final String scriptFilePath; protected final int lineNumber; public ScriptException(Throwable cause, Sql<?> sql, int lineNumber) { this(cause, sql.getRawSql(), sql.getSqlFilePath(), lineNumber); } public ScriptException(Throwable cause, String rawSql, String scriptFilePath, int lineNumber) { super(Message.DOMA2077, cause, rawSql, scriptFilePath, lineNumber, cause); this.rawSql = rawSql; this.scriptFilePath = scriptFilePath; this.lineNumber = lineNumber; } /** * Returns the raw SQL string. * * @return the raw SQL string */ public String getRawSql() { return rawSql; } /** * Returns the script file path. * * @return the script file path */ public String getScriptFilePath() { return scriptFilePath; } /** * Returns the line number of the script file. * * @return the line number */ public int getLineNumber() { return lineNumber; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/metamodel/EntityTypeProxy.java ======================= package org.seasar.doma.jdbc.criteria.metamodel; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.BiFunction; import java.util.function.Function; import org.seasar.doma.DomaIllegalArgumentException; import org.seasar.doma.jdbc.entity.EntityPropertyType; import org.seasar.doma.jdbc.entity.EntityType; import org.seasar.doma.jdbc.entity.GeneratedIdPropertyType; import org.seasar.doma.jdbc.entity.NamingType; import org.seasar.doma.jdbc.entity.PostDeleteContext; import org.seasar.doma.jdbc.entity.PostInsertContext; import org.seasar.doma.jdbc.entity.PostUpdateContext; import org.seasar.doma.jdbc.entity.PreDeleteContext; import org.seasar.doma.jdbc.entity.PreInsertContext; import org.seasar.doma.jdbc.entity.PreUpdateContext; import org.seasar.doma.jdbc.entity.Property; import org.seasar.doma.jdbc.entity.TenantIdPropertyType; import org.seasar.doma.jdbc.entity.VersionPropertyType; public class EntityTypeProxy<ENTITY> implements EntityType<ENTITY> { private final EntityType<ENTITY> entityType; private final String qualifiedTableName; public EntityTypeProxy(EntityType<ENTITY> entityType, String qualifiedTableName) { this.entityType = Objects.requireNonNull(entityType); this.qualifiedTableName = Objects.requireNonNull(qualifiedTableName); if (qualifiedTableName.contains("'")) { throw new DomaIllegalArgumentException( "qualifiedTableName", "The qualifiedTableName must not contain the single quotation(')."); } if (qualifiedTableName.contains(";")) { throw new DomaIllegalArgumentException( "qualifiedTableName", "The qualifiedTableName must not contain the semicolon(;)."); } if (qualifiedTableName.contains("--")) { throw new DomaIllegalArgumentException( "qualifiedTableName", "The qualifiedTableName must not contain the two hyphens(--)."); } if (qualifiedTableName.contains("/")) { throw new DomaIllegalArgumentException( "qualifiedTableName", "The qualifiedTableName must not contain the slash(/)."); } } @Override public boolean isImmutable() { return entityType.isImmutable(); } @Override public String getName() { return entityType.getName(); } @Override public String getCatalogName() { return entityType.getCatalogName(); } @Override public String getSchemaName() { return entityType.getSchemaName(); } @Override @Deprecated public String getTableName() { return entityType.getTableName(); } @Override public String getTableName(BiFunction<NamingType, String, String> namingFunction) { return entityType.getTableName(namingFunction); } @Override @Deprecated public String getQualifiedTableName() { return entityType.getQualifiedTableName(); } @Override @Deprecated public String getQualifiedTableName(Function<String, String> quoteFunction) { return entityType.getQualifiedTableName(quoteFunction); } @Override public String getQualifiedTableName( BiFunction<NamingType, String, String> namingFunction, Function<String, String> quoteFunction) { return qualifiedTableName; } @Override public boolean isQuoteRequired() { return entityType.isQuoteRequired(); } @Override public NamingType getNamingType() { return entityType.getNamingType(); } @Override public GeneratedIdPropertyType<ENTITY,?,?> getGeneratedIdPropertyType() { return entityType.getGeneratedIdPropertyType(); } @Override public VersionPropertyType<ENTITY,?,?> getVersionPropertyType() { return entityType.getVersionPropertyType(); } @Override public TenantIdPropertyType<ENTITY,?,?> getTenantIdPropertyType() { return entityType.getTenantIdPropertyType(); } @Override public List<EntityPropertyType<ENTITY,?>> getIdPropertyTypes() { return entityType.getIdPropertyTypes(); } @Override public EntityPropertyType<ENTITY,?> getEntityPropertyType(String __name) { return entityType.getEntityPropertyType(__name); } @Override public List<EntityPropertyType<ENTITY,?>> getEntityPropertyTypes() { return entityType.getEntityPropertyTypes(); } @Override public ENTITY newEntity(Map<String, Property<ENTITY,?>> __args) { return entityType.newEntity(__args); } @Override public Class<ENTITY> getEntityClass() { return entityType.getEntityClass(); } @Override public void saveCurrentStates(ENTITY entity) { entityType.saveCurrentStates(entity); } @Override public ENTITY getOriginalStates(ENTITY entity) { return entityType.getOriginalStates(entity); } @Override public void preInsert(ENTITY entity, PreInsertContext<ENTITY> context) { entityType.preInsert(entity, context); } @Override public void preUpdate(ENTITY entity, PreUpdateContext<ENTITY> context) { entityType.preUpdate(entity, context); } @Override public void preDelete(ENTITY entity, PreDeleteContext<ENTITY> context) { entityType.preDelete(entity, context); } @Override public void postInsert(ENTITY entity, PostInsertContext<ENTITY> context) { entityType.postInsert(entity, context); } @Override public void postUpdate(ENTITY entity, PostUpdateContext<ENTITY> context) { entityType.postUpdate(entity, context); } @Override public void postDelete(ENTITY entity, PostDeleteContext<ENTITY> context) { entityType.postDelete(entity, context); } } ======================= File: doma-mock/src/main/java/org/seasar/doma/internal/jdbc/mock/MockCallableStatement.java ======================= package org.seasar.doma.internal.jdbc.mock; import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; import java.sql.Array; import java.sql.Blob; import java.sql.CallableStatement; import java.sql.Clob; import java.sql.Date; import java.sql.NClob; import java.sql.Ref; import java.sql.RowId; import java.sql.SQLException; import java.sql.SQLType; import java.sql.SQLXML; import java.sql.Time; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.Map; @SuppressWarnings({"all", "deprecation"}) public class MockCallableStatement extends MockPreparedStatement implements CallableStatement { public List<Object> outParameters = new ArrayList<Object>(); public List<RegisterOutParameter> registerOutParameters = new ArrayList<RegisterOutParameter>(); protected boolean wasNull; public MockCallableStatement() {} public MockCallableStatement(MockResultSet resultSet) { super(resultSet); } @Override public Array getArray(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public Array getArray(String parameterName) throws SQLException { throw new AssertionError(); } @Override public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { throw new AssertionError(); } @Override public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public BigDecimal getBigDecimal(String parameterName) throws SQLException { throw new AssertionError(); } @Override public Blob getBlob(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public Blob getBlob(String parameterName) throws SQLException { throw new AssertionError(); } @Override public boolean getBoolean(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public boolean getBoolean(String parameterName) throws SQLException { throw new AssertionError(); } @Override public byte getByte(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public byte getByte(String parameterName) throws SQLException { throw new AssertionError(); } @Override public byte[] getBytes(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public byte[] getBytes(String parameterName) throws SQLException { throw new AssertionError(); } @Override public Reader getCharacterStream(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public Reader getCharacterStream(String parameterName) throws SQLException { throw new AssertionError(); } @Override public Clob getClob(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public Clob getClob(String parameterName) throws SQLException { throw new AssertionError(); } @Override public Date getDate(int parameterIndex, Calendar cal) throws SQLException { throw new AssertionError(); } @Override public Date getDate(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public Date getDate(String parameterName, Calendar cal) throws SQLException { throw new AssertionError(); } @Override public Date getDate(String parameterName) throws SQLException { throw new AssertionError(); } @Override public double getDouble(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public double getDouble(String parameterName) throws SQLException { throw new AssertionError(); } @Override public float getFloat(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public float getFloat(String parameterName) throws SQLException { throw new AssertionError(); } @Override public int getInt(int parameterIndex) throws SQLException { wasNull = false; Object value = outParameters.get(parameterIndex - 1); if (value == null) { wasNull = true; return 0; } return (Integer) value; } @Override public int getInt(String parameterName) throws SQLException { throw new AssertionError(); } @Override public long getLong(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public long getLong(String parameterName) throws SQLException { throw new AssertionError(); } @Override public Reader getNCharacterStream(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public Reader getNCharacterStream(String parameterName) throws SQLException { throw new AssertionError(); } @Override public NClob getNClob(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public NClob getNClob(String parameterName) throws SQLException { throw new AssertionError(); } @Override public String getNString(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public String getNString(String parameterName) throws SQLException { throw new AssertionError(); } @Override public Object getObject(int parameterIndex, Map<String, Class<?>> map) throws SQLException { throw new AssertionError(); } @Override public Object getObject(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public Object getObject(String parameterName, Map<String, Class<?>> map) throws SQLException { throw new AssertionError(); } @Override public Object getObject(String parameterName) throws SQLException { throw new AssertionError(); } @Override public Ref getRef(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public Ref getRef(String parameterName) throws SQLException { throw new AssertionError(); } @Override public RowId getRowId(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public RowId getRowId(String parameterName) throws SQLException { throw new AssertionError(); } @Override public short getShort(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public short getShort(String parameterName) throws SQLException { throw new AssertionError(); } @Override public SQLXML getSQLXML(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public SQLXML getSQLXML(String parameterName) throws SQLException { throw new AssertionError(); } @Override public String getString(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public String getString(String parameterName) throws SQLException { throw new AssertionError(); } @Override public Time getTime(int parameterIndex, Calendar cal) throws SQLException { throw new AssertionError(); } @Override public Time getTime(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public Time getTime(String parameterName, Calendar cal) throws SQLException { throw new AssertionError(); } @Override public Time getTime(String parameterName) throws SQLException { throw new AssertionError(); } @Override public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { throw new AssertionError(); } @Override public Timestamp getTimestamp(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { throw new AssertionError(); } @Override public Timestamp getTimestamp(String parameterName) throws SQLException { throw new AssertionError(); } @Override public URL getURL(int parameterIndex) throws SQLException { throw new AssertionError(); } @Override public URL getURL(String parameterName) throws SQLException { throw new AssertionError(); } @Override public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { throw new AssertionError(); } @Override public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { throw new AssertionError(); } @Override public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { registerOutParameters.add(new RegisterOutParameter(parameterIndex, sqlType)); } @Override public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { throw new AssertionError(); } @Override public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { throw new AssertionError(); } @Override public void registerOutParameter(String parameterName, int sqlType) throws SQLException { throw new AssertionError(); } @Override public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { throw new AssertionError(); } @Override public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { throw new AssertionError(); } @Override public void setAsciiStream(String parameterName, InputStream x) throws SQLException { throw new AssertionError(); } @Override public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { throw new AssertionError(); } @Override public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { throw new AssertionError(); } @Override public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { throw new AssertionError(); } @Override public void setBinaryStream(String parameterName, InputStream x) throws SQLException { throw new AssertionError(); } @Override public void setBlob(String parameterName, Blob x) throws SQLException { throw new AssertionError(); } @Override public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { throw new AssertionError(); } @Override public void setBlob(String parameterName, InputStream inputStream) throws SQLException { throw new AssertionError(); } @Override public void setBoolean(String parameterName, boolean x) throws SQLException { throw new AssertionError(); } @Override public void setByte(String parameterName, byte x) throws SQLException { throw new AssertionError(); } @Override public void setBytes(String parameterName, byte[] x) throws SQLException { throw new AssertionError(); } @Override public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { throw new AssertionError(); } @Override public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { throw new AssertionError(); } @Override public void setCharacterStream(String parameterName, Reader reader) throws SQLException { throw new AssertionError(); } @Override public void setClob(String parameterName, Clob x) throws SQLException { throw new AssertionError(); } @Override public void setClob(String parameterName, Reader reader, long length) throws SQLException { throw new AssertionError(); } @Override public void setClob(String parameterName, Reader reader) throws SQLException { throw new AssertionError(); } @Override public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { throw new AssertionError(); } @Override public void setDate(String parameterName, Date x) throws SQLException { throw new AssertionError(); } @Override public void setDouble(String parameterName, double x) throws SQLException { throw new AssertionError(); } @Override public void setFloat(String parameterName, float x) throws SQLException { throw new AssertionError(); } @Override public void setInt(String parameterName, int x) throws SQLException { throw new AssertionError(); } @Override public void setLong(String parameterName, long x) throws SQLException { throw new AssertionError(); } @Override public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { throw new AssertionError(); } @Override public void setNCharacterStream(String parameterName, Reader value) throws SQLException { throw new AssertionError(); } @Override public void setNClob(String parameterName, NClob value) throws SQLException { throw new AssertionError(); } @Override public void setNClob(String parameterName, Reader reader, long length) throws SQLException { throw new AssertionError(); } @Override public void setNClob(String parameterName, Reader reader) throws SQLException { throw new AssertionError(); } @Override public void setNString(String parameterName, String value) throws SQLException { throw new AssertionError(); } @Override public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { throw new AssertionError(); } @Override public void setNull(String parameterName, int sqlType) throws SQLException { throw new AssertionError(); } @Override public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { throw new AssertionError(); } @Override public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { throw new AssertionError(); } @Override public void setObject(String parameterName, Object x) throws SQLException { throw new AssertionError(); } @Override public void setRowId(String parameterName, RowId x) throws SQLException { throw new AssertionError(); } @Override public void setShort(String parameterName, short x) throws SQLException { throw new AssertionError(); } @Override public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { throw new AssertionError(); } @Override public void setString(String parameterName, String x) throws SQLException { throw new AssertionError(); } @Override public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { throw new AssertionError(); } @Override public void setTime(String parameterName, Time x) throws SQLException { throw new AssertionError(); } @Override public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { throw new AssertionError(); } @Override public void setTimestamp(String parameterName, Timestamp x) throws SQLException { throw new AssertionError(); } @Override public void setURL(String parameterName, URL val) throws SQLException { throw new AssertionError(); } @Override public boolean wasNull() throws SQLException { return wasNull; } @SuppressWarnings("all") public void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public void setObject(int parameterIndex, Object x, SQLType targetSqlType) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public long executeLargeUpdate() throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public void closeOnCompletion() throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public boolean isCloseOnCompletion() throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public long getLargeUpdateCount() throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public void setLargeMaxRows(long max) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public long getLargeMaxRows() throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public long[] executeLargeBatch() throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public long executeLargeUpdate(String sql) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public long executeLargeUpdate(String sql, String[] columnNames) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public <T> T getObject(int parameterIndex, Class<T> type) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public <T> T getObject(String parameterName, Class<T> type) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public void setObject(String parameterName, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public void setObject(String parameterName, Object x, SQLType targetSqlType) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public void registerOutParameter(int parameterIndex, SQLType sqlType) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public void registerOutParameter(int parameterIndex, SQLType sqlType, int scale) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public void registerOutParameter(int parameterIndex, SQLType sqlType, String typeName) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public void registerOutParameter(String parameterName, SQLType sqlType) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException { throw new AssertionError(); } @SuppressWarnings("all") public void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException { throw new AssertionError(); } } ======================= File: doma-core/src/test/java/org/seasar/doma/wrapper/PrimitiveIntWrapperTest.java ======================= package org.seasar.doma.wrapper; import static org.junit.jupiter.api.Assertions.*; import java.math.BigDecimal; import org.junit.jupiter.api.Test; class PrimitiveIntWrapperTest { @Test void set() { PrimitiveIntWrapper wrapper = new PrimitiveIntWrapper(); wrapper.set(10); assertEquals(10, wrapper.get()); wrapper.set(new BigDecimal(20)); assertEquals(20, wrapper.get()); } @Test void set_null() { PrimitiveIntWrapper wrapper = new PrimitiveIntWrapper(); wrapper.set(null); assertEquals(0, wrapper.get()); wrapper.set((Number) null); assertEquals(0, wrapper.get()); } @Test void getDefault() { PrimitiveIntWrapper wrapper = new PrimitiveIntWrapper(); assertEquals(0, wrapper.getDefault()); } @Test void increment() { PrimitiveIntWrapper wrapper = new PrimitiveIntWrapper(1); wrapper.increment(); assertEquals(2, wrapper.get()); } @Test void increment_fromDefaultValue() { PrimitiveIntWrapper wrapper = new PrimitiveIntWrapper(); wrapper.increment(); assertEquals(1, wrapper.get()); } @Test void decrement() { PrimitiveIntWrapper wrapper = new PrimitiveIntWrapper(1); wrapper.decrement(); assertEquals(0, wrapper.get()); } @Test void decrement_fromDefaultValue() { PrimitiveIntWrapper wrapper = new PrimitiveIntWrapper(); wrapper.decrement(); assertEquals(-1, wrapper.get()); } @Test void isPrimitiveWrapper() { PrimitiveIntWrapper wrapper = new PrimitiveIntWrapper(); assertTrue(wrapper.isPrimitiveWrapper()); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/entity/EntityListener.java ======================= package org.seasar.doma.jdbc.entity; /** * A callback listener that is invoked when the corresponding entities are persisted. * * <p>The implementation class must have a public no-arg constructor. * * <p>The implementation class must be thread safe. * * @param <ENTITY> the entity type */ public interface EntityListener<ENTITY> { /** * Handles the entity before an insert. * * @param entity the entity * @param context the context * @see org.seasar.doma.Insert * @see org.seasar.doma.BatchInsert */ default void preInsert(ENTITY entity, PreInsertContext<ENTITY> context) {} /** * Handles the entity before an update. * * @param entity the entity * @param context the context * @see org.seasar.doma.Update * @see org.seasar.doma.BatchUpdate */ default void preUpdate(ENTITY entity, PreUpdateContext<ENTITY> context) {} /** * Handles the entity before a delete. * * @param entity the entity * @param context the context * @see org.seasar.doma.Delete * @see org.seasar.doma.BatchDelete */ default void preDelete(ENTITY entity, PreDeleteContext<ENTITY> context) {} /** * Handles the entity after an insert. * * @param entity the entity * @param context the context * @see org.seasar.doma.Insert * @see org.seasar.doma.BatchInsert */ default void postInsert(ENTITY entity, PostInsertContext<ENTITY> context) {} /** * Handles the entity after an update. * * @param entity the entity * @param context the context * @see org.seasar.doma.Update * @see org.seasar.doma.BatchUpdate */ default void postUpdate(ENTITY entity, PostUpdateContext<ENTITY> context) {} /** * Handles the entity after a delete. * * @param entity the entity * @param context the context * @see org.seasar.doma.Delete * @see org.seasar.doma.BatchDelete */ default void postDelete(ENTITY entity, PostDeleteContext<ENTITY> context) {} } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/SqlNode.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/jdbc/SqlNode.java package org.seasar.doma.jdbc; import java.util.List; import org.seasar.doma.DomaNullPointerException; /** * An SQL node. * * <p>The implementation class is not required to be thread safe. * * <p>Treat this object for read only when you can not control its life cycle. */ public interface SqlNode { /** * Returns the children list. * * @return the children list */ List<SqlNode> getChildren(); /** * Accepts the visitor. * * @param <R> the result type * @param <P> the parameter type * @param visitor the visitor * @param p the parameter for the visitor * @return the result * @throws DomaNullPointerException if {@code visitor} is {@code null} */ <R, P> R accept(SqlNodeVisitor<R, P> visitor, P p); } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/VersionNotNumberEntity.java ======================= package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.Entity; import org.seasar.doma.Version; @Entity public class VersionNotNumberEntity { @Version String version; public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/dao/DefaultMethodDao.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.apt.processor.dao; import java.math.BigDecimal; import org.seasar.doma.Dao; @SuppressWarnings("deprecation") @Dao(config = MyConfig.class) public interface DefaultMethodDao { default BigDecimal execute(String aaa, Integer bbb) { return BigDecimal.ONE; } } ======================= File: doma-core/src/test/java/org/seasar/doma/internal/jdbc/sql/ScalarInParameterTest.java ======================= package org.seasar.doma.internal.jdbc.sql; import static org.junit.jupiter.api.Assertions.assertEquals; import example.domain.PhoneNumber; import java.util.Optional; import org.junit.jupiter.api.Test; import org.seasar.doma.internal.jdbc.scalar.Scalar; import org.seasar.doma.jdbc.ClassHelper; import org.seasar.doma.jdbc.domain.DomainType; import org.seasar.doma.jdbc.domain.DomainTypeFactory; @SuppressWarnings("OptionalGetWithoutIsPresent") public class ScalarInParameterTest { @Test public void testGetDomainClass() { DomainType<String, PhoneNumber> domainType = DomainTypeFactory.getDomainType(PhoneNumber.class, new ClassHelper() {}); Scalar<String, PhoneNumber> scalar = domainType.createScalar(); ScalarInParameter<String, PhoneNumber> parameter = new ScalarInParameter<>(scalar); Optional<Class<?>> optional = parameter.getDomainClass(); assertEquals(PhoneNumber.class, optional.get()); } @Test public void testGetDomainClass_optional() { DomainType<String, PhoneNumber> domainType = DomainTypeFactory.getDomainType(PhoneNumber.class, new ClassHelper() {}); Scalar<String, Optional<PhoneNumber>> scalar = domainType.createOptionalScalar(); ScalarInParameter<String, Optional<PhoneNumber>> parameter = new ScalarInParameter<>(scalar); Optional<Class<?>> optional = parameter.getDomainClass(); assertEquals(PhoneNumber.class, optional.get()); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/processor/AbstractGeneratingProcessor.java ======================= <filename>doma-processor/src/main/java/org/seasar/doma/internal/apt/processor/AbstractGeneratingProcessor.java package org.seasar.doma.internal.apt.processor; import java.lang.annotation.Annotation; import java.util.Set; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.TypeElement; import javax.lang.model.util.ElementFilter; import org.seasar.doma.internal.ClassName; import org.seasar.doma.internal.apt.generator.Generator; import org.seasar.doma.internal.apt.generator.JavaFileGenerator; import org.seasar.doma.internal.apt.generator.Printer; import org.seasar.doma.internal.apt.meta.TypeElementMeta; import org.seasar.doma.internal.apt.meta.TypeElementMetaFactory; public abstract class AbstractGeneratingProcessor<M extends TypeElementMeta> extends AbstractProcessor { protected AbstractGeneratingProcessor(Class<? extends Annotation> supportedAnnotationType) { super(supportedAnnotationType); } @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver()) { return true; } for (TypeElement a : annotations) { final TypeElementMetaFactory<M> factory = createTypeElementMetaFactory(); for (TypeElement typeElement : ElementFilter.typesIn(roundEnv.getElementsAnnotatedWith(a))) { handleTypeElement( typeElement, t -> { M meta = factory.createTypeElementMeta(typeElement); if (!meta.isError()) { generate(typeElement, meta); } }); } } return true; } protected abstract TypeElementMetaFactory<M> createTypeElementMetaFactory(); protected void generate(TypeElement typeElement, M meta) { JavaFileGenerator<M> javaFileGenerator = new JavaFileGenerator<>(ctx, this::createClassName, this::createGenerator); javaFileGenerator.generate(typeElement, meta); } protected abstract ClassName createClassName(TypeElement typeElement, M meta); protected abstract Generator createGenerator(ClassName className, Printer printer, M meta); } ======================= File: doma-core/src/main/java/org/seasar/doma/wrapper/WrapperVisitor.java ======================= package org.seasar.doma.wrapper; /** * A visitor for the {@link Wrapper} interface. * * @param <R> The result type * @param <P> The first parameter type * @param <Q> The second parameter type * @param <TH> The error or exception type */ public interface WrapperVisitor<R, P, Q, TH extends Throwable> { default R visitArrayWrapper(ArrayWrapper wrapper, P p, Q q) throws TH { return null; } default R visitBigDecimalWrapper(BigDecimalWrapper wrapper, P p, Q q) throws TH { return null; } default R visitBigIntegerWrapper(BigIntegerWrapper wrapper, P p, Q q) throws TH { return null; } default R visitBlobWrapper(BlobWrapper wrapper, P p, Q q) throws TH { return null; } default R visitBooleanWrapper(BooleanWrapper wrapper, P p, Q q) throws TH { return null; } default R visitBytesWrapper(BytesWrapper wrapper, P p, Q q) throws TH { return null; } default R visitByteWrapper(ByteWrapper wrapper, P p, Q q) throws TH { return null; } default R visitClobWrapper(ClobWrapper wrapper, P p, Q q) throws TH { return null; } default R visitDateWrapper(DateWrapper wrapper, P p, Q q) throws TH { return null; } default R visitDoubleWrapper(DoubleWrapper wrapper, P p, Q q) throws TH { return null; } default <E extends Enum<E>> R visitEnumWrapper(EnumWrapper<E> wrapper, P p, Q q) throws TH { return null; } default R visitFloatWrapper(FloatWrapper wrapper, P p, Q q) throws TH { return null; } default R visitIntegerWrapper(IntegerWrapper wrapper, P p, Q q) throws TH { return null; } default R visitLocalDateWrapper(LocalDateWrapper wrapper, P p, Q q) throws TH { return null; } default R visitLocalDateTimeWrapper(LocalDateTimeWrapper wrapper, P p, Q q) throws TH { return null; } default R visitLocalTimeWrapper(LocalTimeWrapper wrapper, P p, Q q) throws TH { return null; } default R visitLongWrapper(LongWrapper wrapper, P p, Q q) throws TH { return null; } default R visitNClobWrapper(NClobWrapper wrapper, P p, Q q) throws TH { return null; } default R visitObjectWrapper(ObjectWrapper wrapper, P p, Q q) throws TH { return null; } default R visitPrimitiveBooleanWrapper(PrimitiveBooleanWrapper wrapper, P p, Q q) throws TH { return visitBooleanWrapper(wrapper, p, q); } default R visitPrimitiveByteWrapper(PrimitiveByteWrapper wrapper, P p, Q q) throws TH { return visitByteWrapper(wrapper, p, q); } default R visitPrimitiveDoubleWrapper(PrimitiveDoubleWrapper wrapper, P p, Q q) throws TH { return visitDoubleWrapper(wrapper, p, q); } default R visitPrimitiveFloatWrapper(PrimitiveFloatWrapper wrapper, P p, Q q) throws TH { return visitFloatWrapper(wrapper, p, q); } default R visitPrimitiveIntWrapper(PrimitiveIntWrapper wrapper, P p, Q q) throws TH { return visitIntegerWrapper(wrapper, p, q); } default R visitPrimitiveLongWrapper(PrimitiveLongWrapper wrapper, P p, Q q) throws TH { return visitLongWrapper(wrapper, p, q); } default R visitPrimitiveShortWrapper(PrimitiveShortWrapper wrapper, P p, Q q) throws TH { return visitShortWrapper(wrapper, p, q); } default R visitShortWrapper(ShortWrapper wrapper, P p, Q q) throws TH { return null; } default R visitStringWrapper(StringWrapper wrapper, P p, Q q) throws TH { return null; } default R visitSQLXMLWrapper(SQLXMLWrapper wrapper, P p, Q q) throws TH { return null; } default R visitTimestampWrapper(TimestampWrapper wrapper, P p, Q q) throws TH { return null; } default R visitTimeWrapper(TimeWrapper wrapper, P p, Q q) throws TH { return null; } default R visitUtilDateWrapper(UtilDateWrapper wrapper, P p, Q q) throws TH { return null; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/tx/TransactionAlreadyBegunException.java ======================= package org.seasar.doma.jdbc.tx; import java.io.Serializable; import org.seasar.doma.jdbc.JdbcException; import org.seasar.doma.message.Message; /** Thrown to indicate that a transaction is already begun. */ public class TransactionAlreadyBegunException extends JdbcException implements Serializable { private static final long serialVersionUID = 1L; public TransactionAlreadyBegunException(String transactionId) { super(Message.DOMA2045, transactionId); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/expression/Expressions.java ======================= <reponame>orekyuu/doma<gh_stars>100-1000 package org.seasar.doma.jdbc.criteria.expression; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.Objects; import java.util.function.Consumer; import java.util.function.Function; import org.seasar.doma.DomaIllegalArgumentException; import org.seasar.doma.jdbc.criteria.context.Operand; import org.seasar.doma.jdbc.criteria.context.SubSelectContext; import org.seasar.doma.jdbc.criteria.metamodel.PropertyMetamodel; public class Expressions { public static PropertyMetamodel<BigDecimal> literal(BigDecimal value) { Objects.requireNonNull(value); return new LiteralExpression<>(value, BigDecimalPropertyType::new); } public static PropertyMetamodel<BigInteger> literal(BigInteger value) { Objects.requireNonNull(value); return new LiteralExpression<>(value, BigIntegerPropertyType::new); } public static PropertyMetamodel<Boolean> literal(boolean value) { return new LiteralExpression<>(value, BooleanPropertyType::new); } public static PropertyMetamodel<Byte> literal(byte value) { return new LiteralExpression<>(value, BytePropertyType::new); } public static PropertyMetamodel<Double> literal(double value) { return new LiteralExpression<>(value, DoublePropertyType::new); } public static PropertyMetamodel<Float> literal(float value) { return new LiteralExpression<>(value, FloatPropertyType::new); } public static PropertyMetamodel<Integer> literal(int value) { return new LiteralExpression<>(value, IntegerPropertyType::new); } public static PropertyMetamodel<LocalDate> literal(LocalDate value) { Objects.requireNonNull(value); return new LiteralExpression<>(value, LocalDatePropertyType::new); } public static PropertyMetamodel<LocalDateTime> literal(LocalDateTime value) { Objects.requireNonNull(value); return new LiteralExpression<>(value, LocalDateTimePropertyType::new); } public static PropertyMetamodel<LocalTime> literal(LocalTime value) { Objects.requireNonNull(value); return new LiteralExpression<>(value, LocalTimePropertyType::new); } public static PropertyMetamodel<Long> literal(long value) { return new LiteralExpression<>(value, LongPropertyType::new); } public static PropertyMetamodel<Short> literal(short value) { return new LiteralExpression<>(value, ShortPropertyType::new); } public static PropertyMetamodel<String> literal(String value) { Objects.requireNonNull(value); if (value.indexOf('\'') > -1) { throw new DomaIllegalArgumentException( "value", "The value must not contain the single quotation."); } return new LiteralExpression<>(value, StringPropertyType::new); } public static <PROPERTY> ArithmeticExpression.Add<PROPERTY> add( PropertyMetamodel<PROPERTY> left, PROPERTY right) { Objects.requireNonNull(left); return new ArithmeticExpression.Add<>( left, new Operand.Prop(left), new Operand.Param(left, right)); } public static <PROPERTY> ArithmeticExpression.Add<PROPERTY> add( PROPERTY left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(right); return new ArithmeticExpression.Add<>( right, new Operand.Param(right, left), new Operand.Prop(right)); } public static <PROPERTY> ArithmeticExpression.Add<PROPERTY> add( PropertyMetamodel<PROPERTY> left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(left); Objects.requireNonNull(right); return new ArithmeticExpression.Add<>(left, new Operand.Prop(left), new Operand.Prop(right)); } public static <PROPERTY> ArithmeticExpression.Sub<PROPERTY> sub( PropertyMetamodel<PROPERTY> left, PROPERTY right) { Objects.requireNonNull(left); return new ArithmeticExpression.Sub<>( left, new Operand.Prop(left), new Operand.Param(left, right)); } public static <PROPERTY> ArithmeticExpression.Sub<PROPERTY> sub( PROPERTY left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(right); return new ArithmeticExpression.Sub<>( right, new Operand.Param(right, left), new Operand.Prop(right)); } public static <PROPERTY> ArithmeticExpression.Sub<PROPERTY> sub( PropertyMetamodel<PROPERTY> left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(left); Objects.requireNonNull(right); return new ArithmeticExpression.Sub<>(left, new Operand.Prop(left), new Operand.Prop(right)); } public static <PROPERTY> ArithmeticExpression.Mul<PROPERTY> mul( PropertyMetamodel<PROPERTY> left, PROPERTY right) { Objects.requireNonNull(left); return new ArithmeticExpression.Mul<>( left, new Operand.Prop(left), new Operand.Param(left, right)); } public static <PROPERTY> ArithmeticExpression.Mul<PROPERTY> mul( PROPERTY left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(right); return new ArithmeticExpression.Mul<>( right, new Operand.Param(right, left), new Operand.Prop(right)); } public static <PROPERTY> ArithmeticExpression.Mul<PROPERTY> mul( PropertyMetamodel<PROPERTY> left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(left); Objects.requireNonNull(right); return new ArithmeticExpression.Mul<>(left, new Operand.Prop(left), new Operand.Prop(right)); } public static <PROPERTY> ArithmeticExpression.Div<PROPERTY> div( PropertyMetamodel<PROPERTY> left, PROPERTY right) { Objects.requireNonNull(left); return new ArithmeticExpression.Div<>( left, new Operand.Prop(left), new Operand.Param(left, right)); } public static <PROPERTY> ArithmeticExpression.Div<PROPERTY> div( PROPERTY left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(right); return new ArithmeticExpression.Div<>( right, new Operand.Param(right, left), new Operand.Prop(right)); } public static <PROPERTY> ArithmeticExpression.Div<PROPERTY> div( PropertyMetamodel<PROPERTY> left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(left); Objects.requireNonNull(right); return new ArithmeticExpression.Div<>(left, new Operand.Prop(left), new Operand.Prop(right)); } public static <PROPERTY> ArithmeticExpression.Mod<PROPERTY> mod( PropertyMetamodel<PROPERTY> left, PROPERTY right) { Objects.requireNonNull(left); return new ArithmeticExpression.Mod<>( left, new Operand.Prop(left), new Operand.Param(left, right)); } public static <PROPERTY> ArithmeticExpression.Mod<PROPERTY> mod( PROPERTY left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(right); return new ArithmeticExpression.Mod<>( right, new Operand.Param(right, left), new Operand.Prop(right)); } public static <PROPERTY> ArithmeticExpression.Mod<PROPERTY> mod( PropertyMetamodel<PROPERTY> left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(left); Objects.requireNonNull(right); return new ArithmeticExpression.Mod<>(left, new Operand.Prop(left), new Operand.Prop(right)); } public static <PROPERTY> StringExpression.Concat<PROPERTY> concat( PropertyMetamodel<PROPERTY> left, PROPERTY right) { Objects.requireNonNull(left); return new StringExpression.Concat<>( left, new Operand.Prop(left), new Operand.Param(left, right)); } public static <PROPERTY> StringExpression.Concat<PROPERTY> concat( PROPERTY left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(right); return new StringExpression.Concat<>( right, new Operand.Param(right, left), new Operand.Prop(right)); } public static <PROPERTY> StringExpression.Concat<PROPERTY> concat( PropertyMetamodel<PROPERTY> left, PropertyMetamodel<PROPERTY> right) { Objects.requireNonNull(left); Objects.requireNonNull(right); return new StringExpression.Concat<>(left, new Operand.Prop(left), new Operand.Prop(right)); } public static <PROPERTY> StringExpression.Lower<PROPERTY> lower( PropertyMetamodel<PROPERTY> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new StringExpression.Lower<>(propertyMetamodel); } public static <PROPERTY> StringExpression.Ltrim<PROPERTY> ltrim( PropertyMetamodel<PROPERTY> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new StringExpression.Ltrim<>(propertyMetamodel); } public static <PROPERTY> StringExpression.Rtrim<PROPERTY> rtrim( PropertyMetamodel<PROPERTY> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new StringExpression.Rtrim<>(propertyMetamodel); } public static <PROPERTY> StringExpression.Trim<PROPERTY> trim( PropertyMetamodel<PROPERTY> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new StringExpression.Trim<>(propertyMetamodel); } public static <PROPERTY> StringExpression.Upper<PROPERTY> upper( PropertyMetamodel<PROPERTY> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new StringExpression.Upper<>(propertyMetamodel); } public static <PROPERTY> AggregateFunction.Avg<PROPERTY> avg( PropertyMetamodel<PROPERTY> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new AggregateFunction.Avg<>(propertyMetamodel); } public static AggregateFunction.AvgAsDouble avgAsDouble(PropertyMetamodel<?> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new AggregateFunction.AvgAsDouble(propertyMetamodel); } public static AggregateFunction.Count count() { return new AggregateFunction.Count(AggregateFunction.Asterisk); } public static AggregateFunction.Count count(PropertyMetamodel<?> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new AggregateFunction.Count(propertyMetamodel); } public static AggregateFunction.Count countDistinct(PropertyMetamodel<?> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new AggregateFunction.Count(propertyMetamodel, true); } public static <PROPERTY> AggregateFunction.Max<PROPERTY> max( PropertyMetamodel<PROPERTY> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new AggregateFunction.Max<>(propertyMetamodel); } public static <PROPERTY> AggregateFunction.Min<PROPERTY> min( PropertyMetamodel<PROPERTY> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new AggregateFunction.Min<>(propertyMetamodel); } public static <PROPERTY> AggregateFunction.Sum<PROPERTY> sum( PropertyMetamodel<PROPERTY> propertyMetamodel) { Objects.requireNonNull(propertyMetamodel); return new AggregateFunction.Sum<>(propertyMetamodel); } public static <PROPERTY> CaseExpression<PROPERTY> when( Consumer<CaseExpression<PROPERTY>.Declaration> block, PropertyMetamodel<PROPERTY> otherwise) { Objects.requireNonNull(block); Objects.requireNonNull(otherwise); CaseExpression<PROPERTY> caseExpression = new CaseExpression<>(otherwise); block.accept(caseExpression.new Declaration()); return caseExpression; } public static <PROPERTY> SelectExpression<PROPERTY> select( Function<SelectExpression.Declaration, SubSelectContext.Single<PROPERTY>> block) { Objects.requireNonNull(block); SubSelectContext.Single<PROPERTY> subSelectContext = block.apply(new SelectExpression.Declaration()); return new SelectExpression<>(subSelectContext); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/DomainResultListHandler.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/DomainResultListHandler.java<gh_stars>100-1000 package org.seasar.doma.internal.jdbc.command; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import org.seasar.doma.jdbc.domain.DomainType; public class DomainResultListHandler<BASIC, DOMAIN> extends ScalarResultListHandler<BASIC, DOMAIN> { public DomainResultListHandler(DomainType<BASIC, DOMAIN> domainType) { super(domainType::createScalar); assertNotNull(domainType); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/processor/DataTypeProcessor.java ======================= package org.seasar.doma.internal.apt.processor; import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedOptions; import org.seasar.doma.experimental.DataType; import org.seasar.doma.internal.apt.Options; import org.seasar.doma.internal.apt.meta.domain.DataTypeMeta; import org.seasar.doma.internal.apt.meta.domain.DataTypeMetaFactory; @SupportedAnnotationTypes({"org.seasar.doma.experimental.DataType"}) @SupportedOptions({ Options.VERSION_VALIDATION, Options.RESOURCES_DIR, Options.TEST, Options.DEBUG, Options.CONFIG_PATH }) public class DataTypeProcessor extends AbstractDomainProcessor<DataTypeMeta> { public DataTypeProcessor() { super(DataType.class); } @Override protected DataTypeMetaFactory createTypeElementMetaFactory() { return new DataTypeMetaFactory(ctx); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/MapCollectorHandler.java ======================= package org.seasar.doma.internal.jdbc.command; import java.util.Map; import java.util.stream.Collector; import org.seasar.doma.MapKeyNamingType; public class MapCollectorHandler<RESULT> extends AbstractCollectorHandler<Map<String, Object>, RESULT> { public MapCollectorHandler( MapKeyNamingType mapKeyNamingType, Collector<Map<String, Object>,?, RESULT> collector) { super(new MapStreamHandler<>(mapKeyNamingType, s -> s.collect(collector))); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/domain/UpperBoundParameterizedDomain.java ======================= package org.seasar.doma.internal.apt.processor.domain; import org.seasar.doma.Domain; @Domain(valueType = Integer.class) public class UpperBoundParameterizedDomain<T extends Number> { private final Integer value; public UpperBoundParameterizedDomain(Integer value) { this.value = value; } public Integer getValue() { return value; } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/LombokValueStaticConstructor.java ======================= <reponame>orekyuu/doma<gh_stars>100-1000 package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.Entity; import org.seasar.doma.internal.apt.lombok.Value; @Entity(immutable = true) @Value(staticConstructor = "of") public class LombokValueStaticConstructor {} ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/dao/ApplicationScopedDao.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.apt.processor.dao; import org.seasar.doma.AnnotateWith; import org.seasar.doma.Annotation; import org.seasar.doma.AnnotationTarget; import org.seasar.doma.Dao; import org.seasar.doma.internal.apt.cdi.ApplicationScoped; @Dao @AnnotateWith( annotations = {@Annotation(target = AnnotationTarget.CLASS, type = ApplicationScoped.class)}) public interface ApplicationScopedDao {} ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/annot/AbstractAnnot.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.apt.annot; import javax.lang.model.element.AnnotationMirror; class AbstractAnnot implements Annot { private final AnnotationMirror annotationMirror; AbstractAnnot(AnnotationMirror annotationMirror) { this.annotationMirror = annotationMirror; } public AnnotationMirror getAnnotationMirror() { return annotationMirror; } } ======================= File: doma-core/src/test/java/org/seasar/doma/jdbc/entity/NotTopLevelEntity.java ======================= package org.seasar.doma.jdbc.entity; import org.seasar.doma.Entity; public class NotTopLevelEntity { @Entity public static class Hoge {} } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/metamodel/Worker.java ======================= package org.seasar.doma.internal.apt.processor.metamodel; import org.seasar.doma.Entity; import org.seasar.doma.Metamodel; @Entity(metamodel = @Metamodel(prefix = "_")) public class Worker {} ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/dialect/Mssql2008PagingTransformer.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/internal/jdbc/dialect/Mssql2008PagingTransformer.java package org.seasar.doma.internal.jdbc.dialect; import org.seasar.doma.internal.jdbc.sql.node.AnonymousNode; import org.seasar.doma.internal.jdbc.sql.node.FragmentNode; import org.seasar.doma.internal.jdbc.sql.node.SelectClauseNode; import org.seasar.doma.internal.jdbc.sql.node.SelectStatementNode; import org.seasar.doma.jdbc.SqlNode; public class Mssql2008PagingTransformer extends StandardPagingTransformer { public Mssql2008PagingTransformer(long offset, long limit) { super(offset, limit); } @Override public SqlNode transform(SqlNode sqlNode) { AnonymousNode result = new AnonymousNode(); for (SqlNode child : sqlNode.getChildren()) { result.appendNode(child.accept(this, null)); } return result; } @Override public SqlNode visitSelectStatementNode(SelectStatementNode node, Void p) { if (processed) { return node; } if (offset > 0) { return super.visitSelectStatementNode(node, p); } processed = true; return appendTopNode(node); } protected SqlNode appendTopNode(SelectStatementNode node) { SelectClauseNode select = new SelectClauseNode(node.getSelectClauseNode().getWordNode()); select.appendNode(new FragmentNode(" top (" + limit + ")")); for (SqlNode child : node.getSelectClauseNode().getChildren()) { select.appendNode(child); } SelectStatementNode result = new SelectStatementNode(); result.setSelectClauseNode(select); result.setFromClauseNode(node.getFromClauseNode()); result.setWhereClauseNode(node.getWhereClauseNode()); result.setGroupByClauseNode(node.getGroupByClauseNode()); result.setHavingClauseNode(node.getHavingClauseNode()); result.setOrderByClauseNode(node.getOrderByClauseNode()); result.setForUpdateClauseNode(node.getForUpdateClauseNode()); result.setOptionClauseNode(node.getOptionClauseNode()); return result; } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/embeddable/LombokAllArgsConstructor.java ======================= <filename>doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/embeddable/LombokAllArgsConstructor.java package org.seasar.doma.internal.apt.processor.embeddable; import org.seasar.doma.Embeddable; import org.seasar.doma.internal.apt.lombok.AllArgsConstructor; @Embeddable @AllArgsConstructor public class LombokAllArgsConstructor { @SuppressWarnings("unused") private String street; @SuppressWarnings("unused") private String city; public LombokAllArgsConstructor(String street, String city) {} } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/cttype/CtTypeVisitor.java ======================= package org.seasar.doma.internal.apt.cttype; public interface CtTypeVisitor<R, P, TH extends Throwable> { R visitAnyCtType(AnyCtType ctType, P p) throws TH; R visitBatchResultCtType(BatchResultCtType ctType, P p) throws TH; R visitBasicCtType(BasicCtType ctType, P p) throws TH; R visitDomainCtType(DomainCtType ctType, P p) throws TH; R visitEmbeddableCtType(EmbeddableCtType ctType, P p) throws TH; R visitEntityCtType(EntityCtType ctType, P p) throws TH; R visitIterableCtType(IterableCtType ctType, P p) throws TH; R visitArrayCtType(ArrayCtType ctType, P p) throws TH; R visitCollectorCtType(CollectorCtType ctType, P p) throws TH; R visitReferenceCtType(ReferenceCtType ctType, P p) throws TH; R visitResultCtType(ResultCtType ctType, P p) throws TH; R visitSelectOptionsCtType(SelectOptionsCtType ctType, P p) throws TH; R visitMapCtType(MapCtType ctType, P p) throws TH; R visitNoneCtType(NoneCtType ctType, P p) throws TH; R visitOptionalCtType(OptionalCtType ctType, P p) throws TH; R visitOptionalIntCtType(OptionalIntCtType ctType, P p) throws TH; R visitOptionalLongCtType(OptionalLongCtType ctType, P p) throws TH; R visitOptionalDoubleCtType(OptionalDoubleCtType ctType, P p) throws TH; R visitFunctionCtType(FunctionCtType ctType, P p) throws TH; R visitStreamCtType(StreamCtType ctType, P p) throws TH; R visitBiFunctionCtType(BiFunctionCtType ctType, P p) throws TH; R visitConfigCtType(ConfigCtType ctType, P p) throws TH; R visitPreparedSqlCtType(PreparedSqlCtType ctType, P p) throws TH; } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/JdbcMappingVisitor.java ======================= <reponame>orekyuu/doma package org.seasar.doma.jdbc; import java.sql.SQLException; import org.seasar.doma.jdbc.type.JdbcType; import org.seasar.doma.wrapper.Wrapper; import org.seasar.doma.wrapper.WrapperVisitor; /** * A visitor that maps between {@link Wrapper} and {@link JdbcType}. * * <p>The implementation class must be thread safe. */ public interface JdbcMappingVisitor extends WrapperVisitor<Void, JdbcMappingFunction, JdbcMappingHint, SQLException> {} ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/command/EntityData.java ======================= package org.seasar.doma.jdbc.criteria.command; import java.util.Collections; import java.util.Map; import java.util.Objects; import org.seasar.doma.jdbc.entity.Property; public class EntityData { private final Map<String, Property<Object,?>> states; public EntityData(Map<String, Property<Object,?>> states) { Objects.requireNonNull(states); this.states = Collections.unmodifiableMap(states); } public Map<String, Property<Object,?>> getStates() { return states; } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/scalar/Scalar.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/internal/jdbc/scalar/Scalar.java<gh_stars>100-1000 package org.seasar.doma.internal.jdbc.scalar; import org.seasar.doma.jdbc.JdbcMappable; public interface Scalar<BASIC, CONTAINER> extends JdbcMappable<BASIC> { CONTAINER cast(Object value); CONTAINER get(); Object getAsNonOptional(); CONTAINER getDefault(); void set(CONTAINER container); } ======================= File: doma-core/src/main/java/org/seasar/doma/wrapper/PrimitiveByteWrapper.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/wrapper/PrimitiveByteWrapper.java package org.seasar.doma.wrapper; import org.seasar.doma.DomaNullPointerException; /** A wrapper for the {@code byte} class. */ public class PrimitiveByteWrapper extends ByteWrapper { private static final byte defaultValue = 0; public PrimitiveByteWrapper() { this(defaultValue); } public PrimitiveByteWrapper(byte value) { super(value); } @Override protected void doSet(Byte value) { this.value = value == null? defaultValue : value; } @Override public void set(Number v) { set(v == null? defaultValue : v.byteValue()); } @Override public Byte getDefault() { return defaultValue; } @Override public boolean isPrimitiveWrapper() { return true; } @Override public <R, P, Q, TH extends Throwable> R accept(WrapperVisitor<R, P, Q, TH> visitor, P p, Q q) throws TH { if (visitor == null) { throw new DomaNullPointerException("visitor"); } return visitor.visitPrimitiveByteWrapper(this, p, q); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/dao/DelegateDaoDelegate.java ======================= package org.seasar.doma.internal.apt.processor.dao; import java.math.BigDecimal; import org.seasar.doma.jdbc.Config; public class DelegateDaoDelegate { protected Config config; public DelegateDaoDelegate(Config config) { this.config = config; } public BigDecimal execute(String aaa, Integer bbb) { return null; } public BigDecimal execute2(String aaa, Integer bbb, String... ccc) { return null; } public void execute3(String aaa, Integer bbb, String... ccc) {} } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/util/ElementKindUtil.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.apt.util; import java.util.Arrays; import javax.lang.model.element.ElementKind; public final class ElementKindUtil { private static final ElementKind RECORD = Arrays.stream(ElementKind.values()) .filter(k -> "RECORD".equals(k.name())) .findAny() .orElse(null); public static boolean isRecord(ElementKind kind) { if (RECORD == null) { return false; } return RECORD == kind; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/NoCacheSqlFileRepository.java ======================= <gh_stars>100-1000 package org.seasar.doma.jdbc; import java.lang.reflect.Method; import org.seasar.doma.jdbc.dialect.Dialect; /** An SQL file repository that does not cache the results of SQL parsing. */ public class NoCacheSqlFileRepository extends AbstractSqlFileRepository { @Override protected SqlFile getSqlFileWithCacheControl(Method method, String path, Dialect dialect) { return createSqlFile(method, path, dialect); } } ======================= File: doma-core/src/main/java/org/seasar/doma/wrapper/NumberWrapper.java ======================= <gh_stars>100-1000 package org.seasar.doma.wrapper; /** * A wrapper for the {@link Number} class. * * @param <BASIC> The number type subclass */ public interface NumberWrapper<BASIC extends Number> extends Wrapper<BASIC> { @Override void set(Number value); /** Increments this object. */ void increment(); /** Decrements this object. */ void decrement(); } ======================= File: doma-core/src/main/java/org/seasar/doma/wrapper/LocalTimeWrapper.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/wrapper/LocalTimeWrapper.java package org.seasar.doma.wrapper; import java.time.LocalTime; import org.seasar.doma.DomaNullPointerException; /** A wrapper for the {@link LocalTime} class. */ public class LocalTimeWrapper extends AbstractWrapper<LocalTime> { public LocalTimeWrapper() { super(LocalTime.class); } public LocalTimeWrapper(LocalTime value) { super(LocalTime.class, value); } @Override public <R, P, Q, TH extends Throwable> R accept(WrapperVisitor<R, P, Q, TH> visitor, P p, Q q) throws TH { if (visitor == null) { throw new DomaNullPointerException("visitor"); } return visitor.visitLocalTimeWrapper(this, p, q); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/statement/EntityqlSelectStarting.java ======================= package org.seasar.doma.jdbc.criteria.statement; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Consumer; import org.seasar.doma.jdbc.Config; import org.seasar.doma.jdbc.command.Command; import org.seasar.doma.jdbc.criteria.declaration.JoinDeclaration; import org.seasar.doma.jdbc.criteria.declaration.OrderByNameDeclaration; import org.seasar.doma.jdbc.criteria.declaration.SelectFromDeclaration; import org.seasar.doma.jdbc.criteria.declaration.WhereDeclaration; import org.seasar.doma.jdbc.criteria.metamodel.EntityMetamodel; import org.seasar.doma.jdbc.criteria.metamodel.PropertyMetamodel; import org.seasar.doma.jdbc.criteria.option.AssociationOption; import org.seasar.doma.jdbc.criteria.option.DistinctOption; import org.seasar.doma.jdbc.criteria.option.ForUpdateOption; public class EntityqlSelectStarting<ENTITY> extends AbstractStatement<EntityqlSelectStarting<ENTITY>, List<ENTITY>> implements Listable<ENTITY> { private final SelectFromDeclaration declaration; private final EntityMetamodel<ENTITY> entityMetamodel; public EntityqlSelectStarting( Config config, SelectFromDeclaration declaration, EntityMetamodel<ENTITY> entityMetamodel) { super(Objects.requireNonNull(config)); this.declaration = Objects.requireNonNull(declaration); this.entityMetamodel = Objects.requireNonNull(entityMetamodel); } public EntityqlSelectStarting<ENTITY> distinct() { declaration.distinct(DistinctOption.basic()); return this; } public EntityqlSelectStarting<ENTITY> distinct(DistinctOption distinctOption) { Objects.requireNonNull(distinctOption); declaration.distinct(distinctOption); return this; } public EntityqlSelectStarting<ENTITY> innerJoin( EntityMetamodel<?> entityMetamodel, Consumer<JoinDeclaration> block) { Objects.requireNonNull(entityMetamodel); Objects.requireNonNull(block); declaration.innerJoin(entityMetamodel, block); return this; } public EntityqlSelectStarting<ENTITY> leftJoin( EntityMetamodel<?> entityMetamodel, Consumer<JoinDeclaration> block) { Objects.requireNonNull(entityMetamodel); Objects.requireNonNull(block); declaration.leftJoin(entityMetamodel, block); return this; } public <ENTITY1, ENTITY2> EntityqlSelectStarting<ENTITY> associate( EntityMetamodel<ENTITY1> first, EntityMetamodel<ENTITY2> second, BiConsumer<ENTITY1, ENTITY2> associator) { Objects.requireNonNull(first); Objects.requireNonNull(second); Objects.requireNonNull(associator); declaration.associate(first, second, associator, AssociationOption.mandatory()); return this; } public <ENTITY1, ENTITY2> EntityqlSelectStarting<ENTITY> associate( EntityMetamodel<ENTITY1> first, EntityMetamodel<ENTITY2> second, BiConsumer<ENTITY1, ENTITY2> associator, AssociationOption option) { Objects.requireNonNull(first); Objects.requireNonNull(second); Objects.requireNonNull(associator); Objects.requireNonNull(option); declaration.associate(first, second, associator, option); return this; } public <ENTITY1, ENTITY2> EntityqlSelectStarting<ENTITY> associateWith( EntityMetamodel<ENTITY1> first, EntityMetamodel<ENTITY2> second, BiFunction<ENTITY1, ENTITY2, ENTITY1> associator) { Objects.requireNonNull(first); Objects.requireNonNull(second); Objects.requireNonNull(associator); declaration.associateWith(first, second, associator, AssociationOption.mandatory()); return this; } public <ENTITY1, ENTITY2> EntityqlSelectStarting<ENTITY> associateWith( EntityMetamodel<ENTITY1> first, EntityMetamodel<ENTITY2> second, BiFunction<ENTITY1, ENTITY2, ENTITY1> associator, AssociationOption option) { Objects.requireNonNull(first); Objects.requireNonNull(second); Objects.requireNonNull(associator); Objects.requireNonNull(option); declaration.associateWith(first, second, associator, option); return this; } public EntityqlSelectStarting<ENTITY> where(Consumer<WhereDeclaration> block) { Objects.requireNonNull(block); declaration.where(block); return this; } public EntityqlSelectStarting<ENTITY> orderBy(Consumer<OrderByNameDeclaration> block) { Objects.requireNonNull(block); declaration.orderBy(block); return this; } public EntityqlSelectStarting<ENTITY> limit(Integer limit) { declaration.limit(limit); return this; } public EntityqlSelectStarting<ENTITY> offset(Integer offset) { declaration.offset(offset); return this; } public EntityqlSelectStarting<ENTITY> forUpdate() { declaration.forUpdate(ForUpdateOption.basic()); return this; } public EntityqlSelectStarting<ENTITY> forUpdate(ForUpdateOption option) { Objects.requireNonNull(option); declaration.forUpdate(option); return this; } public <RESULT> EntityqlSelectTerminal<RESULT> select(EntityMetamodel<RESULT> entityMetamodel) { Objects.requireNonNull(entityMetamodel); declaration.select(entityMetamodel); return new EntityqlSelectTerminal<>(config, declaration, entityMetamodel); } public <RESULT> EntityqlSelectTerminal<RESULT> selectTo( EntityMetamodel<RESULT> entityMetamodel, PropertyMetamodel<?>... propertyMetamodels) { Objects.requireNonNull(entityMetamodel); Objects.requireNonNull(propertyMetamodels); declaration.selectTo(entityMetamodel, Arrays.asList(propertyMetamodels)); return new EntityqlSelectTerminal<>(config, declaration, entityMetamodel); } @Override protected Command<List<ENTITY>> createCommand() { EntityqlSelectTerminal<ENTITY> terminal = new EntityqlSelectTerminal<>(config, declaration, entityMetamodel); return terminal.createCommand(); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/sql/node/RemovableClauseNode.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.jdbc.sql.node; public interface RemovableClauseNode extends ClauseNode {} ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/OutParameter.java ======================= package org.seasar.doma.jdbc; /** * An output parameter. * * @param <BASIC> the basic type */ public interface OutParameter<BASIC> extends SqlParameter, JdbcMappable<BASIC> { /** Updates the reference value. */ void updateReference(); } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/dao/IllegalModifyImmutableEmpDao.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.apt.processor.dao; import org.seasar.doma.Dao; import org.seasar.doma.Insert; import org.seasar.doma.internal.apt.processor.entity.ImmutableEmp; @SuppressWarnings("deprecation") @Dao(config = MyConfig.class) public interface IllegalModifyImmutableEmpDao { @Insert int insert(ImmutableEmp emp); } ======================= File: doma-core/src/test/java/org/seasar/doma/jdbc/entity/OriginalStatesAccessExceptionTest.java ======================= <reponame>orekyuu/doma package org.seasar.doma.jdbc.entity; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; public class OriginalStatesAccessExceptionTest { @Test public void test() { OriginalStatesAccessException e = new OriginalStatesAccessException(new Exception(), "aaa", "bbb"); System.out.println(e.getMessage()); assertEquals("aaa", e.getEntityClassName()); assertEquals("bbb", e.getFieldName()); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/id/AbstractIdGenerator.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/jdbc/id/AbstractIdGenerator.java package org.seasar.doma.jdbc.id; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.seasar.doma.internal.jdbc.util.JdbcUtil; import org.seasar.doma.jdbc.JdbcException; import org.seasar.doma.jdbc.JdbcLogger; import org.seasar.doma.jdbc.Sql; import org.seasar.doma.message.Message; /** A skeletal implementation of the {@link IdGenerator} interface. */ public abstract class AbstractIdGenerator implements IdGenerator { /** * Executes the SQL and gets a generated identity. * * @param config the configuration for identity generation * @param sql the SQL to get the generated identityL * @return the generated identity * @throws JdbcException if a JDBC related error occurs */ protected long getGeneratedValue(IdGenerationConfig config, Sql<?> sql) { JdbcLogger logger = config.getJdbcLogger(); Connection connection = JdbcUtil.getConnection(config.getDataSource()); try { PreparedStatement preparedStatement = JdbcUtil.prepareStatement(connection, sql); try { logger.logSql(getClass().getName(), "getGeneratedId", sql); setupOptions(config, preparedStatement); ResultSet resultSet = preparedStatement.executeQuery(); return getGeneratedValue(config, resultSet); } catch (SQLException e) { throw new JdbcException(Message.DOMA2018, e, config.getEntityType().getName(), e); } finally { JdbcUtil.close(preparedStatement, logger); } } finally { JdbcUtil.close(connection, logger); } } /** * Set up options for the {@code preparedStatement} object. * * @param config the configuration for identity generation * @param preparedStatement the prepared statement * @throws SQLException if operations for the {@code preparedStatement} are failed */ protected void setupOptions(IdGenerationConfig config, PreparedStatement preparedStatement) throws SQLException { if (config.getFetchSize() > 0) { preparedStatement.setFetchSize(config.getFetchSize()); } if (config.getMaxRows() > 0) { preparedStatement.setMaxRows(config.getMaxRows()); } if (config.getQueryTimeout() > 0) { preparedStatement.setQueryTimeout(config.getQueryTimeout()); } } /** * Retrieves a generated identity from the {@link ResultSet} object. * * @param config the configuration for identity generation * @param resultSet the result set * @return the generated identity * @throws JdbcException if a JDBC related error occurs */ protected long getGeneratedValue(IdGenerationConfig config, ResultSet resultSet) { JdbcLogger logger = config.getJdbcLogger(); try { if (resultSet.next()) { return resultSet.getLong(1); } throw new JdbcException(Message.DOMA2017, config.getEntityType().getName()); } catch (final SQLException e) { throw new JdbcException(Message.DOMA2018, e, config.getEntityType().getName(), e); } finally { JdbcUtil.close(resultSet, logger); } } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/parameter/CallableSqlParameterMeta.java ======================= <filename>doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/parameter/CallableSqlParameterMeta.java<gh_stars>100-1000 package org.seasar.doma.internal.apt.meta.parameter; public interface CallableSqlParameterMeta { <R, P> R accept(CallableSqlParameterMetaVisitor<R, P> visitor, P p); } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/processor/EntityProcessor.java ======================= package org.seasar.doma.internal.apt.processor; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import java.util.Set; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedOptions; import javax.lang.model.element.Name; import javax.lang.model.element.TypeElement; import javax.lang.model.util.ElementFilter; import org.seasar.doma.Entity; import org.seasar.doma.internal.ClassName; import org.seasar.doma.internal.ClassNames; import org.seasar.doma.internal.apt.Options; import org.seasar.doma.internal.apt.annot.EntityAnnot; import org.seasar.doma.internal.apt.annot.MetamodelAnnot; import org.seasar.doma.internal.apt.generator.EntityMetamodelGenerator; import org.seasar.doma.internal.apt.generator.EntityTypeGenerator; import org.seasar.doma.internal.apt.generator.Generator; import org.seasar.doma.internal.apt.generator.JavaFileGenerator; import org.seasar.doma.internal.apt.generator.Printer; import org.seasar.doma.internal.apt.meta.entity.EntityMeta; import org.seasar.doma.internal.apt.meta.entity.EntityMetaFactory; @SupportedAnnotationTypes({"org.seasar.doma.Entity"}) @SupportedOptions({ Options.ENTITY_FIELD_PREFIX, Options.DOMAIN_CONVERTERS, Options.VERSION_VALIDATION, Options.RESOURCES_DIR, Options.LOMBOK_VALUE, Options.LOMBOK_ALL_ARGS_CONSTRUCTOR, Options.TEST, Options.DEBUG, Options.CONFIG_PATH, Options.METAMODEL_ENABLED, Options.METAMODEL_PREFIX, Options.METAMODEL_SUFFIX }) public class EntityProcessor extends AbstractProcessor { public EntityProcessor() { super(Entity.class); } @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver()) { return true; } for (TypeElement annotation : annotations) { final EntityMetaFactory factory = new EntityMetaFactory(ctx); for (TypeElement typeElement : ElementFilter.typesIn(roundEnv.getElementsAnnotatedWith(annotation))) { handleTypeElement( typeElement, __ -> { EntityMeta meta = factory.createTypeElementMeta(typeElement); if (!meta.isError()) { generateEntityType(typeElement, meta); if (isMetamodelEnabled(meta)) { generateEntityMetamodel(typeElement, meta); } } }); } } return true; } private boolean isMetamodelEnabled(EntityMeta meta) { EntityAnnot entityAnnot = meta.getEntityAnnot(); MetamodelAnnot metamodelAnnot = entityAnnot.getMetamodelValue(); return metamodelAnnot!= null || ctx.getOptions().isMetamodelEnabled(); } private void generateEntityType(TypeElement typeElement, EntityMeta meta) { JavaFileGenerator<EntityMeta> generator = new JavaFileGenerator<>( ctx, this::createEntityTypeClassName, this::createEntityTypeGenerator); generator.generate(typeElement, meta); } private ClassName createEntityTypeClassName(TypeElement typeElement, EntityMeta meta) { assertNotNull(typeElement, meta); Name binaryName = ctx.getMoreElements().getBinaryName(typeElement); return ClassNames.newEntityTypeClassName(binaryName); } private Generator createEntityTypeGenerator( ClassName className, Printer printer, EntityMeta meta) { assertNotNull(className, meta, printer); return new EntityTypeGenerator(ctx, className, printer, meta); } private void generateEntityMetamodel(TypeElement typeElement, EntityMeta meta) { JavaFileGenerator<EntityMeta> generator = new JavaFileGenerator<>( ctx, this::createEntityMetamodelClassName, this::createEntityMetamodelGenerator); generator.generate(typeElement, meta); } private ClassName createEntityMetamodelClassName(TypeElement typeElement, EntityMeta meta) { assertNotNull(typeElement, meta); EntityAnnot entityAnnot = meta.getEntityAnnot(); MetamodelAnnot metamodelAnnot = entityAnnot.getMetamodelValue(); Name binaryName = ctx.getMoreElements().getBinaryName(typeElement); String prefix = ctx.getOptions().getMetamodelPrefix(); String suffix = ctx.getOptions().getMetamodelSuffix(); if (metamodelAnnot!= null) { String prefixValue = metamodelAnnot.getPrefixValue(); String suffixValue = metamodelAnnot.getSuffixValue(); if (!prefixValue.isEmpty() ||!suffixValue.isEmpty()) { prefix = prefixValue; suffix = suffixValue; } } return ClassNames.newEntityMetamodelClassNameBuilder(binaryName, prefix, suffix); } private Generator createEntityMetamodelGenerator( ClassName className, Printer printer, EntityMeta meta) { assertNotNull(className, meta, printer); ClassName entityTypeName = createEntityTypeClassName(meta.getTypeElement(), meta); return new EntityMetamodelGenerator(ctx, className, printer, meta, entityTypeName); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/entity/EntityPropertyNotDefinedException.java ======================= <reponame>orekyuu/doma<gh_stars>100-1000 package org.seasar.doma.jdbc.entity; import org.seasar.doma.jdbc.JdbcException; import org.seasar.doma.message.Message; /** Thrown to indicate that a property is not defined in an entity. */ public class EntityPropertyNotDefinedException extends JdbcException { private static final long serialVersionUID = 1L; private final String entityClassName; private final String entityPropertyName; public EntityPropertyNotDefinedException(String entityClassName, String entityPropertyName) { super(Message.DOMA2207, entityClassName, entityPropertyName); this.entityClassName = entityClassName; this.entityPropertyName = entityPropertyName; } public String getEntityClassName() { return entityClassName; } public String getEntityPropertyName() { return entityPropertyName; } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/query/AutoBatchModifyQueryMetaFactory.java ======================= package org.seasar.doma.internal.apt.meta.query; import java.util.List; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import org.seasar.doma.internal.apt.AptException; import org.seasar.doma.internal.apt.Context; import org.seasar.doma.internal.apt.annot.BatchModifyAnnot; import org.seasar.doma.internal.apt.annot.SqlAnnot; import org.seasar.doma.internal.apt.cttype.CtType; import org.seasar.doma.internal.apt.cttype.EntityCtType; import org.seasar.doma.internal.apt.cttype.IterableCtType; import org.seasar.doma.internal.apt.cttype.SimpleCtTypeVisitor; import org.seasar.doma.message.Message; public class AutoBatchModifyQueryMetaFactory extends AbstractQueryMetaFactory<AutoBatchModifyQueryMeta> { public AutoBatchModifyQueryMetaFactory( Context ctx, TypeElement daoElement, ExecutableElement methodElement) { super(ctx, daoElement, methodElement); } @Override public QueryMeta createQueryMeta() { AutoBatchModifyQueryMeta queryMeta = createAutoBatchModifyQueryMeta(); if (queryMeta == null) { return null; } doTypeParameters(queryMeta); doParameters(queryMeta); doReturnType(queryMeta); doThrowTypes(queryMeta); return queryMeta; } private AutoBatchModifyQueryMeta createAutoBatchModifyQueryMeta() { SqlAnnot sqlAnnot = ctx.getAnnotations().newSqlAnnot(methodElement); if (sqlAnnot!= null) { return null; } AutoBatchModifyQueryMeta queryMeta = new AutoBatchModifyQueryMeta(daoElement, methodElement); BatchModifyAnnot batchModifyAnnot = ctx.getAnnotations().newBatchInsertAnnot(methodElement); if (batchModifyAnnot!= null &&!batchModifyAnnot.getSqlFileValue()) { queryMeta.setBatchModifyAnnot(batchModifyAnnot); queryMeta.setQueryKind(QueryKind.AUTO_BATCH_INSERT); return queryMeta; } batchModifyAnnot = ctx.getAnnotations().newBatchUpdateAnnot(methodElement); if (batchModifyAnnot!= null &&!batchModifyAnnot.getSqlFileValue()) { queryMeta.setBatchModifyAnnot(batchModifyAnnot); queryMeta.setQueryKind(QueryKind.AUTO_BATCH_UPDATE); return queryMeta; } batchModifyAnnot = ctx.getAnnotations().newBatchDeleteAnnot(methodElement); if (batchModifyAnnot!= null &&!batchModifyAnnot.getSqlFileValue()) { queryMeta.setBatchModifyAnnot(batchModifyAnnot); queryMeta.setQueryKind(QueryKind.AUTO_BATCH_DELETE); return queryMeta; } return null; } @Override protected void doReturnType(AutoBatchModifyQueryMeta queryMeta) { QueryReturnMeta returnMeta = createReturnMeta(queryMeta); EntityCtType entityCtType = queryMeta.getEntityCtType(); if (entityCtType!= null && entityCtType.isImmutable()) { if (!returnMeta.isBatchResult(entityCtType)) { throw new AptException(Message.DOMA4223, methodElement, new Object[] {}); } } else { if (!returnMeta.isPrimitiveIntArray()) { throw new AptException(Message.DOMA4040, methodElement, new Object[] {}); } } queryMeta.setReturnMeta(returnMeta); } @Override protected void doParameters(AutoBatchModifyQueryMeta queryMeta) { List<? extends VariableElement> parameters = methodElement.getParameters(); int size = parameters.size(); if (size!= 1) { throw new AptException(Message.DOMA4002, methodElement, new Object[] {}); } final QueryParameterMeta parameterMeta = createParameterMeta(parameters.get(0)); IterableCtType iterableCtType = parameterMeta .getCtType() .accept( new SimpleCtTypeVisitor<IterableCtType, Void, RuntimeException>() { @Override protected IterableCtType defaultAction(CtType ctType, Void p) throws RuntimeException { throw new AptException(Message.DOMA4042, methodElement, new Object[] {}); } @Override public IterableCtType visitIterableCtType(IterableCtType ctType, Void p) throws RuntimeException { return ctType; } }, null); EntityCtType entityCtType = iterableCtType .getElementCtType() .accept( new SimpleCtTypeVisitor<EntityCtType, Void, RuntimeException>() { @Override protected EntityCtType defaultAction(CtType ctType, Void p) throws RuntimeException { throw new AptException(Message.DOMA4043, methodElement, new Object[] {}); } @Override public EntityCtType visitEntityCtType(EntityCtType ctType, Void p) throws RuntimeException { return ctType; } }, null); queryMeta.setEntityCtType(entityCtType); queryMeta.setEntitiesParameterName(parameterMeta.getName()); queryMeta.addParameterMeta(parameterMeta); if (parameterMeta.isBindable()) { queryMeta.addBindableParameterCtType(parameterMeta.getName(), parameterMeta.getCtType()); } BatchModifyAnnot batchModifyAnnot = queryMeta.getBatchModifyAnnot(); validateEntityPropertyNames( entityCtType.getType(), batchModifyAnnot.getAnnotationMirror(), batchModifyAnnot.getInclude(), batchModifyAnnot.getExclude()); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/sql/node/SelectStatementNode.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/internal/jdbc/sql/node/SelectStatementNode.java<gh_stars>100-1000 package org.seasar.doma.internal.jdbc.sql.node; import org.seasar.doma.DomaNullPointerException; import org.seasar.doma.jdbc.JdbcUnsupportedOperationException; import org.seasar.doma.jdbc.SqlNode; import org.seasar.doma.jdbc.SqlNodeVisitor; public class SelectStatementNode extends AbstractSqlNode implements WhereClauseAwareNode { protected SelectClauseNode selectClauseNode; protected FromClauseNode fromClauseNode; protected WhereClauseNode whereClauseNode; protected GroupByClauseNode groupByClauseNode; protected HavingClauseNode havingClauseNode; protected OrderByClauseNode orderByClauseNode; protected ForUpdateClauseNode forUpdateClauseNode; protected OptionClauseNode optionClauseNode; public SelectClauseNode getSelectClauseNode() { return selectClauseNode; } public void setSelectClauseNode(SelectClauseNode selectClauseNode) { this.selectClauseNode = selectClauseNode; appendNodeInternal(selectClauseNode); } public FromClauseNode getFromClauseNode() { return fromClauseNode; } public void setFromClauseNode(FromClauseNode fromClauseNode) { this.fromClauseNode = fromClauseNode; appendNodeInternal(fromClauseNode); } @Override public WhereClauseNode getWhereClauseNode() { return whereClauseNode; } @Override public void setWhereClauseNode(WhereClauseNode whereClauseNode) { this.whereClauseNode = whereClauseNode; appendNodeInternal(whereClauseNode); } public GroupByClauseNode getGroupByClauseNode() { return groupByClauseNode; } public void setGroupByClauseNode(GroupByClauseNode groupByClauseNode) { this.groupByClauseNode = groupByClauseNode; appendNodeInternal(groupByClauseNode); } public HavingClauseNode getHavingClauseNode() { return havingClauseNode; } public void setHavingClauseNode(HavingClauseNode havingClauseNode) { this.havingClauseNode = havingClauseNode; appendNodeInternal(havingClauseNode); } public OrderByClauseNode getOrderByClauseNode() { return orderByClauseNode; } public void setOrderByClauseNode(OrderByClauseNode orderByClauseNode) { this.orderByClauseNode = orderByClauseNode; appendNodeInternal(orderByClauseNode); } public ForUpdateClauseNode getForUpdateClauseNode() { return forUpdateClauseNode; } public void setForUpdateClauseNode(ForUpdateClauseNode forUpdateClauseNode) { this.forUpdateClauseNode = forUpdateClauseNode; appendNodeInternal(forUpdateClauseNode); } public OptionClauseNode getOptionClauseNode() { return optionClauseNode; } public void setOptionClauseNode(OptionClauseNode optionClauseNode) { this.optionClauseNode = optionClauseNode; appendNodeInternal(optionClauseNode); } @Override public void appendNode(SqlNode child) { throw new JdbcUnsupportedOperationException(getClass().getName(), "addNode"); } protected void appendNodeInternal(SqlNode child) { if (child!= null) { super.appendNode(child); } } @Override public <R, P> R accept(SqlNodeVisitor<R, P> visitor, P p) { if (visitor == null) { throw new DomaNullPointerException("visitor"); } return visitor.visitSelectStatementNode(this, p); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/domain/InterfaceNew.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.apt.processor.domain; import org.seasar.doma.Domain; @Domain(valueType = String.class) public interface InterfaceNew { String getValue(); } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/parameter/OptionalLongSingleResultParameterMeta.java ======================= package org.seasar.doma.internal.apt.meta.parameter; public class OptionalLongSingleResultParameterMeta implements SingleResultParameterMeta { @Override public <R, P> R accept(CallableSqlParameterMetaVisitor<R, P> visitor, P p) { return visitor.visitOptionalLongSingleResultParameterMeta(this, p); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/type/LocalTimeType.java ======================= <gh_stars>100-1000 package org.seasar.doma.jdbc.type; import java.sql.*; import java.time.LocalTime; /** A JDBC type for {@link Types#TIME} and {@link LocalTime}. */ public class LocalTimeType extends AbstractJdbcType<LocalTime> { public LocalTimeType() { super(Types.TIME); } @Override public LocalTime doGetValue(ResultSet resultSet, int index) throws SQLException { Time time = resultSet.getTime(index); return time!= null? time.toLocalTime() : null; } @Override protected void doSetValue(PreparedStatement preparedStatement, int index, LocalTime value) throws SQLException { preparedStatement.setTime(index, Time.valueOf(value)); } @Override protected LocalTime doGetValue(CallableStatement callableStatement, int index) throws SQLException { Time time = callableStatement.getTime(index); return time!= null? time.toLocalTime() : null; } @Override protected String doConvertToLogFormat(LocalTime value) { return "'" + Time.valueOf(value) + "'"; } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/NoDefaultConstructorEntityListenerEntity.java ======================= <reponame>orekyuu/doma<filename>doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/NoDefaultConstructorEntityListenerEntity.java package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.Entity; @Entity(listener = NoDefaultConstructorEntityListener.class) public class NoDefaultConstructorEntityListenerEntity {} ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/id/SequenceIdGenerator.java ======================= package org.seasar.doma.jdbc.id; import org.seasar.doma.jdbc.JdbcException; /** A generator that uses a database SEQUENCE. */ public interface SequenceIdGenerator extends IdGenerator { /** * Sets the qualified name of the sequence. * * @param qualifiedSequenceName the qualified name of the sequence */ void setQualifiedSequenceName(String qualifiedSequenceName); /** * Sets the initial value. * * @param initialValue the initial value */ void setInitialValue(long initialValue); /** * Sets the allocation size. * * @param allocationSize the allocation size */ void setAllocationSize(long allocationSize); /** * Initializes this generator. * * @throws JdbcException if the initialization is failed */ @SuppressWarnings("EmptyMethod") void initialize(); } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/dao/ScriptDao.java ======================= package org.seasar.doma.internal.apt.processor.dao; import org.seasar.doma.Dao; import org.seasar.doma.Script; @SuppressWarnings("deprecation") @Dao(config = MyConfig.class) public interface ScriptDao { @Script void createTables(); @Script(blockDelimiter = "GO", haltOnError = false) void dropTables(); } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/GenericListener5Entity.java ======================= package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.Entity; @Entity(listener = GenericListener5.class) public class GenericListener5Entity {} ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/query/SqlFileSelectQueryMeta.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.apt.meta.query; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import org.seasar.doma.FetchType; import org.seasar.doma.MapKeyNamingType; import org.seasar.doma.SelectType; import org.seasar.doma.internal.apt.annot.SelectAnnot; import org.seasar.doma.internal.apt.cttype.CollectorCtType; import org.seasar.doma.internal.apt.cttype.EntityCtType; import org.seasar.doma.internal.apt.cttype.FunctionCtType; import org.seasar.doma.internal.apt.cttype.SelectOptionsCtType; import org.seasar.doma.jdbc.SqlLogType; public class SqlFileSelectQueryMeta extends AbstractSqlFileQueryMeta { private SelectAnnot selectAnnot; private String functionParameterName; private FunctionCtType functionCtType; private String collectorParameterName; private CollectorCtType collectorCtType; private String selectOptionsParameterName; private SelectOptionsCtType selectOptionsCtType; private EntityCtType entityCtType; private boolean resultStream; public SqlFileSelectQueryMeta(TypeElement daoElement, ExecutableElement methodElement) { super(daoElement, methodElement); } public String getFunctionParameterName() { return functionParameterName; } public void setFunctionParameterName(String functionParameterName) { this.functionParameterName = functionParameterName; } public FunctionCtType getFunctionCtType() { return functionCtType; } public void setFunctionCtType(FunctionCtType functionCtType) { this.functionCtType = functionCtType; } public String getCollectorParameterName() { return collectorParameterName; } public void setCollectorParameterName(String collectorParameterName) { this.collectorParameterName = collectorParameterName; } public CollectorCtType getCollectorCtType() { return collectorCtType; } public void setCollectorCtType(CollectorCtType collectorCtType) { this.collectorCtType = collectorCtType; } public String getSelectOptionsParameterName() { return selectOptionsParameterName; } public void setSelectOptionsParameterName(String selectOptionsParameterName) { this.selectOptionsParameterName = selectOptionsParameterName; } public SelectOptionsCtType getSelectOptionsCtType() { return selectOptionsCtType; } public void setSelectOptionsCtType(SelectOptionsCtType selectOptionsCtType) { this.selectOptionsCtType = selectOptionsCtType; } public EntityCtType getEntityCtType() { return entityCtType; } public void setEntityCtType(EntityCtType entityCtType) { this.entityCtType = entityCtType; } void setSelectAnnot(SelectAnnot selectAnnot) { this.selectAnnot = selectAnnot; } SelectAnnot getSelectAnnot() { return selectAnnot; } public int getFetchSize() { return selectAnnot.getFetchSizeValue(); } public int getMaxRows() { return selectAnnot.getMaxRowsValue(); } public int getQueryTimeout() { return selectAnnot.getQueryTimeoutValue(); } public SelectType getSelectStrategyType() { return selectAnnot.getStrategyValue(); } public FetchType getFetchType() { return selectAnnot.getFetchValue(); } public boolean getEnsureResult() { return selectAnnot.getEnsureResultValue(); } public boolean getEnsureResultMapping() { return selectAnnot.getEnsureResultMappingValue(); } public MapKeyNamingType getMapKeyNamingType() { return selectAnnot.getMapKeyNamingValue(); } public SqlLogType getSqlLogType() { return selectAnnot.getSqlLogValue(); } public boolean isExpandable() { return entityCtType!= null; } public boolean isResultStream() { return resultStream; } public void setResultStream(boolean resultStream) { this.resultStream = resultStream; } @Override public <R> R accept(QueryMetaVisitor<R> visitor) { return visitor.visitSqlFileSelectQueryMeta(this); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/domain/Wednesday.java ======================= package org.seasar.doma.internal.apt.processor.domain; public class Wednesday {} ======================= File: doma-core/src/main/java/org/seasar/doma/wrapper/LongWrapper.java ======================= <reponame>orekyuu/doma package org.seasar.doma.wrapper; import org.seasar.doma.DomaNullPointerException; /** A wrapper for the {@link Long} class. */ public class LongWrapper extends AbstractWrapper<Long> implements NumberWrapper<Long> { public LongWrapper() { super(Long.class); } public LongWrapper(Long value) { super(Long.class, value); } @Override public void set(Number v) { super.set(v.longValue()); } @Override public void increment() { Long value = doGet(); if (value!= null) { doSet(value + 1L); } } @Override public void decrement() { Long value = doGet(); if (value!= null) { doSet(value - 1L); } } @Override public <R, P, Q, TH extends Throwable> R accept(WrapperVisitor<R, P, Q, TH> visitor, P p, Q q) throws TH { if (visitor == null) { throw new DomaNullPointerException("visitor"); } return visitor.visitLongWrapper(this, p, q); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/annot/SqlProcessorAnnot.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.apt.annot; import javax.lang.model.element.AnnotationMirror; public class SqlProcessorAnnot extends AbstractAnnot { SqlProcessorAnnot(AnnotationMirror annotationMirror) { super(annotationMirror); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/type/TimeType.java ======================= package org.seasar.doma.jdbc.type; import java.sql.*; /** A JDBC type for {@link Types#TIME} and {@link Time}. */ public class TimeType extends AbstractJdbcType<Time> { public TimeType() { super(Types.TIME); } @Override protected Time doGetValue(ResultSet resultSet, int index) throws SQLException { return resultSet.getTime(index); } @Override protected void doSetValue(PreparedStatement preparedStatement, int index, Time value) throws SQLException { preparedStatement.setTime(index, value); } @Override protected Time doGetValue(CallableStatement callableStatement, int index) throws SQLException { return callableStatement.getTime(index); } @Override protected String doConvertToLogFormat(Time value) { return "'" + value + "'"; } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/query/AutoModuleQueryMetaFactory.java ======================= <filename>doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/query/AutoModuleQueryMetaFactory.java package org.seasar.doma.internal.apt.meta.query; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import org.seasar.doma.In; import org.seasar.doma.InOut; import org.seasar.doma.Out; import org.seasar.doma.internal.apt.AptException; import org.seasar.doma.internal.apt.Context; import org.seasar.doma.internal.apt.annot.ResultSetAnnot; import org.seasar.doma.internal.apt.cttype.BasicCtType; import org.seasar.doma.internal.apt.cttype.CtType; import org.seasar.doma.internal.apt.cttype.DomainCtType; import org.seasar.doma.internal.apt.cttype.EntityCtType; import org.seasar.doma.internal.apt.cttype.IterableCtType; import org.seasar.doma.internal.apt.cttype.MapCtType; import org.seasar.doma.internal.apt.cttype.OptionalCtType; import org.seasar.doma.internal.apt.cttype.OptionalDoubleCtType; import org.seasar.doma.internal.apt.cttype.OptionalIntCtType; import org.seasar.doma.internal.apt.cttype.OptionalLongCtType; import org.seasar.doma.internal.apt.cttype.ReferenceCtType; import org.seasar.doma.internal.apt.cttype.SimpleCtTypeVisitor; import org.seasar.doma.internal.apt.meta.parameter.*; import org.seasar.doma.message.Message; public abstract class AutoModuleQueryMetaFactory<M extends AutoModuleQueryMeta> extends AbstractQueryMetaFactory<M> { AutoModuleQueryMetaFactory(Context ctx, TypeElement daoElement, ExecutableElement methodElement) { super(ctx, daoElement, methodElement); } @Override protected void doParameters(M queryMeta) { for (VariableElement parameter : methodElement.getParameters()) { QueryParameterMeta parameterMeta = createParameterMeta(parameter); queryMeta.addParameterMeta(parameterMeta); CallableSqlParameterMeta callableSqlParameterMeta = createParameterMeta(parameterMeta); queryMeta.addCallableSqlParameterMeta(callableSqlParameterMeta); if (parameterMeta.isBindable()) { queryMeta.addBindableParameterCtType(parameterMeta.getName(), parameterMeta.getCtType()); } } } private CallableSqlParameterMeta createParameterMeta(final QueryParameterMeta parameterMeta) { ResultSetAnnot resultSetAnnot = ctx.getAnnotations().newResultSetAnnot(parameterMeta.getElement()); if (resultSetAnnot!= null) { return createResultSetParameterMeta(parameterMeta, resultSetAnnot); } if (parameterMeta.isAnnotated(In.class)) { return createInParameterMeta(parameterMeta); } if (parameterMeta.isAnnotated(Out.class)) { return createOutParameterMeta(parameterMeta); } if (parameterMeta.isAnnotated(InOut.class)) { return createInOutParameterMeta(parameterMeta); } throw new AptException(Message.DOMA4066, parameterMeta.getElement(), new Object[] {}); } private CallableSqlParameterMeta createResultSetParameterMeta( final QueryParameterMeta parameterMeta, final ResultSetAnnot resultSetAnnot) { IterableCtType iterableCtType = parameterMeta.getCtType().accept(new ResultSetCtTypeVisitor(parameterMeta), null); return iterableCtType .getElementCtType() .accept(new ResultSetElementCtTypeVisitor(parameterMeta, resultSetAnnot), false); } private CallableSqlParameterMeta createInParameterMeta(final QueryParameterMeta parameterMeta) { return parameterMeta.getCtType().accept(new InCtTypeVisitor(parameterMeta), false); } private CallableSqlParameterMeta createOutParameterMeta(final QueryParameterMeta parameterMeta) { final ReferenceCtType referenceCtType = parameterMeta.getCtType().accept(new OutCtTypeVisitor(parameterMeta), null); return referenceCtType .getReferentCtType() .accept(new OutReferentCtTypeVisitor(parameterMeta, referenceCtType), false); } private CallableSqlParameterMeta createInOutParameterMeta( final QueryParameterMeta parameterMeta) { final ReferenceCtType referenceCtType = parameterMeta.getCtType().accept(new InOutCtTypeVisitor(parameterMeta), null); return referenceCtType .getReferentCtType() .accept(new InOutReferentCtTypeVisitor(parameterMeta, referenceCtType), false); } static class ResultSetCtTypeVisitor extends SimpleCtTypeVisitor<IterableCtType, Void, RuntimeException> { final QueryParameterMeta parameterMeta; ResultSetCtTypeVisitor(QueryParameterMeta parameterMeta) { this.parameterMeta = parameterMeta; } @Override protected IterableCtType defaultAction(CtType type, Void p) throws RuntimeException { throw new AptException(Message.DOMA4062, parameterMeta.getElement(), new Object[] {}); } @Override public IterableCtType visitIterableCtType(IterableCtType ctType, Void p) throws RuntimeException { if (!ctType.isList()) { defaultAction(ctType, p); } return ctType; } } static class ResultSetElementCtTypeVisitor extends SimpleCtTypeVisitor<CallableSqlParameterMeta, Boolean, RuntimeException> { final QueryParameterMeta parameterMeta; final ResultSetAnnot resultSetAnnot; ResultSetElementCtTypeVisitor(QueryParameterMeta parameterMeta, ResultSetAnnot resultSetAnnot) { this.parameterMeta = parameterMeta; this.resultSetAnnot = resultSetAnnot; } @Override protected CallableSqlParameterMeta defaultAction(CtType type, Boolean p) throws RuntimeException { throw new AptException( Message.DOMA4186, parameterMeta.getElement(), new Object[] {type.getType()}); } @Override public CallableSqlParameterMeta visitEntityCtType(EntityCtType ctType, Boolean p) throws RuntimeException { if (ctType.isAbstract()) { throw new AptException( Message.DOMA4157, parameterMeta.getElement(), new Object[] {ctType.getType()}); } return new EntityListParameterMeta( parameterMeta.getName(), ctType, resultSetAnnot.getEnsureResultMappingValue()); } @Override public CallableSqlParameterMeta visitMapCtType(MapCtType ctType, Boolean p) throws RuntimeException { return new MapListParameterMeta(parameterMeta.getName(), ctType); } @Override public CallableSqlParameterMeta visitBasicCtType(BasicCtType ctType, Boolean optional) throws RuntimeException { if (Boolean.TRUE == optional) { return new OptionalBasicListParameterMeta(parameterMeta.getName(), ctType); } return new BasicListParameterMeta(parameterMeta.getName(), ctType); } @Override public CallableSqlParameterMeta visitDomainCtType(DomainCtType ctType, Boolean optional) throws RuntimeException { if (Boolean.TRUE == optional) { return new OptionalDomainListParameterMeta(parameterMeta.getName(), ctType); } return new DomainListParameterMeta(parameterMeta.getName(), ctType); } @Override public CallableSqlParameterMeta visitOptionalCtType(OptionalCtType ctType, Boolean p) throws RuntimeException { return ctType.getElementCtType().accept(this, true); } @Override public CallableSqlParameterMeta visitOptionalIntCtType(OptionalIntCtType ctType, Boolean p) throws RuntimeException { return new OptionalIntListParameterMeta(parameterMeta.getName()); } @Override public CallableSqlParameterMeta visitOptionalLongCtType(OptionalLongCtType ctType, Boolean p) throws RuntimeException { return new OptionalLongListParameterMeta(parameterMeta.getName()); } @Override public CallableSqlParameterMeta visitOptionalDoubleCtType( OptionalDoubleCtType ctType, Boolean p) throws RuntimeException { return new OptionalDoubleListParameterMeta(parameterMeta.getName()); } } static class InCtTypeVisitor extends SimpleCtTypeVisitor<CallableSqlParameterMeta, Boolean, RuntimeException> { final QueryParameterMeta parameterMeta; InCtTypeVisitor(QueryParameterMeta parameterMeta) { this.parameterMeta = parameterMeta; } @Override protected CallableSqlParameterMeta defaultAction(CtType type, Boolean p) throws RuntimeException { throw new AptException( Message.DOMA4101, parameterMeta.getElement(), new Object[] {parameterMeta.getType()}); } @Override public CallableSqlParameterMeta visitBasicCtType(BasicCtType ctType, Boolean optional) throws RuntimeException { if (Boolean.TRUE == optional) { return new OptionalBasicInParameterMeta(parameterMeta.getName(), ctType); } return new BasicInParameterMeta(parameterMeta.getName(), ctType); } @Override public CallableSqlParameterMeta visitDomainCtType(DomainCtType ctType, Boolean optional) throws RuntimeException { if (Boolean.TRUE == optional) { return new OptionalDomainInParameterMeta(parameterMeta.getName(), ctType); } return new DomainInParameterMeta(parameterMeta.getName(), ctType); } @Override public CallableSqlParameterMeta visitOptionalCtType(OptionalCtType ctType, Boolean p) throws RuntimeException { return ctType.getElementCtType().accept(this, true); } @Override public CallableSqlParameterMeta visitOptionalIntCtType(OptionalIntCtType ctType, Boolean p) throws RuntimeException { return new OptionalIntInParameterMeta(parameterMeta.getName()); } @Override public CallableSqlParameterMeta visitOptionalLongCtType(OptionalLongCtType ctType, Boolean p) throws RuntimeException { return new OptionalLongInParameterMeta(parameterMeta.getName()); } @Override public CallableSqlParameterMeta visitOptionalDoubleCtType( OptionalDoubleCtType ctType, Boolean p) throws RuntimeException { return new OptionalDoubleInParameterMeta(parameterMeta.getName()); } } static class OutCtTypeVisitor extends SimpleCtTypeVisitor<ReferenceCtType, Void, RuntimeException> { final QueryParameterMeta parameterMeta; OutCtTypeVisitor(QueryParameterMeta parameterMeta) { this.parameterMeta = parameterMeta; } @Override protected ReferenceCtType defaultAction(CtType type, Void p) throws RuntimeException { throw new AptException(Message.DOMA4098, parameterMeta.getElement(), new Object[] {}); } @Override public ReferenceCtType visitReferenceCtType(ReferenceCtType ctType, Void p) throws RuntimeException { return ctType; } } static class OutReferentCtTypeVisitor extends SimpleCtTypeVisitor<CallableSqlParameterMeta, Boolean, RuntimeException> { final QueryParameterMeta parameterMeta; final ReferenceCtType referenceCtType; OutReferentCtTypeVisitor(QueryParameterMeta parameterMeta, ReferenceCtType referenceCtType) { this.parameterMeta = parameterMeta; this.referenceCtType = referenceCtType; } @Override protected CallableSqlParameterMeta defaultAction(CtType type, Boolean p) throws RuntimeException { throw new AptException( Message.DOMA4100, parameterMeta.getElement(), new Object[] {referenceCtType.getReferentTypeMirror()}); } @Override public CallableSqlParameterMeta visitBasicCtType(BasicCtType ctType, Boolean optional) throws RuntimeException { if (Boolean.TRUE == optional) { return new OptionalBasicOutParameterMeta(parameterMeta.getName(), ctType); } return new BasicOutParameterMeta(parameterMeta.getName(), ctType); } @Override public CallableSqlParameterMeta visitDomainCtType(DomainCtType ctType, Boolean optional) throws RuntimeException { if (Boolean.TRUE == optional) { return new OptionalDomainOutParameterMeta(parameterMeta.getName(), ctType); } return new DomainOutParameterMeta(parameterMeta.getName(), ctType); } @Override public CallableSqlParameterMeta visitOptionalCtType(OptionalCtType ctType, Boolean p) throws RuntimeException { return ctType.getElementCtType().accept(this, true); } @Override public CallableSqlParameterMeta visitOptionalIntCtType(OptionalIntCtType ctType, Boolean p) throws RuntimeException { return new OptionalIntOutParameterMeta(parameterMeta.getName()); } @Override public CallableSqlParameterMeta visitOptionalLongCtType(OptionalLongCtType ctType, Boolean p) throws RuntimeException { return new OptionalLongOutParameterMeta(parameterMeta.getName()); } @Override public CallableSqlParameterMeta visitOptionalDoubleCtType( OptionalDoubleCtType ctType, Boolean p) throws RuntimeException { return new OptionalDoubleOutParameterMeta(parameterMeta.getName()); } } static class InOutCtTypeVisitor extends SimpleCtTypeVisitor<ReferenceCtType, Void, RuntimeException> { final QueryParameterMeta parameterMeta; InOutCtTypeVisitor(QueryParameterMeta parameterMeta) { this.parameterMeta = parameterMeta; } @Override protected ReferenceCtType defaultAction(CtType type, Void p) throws RuntimeException { throw new AptException(Message.DOMA4111, parameterMeta.getElement(), new Object[] {}); } @Override public ReferenceCtType visitReferenceCtType(ReferenceCtType ctType, Void p) throws RuntimeException { return ctType; } } static class InOutReferentCtTypeVisitor extends SimpleCtTypeVisitor<CallableSqlParameterMeta, Boolean, RuntimeException> { final QueryParameterMeta parameterMeta; final ReferenceCtType referenceCtType; InOutReferentCtTypeVisitor(QueryParameterMeta parameterMeta, ReferenceCtType referenceCtType) { this.parameterMeta = parameterMeta; this.referenceCtType = referenceCtType; } @Override protected CallableSqlParameterMeta defaultAction(CtType type, Boolean p) throws RuntimeException { throw new AptException( Message.DOMA4100, parameterMeta.getElement(), new Object[] {referenceCtType.getReferentTypeMirror()}); } @Override public CallableSqlParameterMeta visitBasicCtType(BasicCtType ctType, Boolean optional) throws RuntimeException { if (Boolean.TRUE == optional) { return new OptionalBasicInOutParameterMeta(parameterMeta.getName(), ctType); } return new BasicInOutParameterMeta(parameterMeta.getName(), ctType); } @Override public CallableSqlParameterMeta visitDomainCtType(DomainCtType ctType, Boolean optional) throws RuntimeException { if (Boolean.TRUE == optional) { return new OptionalDomainInOutParameterMeta(parameterMeta.getName(), ctType); } return new DomainInOutParameterMeta(parameterMeta.getName(), ctType); } @Override public CallableSqlParameterMeta visitOptionalCtType(OptionalCtType ctType, Boolean p) throws RuntimeException { return ctType.getElementCtType().accept(this, true); } @Override public CallableSqlParameterMeta visitOptionalIntCtType(OptionalIntCtType ctType, Boolean p) throws RuntimeException { return new OptionalIntInOutParameterMeta(parameterMeta.getName()); } @Override public CallableSqlParameterMeta visitOptionalLongCtType(OptionalLongCtType ctType, Boolean p) throws RuntimeException { return new OptionalLongInOutParameterMeta(parameterMeta.getName()); } @Override public CallableSqlParameterMeta visitOptionalDoubleCtType( OptionalDoubleCtType ctType, Boolean p) throws RuntimeException { return new OptionalDoubleInOutParameterMeta(parameterMeta.getName()); } } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/id/IdGenerationConfig.java ======================= package org.seasar.doma.jdbc.id; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import javax.sql.DataSource; import org.seasar.doma.jdbc.Config; import org.seasar.doma.jdbc.JdbcLogger; import org.seasar.doma.jdbc.Naming; import org.seasar.doma.jdbc.RequiresNewController; import org.seasar.doma.jdbc.dialect.Dialect; import org.seasar.doma.jdbc.entity.EntityType; /** A configuration for the identity generation. */ public class IdGenerationConfig { protected final Config config; protected final EntityType<?> entityType; protected final IdProvider idProvider; public IdGenerationConfig(Config config, EntityType<?> entityType) { this(config, entityType, new UnavailableIdProvider()); } public IdGenerationConfig(Config config, EntityType<?> entityType, IdProvider idProvider) { assertNotNull(config, entityType, idProvider); this.config = config; this.entityType = entityType; this.idProvider = idProvider; } public DataSource getDataSource() { return config.getDataSource(); } public String getDataSourceName() { return config.getDataSourceName(); } public Dialect getDialect() { return config.getDialect(); } public JdbcLogger getJdbcLogger() { return config.getJdbcLogger(); } public RequiresNewController getRequiresNewController() { return config.getRequiresNewController(); } public Naming getNaming() { return config.getNaming(); } public int getFetchSize() { return config.getFetchSize(); } public int getMaxRows() { return config.getMaxRows(); } public int getQueryTimeout() { return config.getQueryTimeout(); } public EntityType<?> getEntityType() { return entityType; } public IdProvider getIdProvider() { return idProvider; } protected static class UnavailableIdProvider implements IdProvider { @Override public boolean isAvailable() { return false; } @Override public long get() { throw new UnsupportedOperationException(); } } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/expression/ArithmeticExpression.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/jdbc/criteria/expression/ArithmeticExpression.java package org.seasar.doma.jdbc.criteria.expression; import java.util.Objects; import org.seasar.doma.jdbc.criteria.context.Operand; import org.seasar.doma.jdbc.criteria.metamodel.PropertyMetamodel; import org.seasar.doma.jdbc.entity.EntityPropertyType; public interface ArithmeticExpression<PROPERTY> extends PropertyMetamodel<PROPERTY> { abstract class AbstractArithmeticExpression<PROPERTY> implements ArithmeticExpression<PROPERTY> { private final PropertyMetamodel<?> propertyMetamodel; public final Operand left; public final Operand right; protected AbstractArithmeticExpression( PropertyMetamodel<?> propertyMetamodel, Operand left, Operand right) { this.propertyMetamodel = Objects.requireNonNull(propertyMetamodel); this.left = Objects.requireNonNull(left); this.right = Objects.requireNonNull(right); } @Override public Class<?> asClass() { return propertyMetamodel.asClass(); } @Override public EntityPropertyType<?,?> asType() { return propertyMetamodel.asType(); } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof AbstractArithmeticExpression)) return false; AbstractArithmeticExpression<?> that = (AbstractArithmeticExpression<?>) o; return propertyMetamodel.equals(that.propertyMetamodel) && left.equals(that.left) && right.equals(that.right); } @Override public int hashCode() { return Objects.hash(propertyMetamodel, left, right); } } class Add<PROPERTY> extends AbstractArithmeticExpression<PROPERTY> { public Add(PropertyMetamodel<?> propertyMetamodel, Operand left, Operand right) { super(propertyMetamodel, left, right); } @Override public String getName() { return "+"; } @Override public void accept(PropertyMetamodel.Visitor visitor) { if (visitor instanceof ArithmeticExpression.Visitor) { ArithmeticExpression.Visitor v = (ArithmeticExpression.Visitor) visitor; v.visit(this); } } } class Sub<PROPERTY> extends AbstractArithmeticExpression<PROPERTY> { public Sub(PropertyMetamodel<?> propertyMetamodel, Operand left, Operand right) { super(propertyMetamodel, left, right); } @Override public String getName() { return "-"; } @Override public void accept(PropertyMetamodel.Visitor visitor) { if (visitor instanceof ArithmeticExpression.Visitor) { ArithmeticExpression.Visitor v = (ArithmeticExpression.Visitor) visitor; v.visit(this); } } } class Mul<PROPERTY> extends AbstractArithmeticExpression<PROPERTY> { public Mul(PropertyMetamodel<?> propertyMetamodel, Operand left, Operand right) { super(propertyMetamodel, left, right); } @Override public String getName() { return "*"; } @Override public void accept(PropertyMetamodel.Visitor visitor) { if (visitor instanceof ArithmeticExpression.Visitor) { ArithmeticExpression.Visitor v = (ArithmeticExpression.Visitor) visitor; v.visit(this); } } } class Div<PROPERTY> extends AbstractArithmeticExpression<PROPERTY> { public Div(PropertyMetamodel<?> propertyMetamodel, Operand left, Operand right) { super(propertyMetamodel, left, right); } @Override public String getName() { return "/"; } @Override public void accept(PropertyMetamodel.Visitor visitor) { if (visitor instanceof ArithmeticExpression.Visitor) { ArithmeticExpression.Visitor v = (ArithmeticExpression.Visitor) visitor; v.visit(this); } } } class Mod<PROPERTY> extends AbstractArithmeticExpression<PROPERTY> { public Mod(PropertyMetamodel<?> propertyMetamodel, Operand left, Operand right) { super(propertyMetamodel, left, right); } @Override public String getName() { return "%"; } @Override public void accept(PropertyMetamodel.Visitor visitor) { if (visitor instanceof ArithmeticExpression.Visitor) { ArithmeticExpression.Visitor v = (ArithmeticExpression.Visitor) visitor; v.visit(this); } } } interface Visitor { void visit(Add<?> add); void visit(Sub<?> sub); void visit(Mul<?> mul); void visit(Div<?> div); void visit(Mod<?> mod); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/validator/Job.java ======================= package org.seasar.doma.internal.apt.validator; public class Job { public Job(CharSequence name) {} public Job(String name) {} } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/SqlParameterVisitor.java ======================= package org.seasar.doma.jdbc; @SuppressWarnings("SameReturnValue") public interface SqlParameterVisitor<R, P, TH extends Throwable> { <BASIC> R visitInParameter(InParameter<BASIC> parameter, P p) throws TH; <BASIC> R visitOutParameter(OutParameter<BASIC> parameter, P p) throws TH; <BASIC, INOUT extends InParameter<BASIC> & OutParameter<BASIC>> R visitInOutParameter( INOUT parameter, P p) throws TH; <ELEMENT> R visitListParameter(ListParameter<ELEMENT> parameter, P p) throws TH; <BASIC, RESULT> R visitSingleResultParameter(SingleResultParameter<BASIC, RESULT> parameter, P p) throws TH; <ELEMENT> R visitResultListParameter(ResultListParameter<ELEMENT> parameter, P p) throws TH; } ======================= File: doma-core/src/test/java/org/seasar/doma/jdbc/UniqueConstraintExceptionTest.java ======================= package org.seasar.doma.jdbc; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertSame; import org.junit.jupiter.api.Test; public class UniqueConstraintExceptionTest { @Test public void test() { Exception cause = new Exception(); UniqueConstraintException e = new UniqueConstraintException( SqlLogType.FORMATTED, SqlKind.INSERT, "aaa", "bbb", "ccc", cause); System.out.println(e.getMessage()); assertSame(SqlKind.INSERT, e.getKind()); assertEquals("aaa", e.getRawSql()); assertEquals("bbb", e.getFormattedSql()); assertEquals("ccc", e.getSqlFilePath()); assertEquals(cause, e.getCause()); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/AbstractParameterBinder.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.jdbc.command; import java.sql.PreparedStatement; import java.sql.SQLException; import org.seasar.doma.jdbc.JdbcMappable; import org.seasar.doma.jdbc.JdbcMappingVisitor; import org.seasar.doma.jdbc.SqlParameter; import org.seasar.doma.wrapper.Wrapper; public abstract class AbstractParameterBinder< STATEMENT extends PreparedStatement, PARAMETER extends SqlParameter> implements ParameterBinder<STATEMENT, PARAMETER> { protected <BASIC> void bindInParameter( STATEMENT statement, JdbcMappable<BASIC> parameter, int index, JdbcMappingVisitor jdbcMappingVisitor) throws SQLException { Wrapper<?> wrapper = parameter.getWrapper(); wrapper.accept(jdbcMappingVisitor, new JdbcValueSetter(statement, index), parameter); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/builder/ParamIndex.java ======================= package org.seasar.doma.jdbc.builder; class ParamIndex { private int value = 1; void increment() { value++; } int getValue() { return value; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/tx/LocalTransactionManager.java ======================= <gh_stars>100-1000 package org.seasar.doma.jdbc.tx; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import java.util.function.Supplier; import org.seasar.doma.DomaNullPointerException; import org.seasar.doma.jdbc.JdbcLogger; /** * A transaction manager for local transactions. * * <p>This instance is thread safe. */ public class LocalTransactionManager implements TransactionManager { protected final LocalTransaction transaction; /** * Create an instance. * * @param transaction the transaction * @throws DomaNullPointerException if the {@code transaction} is {@code null} */ public LocalTransactionManager(LocalTransaction transaction) { if (transaction == null) { throw new DomaNullPointerException("transaction"); } this.transaction = transaction; } /** * Create an instance. * * @param dataSource the data source * @param jdbcLogger the logger * @throws DomaNullPointerException if any of the parameters are {@code null} */ public LocalTransactionManager(LocalTransactionDataSource dataSource, JdbcLogger jdbcLogger) { if (dataSource == null) { throw new DomaNullPointerException("dataSource"); } if (jdbcLogger == null) { throw new DomaNullPointerException("jdbcLogger"); } this.transaction = dataSource.getLocalTransaction(jdbcLogger); } /** * Create an instance. * * @param dataSource the data source * @param jdbcLogger the logger * @param isolationLevel the default transaction isolation level * @throws DomaNullPointerException if any of the parameters are {@code null} */ public LocalTransactionManager( LocalTransactionDataSource dataSource, JdbcLogger jdbcLogger, TransactionIsolationLevel isolationLevel) { if (dataSource == null) { throw new DomaNullPointerException("dataSource"); } if (jdbcLogger == null) { throw new DomaNullPointerException("jdbcLogger"); } if (isolationLevel == null) { throw new DomaNullPointerException("isolationLevel"); } this.transaction = dataSource.getLocalTransaction(jdbcLogger, isolationLevel); } /** * Returns the transaction. * * <p>This method is mainly used in test code. * * @return the transaction */ public LocalTransaction getTransaction() { return transaction; } @Override public void required(Runnable block) { if (block == null) { throw new DomaNullPointerException("block"); } requiredInternal(TransactionIsolationLevel.DEFAULT, toSupplier(block)); } @Override public void required(TransactionIsolationLevel isolationLevel, Runnable block) { if (isolationLevel == null) { throw new DomaNullPointerException("isolationLevel"); } if (block == null) { throw new DomaNullPointerException("block"); } requiredInternal(isolationLevel, toSupplier(block)); } @Override public <RESULT> RESULT required(Supplier<RESULT> supplier) { if (supplier == null) { throw new DomaNullPointerException("supplier"); } return requiredInternal(TransactionIsolationLevel.DEFAULT, supplier); } @Override public <RESULT> RESULT required( TransactionIsolationLevel isolationLevel, Supplier<RESULT> supplier) { if (isolationLevel == null) { throw new DomaNullPointerException("isolationLevel"); } if (supplier == null) { throw new DomaNullPointerException("supplier"); } return requiredInternal(isolationLevel, supplier); } protected <RESULT> RESULT requiredInternal( TransactionIsolationLevel isolationLevel, Supplier<RESULT> supplier) { assertNotNull(isolationLevel, supplier); if (transaction.isActive()) { return supplier.get(); } else { return executeInTransaction(isolationLevel, supplier); } } @Override public void requiresNew(Runnable block) { if (block == null) { throw new DomaNullPointerException("block"); } requiresNewInternal(TransactionIsolationLevel.DEFAULT, toSupplier(block)); } @Override public void requiresNew(TransactionIsolationLevel isolationLevel, Runnable block) { if (isolationLevel == null) { throw new DomaNullPointerException("isolationLevel"); } if (block == null) { throw new DomaNullPointerException("block"); } requiresNewInternal(isolationLevel, toSupplier(block)); } @Override public <RESULT> RESULT requiresNew(Supplier<RESULT> supplier) { if (supplier == null) { throw new DomaNullPointerException("supplier"); } return requiresNewInternal(TransactionIsolationLevel.DEFAULT, supplier); } @Override public <RESULT> RESULT requiresNew( TransactionIsolationLevel isolationLevel, Supplier<RESULT> supplier) { if (isolationLevel == null) { throw new DomaNullPointerException("isolationLevel"); } if (supplier == null) { throw new DomaNullPointerException("supplier"); } return requiresNewInternal(isolationLevel, supplier); } protected <RESULT> RESULT requiresNewInternal( TransactionIsolationLevel isolationLevel, Supplier<RESULT> supplier) { assertNotNull(isolationLevel, supplier); if (transaction.isActive()) { LocalTransactionContext context = transaction.suspend(); try { return executeInTransaction(isolationLevel, supplier); } finally { transaction.resume(context); } } else { return executeInTransaction(isolationLevel, supplier); } } @Override public void notSupported(Runnable block) { if (block == null) { throw new DomaNullPointerException("block"); } notSupportedInternal(TransactionIsolationLevel.DEFAULT, toSupplier(block)); } @Override public void notSupported(TransactionIsolationLevel isolationLevel, Runnable block) { if (isolationLevel == null) { throw new DomaNullPointerException("isolationLevel"); } if (block == null) { throw new DomaNullPointerException("block"); } notSupportedInternal(isolationLevel, toSupplier(block)); } @Override public <RESULT> RESULT notSupported(Supplier<RESULT> supplier) { if (supplier == null) { throw new DomaNullPointerException("supplier"); } return notSupportedInternal(TransactionIsolationLevel.DEFAULT, supplier); } @Override public <RESULT> RESULT notSupported( TransactionIsolationLevel isolationLevel, Supplier<RESULT> supplier) { if (isolationLevel == null) { throw new DomaNullPointerException("isolationLevel"); } if (supplier == null) { throw new DomaNullPointerException("supplier"); } return notSupportedInternal(isolationLevel, supplier); } protected <RESULT> RESULT notSupportedInternal( TransactionIsolationLevel isolationLevel, Supplier<RESULT> supplier) { assertNotNull(isolationLevel, supplier); if (transaction.isActive()) { LocalTransactionContext context = transaction.suspend(); try { return supplier.get(); } finally { transaction.resume(context); } } else { return supplier.get(); } } protected Supplier<Void> toSupplier(Runnable block) { return () -> { block.run(); return null; }; } @Override public void setRollbackOnly() { transaction.setRollbackOnly(); } @Override public boolean isRollbackOnly() { return transaction.isRollbackOnly(); } protected <RESULT> RESULT executeInTransaction( TransactionIsolationLevel isolationLevel, Supplier<RESULT> supplier) { assertNotNull(isolationLevel, supplier); transaction.begin(isolationLevel); try { RESULT result = supplier.get(); if (!transaction.isRollbackOnly()) { transaction.commit(); } return result; } finally { transaction.rollback(); } } @Override public void setSavepoint(String savepointName) { transaction.setSavepoint(savepointName); } @Override public boolean hasSavepoint(String savepointName) { return transaction.hasSavepoint(savepointName); } @Override public void releaseSavepoint(String savepointName) { transaction.releaseSavepoint(savepointName); } @Override public void rollback(String savepointName) { transaction.rollback(savepointName); } } ======================= File: doma-core/src/test/java/org/seasar/doma/jdbc/criteria/tuple/Tuple2Test.java ======================= <filename>doma-core/src/test/java/org/seasar/doma/jdbc/criteria/tuple/Tuple2Test.java package org.seasar.doma.jdbc.criteria.tuple; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; class Tuple2Test { @Test void test() { Tuple2<Integer, String> tuple = new Tuple2<>(1, "a"); assertEquals(new Tuple2<>(1, "a"), tuple); assertEquals(1, tuple.getItem1()); assertEquals("a", tuple.getItem2()); assertEquals(tuple.getItem1(), tuple.component1()); assertEquals(tuple.getItem2(), tuple.component2()); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/SqlFileNotFoundException.java ======================= package org.seasar.doma.jdbc; import org.seasar.doma.message.Message; /** Thrown to indicate that the SQL file is not found. */ public class SqlFileNotFoundException extends JdbcException { private static final long serialVersionUID = 1L; /** the SQL file path */ protected final String path; /** * Creates an instance. * * @param path the SQL file path */ public SqlFileNotFoundException(String path) { super(Message.DOMA2011, path); this.path = path; } /** * Returns the SQL file path. * * @return the SQL file path */ public String getPath() { return path; } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/meta/parameter/ResultParameterMeta.java ======================= package org.seasar.doma.internal.apt.meta.parameter; public interface ResultParameterMeta extends CallableSqlParameterMeta {} ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/command/MappedResultStreamHandler.java ======================= package org.seasar.doma.jdbc.criteria.command; import java.util.Objects; import java.util.function.Function; import java.util.stream.Stream; import org.seasar.doma.internal.jdbc.command.AbstractStreamHandler; import org.seasar.doma.jdbc.ObjectProvider; import org.seasar.doma.jdbc.query.SelectQuery; public class MappedResultStreamHandler<ELEMENT, RESULT> extends AbstractStreamHandler<ELEMENT, RESULT> { private final Function<SelectQuery, ObjectProvider<ELEMENT>> objectProviderFactory; public MappedResultStreamHandler( Function<Stream<ELEMENT>, RESULT> streamMapper, Function<SelectQuery, ObjectProvider<ELEMENT>> objectProviderFactory) { super(Objects.requireNonNull(streamMapper)); this.objectProviderFactory = Objects.requireNonNull(objectProviderFactory); } @Override protected ObjectProvider<ELEMENT> createObjectProvider(SelectQuery query) { return objectProviderFactory.apply(query); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/AptIllegalStateException.java ======================= package org.seasar.doma.internal.apt; public class AptIllegalStateException extends RuntimeException { private static final long serialVersionUID = 1L; public AptIllegalStateException(String message) { super(message); } } ======================= File: doma-core/src/test/java/org/seasar/doma/jdbc/domain/Money.java ======================= package org.seasar.doma.jdbc.domain; import java.math.BigDecimal; import org.seasar.doma.Domain; @Domain(valueType = BigDecimal.class) public class Money {} ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/ImmutableParentEntity.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.Entity; @Entity(immutable = true) public class ImmutableParentEntity { final Integer aaa; final Integer bbb; public ImmutableParentEntity(Integer aaa, Integer bbb) { super(); this.aaa = aaa; this.bbb = bbb; } public Integer getAaa() { return aaa; } public Integer getBbb() { return bbb; } } ======================= File: doma-core/src/test/java/org/seasar/doma/internal/jdbc/command/EntityProviderTest.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.jdbc.command; import static org.junit.jupiter.api.Assertions.fail; import static org.seasar.doma.internal.util.AssertionUtil.assertEquals; import example.entity.Emp; import example.entity._Emp; import java.lang.reflect.Method; import java.math.BigDecimal; import java.util.Collections; import org.junit.jupiter.api.Test; import org.seasar.doma.FetchType; import org.seasar.doma.internal.jdbc.mock.ColumnMetaData; import org.seasar.doma.internal.jdbc.mock.MockConfig; import org.seasar.doma.internal.jdbc.mock.MockResultSet; import org.seasar.doma.internal.jdbc.mock.MockResultSetMetaData; import org.seasar.doma.internal.jdbc.mock.RowData; import org.seasar.doma.jdbc.Config; import org.seasar.doma.jdbc.PreparedSql; import org.seasar.doma.jdbc.SelectOptions; import org.seasar.doma.jdbc.SqlKind; import org.seasar.doma.jdbc.SqlLogType; import org.seasar.doma.jdbc.UnknownColumnException; import org.seasar.doma.jdbc.UnknownColumnHandler; import org.seasar.doma.jdbc.entity.EntityType; import org.seasar.doma.jdbc.query.Query; import org.seasar.doma.jdbc.query.SelectQuery; public class EntityProviderTest { @Test public void testGetEntity() throws Exception { MockResultSetMetaData metaData = new MockResultSetMetaData(); metaData.columns.add(new ColumnMetaData("id")); metaData.columns.add(new ColumnMetaData("name")); metaData.columns.add(new ColumnMetaData("salary")); metaData.columns.add(new ColumnMetaData("version")); MockResultSet resultSet = new MockResultSet(metaData); resultSet.rows.add(new RowData(1, "aaa", new BigDecimal(10), 100)); resultSet.next(); _Emp entityType = _Emp.getSingletonInternal(); EntityProvider<Emp> provider = new EntityProvider<>(entityType, new MySelectQuery(new MockConfig()), false); Emp emp = provider.get(resultSet); assertEquals(1, emp.getId()); assertEquals("aaa", emp.getName()); assertEquals(new BigDecimal(10), emp.getSalary()); assertEquals(100, emp.getVersion()); } @Test public void testGetEntity_UnknownColumnException() throws Exception { MockResultSetMetaData metaData = new MockResultSetMetaData(); metaData.columns.add(new ColumnMetaData("id")); metaData.columns.add(new ColumnMetaData("name")); metaData.columns.add(new ColumnMetaData("salary")); metaData.columns.add(new ColumnMetaData("version")); metaData.columns.add(new ColumnMetaData("unknown")); MockResultSet resultSet = new MockResultSet(metaData); resultSet.rows.add(new RowData(1, "aaa", new BigDecimal(10), 100, "bbb")); resultSet.next(); _Emp entityType = _Emp.getSingletonInternal(); EntityProvider<Emp> provider = new EntityProvider<>(entityType, new MySelectQuery(new MockConfig()), false); try { provider.get(resultSet); fail(); } catch (UnknownColumnException expected) { } } @Test public void testGetEntity_EmptyUnknownColumnHandler() throws Exception { MockResultSetMetaData metaData = new MockResultSetMetaData(); metaData.columns.add(new ColumnMetaData("id")); metaData.columns.add(new ColumnMetaData("name")); metaData.columns.add(new ColumnMetaData("salary")); metaData.columns.add(new ColumnMetaData("version")); metaData.columns.add(new ColumnMetaData("unknown")); MockResultSet resultSet = new MockResultSet(metaData); resultSet.rows.add(new RowData(1, "aaa", new BigDecimal(10), 100, "bbb")); resultSet.next(); _Emp entityType = _Emp.getSingletonInternal(); EntityProvider<Emp> provider = new EntityProvider<>( entityType, new MySelectQuery(new EmptyUnknownColumnHandlerConfig()), false); Emp emp = provider.get(resultSet); assertEquals(1, emp.getId()); assertEquals("aaa", emp.getName()); assertEquals(new BigDecimal(10), emp.getSalary()); assertEquals(100, emp.getVersion()); } protected static class MySelectQuery implements SelectQuery { private final Config config; MySelectQuery(Config config) { this.config = config; } @Override public SelectOptions getOptions() { return SelectOptions.get(); } @Override public Config getConfig() { return config; } @Override public String getClassName() { return null; } @Override public String getMethodName() { return null; } @Override public PreparedSql getSql() { return new PreparedSql( SqlKind.SELECT, "dummy", "dummy", "dummy", Collections.emptyList(), SqlLogType.FORMATTED); } @Override public boolean isResultEnsured() { return false; } @Override public boolean isResultMappingEnsured() { return false; } @Override public FetchType getFetchType() { return FetchType.LAZY; } @Override public int getFetchSize() { return 0; } @Override public int getMaxRows() { return 0; } @Override public int getQueryTimeout() { return 0; } @Override public void prepare() {} @Override public void complete() {} @Override public Method getMethod() { return null; } @Override public SqlLogType getSqlLogType() { return null; } @Override public String comment(String sql) { return sql; } @Override public boolean isResultStream() { return false; } } protected static class EmptyUnknownColumnHandler implements UnknownColumnHandler { @Override public void handle(Query query, EntityType<?> entityType, String unknownColumnName) {} } protected static class EmptyUnknownColumnHandlerConfig extends MockConfig { @Override public UnknownColumnHandler getUnknownColumnHandler() { return new EmptyUnknownColumnHandler(); } } } ======================= File: doma-core/src/main/java/org/seasar/doma/GenerationType.java ======================= <gh_stars>100-1000 package org.seasar.doma; /** * Defines strategies to generate identifiers. * * @see GeneratedValue */ public enum GenerationType { /** Database IDENTITY column */ IDENTITY, /** Database sequence */ SEQUENCE, /** Database table */ TABLE } ======================= File: doma-core/src/test/java/org/seasar/doma/internal/jdbc/entity/Animal.java ======================= package org.seasar.doma.internal.jdbc.entity; public class Animal extends Life { public String kind; } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/sql/node/WordNode.java ======================= package org.seasar.doma.internal.jdbc.sql.node; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import org.seasar.doma.DomaNullPointerException; import org.seasar.doma.jdbc.JdbcUnsupportedOperationException; import org.seasar.doma.jdbc.SqlNode; import org.seasar.doma.jdbc.SqlNodeVisitor; public class WordNode extends AbstractSqlNode { protected final String word; protected final boolean reserved; public WordNode(String word) { this(word, false); } public WordNode(String word, boolean reserved) { assertNotNull(word); this.word = word; this.reserved = reserved; } public String getWord() { return word; } public boolean isReserved() { return reserved; } @Override public void appendNode(SqlNode child) { throw new JdbcUnsupportedOperationException(getClass().getName(), "addNode"); } @Override public <R, P> R accept(SqlNodeVisitor<R, P> visitor, P p) { if (visitor == null) { throw new DomaNullPointerException("visitor"); } return visitor.visitWordNode(this, p); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/query/SqlFileScriptQuery.java ======================= package org.seasar.doma.jdbc.query; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import static org.seasar.doma.internal.util.AssertionUtil.assertTrue; import static org.seasar.doma.internal.util.AssertionUtil.assertUnreachable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; import java.io.UncheckedIOException; import java.net.URL; import java.util.function.Supplier; import org.seasar.doma.internal.Constants; import org.seasar.doma.internal.jdbc.util.ScriptFileUtil; import org.seasar.doma.jdbc.ScriptFileLoader; import org.seasar.doma.jdbc.ScriptFileNotFoundException; import org.seasar.doma.jdbc.Sql; import org.seasar.doma.jdbc.SqlLogType; public class SqlFileScriptQuery extends AbstractQuery implements ScriptQuery { protected String scriptFilePath; protected String blockDelimiter; protected boolean haltOnError; protected URL scriptFileUrl; protected org.seasar.doma.Sql sqlAnnotation; protected SqlLogType sqlLogType; public void setScriptFilePath(String scriptFilePath) { this.scriptFilePath = scriptFilePath; } public void setBlockDelimiter(String blockDelimiter) { this.blockDelimiter = blockDelimiter; } public void setHaltOnError(boolean haltOnError) { this.haltOnError = haltOnError; } public void setSqlLogType(SqlLogType sqlLogType) { this.sqlLogType = sqlLogType; } @Override public void prepare() { super.prepare(); assertNotNull(scriptFilePath, blockDelimiter); sqlAnnotation = method.getAnnotation(org.seasar.doma.Sql.class); if (sqlAnnotation == null) { assertTrue(scriptFilePath.startsWith(Constants.SCRIPT_PATH_PREFIX)); assertTrue(scriptFilePath.endsWith(Constants.SCRIPT_PATH_SUFFIX)); ScriptFileLoader loader = config.getScriptFileLoader(); String dbmsSpecificPath = ScriptFileUtil.convertToDbmsSpecificPath(scriptFilePath, config.getDialect()); scriptFileUrl = loader.loadAsURL(dbmsSpecificPath); if (scriptFileUrl!= null) { scriptFilePath = dbmsSpecificPath; } else { scriptFileUrl = loader.loadAsURL(scriptFilePath); if (scriptFileUrl == null) { throw new ScriptFileNotFoundException(scriptFilePath); } } } if (blockDelimiter.isEmpty()) { blockDelimiter = config.getDialect().getScriptBlockDelimiter(); } } @Override public void complete() {} @Override public int getQueryTimeout() { return -1; } @Override public Sql<?> getSql() { assertUnreachable(); return null; } @Override public String getScriptFilePath() { return scriptFilePath; } @Override public URL getScriptFileUrl() { return scriptFileUrl; } public Supplier<Reader> getReaderSupplier() { if (sqlAnnotation == null) { return () -> { try { InputStream inputStream = scriptFileUrl.openStream(); return new InputStreamReader(inputStream, Constants.UTF_8); } catch (IOException e) { throw new UncheckedIOException(e); } }; } return () -> new StringReader(sqlAnnotation.value()); } @Override public String getBlockDelimiter() { return blockDelimiter; } @Override public boolean getHaltOnError() { return haltOnError; } public SqlLogType getSqlLogType() { return sqlLogType; } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/NameUnsafeEntity_.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.Entity; @Entity public class NameUnsafeEntity_ {} ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/OptionalSingleResultCallback.java ======================= package org.seasar.doma.internal.jdbc.command; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import java.util.Optional; import java.util.function.Function; import org.seasar.doma.jdbc.IterationCallback; import org.seasar.doma.jdbc.IterationContext; public class OptionalSingleResultCallback<TARGET> implements IterationCallback<TARGET, Optional<TARGET>> { protected final Function<TARGET, Optional<TARGET>> mapper; public OptionalSingleResultCallback() { this(Optional::ofNullable); } public OptionalSingleResultCallback(Function<TARGET, Optional<TARGET>> mapper) { assertNotNull(mapper); this.mapper = mapper; } @Override public Optional<TARGET> defaultResult() { return mapper.apply(null); } @Override public Optional<TARGET> iterate(TARGET target, IterationContext context) { context.exit(); return mapper.apply(target); } } ======================= File: doma-processor/src/main/java/org/seasar/doma/internal/apt/decl/Declarations.java ======================= <filename>doma-processor/src/main/java/org/seasar/doma/internal/apt/decl/Declarations.java package org.seasar.doma.internal.apt.decl; import static java.util.stream.Collectors.collectingAndThen; import static java.util.stream.Collectors.toList; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import static org.seasar.doma.internal.util.AssertionUtil.assertTrue; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.Name; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; import org.seasar.doma.internal.apt.Context; import org.seasar.doma.internal.apt.cttype.CtType; import org.seasar.doma.internal.util.Zip; public class Declarations { private final Context ctx; public Declarations(Context ctx) { assertNotNull(ctx); this.ctx = ctx; } public TypeDeclaration newUnknownTypeDeclaration() { TypeMirror type = ctx.getMoreTypes().getNoType(TypeKind.NONE); return newTypeDeclaration(type, null); } public TypeDeclaration newPrimitiveBooleanTypeDeclaration() { TypeMirror type = ctx.getMoreTypes().getTypeMirror(boolean.class); return newTypeDeclaration(type, null); } public TypeDeclaration newTypeDeclaration(Class<?> clazz) { assertNotNull(clazz); TypeMirror type = ctx.getMoreTypes().getTypeMirror(clazz); return newTypeDeclaration(type); } public TypeDeclaration newTypeDeclaration(TypeMirror type) { assertNotNull(type); TypeElement typeElement = ctx.getMoreTypes().toTypeElement(type); return newTypeDeclaration(type, typeElement); } public TypeDeclaration newTypeDeclaration(TypeElement typeElement) { assertNotNull(typeElement); return newTypeDeclaration(typeElement.asType(), typeElement); } private TypeDeclaration newTypeDeclaration(TypeMirror type, TypeElement typeElement) { assertNotNull(type); CtType ctType = ctx.getCtTypes().newCtType(type); Map<Name, List<TypeParameterDeclaration>> map = new LinkedHashMap<>(); gatherTypeParameterDeclarations(type, map); return new TypeDeclaration(ctx, type, ctType, typeElement, map); } private void gatherTypeParameterDeclarations( TypeMirror type, Map<Name, List<TypeParameterDeclaration>> typeParameterDeclarationsMap) { TypeElement typeElement = ctx.getMoreTypes().toTypeElement(type); if (typeElement == null) { return; } Name canonicalName = typeElement.getQualifiedName(); typeParameterDeclarationsMap.put(canonicalName, newTypeParameterDeclaration(typeElement, type)); for (TypeMirror superType : ctx.getMoreTypes().directSupertypes(type)) { TypeElement superElement = ctx.getMoreTypes().toTypeElement(superType); if (superElement == null) { continue; } Name superCanonicalName = superElement.getQualifiedName(); if (typeParameterDeclarationsMap.containsKey(superCanonicalName)) { continue; } typeParameterDeclarationsMap.put( superCanonicalName, newTypeParameterDeclaration(superElement, superType)); gatherTypeParameterDeclarations(superType, typeParameterDeclarationsMap); } } private List<TypeParameterDeclaration> newTypeParameterDeclaration( TypeElement typeElement, TypeMirror type) { assertNotNull(typeElement, type); DeclaredType declaredType = ctx.getMoreTypes().toDeclaredType(type); return Zip.stream(typeElement.getTypeParameters(), declaredType.getTypeArguments()) .map(p -> new TypeParameterDeclaration(p.fst.asType(), p.snd)) .collect(collectingAndThen(toList(), Collections::unmodifiableList)); } FieldDeclaration newFieldDeclaration( VariableElement fieldElement, List<TypeParameterDeclaration> typeParameterDeclarations) { assertNotNull(fieldElement, typeParameterDeclarations); assertTrue( fieldElement.getKind() == ElementKind.FIELD || fieldElement.getKind() == ElementKind.ENUM_CONSTANT, fieldElement.getKind().toString()); TypeMirror fieldType = resolveTypeParameter(fieldElement.asType(), typeParameterDeclarations); TypeDeclaration typeDeclaration = newTypeDeclaration(fieldType); return new FieldDeclaration(fieldElement, typeDeclaration); } ConstructorDeclaration newConstructorDeclaration(ExecutableElement constructorElement) { assertNotNull(constructorElement); assertTrue(constructorElement.getKind() == ElementKind.CONSTRUCTOR); return new ConstructorDeclaration(constructorElement); } MethodDeclaration newMethodDeclaration( ExecutableElement methodElement, List<TypeParameterDeclaration> typeParameterDeclarations) { assertNotNull(methodElement, typeParameterDeclarations); assertTrue(methodElement.getKind() == ElementKind.METHOD); TypeMirror returnTypeMirror = resolveTypeParameter(methodElement.getReturnType(), typeParameterDeclarations); TypeDeclaration returnTypeDeclaration = newTypeDeclaration(returnTypeMirror); return new MethodDeclaration(methodElement, returnTypeDeclaration); } private TypeMirror resolveTypeParameter( TypeMirror formalType, List<TypeParameterDeclaration> typeParameterDeclarations) { for (TypeParameterDeclaration typeParameterDecl : typeParameterDeclarations) { if (formalType.equals(typeParameterDecl.getFormalType())) { return typeParameterDecl.getActualType(); } DeclaredType declaredType = ctx.getMoreTypes().toDeclaredType(formalType); if (declaredType == null) { continue; } if (declaredType.getTypeArguments().isEmpty()) { continue; } List<Optional<TypeMirror>> optTypeArgs = declaredType.getTypeArguments().stream() .map( arg -> typeParameterDeclarations.stream() .filter(declaration -> arg.equals(declaration.getFormalType())) .map(TypeParameterDeclaration::getActualType) .findFirst()) .collect(Collectors.toList()); if (optTypeArgs.stream().allMatch(Optional::isPresent)) { TypeMirror[] typeArgs = optTypeArgs.stream().map(Optional::get).toArray(TypeMirror[]::new); TypeElement typeElement = ctx.getMoreElements().toTypeElement(declaredType.asElement()); if (typeElement == null) { continue; } return ctx.getMoreTypes().getDeclaredType(typeElement, typeArgs); } } return formalType; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/command/EntityPoolProvider.java ======================= <reponame>orekyuu/doma package org.seasar.doma.jdbc.criteria.command; import static java.util.stream.Collectors.toList; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; import org.seasar.doma.jdbc.ObjectProvider; import org.seasar.doma.jdbc.criteria.metamodel.EntityMetamodel; import org.seasar.doma.jdbc.criteria.metamodel.PropertyMetamodel; import org.seasar.doma.jdbc.entity.EntityPropertyType; import org.seasar.doma.jdbc.entity.EntityType; import org.seasar.doma.jdbc.entity.Property; import org.seasar.doma.jdbc.query.Query; public class EntityPoolProvider implements ObjectProvider<EntityPool> { private final Map<EntityMetamodel<?>, List<PropertyMetamodel<?>>> projectionEntityMetamodels; private final FetchSupport fetchSupport; public EntityPoolProvider( Map<EntityMetamodel<?>, List<PropertyMetamodel<?>>> projectionEntityMetamodels, Query query) { this.projectionEntityMetamodels = Objects.requireNonNull(projectionEntityMetamodels); Objects.requireNonNull(query); this.fetchSupport = new FetchSupport(query); } @Override @SuppressWarnings("unchecked") public EntityPool get(ResultSet resultSet) throws SQLException { Objects.requireNonNull(resultSet); EntityPool entityPool = new EntityPool(); int index = 1; for (Map.Entry<EntityMetamodel<?>, List<PropertyMetamodel<?>>> entry : projectionEntityMetamodels.entrySet()) { EntityMetamodel<?> entityMetamodel = entry.getKey(); List<PropertyMetamodel<?>> projectionTargets = entry.getValue(); EntityType<?> entityType = entityMetamodel.asType(); List<? extends EntityPropertyType<?,?>> propertyTypes = projectionTargets.stream().map(PropertyMetamodel::asType).collect(toList()); List<Prop> props = new ArrayList<>(propertyTypes.size()); for (EntityPropertyType<?,?> propertyType : propertyTypes) { Property<Object,?> property = (Property<Object,?>) propertyType.createProperty(); Object rawValue = fetchSupport.fetch(resultSet, property, index++); props.add(new Prop(propertyType, property, rawValue)); } if (props.stream().allMatch(p -> p.rawValue == null)) { continue; } EntityKey key; if (entityType.getIdPropertyTypes().isEmpty()) { key = new EntityKey(entityMetamodel, Collections.singletonList(new Object())); } else { List<?> items = props.stream() .filter(it -> it.propType.isId()) .map(it -> it.prop.getWrapper().get()) .collect(toList()); key = new EntityKey(entityMetamodel, items); } Map<String, Property<Object,?>> states = props.stream().collect(Collectors.toMap(p -> p.propType.getName(), p -> p.prop)); EntityData data = new EntityData(states); entityPool.put(key, data); } return entityPool; } private static class Prop { private final EntityPropertyType<?,?> propType; private final Property<Object,?> prop; private final Object rawValue; public Prop(EntityPropertyType<?,?> propType, Property<Object,?> prop, Object rawValue) { this.propType = propType; this.prop = prop; this.rawValue = rawValue; } } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/SqlExecutionSkipCause.java ======================= package org.seasar.doma.jdbc; /** Defines the causes that skip the SQL execution. */ public enum SqlExecutionSkipCause { /** entity states are not changed in the update process */ STATE_UNCHANGED, /** there is no entity in the batch process */ BATCH_TARGET_NONEXISTENT } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/expression/LiteralExpression.java ======================= <gh_stars>100-1000 package org.seasar.doma.jdbc.criteria.expression; import java.util.Objects; import java.util.function.Function; import org.seasar.doma.jdbc.criteria.metamodel.PropertyMetamodel; import org.seasar.doma.jdbc.entity.EntityPropertyType; public class LiteralExpression<PROPERTY> implements PropertyMetamodel<PROPERTY> { private final PROPERTY value; private final BasicPropertyType<PROPERTY> propertyType; public LiteralExpression( PROPERTY value, Function<PROPERTY, BasicPropertyType<PROPERTY>> factory) { this.value = Objects.requireNonNull(value); Objects.requireNonNull(factory); this.propertyType = factory.apply(value); } @Override public EntityPropertyType<?,?> asType() { return propertyType; } @Override public Class<?> asClass() { return value.getClass(); } @Override public String getName() { return value.toString(); } @Override public void accept(PropertyMetamodel.Visitor visitor) { if (visitor instanceof LiteralExpression.Visitor) { LiteralExpression.Visitor v = (LiteralExpression.Visitor) visitor; v.visit(this); } } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass()!= o.getClass()) return false; LiteralExpression<?> that = (LiteralExpression<?>) o; return value.equals(that.value); } @Override public int hashCode() { return Objects.hash(value); } public interface Visitor { void visit(LiteralExpression<?> expression); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/ScalarStreamHandler.java ======================= package org.seasar.doma.internal.jdbc.command; import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Stream; import org.seasar.doma.internal.jdbc.scalar.Scalar; import org.seasar.doma.jdbc.query.SelectQuery; public class ScalarStreamHandler<BASIC, CONTAINER, RESULT> extends AbstractStreamHandler<CONTAINER, RESULT> { protected final Supplier<Scalar<BASIC, CONTAINER>> supplier; public ScalarStreamHandler( Supplier<Scalar<BASIC, CONTAINER>> supplier, Function<Stream<CONTAINER>, RESULT> mapper) { super(mapper); assertNotNull(supplier); this.supplier = supplier; } @Override protected ScalarProvider<BASIC, CONTAINER> createObjectProvider(SelectQuery query) { return new ScalarProvider<>(supplier, query); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/sql/OptionalDoubleInOutParameter.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.jdbc.sql; import java.util.OptionalDouble; import org.seasar.doma.internal.jdbc.scalar.OptionalDoubleScalar; import org.seasar.doma.jdbc.Reference; public class OptionalDoubleInOutParameter extends ScalarInOutParameter<Double, OptionalDouble> { public OptionalDoubleInOutParameter(Reference<OptionalDouble> reference) { super(new OptionalDoubleScalar(), reference); } } ======================= File: doma-kotlin/src/test/java/org/seasar/doma/jdbc/criteria/entity/_Emp.java ======================= <gh_stars>100-1000 package org.seasar.doma.jdbc.criteria.entity; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.BiFunction; import javax.annotation.Generated; import org.seasar.doma.internal.jdbc.scalar.BasicScalar; import org.seasar.doma.jdbc.entity.AbstractEntityType; import org.seasar.doma.jdbc.entity.AssignedIdPropertyType; import org.seasar.doma.jdbc.entity.DefaultPropertyType; import org.seasar.doma.jdbc.entity.EntityPropertyType; import org.seasar.doma.jdbc.entity.GeneratedIdPropertyType; import org.seasar.doma.jdbc.entity.NamingType; import org.seasar.doma.jdbc.entity.PostDeleteContext; import org.seasar.doma.jdbc.entity.PostInsertContext; import org.seasar.doma.jdbc.entity.PostUpdateContext; import org.seasar.doma.jdbc.entity.PreDeleteContext; import org.seasar.doma.jdbc.entity.PreInsertContext; import org.seasar.doma.jdbc.entity.PreUpdateContext; import org.seasar.doma.jdbc.entity.Property; import org.seasar.doma.jdbc.entity.TenantIdPropertyType; import org.seasar.doma.jdbc.entity.VersionPropertyType; import org.seasar.doma.wrapper.BigDecimalWrapper; import org.seasar.doma.wrapper.IntegerWrapper; import org.seasar.doma.wrapper.PrimitiveIntWrapper; import org.seasar.doma.wrapper.StringWrapper; @Generated("") public class _Emp extends AbstractEntityType<Emp> { private static _Emp singleton = new _Emp(); private static final org.seasar.doma.jdbc.entity.OriginalStatesAccessor<Emp> __originalStatesAccessor = new org.seasar.doma.jdbc.entity.OriginalStatesAccessor<>(Emp.class, "originalStates"); private final NamingType __namingType = NamingType.UPPER_CASE; public final AssignedIdPropertyType<Emp, Integer, Integer> id = new AssignedIdPropertyType<>( Emp.class, () -> new BasicScalar<>(IntegerWrapper::new), "id", "ID", __namingType, false); public final DefaultPropertyType<Emp, String, String> name = new DefaultPropertyType<>( Emp.class, () -> new BasicScalar<>(StringWrapper::new), "name", "NAME", __namingType, true, true, false); public final DefaultPropertyType<Emp, BigDecimal, BigDecimal> salary = new DefaultPropertyType<>( Emp.class, () -> new BasicScalar<>(BigDecimalWrapper::new), "salary", "SALARY", __namingType, true, true, false); public final VersionPropertyType<Emp, Integer, Integer> version = new VersionPropertyType<>( Emp.class, () -> new BasicScalar<>(PrimitiveIntWrapper::new), "version", "VERSION", __namingType, false); private final String __name = "Emp"; private final String __catalogName = null; private final String __schemaName = null; private final String __tableName = ""; private final List<EntityPropertyType<Emp,?>> __idPropertyTypes; private final List<EntityPropertyType<Emp,?>> __entityPropertyTypes; private final Map<String, EntityPropertyType<Emp,?>> __entityPropertyTypeMap; public _Emp() { List<EntityPropertyType<Emp,?>> __idList = new ArrayList<>(); __idList.add(id); __idPropertyTypes = Collections.unmodifiableList(__idList); List<EntityPropertyType<Emp,?>> __list = new ArrayList<>(); __list.add(id); __list.add(name); __list.add(salary); __list.add(version); __entityPropertyTypes = Collections.unmodifiableList(__list); Map<String, EntityPropertyType<Emp,?>> __map = new HashMap<>(); __map.put("id", id); __map.put("name", name); __map.put("salary", salary); __map.put("version", version); __entityPropertyTypeMap = Collections.unmodifiableMap(__map); } @Override public boolean isImmutable() { return false; } @Override public Emp newEntity(Map<String, Property<Emp,?>> args) { Emp entity = new Emp(); args.values().forEach(v -> v.save(entity)); return entity; } @Override public Class<Emp> getEntityClass() { return Emp.class; } @Override public String getName() { return __name; } @Override public List<EntityPropertyType<Emp,?>> getEntityPropertyTypes() { return __entityPropertyTypes; } @Override public EntityPropertyType<Emp,?> getEntityPropertyType(String propertyName) { return __entityPropertyTypeMap.get(propertyName); } @Override public void saveCurrentStates(Emp __entity) { Emp __currentStates = new Emp(); id.copy(__currentStates, __entity); name.copy(__currentStates, __entity); salary.copy(__currentStates, __entity); version.copy(__currentStates, __entity); __originalStatesAccessor.set(__entity, __currentStates); } @Override public Emp getOriginalStates(Emp entity) { if (entity.originalStates instanceof Emp) { Emp originalStates = (Emp) entity.originalStates; return originalStates; } return null; } @Override public GeneratedIdPropertyType<Emp,?,?> getGeneratedIdPropertyType() { return null; } @Override public VersionPropertyType<Emp,?,?> getVersionPropertyType() { return version; } @Override public TenantIdPropertyType<Emp,?,?> getTenantIdPropertyType() { return null; } @Override public List<EntityPropertyType<Emp,?>> getIdPropertyTypes() { return __idPropertyTypes; } @Override public void preInsert(Emp entity, PreInsertContext<Emp> context) {} @Override public void preUpdate(Emp entity, PreUpdateContext<Emp> context) {} @Override public void preDelete(Emp entity, PreDeleteContext<Emp> context) {} @Override public void postInsert(Emp entity, PostInsertContext<Emp> context) {} @Override public void postUpdate(Emp entity, PostUpdateContext<Emp> context) {} @Override public void postDelete(Emp entity, PostDeleteContext<Emp> context) {} @Override public String getCatalogName() { return __catalogName; } @Override public String getSchemaName() { return __schemaName; } @Override @Deprecated public String getTableName() { return getTableName((namingType, text) -> namingType.apply(text)); } @Override public String getTableName(BiFunction<NamingType, String, String> namingFunction) { if (__tableName.isEmpty()) { return namingFunction.apply(getNamingType(), getName()); } return __tableName; } @Override public NamingType getNamingType() { return __namingType; } @Override public boolean isQuoteRequired() { return false; } public static _Emp getSingletonInternal() { return singleton; } } ======================= File: doma-core/src/test/java/org/seasar/doma/jdbc/dialect/SqliteDialectTest.java ======================= package org.seasar.doma.jdbc.dialect; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import java.sql.SQLException; import org.junit.jupiter.api.Test; public class SqliteDialectTest { @Test public void testIsUniqueConstraintViolated_true() { SqliteDialect dialect = new SqliteDialect(); SQLException e = new SQLException( "[SQLITE_CONSTRAINT] Abort due to constraint violation (PRIMARY KEY must be unique)"); assertTrue(dialect.isUniqueConstraintViolated(e)); } @Test public void testIsUniqueConstraintViolated_false() { SqliteDialect dialect = new SqliteDialect(); SQLException e = new SQLException( "[SQLITE_CONSTRAINT] Abort due to constraint violation (hoge.foo may not be NULL)"); assertFalse(dialect.isUniqueConstraintViolated(e)); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/util/ElementKindUtilTest.java ======================= <reponame>orekyuu/doma<gh_stars>100-1000 package org.seasar.doma.internal.apt.util; import static org.junit.jupiter.api.Assertions.*; import javax.lang.model.element.ElementKind; import org.junit.jupiter.api.Test; class ElementKindUtilTest { @Test void isRecord() { assertFalse(ElementKindUtil.isRecord(ElementKind.CLASS)); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/dao/FunctionAbstractEntityListDao.java ======================= <reponame>orekyuu/doma package org.seasar.doma.internal.apt.processor.dao; import java.util.List; import org.seasar.doma.Dao; import org.seasar.doma.Function; import org.seasar.doma.internal.apt.processor.entity.AbstractEntity; @SuppressWarnings("deprecation") @Dao(config = MyConfig.class) public interface FunctionAbstractEntityListDao { @Function List<AbstractEntity> execute(); } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/context/Projection.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/jdbc/criteria/context/Projection.java package org.seasar.doma.jdbc.criteria.context; import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; import org.seasar.doma.jdbc.criteria.metamodel.EntityMetamodel; import org.seasar.doma.jdbc.criteria.metamodel.PropertyMetamodel; public interface Projection { <R> R accept(Visitor<R> visitor); class EntityMetamodels implements Projection { public final Map<EntityMetamodel<?>, java.util.List<PropertyMetamodel<?>>> map = new LinkedHashMap<>(); public EntityMetamodels(EntityMetamodel<?> entityMetamodel) { Objects.requireNonNull(entityMetamodel); map.put(entityMetamodel, entityMetamodel.allPropertyMetamodels()); } public EntityMetamodels( EntityMetamodel<?> entityMetamodel, java.util.List<PropertyMetamodel<?>> propertyMetamodels) { Objects.requireNonNull(entityMetamodel); Objects.requireNonNull(propertyMetamodels); map.put(entityMetamodel, Collections.unmodifiableList(propertyMetamodels)); } @Override public <R> R accept(Visitor<R> visitor) { return visitor.visit(this); } } class PropertyMetamodels implements Projection { public final java.util.List<PropertyMetamodel<?>> propertyMetamodels; public PropertyMetamodels(PropertyMetamodel<?>... propertyMetamodels) { this(Arrays.asList(propertyMetamodels)); } public PropertyMetamodels(java.util.List<PropertyMetamodel<?>> propertyMetamodels) { Objects.requireNonNull(propertyMetamodels); this.propertyMetamodels = Collections.unmodifiableList(propertyMetamodels); } @Override public <R> R accept(Visitor<R> visitor) { return visitor.visit(this); } } interface Visitor<R> { R visit(EntityMetamodels entityMetamodels); R visit(PropertyMetamodels propertyMetamodels); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/query/CreateQuery.java ======================= <gh_stars>100-1000 package org.seasar.doma.jdbc.query; import java.sql.Connection; import java.sql.SQLException; public interface CreateQuery<RESULT> extends Query { RESULT create(Connection connection) throws SQLException; } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/ListenerArgumentTypeIllegalEntity.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.Entity; @Entity(listener = ListenerArgumentTypeIllegalEntityListener.class) public class ListenerArgumentTypeIllegalEntity {} ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/dao/SingletonConfigDao.java ======================= package org.seasar.doma.internal.apt.processor.dao; import org.seasar.doma.Dao; @SuppressWarnings("deprecation") @Dao(config = SingletonConfigAnnotatedConfig.class) public interface SingletonConfigDao {} ======================= File: doma-core/src/main/java/org/seasar/doma/internal/WrapException.java ======================= <reponame>orekyuu/doma<filename>doma-core/src/main/java/org/seasar/doma/internal/WrapException.java<gh_stars>100-1000 package org.seasar.doma.internal; public class WrapException extends Exception { private static final long serialVersionUID = 1L; public WrapException(Throwable cause) { super(cause); } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/declaration/ValuesDeclaration.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/jdbc/criteria/declaration/ValuesDeclaration.java package org.seasar.doma.jdbc.criteria.declaration; import java.util.Objects; import org.seasar.doma.jdbc.criteria.context.InsertContext; import org.seasar.doma.jdbc.criteria.context.Operand; import org.seasar.doma.jdbc.criteria.metamodel.PropertyMetamodel; public class ValuesDeclaration { private final InsertContext context; public ValuesDeclaration(InsertContext context) { this.context = Objects.requireNonNull(context); } public <PROPERTY> void value(PropertyMetamodel<PROPERTY> left, PROPERTY right) { Objects.requireNonNull(left); context.values.put(new Operand.Prop(left), new Operand.Param(left, right)); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/domain/MultidimensionalArrayConverter.java ======================= package org.seasar.doma.internal.apt.processor.domain; import org.seasar.doma.ExternalDomain; import org.seasar.doma.jdbc.domain.DomainConverter; @ExternalDomain public class MultidimensionalArrayConverter implements DomainConverter<String[][], Object> { @Override public Object fromDomainToValue(String[][] domain) { return null; } @Override public String[][] fromValueToDomain(Object value) { return null; } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/scalar/OptionalDoubleScalarSuppliers.java ======================= package org.seasar.doma.internal.jdbc.scalar; import java.util.OptionalDouble; import java.util.function.Supplier; public final class OptionalDoubleScalarSuppliers { public static Supplier<Scalar<Double, OptionalDouble>> of() { return OptionalDoubleScalar::new; } } ======================= File: doma-kotlin/src/test/java/org/seasar/doma/jdbc/criteria/entity/NoIdEmp.java ======================= <reponame>orekyuu/doma package org.seasar.doma.jdbc.criteria.entity; import java.math.BigDecimal; import org.seasar.doma.Entity; import org.seasar.doma.Version; import org.seasar.doma.jdbc.entity.NamingType; @Entity(naming = NamingType.SNAKE_UPPER_CASE) public class NoIdEmp { Integer id; String name; BigDecimal salary; @Version Integer version; } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/Commenter.java ======================= package org.seasar.doma.jdbc; /** * A commenter for SQL strings. * * <p>The comment is added to the SQL string that may be built from a SQL template or may be auto * generated. * * <p>The implementation must not add anything except a comment. */ public interface Commenter { /** * Adds the comment to the SQL string. * * @param sql the SQL string * @param context the context * @return the SQL that the comment is added */ default String comment(String sql, CommentContext context) { return sql; } } ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/criteria/query/DeleteBuilder.java ======================= package org.seasar.doma.jdbc.criteria.query; import java.util.Objects; import java.util.function.Function; import org.seasar.doma.internal.jdbc.sql.PreparedSqlBuilder; import org.seasar.doma.jdbc.Config; import org.seasar.doma.jdbc.PreparedSql; import org.seasar.doma.jdbc.SqlKind; import org.seasar.doma.jdbc.SqlLogType; import org.seasar.doma.jdbc.criteria.context.Criterion; import org.seasar.doma.jdbc.criteria.context.DeleteContext; import org.seasar.doma.jdbc.criteria.metamodel.EntityMetamodel; public class DeleteBuilder { private final Config config; private final DeleteContext context; private final Function<String, String> commenter; private final PreparedSqlBuilder buf; private final BuilderSupport support; public DeleteBuilder( Config config, DeleteContext context, Function<String, String> commenter, SqlLogType sqlLogType) { this( config, context, commenter, new PreparedSqlBuilder(config, SqlKind.DELETE, sqlLogType), new AliasManager(context)); } public DeleteBuilder( Config config, DeleteContext context, Function<String, String> commenter, PreparedSqlBuilder buf, AliasManager aliasManager) { Objects.requireNonNull(config); this.config = Objects.requireNonNull(config); this.context = Objects.requireNonNull(context); this.commenter = Objects.requireNonNull(commenter); this.buf = Objects.requireNonNull(buf); Objects.requireNonNull(aliasManager); support = new BuilderSupport(config, commenter, buf, aliasManager); } public PreparedSql build() { buf.appendSql("delete"); if (config.getDialect().supportsAliasInDeleteClause()) { buf.appendSql(" "); alias(context.entityMetamodel); } buf.appendSql(" from "); table(context.entityMetamodel); if (!context.where.isEmpty()) { buf.appendSql(" where "); int index = 0; for (Criterion criterion : context.where) { visitCriterion(index++, criterion); buf.appendSql(" and "); } buf.cutBackSql(5); } return buf.build(commenter); } private void alias(EntityMetamodel<?> entityMetamodel) { support.alias(entityMetamodel); } private void table(EntityMetamodel<?> entityMetamodel) { support.table(entityMetamodel); } private void visitCriterion(int index, Criterion criterion) { support.visitCriterion(index, criterion); } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/expr/node/AbstractComparisonOperatorNode.java ======================= <gh_stars>100-1000 package org.seasar.doma.internal.expr.node; import static org.seasar.doma.internal.util.AssertionUtil.*; public abstract class AbstractComparisonOperatorNode implements ComparisonOperatorNode { protected static final int PRIORITY = 40; protected final ExpressionLocation location; protected final String expression; protected ExpressionNode leftNode; protected ExpressionNode rightNode; protected AbstractComparisonOperatorNode(ExpressionLocation location, String expression) { assertNotNull(location, expression); this.location = location; this.expression = expression; } @Override public ExpressionNode getLeftNode() { return leftNode; } public void setLeftNode(ExpressionNode leftNode) { this.leftNode = leftNode; } @Override public ExpressionNode getRightNode() { return rightNode; } public void setRightNode(ExpressionNode rightNode) { this.rightNode = rightNode; } @Override public ExpressionLocation getLocation() { return location; } @Override public String getExpression() { return expression; } @Override public int getPriority() { return PRIORITY; } @Override public String toString() { return leftNode + " " + expression + " " + rightNode; } } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/ParameterBinder.java ======================= <filename>doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/ParameterBinder.java package org.seasar.doma.internal.jdbc.command; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; import org.seasar.doma.jdbc.SqlParameter; public interface ParameterBinder<S extends PreparedStatement, P extends SqlParameter> { void bind(S statement, List<? extends P> parameters) throws SQLException; } ======================= File: doma-core/src/main/java/org/seasar/doma/internal/jdbc/command/OptionalMapSingleResultHandler.java ======================= package org.seasar.doma.internal.jdbc.command; import java.util.Map; import java.util.Optional; import org.seasar.doma.MapKeyNamingType; public class OptionalMapSingleResultHandler extends AbstractSingleResultHandler<Optional<Map<String, Object>>> { public OptionalMapSingleResultHandler(MapKeyNamingType keyNamingType) { super(new MapIterationHandler<>(keyNamingType, new OptionalSingleResultCallback<>())); } } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/ListenerArgumentTypeIllegalEntityListener.java ======================= <filename>doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/ListenerArgumentTypeIllegalEntityListener.java<gh_stars>100-1000 package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.jdbc.entity.EntityListener; import org.seasar.doma.jdbc.entity.PostDeleteContext; import org.seasar.doma.jdbc.entity.PostInsertContext; import org.seasar.doma.jdbc.entity.PostUpdateContext; import org.seasar.doma.jdbc.entity.PreDeleteContext; import org.seasar.doma.jdbc.entity.PreInsertContext; import org.seasar.doma.jdbc.entity.PreUpdateContext; public class ListenerArgumentTypeIllegalEntityListener implements EntityListener<String> { @Override public void preDelete(String entity, PreDeleteContext<String> context) {} @Override public void preInsert(String entity, PreInsertContext<String> context) {} @Override public void preUpdate(String entity, PreUpdateContext<String> context) {} @Override public void postInsert(String entity, PostInsertContext<String> context) {} @Override public void postUpdate(String entity, PostUpdateContext<String> context) {} @Override public void postDelete(String entity, PostDeleteContext<String> context) {} } ======================= File: doma-processor/src/test/java/org/seasar/doma/internal/apt/processor/entity/AbstractEntityListenerEntity.java ======================= package org.seasar.doma.internal.apt.processor.entity; import org.seasar.doma.Entity; @Entity(listener = AbstractEntityListener.class) public class AbstractEntityListenerEntity {} ======================= File: doma-core/src/main/java/org/seasar/doma/jdbc/id/AbstractPreGenerateIdGenerator.java ======================= <reponame>orekyuu/doma package org.seasar.doma.jdbc.id; import java.sql.Statement; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.seasar.doma.jdbc.JdbcException; /** A generator that generates an identity value before an execution of insert. */ public abstract class AbstractPreGenerateIdGenerator extends AbstractIdGenerator { protected long initialValue; protected long allocationSize; // the keys are data source names and the values are identity contexts protected final ConcurrentMap<String, IdContext> idContextMap = new ConcurrentHashMap<>(); /** * Sets the initial value. * * @param initialValue the initial value */ public void setInitialValue(long initialValue) { this.initialValue = initialValue; } /** * Sets the allocation size. * * @param allocationSize the allocation size */ public void setAllocationSize(long allocationSize) { this.allocationSize = allocationSize; } @Override public boolean supportsBatch(IdGenerationConfig config) { return true; } @Override public boolean supportsAutoGeneratedKeys(IdGenerationConfig config) { return false; } @
66,001
thestackv1_concat_by_repo-long/65536-65536
::Cdn->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Type->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Role->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::TmUser->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Division->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Region->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::PhysLocation->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Status->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Cachegroup->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Regex->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Parameter->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Profile->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::ProfileParameter->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Asn->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Server->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::Deliveryservice->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::DeliveryserviceRegex->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::DeliveryserviceServer->new($schema_values) ); $self->load_all_fixtures( Fixtures::Integration::ToExtension->new($schema_values) ); diag "Done!"; } # Tearing down the Cachegroup table requires deleting them in a specific order, because # of the 'parent_cachegroup_id' and nested references. sub delete_cachegroups { my $self = shift; my $dbh = Schema->database_handle; my $cg = $dbh->prepare("TRUNCATE TABLE cachegroup CASCADE;"); $cg->execute(); $cg->finish(); $dbh->disconnect; } sub unload_core_data { my $self = shift; my $schema = shift; $self->teardown( $schema, 'Job' ); $self->teardown( $schema, 'Log' ); $self->teardown( $schema, 'TmUser' ); $self->teardown( $schema, 'Role' ); $self->teardown( $schema, 'Regex' ); $self->teardown( $schema, 'DeliveryserviceServer' ); $self->teardown( $schema, 'Deliveryservice' ); $self->teardown( $schema, 'Server' ); $self->teardown( $schema, 'Asn' ); $self->delete_cachegroups($schema); # cachegroups is special because it refs itself $self->teardown( $schema, 'Profile' ); $self->teardown( $schema, 'Parameter' ); $self->teardown( $schema, 'ProfileParameter' ); $self->teardown( $schema, 'ToExtension' ); $self->teardown( $schema, 'Type' ); $self->teardown( $schema, 'Status' ); $self->teardown( $schema, 'PhysLocation' ); $self->teardown( $schema, 'Region' ); $self->teardown( $schema, 'Division' ); $self->teardown( $schema, 'Snapshot' ); $self->teardown( $schema, 'Cdn' ); } 1; ======================= File: traffic_ops/install/lib/GenerateCert.pm ======================= #!/usr/bin/perl # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # package GenerateCert; use strict; use base qw{ Exporter }; our @EXPORT_OK = qw{ createCert }; our %EXPORT_TAGS = ( all => \@EXPORT_OK ); use JSON; use InstallUtils; use File::Temp; use Data::Dumper; use File::Copy; use InstallUtils qw{ :all }; my $ca = "/etc/pki/tls/certs/localhost.ca"; my $csr = "/etc/pki/tls/certs/localhost.csr"; my $cert = "/etc/pki/tls/certs/localhost.crt"; my $cdn_conf = "/opt/traffic_ops/app/conf/cdn.conf"; my $key = "/etc/pki/tls/private/localhost.key"; my $msg = << 'EOF'; We're now running a script to generate a self signed X509 SSL certificate. EOF sub writeCdn_conf { my $cdn_conf = shift; # listen param to be inserted my $listen_str = "https://[::]:443?cert=${cert}&key=${key}&ca=${ca}&verify=0x00&ciphers=AES128-GCM-SHA256:HIGH:!RC4:!MD5:!aNULL:!EDH:!ED"; # load as perl hash to find string to be replaced my $cdnh = do $cdn_conf; if ( exists $cdnh->{hypnotoad} ) { $cdnh->{hypnotoad}{listen} = [$listen_str]; } else { # add the whole hypnotoad config without affecting anything else in the config $cdnh->{hypnotoad} = { listen => [$listen_str], user => 'trafops', group => 'trafops', pid_file => '/var/run/traffic_ops.pid', workers => 48, }; } # dump conf data in compact but readable form my $dumper = Data::Dumper->new( [$cdnh] ); $dumper->Indent(1)->Terse(1)->Quotekeys(0); # write whole config to temp file in pwd (keeps in same filesystem) my $tmpfile = File::Temp->new( DIR => '.' ); print $tmpfile $dumper->Dump(); close $tmpfile; # make backup of current file my $backup_num = 0; my $backup_name; do { $backup_num++; $backup_name = "$cdn_conf.backup$backup_num"; } while ( -e $backup_name ); rename( $cdn_conf, $backup_name ) or die("rename(): $!"); # rename temp file to cdn.conf and set ownership/permissions same as backup my @stats = stat($backup_name); my ( $uid, $gid, $perm ) = @stats[ 4, 5, 2 ]; move( "$tmpfile", $cdn_conf ) or die("move(): $!"); chown $uid, $gid, $cdn_conf; chmod $perm, $cdn_conf; } # execOpenssl takes a description of the command being done, and an array of arguments to OpenSSL, # and tries to execute the command, on failure prompting the user to retry. # The description should be capitalized, but not terminated with punctuation. # Returns the OpenSSL exit code. sub execOpenssl { my ( $description, @args ) = @_; InstallUtils::logger( $description, "info" ); my $result = 1; while ( $result!= 0 ) { $result = InstallUtils::execCommand( "openssl", @args ); if ( $result!= 0 ) { my $ans = ""; while ( $ans!~ /^[yY]/ && $ans!~ /^[nN]/ ) { $ans = InstallUtils::promptUser( $description. " failed. Try again (y/n)", "y" ); } if ( $ans =~ /^[nN]/ ) { return $result; } } } return $result; } # creates a certificate with parameters used from postinstall passed into $config sub createCert { # the file used for ssl configuration my $config = shift; InstallUtils::logger( $msg, "info" ); InstallUtils::logger( "Postinstall SSL Certificate Creation", "info" ); my $params; my $passphrase; # create the string of parameters $params = "/C=$config->{country}/ST=$config->{state}/L=$config->{locality}/O=$config->{company}/OU=$config->{org_unit}/CN=$config->{common_name}/"; $passphrase = $config->{rsaPassword}; InstallUtils::logger( "The server key has been generated", "info" ); if ( execOpenssl( "Generating an RSA Private Server Key", "genrsa", "-des3", "-out", "server.key", "-passout", "pass:$passphrase", "1<PASSWORD>" )!= 0 ) { exit 1; } if ( execOpenssl( "Creating a Certificate Signing Request (CSR)", "req", "-new", "-key", "server.key", "-out", "server.csr", "-passin", "pass:$<PASSWORD>", "-subj", $params )!= 0 ) { exit 1; } InstallUtils::logger( "The Certificate Signing Request has been generated", "info" ); InstallUtils::execCommand( "/bin/mv", "server.key", "server.key.orig" ); if ( execOpenssl( "Removing the pass phrase from the server key", "rsa", "-in", "server.key.orig", "-out", "server.key", "-passin", "pass:$passphrase" )!= 0 ) { exit 1; } InstallUtils::logger( "The pass phrase has been removed from the server key", "info" ); if ( execOpenssl( "Generating a Self-signed certificate", "x509", "-req", "-days", "365", "-in", "server.csr", "-signkey", "server.key", "-out", "server.crt" )!= 0 ) { exit 1; } InstallUtils::logger( "A server key and self signed certificate has been generated", "info" ); InstallUtils::logger( "Installing the server key and server certificate", "info" ); my $result = InstallUtils::execCommand( "/bin/cp", "server.key", "$key" ); if ( $result!= 0 ) { errorOut("Failed to install the private server key"); } $result = InstallUtils::execCommand( "/bin/chmod", "600", "$key" ); $result = InstallUtils::execCommand( "/bin/chown", "trafops:trafops", "$key" ); if ( $result!= 0 ) { errorOut("Failed to install the private server key"); } InstallUtils::logger( "The private key has been installed", "info" ); InstallUtils::logger( "Installing the self signed certificate", "info" ); $result = InstallUtils::execCommand( "/bin/cp", "server.crt", "$cert" ); if ( $result!= 0 ) { errorOut("Failed to install the self signed certificate"); } $result = InstallUtils::execCommand( "/bin/chmod", "600", "$cert" ); $result = InstallUtils::execCommand( "/bin/chown", "trafops:trafops", "$cert" ); if ( $result!= 0 ) { errorOut("Failed to install the self signed certificate"); } InstallUtils::logger( "Saving the self signed csr", "info" ); $result = InstallUtils::execCommand( "/bin/cp", "server.csr", "$csr" ); if ( $result!= 0 ) { errorOut("Failed to save the self signed csr"); } $result = InstallUtils::execCommand( "/bin/chmod", "664", "$csr" ); $result = InstallUtils::execCommand( "/bin/chown", "trafops:trafops", "$csr" ); writeCdn_conf($cdn_conf); my $msg = << 'EOF'; The self signed certificate has now been installed. You may obtain a certificate signed by a Certificate Authority using the server.csr file saved in the current directory. Once you have obtained a signed certificate, copy it to /etc/pki/tls/certs/localhost.crt and restart Traffic Ops. EOF InstallUtils::logger( $msg, "info" ); return 0; } ======================= File: traffic_ops/app/t/api/1.2/tenant.t ======================= package main; # # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use Mojo::Base -strict; use Test::More; use Test::Mojo; use DBI; use strict; use warnings; no warnings 'once'; use warnings 'all'; use Test::TestHelper; #no_transactions=>1 ==> keep fixtures after every execution, beware of duplicate data! #no_transactions=>0 ==> delete fixtures after every execution BEGIN { $ENV{MOJO_MODE} = "test" } my $schema = Schema->connect_to_database; my $dbh = Schema->database_handle; my $t = Test::Mojo->new('TrafficOps'); Test::TestHelper->unload_core_data($schema); Test::TestHelper->load_core_data($schema); ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; #verifying the basic cfg $t->get_ok("/api/1.2/tenants")->status_is(200)->json_is( "/response/0/name", "root" )->or( sub { diag $t->tx->res->content->asset->{content}; } );; my $root_tenant_id = &get_tenant_id('root'); #setting with no "active" field which is optional ok $t->post_ok('/api/1.2/tenants' => {Accept => 'application/json'} => json => { "name" => "tenantA", "parentId" => $root_tenant_id })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "tenantA" ) ->json_is( "/response/active" => 0) ->json_is( "/response/parentId" => $root_tenant_id) , 'Does the tenant details return?'; #same name - would not accept ok $t->post_ok('/api/1.2/tenants' => {Accept => 'application/json'} => json => { "name" => "tenantA", "active" => 1, "parentId" => $root_tenant_id })->status_is(400); #no name - would not accept ok $t->post_ok('/api/1.2/tenants' => {Accept => 'application/json'} => json => { "parentId" => $root_tenant_id })->status_is(400); #no parent - would not accept ok $t->post_ok('/api/1.2/tenants' => {Accept => 'application/json'} => json => { "name" => "tenantB" })->status_is(400); my $tenantA_id = &get_tenant_id('tenantA'); #rename, and move to active ok $t->put_ok('/api/1.2/tenants/'. $tenantA_id => {Accept => 'application/json'} => json => { "name" => "tenantA2", "active" => 1, "parentId" => $root_tenant_id }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "tenantA2" ) ->json_is( "/response/id" => $tenantA_id ) ->json_is( "/response/active" => 1 ) ->json_is( "/response/parentId" => $root_tenant_id ) ->json_is( "/alerts/0/level" => "success" ) , 'Does the tenantA2 details return?'; #change "active" ok $t->put_ok('/api/1.2/tenants/'. $tenantA_id => {Accept => 'application/json'} => json => { "name" => "tenantA2", "active" => 0, "parentId" => $root_tenant_id }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "tenantA2" ) ->json_is( "/response/id" => $tenantA_id ) ->json_is( "/response/active" => 0 ) ->json_is( "/response/parentId" => $root_tenant_id ) ->json_is( "/alerts/0/level" => "success" ) , 'Did we moved to non active?'; #change "active" back ok $t->put_ok('/api/1.2/tenants/'. $tenantA_id => {Accept => 'application/json'} => json => { "name" => "tenantA2", "active" => 1, "parentId" => $root_tenant_id }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "tenantA2" ) ->json_is( "/response/id" => $tenantA_id ) ->json_is( "/response/active" => 1 ) ->json_is( "/response/parentId" => $root_tenant_id ) ->json_is( "/alerts/0/level" => "success" ) , 'Did we moved back to active?'; #cannot change tenant parent to undef ok $t->put_ok('/api/1.2/tenants/'. $tenantA_id => {Accept => 'application/json'} => json => { "name" => "tenantC", "active" => 1}) ->json_is( "/alerts/0/text" => "Parent Id is required.") ->status_is(400); #cannot skip "active" field on "put" ok $t->put_ok('/api/1.2/tenants/'. $tenantA_id => {Accept => 'application/json'} => json => { "name" => "tenantC", "parentId" => $root_tenant_id}) ->json_is( "/alerts/0/text" => "Active field is required.") ->status_is(400); #cannot skip "name" field on "put" ok $t->put_ok('/api/1.2/tenants/'. $tenantA_id => {Accept => 'application/json'} => json => { "active" => 1, "parentId" => $root_tenant_id}) ->json_is( "/alerts/0/text" => "Tenant name is required.") ->status_is(400); #cannot change root-tenant to inactive ok $t->put_ok('/api/1.2/tenants/'. $root_tenant_id => {Accept => 'application/json'} => json => { "name" => "root", "active" => 0, "parentId" => undef}) ->json_is( "/alerts/0/text" => "Root user cannot be in-active.") ->status_is(400); #adding a child tenant ok $t->post_ok('/api/1.2/tenants' => {Accept => 'application/json'} => json => { "name" => "tenantD", "active" => 1, "parentId" => $tenantA_id })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "tenantD" ) ->json_is( "/response/active" => 1 ) ->json_is( "/response/parentId" => $tenantA_id) , 'Does the tenant details return?'; #adding a child inactive tenant ok $t->post_ok('/api/1.2/tenants' => {Accept => 'application/json'} => json => { "name" => "tenantE", "active" => 0, "parentId" => $tenantA_id })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "tenantE" ) ->json_is( "/response/active" => 0 ) ->json_is( "/response/parentId" => $tenantA_id) , 'Does the tenant details return?'; #cannot delete a tenant that have children ok $t->delete_ok('/api/1.2/tenants/'. $tenantA_id)->status_is(400) ->json_is( "/alerts/0/text" => "Tenant 'tenantA2' has children tenant(s): e.g 'tenantD'. Please update these tenants and retry." ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); my $tenantD_id = &get_tenant_id('tenantD'); my $tenantE_id = &get_tenant_id('tenantE'); ok $t->delete_ok('/api/1.2/tenants/'. $tenantE_id)->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->delete_ok('/api/1.2/tenants/'. $tenantD_id)->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->delete_ok('/api/1.2/tenants/'. $tenantA_id)->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ); #cannot delete a tenant that have a user ok $t->delete_ok('/api/1.2/tenants/'. 10**9)->status_is(400) ->json_is( "/alerts/0/text" => "Tenant 'root' is assign with user(s): e.g. 'admin-root'. Please update these users and retry." ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); $dbh->disconnect(); done_testing(); sub get_tenant_id { my $name = shift; my $q = "select id from tenant where name = \'$name\'"; my $get_svr = $dbh->prepare($q); $get_svr->execute(); my $p = $get_svr->fetchall_arrayref( {} ); $get_svr->finish(); my $id = $p->[0]->{id}; return $id; } ======================= File: traffic_ops/app/lib/API/Profile.pm ======================= <filename>traffic_ops/app/lib/API/Profile.pm package API::Profile; # # # 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. # # # # JvD Note: you always want to put Utils as the first use. Sh*t don't work if it's after the Mojo lines. use UI::Utils; use Mojo::Base 'Mojolicious::Controller'; use Data::Dumper; use JSON; sub index { my $self = shift; my $orderby = $self->param('orderby'); my $parameter_id = $self->param('param'); my $cdn_id = $self->param('cdn'); my @data; my %criteria; if ( defined $parameter_id ) { my $rs = $self->db->resultset('ProfileParameter')->search( { parameter => $parameter_id }, { prefetch => [ 'profile' ], order_by => $orderby } ); while ( my $row = $rs->next ) { push( @data, { "id" => $row->profile->id, "name" => $row->profile->name, "description" => $row->profile->description, "cdn" => defined($row->profile->cdn)? $row->profile->cdn->id : undef, "cdnName" => defined($row->profile->cdn)? $row->profile->cdn->name : undef, "type" => $row->profile->type, "lastUpdated" => $row->profile->last_updated } ); } } else { if ( defined $cdn_id ) { $criteria{'cdn'} = $cdn_id; } my $rs_data = $self->db->resultset("Profile")->search( \%criteria, { order_by => $orderby } ); while ( my $row = $rs_data->next ) { push( @data, { "id" => $row->id, "name" => $row->name, "description" => $row->description, "cdn" => defined($row->cdn)? $row->cdn->id : undef, "cdnName" => defined($row->cdn)? $row->cdn->name : undef, "type" => $row->type, "lastUpdated" => $row->last_updated } ); } } $self->success( \@data ); } sub index_trimmed { my $self = shift; my @data; my $orderby = $self->param('orderby') || "name"; my $rs_data = $self->db->resultset("Profile")->search( undef, { order_by => $orderby } ); while ( my $row = $rs_data->next ) { push( @data, { "name" => $row->name, } ); } $self->render( json => \@data ); } sub get_profiles_by_paramId { my $self = shift; my $param_id = $self->param('id'); my $param_profiles = $self->db->resultset('ProfileParameter')->search( { parameter => $param_id } ); my $profiles = $self->db->resultset('Profile')->search( {'me.id' => { -in => $param_profiles->get_column('profile')->as_query } } ); my @data; if ( defined($profiles) ) { while ( my $row = $profiles->next ) { push( @data, { "id" => $row->id, "name" => $row->name, "description" => $row->description, "lastUpdated" => $row->last_updated } ); } } return $self->success( \@data ); } sub show { my $self = shift; my $id = $self->param('id'); my $rs_data = $self->db->resultset("Profile")->search( {'me.id' => $id }, { prefetch => [ 'cdn' ] } ); my @data = (); while ( my $row = $rs_data->next ) { push( @data, { "id" => $row->id, "name" => $row->name, "description" => $row->description, "cdn" => defined($row->cdn)? $row->cdn->id : undef, "cdnName" => defined($row->cdn)? $row->cdn->name : undef, "type" => $row->type, "lastUpdated" => $row->last_updated } ); } $self->success( \@data ); } sub create { my $self = shift; my $params = $self->req->json; if (!defined($params) ) { return $self->alert("parameters must be in JSON format, please check!"); } if (!&is_oper($self) ) { return $self->alert( { Error => " - You must be an admin or oper to perform this operation!" } ); } my $name = $params->{name}; if (!defined($name) || $name eq "" || $name =~ /\s/ ) { return $self->alert("profile 'name' is required and cannot contain spaces."); } my $description = $params->{description}; if (!defined($description) || $description eq "" ) { return $self->alert("profile 'description' is required."); } if (!defined( $params->{type} ) ) { return $self->alert("Profile type is required."); } my $existing_profile = $self->db->resultset('Profile')->search( { name => $name } )->get_column('name')->single(); if ( $existing_profile && $name eq $existing_profile ) { return $self->alert("profile with name $name already exists."); } my $existing_desc = $self->db->resultset('Profile')->find( { description => $description } ); if ($existing_desc) { return $self->alert("a profile with the exact same description already exists."); } my $cdn = $params->{cdn}; my $type = $params->{type}; my $insert = $self->db->resultset('Profile')->create( { name => $name, description => $description, cdn => $cdn, type => $type, } ); $insert->insert(); my $new_id = $insert->id; &log( $self, "Created profile with id: ". $new_id. " and name: ". $name, "APICHANGE" ); my $response; $response->{id} = $new_id; $response->{name} = $name; $response->{description} = $description; $response->{cdn} = $cdn; $response->{type} = $type; return $self->success($response); } sub copy { my $self = shift; if (!&is_oper($self) ) { return $self->alert( { Error => " - You must be an admin or oper to perform this operation!" } ); } my $name = $self->param('profile_name'); my $profile_copy_from_name = $self->param('profile_copy_from'); if (!defined($name) || $name eq "" || $name =~ /\s/ ) { return $self->alert("profile 'name' is required and cannot contain spaces."); } if ( defined($profile_copy_from_name) and ( $profile_copy_from_name eq "" ) ) { return $self->alert("profile name 'profile_copy_from' can't be null."); } my $existing_profile = $self->db->resultset('Profile')->search( { name => $name } )->get_column('name')->single(); if ( $existing_profile && $name eq $existing_profile ) { return $self->alert("profile with name $name already exists."); } my $rs = $self->db->resultset('Profile')->search( { name => $profile_copy_from_name } ); my $row1 = $rs->next; if (!$row1 ) { return $self->alert("profile_copy_from $profile_copy_from_name doesn't exist."); } my $profile_copy_from_id = $row1->id; my $description = $row1->description; my $cdn = $row1->cdn; my $type = $row1->type; my $insert = $self->db->resultset('Profile')->create( { name => $name, description => $description, cdn => $cdn, type => $type, } ); $insert->insert(); my $new_id = $insert->id; if ( defined($profile_copy_from_name) ) { my $rs_param = $self->db->resultset('ProfileParameter') ->search( { profile => $profile_copy_from_id }, { prefetch => [ { profile => undef }, { parameter => undef } ] } ); while ( my $row = $rs_param->next ) { my $insert = $self->db->resultset('ProfileParameter')->create( { profile => $new_id, parameter => $row->parameter->id, } ); $insert->insert(); } } &log( $self, "Created profile from copy with id: ". $new_id. " and name: ". $name, "APICHANGE" ); my $response; $response->{id} = $new_id; $response->{name} = $name; $response->{description} = $description; $response->{profileCopyFrom} = $profile_copy_from_name; $response->{idCopyFrom} = $profile_copy_from_id; return $self->success($response); } sub update { my $self = shift; my $id = $self->param('id'); my $params = $self->req->json; if (!&is_oper($self) ) { return $self->forbidden(); } my $profile = $self->db->resultset('Profile')->find( { id => $id } ); if (!defined($profile) ) { return $self->not_found(); } if (!defined($params) ) { return $self->alert("parameters must be in JSON format."); } my $name = $params->{name}; if (!defined($name) || $name eq "" || $name =~ /\s/ ) { return $self->alert("profile 'name' is required and cannot contain spaces."); } if ( $profile->name ne $name ) { my $existing = $self->db->resultset('Profile')->find( { name => $name } ); if ($existing) { return $self->alert( "a profile with name ". $name. " already exists." ); } } my $description = $params->{description}; if (!defined($description) || $description eq "" ) { return $self->alert("profile 'description' is required."); } if ( $profile->description ne $description ) { my $existing = $self->db->resultset('Profile')->find( { description => $description } ); if ($existing) { return $self->alert("a profile with the exact same description already exists."); } } if (!defined( $params->{type} ) ) { return $self->alert("Profile type is required."); } my $cdn = $params->{cdn}; my $type = $params->{type}; my $values = { name => $name, description => $description, cdn => $cdn, type => $type, }; my $rs = $profile->update($values); if ($rs) { my $response; $response->{id} = $id; $response->{name} = $name; $response->{description} = $description; $response->{cdn} = $cdn; $response->{type} = $type; &log( $self, "Update profile with id: ". $id. " and name: ". $name, "APICHANGE" ); return $self->success( $response, "Profile was updated: ". $id ); } else { return $self->alert("Profile update failed."); } } sub delete { my $self = shift; my $id = $self->param('id'); if (!&is_oper($self) ) { return $self->forbidden(); } my $profile = $self->db->resultset('Profile')->find( { id => $id } ); if (!defined($profile) ) { return $self->not_found(); } if ($profile->name eq 'GLOBAL') { return $self->alert("Cannot delete the GLOBAL profile."); } my $server = $self->db->resultset('Server')->find( { profile => $profile->id } ); if ( defined($server) ) { return $self->alert("the profile is used by some server(s)."); } my $ds = $self->db->resultset('Deliveryservice')->find( { profile => $profile->id } ); if ( defined($ds) ) { return $self->alert("the profile is used by some deliveryservice(s)."); } my $profile_name = $profile->name; $profile->delete(); &log( $self, "Delete profile with id: ". $id. " and name: ". $profile_name, "APICHANGE" ); return $self->success_message("Profile was deleted."); } sub availableprofile { my $self = shift; my @data; my $paramid = $self->param('paramid'); my %dsids; my %in_use; # Get a list of all profile id's associated with this param id my $rs_in_use = $self->db->resultset("ProfileParameter")->search( { 'parameter' => $paramid } ); while ( my $row = $rs_in_use->next ) { $in_use{ $row->profile->id } = undef; } # Add remaining profile ids to @data my $rs_links = $self->db->resultset("Profile")->search( undef, { order_by => "description" } ); while ( my $row = $rs_links->next ) { if (!exists( $in_use{ $row->id } ) ) { push( @data, { "id" => $row->id, "description" => $row->description } ); } } $self->success( \@data ); } 1; ======================= File: traffic_ops/app/lib/UI/Steering.pm ======================= package UI::Steering; # # # 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. # # # # JvD Note: you always want to put Utils as the first use. Sh*t don't work if it's after the Mojo lines. use UI::Utils; use Mojo::Base 'Mojolicious::Controller'; use Data::Dumper; use UI::DeliveryService; use API::Cdn; use Scalar::Util qw(looks_like_number); use JSON; use POSIX qw(strftime); use Date::Parse; sub index { my $self = shift; my $ds_id = $self->param('id'); &navbarpage($self); # select * from steering_target where deliveryservice = ds_id; my $steering = { ds_id => $ds_id, ds_name => $self->get_ds_name($ds_id) }; my $st_rs = $self->db->resultset('SteeringTarget')->search( { deliveryservice => $ds_id } ); if ( $st_rs > 0 ) { my %steering_targets; while ( my $row = $st_rs->next ) { $steering_targets{ $row->target } = $row->weight; } my @keys = sort keys %steering_targets; $steering->{'target_id_1'} = $keys[0]; $steering->{'target_id_2'} = $keys[1]; $steering->{'target_name_1'} = $self->get_ds_name( $keys[0] ); $steering->{'target_name_2'} = $self->get_ds_name( $keys[1] ); $steering->{'target_id_1_weight'} = $self->get_target_weight( $ds_id, $keys[0] ); $steering->{'target_id_2_weight'} = $self->get_target_weight( $ds_id, $keys[1] ); } if (!defined($steering->{'target_id_1_weight'})) { $steering->{'target_id_1_weight'} = 0; } if (!defined($steering->{'target_id_2_weight'})) { $steering->{'target_id_2_weight'} = 0; } $self->stash( steering => $steering, ds_data => $self->get_deliveryservices(), fbox_layout => 1 ); } sub get_target_weight{ my $self = shift; my $ds_id = shift; my $target_id = shift; my $weight = $self->db->resultset('SteeringTarget')->search( { -and => [target => $target_id, deliveryservice => $ds_id] } )->get_column('weight')->single(); return $weight; } sub get_ds_name { my $self = shift; my $ds_id = shift; return $self->db->resultset('Deliveryservice')->search( { id => $ds_id } )->get_column('xml_id')->single(); } sub get_deliveryservices { my $self = shift; my %ds_data; my $rs = $self->db->resultset('Deliveryservice')->search(undef, { prefetch => [ 'type' ] }); while ( my $row = $rs->next ) { if ( $row->type->name =~ m/^HTTP/ ) { $ds_data{ $row->id } = $row->xml_id; } } return \%ds_data; } sub update { my $self = shift; my $ds_id = $self->param('id'); my $tid1 = $self->param('steering.target_id_1'); my $tid2 = $self->param('steering.target_id_2'); my $tid1_weight = $self->param('steering.target_id_1_weight'); my $tid2_weight = $self->param('steering.target_id_2_weight'); if ( $tid1_weight eq "" ) { $tid1_weight = 0; } if ( $tid2_weight eq "" ) { $tid2_weight = 0; } if ( $self->is_valid() ) { my $targets; $targets->{$tid1} = $tid1_weight; $targets->{$tid2} = $tid2_weight; #delete current entries my $delete = $self->db->resultset('SteeringTarget') ->search( { deliveryservice => $ds_id } ); if ( defined($delete) ) { $delete->delete(); } #add new entries foreach my $target ( keys %$targets ) { my $insert = $self->db->resultset('SteeringTarget')->create( { deliveryservice => $ds_id, target => $target, weight => $targets->{$target}, } ); $insert->insert(); } $self->flash( message => "Successfully saved steering assignments for " . $self->get_ds_name($ds_id) . "!" ); $self->redirect_to("/ds/$ds_id/steering"); } else { &stash_role($self); my $target_name_1; my $target_name_2; my $target_id_1_weight; my $target_id_2_weight; if ($tid1 ) { $target_name_1 = $self->get_ds_name($tid1); $target_id_1_weight = $self->get_target_weight( $ds_id, $tid1 ); } if ($tid2 ) { $target_name_2 = $self->get_ds_name($tid2); $target_id_2_weight = $self->get_target_weight( $ds_id, $tid2 ); } $self->stash( steering => { ds_id => $ds_id, ds_name => $self->get_ds_name($ds_id), target_id_1 => $tid1, target_id_2 => $tid2, target_name_1 => $target_name_1, target_name_2 => $target_name_2, target_id_1_weight => $target_id_1_weight, target_id_2_weight => $target_id_2_weight }, ds_data => $self->get_deliveryservices(), fbox_layout => 1 ); $self->render("steering/index"); } } sub is_valid { my $self = shift; #validate DSs are in the same CDN (same profile...) my $t1 = $self->param('steering.target_id_1'); my $t2 = $self->param('steering.target_id_2'); my $t1_profile; my $t2_profile; my $tid1_weight = $self->param('steering.target_id_1_weight'); my $t1_name = $self->param('steering.target_name_1'); my $tid2_weight = $self->param('steering.target_id_2_weight'); my $t2_name = $self->param('steering.target_name_2'); unless ( $t1 eq '' ) { $t1_profile = $self->get_ds_profile( $self->param('steering.target_id_1') ); } unless ( $t2 eq '' ) { $t2_profile = $self->get_ds_profile( $self->param('steering.target_id_2') ); } unless ( $t1 ) { $self->field('steering.target_id_1')->is_equal( "", "Steering targets cannot be blank!" ); } unless ( $t2 ) { $self->field('steering.target_id_2')->is_equal( "", "Steering targets cannot be blank!" ); } unless ( $t1_profile eq $t2_profile ) { $self->field('steering.target_id_1')->is_equal( "", "Target Deliveryservices must be in the same CDN!" ); } unless ( $tid1_weight eq int($tid1_weight) && $tid1_weight >= 0 ) { $self->field('steering.target_id_1_weight')->is_equal( "", "Error: \"$tid1_weight\" is not a valid integer of 0 or greater." ); } unless ( $tid2_weight eq int($tid2_weight) && $tid2_weight >= 0 ) { $self->field('steering.target_id_2_weight')->is_equal( "", "Error: \"$tid2_weight\" is not a valid integer of 0 or greater." ); } return $self->valid; } sub get_ds_profile { my $self = shift; my $ds_id = shift; my $ds = $self->db->resultset('Deliveryservice')->search( {'me.id' => $ds_id }, { prefetch => ['profile'] } )->single(); return $ds->profile->name; } 1; ======================= File: traffic_ops/app/lib/Utils/Helper.pm ======================= <gh_stars>0 package Utils::Helper; # # # 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. # # # use Carp qw(cluck confess); use Data::Dumper; sub new { my $self = {}; my $class = shift; my $args = shift; $self->{MOJO} = $args->{mojo} || confess("The mojo argument is required"); return ( bless( $self, $class ) ); } sub mojo { my $self = shift || confess("Call on an instance of Utils::Helper"); return ( $self->{MOJO} ); } sub is_valid_delivery_service { my $self = shift || confess("Call on an instance of Utils::Helper"); my $id = shift || confess("Please supply a delivery service ID"); my $result = $self->mojo->db->resultset("Deliveryservice")->find( { id => $id } ); if ( defined($result) ) { return (1); } else { return (0); } } sub get_delivery_service_name { my $self = shift || confess("Call on an instance of Utils::Helper"); my $id = shift || confess("Please supply a delivery service ID"); my $result = $self->mojo->db->resultset("Deliveryservice")->search( { id => $id } )->single(); if ( defined($result) ) { return ( $result->xml_id ); } else { return (0); } } sub is_delivery_service_assigned { my $self = shift || confess("Call on an instance of Utils::Helper"); my $id = shift || confess("Please supply a delivery service ID"); my $user_id = $self->mojo->db->resultset('TmUser')->search( { username => $self->mojo->current_user()->{username} } )->get_column('id')->single(); my @ds_ids = (); if ( defined($user_id) ) { @ds_ids = $self->mojo->db->resultset('DeliveryserviceTmuser')->search( { tm_user_id => $user_id } )->get_column('deliveryservice')->all(); } my %ds_hash = map { $_ => 1 } @ds_ids; # no external user ID = internal; assume authenticated due to route configuration if (!defined($user_id) ) { return (1); } elsif ($user_id) { my $result = $self->mojo->db->resultset("Deliveryservice")->search( { id => $id } )->single(); if ( exists( $ds_hash{ $result->id } ) ) { return (1); } } return (0); } sub not_found { my $self = shift || confess("Call on an instance of Utils::Helper"); $self->mojo->render( status => 404, json => { message => { type => "error", content => "Resource not found" } } ); } sub forbidden { my $self = shift || confess("Call on an instance of Utils::Helper"); $self->mojo->render( status => 403, json => { message => { type => "error", content => "Forbidden" } } ); } sub error { my $self = shift || confess("Call on an instance of Utils::Helper"); $self->mojo->render( status => 500, json => { message => { type => "error", content => "Internal server error" } } ); } 1; ======================= File: traffic_ops/app/lib/API/Server2.pm ======================= package API::Server2; # # # 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. # # # use UI::Utils; use Mojo::Base 'Mojolicious::Controller'; use Data::Dumper; use POSIX qw(strftime); use Time::Local; use LWP; use UI::ConfigFiles; use UI::Tools; use MojoPlugins::Response; use MojoPlugins::Job; use Utils::Helper::ResponseHelper; use String::CamelCase qw(decamelize); sub check_server_params { my $self = shift; my $json = shift; my $update_base = shift; my %params = %{$json}; my $err = undef; my %errFields = (); # Required field checks if (!defined( $json->{'hostName'} ) ) { $errFields{'hostName'} = 'is required'; } if (!defined( $json->{'domainName'} ) ) { $errFields{'domainName'} = 'is required'; } if (!defined( $json->{'cachegroup'} ) ) { $errFields{'cachegroup'} = 'is required'; } if (!defined( $json->{'interfaceName'} ) ) { $errFields{'interfaceName'} = 'is required'; } if (!defined( $json->{'ipAddress'} ) ) { $errFields{'ipAddress'} = 'is required'; } if (!defined( $json->{'ipNetmask'} ) ) { $errFields{'ipNetmask'} = 'is required'; } if (!defined( $json->{'ipGateway'} ) ) { $errFields{'ipGateway'} = 'is required'; } if (!defined( $json->{'interfaceMtu'} ) ) { $errFields{'interfaceMtu'} = 'is required'; } if (!defined( $json->{'physLocation'} ) ) { $errFields{'physLocation'} = 'is required'; } if (!defined( $json->{'type'} ) ) { $errFields{'type'} = 'is required'; } if (!defined( $json->{'profile'} ) ) { $errFields{'profile'} = 'is required'; } if (!defined( $json->{'cdnName'} ) ) { $errFields{'cdnName'} = 'is required'; } if (%errFields) { return ( \%params, \%errFields ); } # Valid value checks if ( defined( $json->{'interfaceMtu'} ) ) { if ( $json->{'interfaceMtu'}!= '1500' && $json->{'interfaceMtu'}!= '9000' ) { return ( \%params, "'interfaceMtu' '$json->{'interfaceMtu'}' not equal to 1500 or 9000!" ); } } if ( defined( $json->{'tcpPort'} ) ) { $params{'tcpPort'} = int( $json->{'tcpPort'} ); } elsif (!defined($update_base) ) { $params{'tcpPort'} = 80; } if ( defined( $json->{'httpsPort'} ) ) { $params{'httpsPort'} = int( $json->{'httpsPort'} ); } elsif (!defined($update_base) ) { $params{'httpsPort'} = 443; } eval { $params{'cachegroup'} = $self->db->resultset('Cachegroup')->search( { name => $json->{'cachegroup'} } )->get_column('id')->single(); }; if ( $@ || (!defined( $params{'cachegroup'} ) ) ) { # $@ holds Perl errors return ( \%params, "'cachegroup' $json->{'cachegroup'} not found!" ); } eval { $params{'cdnId'} = $self->db->resultset('Cdn')->search( { name => $json->{'cdnName'} } )->get_column('id')->single(); }; eval { $params{'type'} = &type_id( $self, $json->{'type'} ); }; if ( $@ || (!defined( $params{'type'} ) ) ) { # $@ holds Perl errors return ( \%params, "'type' $json->{'type'} not found!" ); } if ( defined( $json->{'status'} ) ) { eval { $params{'status'} = &admin_status_id( $self, $json->{'status'} ); }; if ( $@ || (!defined( $params{'status'} ) ) ) { return ( \%params, "'status' $json->{'status'} not found!" ); } } eval { $params{'profile'} = &profile_id( $self, $json->{'profile'} ); }; if ( $@ || (!defined( $params{'profile'} ) ) ) { # $@ holds Perl errors return ( \%params, "'profile' $json->{'profile'} not found!" ); } eval { $params{'physLocation'} = $self->db->resultset('PhysLocation')->search( { name => $json->{'physLocation'} } )->get_column('id')->single(); }; if ( $@ || (!defined( $params{'physLocation'} ) ) ) { # $@ holds Perl errors return ( \%params, "'physLocation' $json->{'physLocation'} not found!" ); } # IP address checks foreach my $ipstr ( $json->{'ipAddress'}, $json->{'ipNetmask'}, $json->{'ipGateway'}, $json->{'iloIpAddress'}, $json->{'iloIpNetmask'}, $json->{'iloIpGateway'}, $json->{'mgmtIpAddress'}, $json->{'mgmtIpNetmask'}, $json->{'mgmtIpGateway'} ) { if (!defined($ipstr) || $ipstr eq "" ) { next; } # already checked for mandatory. if (!&is_ipaddress($ipstr) ) { return ( \%params, $ipstr. " is not a valid IPv4 address or netmask" ); } } if ( defined( $json->{'ip6Address'} ) && $json->{'ip6Address'} ne "" &&!&is_ip6address( $json->{'ip6Address'} ) ) { return ( \%params, "Address ". $json->{'ip6Address'}. " is not a valid IPv6 address " ); } if ( defined( $json->{'ip6Gateway'} ) && $json->{'ip6Gateway'} ne "" &&!&is_ip6address( $json->{'ip6Gateway'} ) ) { return ( \%params, "Address ". $json->{'ip6Address'}. " is not a valid IPv6 address " ); } my $ip_used = $self->db->resultset('Server')->search( { -and => [ 'me.ip_address' => $json->{'ipAddress'}, 'profile.name' => $json->{'profile'}, 'me.id' => { '!=' => ( defined($update_base) )? $update_base->id : 0 } ] }, { join => ['profile'] } )->single(); if ($ip_used) { return ( \%params, $json->{'ipAddress'}. " is already being used by a server with the same profile" ); } if ( defined( $json->{'ip6Address'} ) && $json->{'ip6Address'} ne "" ) { my $ip6_used = $self->db->resultset('Server')->search( { -and => [ 'me.ip6_address' => $json->{'ip6Address'}, 'profile.name' => $json->{'profile'}, 'me.id' => { '!=' => ( defined($update_base) )? $update_base->id : 0 } ] }, { join => ['profile'] } )->single(); if ($ip6_used) { return ( \%params, $json->{'ip6Address'}. " is already being used by a server with the same profile" ); } } # Netmask checks if ( defined( $json->{'ipNetmask'} ) && $json->{'mgmtIpNetmask'} ne "" &&!&is_netmask( $json->{'ipNetmask'} ) ) { return ( \%params, $json->{'ipNetmask'}. " is not a valid netmask" ); } if ( defined( $json->{'iloIpNetmask'} ) && $json->{'iloIpNetmask'} ne "" &&!&is_netmask( $json->{'iloIpNetmask'} ) ) { return ( \%params, $json->{'iloIpNetmask'}. " is not a valid netmask" ); } if ( defined( $json->{'mgmtIpNetmask'} ) && $json->{'mgmtIpNetmask'} ne "" &&!&is_netmask( $json->{'mgmtIpNetmask'} ) ) { return ( \%params, $json->{'mgmtIpNetmask'}. " is not a valid netmask" ); } if ( ( defined( $json->{'ip6Address'} ) && $json->{'ip6Address'} ne "" ) || ( defined( $json->{'ip6Gateway'} ) && $json->{'ip6Gateway'} ne "" ) ) { if ( defined($update_base) ) { if (!defined( $json->{'ip6Address'} ) ) { $json->{'ip6Address'} = $update_base->{'ip6_address'}; } if (!defined( $json->{'ip6Gateway'} ) ) { $json->{'ip6Gateway'} = $update_base->{'ip6_gateway'}; } } } my $ipstr1; my $ipstr2; if ( ( defined( $json->{'ipAddress'} ) && $json->{'ipAddress'} ne "" ) || ( defined( $json->{'ipNetmask'} ) && $json->{'ipNetmask'} ne "" ) || ( defined( $json->{'ipGateway'} ) && $json->{'ipGateway'} ne "" ) ) { if (!defined( $json->{'ipAddress'} ) ) { return ( \%params, "ipAddress is not found" ); } $ipstr1 = $json->{'ipAddress'}. "/". $json->{'ipNetmask'}; $ipstr2 = $json->{'ipGateway'}. "/". $json->{'ipNetmask'}; if ( defined( $json->{'ipNetmask'} ) && $json->{'ipNetmask'} ne "" &&!&in_same_net( $ipstr1, $ipstr2 ) ) { return ( \%params, $json->{'ipAddress'}. " and ". $json->{'ipGateway'}. " are not in same network" ); } } if ( ( defined( $json->{'iloIpAddress'} ) && $json->{'iloIpAddress'} ne "" ) || ( defined( $json->{'iloIpNetmask'} ) && $json->{'iloIpNetmask'} ne "" ) || ( defined( $json->{'iloIpGateway'} ) && $json->{'iloIpGateway'} ne "" ) ) { if ( defined($update_base) ) { if (!defined( $json->{'iloIpAddress'} ) ) { $json->{'iloIpAddress'} = $update_base->ilo_ip_address; } if (!defined( $json->{'iloIpNetmask'} ) ) { $json->{'iloIpNetmask'} = $update_base->ilo_ip_netmask; } if (!defined( $json->{'iloIpGateway'} ) ) { $json->{'iloIpGateway'} = $update_base->ilo_ip_gateway; } } $ipstr1 = $json->{'iloIpAddress'}. "/". $json->{'iloIpNetmask'}; $ipstr2 = $json->{'iloIpGateway'}. "/". $json->{'iloIpNetmask'}; if ( $json->{'iloIpGateway'} ne "" &&!&in_same_net( $ipstr1, $ipstr2 ) ) { return ( \%params, $json->{'iloIpAddress'}. " and ". $json->{'iloIpGateway'}. " are not in same network" ); } } if ( ( defined( $json->{'mgmtIpAddress'} ) && $json->{'mgmtIpAddress'} ne "" ) || ( defined( $json->{'mgmtIpNetmask'} ) && $json->{'mgmtIpNetmask'} ne "" ) || ( defined( $json->{'mgmtIpGateway'} ) && $json->{'mgmtIpGateway'} ne "" ) ) { if ( defined($update_base) ) { if (!defined( $json->{'mgmtIpAddress'} ) ) { $json->{'mgmtIpAddress'} = $update_base->mgmt_ip_address; } if (!defined( $json->{'mgmtIpNetmask'} ) ) { $json->{'mgmtIpNetmask'} = $update_base->mgmt_ip_netmask; } if (!defined( $json->{'mgmtIpGateway'} ) ) { $json->{'mgmtIpGateway'} = $update_base->mgmt_ip_gateway; } } $ipstr1 = $json->{'mgmtIpAddress'}. "/". $json->{'mgmtIpNetmask'}; $ipstr2 = $json->{'mgmtIpGateway'}. "/". $json->{'mgmtIpNetmask'}; if ( $json->{'mgmtIpGateway'} ne "" &&!&in_same_net( $ipstr1, $ipstr2 ) ) { return ( \%params, $json->{'mgmtIpAddress'}. " and ". $json->{'mgmtIpGateway'}. " are not in same network" ); } } if ( defined( $json->{'tcpPort'} ) && $json->{'tcpPort'}!~ /\d+/ ) { return ( \%params, $json->{'tcpPort'}. " is not a valid tcp port" ); } if ( defined( $json->{'httpsPort'} ) && $json->{'httpsPort'}!~ /\d+/ ) { return ( \%params, $json->{'httpsPort'}. " is not a valid https port" ); } return ( \%params, $err ); } sub get_server_by_id { my $self = shift; my $id = shift; my $row; my $isadmin = &is_admin($self); eval { $row = $self->db->resultset('Server')->find( { id => $id } ); }; if ($@) { # $@ holds Perl errors $self->app->log->error("Failed to get server id = $id: $@"); return ( undef, "Failed to get server id = $id: $@" ); } my $data = { "id" => $row->id, "hostName" => $row->host_name, "domainName" => $row->domain_name, "tcpPort" => $row->tcp_port, "httpsPort" => $row->https_port, "xmppId" => $row->xmpp_id, "xmppPasswd" => "**********", "interfaceName" => $row->interface_name, "ipAddress" => $row->ip_address, "ipNetmask" => $row->ip_netmask, "ipGateway" => $row->ip_gateway, "ip6Address" => $row->ip6_address, "ip6Gateway" => $row->ip6_gateway, "interfaceMtu" => $row->interface_mtu, "cachegroup" => $row->cachegroup->name, "cdn_id" => $row->cdn_id, "physLocation" => $row->phys_location->name, "guid" => $row->guid, "rack" => $row->rack, "type" => $row->type->name, "status" => $row->status->name, "offline_reason" => $row->offline_reason, "profile" => $row->profile->name, "profileDesc" => $row->profile->description, "mgmtIpAddress" => $row->mgmt_ip_address, "mgmtIpNetmask" => $row->mgmt_ip_netmask, "mgmtIpGateway" => $row->mgmt_ip_gateway, "iloIpAddress" => $row->ilo_ip_address, "iloIpNetmask" => $row->ilo_ip_netmask, "iloIpGateway" => $row->ilo_ip_gateway, "iloUsername" => $row->ilo_username, "iloPassword" => $isadmin? $row->ilo_password : "********", "routerHostName" => $row->router_host_name, "routerPortName" => $row->router_port_name, "lastUpdated" => $row->last_updated, }; return ( $data, undef ); } sub create { my ( $params, $data, $err ) = ( undef, undef, undef ); my $self = shift; my $json = $self->req->json; if (!&is_oper($self) ) { return $self->forbidden("Forbidden. You must have the operations role to perform this operation."); } ( $params, $err ) = $self->check_server_params( $json, undef ); if ( defined($err) ) { return $self->alert($err); } my $new_id = -1; my $xmpp_passwd = "<PASSWORD>"; my $insert; if ( defined( $json->{'ip6Address'} ) && $json->{'ip6Address'} ne "" ) { eval { $insert = $self->db->resultset('Server')->create( { host_name => $json->{'hostName'}, domain_name => $json->{'domainName'}, tcp_port => $params->{'tcpPort'}, https_port => $params->{'httpsPort'}, xmpp_id => $json->{'hostName'}, # TODO JvD remove me later. xmpp_passwd => $<PASSWORD>, interface_name => $json->{'interfaceName'}, ip_address => $json->{'ipAddress'}, ip_netmask => $json->{'ipNetmask'}, ip_gateway => $json->{'ipGateway'}, ip6_address => $json->{'ip6Address'}, ip6_gateway => $json->{'ip6Gateway'}, interface_mtu => $json->{'interfaceMtu'}, cachegroup => $params->{'cachegroup'}, cdn_id => $params->{'cdnId'}, phys_location => $params->{'physLocation'}, guid => $json->{'guid'}, rack => $json->{'rack'}, type => $params->{'type'}, status => &admin_status_id( $self, $json->{'type'} eq "EDGE"? "REPORTED" : "ONLINE" ), offline_reason => $json->{'offline_reason'}, profile => $params->{'profile'}, mgmt_ip_address => $json->{'mgmtIpAddress'}, mgmt_ip_netmask => $json->{'mgmtIpNetmask'}, mgmt_ip_gateway => $json->{'mgmtIpGateway'}, ilo_ip_address => $json->{'iloIpAddress'}, ilo_ip_netmask => $json->{'iloIpNetmask'}, ilo_ip_gateway => $json->{'iloIpGateway'}, ilo_username => $json->{'iloUsername'}, ilo_password => $json->{'<PASSWORD>'}, router_host_name => $json->{'routerHostName'}, router_port_name => $json->{'routerPortName'}, } ); }; if ($@) { # $@ holds Perl errors $self->app->log->error("Failed to create server: $@"); return $self->alert( { Error => "Failed to create server: $@" } ); } } else { eval { $insert = $self->db->resultset('Server')->create( { host_name => $json->{'hostName'}, domain_name => $json->{'domainName'}, tcp_port => $params->{'tcpPort'}, https_port => $params->{'httpsPort'}, xmpp_id => $json->{'hostName'}, # TODO JvD remove me later. xmpp_passwd => <PASSWORD>, interface_name => $json->{'interfaceName'}, ip_address => $json->{'ipAddress'}, ip_netmask => $json->{'ipNetmask'}, ip_gateway => $json->{'ipGateway'}, interface_mtu => $json->{'interfaceMtu'}, cachegroup => $params->{'cachegroup'}, cdn_id => $params->{'cdnId'}, phys_location => $params->{'physLocation'}, guid => $json->{'guid'}, rack => $json->{'rack'}, type => $params->{'type'}, status => &admin_status_id( $self, $json->{'type'} eq "EDGE"? "REPORTED" : "ONLINE" ), offline_reason => $json->{'offline_reason'}, profile => $params->{'profile'}, mgmt_ip_address => $json->{'mgmtIpAddress'}, mgmt_ip_netmask => $json->{'mgmtIpNetmask'}, mgmt_ip_gateway => $json->{'mgmtIpGateway'}, ilo_ip_address => $json->{'iloIpAddress'}, ilo_ip_netmask => $json->{'iloIpNetmask'}, ilo_ip_gateway => $json->{'iloIpGateway'}, ilo_username => $json->{'iloUsername'}, ilo_password => $json->{'<PASSWORD>'}, router_host_name => $json->{'routerHostName'}, router_port_name => $json->{'routerPortName'}, } ); }; if ($@) { # $@ holds Perl errors $self->app->log->error("Failed to create server: $@"); return $self->alert( { Error => "Failed to create server: $@" } ); } } $insert->insert(); $new_id = $insert->id; if ( $json->{'type'} eq "EDGE" || $json->{'type'} eq "MID" ) { $insert = $self->db->resultset('Servercheck')->create( { server => $new_id, } ); $insert->insert(); } # if the insert has failed, we don't even get here, we go to the exception page. &log( $self, "Create server with hostname:". $json->{'hostName'}, "APICHANGE" ); ( $data, $err ) = $self->get_server_by_id($new_id); if ( defined($err) ) { return $self->alert( { Error => $err } ); } $self->success( $data, "Server successfully created: ". $json->{'hostName'} ); } sub update { my ( $params, $data, $err ) = ( undef, undef, undef ); my $self = shift; my $json = $self->req->json; if (!&is_oper($self) ) { return $self->forbidden("Forbidden. You must have the operations role to perform this operation."); } my $id = $self->param('id'); # get resultset for original and one to be updated. Use to examine diffs to propagate the effects of the change. my $org_server = $self->db->resultset('Server')->find( { id => $id } ); if (!defined($org_server) ) { return $self->not_found(); } ( $params, $err ) = $self->check_server_params( $json, $org_server ); if ( defined($err) ) { return $self->alert($err); } my $update = $self->db->resultset('Server')->find( { id => $id } ); eval { $update->update( { host_name => defined( $params->{'hostName'} ) ? $params->{'hostName'} : $update->host_name, domain_name => defined( $params->{'domainName'} ) ? $params->{'domainName'} : $update->domain_name, tcp_port => defined( $params->{'tcpPort'} ) ? $params->{'tcpPort'} : $update->tcp_port, https_port => defined( $params->{'httpsPort'} ) ? $params->{'httpsPort'} : $update->https_port, interface_name => defined( $params->{'interfaceName'} )? $params->{'interfaceName'} : $update->interface_name, ip_address => defined( $params->{'ipAddress'} ) ? $params->{'ipAddress'} : $update->ip_address, ip_netmask => defined( $params->{'ipNetmask'} ) ? $params->{'ipNetmask'} : $update->ip_netmask, ip_gateway => defined( $params->{'ipGateway'} ) ? $params->{'ipGateway'} : $update->ip_gateway, ip6_address => defined( $params->{'ip6Address'} ) && $params->{'ip6Address'}!= ""? $params->{'ip6Address'} : $update->ip6_address, ip6_gateway => defined( $params->{'ip6Gateway'} ) ? $params->{'ip6Gateway'} : $update->ip6_gateway, interface_mtu => defined( $params->{'interfaceMtu'} ) ? $params->{'interfaceMtu'} : $update->interface_mtu, cachegroup => defined( $params->{'cachegroup'} ) ? $params->{'cachegroup'} : $update->cachegroup->id, cdn_id => defined( $params->{'cdnId'} ) ? $params->{'cdnId'} : $update->cdn_id, phys_location => defined( $params->{'physLocation'} ) ? $params->{'physLocation'} : $update->phys_location->id, guid => defined( $params->{'guid'} ) ? $params->{'guid'} : $update->guid, rack => defined( $params->{'rack'} ) ? $params->{'rack'} : $update->rack, type => defined( $params->{'type'} ) ? $params->{'type'} : $update->type->id, status => defined( $params->{'status'} ) ? $params->{'status'} : $update->status->id, offline_reason => defined( $params->{'offline_reason'} )? $params->{'offline_reason'} : $update->offline_reason, profile => defined( $params->{'profile'} ) ? $params->{'profile'} : $update->profile->id, mgmt_ip_address => defined( $params->{'mgmtIpAddress'} ) ? $params->{'mgmtIpAddress'} : $update->mgmt_ip_address, mgmt_ip_netmask => defined( $params->{'mgmtIpNetmask'} ) ? $params->{'mgmtIpNetmask'} : $update->mgmt_ip_netmask, mgmt_ip_gateway => defined( $params->{'mgmtIpGateway'} ) ? $params->{'mgmtIpGateway'} : $update->mgmt_ip_gateway, ilo_ip_address => defined( $params->{'iloIpAddress'} ) ? $params->{'iloIpAddress'} : $update->ilo_ip_address, ilo_ip_netmask => defined( $params->{'iloIpNetmask'} ) ? $params->{'iloIpNetmask'} : $update->ilo_ip_netmask, ilo_ip_gateway => defined( $params->{'iloIpGateway'} ) ? $params->{'iloIpGateway'} : $update->ilo_ip_gateway, ilo_username => defined( $params->{'iloUsername'} ) ? $params->{'iloUsername'} : $update->ilo_username, ilo_password => defined( $params->{'iloPassword'} ) ? $params->{'iloPassword'} : $update->ilo_password, router_host_name => defined( $params->{'routerHostName'} )? $params->{'routerHostName'} : $update->router_host_name, router_port_name => defined( $params->{'routerPortName'} )? $params->{'routerPortName'} : $update->router_port_name, } ); }; if ($@) { # $@ holds Perl errors $self->app->log->error("Failed to update server id = $id: $@"); return $self->alert( { Error => "Failed to update server: $@" } ); } $update->update(); if ( $org_server->profile->id!= $update->profile->id ) { my $param = $self->db->resultset('ProfileParameter') ->search( { -and => [ profile => $org_server->profile->id, 'parameter.config_file' => 'rascal-config.txt', 'parameter.name' => 'CDN_name' ] }, { prefetch => [ { parameter => undef }, { profile => undef } ] } )->single(); my $org_cdn_name = ""; if ( defined($param) ) { $org_cdn_name = $param->parameter->value; } $param = $self->db->resultset('ProfileParameter') ->search( { -and => [ profile => $update->profile->id, 'parameter.config_file' => 'rascal-config.txt', 'parameter.name' => 'CDN_name' ] }, { prefetch => [ { parameter => undef }, { profile => undef } ] } )->single(); my $upd_cdn_name = ""; if ( defined($param) ) { $upd_cdn_name = $param->parameter->value; } if ( $upd_cdn_name ne $org_cdn_name ) { my $delete = $self->db->resultset('DeliveryserviceServer')->search( { server => $id } ); $delete->delete(); &log( $self, $update->host_name. " profile change assigns server to new CDN - deleting all DS assignments", "APICHANGE" ); } if ( $org_server->type->id!= $update->type->id ) { my $delete = $self->db->resultset('DeliveryserviceServer')->search( { server => $id } ); $delete->delete(); &log( $self, $update->host_name. " profile change changes cache type - deleting all DS assignments", "APICHANGE" ); } } if ( $org_server->type->id!= $update->type->id ) { # server type changed: servercheck entry required for EDGE and MID, but not others. Add or remove servercheck entry accordingly my %need_servercheck = map { &type_id( $self, $_ ) => 1 } qw{ EDGE MID }; my $newtype_id = $update->type->id; my $servercheck = $self->db->resultset('Servercheck')->search( { server => $id } ); if ( $servercheck!= 0 &&!$need_servercheck{$newtype_id} ) { # servercheck entry found but not needed -- delete it $servercheck->delete(); &log( $self, $update->host_name. " cache type change - deleting servercheck", "APICHANGE" ); } elsif ( $servercheck == 0 && $need_servercheck{$newtype_id} ) { # servercheck entry not found but needed -- insert it $servercheck = $self->db->resultset('Servercheck')->create( { server => $id } ); $servercheck->insert(); &log( $self, $update->host_name. " cache type changed - adding servercheck", "APICHANGE" ); } } # this just creates the log string for the log table / tab. my $lstring = "Update server ". $update->host_name. " "; foreach my $col ( keys %{ $org_server->{_column_data} } ) { my $colParam = $col; $colParam =~ s/_(\w)/\U$1/g; if ( defined( $params->{$colParam} ) && $params->{$colParam} ne ( $org_server->{_column_data}->{$col} // "" ) ) { if ( $col eq 'ilo_password' || $col eq 'xmpp_passwd' ) { $lstring.= $col. "-> ***********"; } else { $lstring.= $col. "->". $params->{$colParam}. " "; } } } # if the update has failed, we don't even get here, we go to the exception page. &log( $self, $lstring, "APICHANGE" ); ( $data, $err ) = $self->get_server_by_id($id); if ( defined($err) ) { return $self->alert( { Error => $err } ); } $self->success( $data, "Server was updated: ". $update->host_name ); } 1; ======================= File: traffic_ops/app/t/api/1.2/server.t ======================= package main; # # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use Mojo::Base -strict; use Test::More; use Test::Mojo; use DBI; use JSON; use strict; use warnings; no warnings 'once'; use warnings 'all'; use Test::TestHelper; use Data::Dumper; #no_transactions=>1 ==> keep fixtures after every execution, beware of duplicate data! #no_transactions=>0 ==> delete fixtures after every execution BEGIN { $ENV{MOJO_MODE} = "test" } my $schema = Schema->connect_to_database; my $dbh = Schema->database_handle; my $t = Test::Mojo->new('TrafficOps'); Test::TestHelper->unload_core_data($schema); Test::TestHelper->load_core_data($schema); ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) ->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?'; ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => { "name" => "cg2-mid-northwest", "shortName" => "cg2_mid", "latitude" => "12", "longitude" => "56", "parentCachegroup" => "", "secondaryParentCachegroup" => "", "typeName" => "MID_LOC" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "cg2-mid-northwest" ) ->json_is( "/response/shortName" => "cg2_mid") ->json_is( "/response/latitude" => "12") ->json_is( "/response/longitude" => "56") ->json_is( "/response/parentCachegroup" => "") ->json_is( "/response/secondaryParentCachegroup" => "") , 'Does the cache group details return?'; ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => { "name" => "cg-mid-northeast", "shortName" => "mneg", "latitude" => "10", "longitude" => "40", "parentCachegroup" => "", "secondaryParentCachegroup" => "", "typeName" => "MID_LOC" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "cg-mid-northeast" ) ->json_is( "/response/shortName" => "mneg") ->json_is( "/response/latitude" => "10") ->json_is( "/response/longitude" => "40") ->json_is( "/response/parentCachegroup" => "") ->json_is( "/response/secondaryParentCachegroup" => "") , 'Does the cache group details return?'; ok $t->get_ok('/api/1.2/servers?type=MID')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/hostName", "atlanta-mid-01" ) ->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" ) ->json_is( "/response/0/type", "MID" ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->get_ok('/api/1.2/servers?cdn=100')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/hostName", "atlanta-edge-01" ) ->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" ) ->json_is( "/response/0/cdnId", 100 ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->get_ok('/api/1.2/servers?cachegroup=200')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/hostName", "atlanta-mid-02" ) ->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" ) ->json_is( "/response/0/cachegroupId", 200 ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->get_ok('/api/1.2/servers?type=MID&status=ONLINE')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/hostName", "atlanta-mid-01" ) ->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" ) ->json_is( "/response/0/type", "MID" ) ->json_is( "/response/0/status", "ONLINE" ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => { "name" => "edge_atl_group1", "shortName" => "eag1", "latitude" => "22", "longitude" => "55", "parentCachegroup" => "", "secondaryParentCachegroup" => "", "typeName" => "MID_LOC" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "edge_atl_group1" ) ->json_is( "/response/shortName" => "eag1") ->json_is( "/response/latitude" => "22") ->json_is( "/response/longitude" => "55") ->json_is( "/response/parentCachegroup" => "") ->json_is( "/response/secondaryParentCachegroup" => "") , 'Does the cache group details return?'; ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { "hostName" => "server1", "domainName" => "example-domain.com", "cachegroup" => "cg2-mid-northwest", "cdnName" => "cdn1", "ipAddress" => "10.74.27.194", "interfaceName" => "bond0", "ipNetmask" => "255.255.255.252", "ipGateway" => "10.74.27.194", "interfaceMtu" => "1500", "physLocation" => "Denver", "type" => "EDGE", "profile" => "EDGE1" }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Is a server created when all required fields are provided?'; ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { "hostName" => "server2", "domainName" => "example-domain.com", "cachegroup" => "cg2-mid-northwest", "cdnName" => "cdn1", "ipAddress" => "10.74.27.194", "interfaceName" => "bond0", "ipNetmask" => "255.255.255.252", "ipGateway" => "10.74.27.194", "interfaceMtu" => "1500", "physLocation" => "Denver", "type" => "EDGE", "profile" => "EDGE1" }) ->status_is(400) , 'Does the server creation fail because ip address is already used for the profile?'; ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { "hostName" => "server3", "domainName" => "example-domain.com", "cachegroup" => "cg2-mid-northwest", "cdnName" => "cdn1", "ipAddress" => "10.74.27.85", "interfaceName" => "bond0", "ipNetmask" => "255.255.255.252", "ipGateway" => "10.74.27.85", "ip6Address" => "2fc00:e968:6179::de52:7100/64", "ip6Gateway" => "fdf8:f53e:61e4::18", "interfaceMtu" => "1500", "physLocation" => "Denver", "type" => "EDGE", "profile" => "EDGE1" }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Is a server created when all required fields are provided plus an ip6 address?'; ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { "hostName" => "server3", "domainName" => "example-domain.com", "cachegroup" => "cg2-mid-northwest", "cdnName" => "cdn1", "ipAddress" => "10.74.27.77", "interfaceName" => "bond0", "ipNetmask" => "255.255.255.252", "ipGateway" => "10.74.27.77", "ip6Address" => "fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b/64", "ip6Gateway" => "fdf8:f53e:61e4::18", "interfaceMtu" => "1500", "physLocation" => "Denver", "type" => "EDGE", "profile" => "EDGE1" }) ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the server creation fail because ip6 address is already used for the profile?'; ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { "hostName" => "tc1_ats1", "domainName" => "northbound.com", "cachegroup" => "mid-northeast-group", "cdnName" => "cdn1", "interfaceName" => "eth0", "ipAddress" => "10.74.27.184", "ipNetmask" => "255.255.255.0", "ipGateway" => "10.74.27.1", "interfaceMtu" => "1500", "physLocation" => "HotAtlanta", "type" => "MID", "profile" => "MID1" }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/hostName" => "tc1_ats1") ->json_is( "/response/domainName" => "northbound.com") ->json_is( "/response/cachegroup" => "mid-northeast-group") ->json_is( "/response/ipNetmask" => "255.255.255.0") ->json_is( "/response/interfaceName" => "eth0") ->json_is( "/response/ipAddress" => "10.74.27.184") ->json_is( "/response/ipGateway" => "10.74.27.1") ->json_is( "/response/interfaceMtu" => "1500") ->json_is( "/response/physLocation" => "HotAtlanta") ->json_is( "/response/type" => "MID") ->json_is( "/response/profile" => "MID1") , 'Does the server details return?'; ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { "hostName" => "tc1_ats1", "domainName" => "northbound.com", "cachegroup" => "edge_atl_group", "cdnName" => "cdn1", "interfaceName" => "eth0", "ipAddress" => "10.74.27.185", "ipNetmask" => "255.255.255.0", "ipGateway" => "10.74.27.1", "interfaceMtu" => "1500", "physLocation" => "HotAtlanta", "type" => "EDGE", "profile" => "EDGE1" }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/hostName" => "tc1_ats1") ->json_is( "/response/domainName" => "northbound.com") ->json_is( "/response/cachegroup" => "edge_atl_group") ->json_is( "/response/ipNetmask" => "255.255.255.0") ->json_is( "/response/interfaceName" => "eth0") ->json_is( "/response/ipAddress" => "10.74.27.185") ->json_is( "/response/ipGateway" => "10.74.27.1") ->json_is( "/response/interfaceMtu" => "1500") ->json_is( "/response/physLocation" => "HotAtlanta") ->json_is( "/response/type" => "EDGE") ->json_is( "/response/profile" => "EDGE1") , 'Does the server details return?'; ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { "hostName" => "tc1_ats2", "domainName" => "northbound.com", "cachegroup" => "edge_atl_group", "cdnName" => "cdn1", "interfaceName" => "eth0", "ipAddress" => "10.74.27.187", "ipNetmask" => "255.255.255.0", "ipGateway" => "10.74.27.1", "interfaceMtu" => "1500", "physLocation" => "HotAtlanta", "type" => "EDGE", "profile" => "EDGE1" }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/hostName" => "tc1_ats2") ->json_is( "/response/domainName" => "northbound.com") ->json_is( "/response/cachegroup" => "edge_atl_group") ->json_is( "/response/ipNetmask" => "255.255.255.0") ->json_is( "/response/interfaceName" => "eth0") ->json_is( "/response/ipAddress" => "10.74.27.187") ->json_is( "/response/ipGateway" => "10.74.27.1") ->json_is( "/response/interfaceMtu" => "1500") ->json_is( "/response/physLocation" => "HotAtlanta") ->json_is( "/response/type" => "EDGE") ->json_is( "/response/profile" => "EDGE1") , 'Does the server details return?'; ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => { "hostName" => "tc2_ats2", "domainName" => "northbound.com", "cachegroup" => "edge_atl_group", "cdnName" => "cdn1", "interfaceName" => "eth0", "ipAddress" => "10.73.27.187", "ipNetmask" => "255.255.255.0", "ipGateway" => "10.73.27.1", "interfaceMtu" => "1500", "physLocation" => "HotAtlanta", "type" => "MID", "profile" => "MID1" }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/hostName" => "tc2_ats2") ->json_is( "/response/domainName" => "northbound.com") ->json_is( "/response/cachegroup" => "edge_atl_group") ->json_is( "/response/ipNetmask" => "255.255.255.0") ->json_is( "/response/interfaceName" => "eth0") ->json_is( "/response/ipAddress" => "10.73.27.187") ->json_is( "/response/ipGateway" => "10.73.27.1") ->json_is( "/response/interfaceMtu" => "1500") ->json_is( "/response/physLocation" => "HotAtlanta") ->json_is( "/response/type" => "MID") ->json_is( "/response/profile" => "MID1") , 'Does the server details return?'; ok $t->post_ok('/api/1.2/deliveryservices/test-ds1/servers' => {Accept => 'application/json'} => json => { "serverNames" => ['server1','server3' ]}) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Assign the server to the delivery service?'; ok $t->get_ok('/api/1.2/servers/details.json?hostName=server1')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/ipGateway", "10.74.27.194" )->json_is( "/response/0/deliveryservices/0", "100" ), 'Does the hostname details return?'; ok $t->get_ok('/api/1.2/servers/details')->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Does the validation error occur?'; ok $t->get_ok('/api/1.2/servers/details.json?orderby=hostName')->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Does the orderby work?'; ok $t->get_ok('/api/1.2/servers?type=MID')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/type", "MID" ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->post_ok('/api/1.2/deliveryservices/test-ds5/servers' => {Accept => 'application/json'} => json => { "serverNames" => [ 'tc1_ats1' ]}) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Assign the server to the delivery service?'; ok $t->post_ok('/api/1.2/deliveryservices/test-ds4/servers' => {Accept => 'application/json'} => json => { "serverNames" => [ 'tc1_ats2', 'tc2_ats2' ]}) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Assign the server to the delivery service?'; # BUG: last one in wins ok $t->post_ok('/api/1.2/deliveryservices/test-ds4/servers' => {Accept => 'application/json'} => json => { "serverNames" => [ 'tc1_ats2', 'tc2_ats2' ]}) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Assign the server to the delivery service?'; ok $t->get_ok('/api/1.2/servers?type=MID&status=ONLINE')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/type", "MID" ) ->json_is( "/response/0/status", "ONLINE" ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); # Count the'response number' my $count_response = sub { my ( $t, $count ) = @_; my $json = decode_json( $t->tx->res->content->asset->slurp ); my $r = $json->{response}; return $t->success( is( scalar(@$r), $count ) ); }; # this is a dns delivery service with 2 edges and 1 mid and since dns ds's DO employ mids, 3 servers return $t->get_ok('/api/1.2/servers?dsId=100')->status_is(200)->$count_response(2) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); # this is a http_no_cache delivery service with 2 edges and 1 mid and since http_no_cache ds's DON'T employ mids, 2 servers return $t->get_ok('/api/1.2/servers?dsId=400')->status_is(200)->$count_response(2) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); my $svr_id = &get_svr_id('tc1_ats1'); ok $t->put_ok('/api/1.2/servers/'. $svr_id. '/update' => {Accept => 'application/json'} => json => { "hostName" => "tc1_ats3", "domainName" => "northbound.com", "cachegroup" => "edge_atl_group", "cdnName" => "cdn1", "interfaceName" => "eth0", "ipAddress" => "10.74.27.186", "ipNetmask" => "255.255.255.0", "ipGateway" => "10.74.27.1", "interfaceMtu" => "1500", "physLocation" => "Denver", "type" => "EDGE", "profile" => "EDGE1" }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/hostName" => "tc1_ats3") ->json_is( "/response/domainName" => "northbound.com") ->json_is( "/response/cachegroup" => "edge_atl_group") ->json_is( "/response/ipNetmask" => "255.255.255.0") ->json_is( "/response/interfaceName" => "eth0") ->json_is( "/response/ipAddress" => "10.74.27.186") ->json_is( "/response/ipGateway" => "10.74.27.1") ->json_is( "/response/interfaceMtu" => "1500") ->json_is( "/response/physLocation" => "Denver") ->json_is( "/response/type" => "EDGE") ->json_is( "/response/profile" => "EDGE1") , 'Does the server details return?'; ok $t->put_ok('/api/1.2/servers/'. $svr_id. '/update' => {Accept => 'application/json'} => json => { "ipAddress" => "10.10.10.220", "ipGateway" => "172.16.58.3", "ipNetmask" => "255.255.255.0" }) ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the server details return?'; ok $t->put_ok('/api/1.2/servers/'. $svr_id. '/update' => {Accept => 'application/json'} => json => { "ip6Address" => "fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b", "ip6Gateway" => "fe80::1" }) ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the server details return?'; my $svr_id1 = &get_svr_id('tc1_ats3'); ok $t->post_ok('/api/1.2/servers/'. $svr_id1. '/queue_update' => {Accept => 'application/json'} =>json => { 'action' => 'queue' }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/action" => "queue") ->json_is( "/response/serverId" => "".$svr_id1) , 'Does the queue_update api return?'; ok $t->post_ok('/api/1.2/servers/9999/queue_update' => {Accept => 'application/json'} =>json => { 'action' => 'queue' }) ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the queue_update api return?'; ok $t->delete_ok('/api/1.2/servers/'. $svr_id) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/alerts/0/level", "success" ) ->json_is( "/alerts/0/text", "Server was deleted: tc1_ats3" ) , "Is the server id valid?"; ok $t->delete_ok('/api/1.2/servers/'. $svr_id) ->status_is(404)->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->put_ok('/api/1.2/servers/'. $svr_id. '/update' => {Accept => 'application/json'} => json => { "hostName" => "tc1_ats1", "domainName" => "northbound.com", "ipAddress" => "10.74.27.185", "physLocation" => "HotAtlanta" }) ->status_is(404)->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->post_ok('/api/1.2/servers' => {Accept => 'application/json'} => json => { "hostName" => "my-server-host", "domainName" => "example-domain.com", "cachegroupId" => 100, "cdnId" => 100, "ipAddress" => "10.74.27.78", "interfaceName" => "bond0", "ipNetmask" => "255.255.255.252", "ipGateway" => "10.74.27.78", "interfaceMtu" => 1500, "physLocationId" => 100, "typeId" => 1, "statusId" => 1, "updPending" => \0, "profileId" => 100 }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the server creation succeed?'; ok $t->post_ok('/api/1.2/servers' => {Accept => 'application/json'} => json => { "hostName" => "my-server-host", "domainName" => "example-domain.com", "cachegroupId" => 100, "cdnId" => 100, "ipAddress" => "10.74.27.78", "interfaceName" => "bond0", "ipNetmask" => "255.255.255.252", "ipGateway" => "10.74.27.78", "interfaceMtu" => 1500, "physLocationId" => 100, "typeId" => 1, "statusId" => 1, "updPending" => \0, "profileId" => 100 }) ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the server creation fail because ipAddress is already used by the profile?'; my $server_id =&get_svr_id('my-server-host'); ok $t->put_ok('/api/1.2/servers/'. $server_id => {Accept => 'application/json'} => json => { "hostName" => "my-server-host", "domainName" => "example-domain.com", "cachegroupId" => 200, "cdnId" => 100, "ipAddress" => "10.74.27.78", "interfaceName" => "bond0", "ipNetmask" => "255.255.255.252", "ipGateway" => "10.74.27.78", "interfaceMtu" => 1500, "physLocationId" => 100, "typeId" => 1, "statusId" => 1, "updPending" => \0, "profileId" => 100 }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the server update succeed because ipAddress is already used by the profile but...by this server?'; ok $t->post_ok('/api/1.2/servers' => {Accept => 'application/json'} => json => { "hostName" => "my-server-host-ip6", "domainName" => "example-domain.com", "cachegroupId" => 100, "cdnId" => 100, "ipAddress" => "10.74.27.79", "interfaceName" => "bond0", "ipNetmask" => "255.255.255.252", "ipGateway" => "10.74.27.79", "ip6Address" => "2fc00:e968:6179::de52:7100/64", "ip6Gateway" => "fc00:e968:6179::de52:7100", "interfaceMtu" => 1500, "physLocationId" => 100, "typeId" => 1, "statusId" => 1, "updPending" => \0, "profileId" => 100 }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the server creation succeed?'; ok $t->post_ok('/api/1.2/servers' => {Accept => 'application/json'} => json => { "hostName" => "my-server-host-ip6", "domainName" => "example-domain.com", "cachegroupId" => 100, "cdnId" => 100, "ipAddress" => "10.74.27.80", "interfaceName" => "bond0", "ipNetmask" => "255.255.255.252", "ipGateway" => "10.74.27.80", "ip6Address" => "2001:fc00:e968:6179::de52:7100/64", "ip6Gateway" => "fc00:e968:6179::de52:7100", "interfaceMtu" => 1500, "physLocationId" => 100, "typeId" => 1, "statusId" => 1, "updPending" => \0, "profileId" => 100 }) ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the server creation fail because ip6Address is already used by the profile?'; my $server_id =&get_svr_id('my-server-host-ip6'); ok $t->put_ok('/api/1.2/servers/'. $server_id => {Accept => 'application/json'} => json => { "hostName" => "my-server-host-ip6", "domainName" => "example-domain.com", "cachegroupId" => 200, "cdnId" => 100, "ipAddress" => "10.74.27.80", "interfaceName" => "bond0", "ipNetmask" => "255.255.255.252", "ipGateway" => "10.74.27.80", "ip6Address" => "fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b/64", "ip6Gateway" => "fc00:e968:6179::de52:7100", "interfaceMtu" => 1500, "physLocationId" => 100, "typeId" => 1, "statusId" => 1, "updPending" => \0, "profileId" => 100 }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) , 'Does the server update succeed because ip6Address is already used by the profile but...by this server?'; ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); $dbh->disconnect(); done_testing(); sub get_svr_id { my $host_name = shift; my $q = "select id from server where host_name = \'$host_name\'"; my $get_svr = $dbh->prepare($q); $get_svr->execute(); my $p = $get_svr->fetchall_arrayref( {} ); $get_svr->finish(); my $id = $p->[0]->{id}; return $id; } ======================= File: traffic_ops/app/lib/Fixtures/TmUser.pm ======================= package Fixtures::TmUser; # # # 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. # # # use Moose; extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; use Digest::SHA1 qw(sha1_hex); my $local_passwd = sha1_hex('password'); my %definition_for = ( admin => { new => 'TmUser', using => { id => 100, username => 'admin', tenant_id => undef, role => 4, uid => '1', gid => '1', local_passwd => <PASSWORD>, confirm_local_passwd => $<PASSWORD>, full_name => 'The <NAME>', email => '<EMAIL>', new_user => '1', address_line1 => 'address_line1', address_line2 => 'address_line2', city => 'city', state_or_province =>'state_or_province', phone_number => '111-111-1111', postal_code => '80122', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, portal => { new => 'TmUser', using => { id => 200, username => 'portal', tenant_id => undef, role => 6, uid => '1', gid => '1', local_passwd => $<PASSWORD>, confirm_local_passwd => $local_passwd, full_name => '<NAME>', email => '<EMAIL>', new_user => '1', address_line1 => 'address_line3', address_line2 => 'address_line4', city => 'city', state_or_province =>'state_or_province', phone_number => '222-222-2222', postal_code => '80122', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, codebig => { new => 'TmUser', using => { id => 300, username => 'codebig', tenant_id => undef, role => 6, uid => '1', gid => '1', local_passwd => $<PASSWORD>, confirm_local_passwd => $local_passwd, full_name => 'The <NAME>', email => '<EMAIL>', new_user => '1', address_line1 => 'address_line7', address_line2 => 'address_line8', city => 'city', state_or_province =>'state_or_province', phone_number => '444-444-4444', postal_code => '80124', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, migrations => { new => 'TmUser', using => { id => 400, username =>'migration', tenant_id => undef, role => 5, uid => '1', gid => '1', local_passwd => $<PASSWORD>, confirm_local_passwd => $local_passwd, full_name => 'The <NAME>', email => '<EMAIL>', new_user => '1', address_line1 => 'address_line1', address_line2 => 'address_line2', city => 'city', state_or_province =>'state_or_province', phone_number => '111-111-1111', postal_code => '80122', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, federation => { new => 'TmUser', using => { id => 500, username => 'federation', tenant_id => undef, role => 7, uid => '1', gid => '1', local_passwd => $local_passwd, confirm_local_passwd => $local_passwd, full_name => 'The federations User', email => '<EMAIL>', new_user => '1', address_line1 => 'address_line1', address_line2 => 'address_line2', city => 'city', state_or_province =>'state_or_province', phone_number => '333-333-3333', postal_code => '80123', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, steering1 => { new => 'TmUser', using => { id => 600, username =>'steering1', tenant_id => undef, role => 7, uid => '1', gid => '1', local_passwd => $<PASSWORD>, confirm_local_passwd => $local_passwd, full_name => 'The steering User 1', email => '<EMAIL>', new_user => '1', address_line1 => 'address_line1', address_line2 => 'address_line2', city => 'city', state_or_province =>'state_or_province', phone_number => '333-333-3333', postal_code => '80123', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, steering2 => { new => 'TmUser', using => { id => 700, username =>'steering2', tenant_id => undef, role => 7, uid => '1', gid => '1', local_passwd => $<PASSWORD>, confirm_local_passwd => $local_passwd, full_name => 'The steering User 2', email => '<EMAIL>', new_user => '1', address_line1 => 'address_line1', address_line2 => 'address_line2', city => 'city', state_or_province =>'state_or_province', phone_number => '333-333-3333', postal_code => '80123', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, admin_root => { new => 'TmUser', using => { id => 800, username => 'admin-root', tenant_id => 10**9, role => 4, uid => '1', gid => '1', local_passwd => <PASSWORD>, confirm_local_passwd => $local_<PASSWORD>, full_name => 'The Admin User for the "root" tenant', email => '<EMAIL>', new_user => '1', address_line1 => 'address_line1', address_line2 => 'address_line2', city => 'city', state_or_province =>'state_or_province', phone_number => '111-111-1111', postal_code => '80122', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, portal_root => { new => 'TmUser', using => { id => 900, username => 'portal-root', tenant_id => 10**9, role => 6, uid => '1', gid => '1', local_passwd => $<PASSWORD>, confirm_local_passwd => $<PASSWORD>, full_name => 'The Portal User for the "root" tenant', email => '<EMAIL>', new_user => '1', address_line1 => 'address_line3', address_line2 => 'address_line4', city => 'city', state_or_province =>'state_or_province', phone_number => '222-222-2222', postal_code => '80122', country => 'United States', token => '', registration_sent => '1999-01-01 00:00:00', }, }, ); sub get_definition { my ( $self, $name ) = @_; return $definition_for{$name}; } sub all_fixture_names { # sort by db username to guarantee insertion order return (sort { $definition_for{$a}{using}{username} cmp $definition_for{$b}{using}{username} } keys %definition_for); } __PACKAGE__->meta->make_immutable; 1; ======================= File: traffic_ops/app/lib/API/ProfileParameter.pm ======================= <filename>traffic_ops/app/lib/API/ProfileParameter.pm package API::ProfileParameter; # # # 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. # # # # JvD Note: you always want to put Utils as the first use. Sh*t don't work if it's after the Mojo lines. use UI::Utils; use Mojo::Base 'Mojolicious::Controller'; use Data::Dumper; # Read sub index { my $self = shift; my @data; my $orderby = "profile"; $orderby = $self->param('orderby') if ( defined $self->param('orderby') ); my $rs_data = $self->db->resultset("ProfileParameter")->search( undef, { prefetch => [ 'profile' ], order_by => $orderby } ); while ( my $row = $rs_data->next ) { push( @data, { "profile" => $row->profile->name, "parameter" => $row->parameter->id, "lastUpdated" => $row->last_updated, } ); } $self->success( \@data ); } sub create { my $self = shift; my $params = $self->req->json; if (!&is_oper($self) ) { return $self->forbidden(); } if (!defined($params) ) { return $self->alert("parameters must be in JSON format."); } if ( ref($params) ne 'ARRAY' ) { my @temparry; push(@temparry, $params); $params = \@temparry; } if ( scalar(@{ $params }) == 0 ) { return $self->alert("parameters array length is 0."); } $self->db->txn_begin(); foreach my $param (@{ $params }) { my $profile_exist = $self->db->resultset('Profile')->find( { id => $param->{profileId} } ); if (!defined($profile_exist) ) { $self->db->txn_rollback(); return $self->alert("profile with id: ". $param->{profileId}. " isn't existed."); } my $param_exist = $self->db->resultset('Parameter')->find( { id => $param->{parameterId} } ); if (!defined($param_exist) ) { $self->db->txn_rollback(); return $self->alert("parameter with id: ". $param->{parameterId}. " isn't existed."); } my $profile_param_exist = $self->db->resultset('ProfileParameter')->find( { parameter => $param_exist->id, profile => $profile_exist->id } ); if ( defined($profile_param_exist) ) { $self->db->txn_rollback(); return $self->alert("parameter: ". $param->{parameterId}. " already associated with profile: ". $param->{profileId}); } $self->db->resultset('ProfileParameter')->create( { parameter => $param_exist->id, profile => $profile_exist->id } )->insert(); } $self->db->txn_commit(); &log( $self, "New profile parameter associations were created.", "APICHANGE" ); my $response = $params; return $self->success($response, "Profile parameter associations were created."); } sub delete { my $self = shift; my $profile_id = $self->param('profile_id'); my $parameter_id = $self->param('parameter_id'); if (!&is_oper($self) ) { return $self->forbidden(); } my $profile = $self->db->resultset('Profile')->find( { id => $profile_id } ); if (!defined($profile) ) { return $self->not_found(); } my $parameter = $self->db->resultset('Parameter')->find( { id => $parameter_id } ); if (!defined($parameter) ) { return $self->not_found(); } my $delete = $self->db->resultset('ProfileParameter')->find( { parameter => $parameter->id, profile => $profile->id } ); if (!defined($delete) ) { return $self->alert("parameter: $parameter_id isn't associated with profile: $profile_id."); } $delete->delete(); &log( $self, "Delete profile parameter ". $profile->name. " <-> ". $parameter->name, "APICHANGE" ); return $self->success_message("Profile parameter association was deleted."); } sub create_param_for_profile_name { my $self = shift; my $json = $self->req->json; my $profileName = $self->param('name'); if (!&is_oper($self) ) { return $self->forbidden("You must be an admin or oper to perform this operation!"); } my $profile_find = $self->db->resultset('Profile')->find({ name => $profileName }); if (!defined($profile_find) ){ return $self->not_found("profile ". $profileName. " does not exist."); } #return &addex($self, $profileName, $json, $profile_find); return $self->addex($profileName, $json, $profile_find); } sub create_param_for_profile_id { my $self = shift; my $json = $self->req->json; my $profileId = $self->param('id'); if (!&is_oper($self) ) { return $self->forbidden("You must be an admin or oper to perform this operation!"); } my $profile_find = $self->db->resultset('Profile')->find({ id => $profileId }); if (!defined($profile_find) ){ return $self->not_found("profile with id ". $profileId. " does not exist."); } return $self->addex($profile_find->name, $json, $profile_find); } sub addex { my $self = shift; my $profileName = shift; my $json = shift; my $profile_find = shift; if ( ref($json) ne 'ARRAY' ) { my @temparry; push(@temparry, $json); $json = \@temparry; } if ( scalar(@{ $json }) == 0 ) { return $self->alert("parameters array length is 0."); } my @new_parameters = (); $self->db->txn_begin(); foreach my $param (@{ $json }) { if (!defined($param->{name}) ) { $self->db->txn_rollback(); return $self->alert("there is parameter name does not provide, configFile:".$param->{configFile}.", value:".$param->{value}); } if (!defined($param->{configFile}) ) { $self->db->txn_rollback(); return $self->alert("there is parameter configFile does not provide, name:".$param->{name}.", value:".$param->{value}); } if (!defined($param->{value}) ) { $self->db->txn_rollback(); return $self->alert("there is parameter value does not provide, name:".$param->{name}.", configFile:".$param->{configFile}); } if (!defined($param->{secure}) ) { $param->{secure} = 0 } else { if (($param->{secure} ne '0') && ($param->{secure} ne '1')) { $self->db->txn_rollback(); return $self->alert("secure must 0 or 1, parameter [name:".$param->{name}.", configFile:".$param->{configFile}.", value:".$param->{value}.", secure:".$param->{secure}."]"); } $param->{secure} = 0 if ($param->{secure} eq '0' ); $param->{secure} = 1 if ($param->{secure} eq '1' ); if ( $param->{secure}!= 0 &&!&is_admin($self)) { $self->db->txn_rollback(); return $self->forbidden("Parameter[name:".$param->{name}.", configFile:".$param->{configFile}.", value:".$param->{value}."] secure=1, You must be an admin to perform this operation!"); } } my $param_find = $self->db->resultset('Parameter')->find({ name => $param->{name}, config_file => $param->{configFile}, value => $param->{value}, } ) ; my $param_id = undef; if (!defined($param_find) ){ my $insert = $self->db->resultset('Parameter')->create( { name => $param->{name}, config_file => $param->{configFile}, value => $param->{value}, secure => $param->{secure} } ); $insert->insert(); $param_id = $insert->id; push(@new_parameters, { 'id' => $insert->id, 'name' => $insert->name, 'configFile' => $insert->config_file, 'value' => $insert->value, 'secure' => $insert->secure }) } else { $param_id = $param_find->id; push(@new_parameters, { 'id' => $param_find->id, 'name' => $param_find->name, 'configFile' => $param_find->config_file, 'value' => $param_find->value, 'secure' => $param_find->secure }) } my $profile_parameter_find = $self->db->resultset("ProfileParameter")->find( { profile => $profile_find->id, parameter => $param_id } ); if (!defined($profile_parameter_find) ) { my $insert = $self->db->resultset('ProfileParameter')->create( { profile => $profile_find->id, parameter => $param_id } ); $insert->insert(); } else { $self->app->log->warn("parameter [name:".$param_find->name.", configFile:".$param_find->config_file.", value:".$param_find->value."] has already assigned to profile ". $profileName); } } $self->db->txn_commit(); my $response; $response->{profileName} = $profile_find->name; $response->{profileId} = $profile_find->id; $response->{parameters} = \@new_parameters; $self->success($response, "Assign parameters successfully to profile ". $response->{profileName}); } 1; ======================= File: traffic_ops/app/lib/Fixtures/Server.pm ======================= <filename>traffic_ops/app/lib/Fixtures/Server.pm<gh_stars>0 package Fixtures::Server; # # # 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. # use Moose; extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( server_edge1 => { new => 'Server', using => { id => 100, host_name => 'atlanta-edge-01', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, xmpp_id => '<EMAIL>', xmpp_passwd => 'X', interface_name => 'bond0', ip_address => '127.0.0.1', ip_netmask => '255.255.255.252', ip_gateway => '127.0.0.1', ip6_address => 'fdf8:f53e:61e4::18/64', ip6_gateway => 'fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 1, status => 2, profile => 100, cdn_id => 100, cachegroup => 300, phys_location => 100, }, }, server_mid1 => { new => 'Server', using => { id => 200, host_name => 'atlanta-mid-01', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, xmpp_id => '<EMAIL>', xmpp_passwd => 'X', interface_name => 'bond0', ip_address => '127.0.0.2', ip_netmask => '255.255.255.252', ip_gateway => '127.0.0.2', ip6_address => 'fdf8:f53e:61e4::18/64', ip6_gateway => 'fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 2, status => 2, profile => 200, cdn_id => 100, cachegroup => 100, phys_location => 100, }, }, rascal_server => { new => 'Server', using => { id => 300, host_name => 'rascal01', domain_name => 'kabletown.net', tcp_port => 81, xmpp_id => '<EMAIL>', xmpp_passwd => 'X', interface_name => 'bond0', ip_address => '127.0.0.4', ip_netmask => '255.255.255.252', ip_gateway => '127.0.0.4', ip6_address => 'fdf8:f53e:61e4::18/64', ip6_gateway => 'fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 4, status => 2, profile => 300, cdn_id => 200, cachegroup => 100, phys_location => 100, }, }, riak_server1 => { new => 'Server', using => { id => 400, host_name => 'riak01', domain_name => 'kabletown.net', tcp_port => 8088, xmpp_id => '', xmpp_passwd => '', interface_name => 'eth1', ip_address => '127.0.0.5', ip_netmask => '255.255.252.0', ip_gateway => '127.0.0.5', ip6_address => '', ip6_gateway => '', interface_mtu => 1500, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 31, status => 2, profile => 500, cdn_id => 100, cachegroup => 100, phys_location => 100, }, }, rascal_server2 => { new => 'Server', using => { id => 500, host_name => 'rascal02', domain_name => 'kabletown.net', tcp_port => 81, xmpp_id => '<EMAIL>', xmpp_passwd => 'X', interface_name => 'bond0', ip_address => '127.0.0.6', ip_netmask => '255.255.255.252', ip_gateway => '127.0.0.6', ip6_address => 'fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b/64', ip6_gateway => 'fc00:db20:35b:7399::5', interface_mtu => 9000, rack => 'RR 119.05', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 4, status => 2, profile => 300, cdn_id => 200, cachegroup => 100, phys_location => 100, }, }, server_edge2 => { new => 'Server', using => { id => 600, host_name => 'atlanta-edge-02', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, xmpp_id => '<EMAIL>', xmpp_passwd => 'X', interface_name => 'bond0', ip_address => '127.0.0.7', ip_netmask => '255.255.255.252', ip_gateway => '127.0.0.7', ip6_address => 'fdf8:f53e:61e4::18/64', ip6_gateway => 'fdf8:f53e:61e4::18', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 1, status => 2, profile => 100, cdn_id => 100, cachegroup => 300, phys_location => 100, }, }, server_mid2 => { new => 'Server', using => { id => 700, host_name => 'atlanta-mid-02', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, xmpp_id => '<EMAIL>', xmpp_passwd => 'X', interface_name => 'bond0', ip_address => '127.0.0.8', ip_netmask => '255.255.255.252', ip_gateway => '127.0.0.8', ip6_address => 'fdf8:f53e:61e4::18/64', ip6_gateway => 'fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 2, status => 2, profile => 200, cdn_id => 200, cachegroup => 200, phys_location => 200, }, }, riak_server2 => { new => 'Server', using => { id => 800, host_name => 'riak02', domain_name => 'kabletown.net', tcp_port => 8088, xmpp_id => '', xmpp_passwd => '', interface_name => 'eth1', ip_address => '127.0.0.9', ip_netmask => '255.255.252.0', ip_gateway => '127.0.0.9', ip6_address => 'fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b/64', ip6_gateway => 'fc00:db20:35b:7399::5', interface_mtu => 1500, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 31, status => 2, profile => 500, cdn_id => 100, cachegroup => 100, phys_location => 200, }, }, influxdb_server1 => { new => 'Server', using => { id => 900, host_name => 'influxdb01', domain_name => 'kabletown.net', tcp_port => 8086, xmpp_id => '', xmpp_passwd => '', interface_name => 'eth1', ip_address => '127.0.0.10', ip_netmask => '255.255.252.0', ip_gateway => '127.0.0.10', ip6_address => '127.0.0.10', ip6_gateway => '127.0.0.10', interface_mtu => 1500, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 32, status => 2, profile => 500, cdn_id => 100, cachegroup => 100, phys_location => 300, }, }, influxdb_server2 => { new => 'Server', using => { id => 1000, host_name => 'influxdb02', domain_name => 'kabletown.net', tcp_port => 8086, xmpp_id => '', xmpp_passwd => '', interface_name => 'eth1', ip_address => '127.0.0.11', ip_netmask => '255.255.252.0', ip_gateway => '127.0.0.11', ip6_address => '127.0.0.11', ip6_gateway => '127.0.0.11', interface_mtu => 1500, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 32, status => 2, profile => 500, cdn_id => 100, cachegroup => 100, phys_location => 300, }, }, server_router => { new => 'Server', using => { id => 1100, host_name => 'atlanta-router-01', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, xmpp_id => '<EMAIL>', xmpp_passwd => 'X', interface_name => 'bond0', ip_address => '127.0.0.12', ip_netmask => '255.255.255.252', ip_gateway => '127.0.0.1', ip6_address => 'fc00:db20:35b:7399::5/64', ip6_gateway => 'fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 4, status => 2, profile => 100, cdn_id => 100, cachegroup => 300, phys_location => 100, }, }, server_edge_reported => { new => 'Server', using => { id => 1200, host_name => 'atlanta-edge-03', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, xmpp_id => '<EMAIL>', xmpp_passwd => 'X', interface_name => 'bond0', ip_address => '127.0.0.13', ip_netmask => '255.255.255.252', ip_gateway => '127.0.0.1', ip6_address => 'fc00:e968:6179::de52:7100/64', ip6_gateway => 'fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 1, status => 3, profile => 100, cdn_id => 100, cachegroup => 300, phys_location => 100, }, }, server_edge13 => { new => 'Server', using => { id => 1300, host_name => 'atlanta-edge-14', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, xmpp_id => '<EMAIL>', xmpp_passwd => 'X', interface_name => 'bond0', ip_address => '127.0.0.14', ip_netmask => '255.255.255.252', ip_gateway => '127.0.0.1', ip6_address => 'fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b/64', ip6_gateway => 'fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 1, status => 2, profile => 100, cdn_id => 100, cachegroup => 900, phys_location => 100, }, }, server_edge14 => { new => 'Server', using => { id => 1400, host_name => 'atlanta-edge-15', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, xmpp_id => '<EMAIL>', xmpp_passwd => 'X', interface_name => 'bond0', ip_address => '127.0.0.15', ip_netmask => '255.255.255.252', ip_gateway => '127.0.0.7', ip6_address => 'fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b/64', ip6_gateway => 'fdf8:f53e:61e4::18', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 1, status => 2, profile => 100, cdn_id => 100, cachegroup => 900, phys_location => 100, }, }, server_mid15 => { new => 'Server', using => { id => 1500, host_name => 'atlanta-mid-16', domain_name => 'ga.atlanta.kabletown.net', tcp_port => 80, xmpp_id => 'atlanta-mid-<EMAIL>', xmpp_passwd => 'X', interface_name => 'bond0', ip_address => '127.0.0.16', ip_netmask => '255.255.255.252', ip_gateway => '127.0.0.7', ip6_address => 'fc00:e968:6179::de52:7100/64', ip6_gateway => 'fdf8:f53e:61e4::18', interface_mtu => 9000, rack => 'RR 119.02', mgmt_ip_address => '', mgmt_ip_netmask => '', mgmt_ip_gateway => '', ilo_ip_address => '', ilo_ip_netmask => '', ilo_ip_gateway => '', ilo_username => '', ilo_password => '', router_host_name => '', router_port_name => '', type => 2, status => 2, profile => 100, cdn_id => 100, cachegroup => 800, phys_location => 100, }, }, ); sub get_definition { my ( $self, $name ) = @_; return $definition_for{$name}; } sub all_fixture_names { # sort by db xml_id to guarantee insertion order return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); } __PACKAGE__->meta->make_immutable; 1; ======================= File: traffic_ops/app/lib/TrafficOps.pm ======================= package TrafficOps; # # # 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. # # # use Mojo::Base 'Mojolicious'; use Mojo::Base 'Mojolicious::Controller'; use Mojo::Base 'Mojolicious::Plugin::Config'; use base 'DBIx::Class::Core'; use Schema; use Data::Dumper; use Digest::SHA1 qw(sha1_hex); use JSON; use Cwd; use Mojolicious::Plugins; use Mojolicious::Plugin::Authentication; use Mojolicious::Plugin::AccessLog; use Mojolicious::Plugin::FormFields; use Mojolicious::Plugin::Mail; use Mojolicious::Static; use Net::LDAP; use Data::GUID; use File::Stat qw/:stat/; use User::pwent; use POSIX qw(strftime); use Utils::JsonConfig; use MojoX::Log::Log4perl; use File::Find; use File::Basename; use Env qw(PERL5LIB); use Utils::Helper::TrafficOpsRoutesLoader; use File::Path qw(make_path); use IO::Compress::Gzip 'gzip'; use IO::Socket::SSL; use Utils::Helper::Version; use constant SESSION_TIMEOUT => 14400; my $logging_root_dir; my $app_root_dir; my $mode; my $config; local $/; #Enable'slurp' mode has schema => sub { return Schema->connect_to_database }; has watch => sub { [qw(lib templates)] }; if (!defined $ENV{MOJO_CONFIG} ) { $ENV{MOJO_CONFIG} = find_conf_path('cdn.conf'); print( "Loading config from ". $ENV{MOJO_CONFIG}. "\n" ); } else { print( "MOJO_CONFIG overridden: ". $ENV{MOJO_CONFIG}. "\n" ); } my $ldap_conf_path = find_conf_path('ldap.conf'); my $ldap_info = 0; my $host; my $admin_dn; my $admin_pass; my $search_base; if ( -e $ldap_conf_path ) { $ldap_info = Utils::JsonConfig->new($ldap_conf_path); $host = $ldap_info->{host}; $admin_dn = $ldap_info->{admin_dn}; $admin_pass = $ldap_info->{admin_pass}; $search_base = $ldap_info->{search_base}; } # This method will run once at server start sub startup { my $self = shift; $mode = $self->mode; $self->app->types->type( iso => 'application/octet-stream' ); $self->setup_logging($mode); $self->validate_cdn_conf(); $self->setup_mojo_plugins(); $self->set_secrets(); $self->log->info("-------------------------------------------------------------"); $self->log->info( "TrafficOps version: ". Utils::Helper::Version->current(). " is starting." ); $self->log->info("-------------------------------------------------------------"); $self->sessions->default_expiration(SESSION_TIMEOUT); my $access_control_allow_origin; my $portal_base_url; # Set/override app defaults $self->defaults( layout => 'jquery' ); #Static Files my $static = Mojolicious::Static->new; push @{ $static->paths }, 'public'; # Make sure static files are cached $self->hook( after_static => sub { my $self = shift; $self->res->headers->cache_control('max-age=3600, must-revalidate') if $self->res->code; } ); if ( $mode ne 'test' ) { $access_control_allow_origin = $config->{'cors'}{'access_control_allow_origin'}; if ( defined($access_control_allow_origin) ) { $self->app->log->info( "Allowed origins : ". $config->{'cors'}{'access_control_allow_origin'} ); } $portal_base_url = $config->{'portal'}{'base_url'}; if ( defined($portal_base_url) ) { $self->app->log->info( "Portal Base Url : ". $portal_base_url ); } } if ($ldap_info) { $self->log->info("Found $ldap_conf_path, LDAP is now enabled.\n"); } $self->hook( before_render => sub { my ( $self, $args ) = @_; # Make sure we are rendering the exception template return unless my $template = $args->{template}; return unless $template eq 'exception'; $self->app->log->error( $self->stash(" exception ") ); # Switch to JSON rendering if content negotiation allows it $args->{json} = { alerts => [ { "level" => "error", "text" => "An error occurred. Please contact your administrator." } ] } if $self->accepts('json'); } ); if ( defined($access_control_allow_origin) ) { # Coors Light header (CORS) $self->hook( before_dispatch => sub { my $self = shift; $self->res->headers->header( 'Access-Control-Allow-Origin' => $config->{'cors'}{'access_control_allow_origin'} ); $self->res->headers->header( 'Access-Control-Allow-Headers' => 'Origin, X-Requested-With, Content-Type, Accept' ); $self->res->headers->header( 'Access-Control-Allow-Methods' => 'POST,GET,OPTIONS,PUT,DELETE' ); $self->res->headers->header( 'Access-Control-Allow-Credentials' => 'true' ); $self->res->headers->header( 'Cache-Control' => 'no-cache, no-store, max-age=0, must-revalidate' ); } ); } $self->hook( after_render => sub { my ( $c, $output, $format ) = @_; # Check if user agent accepts gzip compression return unless ( $c->req->headers->accept_encoding // '' ) =~ /gzip/i; $c->res->headers->append( Vary => 'Accept-Encoding' ); # Compress content with gzip $c->res->headers->content_encoding('gzip'); gzip $output, \my $compressed; $$output = $compressed; } ); my $r = $self->routes; # Look in the PERL5LIB for any TrafficOpsRoutes.pm files and load them as well # Router my $rh = new Utils::Helper::TrafficOpsRoutesLoader($r); $rh->load(); ##help relieve issues with riak IO::Socket::SSL::set_default_session_cache( IO::Socket::SSL::Session_Cache->new(4096) ); } sub setup_logging { my $self = shift; my $mode = shift; # This check prevents startup from blowing up if no conf/log4perl.conf # can be found, the Mojo defaults pattern/appender will kick in. if ( $mode eq 'production' ) { $logging_root_dir = "/var/log/traffic_ops"; $app_root_dir = "/opt/traffic_ops/app"; } else { my $pwd = cwd(); $logging_root_dir = "$pwd/log"; $app_root_dir = "."; make_path( $logging_root_dir, { verbose => 1, } ); } my $log4perl_conf = find_conf_path("$mode/log4perl.conf"); if ( -e $log4perl_conf ) { $self->log( MojoX::Log::Log4perl->new($log4perl_conf) ); } else { print( "Warning cannot locate ". $log4perl_conf. ", using defaults\n" ); $self->log( MojoX::Log::Log4perl->new() ); } print("Reading log4perl config from $log4perl_conf \n"); } sub setup_mojo_plugins { my $self = shift; $self->helper( db => sub { $self->schema } ); $config = $self->plugin('Config'); if (!defined $ENV{MOJO_INACTIVITY_TIMEOUT} ) { $ENV{MOJO_INACTIVITY_TIMEOUT} = $config->{inactivity_timeout} // 60; print( "Setting mojo inactivity timeout to ". $ENV{MOJO_INACTIVITY_TIMEOUT}. "\n" ); } $self->plugin( 'authentication', { autoload_user => 1, load_user => sub { my ( $app, $username ) = @_; my $user_data = $self->db->resultset('TmUser')->search( { username => $username } )->single; my $role = "read-only"; my $priv = 10; if ( defined($user_data) ) { $role = $user_data->role->name; $priv = $user_data->role->priv_level; } if ( $role eq 'disallowed' ) { return undef; } return { 'username' => $username, 'role' => $role, 'priv' => $priv, }; }, validate_user => sub { my ( $app, $username, $pass, $options ) = @_; my $logged_in_user; my $is_authenticated; # Check the Token Flow my $token = $options->{'token'}; if ( defined($token) ) { $self->app->log->debug("Token was passed, now validating..."); $logged_in_user = $self->check_token($token); } # Check the User/Password flow else { # Check Local User (in the database) ( $logged_in_user, $is_authenticated ) = $self->check_local_user( $username, $pass ); # Check LDAP if conf/ldap.conf is defined. if ( $ldap_info && (!$logged_in_user ||!$is_authenticated ) ) { $logged_in_user = $self->check_ldap_user( $username, $pass ); } } return $logged_in_user; }, } ); # Custom TO Plugins my $mojo_plugins_dir; foreach my $dir (@INC) { $mojo_plugins_dir = sprintf( "%s/MojoPlugins", $dir ); if ( -e $mojo_plugins_dir ) { last; } } my $plugins = Mojolicious::Plugins->new; my @file_list; find( sub { return unless -f; #Must be a file return unless /\.pm$/; #Must end with `.pl` suffix push @file_list, $File::Find::name; }, $mojo_plugins_dir ); #print join "\n", @file_list; foreach my $file (@file_list) { open my $fn, '<', $file; my $first_line = <$fn>; my ( $package_keyword, $package_name ) = ( $first_line =~ m/(package )(.*);/ ); close $fn; #print("Loading: $package_name\n"); $plugins->load_plugin($package_name); $self->plugin($package_name); } my $to_email_from = $config->{'to'}{'email_from'}; if ( defined($to_email_from) ) { $self->plugin( mail => { from => $to_email_from, type => 'text/html', } ); if ( $mode ne 'test' ) { $self->app->log->info("..."); $self->app->log->info( "Traffic Ops Email From: ". $to_email_from ); } } $self->plugin( AccessLog => { log => "$logging_root_dir/access.log", format => '%h %l %u %t "%r" %>s %b %D "%{User-Agent}i"' } ); $self->plugin( 'ParamExpand', max_array => 256 ); #FormFields $self->plugin('FormFields'); } sub check_token { my $self = shift; my $token = shift; $self->app->log->debug( "Locating user with token : ". $token. " \n " ); my $tm_user = $self->db->resultset('TmUser')->find( { token => $token } ); if ( defined($tm_user) ) { my $token_user = $self->db->resultset('TmUser')->find( { token => $token } ); my $username = $token_user->username; $self->app->log->debug( "Token matched username : ". $username. " \n " ); return $username; } else { $self->app->log->debug("Failed, could not find a matching token from tm_user. \n "); return undef; } } sub check_ldap_user { my $self = shift; my $username = shift; my $pass = shift; $self->app->log->debug( "Checking LDAP user: ". $username. "\n" ); # If user is not found in local tm_user, assume it's an LDAP username, and give RO privs. my $user_dn = $self->find_username_in_ldap($username); my $is_logged_in = &login_to_ldap( $user_dn, $pass ); if ( defined($user_dn) && $is_logged_in ) { $self->app->log->info( "Successful LDAP logged in : ". $username ); return $username; } return undef; } sub find_conf_path { my $req_conf = shift; my $mod_path = $INC{ __PACKAGE__. '.pm' }; my $conf_path = join( '/', dirname( dirname($mod_path) ), 'conf', $req_conf ); return $conf_path; } sub find_username_in_ldap { my $self = shift; my $username = shift; my $dn; $self->app->log->debug( "Searching LDAP for: ". $username ); my $ldap = Net::LDAP->new( $host, verify => 'none', timeout => 20 ) or die "$@ "; $self->app->log->debug("Binding..."); my $mesg = $ldap->bind( $admin_dn, password => <PASSWORD>" ); $mesg->code && return undef; $mesg = $ldap->search( base => $search_base, filter => "(&(objectCategory=person)(objectClass=user)(sAMAccountName=$username))" ); $mesg->code && return undef; my $entry = $mesg->shift_entry; if ($entry) { $dn = $entry->dn; } else { $self->app->log->info( "Cannot find ". $username. " in LDAP." ); return undef; } $ldap->unbind; return $dn; } # Lookup user in database sub check_local_user { my $self = shift; my $username = shift; my $pass = shift; my $local_user = undef; my $is_authenticated = 0; my $db_user = $self->db->resultset('TmUser')->find( { username => $username } ); if ( defined($db_user) && defined( $db_user->local_passwd ) ) { $self->app->log->info( $username. " was found in the database. " ); my $db_local_passwd = $db_user->local_passwd; my $db_confirm_local_passwd = $db_user->confirm_local_passwd; my $hex_pw_string = sha1_hex($pass); if ( $db_local_passwd eq $hex_pw_string ) { $local_user = $username; $self->app->log->debug("Password matched."); $is_authenticated = 1; } else { $self->app->log->debug("Passwords did not match."); $local_user = 0; } } else { $self->app->log->info( "Could not find database user : ". $username ); $local_user = 0; } return ( $local_user, $is_authenticated ); } sub login_to_ldap { my $ldap; my $user_dn = shift; my $pass = shift; $ldap = Net::LDAP->new( $host, verify => 'none' ) or die "$@ "; my $mesg = $ldap->bind( $user_dn, password => $pass ); if ( $mesg->code ) { $ldap->unbind; return 0; } else { $ldap->unbind; return 1; } } sub load_conf { my $self = shift; my $conf_file = shift; open( my $in, '<', $conf_file ) || die("$conf_file $!\n"); local $/; my $conf_info = eval <$in>; undef $in; return $conf_info; } # Validates the conf/cdn.conf for certain criteria to # avoid admin mistakes. sub validate_cdn_conf { my $self = shift; my $cdn_info = $self->load_conf( $ENV{MOJO_CONFIG} ); my $user; if (!exists( $cdn_info->{secrets} ) ) { print("WARNING: no secrets found in $ENV{MOJO_CONFIG}.\n"); } if ( exists( $cdn_info->{hypnotoad}{user} ) ) { for my $u ( $cdn_info->{hypnotoad}{user} ) { $u =~ s/.*?\?(.*)$/$1/; $user = $u; } } my $group; if ( exists( $cdn_info->{hypnotoad}{group} ) ) { for my $g ( $cdn_info->{hypnotoad}{group} ) { $g =~ s/.*?\?(.*)$/$1/; $group = $g; } } if ( exists( $cdn_info->{hypnotoad}{listen} ) ) { for my $listen ( @{ $cdn_info->{hypnotoad}{listen} } ) { $listen =~ s/.*?\?(.*)$/$1/; if ( $listen!~ /^#/ ) { for my $part ( split( /&/, $listen ) ) { my ( $k, $v ) = split( /=/, $part ); if ( $k eq "cert" || $k eq "key" ) { my @fstats = stat($v); my $uid = $fstats[4]; if ( defined($uid) ) { my $gid = $fstats[5]; my $file_owner = getpwuid($uid)->name; my $file_group = getgrgid($gid); if ( ( $file_owner!~ /$user/ ) || ( $file_group!~ /$group/ ) ) { print( "WARNING: ". $v. " is not owned by ". $user. ":". $group. ".\n" ); } } } } } } } } sub set_secrets { my $self = shift; # Set secret / disable annoying log message # The following commit details the change from secret to secrets in 4.63 # https://github.com/kraih/mojo/commit/57e5129436bf3d717a13e092dd972217938e29b5 my $cdn_info = $self->load_conf( $ENV{MOJO_CONFIG} ); # for backward compatability -- keep old secret if not found in cdn.conf my $secrets = $cdn_info->{secrets} // ['mONKEYDOmONKEYSEE.']; if ( ref $secrets ne 'ARRAY' ) { my $e = Mojo::Exception->throw("Invalid'secrets' entry in cdn.conf"); } if ( $Mojolicious::VERSION >= 4.63 ) { $self->secrets($secrets); # for Mojolicious 4.67, Top Hat } else { $self->secret( $secrets->[0] ); # for Mojolicious 3.x } } 1; ======================= File: traffic_ops/app/t/api/1.2/deliveryservice_regex.t ======================= package main; # # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use Mojo::Base -strict; use Test::More; use Test::Mojo; use DBI; use Schema; use Test::TestHelper; use Test::MockModule; use Test::MockObject; use strict; use warnings; use JSON; BEGIN { $ENV{MOJO_MODE} = "test" } my $schema = Schema->connect_to_database; my $t = Test::Mojo->new('TrafficOps'); #unload data for a clean test Test::TestHelper->unload_core_data($schema); #load core test data Test::TestHelper->load_core_data($schema); #NEGATIVE TESTING -- No Privs ok $t->post_ok( '/api/1.1/user/login', json => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(200), 'Log into the admin user?'; ok $t->get_ok("/api/1.2/deliveryservices_regexes")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_has( '/response', 'has a response' )->json_is( '/response/0/dsName','steering-ds1' )->json_has( '/response/0/regexes/0/type', 'has a regex type' ) ->json_is( '/response/1/dsName','steering-ds2' ) ->json_has( '/response/1/regexes', 'has a second regex' )->json_has( '/response/7/regexes/0/type', 'has a second regex type' ), 'Query regexes'; $t->get_ok("/api/1.2/deliveryservices/100/regexes")->status_is(200)->json_is( "/response/0/id", 200 ) ->json_is( "/response/0/pattern" => '.*\.foo\..*' ) ->json_is( "/response/0/type" => 19 ) ->json_is( "/response/0/typeName" => 'HOST_REGEXP' ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok("/api/1.2/deliveryservices/100/regexes")->status_is(200)->json_is( "/response/1/id", 800 ) ->json_is( "/response/1/pattern" => '.*\.steering-ds1\..*' ) ->json_is( "/response/1/type" => 19 ) ->json_is( "/response/1/typeName" => 'HOST_REGEXP' ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok("/api/1.2/deliveryservices/100/regexes/200")->status_is(200)->json_is( "/response/0/id", 200 ) ->json_is( "/response/0/pattern" => '.*\.foo\..*' ) ->json_is( "/response/0/type" => 19 ) ->json_is( "/response/0/typeName" => 'HOST_REGEXP' ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->put_ok('/api/1.2/deliveryservices/100/regexes/200' => {Accept => 'application/json'} => json => { "pattern" => '.*\.foo-bar\..*', "type" => 20, "setNumber" => 22, }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/pattern" => '.*\.foo-bar\..*' ) ->json_is( "/response/type" => 20 ) ->json_is( "/response/typeName" => 'PATH_REGEXP' ) ->json_is( "/response/setNumber" => 22 ) ->json_is( "/alerts/0/level" => "success" ) , 'Did the delivery service regex update?'; ok $t->delete_ok('/api/1.2/deliveryservices/100/regexes/200')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->delete_ok('/api/1.2/deliveryservices/100/regexes/800')->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/alerts/0/level" => "error" ) ->json_is( "/alerts/0/text" => "A delivery service must have at least one regex." ) , 'Does the delivery service regex delete fail because each ds must have at least one regex?';; ok $t->post_ok('/api/1.2/deliveryservices/100/regexes' => {Accept => 'application/json'} => json => { "pattern" => "foo.bar.com", "type" => 19, "setNumber" => 2, }) ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/pattern" => "foo.bar.com" ) ->json_is( "/response/type" => 19 ) ->json_is( "/response/typeName" => "HOST_REGEXP" ) ->json_is( "/response/setNumber" => 2 ) ->json_is( "/alerts/0/level" => "success" ) ->json_is( "/alerts/0/text" => "Delivery service regex creation was successful." ) , 'Is the delivery service regex created?'; ok $t->post_ok('/api/1.2/deliveryservices/100/regexes' => {Accept => 'application/json'} => json => { "pattern" => "foo2.bar.com", "type" => 12, "setNumber" => 2, }) ->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/alerts/0/level" => "error" ) ->json_is( "/alerts/0/text" => "Invalid regex type" ) , 'Does the delivery service regex create fail due to bad regex type?'; ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); #NEGATIVE TESTING -- No Privs ok $t->post_ok( '/api/1.1/user/login', json => { u => Test::TestHelper::PORTAL_USER, p => Test::TestHelper::PORTAL_USER_PASSWORD } )->status_is(200), 'Log into the portal user?'; # Verify Permissions ok $t->get_ok("/api/1.2/deliveryservices_regexes")->status_is(403)->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); done_testing(); ======================= File: traffic_ops/app/lib/Fixtures/Integration/GooseDbVersion.pm ======================= <filename>traffic_ops/app/lib/Fixtures/Integration/GooseDbVersion.pm package Fixtures::Integration::GooseDbVersion; # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # Do not edit! Generated code. # See https://github.com/Comcast/traffic_control/wiki/The%20Kabletown%20example use Moose; extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( '0' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:20', version_id => '0', }, }, '1' => { new => 'GooseDbVersion', using => { tstamp => '2015-12-04 07:46:21', version_id => '20141222103718', is_applied => '1', }, }, '2' => { new => 'GooseDbVersion', using => { version_id => '20150108100000', is_applied => '1', tstamp => '2015-12-04 07:46:21', }, }, '3' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:21', version_id => '20150205100000', }, }, '4' => { new => 'GooseDbVersion', using => { version_id => '20150209100000', is_applied => '1', tstamp => '2015-12-04 07:46:21', }, }, '5' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:21', version_id => '20150210100000', }, }, '6' => { new => 'GooseDbVersion', using => { tstamp => '2015-12-04 07:46:21', version_id => '20150304100000', is_applied => '1', }, }, '7' => { new => 'GooseDbVersion', using => { version_id => '20150310100000', is_applied => '1', tstamp => '2015-12-04 07:46:21', }, }, '8' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:21', version_id => '20150316100000', }, }, '9' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150331105256', }, }, '10' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150501100000', }, }, '11' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150503100001', }, }, '12' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150504100000', }, }, '13' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150504100001', }, }, '14' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150521100000', }, }, '15' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150530100000', }, }, '16' => { new => 'GooseDbVersion', using => { tstamp => '2015-12-04 07:46:22', version_id => '20150618100000', is_applied => '1', }, }, '17' => { new => 'GooseDbVersion', using => { version_id => '20150626100000', is_applied => '1', tstamp => '2015-12-04 07:46:22', }, }, '18' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150706084134', }, }, '19' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150721000000', }, }, '20' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150722100000', }, }, '21' => { new => 'GooseDbVersion', using => { tstamp => '2015-12-04 07:46:22', version_id => '20150728000000', is_applied => '1', }, }, '22' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150804000000', }, }, '23' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150807000000', }, }, '24' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150825175644', }, }, '25' => { new => 'GooseDbVersion', using => { tstamp => '2015-12-04 07:46:22', version_id => '20150922092122', is_applied => '1', }, }, '26' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20150925020500', }, }, '27' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20151020143912', }, }, '28' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20151021000000', }, }, '29' => { new => 'GooseDbVersion', using => { is_applied => '1', tstamp => '2015-12-04 07:46:22', version_id => '20151027152323', }, }, '30' => { new => 'GooseDbVersion', using => { tstamp => '2015-12-04 07:46:22', version_id => '20151107000000', is_applied => '1', }, }, ); sub name { return "GooseDbVersion"; } sub get_definition { my ( $self, $name ) = @_; return $definition_for{$name}; } sub all_fixture_names { return keys %definition_for; } __PACKAGE__->meta->make_immutable; 1; ======================= File: traffic_ops/app/lib/API/Asn.pm ======================= <reponame>orifinkelman/incubator-trafficcontrol package API::Asn; # # # 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. # # # # JvD Note: you always want to put Utils as the first use. Sh*t don't work if it's after the Mojo lines. use UI::Utils; use Mojo::Base 'Mojolicious::Controller'; use Data::Dumper; # Index sub index { my $self = shift; my $cg_id = $self->param('cachegroup'); my %criteria; if ( defined $cg_id ) { $criteria{'cachegroup'} = $cg_id; } my @data; my $orderby = $self->param('orderby') || "asn"; my $rs_data = $self->db->resultset("Asn")->search( \%criteria, { prefetch => [ { 'cachegroup' => undef } ], order_by => "me.". $orderby } ); while ( my $row = $rs_data->next ) { push( @data, { "id" => $row->id, "asn" => $row->asn, "cachegroupId" => $row->cachegroup->id, "cachegroup" => $row->cachegroup->name, "lastUpdated" => $row->last_updated } ); } $self->success( \@data ); } # Show sub show { my $self = shift; my $id = $self->param('id'); my $rs_data = $self->db->resultset("Asn")->search( {'me.id' => $id }, { prefetch => ['cachegroup'] } ); my @data = (); while ( my $row = $rs_data->next ) { push( @data, { "id" => $row->id, "asn" => $row->asn, "cachegroupId" => $row->cachegroup->id, "cachegroup" => $row->cachegroup->name, "lastUpdated" => $row->last_updated } ); } $self->success( \@data ); } sub update { my $self = shift; my $id = $self->param('id'); my $params = $self->req->json; if (!&is_oper($self) ) { return $self->forbidden(); } my $asn = $self->db->resultset('Asn')->find( { id => $id } ); if (!defined($asn) ) { return $self->not_found(); } if (!defined($params) ) { return $self->alert("parameters must be in JSON format."); } if (!defined( $params->{asn} ) ) { return $self->alert("ASN is required."); } if (!defined( $params->{cachegroupId} ) ) { return $self->alert("Cachegroup is required."); } my $values = { asn => $params->{asn}, cachegroup => $params->{cachegroupId} }; my $rs = $asn->update($values); if ( $rs ) { my $response; $response->{id} = $rs->id; $response->{asn} = $rs->asn; $response->{cachegroupId} = $rs->cachegroup->id; $response->{cachegroup} = $rs->cachegroup->name; $response->{lastUpdated} = $rs->last_updated; &log( $self, "Updated ASN name '". $rs->asn. "' for id: ". $rs->id, "APICHANGE" ); return $self->success( $response, "ASN update was successful." ); } else { return $self->alert("ASN update failed."); } } sub create { my $self = shift; my $params = $self->req->json; if (!&is_oper($self) ) { return $self->forbidden(); } if (!defined($params->{asn}) ) { return $self->alert("ASN is required."); } if (!defined($params->{cachegroupId}) ) { return $self->alert("Cachegroup Id is required."); } my $values = { asn => $params->{asn}, cachegroup => $params->{cachegroupId} }; my $insert = $self->db->resultset('Asn')->create($values); my $rs = $insert->insert(); if ($rs) { my $response; $response->{id} = $rs->id; $response->{asn} = $rs->asn; $response->{cachegroupId} = $rs->cachegroup->id; $response->{cachegroup} = $rs->cachegroup->name; $response->{lastUpdated} = $rs->last_updated; &log( $self, "Created ASN name '". $rs->asn. "' for id: ". $rs->id, "APICHANGE" ); return $self->success( $response, "ASN create was successful." ); } else { return $self->alert("ASN create failed."); } } sub delete { my $self = shift; my $id = $self->param('id'); if (!&is_oper($self) ) { return $self->forbidden(); } my $asn = $self->db->resultset('Asn')->find( { id => $id } ); if (!defined($asn) ) { return $self->not_found(); } my $rs = $asn->delete(); if ($rs) { return $self->success_message("ASN deleted."); } else { return $self->alert( "ASN delete failed." ); } } 1; ======================= File: traffic_ops/app/lib/API/Riak.pm ======================= package API::Riak; # # # 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. # # # use UI::Utils; use Mojo::Base 'Mojolicious::Controller'; use UI::Server; use JSON; use Data::Dumper; sub stats { my $self = shift; #my $response = $self->riak_stats(); my $response = $self->riak_stats(); my $content = $response->{_content}; return $self->success( decode_json($content) ); } sub ping { my $self = shift; #my $response = $self->riak_stats(); my $ping = $self->riak_ping(); my $server = $ping->{'server'}; my $response = $ping->{'response'}; my $content = $response->content; return $self->success( { server => $server, status => $content } ); } sub get { my $self = shift; my $bucket = $self->param("bucket"); my $key = $self->param("key"); my $riak_get = $self->riak_get( $bucket, $key ); my $response = $riak_get->{'response'}; my $content = $response->{_content}; if ( $response->is_success() ) { return $self->success( decode_json($content) ); } else { $self->app->log->debug( "riak_get #-> ". Dumper($riak_get) ); my $rc = $response->{_rc}; return $self->alert( $content, $rc ); } } 1; ======================= File: traffic_ops/app/lib/Fixtures/Integration/Parameter.pm ======================= <gh_stars>0 package Fixtures::Integration::Parameter; # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # Note - removing the domain_name parameter wreaks all kinds of havoc because of ordering / id problems, so I renamed # it to NODNAME - JvD use Moose; extends 'DBIx::Class::EasyFixture'; use namespace::autoclean; my %definition_for = ( ## id => 1 '0' => { new => 'Parameter', using => { name => 'algorithm', value => 'consistent_hash', config_file => 'parent.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 2 '1' => { new => 'Parameter', using => { name => 'allow_ip', last_updated => '2015-12-10 15:43:46', value => '127.0.0.1,172.16.31.10/16,172.16.17.32/24', config_file => 'astats.config', }, }, ## id => 3 '2' => { new => 'Parameter', using => { name => 'allow_ip6', value => '::1,2033:Dfd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b/64,2033:Dfc00:db20:35b:7399::5/64,2033:D0fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b/64,2033:Dfd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b/64', config_file => 'astats.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 4 '3' => { new => 'Parameter', using => { name => 'api.port', last_updated => '2015-12-10 15:43:46', value => '8080', config_file =>'server.xml', }, }, ## id => 5 '4' => { new => 'Parameter', using => { name => 'api.port', config_file =>'server.xml', last_updated => '2015-12-10 15:43:48', value => '8080', }, }, ## id => 6 '5' => { new => 'Parameter', using => { name => 'astats_over_http', value => '1.2-3.el6.x86_64', config_file => 'package', last_updated => '2015-12-10 15:43:48', }, }, ## id => 7 '6' => { new => 'Parameter', using => { name => 'astats_over_http', last_updated => '2015-12-10 15:43:46', value => '3.2.0-4114.el6.x86_64', config_file => 'package', }, }, ## id => 8 '7' => { new => 'Parameter', using => { name => 'astats_over_http', value => '1.1-2.el6.x86_64', config_file => 'package', last_updated => '2015-12-10 15:43:48', }, }, ## id => 9 '8' => { new => 'Parameter', using => { name => 'astats_over_http.so', config_file => 'plugin.config', last_updated => '2015-12-10 15:43:48', value => '', }, }, ## id => 10 '9' => { new => 'Parameter', using => { name => 'astats_over_http.so', config_file => 'plugin.config', last_updated => '2015-12-10 15:43:46', value => '_astats 192.168.127.12,172.16.31.10,172.16.17.32,172.16.17.32,172.16.58.3', }, }, ## id => 11 '10' => { new => 'Parameter', using => { name => 'CacheHealthTimeout', last_updated => '2015-12-10 15:43:46', value => '70', config_file => 'CRConfig.xml', }, }, ## id => 12 '11' => { new => 'Parameter', using => { name => 'CacheStats', config_file => 'traffic_stats.config', last_updated => '2015-12-10 15:43:48', value => 'bandwidth', }, }, ## id => 13 '12' => { new => 'Parameter', using => { name => 'CacheStats', value =>'maxKbps', config_file => 'traffic_stats.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 14 '13' => { new => 'Parameter', using => { name => 'CacheStats', last_updated => '2015-12-10 15:43:46', value => 'ats.proxy.process.http.current_client_connections', config_file => 'traffic_stats.config', }, }, ## id => 15 '14' => { new => 'Parameter', using => { name => 'cacheurl', config_file => 'package', last_updated => '2015-12-10 15:43:46', value => '1.0-3.el6.x86_64', }, }, ## id => 16 '15' => { new => 'Parameter', using => { name => 'cacheurl', config_file => 'package', last_updated => '2015-12-10 15:43:47', value => '3.2.0-5628.el6.x86_64', }, }, ## id => 17 '16' => { new => 'Parameter', using => { name => 'cacheurl', config_file => 'package', last_updated => '2015-12-10 15:43:48', value => '1.0-1.el6.x86_64', }, }, ## id => 18 '17' => { new => 'Parameter', using => { name => 'cacheurl.so', value => '', config_file => 'plugin.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 19 '18' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.accept_threads', last_updated => '2015-12-10 15:43:46', value => 'INT 1', config_file =>'records.config', }, }, ## id => 20 '19' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.admin.admin_user', value => 'STRING admin', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 21 '20' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.admin.autoconf_port', last_updated => '2015-12-10 15:43:46', value => 'INT 8083', config_file =>'records.config', }, }, ## id => 22 '21' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.admin.number_config_bak', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 3', }, }, ## id => 23 '22' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.admin.user_id', value => 'STRING ats', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 24 '23' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.alarm.abs_path', last_updated => '2015-12-10 15:43:46', value => 'STRING NULL', config_file =>'records.config', }, }, ## id => 25 '24' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.alarm.bin', value => 'STRING example_alarm_bin.sh', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 26 '25' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.alarm_email', value => 'STRING ats', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 27 '26' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.allocator.debug_filter', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 28 '27' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.allocator.enable_reclaim', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 0', }, }, ## id => 29 '28' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.allocator.max_overage', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 3', }, }, ## id => 30 '29' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.allocator.thread_freelist_size', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 1024', }, }, ## id => 31 '30' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.body_factory.enable_customizations', last_updated => '2015-12-10 15:43:46', value => 'INT 0', config_file =>'records.config', }, }, ## id => 32 '31' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.body_factory.enable_logging', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 33 '32' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.body_factory.response_suppression_mode', last_updated => '2015-12-10 15:43:48', value => 'INT 0', config_file =>'records.config', }, }, ## id => 34 '33' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.enable_read_while_writer', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 0', }, }, ## id => 35 '34' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.enable_read_while_writer', last_updated => '2015-12-10 15:43:48', value => 'INT 1', config_file =>'records.config', }, }, ## id => 36 '35' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.hosting_filename', last_updated => '2015-12-10 15:43:47', value => 'STRING hosting.config', config_file =>'records.config', }, }, ## id => 37 '36' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.http.compatibility.4-2-0-fixup', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 0', }, }, ## id => 38 '37' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.limits.http.max_alts', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 5', }, }, ## id => 39 '38' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.max_doc_size', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 40 '39' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.min_average_object_size', value => 'INT 131072', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 41 '40' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.mutex_retry_delay', last_updated => '2015-12-10 15:43:47', value => 'INT 2', config_file =>'records.config', }, }, ## id => 42 '41' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.permit.pinning', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 0', }, }, ## id => 43 '42' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.ram_cache.algorithm', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 44 '43' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.ram_cache.compress', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 0', }, }, ## id => 45 '44' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.ram_cache.size', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 21474836480', }, }, ## id => 46 '45' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.ram_cache.size', value => 'INT 16106127360', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 47 '46' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.ram_cache.size', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 34359738368', }, }, ## id => 48 '47' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.ram_cache.use_seen_filter', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 0', }, }, ## id => 49 '48' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.ram_cache_cutoff', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 4194304', }, }, ## id => 50 '49' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.ram_cache_cutoff', value => '268435456', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 51 '50' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.ram_cache_cutoff', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 268435456', }, }, ## id => 52 '51' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.target_fragment_size', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 1048576', }, }, ## id => 53 '52' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cache.threads_per_disk', last_updated => '2015-12-10 15:43:48', value => 'INT 8', config_file =>'records.config', }, }, ## id => 54 '53' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cluster.cluster_configuration ', last_updated => '2015-12-10 15:43:46', value => 'STRING cluster.config', config_file =>'records.config', }, }, ## id => 55 '54' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cluster.cluster_port', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 8086', }, }, ## id => 56 '55' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cluster.ethernet_interface', value => 'STRING lo', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 57 '56' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cluster.log_bogus_mc_msgs', last_updated => '2015-12-10 15:43:47', value => 'INT 1', config_file =>'records.config', }, }, ## id => 58 '57' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cluster.mc_group_addr', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'STRING 172.16.31.10', }, }, ## id => 59 '58' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cluster.mc_ttl', last_updated => '2015-12-10 15:43:46', value => 'INT 1', config_file =>'records.config', }, }, ## id => 60 '59' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cluster.mcport', value => 'INT 8089', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 61 '60' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.cluster.rsport', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 8088', }, }, ## id => 62 '61' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.config_dir', last_updated => '2015-12-10 15:43:47', value => 'STRING etc/trafficserver', config_file =>'records.config', }, }, ## id => 63 '62' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.core_limit', value => 'INT -1', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 64 '63' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.diags.debug.enabled', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 0', }, }, ## id => 65 '64' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.diags.debug.tags', last_updated => '2015-12-10 15:43:47', value => 'STRING http.*|dns.*', config_file =>'records.config', }, }, ## id => 66 '65' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.diags.show_location', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 0', }, }, ## id => 67 '66' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.dns.lookup_timeout', last_updated => '2015-12-10 15:43:46', value => 'INT 2', config_file =>'records.config', }, }, ## id => 68 '67' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.dns.max_dns_in_flight', last_updated => '2015-12-10 15:43:48', value => 'INT 2048', config_file =>'records.config', }, }, ## id => 69 '68' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.dns.nameservers', value => 'STRING NULL', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 70 '69' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.dns.resolv_conf', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'STRING /etc/resolv.conf', }, }, ## id => 71 '70' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.dns.round_robin_nameservers', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 0', }, }, ## id => 72 '71' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.dns.search_default_domains', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 73 '72' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.dns.splitDNS.enabled', last_updated => '2015-12-10 15:43:48', value => 'INT 0', config_file =>'records.config', }, }, ## id => 74 '73' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.dns.url_expansions', value => 'STRING NULL', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 75 '74' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.dns.validate_query_name', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 0', }, }, ## id => 76 '75' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.dump_mem_info_frequency', last_updated => '2015-12-10 15:43:46', value => 'INT 0', config_file =>'records.config', }, }, ## id => 77 '76' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.env_prep', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'STRING example_prep.sh', }, }, ## id => 78 '77' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.exec_thread.affinity', last_updated => '2015-12-10 15:43:48', value => 'INT 1', config_file =>'records.config', }, }, ## id => 79 '78' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.exec_thread.autoconfig', last_updated => '2015-12-10 15:43:48', value => 'INT 0', config_file =>'records.config', }, }, ## id => 80 '79' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.exec_thread.autoconfig', value => 'INT 1', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 81 '80' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.exec_thread.autoconfig.scale', last_updated => '2015-12-10 15:43:47', value => 'FLOAT 1.5', config_file =>'records.config', }, }, ## id => 82 '81' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.exec_thread.limit', value => 'INT 32', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 83 '82' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.exec_thread.limit', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 2', }, }, ## id => 84 '83' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.header.parse.no_host_url_redirect', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'STRING NULL', }, }, ## id => 85 '84' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.hostdb.serve_stale_for', last_updated => '2015-12-10 15:43:46', value => 'INT 6', config_file =>'records.config', }, }, ## id => 86 '85' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.hostdb.size', value => 'INT 120000', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 87 '86' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.hostdb.storage_size', last_updated => '2015-12-10 15:43:46', value => 'INT 33554432', config_file =>'records.config', }, }, ## id => 88 '87' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.hostdb.strict_round_robin', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 89 '88' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.hostdb.timeout', last_updated => '2015-12-10 15:43:46', value => 'INT 1440', config_file =>'records.config', }, }, ## id => 90 '89' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.hostdb.ttl_mode', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 1', }, }, ## id => 91 '90' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.hostdb.ttl_mode', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 92 '91' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.accept_no_activity_timeout', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 120', }, }, ## id => 93 '92' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.anonymize_insert_client_ip', value => 'INT 1', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 94 '93' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.anonymize_other_header_list', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'STRING NULL', }, }, ## id => 95 '94' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.anonymize_remove_client_ip', last_updated => '2015-12-10 15:43:47', value => 'INT 0', config_file =>'records.config', }, }, ## id => 96 '95' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.anonymize_remove_cookie', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 0', }, }, ## id => 97 '96' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.anonymize_remove_from', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 0', }, }, ## id => 98 '97' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.anonymize_remove_referer', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 0', }, }, ## id => 99 '98' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.anonymize_remove_user_agent', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 0', }, }, ## id => 100 '99' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.background_fill_active_timeout', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 0', }, }, ## id => 101 '100' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.background_fill_active_timeout', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 60', }, }, ## id => 102 '101' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.background_fill_completed_threshold', last_updated => '2015-12-10 15:43:46', value => 'FLOAT 0.0', config_file =>'records.config', }, }, ## id => 103 '102' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.background_fill_completed_threshold', last_updated => '2015-12-10 15:43:47', value => 'FLOAT 0.5', config_file =>'records.config', }, }, ## id => 104 '103' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.allow_empty_doc', last_updated => '2015-12-10 15:43:47', value => 'INT 0', config_file =>'records.config', }, }, ## id => 105 '104' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.cache_responses_to_cookies', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 1', }, }, ## id => 106 '105' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.cache_urls_that_look_dynamic', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 1', }, }, ## id => 107 '106' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.enable_default_vary_headers', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 108 '107' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.fuzz.probability', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'FLOAT 0.005', }, }, ## id => 109 '108' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.fuzz.time', last_updated => '2015-12-10 15:43:46', value => 'INT 240', config_file =>'records.config', }, }, ## id => 110 '109' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.heuristic_lm_factor', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'FLOAT 0.10', }, }, ## id => 111 '110' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.heuristic_max_lifetime', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 86400', }, }, ## id => 112 '111' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.heuristic_min_lifetime', value => 'INT 3600', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 113 '112' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.http', last_updated => '2015-12-10 15:43:48', value => 'INT 1', config_file =>'records.config', }, }, ## id => 114 '113' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.ignore_accept_encoding_mismatch', value => 'INT 1', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 115 '114' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.ignore_authentication', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 116 '115' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.ignore_client_cc_max_age', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 117 '116' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.ignore_client_no_cache', value => 'INT 1', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 118 '117' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.ignore_server_no_cache', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 0', }, }, ## id => 119 '118' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.ims_on_client_no_cache', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 1', }, }, ## id => 120 '119' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.max_stale_age', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 604800', }, }, ## id => 121 '120' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.range.lookup', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 1', }, }, ## id => 122 '121' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.required_headers', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 123 '122' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.vary_default_images', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'STRING NULL', }, }, ## id => 124 '123' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.vary_default_other', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'STRING NULL', }, }, ## id => 125 '124' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.vary_default_text', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'STRING NULL', }, }, ## id => 126 '125' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.when_to_add_no_cache_to_msie_requests', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT -1', }, }, ## id => 127 '126' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.cache.when_to_revalidate', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 0', }, }, ## id => 128 '127' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.chunking_enabled', value => 'INT 1', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 129 '128' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.congestion_control.enabled', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 0', }, }, ## id => 130 '129' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.connect_attempts_max_retries', last_updated => '2015-12-10 15:43:47', value => 'INT 6', config_file =>'records.config', }, }, ## id => 131 '130' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.connect_attempts_max_retries_dead_server', value => 'INT 3', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 132 '131' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.connect_attempts_rr_retries', last_updated => '2015-12-10 15:43:46', value => 'INT 3', config_file =>'records.config', }, }, ## id => 133 '132' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.connect_attempts_timeout', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 30', }, }, ## id => 134 '133' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.connect_ports', value => 'STRING 443 563', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 135 '134' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.down_server.abort_threshold', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 10', }, }, ## id => 136 '135' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.down_server.cache_time', value => 'INT 300', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 137 '136' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.enable_http_stats', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 1', }, }, ## id => 138 '137' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.enable_url_expandomatic', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 0', }, }, ## id => 139 '138' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.forward.proxy_auth_to_parent', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 0', }, }, ## id => 140 '139' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.insert_age_in_response', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 141 '140' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.insert_age_in_response', value => 'INT 1', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 142 '141' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.insert_request_via_str', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 1', }, }, ## id => 143 '142' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.insert_response_via_str', value => 'INT 3', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 144 '143' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.insert_squid_x_forwarded_for', last_updated => '2015-12-10 15:43:48', value => 'INT 1', config_file =>'records.config', }, }, ## id => 145 '144' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.keep_alive_enabled_in', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 1', }, }, ## id => 146 '145' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.keep_alive_enabled_out', last_updated => '2015-12-10 15:43:46', value => 'INT 1', config_file =>'records.config', }, }, ## id => 147 '146' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.keep_alive_no_activity_timeout_in', value => 'INT 115', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 148 '147' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.keep_alive_no_activity_timeout_out', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 120', }, }, ## id => 149 '148' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.negative_caching_enabled', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 0', }, }, ## id => 150 '149' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.negative_caching_lifetime', last_updated => '2015-12-10 15:43:47', value => 'INT 1800', config_file =>'records.config', }, }, ## id => 151 '150' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.no_dns_just_forward_to_parent', last_updated => '2015-12-10 15:43:46', value => 'INT 0', config_file =>'records.config', }, }, ## id => 152 '151' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.normalize_ae_gzip', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 0', }, }, ## id => 153 '152' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.origin_server_pipeline', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 1', }, }, ## id => 154 '153' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout', value => 'INT 30', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 155 '154' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.parent_proxy.fail_threshold', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 10', }, }, ## id => 156 '155' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.parent_proxy.file', last_updated => '2015-12-10 15:43:46', value => 'STRING parent.config', config_file =>'records.config', }, }, ## id => 157 '156' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.parent_proxy.per_parent_connect_attempts', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 2', }, }, ## id => 158 '157' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.parent_proxy.retry_time', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 300', }, }, ## id => 159 '158' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.parent_proxy.total_connect_attempts', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 4', }, }, ## id => 160 '159' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.parent_proxy_routing_enable', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 0', }, }, ## id => 161 '160' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.parent_proxy_routing_enable', value => 'INT 1', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 162 '161' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.post_connect_attempts_timeout', last_updated => '2015-12-10 15:43:47', value => 'INT 1800', config_file =>'records.config', }, }, ## id => 163 '162' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.push_method_enabled', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 0', }, }, ## id => 164 '163' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.referer_default_redirect', last_updated => '2015-12-10 15:43:46', value => 'STRING http://www.example.com/', config_file =>'records.config', }, }, ## id => 165 '164' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.referer_filter', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 166 '165' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.referer_format_redirect', last_updated => '2015-12-10 15:43:47', value => 'INT 0', config_file =>'records.config', }, }, ## id => 167 '166' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.response_server_enabled', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 1', }, }, ## id => 168 '167' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.send_http11_requests', last_updated => '2015-12-10 15:43:47', value => 'INT 1', config_file =>'records.config', }, }, ## id => 169 '168' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.server_ports', last_updated => '2015-12-10 15:43:48', value => 'STRING 80 80:ipv6', config_file =>'records.config', }, }, ## id => 170 '169' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.server_ports', value => 'STRING 80 80:ipv6 443:ssl 443:ipv6:ssl', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 171 '170' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.share_server_sessions', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 2', }, }, ## id => 172 '171' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.slow.log.threshold', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 173 '172' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.transaction_active_timeout_in', last_updated => '2015-12-10 15:43:46', value => 'INT 900', config_file =>'records.config', }, }, ## id => 174 '173' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.transaction_active_timeout_out', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 175 '174' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.transaction_no_activity_timeout_in', value => 'INT 30', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 176 '175' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.transaction_no_activity_timeout_out', last_updated => '2015-12-10 15:43:48', value => 'INT 30', config_file =>'records.config', }, }, ## id => 177 '176' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.uncacheable_requests_bypass_parent', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 1', }, }, ## id => 178 '177' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.http.user_agent_pipeline', last_updated => '2015-12-10 15:43:47', value => 'INT 8', config_file =>'records.config', }, }, ## id => 179 '178' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.icp.enabled', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 0', }, }, ## id => 180 '179' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.icp.icp_interface', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'STRING NULL', }, }, ## id => 181 '180' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.icp.icp_port', last_updated => '2015-12-10 15:43:47', value => 'INT 3130', config_file =>'records.config', }, }, ## id => 182 '181' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.icp.multicast_enabled', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 183 '182' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.icp.query_timeout', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 2', }, }, ## id => 184 '183' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.auto_delete_rolled_files', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 1', }, }, ## id => 185 '184' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.collation_host', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'STRING NULL', }, }, ## id => 186 '185' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.collation_host_tagged', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 0', }, }, ## id => 187 '186' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.collation_port', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 8085', }, }, ## id => 188 '187' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.collation_retry_sec', last_updated => '2015-12-10 15:43:47', value => 'INT 5', config_file =>'records.config', }, }, ## id => 189 '188' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.collation_secret', last_updated => '2015-12-10 15:43:48', value => 'STRING foobar', config_file =>'records.config', }, }, ## id => 190 '189' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.common_log_enabled', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 0', }, }, ## id => 191 '190' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.common_log_header', value => 'STRING NULL', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 192 '191' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.common_log_is_ascii', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 1', }, }, ## id => 193 '192' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.common_log_name', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'STRING common', }, }, ## id => 194 '193' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.custom_logs_enabled', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 1', }, }, ## id => 195 '194' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.extended2_log_enabled', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 196 '195' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.extended2_log_enabled', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 197 '196' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.extended2_log_header', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'STRING NULL', }, }, ## id => 198 '197' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.extended2_log_is_ascii', last_updated => '2015-12-10 15:43:46', value => 'INT 1', config_file =>'records.config', }, }, ## id => 199 '198' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.extended2_log_name', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'STRING extended2', }, }, ## id => 200 '199' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.extended_log_enabled', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 0', }, }, ## id => 201 '200' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.extended_log_header', last_updated => '2015-12-10 15:43:47', value => 'STRING NULL', config_file =>'records.config', }, }, ## id => 202 '201' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.extended_log_is_ascii', last_updated => '2015-12-10 15:43:47', value => 'INT 0', config_file =>'records.config', }, }, ## id => 203 '202' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.extended_log_name', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'STRING extended', }, }, ## id => 204 '203' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.hostname', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'STRING localhost', }, }, ## id => 205 '204' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.logfile_dir', last_updated => '2015-12-10 15:43:48', value => 'STRING var/log/trafficserver', config_file =>'records.config', }, }, ## id => 206 '205' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.logfile_perm', value => 'STRING rw-r--r--', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 207 '206' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.logging_enabled', last_updated => '2015-12-10 15:43:46', value => 'INT 3', config_file =>'records.config', }, }, ## id => 208 '207' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.max_secs_per_buffer', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 5', }, }, ## id => 209 '208' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.max_space_mb_for_logs', last_updated => '2015-12-10 15:43:47', value => 'INT 25000', config_file =>'records.config', }, }, ## id => 210 '209' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.max_space_mb_for_orphan_logs', value => 'INT 25', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 211 '210' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.max_space_mb_headroom', last_updated => '2015-12-10 15:43:46', value => 'INT 1000', config_file =>'records.config', }, }, ## id => 212 '211' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.rolling_enabled', value => 'INT 1', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 213 '212' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.rolling_interval_sec', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 86400', }, }, ## id => 214 '213' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.rolling_offset_hr', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 215 '214' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.rolling_size_mb', last_updated => '2015-12-10 15:43:46', value => 'INT 10', config_file =>'records.config', }, },## id => 216 '215' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.sampling_frequency', last_updated => '2015-12-10 15:43:47', value => 'INT 1', config_file =>'records.config', }, }, ## id => 217 '216' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.separate_host_logs', value => 'INT 0', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 218 '217' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.separate_icp_logs', last_updated => '2015-12-10 15:43:48', value => 'INT 0', config_file =>'records.config', }, }, ## id => 219 '218' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.squid_log_enabled', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'INT 0', }, }, ## id => 220 '219' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.squid_log_header', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'STRING NULL', }, }, ## id => 221 '220' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.squid_log_is_ascii', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 0', }, }, ## id => 222 '221' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.squid_log_name', value => 'STRING squid', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', }, }, ## id => 223 '222' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.log.xml_config_file', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', value => 'STRING logs_xml.config', }, }, ## id => 224 '223' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.mlock_enabled', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', value => 'INT 2', }, }, ## id => 225 '224' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.net.connections_throttle', last_updated => '2015-12-10 15:43:47', value => 'INT 500000', config_file =>'records.config', }, }, ## id => 226 '225' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.net.defer_accept', value => 'INT 45', config_file =>'records.config', last_updated => '2015-12-10 15:43:47', }, }, ## id => 227 '226' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.net.sock_recv_buffer_size_in', config_file =>'records.config', last_updated => '2015-12-10 15:43:48', value => 'INT 0', }, }, ## id => 228 '227' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.net.sock_recv_buffer_size_out', last_updated => '2015-12-10 15:43:47', value => 'INT 0', config_file =>'records.config', }, }, ## id => 229 '228' => { new => 'Parameter', using => { name => 'CONFIG proxy.config.net.sock_send_buffer_size_in', value => 'INT 262144', config_file =>'records.config', last_updated => '2015-12-10 15:43:46', }, }, ## id => 230 '229' => { new => 'Parameter', using => { name
69,747
thestackv1_concat_by_repo-long/65536-65536
Repo: trustcoinmining/FMx-PG195-PCIe-DMA ======================= File: Xilinx_Answer_65444_Linux_Files_rel20180420/xdma/xdma.mod.c ======================= <filename>Xilinx_Answer_65444_Linux_Files_rel20180420/xdma/xdma.mod.c #include <linux/module.h> #include <linux/vermagic.h> #include <linux/compiler.h> MODULE_INFO(vermagic, VERMAGIC_STRING); MODULE_INFO(name, KBUILD_MODNAME); __visible struct module __this_module __attribute__((section(".gnu.linkonce.this_module"))) = { .name = KBUILD_MODNAME, .init = init_module, #ifdef CONFIG_MODULE_UNLOAD .exit = cleanup_module, #endif .arch = MODULE_ARCH_INIT, }; #ifdef RETPOLINE MODULE_INFO(retpoline, "Y"); #endif static const char __module_depends[] __used __attribute__((section(".modinfo"))) = "depends="; MODULE_ALIAS("pci:v000010EEd0000903Fsv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009038sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009028sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009018sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009034sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009024sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009014sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009032sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009022sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009012sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009031sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009021sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00009011sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008011sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008012sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008014sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008018sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008021sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008022sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008024sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008028sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008031sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008032sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008034sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00008038sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007011sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007012sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007014sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007018sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007021sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007022sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007024sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007028sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007031sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007032sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007034sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00007038sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00006828sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00006830sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00006928sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00006930sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00006A28sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00006A30sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00006D30sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00004808sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00004828sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00004908sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00004A28sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00004B28sv*sd*bc*sc*i*"); MODULE_ALIAS("pci:v000010EEd00002808sv*sd*bc*sc*i*"); MODULE_INFO(srcversion, "A0D5A38205CE9F5D05FA8B6"); ======================= File: xdma_0_ex.ip_user_files/sim_scripts/xdma_0/ies/run.f ======================= <reponame>trustcoinmining/FMx-PG195-PCIe-DMA -makelib ies_lib/xilinx_vip -sv \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_axi4streampc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_axi4pc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/xil_common_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/clk_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/rst_vip_if.sv" \ -endlib -makelib ies_lib/xil_defaultlib -sv \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_cdc/hdl/xpm_cdc.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_fifo/hdl/xpm_fifo.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_memory/hdl/xpm_memory.sv" \ -endlib -makelib ies_lib/xpm \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_VCOMP.vhd" \ -endlib -makelib ies_lib/xil_defaultlib \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_clock.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_eq.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_drp.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_rate.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_reset.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_sync.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_pipe_rate.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_pipe_drp.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_pipe_reset.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_user.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_wrapper.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_qpll_drp.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_qpll_reset.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_qpll_wrapper.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_rxeq_scan.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_top.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_core_top.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_rx_null_gen.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_rx_pipeline.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_rx.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_top.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_tx_pipeline.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_tx_thrtl_ctl.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_tx.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_7x.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_bram_7x.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_bram_top_7x.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_brams_7x.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_pipe_lane.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_pipe_misc.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_pipe_pipeline.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_top.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_common.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_cpllpd_ovrd.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtx_cpllpd_ovrd.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_rx_valid_filter_7x.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_wrapper.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie2_top.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/sim/xdma_0_pcie2_ip.v" \ -endlib -makelib ies_lib/blk_mem_gen_v8_4_2 \ "../../../ipstatic/simulation/blk_mem_gen_v8_4.v" \ -endlib -makelib ies_lib/xil_defaultlib \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_1/sim/xdma_v4_1_2_blk_mem_64_reg_be.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_2/sim/xdma_v4_1_2_blk_mem_64_noreg_be.v" \ -endlib -makelib ies_lib/fifo_generator_v13_1_4 \ "../../../ipstatic/simulation/fifo_generator_vlog_beh.v" \ -endlib -makelib ies_lib/fifo_generator_v13_1_4 \ "../../../ipstatic/hdl/fifo_generator_v13_1_rfs.vhd" \ -endlib -makelib ies_lib/fifo_generator_v13_1_4 \ "../../../ipstatic/hdl/fifo_generator_v13_1_rfs.v" \ -endlib -makelib ies_lib/xil_defaultlib \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_3/sim/pcie2_fifo_generator_dma_cpl.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_4/sim/pcie2_fifo_generator_tgt_brdg.v" \ -endlib -makelib ies_lib/xdma_v4_1_2 -sv \ "../../../ipstatic/hdl/xdma_v4_1_vl_rfs.sv" \ -endlib -makelib ies_lib/xil_defaultlib -sv \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_dma_cpl.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_dma_req.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_rx_destraddler.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_rx_demux.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_tgt_cpl.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_tgt_req.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_tx_mux.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_axi_stream_intf.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_cfg_sideband.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_pcie2_to_pcie3_wrapper.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_dma_bram_wrap.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_core_top.sv" \ -endlib -makelib ies_lib/xil_defaultlib \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/sim/xdma_0.v" \ -endlib -makelib ies_lib/xil_defaultlib \ glbl.v -endlib ======================= File: README.md ======================= # FM2-PG195 PCIe-XDMA PCI-e XDMA ProgramGuide pre-synthesized for FM2x Board. Xilinx PG195 Ported. ## (Port to vivado 2018.3) FM2 board PCI-e XDMA prebuilt, base on pg195-7series-pcie. PCI-e PROM and PCI-e Application Tutorial for FM2, port from Xilinx pg195 tutorial ## bitstream files link:: https://github.com/trustcoinmining/FMx-PG195-PCIe-DMA/tree/master/bitstreamout ## Here is PCI-e usage examples for FM2 board. You can refer here. [pg195 Xilinx pdf page from 80](https://www.xilinx.com/support/documentation/ip_documentation/xdma/v4_0/pg195-pcie-dma.pdf) archive is pre-built (synthesized) vivado projects. You can customize it from the `./xdma_0_ex/import/xdma_app.v ` After bistream generation, we are providing the pci-e rescan scripts. Another pg054 archive ``` # pci-e rescan $ sudo./rescan3.sh lspci | grep Xilinx 01:00.0 Memory Conroller: Xilinx Corporation Device 7028 ``` ## Update Answer, Trouble shooting and Linux driver and sw reference. https://www.xilinx.com/support/answers/65443.html - Basic Linux Driver is 65444 https://www.xilinx.com/support/answers/65444.html You can download and build for your custom purpose, on Ubuntu and Windows10 - Windows10 XDMA driver installation discussion https://forums.xilinx.com/t5/PCI-Express/XDMA-driver-installation/td-p/851356 ## Directory structure You can identify it. Any feedback is welcome and we have a bounty program, share project application source for FM2L. Thanks. ======================= File: xdma_0_ex.ip_user_files/sim_scripts/xdma_0/vcs/xdma_0.sh ======================= <filename>xdma_0_ex.ip_user_files/sim_scripts/xdma_0/vcs/xdma_0.sh #!/bin/bash -f #********************************************************************************************************* # Vivado (TM) v2018.3 (64-bit) # # Filename : xdma_0.sh # Simulator : Synopsys Verilog Compiler Simulator # Description : Simulation script for compiling, elaborating and verifying the project source files. # The script will automatically create the design libraries sub-directories in the run # directory, add the library logical mappings in the simulator setup file, create default # 'do/prj' file, execute compilation, elaboration and simulation steps. # # Generated by Vivado on Fri Mar 08 20:32:05 +0900 2019 # SW Build 2405991 on Thu Dec 6 23:38:27 MST 2018 # # Copyright 1986-2018 Xilinx, Inc. All Rights Reserved. # # usage: xdma_0.sh [-help] # usage: xdma_0.sh [-lib_map_path] # usage: xdma_0.sh [-noclean_files] # usage: xdma_0.sh [-reset_run] # # Prerequisite:- To compile and run simulation, you must compile the Xilinx simulation libraries using the # 'compile_simlib' TCL command. For more information about this command, run 'compile_simlib -help' in the # Vivado Tcl Shell. Once the libraries have been compiled successfully, specify the -lib_map_path switch # that points to these libraries and rerun export_simulation. For more information about this switch please # type 'export_simulation -help' in the Tcl shell. # # You can also point to the simulation libraries by either replacing the <SPECIFY_COMPILED_LIB_PATH> in this # script with the compiled library directory path or specify this path with the '-lib_map_path' switch when # executing this script. Please type 'xdma_0.sh -help' for more information. # # Additional references - 'Xilinx Vivado Design Suite User Guide:Logic simulation (UG900)' # #********************************************************************************************************* # Directory path for design sources and include directories (if any) wrt this path ref_dir="." # Override directory with 'export_sim_ref_dir' env path value if set in the shell if [[ (! -z "$export_sim_ref_dir") && ($export_sim_ref_dir!= "") ]]; then ref_dir="$export_sim_ref_dir" fi # Command line options vlogan_opts="-full64" vhdlan_opts="-full64" vcs_elab_opts="-full64 -debug_pp -t ps -licqueue -l elaborate.log" vcs_sim_opts="-ucli -licqueue -l simulate.log" # Design libraries design_libs=(xilinx_vip xil_defaultlib xpm blk_mem_gen_v8_4_2 fifo_generator_v13_1_4 xdma_v4_1_2) # Simulation root library directory sim_lib_dir="vcs_lib" # Script info echo -e "xdma_0.sh - Script generated by export_simulation (Vivado v2018.3 (64-bit)-id)\n" # Main steps run() { check_args $# $1 setup $1 $2 compile elaborate simulate } # RUN_STEP: <compile> compile() { # Compile design files vlogan -work xilinx_vip $vlogan_opts -sverilog +incdir+"$ref_dir/../../../ipstatic/hdl/verilog" +incdir+"C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_axi4streampc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_axi4pc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/xil_common_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/clk_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/rst_vip_if.sv" \ 2>&1 | tee -a vlogan.log vlogan -work xil_defaultlib $vlogan_opts -sverilog +incdir+"$ref_dir/../../../ipstatic/hdl/verilog" +incdir+"C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_cdc/hdl/xpm_cdc.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_fifo/hdl/xpm_fifo.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_memory/hdl/xpm_memory.sv" \ 2>&1 | tee -a vlogan.log vhdlan -work xpm $vhdlan_opts \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_VCOMP.vhd" \ 2>&1 | tee -a vhdlan.log vlogan -work xil_defaultlib $vlogan_opts +v2k +incdir+"$ref_dir/../../../ipstatic/hdl/verilog" +incdir+"C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_clock.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_eq.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_drp.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_rate.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_reset.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_sync.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_pipe_rate.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_pipe_drp.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_pipe_reset.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_user.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_wrapper.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_qpll_drp.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_qpll_reset.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_qpll_wrapper.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_rxeq_scan.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_top.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_core_top.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_rx_null_gen.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_rx_pipeline.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_rx.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_top.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_tx_pipeline.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_tx_thrtl_ctl.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_tx.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_7x.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_bram_7x.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_bram_top_7x.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_brams_7x.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_pipe_lane.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_pipe_misc.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_pipe_pipeline.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_top.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_common.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_cpllpd_ovrd.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtx_cpllpd_ovrd.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_rx_valid_filter_7x.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_wrapper.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie2_top.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/sim/xdma_0_pcie2_ip.v" \ 2>&1 | tee -a vlogan.log vlogan -work blk_mem_gen_v8_4_2 $vlogan_opts +v2k +incdir+"$ref_dir/../../../ipstatic/hdl/verilog" +incdir+"C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "$ref_dir/../../../ipstatic/simulation/blk_mem_gen_v8_4.v" \ 2>&1 | tee -a vlogan.log vlogan -work xil_defaultlib $vlogan_opts +v2k +incdir+"$ref_dir/../../../ipstatic/hdl/verilog" +incdir+"C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_1/sim/xdma_v4_1_2_blk_mem_64_reg_be.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_2/sim/xdma_v4_1_2_blk_mem_64_noreg_be.v" \ 2>&1 | tee -a vlogan.log vlogan -work fifo_generator_v13_1_4 $vlogan_opts +v2k +incdir+"$ref_dir/../../../ipstatic/hdl/verilog" +incdir+"C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "$ref_dir/../../../ipstatic/simulation/fifo_generator_vlog_beh.v" \ 2>&1 | tee -a vlogan.log vhdlan -work fifo_generator_v13_1_4 $vhdlan_opts \ "$ref_dir/../../../ipstatic/hdl/fifo_generator_v13_1_rfs.vhd" \ 2>&1 | tee -a vhdlan.log vlogan -work fifo_generator_v13_1_4 $vlogan_opts +v2k +incdir+"$ref_dir/../../../ipstatic/hdl/verilog" +incdir+"C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "$ref_dir/../../../ipstatic/hdl/fifo_generator_v13_1_rfs.v" \ 2>&1 | tee -a vlogan.log vlogan -work xil_defaultlib $vlogan_opts +v2k +incdir+"$ref_dir/../../../ipstatic/hdl/verilog" +incdir+"C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_3/sim/pcie2_fifo_generator_dma_cpl.v" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_4/sim/pcie2_fifo_generator_tgt_brdg.v" \ 2>&1 | tee -a vlogan.log vlogan -work xdma_v4_1_2 $vlogan_opts -sverilog +incdir+"$ref_dir/../../../ipstatic/hdl/verilog" +incdir+"C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "$ref_dir/../../../ipstatic/hdl/xdma_v4_1_vl_rfs.sv" \ 2>&1 | tee -a vlogan.log vlogan -work xil_defaultlib $vlogan_opts -sverilog +incdir+"$ref_dir/../../../ipstatic/hdl/verilog" +incdir+"C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_dma_cpl.sv" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_dma_req.sv" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_rx_destraddler.sv" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_rx_demux.sv" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_tgt_cpl.sv" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_tgt_req.sv" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_tx_mux.sv" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_axi_stream_intf.sv" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_cfg_sideband.sv" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_pcie2_to_pcie3_wrapper.sv" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_dma_bram_wrap.sv" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_core_top.sv" \ 2>&1 | tee -a vlogan.log vlogan -work xil_defaultlib $vlogan_opts +v2k +incdir+"$ref_dir/../../../ipstatic/hdl/verilog" +incdir+"C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "$ref_dir/../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/sim/xdma_0.v" \ 2>&1 | tee -a vlogan.log vlogan -work xil_defaultlib $vlogan_opts +v2k \ glbl.v \ 2>&1 | tee -a vlogan.log } # RUN_STEP: <elaborate> elaborate() { vcs $vcs_elab_opts xil_defaultlib.xdma_0 xil_defaultlib.glbl -o xdma_0_simv } # RUN_STEP: <simulate> simulate() { ./xdma_0_simv $vcs_sim_opts -do simulate.do } # STEP: setup setup() { case $1 in "-lib_map_path" ) if [[ ($2 == "") ]]; then echo -e "ERROR: Simulation library directory path not specified (type \"./xdma_0.sh -help\" for more information)\n" exit 1 fi create_lib_mappings $2 ;; "-reset_run" ) reset_run echo -e "INFO: Simulation run files deleted.\n" exit 0 ;; "-noclean_files" ) # do not remove previous data ;; * ) create_lib_mappings $2 esac create_lib_dir # Add any setup/initialization commands here:- # <user specific commands> } # Define design library mappings create_lib_mappings() { file="synopsys_sim.setup" if [[ -e $file ]]; then if [[ ($1 == "") ]]; then return else rm -rf $file fi fi touch $file lib_map_path="" if [[ ($1!= "") ]]; then lib_map_path="$1" fi for (( i=0; i<${#design_libs[*]}; i++ )); do lib="${design_libs[i]}" mapping="$lib:$sim_lib_dir/$lib" echo $mapping >> $file done if [[ ($lib_map_path!= "") ]]; then incl_ref="OTHERS=$lib_map_path/synopsys_sim.setup" echo $incl_ref >> $file fi } # Create design library directory paths create_lib_dir() { if [[ -e $sim_lib_dir ]]; then rm -rf $sim_lib_dir fi for (( i=0; i<${#design_libs[*]}; i++ )); do lib="${design_libs[i]}" lib_dir="$sim_lib_dir/$lib" if [[! -e $lib_dir ]]; then mkdir -p $lib_dir fi done } # Delete generated data from the previous run reset_run() { files_to_remove=(ucli.key xdma_0_simv vlogan.log vhdlan.log compile.log elaborate.log simulate.log.vlogansetup.env.vlogansetup.args.vcs_lib_lock scirocco_command.log 64 AN.DB csrc xdma_0_simv.daidir) for (( i=0; i<${#files_to_remove[*]}; i++ )); do file="${files_to_remove[i]}" if [[ -e $file ]]; then rm -rf $file fi done create_lib_dir } # Check command line arguments check_args() { if [[ ($1 == 1 ) && ($2!= "-lib_map_path" && $2!= "-noclean_files" && $2!= "-reset_run" && $2!= "-help" && $2!= "-h") ]]; then echo -e "ERROR: Unknown option specified '$2' (type \"./xdma_0.sh -help\" for more information)\n" exit 1 fi if [[ ($2 == "-help" || $2 == "-h") ]]; then usage fi } # Script usage usage() { msg="Usage: xdma_0.sh [-help]\n\ Usage: xdma_0.sh [-lib_map_path]\n\ Usage: xdma_0.sh [-reset_run]\n\ Usage: xdma_0.sh [-noclean_files]\n\n\ [-help] -- Print help information for this script\n\n\ [-lib_map_path <path>] -- Compiled simulation library directory path. The simulation library is compiled\n\ using the compile_simlib tcl command. Please see 'compile_simlib -help' for more information.\n\n\ [-reset_run] -- Recreate simulator setup files and library mappings for a clean run. The generated files\n\ from the previous run will be removed. If you don't want to remove the simulator generated files, use the\n\ -noclean_files switch.\n\n\ [-noclean_files] -- Reset previous run, but do not remove simulator generated files from the previous run.\n\n" echo -e $msg exit 1 } # Launch script run $1 $2 ======================= File: Xilinx_Answer_65444_Linux_Files_rel20180420/rescan3.sh ======================= <filename>Xilinx_Answer_65444_Linux_Files_rel20180420/rescan3.sh #!/bin/sh # get current PCI list pcilist=$(lspci | grep Xilinx | awk '{ print $1 }') echo $pcilist # remove current PCI list for pcibus in $pcilist do echo "/sys/bus/pci/devices/0000:$pcibus/remove" echo 1 > /sys/bus/pci/devices/0000:$pcibus/remove done sleep 1 # rescan pci-e bus echo "Listing Pci-E devices" lspci | grep Xilinx echo 1 > /sys/bus/pci/rescan sleep 2 # enable PCI-e devices # get rescaned PCI list pcilist2=$(lspci | grep Xilinx | awk '{ print $1 }') echo $pcilist2 echo -n > devices.txt for pcibus in $pcilist2 do echo "/sys/bus/pci/devices/0000:$pcibus/enable" echo 1 > /sys/bus/pci/devices/0000:$pcibus/enable echo "/sys/bus/pci/devices/0000:$pcibus/resource0" >> devices.txt done lspci | grep Xilinx ======================= File: xdma_0_ex.ip_user_files/sim_scripts/blk_mem_gen_0/modelsim/compile.do ======================= <filename>xdma_0_ex.ip_user_files/sim_scripts/blk_mem_gen_0/modelsim/compile.do vlib modelsim_lib/work vlib modelsim_lib/msim vlib modelsim_lib/msim/xilinx_vip vlib modelsim_lib/msim/xil_defaultlib vlib modelsim_lib/msim/xpm vlib modelsim_lib/msim/blk_mem_gen_v8_4_2 vmap xilinx_vip modelsim_lib/msim/xilinx_vip vmap xil_defaultlib modelsim_lib/msim/xil_defaultlib vmap xpm modelsim_lib/msim/xpm vmap blk_mem_gen_v8_4_2 modelsim_lib/msim/blk_mem_gen_v8_4_2 vlog -work xilinx_vip -64 -incr -sv -L xilinx_vip "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_axi4streampc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_axi4pc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/xil_common_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/clk_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/rst_vip_if.sv" \ vlog -work xil_defaultlib -64 -incr -sv -L xilinx_vip "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_cdc/hdl/xpm_cdc.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_fifo/hdl/xpm_fifo.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_memory/hdl/xpm_memory.sv" \ vcom -work xpm -64 -93 \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_VCOMP.vhd" \ vlog -work blk_mem_gen_v8_4_2 -64 -incr "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../ipstatic/simulation/blk_mem_gen_v8_4.v" \ vlog -work xil_defaultlib -64 -incr "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../../xdma_0_ex.srcs/sources_1/ip/blk_mem_gen_0/sim/blk_mem_gen_0.v" \ vlog -work xil_defaultlib \ "glbl.v" ======================= File: xdma_0_ex.ip_user_files/sim_scripts/xdma_0/questa/compile.do ======================= vlib questa_lib/work vlib questa_lib/msim vlib questa_lib/msim/xilinx_vip vlib questa_lib/msim/xil_defaultlib vlib questa_lib/msim/xpm vlib questa_lib/msim/blk_mem_gen_v8_4_2 vlib questa_lib/msim/fifo_generator_v13_1_4 vlib questa_lib/msim/xdma_v4_1_2 vmap xilinx_vip questa_lib/msim/xilinx_vip vmap xil_defaultlib questa_lib/msim/xil_defaultlib vmap xpm questa_lib/msim/xpm vmap blk_mem_gen_v8_4_2 questa_lib/msim/blk_mem_gen_v8_4_2 vmap fifo_generator_v13_1_4 questa_lib/msim/fifo_generator_v13_1_4 vmap xdma_v4_1_2 questa_lib/msim/xdma_v4_1_2 vlog -work xilinx_vip -64 -sv -L xilinx_vip "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_axi4streampc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_axi4pc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/xil_common_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/clk_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/rst_vip_if.sv" \ vlog -work xil_defaultlib -64 -sv -L xilinx_vip "+incdir+../../../ipstatic/hdl/verilog" "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_cdc/hdl/xpm_cdc.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_fifo/hdl/xpm_fifo.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_memory/hdl/xpm_memory.sv" \ vcom -work xpm -64 -93 \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_VCOMP.vhd" \ vlog -work xil_defaultlib -64 "+incdir+../../../ipstatic/hdl/verilog" "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_clock.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_eq.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_drp.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_rate.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_reset.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_sync.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_pipe_rate.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_pipe_drp.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_pipe_reset.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_user.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pipe_wrapper.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_qpll_drp.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_qpll_reset.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_qpll_wrapper.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_rxeq_scan.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_top.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_core_top.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_rx_null_gen.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_rx_pipeline.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_rx.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_top.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_tx_pipeline.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_tx_thrtl_ctl.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_axi_basic_tx.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_7x.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_bram_7x.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_bram_top_7x.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_brams_7x.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_pipe_lane.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_pipe_misc.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie_pipe_pipeline.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_top.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_common.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtp_cpllpd_ovrd.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gtx_cpllpd_ovrd.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_rx_valid_filter_7x.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_gt_wrapper.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/source/xdma_0_pcie2_ip_pcie2_top.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_0/sim/xdma_0_pcie2_ip.v" \ vlog -work blk_mem_gen_v8_4_2 -64 "+incdir+../../../ipstatic/hdl/verilog" "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../ipstatic/simulation/blk_mem_gen_v8_4.v" \ vlog -work xil_defaultlib -64 "+incdir+../../../ipstatic/hdl/verilog" "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_1/sim/xdma_v4_1_2_blk_mem_64_reg_be.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_2/sim/xdma_v4_1_2_blk_mem_64_noreg_be.v" \ vlog -work fifo_generator_v13_1_4 -64 "+incdir+../../../ipstatic/hdl/verilog" "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../ipstatic/simulation/fifo_generator_vlog_beh.v" \ vcom -work fifo_generator_v13_1_4 -64 -93 \ "../../../ipstatic/hdl/fifo_generator_v13_1_rfs.vhd" \ vlog -work fifo_generator_v13_1_4 -64 "+incdir+../../../ipstatic/hdl/verilog" "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../ipstatic/hdl/fifo_generator_v13_1_rfs.v" \ vlog -work xil_defaultlib -64 "+incdir+../../../ipstatic/hdl/verilog" "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_3/sim/pcie2_fifo_generator_dma_cpl.v" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/ip_4/sim/pcie2_fifo_generator_tgt_brdg.v" \ vlog -work xdma_v4_1_2 -64 -sv -L xilinx_vip "+incdir+../../../ipstatic/hdl/verilog" "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../ipstatic/hdl/xdma_v4_1_vl_rfs.sv" \ vlog -work xil_defaultlib -64 -sv -L xilinx_vip "+incdir+../../../ipstatic/hdl/verilog" "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_dma_cpl.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_dma_req.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_rx_destraddler.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_rx_demux.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_tgt_cpl.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_tgt_req.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_tx_mux.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_axi_stream_intf.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_cfg_sideband.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_pcie2_to_pcie3_wrapper.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_dma_bram_wrap.sv" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_core_top.sv" \ vlog -work xil_defaultlib -64 "+incdir+../../../ipstatic/hdl/verilog" "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../../xdma_0_ex.srcs/sources_1/ip/xdma_0/sim/xdma_0.v" \ vlog -work xil_defaultlib \ "glbl.v" ======================= File: xdma_0_ex.ip_user_files/sim_scripts/xdma_0/questa/elaborate.do ======================= <filename>xdma_0_ex.ip_user_files/sim_scripts/xdma_0/questa/elaborate.do vopt -64 +acc -l elaborate.log -L xilinx_vip -L xil_defaultlib -L xpm -L blk_mem_gen_v8_4_2 -L fifo_generator_v13_1_4 -L xdma_v4_1_2 -L xilinx_vip -L unisims_ver -L unimacro_ver -L secureip -work xil_defaultlib xil_defaultlib.xdma_0 xil_defaultlib.glbl -o xdma_0_opt ======================= File: xdma_0_ex.ip_user_files/sim_scripts/blk_mem_gen_0/questa/elaborate.do ======================= vopt -64 +acc -l elaborate.log -L xilinx_vip -L xil_defaultlib -L xpm -L blk_mem_gen_v8_4_2 -L xilinx_vip -L unisims_ver -L unimacro_ver -L secureip -work xil_defaultlib xil_defaultlib.blk_mem_gen_0 xil_defaultlib.glbl -o blk_mem_gen_0_opt ======================= File: xdma_0_ex.ip_user_files/sim_scripts/blk_mem_gen_1/activehdl/compile.do ======================= <gh_stars>1-10 vlib work vlib activehdl vlib activehdl/xilinx_vip vlib activehdl/xil_defaultlib vlib activehdl/xpm vlib activehdl/blk_mem_gen_v8_4_2 vmap xilinx_vip activehdl/xilinx_vip vmap xil_defaultlib activehdl/xil_defaultlib vmap xpm activehdl/xpm vmap blk_mem_gen_v8_4_2 activehdl/blk_mem_gen_v8_4_2 vlog -work xilinx_vip -sv2k12 "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_axi4streampc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_axi4pc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/xil_common_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/clk_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/rst_vip_if.sv" \ vlog -work xil_defaultlib -sv2k12 "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_cdc/hdl/xpm_cdc.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_fifo/hdl/xpm_fifo.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_memory/hdl/xpm_memory.sv" \ vcom -work xpm -93 \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_VCOMP.vhd" \ vlog -work blk_mem_gen_v8_4_2 -v2k5 "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../ipstatic/simulation/blk_mem_gen_v8_4.v" \ vlog -work xil_defaultlib -v2k5 "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../../xdma_0_ex.srcs/sources_1/ip/blk_mem_gen_1/sim/blk_mem_gen_1.v" \ vlog -work xil_defaultlib \ "glbl.v" ======================= File: xdma_0_ex.ip_user_files/sim_scripts/blk_mem_gen_0/riviera/compile.do ======================= <gh_stars>1-10 vlib work vlib riviera vlib riviera/xilinx_vip vlib riviera/xil_defaultlib vlib riviera/xpm vlib riviera/blk_mem_gen_v8_4_2 vmap xilinx_vip riviera/xilinx_vip vmap xil_defaultlib riviera/xil_defaultlib vmap xpm riviera/xpm vmap blk_mem_gen_v8_4_2 riviera/blk_mem_gen_v8_4_2 vlog -work xilinx_vip -sv2k12 "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_axi4streampc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_axi4pc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/xil_common_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/clk_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/rst_vip_if.sv" \ vlog -work xil_defaultlib -sv2k12 "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_cdc/hdl/xpm_cdc.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_fifo/hdl/xpm_fifo.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_memory/hdl/xpm_memory.sv" \ vcom -work xpm -93 \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_VCOMP.vhd" \ vlog -work blk_mem_gen_v8_4_2 -v2k5 "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../ipstatic/simulation/blk_mem_gen_v8_4.v" \ vlog -work xil_defaultlib -v2k5 "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../../xdma_0_ex.srcs/sources_1/ip/blk_mem_gen_0/sim/blk_mem_gen_0.v" \ vlog -work xil_defaultlib \ "glbl.v" ======================= File: xdma_0_ex.ip_user_files/sim_scripts/blk_mem_gen_1/questa/elaborate.do ======================= <filename>xdma_0_ex.ip_user_files/sim_scripts/blk_mem_gen_1/questa/elaborate.do vopt -64 +acc -l elaborate.log -L xilinx_vip -L xil_defaultlib -L xpm -L blk_mem_gen_v8_4_2 -L xilinx_vip -L unisims_ver -L unimacro_ver -L secureip -work xil_defaultlib xil_defaultlib.blk_mem_gen_1 xil_defaultlib.glbl -o blk_mem_gen_1_opt ======================= File: xdma_0_ex.ip_user_files/sim_scripts/blk_mem_gen_0/questa/compile.do ======================= <reponame>trustcoinmining/FMx-PG195-PCIe-DMA vlib questa_lib/work vlib questa_lib/msim vlib questa_lib/msim/xilinx_vip vlib questa_lib/msim/xil_defaultlib vlib questa_lib/msim/xpm vlib questa_lib/msim/blk_mem_gen_v8_4_2 vmap xilinx_vip questa_lib/msim/xilinx_vip vmap xil_defaultlib questa_lib/msim/xil_defaultlib vmap xpm questa_lib/msim/xpm vmap blk_mem_gen_v8_4_2 questa_lib/msim/blk_mem_gen_v8_4_2 vlog -work xilinx_vip -64 -sv -L xilinx_vip "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_axi4streampc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_axi4pc.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/xil_common_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_pkg.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi4stream_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/axi_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/clk_vip_if.sv" \ "C:/Xilinx/Vivado/2018.3/data/xilinx_vip/hdl/rst_vip_if.sv" \ vlog -work xil_defaultlib -64 -sv -L xilinx_vip "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_cdc/hdl/xpm_cdc.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_fifo/hdl/xpm_fifo.sv" \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_memory/hdl/xpm_memory.sv" \ vcom -work xpm -64 -93 \ "C:/Xilinx/Vivado/2018.3/data/ip/xpm/xpm_VCOMP.vhd" \ vlog -work blk_mem_gen_v8_4_2 -64 "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../ipstatic/simulation/blk_mem_gen_v8_4.v" \ vlog -work xil_defaultlib -64 "+incdir+C:/Xilinx/Vivado/2018.3/data/xilinx_vip/include" \ "../../../../xdma_0_ex.srcs/sources_1/ip/blk_mem_gen_0/sim/blk_mem_gen_0.v" \ vlog -work xil_defaultlib \ "glbl.v" ======================= File: xdma_0_ex.ip_user_files/sim_scripts/xdma_0/riviera/simulate.do ======================= <filename>xdma_0_ex.ip_user_files/sim_scripts/xdma_0/riviera/simulate.do<gh_stars>1-10 onbreak {quit -force} onerror {quit -force} asim -t 1ps +access +r +m+xdma_0 -L xilinx_vip -L xil_defaultlib -L xpm -L blk_mem_gen_v8_4_2 -L fifo_generator_v13_1_4 -L xdma_v4_1_2 -L xilinx_vip -L unisims_ver -L unimacro_ver -L secureip -O5 xil_defaultlib.xdma_0 xil_defaultlib.glbl do {wave.do} view wave view structure do {xdma_0.udo} run -all endsim quit -force ======================= File: xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_tgt_req.sv ======================= //----------------------------------------------------------------------------- // // (c) Copyright 2012-2012 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant any // rights to the materials distributed herewith. Except as // otherwise provided in a valid license issued to you by // Xilinx, and to the maximum extent permitted by applicable // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND // WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES // AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING // BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- // INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and // (2) Xilinx shall not be liable (whether in contract or tort, // including negligence, or under any other theory of // liability) for any loss or damage of any kind or nature // related to, arising under or in connection with these // materials, including for any direct, or any indirect, // special, incidental, or consequential loss or damage // (including loss of data, profits, goodwill, or any type of // loss or damage suffered as a result of any action brought // by a third party) even if such damage or loss was // reasonably foreseeable or Xilinx had been advised of the // possibility of the same. // // CRITICAL APPLICATIONS // Xilinx products are not designed or intended to be fail- // safe, or for use in any application requiring fail-safe // performance, such as life-support or safety devices or // systems, Class III medical devices, nuclear facilities, // applications related to the deployment of airbags, or any // other applications that could lead to death, personal // injury, or severe property or environmental damage // (individually and collectively, "Critical // Applications"). Customer assumes the sole risk and // liability of any use of Xilinx products in Critical // Applications, subject only to applicable laws and // regulations governing limitations on product liability. // // THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS // PART OF THIS FILE AT ALL TIMES. // //----------------------------------------------------------------------------- // // Project : The Xilinx PCI Express DMA // File : xdma_0_tgt_req.sv // Version : 4.1 //----------------------------------------------------------------------------- //----------------------------------------------------------------------------// // File : <ComponentName>_tgt_req.v // // Date : 12/04/15 // // Author : <NAME> // // // // Description: // // Generates Gen3 PCIe CQ packets // // // // Notes: // // 64-bit and 128-bit are supported // // // // Hierarchical: // // pcie2_to_pcie3_wrapper // // axi_stream_intf // // tgt_req // // // //----------------------------------------------------------------------------// `timescale 1ps/1ps module xdma_0_tgt_req # ( parameter C_AXI_DATA_WIDTH = 64, parameter C_KEEP_WIDTH = C_AXI_DATA_WIDTH/8, parameter C_CQ_KEEP_WIDTH = C_AXI_DATA_WIDTH/32, parameter C_S_AXIS_CQ_USER_WIDTH = 85, parameter TCQ = 1 ) ( input clk, input user_reset, input [C_AXI_DATA_WIDTH-1:0] m_axis_rx_tdata, // RX data input m_axis_rx_tvalid, // RX data is valid output reg m_axis_rx_tready, // RX ready for data input [C_KEEP_WIDTH-1:0] m_axis_rx_tkeep, // RX strobe byte enables input m_axis_rx_tlast, // RX data is last input [21:0] m_axis_rx_tuser, // RX user signals input s_axis_cq_tready, output reg [C_AXI_DATA_WIDTH-1:0] s_axis_cq_tdata, output reg [C_CQ_KEEP_WIDTH-1:0] s_axis_cq_tkeep, output reg s_axis_cq_tlast, output reg s_axis_cq_tvalid, output reg [C_S_AXIS_CQ_USER_WIDTH -1:0] s_axis_cq_tuser ); localparam RX_IDLE = 3'd0; localparam RX_DW0_DW1 = 3'd1; localparam RX_DW2 = 3'd2; localparam RX_WAIT = 3'd3; //PCIe TLP Completion fields wire sop; // Start of packet reg in_packet_q; // PCIe Write request signals reg rd_req_signal; reg wr_req_signal; reg [63:0] req_addr; reg [31:0] req_data; reg [10:0] req_len; // Only 1-256DW supported; No need to check special 1024DW condition reg [15:0] req_rid; reg [7:0] req_tag; reg [2:0] req_attr; reg [4:0] req_type; reg [1:0] req_fmt; reg req_mesg; reg [7:0] req_msg_code; reg req_VDM; reg req_ATS; reg req_OBFF; reg req_LTR; reg req_id_en; reg req_ep; reg req_wr; reg [2:0] req_tc; reg req_rro; reg [3:0] req_fbe; reg [3:0] req_lbe; reg req_4dw; reg [2:0] req_bar_id; reg [1:0] req_at; reg [2:0] state; reg done; // Generate a signal that indicates if we are currently receiving a packet. // This value is one clock cycle delayed from what is actually on the AXIS // data bus. always @(posedge clk) begin if(user_reset) in_packet_q <= # TCQ 1'b0; else if (m_axis_rx_tvalid && m_axis_rx_tready && m_axis_rx_tlast) in_packet_q <= # TCQ 1'b0; else if (sop && m_axis_rx_tready) in_packet_q <= # TCQ 1'b1; end assign sop =!in_packet_q && m_axis_rx_tvalid; generate if (C_AXI_DATA_WIDTH == 64) begin : tx_64 always @ ( posedge clk ) begin if (user_reset) begin req_addr <= #TCQ 64'b0; req_len <= #TCQ 11'b0; req_rid <= #TCQ 16'b0; req_tag <= #TCQ 8'b0; req_id_en <= #TCQ 1'b0; req_mesg <= #TCQ 1'b0; req_msg_code <= #TCQ 8'b0; req_VDM <= #TCQ 1'b0; req_ATS <= #TCQ 1'b0; req_OBFF <= #TCQ 1'b0; req_LTR <= #TCQ 1'b0; req_ep <= #TCQ 1'b0; req_wr <= #TCQ 1'b0; req_type <= #TCQ 5'b0; req_fmt <= #TCQ 2'b0; req_fbe <= #TCQ 4'b0; req_rid <= #TCQ 16'b0; req_data <= #TCQ 32'b0; req_lbe <= #TCQ 4'b0; req_tc <= #TCQ 3'b0; req_attr <= #TCQ 3'b0; req_4dw <= #TCQ 1'b0; req_bar_id <= #TCQ 3'b0; req_at <= #TCQ 2'b0; state <= #TCQ RX_IDLE; end else begin case (state) RX_IDLE : begin req_addr <= #TCQ 64'b0; if (sop) begin req_len <= #TCQ {1'b0, m_axis_rx_tdata[9:0]}; req_at <= #TCQ m_axis_rx_tdata[11:10]; req_attr <= #TCQ {m_axis_rx_tdata[18], m_axis_rx_tdata[13:12]}; req_ep <= #TCQ m_axis_rx_tdata[14]; req_tc <= #TCQ m_axis_rx_tdata[22:20]; req_type <= #TCQ m_axis_rx_tdata[28:24]; req_fmt <= #TCQ m_axis_rx_tdata[30:29]; req_4dw <= #TCQ m_axis_rx_tdata[29]; req_wr <= #TCQ m_axis_rx_tdata[30]; req_fbe <= #TCQ (m_axis_rx_tdata[28] == 1'b0)? m_axis_rx_tdata[35:32] : 4'b0; req_lbe <= #TCQ (m_axis_rx_tdata[28] == 1'b0)? m_axis_rx_tdata[39:36] : 4'b0; req_mesg <= #TCQ (m_axis_rx_tdata[28])? 1'b1 : 1'b0; req_msg_code <= #TCQ (m_axis_rx_tdata[28])? m_axis_rx_tdata[39:32] : 8'b0; req_VDM <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:33] == 7'b0111_111))? 1'b1 : 1'b0; req_ATS <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:32] == 8'b0000_0001 || m_axis_rx_tdata[39:32] == 8'b0000_0010 || m_axis_rx_tdata[39:32] == 8'b0000_0100 || m_axis_rx_tdata[39:32] == 8'b0000_0101)) ? 1'b1 : 1'b0; req_OBFF <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:32] == 8'b0001_0010))? 1'b1 : 1'b0; req_LTR <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:32] == 8'b0001_0000))? 1'b1 : 1'b0; req_tag <= #TCQ m_axis_rx_tdata[47:40]; req_rid <= #TCQ m_axis_rx_tdata[63:48]; req_bar_id <= #TCQ (m_axis_rx_tuser[2])? 3'b0 : (m_axis_rx_tuser[3])? 3'b1 : (m_axis_rx_tuser[4])? 3'h2 : (m_axis_rx_tuser[5])? 3'h3 : (m_axis_rx_tuser[6])? 3'h4 : 3'h5; state <= #TCQ RX_DW0_DW1; end else begin req_len <= #TCQ 11'b0; req_at <= #TCQ 2'b0; req_attr <= #TCQ 3'b0; req_ep <= #TCQ 1'b0; req_tc <= #TCQ 3'b0; req_type <= #TCQ 5'b0; req_fmt <= #TCQ 2'b0; req_fbe <= #TCQ 4'b0; req_lbe <= #TCQ 4'b0; req_mesg <= #TCQ 1'b0; req_msg_code <= #TCQ 8'b0; req_VDM <= #TCQ 1'b0; req_ATS <= #TCQ 1'b0; req_OBFF <= #TCQ 1'b0; req_LTR <= #TCQ 1'b0; req_tag <= #TCQ 8'b0; req_rid <= #TCQ 16'b0; req_bar_id <= #TCQ 3'b0; state <= #TCQ RX_IDLE; end end RX_DW0_DW1 : begin req_len <= #TCQ req_len; req_at <= #TCQ req_at; req_attr <= #TCQ req_attr; req_ep <= #TCQ req_ep; req_tc <= #TCQ req_tc; req_type <= #TCQ req_type; req_fmt <= #TCQ req_fmt; req_4dw <= #TCQ req_4dw; req_wr <= #TCQ req_wr; req_fbe <= #TCQ req_fbe; req_lbe <= #TCQ req_lbe; req_mesg <= #TCQ req_mesg; req_msg_code <= #TCQ req_msg_code; req_VDM <= #TCQ req_VDM; req_ATS <= #TCQ req_ATS; req_OBFF <= #TCQ req_OBFF; req_LTR <= #TCQ req_LTR; req_tag <= #TCQ req_tag; req_rid <= #TCQ req_rid; req_bar_id <= #TCQ req_bar_id; if (req_4dw || (req_fmt[1] && req_mesg)) begin req_addr <= #TCQ {m_axis_rx_tdata[31:0], m_axis_rx_tdata[63:32]}; req_data <= #TCQ 32'b0; end else begin req_addr <= #TCQ {32'b0, m_axis_rx_tdata[31:0]}; req_data <= #TCQ m_axis_rx_tdata[63:32]; end if (s_axis_cq_tready) begin state <= #TCQ RX_DW2; end else begin state <= #TCQ RX_DW0_DW1; end end RX_DW2 : begin req_len <= #TCQ req_len; req_at <= #TCQ req_at; req_attr <= #TCQ req_attr; req_ep <= #TCQ req_ep; req_tc <= #TCQ req_tc; req_type <= #TCQ req_type; req_fmt <= #TCQ req_fmt; req_4dw <= #TCQ req_4dw; req_wr <= #TCQ req_wr; req_fbe <= #TCQ req_fbe; req_lbe <= #TCQ req_lbe; req_mesg <= #TCQ req_mesg; req_msg_code <= #TCQ req_msg_code; req_VDM <= #TCQ req_VDM; req_ATS <= #TCQ req_ATS; req_OBFF <= #TCQ req_OBFF; req_LTR <= #TCQ req_LTR; req_tag <= #TCQ req_tag; req_rid <= #TCQ req_rid; req_addr <= #TCQ req_addr; req_bar_id <= #TCQ req_bar_id; req_data <= #TCQ (req_4dw || (req_fmt[1] && req_mesg))? m_axis_rx_tdata[31:0] : req_data; if (s_axis_cq_tready) begin if ( (req_fmt[1] && req_mesg) || (!done) ) state <= #TCQ RX_WAIT; else begin // if (done) if (sop) begin req_len <= #TCQ {1'b0, m_axis_rx_tdata[9:0]}; req_at <= #TCQ m_axis_rx_tdata[11:10]; req_attr <= #TCQ {m_axis_rx_tdata[18], m_axis_rx_tdata[13:12]}; req_ep <= #TCQ m_axis_rx_tdata[14]; req_tc <= #TCQ m_axis_rx_tdata[22:20]; req_type <= #TCQ m_axis_rx_tdata[28:24]; req_fmt <= #TCQ m_axis_rx_tdata[30:29]; req_4dw <= #TCQ m_axis_rx_tdata[29]; req_wr <= #TCQ m_axis_rx_tdata[30]; req_fbe <= #TCQ (m_axis_rx_tdata[28] == 1'b0)? m_axis_rx_tdata[35:32] : 4'b0; req_lbe <= #TCQ (m_axis_rx_tdata[28] == 1'b0)? m_axis_rx_tdata[39:36] : 4'b0; req_mesg <= #TCQ (m_axis_rx_tdata[28])? 1'b1 : 1'b0; req_msg_code <= #TCQ (m_axis_rx_tdata[28])? m_axis_rx_tdata[39:32] : 8'b0; req_VDM <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:33] == 7'b0111_111))? 1'b1 : 1'b0; req_ATS <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:32] == 8'b0000_0001 || m_axis_rx_tdata[39:32] == 8'b0000_0010 || m_axis_rx_tdata[39:32] == 8'b0000_0100 || m_axis_rx_tdata[39:32] == 8'b0000_0101)) ? 1'b1 : 1'b0; req_OBFF <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:32] == 8'b0001_0010))? 1'b1 : 1'b0; req_LTR <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:32] == 8'b0001_0000))? 1'b1 : 1'b0; req_tag <= #TCQ m_axis_rx_tdata[47:40]; req_rid <= #TCQ m_axis_rx_tdata[63:48]; req_bar_id <= #TCQ (m_axis_rx_tuser[2])? 3'b0 : (m_axis_rx_tuser[3])? 3'b1 : (m_axis_rx_tuser[4])? 3'h2 : (m_axis_rx_tuser[5])? 3'h3 : (m_axis_rx_tuser[6])? 3'h4 : 3'h5; state <= #TCQ RX_DW0_DW1; end else begin state <= #TCQ RX_IDLE; end end // if (done) end else begin state <= #TCQ RX_DW2; end end RX_WAIT : begin req_len <= #TCQ req_len; req_at <= #TCQ req_at; req_attr <= #TCQ req_attr; req_ep <= #TCQ req_ep; req_tc <= #TCQ req_tc; req_type <= #TCQ req_type; req_fmt <= #TCQ req_fmt; req_4dw <= #TCQ req_4dw; req_wr <= #TCQ req_wr; req_fbe <= #TCQ req_fbe; req_lbe <= #TCQ req_lbe; req_mesg <= #TCQ req_mesg; req_msg_code <= #TCQ req_msg_code; req_VDM <= #TCQ req_VDM; req_ATS <= #TCQ req_ATS; req_OBFF <= #TCQ req_OBFF; req_LTR <= #TCQ req_LTR; req_tag <= #TCQ req_tag; req_rid <= #TCQ req_rid; req_addr <= #TCQ req_addr; req_data <= #TCQ req_data; req_bar_id <= #TCQ req_bar_id; if (s_axis_cq_tready && done) begin if (sop) begin req_len <= #TCQ {1'b0, m_axis_rx_tdata[9:0]}; req_at <= #TCQ m_axis_rx_tdata[11:10]; req_attr <= #TCQ {m_axis_rx_tdata[18], m_axis_rx_tdata[13:12]}; req_ep <= #TCQ m_axis_rx_tdata[14]; req_tc <= #TCQ m_axis_rx_tdata[22:20]; req_type <= #TCQ m_axis_rx_tdata[28:24]; req_fmt <= #TCQ m_axis_rx_tdata[30:29]; req_4dw <= #TCQ m_axis_rx_tdata[29]; req_wr <= #TCQ m_axis_rx_tdata[30]; req_fbe <= #TCQ (m_axis_rx_tdata[28] == 1'b0)? m_axis_rx_tdata[35:32] : 4'b0; req_lbe <= #TCQ (m_axis_rx_tdata[28] == 1'b0)? m_axis_rx_tdata[39:36] : 4'b0; req_mesg <= #TCQ (m_axis_rx_tdata[28])? 1'b1 : 1'b0; req_msg_code <= #TCQ (m_axis_rx_tdata[28])? m_axis_rx_tdata[39:32] : 8'b0; req_VDM <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:33] == 7'b0111_111))? 1'b1 : 1'b0; req_ATS <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:32] == 8'b0000_0001 || m_axis_rx_tdata[39:32] == 8'b0000_0010 || m_axis_rx_tdata[39:32] == 8'b0000_0100 || m_axis_rx_tdata[39:32] == 8'b0000_0101)) ? 1'b1 : 1'b0; req_OBFF <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:32] == 8'b0001_0010))? 1'b1 : 1'b0; req_LTR <= #TCQ (m_axis_rx_tdata[28] && (m_axis_rx_tdata[39:32] == 8'b0001_0000))? 1'b1 : 1'b0; req_tag <= #TCQ m_axis_rx_tdata[47:40]; req_rid <= #TCQ m_axis_rx_tdata[63:48]; req_bar_id <= #TCQ (m_axis_rx_tuser[2])? 3'b0 : (m_axis_rx_tuser[3])? 3'b1 : (m_axis_rx_tuser[4])? 3'h2 : (m_axis_rx_tuser[5])? 3'h3 : (m_axis_rx_tuser[6])? 3'h4 : 3'h5; state <= #TCQ RX_DW0_DW1; end else begin state <= #TCQ RX_IDLE; end end else begin state <= #TCQ RX_WAIT; end end endcase end end always @(*) begin if (user_reset) begin s_axis_cq_tdata = 64'b0; s_axis_cq_tvalid = 1'b0; s_axis_cq_tkeep = 2'h0; s_axis_cq_tlast = 1'b0; s_axis_cq_tuser = 85'h0; m_axis_rx_tready = 1'b1; done = 1'b0; end else begin case (state) RX_DW0_DW1 : begin if (req_mesg) begin // Message Type Header if (req_VDM) begin // Vendor Defined Messages Type 0/1 s_axis_cq_tdata = {m_axis_rx_tdata[63:32], m_axis_rx_tdata[15:0], m_axis_rx_tdata[31:16]}; end else if (req_ATS) begin // ATS Messages s_axis_cq_tdata = m_axis_rx_tdata[63:0]; end else if (req_LTR) begin // LTR Messages s_axis_cq_tdata = {m_axis_rx_tdata[31:0], m_axis_rx_tdata[63:32]}; end else if (req_OBFF) begin // OBFF Messages s_axis_cq_tdata = m_axis_rx_tdata[63:0]; end else begin // Other Messages -- Assign Address [63:0] field but should be treated as reserved by receiver unless Routed by Address s_axis_cq_tdata = {m_axis_rx_tdata[31:0], m_axis_rx_tdata[63:32]}; end s_axis_cq_tuser = {44'b0, 1'b1, 32'b0, (req_wr)? {4'b1111, 4'b1111} : {4'b0000, 4'b0000} }; //SOP is set and FBE/LBE is set only if it has payload end else begin // Non-Message Type Header s_axis_cq_tdata = (req_4dw)? {m_axis_rx_tdata[31:0], m_axis_rx_tdata[63:34], req_at} : {32'b0, m_axis_rx_tdata[31:2], req_at}; s_axis_cq_tuser = {44'b0, 1'b1, 36'b0, req_fbe}; //SOP and FBE set end s_axis_cq_tvalid = (req_mesg)? 1'b0 : 1'b1; // Filter out all Messages as DMA IP doesn't handle Message TLP s_axis_cq_tkeep = 2'h3; s_axis_cq_tlast = 1'b0; m_axis_rx_tready = s_axis_cq_tready; done = 1'b0; end RX_DW2 : begin s_axis_cq_tdata = { 1'b0, req_attr, req_tc, 6'b0, (req_mesg? req_type[2:0] : req_bar_id), (req_mesg? req_msg_code : 8'b0), req_tag, req_rid, 1'b0, ( req_mesg? (req_VDM? 4'b1101 : (req_ATS? 4'b1110 : 4'b1100) ) : (req_wr? 4'b1 : 4'b0) ), req_len }; s_axis_cq_tvalid = (req_mesg)? 1'b0 : 1'b1; // Filter out all Messages as DMA IP doesn't handle Message TLP s_axis_cq_tkeep = 2'h3; if (!req_mesg) begin s_axis_cq_tlast = (req_wr)? 1'b0 : 1'b1; done = (req_wr)? 1'b0 : 1'b1; s_axis_cq_tuser = {81'b0, req_fbe} ; // FBE set end else begin s_axis_cq_tlast = (req_fmt[1])? 1'b0 : 1'b1; //MsgD or Msg done = (req_fmt[1])? 1'b0 : 1'b1; s_axis_cq_tuser = 85'b0 ; // FBE set end m_axis_rx_tready = ( (req_fmt[1] && req_mesg) || req_wr )? 1'b0 : s_axis_cq_tready; end RX_WAIT : begin if (!req_mesg ) begin s_axis_cq_tdata = req_addr[2]? {{req_data[7:0], req_data[15:8], req_data[23:16], req_data[31:24]}, 32'b0} : {32'b0, {req_data[7:0], req_data[15:8], req_data[23:16], req_data[31:24]}}; s_axis_cq_tuser = {73'b0, (req_addr[2]? 8'hF0 : 8'h0F), 4'b0, req_fbe} ; s_axis_cq_tkeep = req_addr[2]? 2'h3 : 2'h1; end else begin s_axis_cq_tdata = {32'b0, {req_data[7:0], req_data[15:8], req_data[23:16], req_data[31:24]}}; s_axis_cq_tuser = {69'b0, (req_addr[2]? 8'hF0 : 8'h0F), 4'b0, 4'b0}; //Supplying only byte_en for MsgD s_axis_cq_tkeep = 2'h1; end s_axis_cq_tvalid = (req_mesg)? 1'b0 : 1'b1; // Filter out all Messages as DMA IP doesn't handle Message TLP s_axis_cq_tlast = 1'b1; done = 1'b1; m_axis_rx_tready = s_axis_cq_tready; end default : begin s_axis_cq_tdata = 64'b0; s_axis_cq_tvalid = 1'b0; s_axis_cq_tkeep = 2'h0; s_axis_cq_tlast = 1'b0; s_axis_cq_tuser = 85'b0; m_axis_rx_tready = 1'b1; done = 1'b0; end endcase end end end endgenerate generate if (C_AXI_DATA_WIDTH == 128) begin : tx_128 wire [2:0] req_bar; always @ ( posedge clk ) begin if (user_reset ) begin req_4dw <= #TCQ 1'b0; req_addr <= #TCQ 64'b0; req_data <= #TCQ 32'b0; state <= #TCQ RX_IDLE; end else begin case (state) RX_IDLE : begin if (sop) begin req_4dw <= #TCQ m_axis_rx_tdata[29]; req_data <= #TCQ (m_axis_rx_tdata[29])? 32'b0 : {m_axis_rx_tdata[103:96], m_axis_rx_tdata[111:104], m_axis_rx_tdata[119:112], m_axis_rx_tdata[127:120]};//m_axis_rx_tdata[127:96]; req_addr <= #TCQ (m_axis_rx_tdata[29])? {m_axis_rx_tdata[95:64], m_axis_rx_tdata[127:96]} : {32'b0, m_axis_rx_tdata[95:64]}; req_mesg <= #TCQ (m_axis_rx_tdata[28])? 1'b1 : 1'b0; state <= #TCQ (s_axis_cq_tready)? ( (m_axis_rx_tdata[30])? RX_DW2 : RX_IDLE) : RX_IDLE ; //Mem Rd end else begin req_4dw <= #TCQ 1'b0; req_data <= #TCQ 32'b0; req_addr <= #TCQ 64'b0; state <= #TCQ RX_IDLE; end end RX_DW2 : begin req_4dw <= #TCQ req_4dw; req_data <= #TCQ (req_4dw)? m_axis_rx_tdata[31:0] : req_data; req_addr <= #TCQ req_addr; req_mesg <= #TCQ req_mesg; if (s_axis_cq_tready) begin state <= #TCQ RX_IDLE; end else begin state <= #TCQ RX_DW2; end end endcase end end assign req_bar = (m_axis_rx_tuser[2])? 3'b0 : (m_axis_rx_tuser[3])? 3'b1 : (m_axis_rx_tuser[4])? 3'h2 : (m_axis_rx_tuser[5])? 3'h3 : (m_axis_rx_tuser[6])? 3'h4 : 3'h5; always @(*) begin if (user_reset ) begin s_axis_cq_tdata = 128'b0; s_axis_cq_tvalid = 1'b0; s_axis_cq_tkeep = 2'h0; s_axis_cq_tlast = 1'b0; s_axis_cq_tuser = 85'h0; m_axis_rx_tready = 1'b0; done = 1'b0; end else begin case (state) RX_IDLE : begin if (sop) begin if (m_axis_rx_tdata[28]) begin // Message TLP if (m_axis_rx_tdata[39:33] == 7'b0111_111) begin // Vendor Defined Message Type 0/1 s_axis_cq_tdata = { 1'b0, req_attr, req_tc, 6'b0, m_axis_rx_tdata[26:24], m_axis_rx_tdata[39:32], m_axis_rx_tdata[47:40], m_axis_rx_tdata[63:48], 1'b0, 4'b1101, {1'b0, m_axis_rx_tdata[9:0]}, m_axis_rx_tdata[127:96], m_axis_rx_tdata[79:64], m_axis_rx_tdata[95:80] }; end else if (m_axis_rx_tdata[39:32] == 8'b0000_0001 || m_axis_rx_tdata[39:32] == 8'b0000_0010 || m_axis_rx_tdata[39:32] == 8'b0000_0100 || m_axis_rx_tdata[39:32] == 8'b0000_0101) begin // ATS Message s_axis_cq_tdata = { 1'b0, req_attr, req_tc, 6'b0, m_axis_rx_tdata[26:24], m_axis_rx_tdata[39:32], m_axis_rx_tdata[47:40], m_axis_rx_tdata[63:48], 1'b0, 4'b1110, {1'b0, m_axis_rx_tdata[9:0]}, m_axis_rx_tdata[63:0] }; end else if (m_axis_rx_tdata[39:32] == 8'b0001_0010) begin // OBFF Message s_axis_cq_tdata = { 1'b0, req_attr, req_tc, 6'b0, m_axis_rx_tdata[26:24], m_axis_rx_tdata[39:32], m_axis_rx_tdata[47:40], m_axis_rx_tdata[63:48], 1'b0, 4'b1100, {1'b0, m_axis_rx_tdata[9:0]}, m_axis_rx_tdata[63:0] }; end else if (m_axis_rx_tdata[39:32] == 8'b0001_0000) begin // LTR Message s_axis_cq_tdata = { 1'b0, req_attr, req_tc, 6'b0, m_axis_rx_tdata[26:24], m_axis_rx_tdata[39:32], m_axis_rx_tdata[47:40], m_axis_rx_tdata[63:48], 1'b0, 4'b1100, {1'b0, m_axis_rx_tdata[9:0]}, m_axis_rx_tdata[31:0], m_axis_rx_tdata[63:32] }; end else begin // Other Messages s_axis_cq_tdata = { 1'b0, req_attr, req_tc, 6'b0, m_axis_rx_tdata[26:24], m_axis_rx_tdata[39:32], m_axis_rx_tdata[47:40], m_axis_rx_tdata[63:48], 1'b0, 4'b1100, {1'b0, m_axis_rx_tdata[9:0]}, m_axis_rx_tdata[31:0], m_axis_rx_tdata[63:32] }; end s_axis_cq_tuser = {44'b0, 1'b1, 32'b0, (m_axis_rx_tdata[30])? {4'b1111, 4'b1111} : {4'b0000, 4'b0000} }; //SOP is set and FBE/LBE is set only if it has payload end else begin // Non-Message TLP s_axis_cq_tdata = { 1'b0, {m_axis_rx_tdata[18], m_axis_rx_tdata[13:12]}, m_axis_rx_tdata[22:20], 6'b0, req_bar, 8'b0, m_axis_rx_tdata[47:40], m_axis_rx_tdata[63:48], 1'b0, {3'b0, m_axis_rx_tdata[30]}, {1'b0, m_axis_rx_tdata[9:0]}, (m_axis_rx_tdata[29]? {m_axis_rx_tdata[95:64], m_axis_rx_tdata[127:98]} : ({32'b0, m_axis_rx_tdata[95:66]})), m_axis_rx_tdata[11:10] }; s_axis_cq_tuser = {44'b0, 1'b1, 32'b0, m_axis_rx_tdata[39:32]}; end s_axis_cq_tvalid = m_axis_rx_tdata[28]? 1'b0 : 1'b1; // Filter out all Messages as DMA IP doesn't handle Message TLP s_axis_cq_tkeep = 4'hF; s_axis_cq_tlast = (m_axis_rx_tdata[30])? 1'b0 : 1'b1; // s_axis_cq_tuser = {44'b0, 1'b1, 40'b0 }; //: 85'b0; //SOP set m_axis_rx_tready = s_axis_cq_tready; end else begin s_axis_cq_tdata = 128'b0; s_axis_cq_tvalid = 1'b0; s_axis_cq_tkeep = 4'h0; s_axis_cq_tlast = 1'b0; s_axis_cq_tuser = 85'b0; m_axis_rx_tready = s_axis_cq_tready; end end RX_DW2 : begin if (req_4dw) begin case (req_addr[3:2]) 2'd0: begin s_axis_cq_tdata = {96'b0, m_axis_rx_tdata[7:0], m_axis_rx_tdata[15:8], m_axis_rx_tdata[23:16], m_axis_rx_tdata[31:24]}; s_axis_cq_tuser = {45'b0, 32'h000F, 8'b0}; s_axis_cq_tkeep = 4'b0001; end 2'd1: begin s_axis_cq_tdata = {64'b0, m_axis_rx_tdata[7:0], m_axis_rx_tdata[15:8], m_axis_rx_tdata[23:16], m_axis_rx_tdata[31:24], 32'b0}; s_axis_cq_tuser = {45'b0, 32'h00F0, 8'b0}; s_axis_cq_tkeep = 4'b0011; end 2'd2: begin s_axis_cq_tdata = {32'b0, m_axis_rx_tdata[7:0], m_axis_rx_tdata[15:8], m_axis_rx_tdata[23:16], m_axis_rx_tdata[31:24], 64'b0}; s_axis_cq_tuser = {45'b0, 32'h0F00, 8'b0}; s_axis_cq_tkeep = 4'b0111; end 2'd3: begin s_axis_cq_tdata = {m_axis_rx_tdata[7:0], m_axis_rx_tdata[15:8], m_axis_rx_tdata[23:16], m_axis_rx_tdata[31:24], 96'b0}; s_axis_cq_tuser = {45'b0, 32'hF000, 8'b0}; s_axis_cq_tkeep = 4'b1111; end endcase end else begin case (req_addr[3:2]) 2'd0: begin s_axis_cq_tdata = {96'b0, req_data[31:0]}; s_axis_cq_tuser = {45'b0, 32'h000F, 8'b0}; s_axis_cq_tkeep = 4'b0001; end 2'd1: begin s_axis_cq_tdata = {64'b0, req_data[31:0], 32'b0}; s_axis_cq_tuser = {45'b0, 32'h00F0, 8'b0}; s_axis_cq_tkeep = 4'b0011; end 2'd2: begin s_axis_cq_tdata = {32'b0, req_data[31:0], 64'b0}; s_axis_cq_tuser = {45'b0, 32'h0F00, 8'b0}; s_axis_cq_tkeep = 4'b0111; end 2'd3: begin s_axis_cq_tdata = {req_data[31:0], 96'b0}; s_axis_cq_tuser = {45'b0, 32'hF000, 8'b0}; s_axis_cq_tkeep = 4'b1111; end endcase end s_axis_cq_tvalid = (req_mesg)? 1'b0 : 1'b1; // Filter out all Messages as DMA IP doesn't handle Message TLP s_axis_cq_tlast = 1'b1; // s_axis_cq_tuser = 85'b0 ; // FBE set m_axis_rx_tready = (req_4dw)? s_axis_cq_tready : 1'b0; end default : begin s_axis_cq_tdata = 128'b0; s_axis_cq_tvalid = 1'b0; s_axis_cq_tkeep = 4'h0; s_axis_cq_tlast = 1'b0; s_axis_cq_tuser = 85'b0; m_axis_rx_tready = s_axis_cq_tready; end endcase end end end endgenerate endmodule ======================= File: xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_tgt_cpl.sv ======================= //----------------------------------------------------------------------------- // // (c) Copyright 2012-2012 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant any // rights to the materials distributed herewith. Except as // otherwise provided in a valid license issued to you by // Xilinx, and to the maximum extent permitted by applicable // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND // WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES // AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING // BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- // INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and // (2) Xilinx shall not be liable (whether in contract or tort, // including negligence, or under any other theory of // liability) for any loss or damage of any kind or nature // related to, arising under or in connection with these // materials, including for any direct, or any indirect, // special, incidental, or consequential loss or damage // (including loss of data, profits, goodwill, or any type of // loss or damage suffered as a result of any action brought // by a third party) even if such damage or loss was // reasonably foreseeable or Xilinx had been advised of the // possibility of the same. // // CRITICAL APPLICATIONS // Xilinx products are not designed or intended to be fail- // safe, or for use in any application requiring fail-safe // performance, such as life-support or safety devices or // systems, Class III medical devices, nuclear facilities, // applications related to the deployment of airbags, or any // other applications that could lead to death, personal // injury, or severe property or environmental damage // (individually and collectively, "Critical // Applications"). Customer assumes the sole risk and // liability of any use of Xilinx products in Critical // Applications, subject only to applicable laws and // regulations governing limitations on product liability. // // THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS // PART OF THIS FILE AT ALL TIMES. // //----------------------------------------------------------------------------- // // Project : The Xilinx PCI Express DMA // File : xdma_0_tgt_cpl.sv // Version : 4.1 //----------------------------------------------------------------------------- //----------------------------------------------------------------------------// // File : <ComponentName>_tgt_cpl.v // // Date : 12/04/15 // // Author : <NAME> // // // // Description: // // Generates Gen2 PCIe tx packets // // // // Notes: // // 64-bit and 128-bit are supported. Module can handle only 1DW completion // // for 128-bit interface // // // // Hierarchical: // // pcie2_to_pcie3_wrapper // // axi_stream_intf // // tgt_cpl // // // //----------------------------------------------------------------------------// `timescale 1ps/1ps module xdma_0_tgt_cpl # ( parameter C_AXI_DATA_WIDTH = 64, parameter C_KEEP_WIDTH = C_AXI_DATA_WIDTH/8, parameter C_CC_KEEP_WIDTH = C_AXI_DATA_WIDTH/32, parameter C_S_AXIS_CC_USER_WIDTH = 33, parameter TCQ = 1 ) ( input clk, input user_reset, input [C_AXI_DATA_WIDTH-1:0] m_axis_cc_tdata, input m_axis_cc_tvalid, output reg [3:0] m_axis_cc_tready, input [C_CC_KEEP_WIDTH-1:0] m_axis_cc_tkeep, input m_axis_cc_tlast, input [C_S_AXIS_CC_USER_WIDTH-1:0] m_axis_cc_tuser, output reg [C_AXI_DATA_WIDTH-1:0] s_axis_tx_tdata, output reg [C_KEEP_WIDTH-1:0] s_axis_tx_tkeep, output reg s_axis_tx_tlast, output reg s_axis_tx_tvalid, input s_axis_tx_tready, output reg [3:0] s_axis_tx_tuser, //------------------------------------------------- // Completer ID //------------------------------------------------- input [7:0] cfg_bus_number, input [4:0] cfg_device_number, input [2:0] cfg_function_number ); localparam TX_IDLE = 3'b0; localparam TX_DW0_DW1 = 3'd1; localparam TX_DW2 = 3'd2; localparam TX_WAIT = 3'd3; reg compl_signal; reg [9:0] compl_len; reg [6:0] compl_addr; reg [1:0] compl_at; reg [15:0] compl_rid; reg [15:0] compl_cid; reg [7:0] compl_tag; reg [C_AXI_DATA_WIDTH-1:0] compl_data; reg [11:0] compl_byte; reg [2:0] compl_status; reg compl_lck; reg compl_ep; reg [2:0] compl_tc; reg [2:0] compl_attr; reg compl_ecrc; reg [2:0] state; wire sop; // Start of Packet reg in_packet_q; // Generate a signal that indicates if we are currently receiving a packet. // This value is one clock cycle delayed from what is actually on the AXIS // data bus. always @(posedge clk) begin if(user_reset) in_packet_q <= # TCQ 1'b0; else if (m_axis_cc_tvalid && s_axis_tx_tready && m_axis_cc_tlast) in_packet_q <= # TCQ 1'b0; else if (sop && s_axis_tx_tready) in_packet_q <= # TCQ 1'b1; end assign sop =!in_packet_q && m_axis_cc_tvalid; generate if (C_AXI_DATA_WIDTH == 64) begin : tx_64 always @ ( posedge clk ) begin if (user_reset) begin compl_addr <= #TCQ 7'b0; compl_at <= #TCQ 2'b0; compl_byte <= #TCQ 12'b0; compl_len <= #TCQ 11'b0; compl_status <= #TCQ 3'b0; compl_ep <= #TCQ 1'b0; compl_rid <= #TCQ 16'b0; compl_tag <= #TCQ 8'b0; compl_cid <= #TCQ 16'b0; compl_tc <= #TCQ 3'b0; compl_attr <= #TCQ 3'b0; compl_ecrc <= #TCQ 1'b0; compl_data <= #TCQ 64'b0; state <= #TCQ TX_IDLE; end else begin case (state) TX_IDLE : begin compl_tag <= #TCQ compl_tag; compl_cid <= #TCQ compl_cid; compl_data <= #TCQ compl_data; if (sop) begin compl_addr <= #TCQ m_axis_cc_tdata[6:0]; compl_at <= #TCQ m_axis_cc_tdata[9:8]; compl_byte <= #TCQ m_axis_cc_tdata[27:16]; compl_len <= #TCQ m_axis_cc_tdata[41:32]; compl_status <= #TCQ m_axis_cc_tdata[45:43]; compl_ep <= #TCQ m_axis_cc_tdata[46]; compl_rid <= #TCQ m_axis_cc_tdata[63:48]; state <= #TCQ TX_DW0_DW1; end end TX_DW0_DW1 : begin compl_addr <= #TCQ compl_addr; compl_at <= #TCQ compl_at; compl_byte <= #TCQ compl_byte; compl_len <= #TCQ compl_len; compl_status <= #TCQ compl_status; compl_ep <= #TCQ compl_ep; compl_rid <= #TCQ compl_rid; compl_tag <= #TCQ m_axis_cc_tdata[7:0]; compl_cid <= #TCQ m_axis_cc_tdata[23:8]; compl_tc <= #TCQ m_axis_cc_tdata[27:25]; compl_attr <= #TCQ m_axis_cc_tdata[30:28]; compl_ecrc <= #TCQ m_axis_cc_tdata[31]; compl_data <= #TCQ compl_data; state <= #TCQ (s_axis_tx_tready)? TX_DW2 : TX_DW0_DW1; end TX_DW2 : begin compl_addr <= #TCQ compl_addr; compl_at <= #TCQ compl_at; compl_byte <= #TCQ compl_byte; compl_len <= #TCQ compl_len; compl_status <= #TCQ compl_status; compl_ep <= #TCQ compl_ep; compl_rid <= #TCQ compl_rid; compl_tag <= #TCQ compl_tag; compl_cid <= #TCQ compl_cid; compl_tc <= #TCQ compl_tc; compl_attr <= #TCQ compl_attr; compl_ecrc <= #TCQ compl_ecrc; compl_data <= #TCQ (compl_addr[2])? {32'b0, m_axis_cc_tdata[63:32]} : m_axis_cc_tdata[63:0]; state <= #TCQ (s_axis_tx_tready)? ( (m_axis_cc_tvalid && m_axis_cc_tlast)? TX_IDLE : TX_WAIT ) : TX_DW2; end TX_WAIT : begin compl_addr <= #TCQ compl_addr; compl_at <= #TCQ compl_at; compl_byte <= #TCQ compl_byte; compl_len <= #TCQ compl_len; compl_status <= #TCQ compl_status; compl_ep <= #TCQ compl_ep; compl_rid <= #TCQ compl_rid; compl_tag <= #TCQ compl_tag; compl_cid <= #TCQ compl_cid; compl_tc <= #TCQ compl_tc; compl_attr <= #TCQ compl_attr; compl_ecrc <= #TCQ compl_ecrc; compl_data <= #TCQ m_axis_cc_tdata[63:0]; state <= #TCQ (s_axis_tx_tready && m_axis_cc_tvalid && m_axis_cc_tlast)? TX_IDLE : TX_WAIT; end endcase end end always @ (*) begin if (user_reset) begin s_axis_tx_tdata = 64'b0; s_axis_tx_tvalid = 1'b0; s_axis_tx_tkeep = 8'h0; s_axis_tx_tlast = 2'b0; s_axis_tx_tuser = 4'h0; m_axis_cc_tready = 4'hF; end else begin case (state) TX_DW0_DW1 : begin s_axis_tx_tdata = { {m_axis_cc_tdata[24]? m_axis_cc_tdata[23:8] : {cfg_bus_number, cfg_device_number, cfg_function_number}}, //Completer ID compl_status, 1'b0, //BCM compl_byte, 1'b0, //Reserved 2'h2, //CplD fmt 5'hA, //CplD type 1'b0, m_axis_cc_tdata[27:25], //TC 1'b0, //Reserved m_axis_cc_tdata[30], //ID Based Ordering 1'b0, //Reserved 1'b0, //TPH 1'b0, //TD compl_ep, m_axis_cc_tdata[29:28], //compl_attr compl_at, compl_len }; m_axis_cc_tready = {4{s_axis_tx_tready}}; s_axis_tx_tvalid = 1'b1; s_axis_tx_tkeep = 8'hFF; s_axis_tx_tlast = 2'b0; s_axis_tx_tuser = 4'h0; end TX_DW2 : begin s_axis_tx_tdata = { (compl_addr[2])? {m_axis_cc_tdata[39:32], m_axis_cc_tdata[47:40], m_axis_cc_tdata[55:48],m_axis_cc_tdata[63:56]} : {m_axis_cc_tdata[7:0], m_axis_cc_tdata[15:8], m_axis_cc_tdata[23:16], m_axis_cc_tdata[31:24] }, compl_rid, compl_tag, 1'b0, compl_addr }; m_axis_cc_tready = {4{s_axis_tx_tready}}; s_axis_tx_tvalid = 1'b1; s_axis_tx_tkeep = (compl_status!= 3'b0)? 8'h3F : 8'hFF; s_axis_tx_tlast = m_axis_cc_tlast; s_axis_tx_tuser = 4'h0; end TX_WAIT : begin s_axis_tx_tdata = { (compl_addr[2])? { m_axis_cc_tdata[39:32], m_axis_cc_tdata[47:40], m_axis_cc_tdata[55:48],m_axis_cc_tdata[63:56], m_axis_cc_tdata[7:0], m_axis_cc_tdata[15:8], m_axis_cc_tdata[23:16], m_axis_cc_tdata[31:24] } : {m_axis_cc_tdata[7:0], m_axis_cc_tdata[15:8], m_axis_cc_tdata[23:16], m_axis_cc_tdata[31:24], compl_data[39:32], compl_data[47:40], compl_data[55:48], compl_data[63:56]} }; m_axis_cc_tready = {4{s_axis_tx_tready}}; s_axis_tx_tvalid = 1'b1; s_axis_tx_tkeep = 8'hFF; s_axis_tx_tlast = m_axis_cc_tlast; s_axis_tx_tuser = 4'h0; end default: begin s_axis_tx_tdata = 64'b0; s_axis_tx_tvalid = 1'b0; s_axis_tx_tkeep = 8'h0; s_axis_tx_tlast = 2'b0; s_axis_tx_tuser = 4'h0; m_axis_cc_tready = 4'hF; end endcase end end end endgenerate generate if (C_AXI_DATA_WIDTH == 128) begin : tx_128 always @ ( posedge clk ) begin if (user_reset ) begin compl_addr <= #TCQ 7'b0; compl_at <= #TCQ 2'b0; compl_byte <= #TCQ 12'b0; compl_len <= #TCQ 11'b0; compl_status <= #TCQ 3'b0; compl_ep <= #TCQ 1'b0; compl_rid <= #TCQ 16'b0; compl_tag <= #TCQ 8'b0; compl_cid <= #TCQ 16'b0; compl_tc <= #TCQ 3'b0; compl_attr <= #TCQ 3'b0; compl_ecrc <= #TCQ 1'b0; compl_data <= #TCQ 128'b0; state <= #TCQ TX_IDLE; end else begin case (state) TX_IDLE : begin compl_tag <= #TCQ compl_tag; compl_cid <= #TCQ compl_cid; if (sop) begin compl_addr <= #TCQ m_axis_cc_tdata[6:0]; compl_at <= #TCQ m_axis_cc_tdata[9:8]; compl_byte <= #TCQ m_axis_cc_tdata[27:16]; compl_len <= #TCQ m_axis_cc_tdata[41:32]; compl_status <= #TCQ m_axis_cc_tdata[45:43]; compl_ep <= #TCQ m_axis_cc_tdata[46]; compl_rid <= #TCQ m_axis_cc_tdata[63:48]; compl_tag <= #TCQ m_axis_cc_tdata[71:64]; compl_cid <= #TCQ m_axis_cc_tdata[87:72]; compl_tc <= #TCQ m_axis_cc_tdata[91:89]; compl_attr <= #TCQ m_axis_cc_tdata[94:92]; compl_ecrc <= #TCQ m_axis_cc_tdata[95]; state <= #TCQ TX_DW0_DW1; end end TX_DW0_DW1 : begin compl_addr <= #TCQ compl_addr; compl_at <= #TCQ compl_at; compl_byte <= #TCQ compl_byte; compl_len <= #TCQ compl_len; compl_status <= #TCQ compl_status; compl_ep <= #TCQ compl_ep; compl_rid <= #TCQ compl_rid; compl_tag <= #TCQ compl_tag; compl_cid <= #TCQ compl_cid; compl_tc <= #TCQ compl_tc; compl_attr <= #TCQ compl_attr; compl_ecrc <= #TCQ compl_ecrc; compl_data <= #TCQ m_axis_cc_tdata; state <= #TCQ (s_axis_tx_tready)? ( (m_axis_cc_tvalid && m_axis_cc_tlast)? TX_IDLE : TX_WAIT ) : TX_DW0_DW1; end TX_WAIT : begin state <= #TCQ TX_IDLE; end endcase end end always @ (*) begin if (user_reset ) begin s_axis_tx_tdata = 128'b0; s_axis_tx_tvalid = 1'b0; s_axis_tx_tkeep = 16'h0; s_axis_tx_tlast = 1'b0; s_axis_tx_tuser = 4'h0; m_axis_cc_tready = 4'hF; end else begin case (state) TX_DW0_DW1 : begin s_axis_tx_tdata = { compl_data_tx(compl_addr[3:2]), compl_rid, compl_tag, 1'b0, compl_addr, {m_axis_cc_tdata[88]? compl_cid : {cfg_bus_number, cfg_device_number, cfg_function_number}}, //Completer ID compl_status, 1'b0, //BCM compl_byte, 1'b0, //Reserved 2'h2, //CplD fmt 5'hA, //CplD type 1'b0, compl_tc, //TC 1'b0, //Reserved compl_attr[2], //ID Based Ordering 1'b0, //Reserved 1'b0, //TPH 1'b0, //TD compl_ep, compl_attr[1:0], //compl_attr compl_at, compl_len }; m_axis_cc_tready = {4{s_axis_tx_tready}}; s_axis_tx_tvalid = 1'b1; s_axis_tx_tkeep = (compl_status!= 3'b0)? 16'h3FFF : 16'hFFFF; s_axis_tx_tlast = m_axis_cc_tlast; s_axis_tx_tuser = 4'h0; end TX_WAIT : begin s_axis_tx_tdata = {compl_data_tx(compl_addr[3:2]), m_axis_cc_tdata[95:0] }; s_axis_tx_tvalid = 1'b1; s_axis_tx_tkeep = { {4{m_axis_cc_tkeep[3]}}, {4{m_axis_cc_tkeep[2]}}, {4{m_axis_cc_tkeep[1]}}, {4{m_axis_cc_tkeep[0]}} }; s_axis_tx_tlast = 1'b1; s_axis_tx_tuser = 4'h0; m_axis_cc_tready = {4{s_axis_tx_tready}}; end default: begin s_axis_tx_tdata = 128'b0; s_axis_tx_tvalid = 1'b0; s_axis_tx_tkeep = 16'h0; s_axis_tx_tlast = 1'b0; s_axis_tx_tuser = 4'h0; m_axis_cc_tready = 4'hF; end endcase end end //Function to calculate completion data function [31:0] compl_data_tx; input [1:0] compl_addr; begin case (compl_addr) 2'd0 : compl_data_tx = {m_axis_cc_tdata[7:0], m_axis_cc_tdata[15:8], m_axis_cc_tdata[23:16], m_axis_cc_tdata[31:24]}; 2'd1 : compl_data_tx = { m_axis_cc_tdata[39:32], m_axis_cc_tdata[47:40], m_axis_cc_tdata[55:48],m_axis_cc_tdata[63:56]}; 2'd2 : compl_data_tx = {m_axis_cc_tdata[71:64], m_axis_cc_tdata[79:72], m_axis_cc_tdata[87:80], m_axis_cc_tdata[95:88]}; 2'd3 : compl_data_tx = {m_axis_cc_tdata[103:96], m_axis_cc_tdata[111:104], m_axis_cc_tdata[119:112], m_axis_cc_tdata[127:120]}; endcase end endfunction end endgenerate endmodule ======================= File: imports/xilinx_dma_pcie_ep.sv ======================= <gh_stars>1-10 //----------------------------------------------------------------------------- // // (c) Copyright 2012-2012 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant any // rights to the materials distributed herewith. Except as // otherwise provided in a valid license issued to you by // Xilinx, and to the maximum extent permitted by applicable // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND // WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES // AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING // BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- // INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and // (2) Xilinx shall not be liable (whether in contract or tort, // including negligence, or under any other theory of // liability) for any loss or damage of any kind or nature // related to, arising under or in connection with these // materials, including for any direct, or any indirect, // special, incidental, or consequential loss or damage // (including loss of data, profits, goodwill, or any type of // loss or damage suffered as a result of any action brought // by a third party) even if such damage or loss was // reasonably foreseeable or Xilinx had been advised of the // possibility of the same. // // CRITICAL APPLICATIONS // Xilinx products are not designed or intended to be fail- // safe, or for use in any application requiring fail-safe // performance, such as life-support or safety devices or // systems, Class III medical devices, nuclear facilities, // applications related to the deployment of airbags, or any // other applications that could lead to death, personal // injury, or severe property or environmental damage // (individually and collectively, "Critical // Applications"). Customer assumes the sole risk and // liability of any use of Xilinx products in Critical // Applications, subject only to applicable laws and // regulations governing limitations on product liability. // // THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS // PART OF THIS FILE AT ALL TIMES. // //----------------------------------------------------------------------------- // // Project : The Xilinx PCI Express DMA // File : xilinx_dma_pcie_ep.sv // Version : 4.1 //----------------------------------------------------------------------------- `timescale 1ps / 1ps module xilinx_dma_pcie_ep # ( parameter PL_LINK_CAP_MAX_LINK_WIDTH = 1, // 1- X1; 2 - X2; 4 - X4; 8 - X8 parameter PL_SIM_FAST_LINK_TRAINING = "FALSE", // Simulation Speedup parameter PL_LINK_CAP_MAX_LINK_SPEED = 1, // 1- GEN1; 2 - GEN2; 4 - GEN3 parameter C_DATA_WIDTH = 64, parameter EXT_PIPE_SIM = "FALSE", // This Parameter has effect on selecting Enable External PIPE Interface in GUI. parameter C_ROOT_PORT = "FALSE", // PCIe block is in root port mode parameter C_DEVICE_NUMBER = 0, // Device number for Root Port configurations only parameter AXIS_CCIX_RX_TDATA_WIDTH = 256, parameter AXIS_CCIX_TX_TDATA_WIDTH = 256, parameter AXIS_CCIX_RX_TUSER_WIDTH = 46, parameter AXIS_CCIX_TX_TUSER_WIDTH = 46 ) ( output [(PL_LINK_CAP_MAX_LINK_WIDTH - 1) : 0] pci_exp_txp, output [(PL_LINK_CAP_MAX_LINK_WIDTH - 1) : 0] pci_exp_txn, input [(PL_LINK_CAP_MAX_LINK_WIDTH - 1) : 0] pci_exp_rxp, input [(PL_LINK_CAP_MAX_LINK_WIDTH - 1) : 0] pci_exp_rxn, //VU9P_TUL_EX_String= FALSE input sys_clk_p, input sys_clk_n, input sys_rst_n ); //----------------------------------------------------------------------------------------------------------------------- // Local Parameters derived from user selection localparam integer USER_CLK_FREQ = ((PL_LINK_CAP_MAX_LINK_SPEED == 3'h4)? 5 : 4); localparam TCQ = 1; localparam C_S_AXI_ID_WIDTH = 4; localparam C_M_AXI_ID_WIDTH = 4; localparam C_S_AXI_DATA_WIDTH = C_DATA_WIDTH; localparam C_M_AXI_DATA_WIDTH = C_DATA_WIDTH; localparam C_S_AXI_ADDR_WIDTH = 64; localparam C_M_AXI_ADDR_WIDTH = 64; localparam C_NUM_USR_IRQ = 1; wire user_lnk_up; //----------------------------------------------------------------------------------------------------------------// // AXI Interface // //----------------------------------------------------------------------------------------------------------------// wire user_clk; wire user_resetn; // Wires for Avery HOT/WARM and COLD RESET wire avy_sys_rst_n_c; wire avy_cfg_hot_reset_out; reg avy_sys_rst_n_g; reg avy_cfg_hot_reset_out_g; assign avy_sys_rst_n_c = avy_sys_rst_n_g; assign avy_cfg_hot_reset_out = avy_cfg_hot_reset_out_g; initial begin avy_sys_rst_n_g = 1; avy_cfg_hot_reset_out_g =0; end //----------------------------------------------------------------------------------------------------------------// // System(SYS) Interface // //----------------------------------------------------------------------------------------------------------------// wire sys_clk; wire sys_clk_gt; wire sys_rst_n_c; // User Clock LED Heartbeat reg [25:0] user_clk_heartbeat; reg [((2*C_NUM_USR_IRQ)-1):0] usr_irq_function_number=0; reg [C_NUM_USR_IRQ-1:0] usr_irq_req = 0; wire [C_NUM_USR_IRQ-1:0] usr_irq_ack; //-- AXI Master Write Address Channel wire [C_M_AXI_ADDR_WIDTH-1:0] m_axi_awaddr; wire [C_M_AXI_ID_WIDTH-1:0] m_axi_awid; wire [2:0] m_axi_awprot; wire [1:0] m_axi_awburst; wire [2:0] m_axi_awsize; wire [3:0] m_axi_awcache; wire [7:0] m_axi_awlen; wire m_axi_awlock; wire m_axi_awvalid; wire m_axi_awready; //-- AXI Master Write Data Channel wire [C_M_AXI_DATA_WIDTH-1:0] m_axi_wdata; wire [(C_M_AXI_DATA_WIDTH/8)-1:0] m_axi_wstrb; wire m_axi_wlast; wire m_axi_wvalid; wire m_axi_wready; //-- AXI Master Write Response Channel wire m_axi_bvalid; wire m_axi_bready; wire [C_M_AXI_ID_WIDTH-1 : 0] m_axi_bid ; wire [1:0] m_axi_bresp ; //-- AXI Master Read Address Channel wire [C_M_AXI_ID_WIDTH-1 : 0] m_axi_arid; wire [C_M_AXI_ADDR_WIDTH-1:0] m_axi_araddr; wire [7:0] m_axi_arlen; wire [2:0] m_axi_arsize; wire [1:0] m_axi_arburst; wire [2:0] m_axi_arprot; wire m_axi_arvalid; wire m_axi_arready; wire m_axi_arlock; wire [3:0] m_axi_arcache; //-- AXI Master Read Data Channel wire [C_M_AXI_ID_WIDTH-1 : 0] m_axi_rid; wire [C_M_AXI_DATA_WIDTH-1:0] m_axi_rdata; wire [1:0] m_axi_rresp; wire m_axi_rvalid; wire m_axi_rready; /////////////////////////////////////////////////////////////////////////////// // CQ forwarding port to BARAM wire [C_M_AXI_ADDR_WIDTH-1:0] m_axib_awaddr; wire [C_M_AXI_ID_WIDTH-1:0] m_axib_awid; wire [2:0] m_axib_awprot; wire [1:0] m_axib_awburst; wire [2:0] m_axib_awsize; wire [3:0] m_axib_awcache; wire [7:0] m_axib_awlen; wire m_axib_awlock; wire m_axib_awvalid; wire m_axib_awready; //-- AXI Master Write Data Channel wire [C_M_AXI_DATA_WIDTH-1:0] m_axib_wdata; wire [(C_M_AXI_DATA_WIDTH/8)-1:0] m_axib_wstrb; wire m_axib_wlast; wire m_axib_wvalid; wire m_axib_wready; //-- AXI Master Write Response Channel wire m_axib_bvalid; wire m_axib_bready; wire [C_M_AXI_ID_WIDTH-1 : 0] m_axib_bid ; wire [1 : 0] m_axib_bresp ; //-- AXI Master Read Address Channel wire [C_M_AXI_ID_WIDTH-1 : 0] m_axib_arid; wire [C_M_AXI_ADDR_WIDTH-1:0] m_axib_araddr; wire [7 : 0] m_axib_arlen; wire [2 : 0] m_axib_arsize; wire [1 : 0] m_axib_arburst; wire [2:0] m_axib_arprot; wire m_axib_arvalid; wire m_axib_arready; wire m_axib_arlock; wire [3:0] m_axib_arcache; //////////////////////////////////////////////////////////////////////////////// //-- AXI Master Read Data Channel wire [C_M_AXI_ID_WIDTH-1 : 0] m_axib_rid; wire [C_M_AXI_DATA_WIDTH-1:0] m_axib_rdata; wire [1:0] m_axib_rresp; wire m_axib_rvalid; wire m_axib_rready; ////////////////////////////////////////////////// LITE //-- AXI Master Write Address Channel wire [31:0] m_axil_awaddr; wire [2:0] m_axil_awprot; wire m_axil_awvalid; wire m_axil_awready; //-- AXI Master Write Data Channel wire [31:0] m_axil_wdata; wire [3:0] m_axil_wstrb; wire m_axil_wvalid; wire m_axil_wready; //-- AXI Master Write Response Channel wire m_axil_bvalid; wire m_axil_bready; //-- AXI Master Read Address Channel wire [31:0] m_axil_araddr; wire [2:0] m_axil_arprot; wire m_axil_arvalid; wire m_axil_arready; //-- AXI Master Read Data Channel wire [31:0] m_axil_rdata; wire [1:0] m_axil_rresp; wire m_axil_rvalid; wire m_axil_rready; wire [1:0] m_axil_bresp; wire [2:0] msi_vector_width; wire msi_enable; // AXI streaming ports wire [C_DATA_WIDTH-1:0] m_axis_h2c_tdata_0; wire m_axis_h2c_tlast_0; wire m_axis_h2c_tvalid_0; wire m_axis_h2c_tready_0; wire [C_DATA_WIDTH/8-1:0] m_axis_h2c_tkeep_0; wire [C_DATA_WIDTH-1:0] s_axis_c2h_tdata_0; wire s_axis_c2h_tlast_0; wire s_axis_c2h_tvalid_0; wire s_axis_c2h_tready_0; wire [C_DATA_WIDTH/8-1:0] s_axis_c2h_tkeep_0; wire [3:0] leds; wire free_run_clock; wire [5:0] cfg_ltssm_state; // Ref clock buffer IBUFDS_GTE2 refclk_ibuf (.O(sys_clk),.ODIV2(),.I(sys_clk_p),.CEB(1'b0),.IB(sys_clk_n)); // Reset buffer IBUF sys_reset_n_ibuf (.O(sys_rst_n_c),.I(sys_rst_n)); // Core Top Level Wrapper xdma_0 xdma_0_i ( //---------------------------------------------------------------------------------------// // PCI Express (pci_exp) Interface // //---------------------------------------------------------------------------------------// .sys_rst_n ( sys_rst_n_c ), .sys_clk ( sys_clk ), // Tx .pci_exp_txn ( pci_exp_txn ), .pci_exp_txp ( pci_exp_txp ), // Rx .pci_exp_rxn ( pci_exp_rxn ), .pci_exp_rxp ( pci_exp_rxp ), // CQ Bypass ports .m_axib_awid (m_axib_awid), .m_axib_awaddr (m_axib_awaddr), .m_axib_awlen (m_axib_awlen), .m_axib_awsize (m_axib_awsize), .m_axib_awburst (m_axib_awburst), .m_axib_awprot (m_axib_awprot), .m_axib_awvalid (m_axib_awvalid), .m_axib_awready (m_axib_awready), .m_axib_awlock (m_axib_awlock), .m_axib_awcache (m_axib_awcache), .m_axib_wdata (m_axib_wdata), .m_axib_wstrb (m_axib_wstrb), .m_axib_wlast (m_axib_wlast), .m_axib_wvalid (m_axib_wvalid), .m_axib_wready (m_axib_wready), .m_axib_bid (m_axib_bid), .m_axib_bresp (m_axib_bresp), .m_axib_bvalid (m_axib_bvalid), .m_axib_bready (m_axib_bready), .m_axib_arid (m_axib_arid), .m_axib_araddr (m_axib_araddr), .m_axib_arlen (m_axib_arlen), .m_axib_arsize (m_axib_arsize), .m_axib_arburst (m_axib_arburst), .m_axib_arprot (m_axib_arprot), .m_axib_arvalid (m_axib_arvalid), .m_axib_arready (m_axib_arready), .m_axib_arlock (m_axib_arlock), .m_axib_arcache (m_axib_arcache), .m_axib_rid (m_axib_rid), .m_axib_rdata (m_axib_rdata), .m_axib_rresp (m_axib_rresp), .m_axib_rlast (m_axib_rlast), .m_axib_rvalid (m_axib_rvalid), .m_axib_rready (m_axib_rready), // AXI streaming ports .s_axis_c2h_tdata_0(s_axis_c2h_tdata_0), .s_axis_c2h_tlast_0(s_axis_c2h_tlast_0), .s_axis_c2h_tvalid_0(s_axis_c2h_tvalid_0), .s_axis_c2h_tready_0(s_axis_c2h_tready_0), .s_axis_c2h_tkeep_0(s_axis_c2h_tkeep_0), .m_axis_h2c_tdata_0(m_axis_h2c_tdata_0), .m_axis_h2c_tlast_0(m_axis_h2c_tlast_0), .m_axis_h2c_tvalid_0(m_axis_h2c_tvalid_0), .m_axis_h2c_tready_0(m_axis_h2c_tready_0), .m_axis_h2c_tkeep_0(m_axis_h2c_tkeep_0), // LITE interface //-- AXI Master Write Address Channel .m_axil_awaddr (m_axil_awaddr), .m_axil_awprot (m_axil_awprot), .m_axil_awvalid (m_axil_awvalid), .m_axil_awready (m_axil_awready), //-- AXI Master Write Data Channel .m_axil_wdata (m_axil_wdata), .m_axil_wstrb (m_axil_wstrb), .m_axil_wvalid (m_axil_wvalid), .m_axil_wready (m_axil_wready), //-- AXI Master Write Response Channel .m_axil_bvalid (m_axil_bvalid), .m_axil_bresp (m_axil_bresp), .m_axil_bready (m_axil_bready), //-- AXI Master Read Address Channel .m_axil_araddr (m_axil_araddr), .m_axil_arprot (m_axil_arprot), .m_axil_arvalid (m_axil_arvalid), .m_axil_arready (m_axil_arready), .m_axil_rdata (m_axil_rdata), //-- AXI Master Read Data Channel .m_axil_rresp (m_axil_rresp), .m_axil_rvalid (m_axil_rvalid), .m_axil_rready (m_axil_rready), //------------TRANSCEIVER DEBUG----------------------------------- .pipe_txprbssel (3'b000), .pipe_rxprbssel (3'b000), .pipe_txprbsforceerr (1'b0), .pipe_rxprbscntreset (1'b0), .pipe_loopback (3'b000), .pipe_rxprbserr ( ), .pipe_txinhibit ({PL_LINK_CAP_MAX_LINK_WIDTH{1'b0}}), .pipe_rst_fsm ( ), .pipe_qrst_fsm ( ), .pipe_rate_fsm ( ), .pipe_sync_fsm_tx ( ), .pipe_sync_fsm_rx ( ), .pipe_drp_fsm ( ), .pipe_rst_idle ( ), .pipe_qrst_idle ( ), .pipe_rate_idle ( ), .pipe_eyescandataerror ( ), .pipe_rxstatus ( ), .pipe_dmonitorout ( ), .pipe_cpll_lock ( ), .pipe_qpll_lock ( ), .pipe_rxpmaresetdone ( ), .pipe_rxbufstatus ( ), .pipe_txphaligndone ( ), .pipe_txphinitdone ( ), .pipe_txdlysresetdone ( ), .pipe_rxphaligndone ( ), .pipe_rxdlysresetdone ( ), .pipe_rxsyncdone ( ), .pipe_rxdisperr ( ), .pipe_rxnotintable ( ), .pipe_rxcommadet ( ), .gt_ch_drp_rdy ( ), .pipe_debug_0 ( ), .pipe_debug_1 ( ), .pipe_debug_2 ( ), .pipe_debug_3 ( ), .pipe_debug_4 ( ), .pipe_debug_5 ( ), .pipe_debug_6 ( ), .pipe_debug_7 ( ), .pipe_debug_8 ( ), .pipe_debug_9 ( ), .pipe_debug ( ), .usr_irq_req (usr_irq_req), .usr_irq_ack (usr_irq_ack), .msi_enable (msi_enable), .msi_vector_width (msi_vector_width), .msix_enable (), // Config managemnet interface .cfg_mgmt_addr ( 19'b0 ), .cfg_mgmt_write ( 1'b0 ), .cfg_mgmt_write_data ( 32'b0 ), .cfg_mgmt_byte_enable ( 4'b0 ), .cfg_mgmt_read ( 1'b0 ), .cfg_mgmt_read_data (), .cfg_mgmt_read_write_done (), .cfg_mgmt_type1_cfg_reg_access ( 1'b0 ), //-- AXI Global .axi_aclk ( user_clk ), .axi_aresetn ( user_resetn ), .user_lnk_up ( user_lnk_up ) ); // XDMA taget application xdma_app #( .C_M_AXI_ID_WIDTH(C_M_AXI_ID_WIDTH) ) xdma_app_i ( // AXI Lite Master Interface connections .s_axil_awaddr (m_axil_awaddr[31:0]), .s_axil_awvalid (m_axil_awvalid), .s_axil_awready (m_axil_awready), .s_axil_wdata (m_axil_wdata[31:0]), // block fifo for AXI lite only 31 bits. .s_axil_wstrb (m_axil_wstrb[3:0]), .s_axil_wvalid (m_axil_wvalid), .s_axil_wready (m_axil_wready), .s_axil_bresp (m_axil_bresp), .s_axil_bvalid (m_axil_bvalid), .s_axil_bready (m_axil_bready), .s_axil_araddr (m_axil_araddr[31:0]), .s_axil_arvalid (m_axil_arvalid), .s_axil_arready (m_axil_arready), .s_axil_rdata (m_axil_rdata), // block ram for AXI Lite is only 31 bits .s_axil_rresp (m_axil_rresp), .s_axil_rvalid (m_axil_rvalid), .s_axil_rready (m_axil_rready), // AXI streaming ports .s_axis_c2h_tdata_0(s_axis_c2h_tdata_0), .s_axis_c2h_tlast_0(s_axis_c2h_tlast_0), .s_axis_c2h_tvalid_0(s_axis_c2h_tvalid_0), .s_axis_c2h_tready_0(s_axis_c2h_tready_0), .s_axis_c2h_tkeep_0(s_axis_c2h_tkeep_0), .m_axis_h2c_tdata_0(m_axis_h2c_tdata_0), .m_axis_h2c_tlast_0(m_axis_h2c_tlast_0), .m_axis_h2c_tvalid_0(m_axis_h2c_tvalid_0), .m_axis_h2c_tready_0(m_axis_h2c_tready_0), .m_axis_h2c_tkeep_0(m_axis_h2c_tkeep_0), // AXI stream interface for the CQ forwarding .s_axib_awid (m_axib_awid), .s_axib_awaddr (m_axib_awaddr[18:0]), .s_axib_awlen (m_axib_awlen), .s_axib_awsize (m_axib_awsize), .s_axib_awburst (m_axib_awburst), .s_axib_awvalid (m_axib_awvalid), .s_axib_awready (m_axib_awready), .s_axib_wdata (m_axib_wdata), .s_axib_wstrb (m_axib_wstrb), .s_axib_wlast (m_axib_wlast), .s_axib_wvalid (m_axib_wvalid), .s_axib_wready (m_axib_wready), .s_axib_bid (m_axib_bid), .s_axib_bresp (m_axib_bresp), .s_axib_bvalid (m_axib_bvalid), .s_axib_bready (m_axib_bready), .s_axib_arid (m_axib_arid), .s_axib_araddr (m_axib_araddr[18:0]), .s_axib_arlen (m_axib_arlen), .s_axib_arsize (m_axib_arsize), .s_axib_arburst (m_axib_arburst), .s_axib_arvalid (m_axib_arvalid), .s_axib_arready (m_axib_arready), .s_axib_rid (m_axib_rid), .s_axib_rdata (m_axib_rdata), .s_axib_rresp (m_axib_rresp), .s_axib_rlast (m_axib_rlast), .s_axib_rvalid (m_axib_rvalid), .s_axib_rready (m_axib_rready), .user_clk(user_clk), .user_resetn(user_resetn), .user_lnk_up(user_lnk_up), .sys_rst_n(sys_rst_n_c), .leds() ); endmodule ======================= File: xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_pcie2_to_pcie3_wrapper.sv ======================= //----------------------------------------------------------------------------- // // (c) Copyright 2012-2012 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant any // rights to the materials distributed herewith. Except as // otherwise provided in a valid license issued to you by // Xilinx, and to the maximum extent permitted by applicable // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND // WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES // AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING // BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- // INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and // (2) Xilinx shall not be liable (whether in contract or tort, // including negligence, or under any other theory of // liability) for any loss or damage of any kind or nature // related to, arising under or in connection with these // materials, including for any direct, or any indirect, // special, incidental, or consequential loss or damage // (including loss of data, profits, goodwill, or any type of // loss or damage suffered as a result of any action brought // by a third party) even if such damage or loss was // reasonably foreseeable or Xilinx had been advised of the // possibility of the same. // // CRITICAL APPLICATIONS // Xilinx products are not designed or intended to be fail- // safe, or for use in any application requiring fail-safe // performance, such as life-support or safety devices or // systems, Class III medical devices, nuclear facilities, // applications related to the deployment of airbags, or any // other applications that could lead to death, personal // injury, or severe property or environmental damage // (individually and collectively, "Critical // Applications"). Customer assumes the sole risk and // liability of any use of Xilinx products in Critical // Applications, subject only to applicable laws and // regulations governing limitations on product liability. // // THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS // PART OF THIS FILE AT ALL TIMES. // //----------------------------------------------------------------------------- // // Project : The Xilinx PCI Express DMA // File : xdma_0_pcie2_to_pcie3_wrapper.sv // Version : 4.1 //----------------------------------------------------------------------------- `timescale 1ps/1ps module xdma_0_pcie2_to_pcie3_wrapper #( parameter PL_LINK_CAP_MAX_LINK_WIDTH = 1, parameter C_M_AXIS_RQ_USER_WIDTH = 60, parameter C_M_AXIS_RC_USER_WIDTH = 75, parameter C_S_AXIS_CQ_USER_WIDTH = 85, parameter C_S_AXIS_CC_USER_WIDTH = 33, parameter C_M_AXIS_DATA_WIDTH = 128, parameter C_S_AXIS_DATA_WIDTH = 128, parameter C_S_KEEP_WIDTH = C_S_AXIS_DATA_WIDTH / 32, parameter C_M_KEEP_WIDTH = C_M_AXIS_DATA_WIDTH / 32, parameter C_AXI_DATA_WIDTH = 64, parameter C_KEEP_WIDTH = C_AXI_DATA_WIDTH/8, parameter C_ADDR_ALGN = 1, parameter C_LEGACY_INT_EN = "TRUE", parameter C_MSI_EN = "TRUE", parameter C_MSIX_EN = "TRUE", parameter TCQ = 1 ) ( //--------------------------------------------------------------------------------// // ---------- Virtex-7 Gen3 PCIe Integrated Block Ports ------------------------- // //--------------------------------------------------------------------------------// //---------------------------------------------------------------------------------------// // PCI Express (pci_exp) Interface // //---------------------------------------------------------------------------------------// // Tx output wire [PL_LINK_CAP_MAX_LINK_WIDTH-1 : 0] pci_exp_txp, output wire [PL_LINK_CAP_MAX_LINK_WIDTH-1 : 0] pci_exp_txn, // Rx input wire [PL_LINK_CAP_MAX_LINK_WIDTH-1 : 0] pci_exp_rxp, input wire [PL_LINK_CAP_MAX_LINK_WIDTH-1 : 0] pci_exp_rxn, //---------------------------------------------------------------------------------------// // AXI Interface // //---------------------------------------------------------------------------------------// output wire user_clk, output wire user_reset, output wire user_lnk_up, input wire [C_M_AXIS_DATA_WIDTH-1:0] s_axis_rq_tdata, input wire [C_M_AXIS_RQ_USER_WIDTH-1:0] s_axis_rq_tuser, input wire [C_M_AXIS_DATA_WIDTH/32-1:0] s_axis_rq_tkeep, input wire s_axis_rq_tlast, input wire s_axis_rq_tvalid, output wire [3:0] s_axis_rq_tready, output wire [C_M_AXIS_DATA_WIDTH-1:0] m_axis_rc_tdata, output wire [C_M_AXIS_RC_USER_WIDTH-1:0] m_axis_rc_tuser, output wire [C_M_AXIS_DATA_WIDTH/32-1:0] m_axis_rc_tkeep, output wire m_axis_rc_tlast, output wire m_axis_rc_tvalid, input wire m_axis_rc_tready, output wire [C_S_AXIS_DATA_WIDTH-1:0] m_axis_cq_tdata, output wire [C_S_AXIS_CQ_USER_WIDTH-1:0] m_axis_cq_tuser, output wire [C_S_AXIS_DATA_WIDTH/32-1:0] m_axis_cq_tkeep, output wire m_axis_cq_tlast, output wire m_axis_cq_tvalid, input wire m_axis_cq_tready, input wire [C_S_AXIS_DATA_WIDTH-1:0] s_axis_cc_tdata, input wire [C_S_AXIS_CC_USER_WIDTH-1:0] s_axis_cc_tuser, input wire [C_S_AXIS_DATA_WIDTH/32-1:0] s_axis_cc_tkeep, input wire s_axis_cc_tlast, input wire s_axis_cc_tvalid, output wire [3:0] s_axis_cc_tready, output wire [3:0] pcie_rq_seq_num, output wire pcie_rq_seq_num_vld, output wire [5:0] pcie_rq_tag, output wire pcie_rq_tag_vld, output wire [1:0] pcie_tfc_nph_av, output wire [1:0] pcie_tfc_npd_av, input wire pcie_cq_np_req, output wire [5:0] pcie_cq_np_req_count, output wire cfg_phy_link_down, output wire [1:0] cfg_phy_link_status, output wire [3:0] cfg_negotiated_width, output wire [2:0] cfg_current_speed, output wire [2:0] cfg_max_payload, output wire [2:0] cfg_max_read_req, output wire [7:0] cfg_function_status, output wire [5:0] cfg_function_power_state, output wire [1:0] cfg_link_power_state, // Management Interface input wire [18:0] cfg_mgmt_addr, input wire cfg_mgmt_write, input wire [31:0] cfg_mgmt_write_data, input wire [3:0] cfg_mgmt_byte_enable, input wire cfg_mgmt_read, output wire [31:0] cfg_mgmt_read_data, output wire cfg_mgmt_read_write_done, input wire cfg_mgmt_type1_cfg_reg_access, // Error Reporting Interface output wire cfg_err_cor_out, output wire cfg_err_nonfatal_out, output wire cfg_err_fatal_out, output wire cfg_ltr_enable, output wire [5:0] cfg_ltssm_state, output wire [1:0] cfg_rcb_status, output wire [1:0] cfg_dpa_substate_change, output wire [1:0] cfg_obff_enable, output wire cfg_pl_status_change, output wire cfg_msg_received, output wire [7:0] cfg_msg_received_data, output wire [4:0] cfg_msg_received_type, input wire cfg_msg_transmit, input wire [2:0] cfg_msg_transmit_type, input wire [31:0] cfg_msg_transmit_data, output wire cfg_msg_transmit_done, output wire [7:0] cfg_fc_ph, output wire [11:0] cfg_fc_pd, output wire [7:0] cfg_fc_nph, output wire [11:0] cfg_fc_npd, output wire [7:0] cfg_fc_cplh, output wire [11:0] cfg_fc_cpld, input wire [2:0] cfg_fc_sel, input wire [2:0] cfg_per_func_status_control, output wire [15:0] cfg_per_func_status_data, input wire [2:0] cfg_per_function_number, input wire cfg_per_function_output_request, output wire cfg_per_function_update_done, input wire [15:0] cfg_subsys_vend_id, input wire [63:0] cfg_dsn, input wire cfg_power_state_change_ack, output wire cfg_power_state_change_interrupt, input wire cfg_err_cor_in, input wire cfg_err_uncor_in, input wire cfg_link_training_enable, output wire cfg_ext_read_received, output wire cfg_ext_write_received, output wire [9:0] cfg_ext_register_number, output wire [7:0] cfg_ext_function_number, output wire [31:0] cfg_ext_write_data, output wire [3:0] cfg_ext_write_byte_enable, input wire [31:0] cfg_ext_read_data, input wire cfg_ext_read_data_valid, //-------------------------------------------------------------------------------// // EP Only // //-------------------------------------------------------------------------------// // Interrupt Interface Signals input wire [3:0] cfg_interrupt_int, input wire [1:0] cfg_interrupt_pending, output wire cfg_interrupt_sent, output wire [1:0] cfg_interrupt_msi_enable, output wire [5:0] cfg_interrupt_msi_mmenable, output wire cfg_interrupt_msi_mask_update, output wire [31:0] cfg_interrupt_msi_data, input wire [3:0] cfg_interrupt_msi_select, input wire [31:0] cfg_interrupt_msi_int, input wire [63:0] cfg_interrupt_msi_pending_status, output wire cfg_interrupt_msi_sent, output wire cfg_interrupt_msi_fail, input wire [2:0] cfg_interrupt_msi_attr, input wire cfg_interrupt_msi_tph_present, input wire [1:0] cfg_interrupt_msi_tph_type, input wire [8:0] cfg_interrupt_msi_tph_st_tag, input wire [2:0] cfg_interrupt_msi_function_number, output wire [5:0] cfg_interrupt_msi_vf_enable, input wire [31:0] cfg_interrupt_msix_data, input wire [63:0] cfg_interrupt_msix_address, input wire cfg_interrupt_msix_int, output wire [1:0] cfg_interrupt_msix_enable, output wire [1:0] cfg_interrupt_msix_mask, output wire [5:0] cfg_interrupt_msix_vf_enable, output wire [5:0] cfg_interrupt_msix_vf_mask, output wire cfg_interrupt_msix_sent, output wire cfg_interrupt_msix_fail, output wire [11:0] cfg_vf_status, output wire [17:0] cfg_vf_power_state, output wire [1:0] cfg_tph_requester_enable, output wire [5:0] cfg_tph_st_mode, output wire [5:0] cfg_vf_tph_requester_enable, output wire [17:0] cfg_vf_tph_st_mode, output wire [1:0] cfg_flr_in_process, output wire [5:0] cfg_vf_flr_in_process, // EP only input wire [1:0] cfg_flr_done, input wire [5:0] cfg_vf_flr_done, output wire cfg_hot_reset_out, input wire cfg_config_space_enable, input wire cfg_req_pm_transition_l23_ready, // RP only input wire cfg_hot_reset_in, input wire [7:0] cfg_ds_bus_number, input wire [4:0] cfg_ds_device_number, input wire [2:0] cfg_ds_function_number, input wire [7:0] cfg_ds_port_number, //--------------------------------------------------------------------------------------// // Transceiver Debug And Status Ports // //--------------------------------------------------------------------------------------// input wire [2:0] pipe_txprbssel, input wire [2:0] pipe_rxprbssel, input wire pipe_txprbsforceerr, input wire pipe_rxprbscntreset, input wire [2:0] pipe_loopback, output wire [0:0] pipe_rxprbserr, input wire [0:0] pipe_txinhibit, output wire [4:0] pipe_rst_fsm, output wire [11:0] pipe_qrst_fsm, output wire [4:0] pipe_rate_fsm, output wire [5:0] pipe_sync_fsm_tx, output wire [6:0] pipe_sync_fsm_rx, output wire [6:0] pipe_drp_fsm, output wire pipe_rst_idle, output wire pipe_qrst_idle, output wire pipe_rate_idle, output wire [0:0] pipe_eyescandataerror, output wire [2:0] pipe_rxstatus, output wire [14:0] pipe_dmonitorout, output wire [0:0] pipe_cpll_lock, output wire [0:0] pipe_qpll_lock, output wire [0:0] pipe_rxpmaresetdone, output wire [2:0] pipe_rxbufstatus, output wire [0:0] pipe_txphaligndone, output wire [0:0] pipe_txphinitdone, output wire [0:0] pipe_txdlysresetdone, output wire [0:0] pipe_rxphaligndone, output wire [0:0] pipe_rxdlysresetdone, output wire [0:0] pipe_rxsyncdone, output wire [7:0] pipe_rxdisperr, output wire [7:0] pipe_rxnotintable, output wire [0:0] pipe_rxcommadet, output wire [0:0] gt_ch_drp_rdy, output wire [0:0] pipe_debug_0, output wire [0:0] pipe_debug_1, output wire [0:0] pipe_debug_2, output wire [0:0] pipe_debug_3, output wire [0:0] pipe_debug_4, output wire [0:0] pipe_debug_5, output wire [0:0] pipe_debug_6, output wire [0:0] pipe_debug_7, output wire [0:0] pipe_debug_8, output wire [0:0] pipe_debug_9, output wire [31:0] pipe_debug, //--------------------------------------------------------------------------------------// // System(SYS) Interface // //--------------------------------------------------------------------------------------// input wire sys_clk, input wire sys_reset ); //--------------------------------------------------------------------------------// // ---------- Wire and Register Declaration ------------------------------------- // //--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------// // ---------- 7-series Gen2 PCIe Integrated Block Ports ------------------------- // //--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------------// // AXI-S Interface // //--------------------------------------------------------------------------------------// // Common wire g2ip_user_lnk_up; wire g2ip_user_app_rdy; // TX wire s_axis_tx_tready; wire [C_AXI_DATA_WIDTH-1:0] s_axis_tx_tdata; wire [C_KEEP_WIDTH-1:0] s_axis_tx_tkeep; wire s_axis_tx_tlast; wire s_axis_tx_tvalid; wire [3:0] s_axis_tx_tuser; // RX wire [C_AXI_DATA_WIDTH-1:0] m_axis_rx_tdata; wire [C_KEEP_WIDTH-1:0] m_axis_rx_tkeep; wire m_axis_rx_tlast; wire m_axis_rx_tvalid; wire m_axis_rx_tready; wire [21:0] m_axis_rx_tuser; wire rx_np_ok; wire rx_np_req; // MSI-X from cfg_sideband to axi-stream_intf wire s_axis_tx_msix_tready; wire [C_AXI_DATA_WIDTH-1:0] s_axis_tx_msix_tdata; wire [C_KEEP_WIDTH-1:0] s_axis_tx_msix_tkeep; wire s_axis_tx_msix_tlast; wire s_axis_tx_msix_tvalid; wire [3:0] s_axis_tx_msix_tuser; //--------------------------------------------------------------------------------------// // Flow Control Interface // //--------------------------------------------------------------------------------------// wire [11:0] g2ip_fc_cpld; wire [7:0] g2ip_fc_cplh; wire [11:0] g2ip_fc_npd; wire [7:0] g2ip_fc_nph; wire [11:0] g2ip_fc_pd; wire [7:0] g2ip_fc_ph; wire [2:0] g2ip_fc_sel; //--------------------------------------------------------------------------------------// // Configuration (CFG) Interface // //--------------------------------------------------------------------------------------// wire [4:0] g2ip_cfg_device_number; wire [15:0] g2ip_cfg_dcommand2; wire g2ip_cfg_pmcsr_pme_status; wire [15:0] g2ip_cfg_status; wire g2ip_cfg_to_turnoff; wire g2ip_cfg_received_func_lvl_rst; wire [15:0] g2ip_cfg_dcommand; wire [7:0] g2ip_cfg_bus_number; wire [2:0] g2ip_cfg_function_number; wire [15:0] g2ip_cfg_command; wire [15:0] g2ip_cfg_dstatus; wire [15:0] g2ip_cfg_lstatus; wire [2:0] g2ip_cfg_pcie_link_state; wire [15:0] g2ip_cfg_lcommand; wire g2ip_cfg_pmcsr_pme_en; wire [1:0] g2ip_cfg_pmcsr_powerstate; wire g2ip_cfg_trn_pending; wire g2ip_cfg_pm_halt_aspm_l0s; wire g2ip_cfg_pm_halt_aspm_l1; wire g2ip_cfg_pm_force_state_en; wire [1:0] g2ip_cfg_pm_force_state; wire [63:0] g2ip_cfg_dsn; wire g2ip_cfg_turnoff_ok; wire g2ip_cfg_pm_wake; wire g2ip_cfg_pm_send_pme_to; wire [7:0] g2ip_cfg_ds_bus_number; wire [4:0] g2ip_cfg_ds_device_number; wire [2:0] g2ip_cfg_ds_function_number; wire [5:0] g2ip_tx_buf_av; wire g2ip_tx_err_drop; wire g2ip_tx_cfg_req; wire g2ip_tx_cfg_gnt; //------------------------------------------------// // RP Only // //------------------------------------------------// wire g2ip_cfg_bridge_serr_en; wire g2ip_cfg_slot_control_electromech_il_ctl_pulse; wire g2ip_cfg_root_control_syserr_corr_err_en; wire g2ip_cfg_root_control_syserr_non_fatal_err_en; wire g2ip_cfg_root_control_syserr_fatal_err_en; wire g2ip_cfg_root_control_pme_int_en; wire g2ip_cfg_aer_rooterr_corr_err_reporting_en; wire g2ip_cfg_aer_rooterr_non_fatal_err_reporting_en; wire g2ip_cfg_aer_rooterr_fatal_err_reporting_en; wire g2ip_cfg_aer_rooterr_corr_err_received; wire g2ip_cfg_aer_rooterr_non_fatal_err_received; wire g2ip_cfg_aer_rooterr_fatal_err_received; //--------------------------------------------------------------------------------------// // VC interface // //--------------------------------------------------------------------------------------// wire [6:0] g2ip_cfg_vc_tcvc_map; // Management Interface wire [31:0] g2ip_cfg_mgmt_di; wire [3:0] g2ip_cfg_mgmt_byte_en; wire [9:0] g2ip_cfg_mgmt_dwaddr; wire g2ip_cfg_mgmt_wr_en; wire g2ip_cfg_mgmt_rd_en; wire g2ip_cfg_mgmt_wr_readonly; wire g2ip_cfg_mgmt_wr_rw1c_as_rw; //------------------------------------------------// // EP and RP // //------------------------------------------------// wire [31:0] g2ip_cfg_mgmt_do; wire g2ip_cfg_mgmt_rd_wr_done; // Error Reporting Interface wire g2ip_cfg_err_ecrc; wire g2ip_cfg_err_ur; wire g2ip_cfg_err_cpl_timeout; wire g2ip_cfg_err_cpl_unexpect; wire g2ip_cfg_err_cpl_abort; wire g2ip_cfg_err_posted; wire g2ip_cfg_err_cor; wire g2ip_cfg_err_atomic_egress_blocked; wire g2ip_cfg_err_internal_cor; wire g2ip_cfg_err_malformed; wire g2ip_cfg_err_mc_blocked; wire g2ip_cfg_err_poisoned; wire g2ip_cfg_err_norecovery; wire [47:0] g2ip_cfg_err_tlp_cpl_header; wire g2ip_cfg_err_cpl_rdy; wire g2ip_cfg_err_locked; wire g2ip_cfg_err_acs; wire g2ip_cfg_err_internal_uncor; //--------------------------------------------------------------------------------------// // AER Interface // //--------------------------------------------------------------------------------------// wire [127:0] g2ip_cfg_err_aer_headerlog; wire [4:0] g2ip_cfg_aer_interrupt_msgnum; wire g2ip_cfg_err_aer_headerlog_set; wire g2ip_cfg_aer_ecrc_check_en; wire g2ip_cfg_aer_ecrc_gen_en; //------------------------------------------------// // EP Only // //------------------------------------------------// wire g2ip_cfg_interrupt; wire g2ip_cfg_interrupt_rdy; wire g2ip_cfg_interrupt_assert; wire [7:0] g2ip_cfg_interrupt_di; wire [7:0] g2ip_cfg_interrupt_do; wire [2:0] g2ip_cfg_interrupt_mmenable; wire g2ip_cfg_interrupt_msienable; wire g2ip_cfg_interrupt_msixenable; wire g2ip_cfg_interrupt_msixfm; wire g2ip_cfg_interrupt_stat; wire [4:0] g2ip_cfg_pciecap_interrupt_msgnum; wire g2ip_cfg_msg_received_err_cor; wire g2ip_cfg_msg_received_err_non_fatal; wire g2ip_cfg_msg_received_err_fatal; wire g2ip_cfg_msg_received_pm_as_nak; wire g2ip_cfg_msg_received_pme_to_ack; wire g2ip_cfg_msg_received_assert_int_a; wire g2ip_cfg_msg_received_assert_int_b; wire g2ip_cfg_msg_received_assert_int_c; wire g2ip_cfg_msg_received_assert_int_d; wire g2ip_cfg_msg_received_deassert_int_a; wire g2ip_cfg_msg_received_deassert_int_b; wire g2ip_cfg_msg_received_deassert_int_c; wire g2ip_cfg_msg_received_deassert_int_d; wire g2ip_cfg_msg_received_pm_pme; wire g2ip_cfg_msg_received_setslotpowerlimit; wire g2ip_cfg_msg_received; wire [15:0] g2ip_cfg_msg_data; //--------------------------------------------------------------------------------------// // Physical Layer Control and Status (PL) Interface // //--------------------------------------------------------------------------------------// wire [1:0] g2ip_pl_directed_link_change; wire [1:0] g2ip_pl_directed_link_width; wire g2ip_pl_directed_link_speed; wire g2ip_pl_directed_link_auton; wire g2ip_pl_upstream_prefer_deemph; wire g2ip_pl_sel_lnk_rate; wire [1:0] g2ip_pl_sel_lnk_width; wire [5:0] g2ip_pl_ltssm_state; wire [1:0] g2ip_pl_lane_reversal_mode; wire g2ip_pl_phy_lnk_up; wire [2:0] g2ip_pl_tx_pm_state; wire [1:0] g2ip_pl_rx_pm_state; wire g2ip_pl_link_upcfg_cap; wire g2ip_pl_link_gen2_cap; wire g2ip_pl_link_partner_gen2_supported; wire [2:0] g2ip_pl_initial_link_width; wire g2ip_pl_directed_change_done; //------------------------------------------------// // EP Only // //------------------------------------------------// wire g2ip_pl_received_hot_rst; //------------------------------------------------// // RP Only // //------------------------------------------------// wire g2ip_pl_transmit_hot_rst; wire g2ip_pl_downstream_deemph_source; //--------------------------------------------------------------------------------------// // Transceiver Control Status and debug ports // //--------------------------------------------------------------------------------------// wire [2:0] g2ip_pipe_txprbssel; wire [2:0] g2ip_pipe_rxprbssel; wire g2ip_pipe_txprbsforceerr; wire g2ip_pipe_rxprbscntreset; wire [2:0] g2ip_pipe_loopback; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_gt_ch_drp_rdy; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_rxprbserr; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_txinhibit; wire [4:0] g2ip_pipe_rst_fsm; wire [11:0] g2ip_pipe_qrst_fsm; wire [(PL_LINK_CAP_MAX_LINK_WIDTH*5)-1:0] g2ip_pipe_rate_fsm; wire [(PL_LINK_CAP_MAX_LINK_WIDTH*6)-1:0] g2ip_pipe_sync_fsm_tx; wire [(PL_LINK_CAP_MAX_LINK_WIDTH*7)-1:0] g2ip_pipe_sync_fsm_rx; wire [(PL_LINK_CAP_MAX_LINK_WIDTH*7)-1:0] g2ip_pipe_drp_fsm; wire g2ip_pipe_rst_idle; wire g2ip_pipe_qrst_idle; wire g2ip_pipe_rate_idle; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_eyescandataerror; wire [(PL_LINK_CAP_MAX_LINK_WIDTH*3)-1:0] g2ip_pipe_rxstatus; wire [(PL_LINK_CAP_MAX_LINK_WIDTH*15)-1:0] g2ip_pipe_dmonitorout; wire [(PL_LINK_CAP_MAX_LINK_WIDTH)-1:0] g2ip_pipe_cpll_lock; wire [(PL_LINK_CAP_MAX_LINK_WIDTH-1)>>2:0] g2ip_pipe_qpll_lock; wire [(PL_LINK_CAP_MAX_LINK_WIDTH)-1:0] g2ip_pipe_rxpmaresetdone; wire [(PL_LINK_CAP_MAX_LINK_WIDTH*3)-1:0] g2ip_pipe_rxbufstatus; wire [(PL_LINK_CAP_MAX_LINK_WIDTH)-1:0] g2ip_pipe_txphaligndone; wire [(PL_LINK_CAP_MAX_LINK_WIDTH)-1:0] g2ip_pipe_txphinitdone; wire [(PL_LINK_CAP_MAX_LINK_WIDTH)-1:0] g2ip_pipe_txdlysresetdone; wire [(PL_LINK_CAP_MAX_LINK_WIDTH)-1:0] g2ip_pipe_rxphaligndone; wire [(PL_LINK_CAP_MAX_LINK_WIDTH)-1:0] g2ip_pipe_rxdlysresetdone; wire [(PL_LINK_CAP_MAX_LINK_WIDTH)-1:0] g2ip_pipe_rxsyncdone; wire [(PL_LINK_CAP_MAX_LINK_WIDTH*8)-1:0] g2ip_pipe_rxdisperr; wire [(PL_LINK_CAP_MAX_LINK_WIDTH*8)-1:0] g2ip_pipe_rxnotintable; wire [(PL_LINK_CAP_MAX_LINK_WIDTH)-1:0] g2ip_pipe_rxcommadet; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_debug_0; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_debug_1; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_debug_2; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_debug_3; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_debug_4; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_debug_5; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_debug_6; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_debug_7; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_debug_8; wire [PL_LINK_CAP_MAX_LINK_WIDTH-1:0] g2ip_pipe_debug_9; wire [31:0] g2ip_pipe_debug; // AXI-S RX Interface DMA CPL <-> RX Demux wire [C_AXI_DATA_WIDTH-1:0] m_axis_rx_cpl_tdata; // RX data wire m_axis_rx_cpl_tvalid; // RX data is valid wire m_axis_rx_cpl_tready; // RX ready for data wire [C_KEEP_WIDTH-1:0] m_axis_rx_cpl_tkeep; // RX strobe byte enables wire m_axis_rx_cpl_tlast; // RX data is last wire [21:0] m_axis_rx_cpl_tuser; // RX user signals // AXI-S RX Interface Target Bridge <-> RX Demux wire [C_AXI_DATA_WIDTH-1:0] m_axis_rx_tgt_tdata; // RX data wire m_axis_rx_tgt_tvalid; // RX data is valid wire m_axis_rx_tgt_tready; // RX ready for data wire [C_KEEP_WIDTH-1:0] m_axis_rx_tgt_tkeep; // RX strobe byte enables wire m_axis_rx_tgt_tlast; // RX data is last wire [21:0] m_axis_rx_tgt_tuser; // RX user signals // AXI-S TX Interface DMA REQ <-> TX Mux wire [C_AXI_DATA_WIDTH-1:0] s_axis_tx_req_tdata; // TX data wire s_axis_tx_req_tvalid; // TX data is valid wire s_axis_tx_req_tready; // TX ready for data wire [C_KEEP_WIDTH-1:0] s_axis_tx_req_tkeep; // TX strobe byte enables wire s_axis_tx_req_tlast; // TX data is last wire [3:0] s_axis_tx_req_tuser; // TX user signals // AXI-S TX Interface Target Bridge <-> TX Mux wire [C_AXI_DATA_WIDTH-1:0] s_axis_tx_tgt_tdata; // TX data wire s_axis_tx_tgt_tvalid; // TX data is valid wire s_axis_tx_tgt_tready; // TX ready for data wire [C_KEEP_WIDTH-1:0] s_axis_tx_tgt_tkeep; // TX strobe byte enables wire s_axis_tx_tgt_tlast; // TX data is last wire [3:0] s_axis_tx_tgt_tuser; // TX user signals //--------------------------------------------------------------------------------// // ---------- AXI Stream Signals ------------------------------------------------ // //--------------------------------------------------------------------------------// xdma_0_axi_stream_intf #( .C_M_AXIS_RQ_USER_WIDTH ( C_M_AXIS_RQ_USER_WIDTH ), .C_M_AXIS_RC_USER_WIDTH ( C_M_AXIS_RC_USER_WIDTH ), .C_S_AXIS_CQ_USER_WIDTH ( C_S_AXIS_CQ_USER_WIDTH ), .C_S_AXIS_CC_USER_WIDTH ( C_S_AXIS_CC_USER_WIDTH ), .C_M_AXIS_DATA_WIDTH ( C_M_AXIS_DATA_WIDTH ), .C_S_AXIS_DATA_WIDTH ( C_S_AXIS_DATA_WIDTH ), .C_S_KEEP_WIDTH ( C_S_KEEP_WIDTH ), .C_M_KEEP_WIDTH ( C_M_KEEP_WIDTH ), .C_AXI_DATA_WIDTH ( C_AXI_DATA_WIDTH ), .C_KEEP_WIDTH ( C_KEEP_WIDTH ), .C_ADDR_ALGN ( C_ADDR_ALGN ), .TCQ ( TCQ ) ) xdma_0_axi_stream_intf_i ( //--------------------------------------------------------------------------------// // ---------- 7-series Gen2 PCIe Integrated Block Ports ------------------------- // //--------------------------------------------------------------------------------// .s_axis_tx_msix_tdata ( s_axis_tx_msix_tdata ), .s_axis_tx_msix_tvalid ( s_axis_tx_msix_tvalid ), .s_axis_tx_msix_tready ( s_axis_tx_msix_tready ), .s_axis_tx_msix_tkeep ( s_axis_tx_msix_tkeep ), .s_axis_tx_msix_tlast ( s_axis_tx_msix_tlast ), .s_axis_tx_msix_tuser ( s_axis_tx_msix_tuser ), .s_axis_tx_tready ( s_axis_tx_tready ), .s_axis_tx_tdata ( s_axis_tx_tdata ), .s_axis_tx_tkeep ( s_axis_tx_tkeep ), .s_axis_tx_tlast ( s_axis_tx_tlast ), .s_axis_tx_tvalid ( s_axis_tx_tvalid ), .s_axis_tx_tuser ( s_axis_tx_tuser ), .m_axis_rx_tdata ( m_axis_rx_tdata ), .m_axis_rx_tkeep ( m_axis_rx_tkeep ), .m_axis_rx_tlast ( m_axis_rx_tlast ), .m_axis_rx_tvalid ( m_axis_rx_tvalid ), .m_axis_rx_tready ( m_axis_rx_tready ), .m_axis_rx_tuser ( m_axis_rx_tuser ), .rx_np_ok ( rx_np_ok ), .rx_np_req ( rx_np_req ), .cfg_bus_number ( g2ip_cfg_bus_number ), .cfg_device_number ( g2ip_cfg_device_number ), .cfg_function_number ( g2ip_cfg_function_number ), //--------------------------------------------------------------------------------// // ---------- Virtex-7 Gen3 PCIe Integrated Block Ports ------------------------- // //--------------------------------------------------------------------------------// .s_axis_rq_tdata ( s_axis_rq_tdata ), .s_axis_rq_tuser ( s_axis_rq_tuser ), .s_axis_rq_tkeep ( s_axis_rq_tkeep ), .s_axis_rq_tlast ( s_axis_rq_tlast ), .s_axis_rq_tvalid ( s_axis_rq_tvalid ), .s_axis_rq_tready ( s_axis_rq_tready ), .m_axis_rc_tdata ( m_axis_rc_tdata ), .m_axis_rc_tuser ( m_axis_rc_tuser ), .m_axis_rc_tkeep ( m_axis_rc_tkeep ), .m_axis_rc_tlast ( m_axis_rc_tlast ), .m_axis_rc_tvalid ( m_axis_rc_tvalid ), .m_axis_rc_tready ( m_axis_rc_tready ), .m_axis_cq_tdata ( m_axis_cq_tdata ), .m_axis_cq_tuser ( m_axis_cq_tuser ), .m_axis_cq_tkeep ( m_axis_cq_tkeep ), .m_axis_cq_tlast ( m_axis_cq_tlast ), .m_axis_cq_tvalid ( m_axis_cq_tvalid ), .m_axis_cq_tready ( m_axis_cq_tready ), .s_axis_cc_tdata ( s_axis_cc_tdata ), .s_axis_cc_tuser ( s_axis_cc_tuser ), .s_axis_cc_tkeep ( s_axis_cc_tkeep ), .s_axis_cc_tlast ( s_axis_cc_tlast ), .s_axis_cc_tvalid ( s_axis_cc_tvalid ), .s_axis_cc_tready ( s_axis_cc_tready ), .pcie_rq_seq_num ( pcie_rq_seq_num ), .pcie_rq_seq_num_vld ( pcie_rq_seq_num_vld ), .pcie_rq_tag ( pcie_rq_tag ), .pcie_rq_tag_vld ( pcie_rq_tag_vld ), .pcie_cq_np_req ( pcie_cq_np_req ), .pcie_cq_np_req_count ( pcie_cq_np_req_count ), //--------------------------------------------------------------------------------// // ---------- System (SYS) Interface -------------------------------------------- // //--------------------------------------------------------------------------------// .user_clk ( user_clk ), .user_reset ( user_reset ) ); //--------------------------------------------------------------------------------// // ---------- CFG and Other Sidebands Signals ------------------------------------// //--------------------------------------------------------------------------------// xdma_0_cfg_sideband #( .C_AXI_DATA_WIDTH ( C_AXI_DATA_WIDTH ), .C_KEEP_WIDTH ( C_KEEP_WIDTH ), .PL_LINK_CAP_MAX_LINK_WIDTH ( PL_LINK_CAP_MAX_LINK_WIDTH ), .C_LEGACY_INT_EN ( C_LEGACY_INT_EN ), .C_MSI_EN ( C_MSI_EN ), .C_MSIX_EN ( C_MSIX_EN ), .TCQ ( TCQ ) ) xdma_0_cfg_sideband_i ( //--------------------------------------------------------------------------------// // ---------- 7-series Gen2 PCIe Integrated Block Ports ------------------------- // //--------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------// // AXI-S Interface // //-------------------------------------------------------------------------------------// // Common .g2ip_user_lnk_up ( g2ip_user_lnk_up ), .g2ip_user_app_rdy ( g2ip_user_app_rdy ), // TX .s_axis_tx_tdata ( s_axis_tx_msix_tdata ), .s_axis_tx_tvalid ( s_axis_tx_msix_tvalid ), .s_axis_tx_tready ( s_axis_tx_msix_tready ), .s_axis_tx_tkeep ( s_axis_tx_msix_tkeep ), .s_axis_tx_tlast ( s_axis_tx_msix_tlast ), .s_axis_tx_tuser ( s_axis_tx_msix_tuser ), //-------------------------------------------------------------------------------------// // Flow Control Interface // //-------------------------------------------------------------------------------------// .g2ip_fc_cpld ( g2ip_fc_cpld ), .g2ip_fc_cplh ( g2ip_fc_cplh ), .g2ip_fc_npd ( g2ip_fc_npd ), .g2ip_fc_nph ( g2ip_fc_nph ), .g2ip_fc_pd ( g2ip_fc_pd ), .g2ip_fc_ph ( g2ip_fc_ph ), .g2ip_fc_sel ( g2ip_fc_sel ), //-------------------------------------------------------------------------------------// // Configuration (CFG) Interface // //-------------------------------------------------------------------------------------// .g2ip_cfg_device_number ( g2ip_cfg_device_number ), .g2ip_cfg_dcommand2 ( g2ip_cfg_dcommand2 ), .g2ip_cfg_pmcsr_pme_status ( g2ip_cfg_pmcsr_pme_status ), .g2ip_cfg_status ( g2ip_cfg_status ), .g2ip_cfg_to_turnoff ( g2ip_cfg_to_turnoff ), .g2ip_cfg_received_func_lvl_rst ( g2ip_cfg_received_func_lvl_rst ), .g2ip_cfg_dcommand ( g2ip_cfg_dcommand ), .g2ip_cfg_bus_number ( g2ip_cfg_bus_number ), .g2ip_cfg_function_number ( g2ip_cfg_function_number ), .g2ip_cfg_command ( g2ip_cfg_command ), .g2ip_cfg_dstatus ( g2ip_cfg_dstatus ), .g2ip_cfg_lstatus ( g2ip_cfg_lstatus ), .g2ip_cfg_pcie_link_state ( g2ip_cfg_pcie_link_state ), .g2ip_cfg_lcommand ( g2ip_cfg_lcommand ), .g2ip_cfg_pmcsr_pme_en ( g2ip_cfg_pmcsr_pme_en ), .g2ip_cfg_pmcsr_powerstate ( g2ip_cfg_pmcsr_powerstate ), .g2ip_cfg_trn_pending ( g2ip_cfg_trn_pending ), .g2ip_cfg_pm_halt_aspm_l0s ( g2ip_cfg_pm_halt_aspm_l0s ), .g2ip_cfg_pm_halt_aspm_l1 ( g2ip_cfg_pm_halt_aspm_l1 ), .g2ip_cfg_pm_force_state_en ( g2ip_cfg_pm_force_state_en ), .g2ip_cfg_pm_force_state ( g2ip_cfg_pm_force_state ), .g2ip_cfg_dsn ( g2ip_cfg_dsn ), .g2ip_cfg_turnoff_ok ( g2ip_cfg_turnoff_ok ), .g2ip_cfg_pm_wake ( g2ip_cfg_pm_wake ), .g2ip_cfg_pm_send_pme_to ( g2ip_cfg_pm_send_pme_to ), .g2ip_cfg_ds_bus_number ( g2ip_cfg_ds_bus_number ), .g2ip_cfg_ds_device_number ( g2ip_cfg_ds_device_number ), .g2ip_cfg_ds_function_number ( g2ip_cfg_ds_function_number ), .g2ip_tx_buf_av ( g2ip_tx_buf_av ), .g2ip_tx_err_drop ( g2ip_tx_err_drop ), .g2ip_tx_cfg_req ( g2ip_tx_cfg_req ), .g2ip_tx_cfg_gnt ( g2ip_tx_cfg_gnt ), //------------------------------------------------// // RP Only // //------------------------------------------------// .g2ip_cfg_bridge_serr_en ( g2ip_cfg_bridge_serr_en ), .g2ip_cfg_slot_control_electromech_il_ctl_pulse ( g2ip_cfg_slot_control_electromech_il_ctl_pulse ), .g2ip_cfg_root_control_syserr_corr_err_en ( g2ip_cfg_root_control_syserr_corr_err_en ), .g2ip_cfg_root_control_syserr_non_fatal_err_en ( g2ip_cfg_root_control_syserr_non_fatal_err_en ), .g2ip_cfg_root_control_syserr_fatal_err_en ( g2ip_cfg_root_control_syserr_fatal_err_en ), .g2ip_cfg_root_control_pme_int_en ( g2ip_cfg_root_control_pme_int_en ), .g2ip_cfg_aer_rooterr_corr_err_reporting_en ( g2ip_cfg_aer_rooterr_corr_err_reporting_en ), .g2ip_cfg_aer_rooterr_non_fatal_err_reporting_en ( g2ip_cfg_aer_rooterr_non_fatal_err_reporting_en ), .g2ip_cfg_aer_rooterr_fatal_err_reporting_en ( g2ip_cfg_aer_rooterr_fatal_err_reporting_en ), .g2ip_cfg_aer_rooterr_corr_err_received ( g2ip_cfg_aer_rooterr_corr_err_received ), .g2ip_cfg_aer_rooterr_non_fatal_err_received ( g2ip_cfg_aer_rooterr_non_fatal_err_received ), .g2ip_cfg_aer_rooterr_fatal_err_received ( g2ip_cfg_aer_rooterr_fatal_err_received ), //-------------------------------------------------------------------------------------// // VC interface // //-------------------------------------------------------------------------------------// .g2ip_cfg_vc_tcvc_map ( g2ip_cfg_vc_tcvc_map ), // Management Interface .g2ip_cfg_mgmt_di ( g2ip_cfg_mgmt_di ), .g2ip_cfg_mgmt_byte_en ( g2ip_cfg_mgmt_byte_en ), .g2ip_cfg_mgmt_dwaddr ( g2ip_cfg_mgmt_dwaddr ), .g2ip_cfg_mgmt_wr_en ( g2ip_cfg_mgmt_wr_en ), .g2ip_cfg_mgmt_rd_en ( g2ip_cfg_mgmt_rd_en ), .g2ip_cfg_mgmt_wr_readonly ( g2ip_cfg_mgmt_wr_readonly ), .g2ip_cfg_mgmt_wr_rw1c_as_rw ( g2ip_cfg_mgmt_wr_rw1c_as_rw ), //------------------------------------------------// // EP and RP // //------------------------------------------------// .g2ip_cfg_mgmt_do ( g2ip_cfg_mgmt_do ), .g2ip_cfg_mgmt_rd_wr_done ( g2ip_cfg_mgmt_rd_wr_done ), // Error Reporting Interface .g2ip_cfg_err_ecrc ( g2ip_cfg_err_ecrc ), .g2ip_cfg_err_ur ( g2ip_cfg_err_ur ), .g2ip_cfg_err_cpl_timeout ( g2ip_cfg_err_cpl_timeout ), .g2ip_cfg_err_cpl_unexpect ( g2ip_cfg_err_cpl_unexpect ), .g2ip_cfg_err_cpl_abort ( g2ip_cfg_err_cpl_abort ), .g2ip_cfg_err_posted ( g2ip_cfg_err_posted ), .g2ip_cfg_err_cor ( g2ip_cfg_err_cor ), .g2ip_cfg_err_atomic_egress_blocked ( g2ip_cfg_err_atomic_egress_blocked ), .g2ip_cfg_err_internal_cor ( g2ip_cfg_err_internal_cor ), .g2ip_cfg_err_malformed ( g2ip_cfg_err_malformed ), .g2ip_cfg_err_mc_blocked ( g2ip_cfg_err_mc_blocked ), .g2ip_cfg_err_poisoned ( g2ip_cfg_err_poisoned ), .g2ip_cfg_err_norecovery ( g2ip_cfg_err_norecovery ), .g2ip_cfg_err_tlp_cpl_header ( g2ip_cfg_err_tlp_cpl_header ), .g2ip_cfg_err_cpl_rdy ( g2ip_cfg_err_cpl_rdy ), .g2ip_cfg_err_locked ( g2ip_cfg_err_locked ), .g2ip_cfg_err_acs ( g2ip_cfg_err_acs ), .g2ip_cfg_err_internal_uncor ( g2ip_cfg_err_internal_uncor ), //-------------------------------------------------------------------------------------// // AER Interface // //-------------------------------------------------------------------------------------// .g2ip_cfg_err_aer_headerlog ( g2ip_cfg_err_aer_headerlog ), .g2ip_cfg_aer_interrupt_msgnum ( g2ip_cfg_aer_interrupt_msgnum ), .g2ip_cfg_err_aer_headerlog_set ( g2ip_cfg_err_aer_headerlog_set ), .g2ip_cfg_aer_ecrc_check_en ( g2ip_cfg_aer_ecrc_check_en ), .g2ip_cfg_aer_ecrc_gen_en ( g2ip_cfg_aer_ecrc_gen_en ), //------------------------------------------------// // EP Only // //------------------------------------------------// .g2ip_cfg_interrupt ( g2ip_cfg_interrupt ), .g2ip_cfg_interrupt_rdy ( g2ip_cfg_interrupt_rdy ), .g2ip_cfg_interrupt_assert ( g2ip_cfg_interrupt_assert ), .g2ip_cfg_interrupt_di ( g2ip_cfg_interrupt_di ), .g2ip_cfg_interrupt_do ( g2ip_cfg_interrupt_do ), .g2ip_cfg_interrupt_mmenable ( g2ip_cfg_interrupt_mmenable ), .g2ip_cfg_interrupt_msienable ( g2ip_cfg_interrupt_msienable ), .g2ip_cfg_interrupt_msixenable ( g2ip_cfg_interrupt_msixenable ), .g2ip_cfg_interrupt_msixfm ( g2ip_cfg_interrupt_msixfm ), .g2ip_cfg_interrupt_stat ( g2ip_cfg_interrupt_stat ), .g2ip_cfg_pciecap_interrupt_msgnum ( g2ip_cfg_pciecap_interrupt_msgnum ), .g2ip_cfg_msg_received_err_cor ( g2ip_cfg_msg_received_err_cor ), .g2ip_cfg_msg_received_err_non_fatal ( g2ip_cfg_msg_received_err_non_fatal ), .g2ip_cfg_msg_received_err_fatal ( g2ip_cfg_msg_received_err_fatal ), .g2ip_cfg_msg_received_pm_as_nak ( g2ip_cfg_msg_received_pm_as_nak ), .g2ip_cfg_msg_received_pme_to_ack ( g2ip_cfg_msg_received_pme_to_ack ), .g2ip_cfg_msg_received_assert_int_a ( g2ip_cfg_msg_received_assert_int_a ), .g2ip_cfg_msg_received_assert_int_b ( g2ip_cfg_msg_received_assert_int_b ), .g2ip_cfg_msg_received_assert_int_c ( g2ip_cfg_msg_received_assert_int_c ), .g2ip_cfg_msg_received_assert_int_d ( g2ip_cfg_msg_received_assert_int_d ), .g2ip_cfg_msg_received_deassert_int_a ( g2ip_cfg_msg_received_deassert_int_a ), .g2ip_cfg_msg_received_deassert_int_b ( g2ip_cfg_msg_received_deassert_int_b ), .g2ip_cfg_msg_received_deassert_int_c ( g2ip_cfg_msg_received_deassert_int_c ), .g2ip_cfg_msg_received_deassert_int_d ( g2ip_cfg_msg_received_deassert_int_d ), .g2ip_cfg_msg_received_pm_pme ( g2ip_cfg_msg_received_pm_pme ), .g2ip_cfg_msg_received_setslotpowerlimit ( g2ip_cfg_msg_received_setslotpowerlimit ), .g2ip_cfg_msg_received ( g2ip_cfg_msg_received ), .g2ip_cfg_msg_data ( g2ip_cfg_msg_data ), //-------------------------------------------------------------------------------------// // Physical Layer Control and Status (PL) Interface // //-------------------------------------------------------------------------------------// .g2ip_pl_directed_link_change ( g2ip_pl_directed_link_change ), .g2ip_pl_directed_link_width ( g2ip_pl_directed_link_width ), .g2ip_pl_directed_link_speed ( g2ip_pl_directed_link_speed ), .g2ip_pl_directed_link_auton ( g2ip_pl_directed_link_auton ), .g2ip_pl_upstream_prefer_deemph ( g2ip_pl_upstream_prefer_deemph ), .g2ip_pl_sel_lnk_rate ( g2ip_pl_sel_lnk_rate ), .g2ip_pl_sel_lnk_width ( g2ip_pl_sel_lnk_width ), .g2ip_pl_ltssm_state ( g2ip_pl_ltssm_state ), .g2ip_pl_lane_reversal_mode ( g2ip_pl_lane_reversal_mode ), .g2ip_pl_phy_lnk_up ( g2ip_pl_phy_lnk_up ), .g2ip_pl_tx_pm_state ( g2ip_pl_tx_pm_state ), .g2ip_pl_rx_pm_state ( g2ip_pl_rx_pm_state ), .g2ip_pl_link_upcfg_cap ( g2ip_pl_link_upcfg_cap ), .g2ip_pl_link_gen2_cap ( g2ip_pl_link_gen2_cap ), .g2ip_pl_link_partner_gen2_supported ( g2ip_pl_link_partner_gen2_supported ), .g2ip_pl_initial_link_width ( g2ip_pl_initial_link_width ), .g2ip_pl_directed_change_done ( g2ip_pl_directed_change_done ), //------------------------------------------------// // EP Only // //------------------------------------------------// .g2ip_pl_received_hot_rst ( g2ip_pl_received_hot_rst ), //------------------------------------------------// // RP Only // //------------------------------------------------// .g2ip_pl_transmit_hot_rst ( g2ip_pl_transmit_hot_rst ), .g2ip_pl_downstream_deemph_source ( g2ip_pl_downstream_deemph_source ), //-------------------------------------------------------------------------------------// // Transceiver Control Status and debug ports // //-------------------------------------------------------------------------------------// .g2ip_pipe_txprbssel ( g2ip_pipe_txprbssel ), .g2ip_pipe_rxprbssel ( g2ip_pipe_rxprbssel ), .g2ip_pipe_txprbsforceerr ( g2ip_pipe_txprbsforceerr ), .g2ip_pipe_rxprbscntreset ( g2ip_pipe_rxprbscntreset ), .g2ip_pipe_loopback ( g2ip_pipe_loopback ), .g2ip_gt_ch_drp_rdy ( g2ip_gt_ch_drp_rdy ), .g2ip_pipe_rxprbserr ( g2ip_pipe_rxprbserr ), .g2ip_pipe_txinhibit ( g2ip_pipe_txinhibit ), .g2ip_pipe_rst_fsm ( g2ip_pipe_rst_fsm ), .g2ip_pipe_qrst_fsm ( g2ip_pipe_qrst_fsm ), .g2ip_pipe_rate_fsm ( g2ip_pipe_rate_fsm ), .g2ip_pipe_sync_fsm_tx ( g2ip_pipe_sync_fsm_tx ), .g2ip_pipe_sync_fsm_rx ( g2ip_pipe_sync_fsm_rx ), .g2ip_pipe_drp_fsm ( g2ip_pipe_drp_fsm ), .g2ip_pipe_rst_idle ( g2ip_pipe_rst_idle ), .g2ip_pipe_qrst_idle ( g2ip_pipe_qrst_idle ), .g2ip_pipe_rate_idle ( g2ip_pipe_rate_idle ), .g2ip_pipe_eyescandataerror ( g2ip_pipe_eyescandataerror ), .g2ip_pipe_rxstatus ( g2ip_pipe_rxstatus ), .g2ip_pipe_dmonitorout ( g2ip_pipe_dmonitorout ), .g2ip_pipe_cpll_lock ( g2ip_pipe_cpll_lock ), .g2ip_pipe_qpll_lock ( g2ip_pipe_qpll_lock ), .g2ip_pipe_rxpmaresetdone ( g2ip_pipe_rxpmaresetdone ), .g2ip_pipe_rxbufstatus ( g2ip_pipe_rxbufstatus ), .g2ip_pipe_txphaligndone ( g2ip_pipe_txphaligndone ), .g2ip_pipe_txphinitdone ( g2ip_pipe_txphinitdone ), .g2ip_pipe_txdlysresetdone ( g2ip_pipe_txdlysresetdone ), .g2ip_pipe_rxphaligndone ( g2ip_pipe_rxphaligndone ), .g2ip_pipe_rxdlysresetdone ( g2ip_pipe_rxdlysresetdone ), .g2ip_pipe_rxsyncdone ( g2ip_pipe_rxsyncdone ), .g2ip_pipe_rxdisperr ( g2ip_pipe_rxdisperr ), .g2ip_pipe_rxnotintable ( g2ip_pipe_rxnotintable ), .g2ip_pipe_rxcommadet ( g2ip_pipe_rxcommadet ), .g2ip_pipe_debug_0 ( g2ip_pipe_debug_0 ), .g2ip_pipe_debug_1 ( g2ip_pipe_debug_1 ), .g2ip_pipe_debug_2 ( g2ip_pipe_debug_2 ), .g2ip_pipe_debug_3 ( g2ip_pipe_debug_3 ), .g2ip_pipe_debug_4 ( g2ip_pipe_debug_4 ), .g2ip_pipe_debug_5 ( g2ip_pipe_debug_5 ), .g2ip_pipe_debug_6 ( g2ip_pipe_debug_6 ), .g2ip_pipe_debug_7 ( g2ip_pipe_debug_7 ), .g2ip_pipe_debug_8 ( g2ip_pipe_debug_8 ), .g2ip_pipe_debug_9 ( g2ip_pipe_debug_9 ), .g2ip_pipe_debug ( g2ip_pipe_debug ), //--------------------------------------------------------------------------------// // ---------- Virtex-7 Gen3 PCIe Integrated Block Ports ------------------------- // //--------------------------------------------------------------------------------// .user_lnk_up ( user_lnk_up ), .pcie_tfc_nph_av ( pcie_tfc_nph_av ), .pcie_tfc_npd_av ( pcie_tfc_npd_av ), .cfg_phy_link_down ( cfg_phy_link_down ), .cfg_phy_link_status ( cfg_phy_link_status ), .cfg_negotiated_width ( cfg_negotiated_width ), .cfg_current_speed ( cfg_current_speed ), .cfg_max_payload ( cfg_max_payload ), .cfg_max_read_req ( cfg_max_read_req ), .cfg_function_status ( cfg_function_status ), .cfg_function_power_state ( cfg_function_power_state ), .cfg_link_power_state ( cfg_link_power_state ), // Management Interface .cfg_mgmt_addr ( cfg_mgmt_addr ), .cfg_mgmt_write ( cfg_mgmt_write ), .cfg_mgmt_write_data ( cfg_mgmt_write_data ), .cfg_mgmt_byte_enable ( cfg_mgmt_byte_enable ), .cfg_mgmt_read ( cfg_mgmt_read ), .cfg_mgmt_read_data ( cfg_mgmt_read_data ), .cfg_mgmt_read_write_done ( cfg_mgmt_read_write_done ), .cfg_mgmt_type1_cfg_reg_access ( cfg_mgmt_type1_cfg_reg_access ), // Error Reporting Interface .cfg_err_cor_out ( cfg_err_cor_out ), .cfg_err_nonfatal_out ( cfg_err_nonfatal_out ), .cfg_err_fatal_out ( cfg_err_fatal_out ), .cfg_ltr_enable ( cfg_ltr_enable ), .cfg_ltssm_state ( cfg_ltssm_state ), .cfg_rcb_status ( cfg_rcb_status ), .cfg_dpa_substate_change ( cfg_dpa_substate_change ), .cfg_obff_enable ( cfg_obff_enable ), .cfg_pl_status_change ( cfg_pl_status_change ), .cfg_msg_received ( cfg_msg_received ), .cfg_msg_received_data ( cfg_msg_received_data ), .cfg_msg_received_type ( cfg_msg_received_type ), .cfg_msg_transmit ( cfg_msg_transmit ), .cfg_msg_transmit_type ( cfg_msg_transmit_type ), .cfg_msg_transmit_data ( cfg_msg_transmit_data ), .cfg_msg_transmit_done ( cfg_msg_transmit_done ), .cfg_fc_ph ( cfg_fc_ph ), .cfg_fc_pd ( cfg_fc_pd ), .cfg_fc_nph ( cfg_fc_nph ), .cfg_fc_npd ( cfg_fc_npd ), .cfg_fc_cplh ( cfg_fc_cplh ), .cfg_fc_cpld ( cfg_fc_cpld ), .cfg_fc_sel ( cfg_fc_sel ), .cfg_per_func_status_control ( cfg_per_func_status_control ), .cfg_per_func_status_data ( cfg_per_func_status_data ), .cfg_per_function_number ( cfg_per_function_number ), .cfg_per_function_output_request ( cfg_per_function_output_request ), .cfg_per_function_update_done ( cfg_per_function_update_done ), .cfg_subsys_vend_id ( cfg_subsys_vend_id ), .cfg_dsn ( cfg_dsn ), .cfg_power_state_change_ack ( cfg_power_state_change_ack ), .cfg_power_state_change_interrupt ( cfg_power_state_change_interrupt ), .cfg_err_cor_in ( cfg_err_cor_in ), .cfg_err_uncor_in ( cfg_err_uncor_in ), .cfg_link_training_enable ( cfg_link_training_enable ), .cfg_ext_read_received ( cfg_ext_read_received ), .cfg_ext_write_received ( cfg_ext_write_received ), .cfg_ext_register_number ( cfg_ext_register_number ), .cfg_ext_function_number ( cfg_ext_function_number ), .cfg_ext_write_data ( cfg_ext_write_data ), .cfg_ext_write_byte_enable ( cfg_ext_write_byte_enable ), .cfg_ext_read_data ( cfg_ext_read_data ), .cfg_ext_read_data_valid ( cfg_ext_read_data_valid ), //-------------------------------------------------------------------------------// // EP Only // //-------------------------------------------------------------------------------// // Interrupt Interface Signals .cfg_interrupt_int ( cfg_interrupt_int ), .cfg_interrupt_pending ( cfg_interrupt_pending ), .cfg_interrupt_sent ( cfg_interrupt_sent ), .cfg_interrupt_msi_enable ( cfg_interrupt_msi_enable ), .cfg_interrupt_msi_mmenable ( cfg_interrupt_msi_mmenable ), .cfg_interrupt_msi_mask_update ( cfg_interrupt_msi_mask_update ), .cfg_interrupt_msi_data ( cfg_interrupt_msi_data ), .cfg_interrupt_msi_select ( cfg_interrupt_msi_select ), .cfg_interrupt_msi_int ( cfg_interrupt_msi_int ), .cfg_interrupt_msi_pending_status ( cfg_interrupt_msi_pending_status ), .cfg_interrupt_msi_sent ( cfg_interrupt_msi_sent ), .cfg_interrupt_msi_fail ( cfg_interrupt_msi_fail ), .cfg_interrupt_msi_attr ( cfg_interrupt_msi_attr ), .cfg_interrupt_msi_tph_present ( cfg_interrupt_msi_tph_present ), .cfg_interrupt_msi_tph_type ( cfg_interrupt_msi_tph_type ), .cfg_interrupt_msi_tph_st_tag ( cfg_interrupt_msi_tph_st_tag ), .cfg_interrupt_msi_function_number ( cfg_interrupt_msi_function_number ), .cfg_interrupt_msi_vf_enable ( cfg_interrupt_msi_vf_enable ), .cfg_interrupt_msix_data ( cfg_interrupt_msix_data ), .cfg_interrupt_msix_address ( cfg_interrupt_msix_address ), .cfg_interrupt_msix_int ( cfg_interrupt_msix_int ), .cfg_interrupt_msix_enable ( cfg_interrupt_msix_enable ), .cfg_interrupt_msix_mask ( cfg_interrupt_msix_mask ), .cfg_interrupt_msix_vf_enable ( cfg_interrupt_msix_vf_enable ), .cfg_interrupt_msix_vf_mask ( cfg_interrupt_msix_vf_mask ), .cfg_interrupt_msix_sent ( cfg_interrupt_msix_sent ), .cfg_interrupt_msix_fail ( cfg_interrupt_msix_fail ), .cfg_vf_status ( cfg_vf_status ), .cfg_vf_power_state ( cfg_vf_power_state ), .cfg_tph_requester_enable ( cfg_tph_requester_enable ), .cfg_tph_st_mode ( cfg_tph_st_mode ), .cfg_vf_tph_requester_enable ( cfg_vf_tph_requester_enable ), .cfg_vf_tph_st_mode ( cfg_vf_tph_st_mode ), .cfg_flr_in_process ( cfg_flr_in_process ), .cfg_vf_flr_in_process ( cfg_vf_flr_in_process ), // EP only .cfg_flr_done ( cfg_flr_done ), .cfg_vf_flr_done ( cfg_vf_flr_done ), .cfg_hot_reset_out ( cfg_hot_reset_out ), .cfg_config_space_enable ( cfg_config_space_enable ), .cfg_req_pm_transition_l23_ready ( cfg_req_pm_transition_l23_ready ), // RP only .cfg_hot_reset_in ( cfg_hot_reset_in ), .cfg_ds_bus_number ( cfg_ds_bus_number ), .cfg_ds_device_number ( cfg_ds_device_number ), .cfg_ds_function_number ( cfg_ds_function_number ), .cfg_ds_port_number ( cfg_ds_port_number ), //--------------------------------------------------------------------------------------// // Transceiver Debug And Status Ports // //--------------------------------------------------------------------------------------// .pipe_txprbssel ( pipe_txprbssel ), .pipe_rxprbssel ( pipe_rxprbssel ), .pipe_txprbsforceerr ( pipe_txprbsforceerr ), .pipe_rxprbscntreset ( pipe_rxprbscntreset ), .pipe_loopback ( pipe_loopback ), .pipe_rxprbserr ( pipe_rxprbserr ), .pipe_txinhibit ( pipe_txinhibit ), .pipe_rst_fsm ( pipe_rst_fsm ), .pipe_qrst_fsm ( pipe_qrst_fsm ), .pipe_rate_fsm ( pipe_rate_fsm ), .pipe_sync_fsm_tx ( pipe_sync_fsm_tx ), .pipe_sync_fsm_rx ( pipe_sync_fsm_rx ), .pipe_drp_fsm ( pipe_drp_fsm ), .pipe_rst_idle ( pipe_rst_idle ), .pipe_qrst_idle ( pipe_qrst_idle ), .pipe_rate_idle ( pipe_rate_idle ), .pipe_eyescandataerror ( pipe_eyescandataerror ), .pipe_rxstatus ( pipe_rxstatus ), .pipe_dmonitorout ( pipe_dmonitorout ), .pipe_cpll_lock ( pipe_cpll_lock ), .pipe_qpll_lock ( pipe_qpll_lock ), .pipe_rxpmaresetdone ( pipe_rxpmaresetdone ), .pipe_rxbufstatus ( pipe_rxbufstatus ), .pipe_txphaligndone ( pipe_txphaligndone ), .pipe_txphinitdone ( pipe_txphinitdone ), .pipe_txdlysresetdone ( pipe_txdlysresetdone ), .pipe_rxphaligndone ( pipe_rxphaligndone ), .pipe_rxdlysresetdone ( pipe_rxdlysresetdone ), .pipe_rxsyncdone ( pipe_rxsyncdone ), .pipe_rxdisperr ( pipe_rxdisperr ), .pipe_rxnotintable ( pipe_rxnotintable ), .pipe_rxcommadet ( pipe_rxcommadet ), .gt_ch_drp_rdy ( gt_ch_drp_rdy ), .pipe_debug_0 ( pipe_debug_0 ), .pipe_debug_1 ( pipe_debug_1 ), .pipe_debug_2 ( pipe_debug_2 ), .pipe_debug_3 ( pipe_debug_3 ), .pipe_debug_4 ( pipe_debug_4 ), .pipe_debug_5 ( pipe_debug_5 ), .pipe_debug_6 ( pipe_debug_6 ), .pipe_debug_7 ( pipe_debug_7 ), .pipe_debug_8 ( pipe_debug_8 ), .pipe_debug_9 ( pipe_debug_9 ), .pipe_debug ( pipe_debug ), //-------------------------------------------------------------------------------------// // ---------- System (SYS) Interface ------------------------------------------------- // //-------------------------------------------------------------------------------------// .user_clk ( user_clk ), .user_reset ( user_reset ) ); //--------------------------------------------------------------------------------// // ---------- 7-Series Integrated Block for PCI Express ------------------------- // //--------------------------------------------------------------------------------// xdma_0_pcie2_ip pcie2_ip_i ( //-------------------------------------------------------------------------------------// // PCI Express (pci_exp) Interface // //-------------------------------------------------------------------------------------// // Tx .pci_exp_txn ( pci_exp_txn ), .pci_exp_txp ( pci_exp_txp ), // Rx .pci_exp_rxn ( pci_exp_rxn ), .pci_exp_rxp ( pci_exp_rxp ), //-------------------------------------------------------------------------------------// // AXI-S Interface // //-------------------------------------------------------------------------------------// // Common .user_clk_out ( user_clk ), .user_reset_out ( user_reset ), .user_lnk_up ( g2ip_user_lnk_up ), .user_app_rdy ( g2ip_user_app_rdy ), // TX .s_axis_tx_tready ( s_axis_tx_tready ), .s_axis_tx_tdata ( s_axis_tx_tdata ), .s_axis_tx_tkeep ( s_axis_tx_tkeep ), .s_axis_tx_tuser ( s_axis_tx_tuser ), .s_axis_tx_tlast ( s_axis_tx_tlast ), .s_axis_tx_tvalid ( s_axis_tx_tvalid ), // RX .m_axis_rx_tdata ( m_axis_rx_tdata ), .m_axis_rx_tkeep ( m_axis_rx_tkeep ), .m_axis_rx_tlast ( m_axis_rx_tlast ), .m_axis_rx_tvalid ( m_axis_rx_tvalid ), .m_axis_rx_tready ( m_axis_rx_tready ), .m_axis_rx_tuser ( m_axis_rx_tuser ), .rx_np_ok ( rx_np_ok ), .rx_np_req ( rx_np_req ), //-------------------------------------------------------------------------------------// // Flow Control Interface // //-------------------------------------------------------------------------------------// .fc_cpld ( g2ip_fc_cpld ), .fc_cplh ( g2ip_fc_cplh ), .fc_npd ( g2ip_fc_npd ), .fc_nph ( g2ip_fc_nph ), .fc_pd ( g2ip_fc_pd ), .fc_ph ( g2ip_fc_ph ), .fc_sel ( g2ip_fc_sel ), //-------------------------------------------------------------------------------------// // Configuration (CFG) Interface // //-------------------------------------------------------------------------------------// .cfg_device_number ( g2ip_cfg_device_number ), .cfg_dcommand2 ( g2ip_cfg_dcommand2 ), .cfg_pmcsr_pme_status ( g2ip_cfg_pmcsr_pme_status ), .cfg_status ( g2ip_cfg_status ), .cfg_to_turnoff ( g2ip_cfg_to_turnoff ), .cfg_received_func_lvl_rst ( g2ip_cfg_received_func_lvl_rst ), .cfg_dcommand ( g2ip_cfg_dcommand ), .cfg_bus_number ( g2ip_cfg_bus_number ), .cfg_function_number ( g2ip_cfg_function_number ), .cfg_command ( g2ip_cfg_command ), .cfg_dstatus ( g2ip_cfg_dstatus ), .cfg_lstatus ( g2ip_cfg_lstatus ), .cfg_pcie_link_state ( g2ip_cfg_pcie_link_state ), .cfg_lcommand ( g2ip_cfg_lcommand ), .cfg_pmcsr_pme_en ( g2ip_cfg_pmcsr_pme_en ), .cfg_pmcsr_powerstate ( g2ip_cfg_pmcsr_powerstate ), .cfg_trn_pending ( g2ip_cfg_trn_pending ), .cfg_pm_halt_aspm_l0s ( g2ip_cfg_pm_halt_aspm_l0s ), .cfg_pm_halt_aspm_l1 ( g2ip_cfg_pm_halt_aspm_l1 ), .cfg_pm_force_state_en ( g2ip_cfg_pm_force_state_en ), .cfg_pm_force_state ( g2ip_cfg_pm_force_state ), .cfg_dsn ( g2ip_cfg_dsn ), .cfg_turnoff_ok ( g2ip_cfg_turnoff_ok ), .cfg_pm_wake ( g2ip_cfg_pm_wake ), .cfg_pm_send_pme_to ( g2ip_cfg_pm_send_pme_to ), .cfg_ds_bus_number ( g2ip_cfg_ds_bus_number ), .cfg_ds_device_number ( g2ip_cfg_ds_device_number ), .cfg_ds_function_number ( g2ip_cfg_ds_function_number ), .tx_buf_av ( g2ip_tx_buf_av ), .tx_err_drop ( g2ip_tx_err_drop ), .tx_cfg_req ( g2ip_tx_cfg_req ), .tx_cfg_gnt ( g2ip_tx_cfg_gnt ), //------------------------------------------------// // RP Only // //------------------------------------------------// .cfg_bridge_serr_en ( g2ip_cfg_bridge_serr_en ), .cfg_slot_control_electromech_il_ctl_pulse ( g2ip_cfg_slot_control_electromech_il_ctl_pulse ), .cfg_root_control_syserr_corr_err_en ( g2ip_cfg_root_control_syserr_corr_err_en ), .cfg_root_control_syserr_non_fatal_err_en ( g2ip_cfg_root_control_syserr_non_fatal_err_en ), .cfg_root_control_syserr_fatal_err_en ( g2ip_cfg_root_control_syserr_fatal_err_en ), .cfg_root_control_pme_int_en ( g2ip_cfg_root_control_pme_int_en ), .cfg_aer_rooterr_corr_err_reporting_en ( g2ip_cfg_aer_rooterr_corr_err_reporting_en ), .cfg_aer_rooterr_non_fatal_err_reporting_en ( g2ip_cfg_aer_rooterr_non_fatal_err_reporting_en ), .cfg_aer_rooterr_fatal_err_reporting_en ( g2ip_cfg_aer_rooterr_fatal_err_reporting_en ), .cfg_aer_rooterr_corr_err_received ( g2ip_cfg_aer_rooterr_corr_err_received ), .cfg_aer_rooterr_non_fatal_err_received ( g2ip_cfg_aer_rooterr_non_fatal_err_received ), .cfg_aer_rooterr_fatal_err_received ( g2ip_cfg_aer_rooterr_fatal_err_received ), //-------------------------------------------------------------------------------------// // VC interface // //-------------------------------------------------------------------------------------// .cfg_vc_tcvc_map ( g2ip_cfg_vc_tcvc_map ), // Management Interface .cfg_mgmt_di ( g2ip_cfg_mgmt_di ), .cfg_mgmt_byte_en ( g2ip_cfg_mgmt_byte_en ), .cfg_mgmt_dwaddr ( g2ip_cfg_mgmt_dwaddr ), .cfg_mgmt_wr_en ( g2ip_cfg_mgmt_wr_en ), .cfg_mgmt_rd_en ( g2ip_cfg_mgmt_rd_en ), .cfg_mgmt_wr_readonly ( g2ip_cfg_mgmt_wr_readonly ), .cfg_mgmt_wr_rw1c_as_rw ( g2ip_cfg_mgmt_wr_rw1c_as_rw ), //------------------------------------------------// // EP and RP // //------------------------------------------------// .cfg_mgmt_do ( g2ip_cfg_mgmt_do ), .cfg_mgmt_rd_wr_done ( g2ip_cfg_mgmt_rd_wr_done ), // Error Reporting Interface .cfg_err_ecrc ( g2ip_cfg_err_ecrc ), .cfg_err_ur ( g2ip_cfg_err_ur ), .cfg_err_cpl_timeout ( g2ip_cfg_err_cpl_timeout ), .cfg_err_cpl_unexpect ( g2ip_cfg_err_cpl_unexpect ), .cfg_err_cpl_abort ( g2ip_cfg_err_cpl_abort ), .cfg_err_posted ( g2ip_cfg_err_posted ), .cfg_err_cor ( g2ip_cfg_err_cor ), .cfg_err_atomic_egress_blocked ( g2ip_cfg_err_atomic_egress_blocked ), .cfg_err_internal_cor ( g2ip_cfg_err_internal_cor ), .cfg_err_malformed ( g2ip_cfg_err_malformed ), .cfg_err_mc_blocked ( g2ip_cfg_err_mc_blocked ), .cfg_err_poisoned ( g2ip_cfg_err_poisoned ), .cfg_err_norecovery ( g2ip_cfg_err_norecovery ), .cfg_err_tlp_cpl_header ( g2ip_cfg_err_tlp_cpl_header ), .cfg_err_cpl_rdy ( g2ip_cfg_err_cpl_rdy ), .cfg_err_locked ( g2ip_cfg_err_locked ), .cfg_err_acs ( g2ip_cfg_err_acs ), .cfg_err_internal_uncor ( g2ip_cfg_err_internal_uncor ), //-------------------------------------------------------------------------------------// // AER Interface // //-------------------------------------------------------------------------------------// .cfg_err_aer_headerlog ( g2ip_cfg_err_aer_headerlog ), .cfg_aer_interrupt_msgnum ( g2ip_cfg_aer_interrupt_msgnum ), .cfg_err_aer_headerlog_set ( g2ip_cfg_err_aer_headerlog_set ), .cfg_aer_ecrc_check_en ( g2ip_cfg_aer_ecrc_check_en ), .cfg_aer_ecrc_gen_en ( g2ip_cfg_aer_ecrc_gen_en ), //------------------------------------------------// // EP Only // //------------------------------------------------// .cfg_interrupt ( g2ip_cfg_interrupt ), .cfg_interrupt_rdy ( g2ip_cfg_interrupt_rdy ), .cfg_interrupt_assert ( g2ip_cfg_interrupt_assert ), .cfg_interrupt_di ( g2ip_cfg_interrupt_di ), .cfg_interrupt_do ( g2ip_cfg_interrupt_do ), .cfg_interrupt_mmenable ( g2ip_cfg_interrupt_mmenable ), .cfg_interrupt_msienable ( g2ip_cfg_interrupt_msienable ), .cfg_interrupt_msixenable ( g2ip_cfg_interrupt_msixenable ), .cfg_interrupt_msixfm ( g2ip_cfg_interrupt_msixfm ), .cfg_interrupt_stat ( g2ip_cfg_interrupt_stat ), .cfg_pciecap_interrupt_msgnum ( g2ip_cfg_pciecap_interrupt_msgnum ), .cfg_msg_received_err_cor ( g2ip_cfg_msg_received_err_cor ), .cfg_msg_received_err_non_fatal ( g2ip_cfg_msg_received_err_non_fatal ), .cfg_msg_received_err_fatal ( g2ip_cfg_msg_received_err_fatal ), .cfg_msg_received_pm_as_nak ( g2ip_cfg_msg_received_pm_as_nak ), .cfg_msg_received_pme_to_ack ( g2ip_cfg_msg_received_pme_to_ack ), .cfg_msg_received_assert_int_a ( g2ip_cfg_msg_received_assert_int_a ), .cfg_msg_received_assert_int_b ( g2ip_cfg_msg_received_assert_int_b ), .cfg_msg_received_assert_int_c ( g2ip_cfg_msg_received_assert_int_c ), .cfg_msg_received_assert_int_d ( g2ip_cfg_msg_received_assert_int_d ), .cfg_msg_received_deassert_int_a ( g2ip_cfg_msg_received_deassert_int_a ), .cfg_msg_received_deassert_int_b ( g2ip_cfg_msg_received_deassert_int_b ), .cfg_msg_received_deassert_int_c ( g2ip_cfg_msg_received_deassert_int_c ), .cfg_msg_received_deassert_int_d ( g2ip_cfg_msg_received_deassert_int_d ), .cfg_msg_received_pm_pme ( g2ip_cfg_msg_received_pm_pme ), .cfg_msg_received_setslotpowerlimit ( g2ip_cfg_msg_received_setslotpowerlimit ), .cfg_msg_received ( g2ip_cfg_msg_received ), .cfg_msg_data ( g2ip_cfg_msg_data ), //-------------------------------------------------------------------------------------// // Physical Layer Control and Status (PL) Interface // //-------------------------------------------------------------------------------------// .pl_directed_link_change ( g2ip_pl_directed_link_change ), .pl_directed_link_width ( g2ip_pl_directed_link_width ), .pl_directed_link_speed ( g2ip_pl_directed_link_speed ), .pl_directed_link_auton ( g2ip_pl_directed_link_auton ), .pl_upstream_prefer_deemph ( g2ip_pl_upstream_prefer_deemph ), .pl_sel_lnk_rate ( g2ip_pl_sel_lnk_rate ), .pl_sel_lnk_width ( g2ip_pl_sel_lnk_width ), .pl_ltssm_state ( g2ip_pl_ltssm_state ), .pl_lane_reversal_mode ( g2ip_pl_lane_reversal_mode ), .pl_phy_lnk_up ( g2ip_pl_phy_lnk_up ), .pl_tx_pm_state ( g2ip_pl_tx_pm_state ), .pl_rx_pm_state ( g2ip_pl_rx_pm_state ), .pl_link_upcfg_cap ( g2ip_pl_link_upcfg_cap ), .pl_link_gen2_cap ( g2ip_pl_link_gen2_cap ), .pl_link_partner_gen2_supported ( g2ip_pl_link_partner_gen2_supported ), .pl_initial_link_width ( g2ip_pl_initial_link_width ), .pl_directed_change_done ( g2ip_pl_directed_change_done ), //------------------------------------------------// // EP Only // //------------------------------------------------// .pl_received_hot_rst ( g2ip_pl_received_hot_rst ), //------------------------------------------------// // RP Only // //------------------------------------------------// .pl_transmit_hot_rst ( g2ip_pl_transmit_hot_rst ), .pl_downstream_deemph_source ( g2ip_pl_downstream_deemph_source ), //-------------------------------------------------------------------------------------// // Transceiver Control Status and debug ports // //-------------------------------------------------------------------------------------// .pipe_txprbssel ( g2ip_pipe_txprbssel ), .pipe_rxprbssel ( g2ip_pipe_rxprbssel ), .pipe_txprbsforceerr ( g2ip_pipe_txprbsforceerr ), .pipe_rxprbscntreset ( g2ip_pipe_rxprbscntreset ), .pipe_loopback ( g2ip_pipe_loopback ), .gt_ch_drp_rdy ( g2ip_gt_ch_drp_rdy ), .pipe_rxprbserr ( g2ip_pipe_rxprbserr ), .pipe_txinhibit ( g2ip_pipe_txinhibit ), .pipe_rst_fsm ( g2ip_pipe_rst_fsm ), .pipe_qrst_fsm ( g2ip_pipe_qrst_fsm ), .pipe_rate_fsm ( g2ip_pipe_rate_fsm ), .pipe_sync_fsm_tx ( g2ip_pipe_sync_fsm_tx ), .pipe_sync_fsm_rx ( g2ip_pipe_sync_fsm_rx ), .pipe_drp_fsm ( g2ip_pipe_drp_fsm ), .pipe_rst_idle ( g2ip_pipe_rst_idle ), .pipe_qrst_idle ( g2ip_pipe_qrst_idle ), .pipe_rate_idle ( g2ip_pipe_rate_idle ), .pipe_eyescandataerror ( g2ip_pipe_eyescandataerror ), .pipe_rxstatus ( g2ip_pipe_rxstatus ), .pipe_dmonitorout ( g2ip_pipe_dmonitorout ), .pipe_cpll_lock ( g2ip_pipe_cpll_lock ), .pipe_qpll_lock ( g2ip_pipe_qpll_lock ), .pipe_rxpmaresetdone ( g2ip_pipe_rxpmaresetdone ), .pipe_rxbufstatus ( g2ip_pipe_rxbufstatus ), .pipe_txphaligndone ( g2ip_pipe_txphaligndone ), .pipe_txphinitdone ( g2ip_pipe_txphinitdone ), .pipe_txdlysresetdone ( g2ip_pipe_txdlysresetdone ), .pipe_rxphaligndone ( g2ip_pipe_rxphaligndone ), .pipe_rxdlysresetdone ( g2ip_pipe_rxdlysresetdone ), .pipe_rxsyncdone ( g2ip_pipe_rxsyncdone ), .pipe_rxdisperr ( g2ip_pipe_rxdisperr ), .pipe_rxnotintable ( g2ip_pipe_rxnotintable ), .pipe_rxcommadet ( g2ip_pipe_rxcommadet ), .pipe_debug_0 ( g2ip_pipe_debug_0 ), .pipe_debug_1 ( g2ip_pipe_debug_1 ), .pipe_debug_2 ( g2ip_pipe_debug_2 ), .pipe_debug_3 ( g2ip_pipe_debug_3 ), .pipe_debug_4 ( g2ip_pipe_debug_4 ), .pipe_debug_5 ( g2ip_pipe_debug_5 ), .pipe_debug_6 ( g2ip_pipe_debug_6 ), .pipe_debug_7 ( g2ip_pipe_debug_7 ), .pipe_debug_8 ( g2ip_pipe_debug_8 ), .pipe_debug_9 ( g2ip_pipe_debug_9 ), .pipe_debug ( g2ip_pipe_debug ), //-------------------------------------------------------------------------------------// // System (SYS) Interface // //-------------------------------------------------------------------------------------// .sys_clk ( sys_clk ), .sys_rst_n ( sys_reset ) ); endmodule ======================= File: xdma_0_ex.srcs/sources_1/ip/xdma_0/xdma_v4_1/hdl/verilog/xdma_0_dma_cpl.sv ======================= //----------------------------------------------------------------------------- // // (c) Copyright 2012-2012 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant any // rights to the materials distributed herewith. Except as // otherwise provided in a valid license issued to you by // Xilinx, and to the maximum extent permitted by applicable // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND // WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES // AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING // BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- // INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and // (2) Xilinx shall not be liable (whether in contract or tort, // including negligence, or under any other theory of // liability) for any loss or damage of any kind or nature // related to, arising under or in connection with these // materials, including for any direct, or any indirect, // special, incidental, or consequential loss or damage // (including loss of data, profits, goodwill, or any type of // loss or damage suffered as a result of any action brought // by a third party) even if such damage or loss was // reasonably foreseeable or Xilinx had been advised of the // possibility of the same. // // CRITICAL APPLICATIONS // Xilinx products are not designed or intended to be fail- // safe, or for use in any application requiring fail-safe // performance, such as life-support or safety devices or // systems, Class III medical devices, nuclear facilities, // applications related to the deployment of airbags, or any // other applications that could lead to death, personal // injury, or severe property or environmental damage // (individually and collectively, "Critical // Applications"). Customer assumes the sole risk and // liability of any use of Xilinx products in Critical // Applications, subject only to applicable laws and // regulations governing limitations on product liability. // // THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS // PART OF THIS FILE AT ALL TIMES. // //----------------------------------------------------------------------------- // // Project : The Xilinx PCI Express DMA // File : xdma_0_dma_cpl.sv // Version : 4.1 //----------------------------------------------------------------------------- //----------------------------------------------------------------------------// // File : <ComponentName>_dma_cpl.v // // Date : 11/17/15 // // Author : <NAME> // // // // Description: // // Converts Gen2 PCIe RX packets to RC and sends it to the DMA // // // // Notes: // // 64-bit &128-bit are supported // // // // Hierarchical: // // pcie2_to_pcie3_wrapper // // axi_stream_intf // // dma_cpl // // // //----------------------------------------------------------------------------// `timescale 1ps/1ps module xdma_0_dma_cpl #( parameter C_AXI_DATA_WIDTH = 32, // RX/TX interface data width parameter C_KEEP_WIDTH = C_AXI_DATA_WIDTH/8, // TKEEP width for RX parameter C_RC_KEEP_WIDTH = C_AXI_DATA_WIDTH/32, // TKEEP width for RC parameter C_ADDR_ALGN = 1, // specifies alignment mode; 1 = Address Aligned; 0 = Dword Aligned parameter TCQ = 1 // Clock to Q time ) ( input clk, input user_reset, //------------------------------------------------- // AXI-S RX Interface from RX Demux //------------------------------------------------- input [C_AXI_DATA_WIDTH-1:0] m_axis_rx_tdata, // RX data input m_axis_rx_tvalid, // RX data is valid input [C_KEEP_WIDTH-1:0] m_axis_rx_tkeep, // RX strobe byte enables input m_axis_rx_tlast, // RX data is last input [21:0] m_axis_rx_tuser, // RX user signals output reg m_axis_rx_tready, // RX ready for data //------------------------------------------------- // AXI-S RX to RC conversion //------------------------------------------------- output reg[C_AXI_DATA_WIDTH-1:0] s_axis_rc_tdata, // RX data output reg s_axis_rc_tvalid, // RX data is valid input s_axis_rc_tready, // RX ready for data output reg [C_RC_KEEP_WIDTH-1:0] s_axis_rc_tkeep, // RX strobe byte enables output reg s_axis_rc_tlast, // RX data is last output reg [74:0] s_axis_rc_tuser // RX user signals ); localparam RX_IDLE = 3'd0; localparam RX_DW0_DW1 = 3'd1; localparam RX_DATA = 3'd2; localparam RX_DATA_N = 3'd3; localparam RX_NEW = 3'd4; wire sop; // Start of packet reg in_packet_q; reg [2:0] wr_tc; reg wr_td; reg wr_ep; reg [2:0] wr_attr; reg [9:0] wr_len; reg [15:0] wr_rid; reg [15:0] wr_cid; reg [7:0] wr_tag; reg [7:0] wr_be; reg [6:0] wr_addr; reg [11:0] wr_byte; reg [2:0] wr_compl_status; reg [2:0] state; reg [C_AXI_DATA_WIDTH-1:0] wr_data; reg [C_AXI_DATA_WIDTH-1:0] wr_data_reg; wire [C_AXI_DATA_WIDTH-1:0] m_axis_rx_tdata_be; // Byte Reverse of m_axis_rx_tdata wire [11:0] pending_dw_count; reg [11:0] current_dw_count; // Generate a signal that indicates if we are currently receiving a packet. // This value is one clock cycle delayed from what is actually on the AXIS // data bus. always @(posedge clk) begin if(user_reset) in_packet_q <= # TCQ 1'b0; else if (m_axis_rx_tvalid && s_axis_rc_tready && m_axis_rx_tlast) in_packet_q <= # TCQ 1'b0; else if (sop && s_axis_rc_tready) in_packet_q <= # TCQ 1'b1; end assign sop =!in_packet_q && m_axis_rx_tvalid; always @(posedge clk) begin if (user_reset) wr_data_reg <=#TCQ 64'b0; else wr_data_reg <=#TCQ wr_data; end assign pending_dw_count = (wr_len - current_dw_count); generate if (C_AXI_DATA_WIDTH == 64) begin : rc_64 assign m_axis_rx_tdata_be = {m_axis_rx_tdata[39:32], m_axis_rx_tdata[47:40], m_axis_rx_tdata[55:48], m_axis_rx_tdata[63:56], m_axis_rx_tdata[7:0], m_axis_rx_tdata [15:8], m_axis_rx_tdata[23:16], m_axis_rx_tdata[31:24]}; always @ ( posedge clk ) begin if (user_reset) begin // m_axis_rx_tready <= #TCQ 1'b0; wr_tc <= #TCQ 3'b0; wr_td <= #TCQ 1'b0; wr_ep <= #TCQ 1'b0; wr_attr <= #TCQ 3'b0; wr_len <= #TCQ 10'b0; wr_rid <= #TCQ 16'b0; wr_cid <= #TCQ 16'b0; wr_tag <= #TCQ 8'b0; wr_be <= #TCQ 8'b0; wr_addr <= #TCQ 7'b0; wr_byte <= #TCQ 12'b0; wr_compl_status <= #TCQ 3'b0; current_dw_count <= #TCQ 12'b0; wr_data <= #TCQ 64'b0; state <= #TCQ RX_IDLE; end else begin case (state) RX_IDLE : begin wr_tag <= #TCQ 8'b0; wr_data <= #TCQ 64'b0; current_dw_count <= #TCQ 12'b0; if (sop) begin wr_len <= #TCQ m_axis_rx_tdata[9:0]; wr_attr <= #TCQ {m_axis_rx_tdata[18], m_axis_rx_tdata[13:12]}; wr_ep <= #TCQ m_axis_rx_tdata[14]; wr_td <= #TCQ m_axis_rx_tdata[15]; wr_tc <= #TCQ m_axis_rx_tdata[22:20]; wr_byte <= #TCQ m_axis_rx_tdata[43:32]; wr_compl_status <= #TCQ m_axis_rx_tdata[47:45]; wr_cid <= #TCQ m_axis_rx_tdata[63:48]; state <= #TCQ RX_DW0_DW1; end else begin wr_len <= #TCQ 10'b0; wr_attr <= #TCQ 3'b0; wr_ep <= #TCQ wr_ep; wr_td <= #TCQ 1'b0; wr_tc <= #TCQ 3'b0; wr_byte <= #TCQ 12'b0; wr_compl_status <= #TCQ 3'b0; wr_cid <= #TCQ 16'b0; state <= #TCQ RX_IDLE; end end RX_DW0_DW1 : begin wr_addr <= #TCQ m_axis_rx_tdata [6:0]; wr_tag <= #TCQ m_axis_rx_tdata[15:8]; wr_rid <= #TCQ m_axis_rx_tdata[31:16]; wr_data <= #TCQ {32'b0, m_axis_rx_tdata_be[63:32]}; wr_len <= #TCQ wr_len; wr_attr <= #TCQ wr_attr; wr_ep <= #TCQ wr_ep; wr_td <= #TCQ wr_td; wr_tc <= #TCQ wr_tc; wr_byte <= #TCQ wr_byte; wr_compl_status <= #TCQ wr_compl_status; wr_cid <= #TCQ wr_cid; current_dw_count <= #TCQ 11'h0; if ( s_axis_rc_tready) begin state <= #TCQ ((wr_len == 10'h1) || (wr_compl_status!= 3'b0))? RX_NEW : RX_DATA; //In case of UR/CA, look for next packet end else begin state <= #TCQ RX_DW0_DW1; end end RX_DATA : begin wr_addr <= #TCQ wr_addr; wr_len <= #TCQ wr_len; wr_attr <= #TCQ wr_attr; wr_ep <= #TCQ wr_ep; wr_td <= #TCQ wr_td; wr_tc <= #TCQ wr_tc; wr_byte <= #TCQ wr_byte; wr_compl_status <= #TCQ wr_compl_status; wr_cid <= #TCQ wr_cid; wr_tag <= #TCQ wr_tag; current_dw_count <= #TCQ current_dw_count + 11'h1; wr_data <= #TCQ m_axis_rx_tdata_be; state <= #TCQ (s_axis_rc_tready)? ((wr_len <= 3'h3)? RX_NEW : RX_DATA_N) : RX_DATA; end RX_DATA_N : begin wr_addr <= #TCQ wr_addr; wr_len <= #TCQ wr_len; wr_attr <= #TCQ wr_attr; wr_ep <= #TCQ wr_ep; wr_td <= #TCQ wr_td; wr_tc <= #TCQ wr_tc; wr_byte <= #TCQ wr_byte; wr_compl_status <= #TCQ wr_compl_status; wr_cid <= #TCQ wr_cid; wr_tag <= #TCQ wr_tag; current_dw_count <= #TCQ current_dw_count + 11'h2; wr_data <= #TCQ m_axis_rx_tdata_be; state <= #TCQ ( s_axis_rc_tready)? ((pending_dw_count >= 3'h4)? RX_DATA_N : RX_NEW) : RX_DATA_N; end RX_NEW : begin wr_tag <= #TCQ 8'b0; wr_data <= #TCQ 64'b0; current_dw_count <= #TCQ (current_dw_count + 2'h2); if (sop) begin wr_len <= #TCQ m_axis_rx_tdata[9:0]; wr_attr <= #TCQ {m_axis_rx_tdata[18], m_axis_rx_tdata[13:12]}; wr_ep <= #TCQ m_axis_rx_tdata[14]; wr_td <= #TCQ m_axis_rx_tdata[15]; wr_tc <= #TCQ m_axis_rx_tdata[22:20]; wr_byte <= #TCQ m_axis_rx_tdata[43:32]; wr_compl_status <= #TCQ m_axis_rx_tdata[47:45]; wr_cid <= #TCQ m_axis_rx_tdata[63:48]; state <= #TCQ RX_DW0_DW1; end else begin wr_len <= #TCQ 10'b0; wr_attr <= #TCQ 3'b0; wr_ep <= #TCQ wr_ep; wr_td <= #TCQ 1'b0; wr_tc <= #TCQ 3'b0; wr_byte <= #TCQ 12'b0; wr_compl_status <= #TCQ 3'b0; wr_cid <= #TCQ 16'b0; state <= #TCQ RX_IDLE; end end endcase end end always @ (*) begin if (user_reset) begin s_axis_rc_tdata = 64'b0; s_axis_rc_tvalid = 1'b0; s_axis_rc_tkeep = 8'h0; s_axis_rc_tlast = 2'b0; s_axis_rc_tuser = 4'h0; m_axis_rx_tready = 1'h1; end else begin m_axis_rx_tready = s_axis_rc_tready; case (state) RX_DW0_DW1: begin s_axis_rc_tdata = { // Bits m_axis_rx_tdata[31:16], //16 {1'b0}, // 1 wr_ep, // 1 - Poisoned Packet wr_compl_status, // 3 {1'b0, wr_len}, // 11 {1'b0}, // 1 ( (wr_byte[11:2] <= wr_len[9:0])? 1'b1 : 1'b0 ), // 1 - Request Completed {1'b0}, // 1 - Locked Read Completion {1'b0, wr_byte}, // 13 (wr_compl_status == 3'b0? 4'h0 : 4'h2 ) , // 4 {5'b0, m_axis_rx_tdata[6:0]} // 12 }; s_axis_rc_tkeep = 2'h3; s_axis_rc_tuser = {42'b0, 1'b1, 32'b0}; //Setting SOP = 1 s_axis_rc_tlast = 1'b0; s_axis_rc_tvalid = 1'b1; end RX_DATA : begin s_axis_rc_tvalid = 1'b1; s_axis_rc_tdata = { // Bits wr_data[31:0], // 32 1'b0, // 1 wr_attr, // 3 wr_tc, // 3 1'b0, // 1 wr_cid, // 16 wr_tag // 8 }; s_axis_rc_tlast = ((wr_len == 10'h1) || (wr_compl_status!= 3'b0))? 1'b1 : 1'b0; if (wr_compl_status!= 3'b0) begin s_axis_rc_tuser = {40'b0, 1'b1, 2'b0, 32'h0000}; //Sending EOF= 1 s_axis_rc_tkeep = 2'h1; end else begin s_axis_rc_tuser = (wr_len == 10'b1)? {40'b0, 1'b1, 2'b0, 32'h00F0} : {43'b0, 32'h00F0}; //Sending byte enable s_axis_rc_tkeep = 2'h3; end end RX_DATA_N : begin//, RX_NEW : begin s_axis_rc_tvalid = 1'b1; s_axis_rc_tdata = wr_data; s_axis_rc_tlast = (pending_dw_count <= 10'h2)? 1'b1 : 1'b0; s_axis_rc_tuser = { 40'b0, {(pending_dw_count > 10'h2)? 1'b0 : 1'b1}, // EOF 2'b0, // SOF {(pending_dw_count > 10'h1)? 32'h00FF : 32'h000F} // Byte Enable }; s_axis_rc_tkeep = (pending_dw_count == 10'h1)? 2'h1 : 2'h3; end RX_NEW : begin//, RX_NEW : begin s_axis_rc_tvalid = 1'b1; if (wr_len == 10'h1) begin s_axis_rc_tdata = { // Bits wr_data[31:0], // 32 1'b0, // 1 wr_attr, // 3 wr_tc, // 3 1'b0, // 1 wr_cid, // 16 wr_tag // 8 }; s_axis_rc_tlast = 1'b1; s_axis_rc_tuser = {40'b0, 1'b1, 2'b0, 32'h00F0}; s_axis_rc_tkeep = 2'h3; end else begin s_axis_rc_tdata = wr_data; s_axis_rc_tlast = (pending_dw_count <= 10'h2)? 1'b1 : 1'b0; s_axis_rc_tuser = { 40'b0, {(pending_dw_count > 10'h2)? 1'b0 : 1'b1}, // EOF 2'b0, // SOF {(pending_dw_count > 10'h1)? 32'h00FF : 32'h000F} // Byte Enable }; s_axis_rc_tkeep = (pending_dw_count == 10'h1)? 2'h1 : 2'h3; end end default: begin s_axis_rc_tlast = 1'b0; s_axis_rc_tuser = 75'h0 ; //Sending byte enable s_axis_rc_tkeep = 2'h0; s_axis_rc_tdata = 64'b0; s_axis_rc_tvalid = 1'b0; end endcase end end end endgenerate generate if (C_AXI_DATA_WIDTH == 128) begin : rc_128 assign m_axis_rx_tdata_be = {m_axis_rx_tdata[103:96], m_axis_rx_tdata[111:104], m_axis_rx_tdata[119:112], m_axis_rx_tdata[127:120], m_axis_rx_tdata[71:64] , m_axis_rx_tdata[79:72], m_axis_rx_tdata[87:80] , m_axis_rx_tdata[95:88] , m_axis_rx_tdata[39:32], m_axis_rx_tdata[47:40] , m_axis_rx_tdata[55:48] , m_axis_rx_tdata[63:56], m_axis_rx_tdata[7:0] , m_axis_rx_tdata [15:8] , m_axis_rx_tdata[23:16], m_axis_rx_tdata[31:24]}; always @ ( posedge clk ) begin if (user_reset) begin // m_axis_rx_tready <= #TCQ 1'b0; wr_tc <= #TCQ 3'b0; wr_td <= #TCQ 1'b0; wr_ep <= #TCQ 1'b0; wr_attr <= #TCQ 3'b0; wr_len <= #TCQ 10'b0; wr_rid <= #TCQ 16'b0; wr_cid <= #TCQ 16'b0; wr_tag <= #TCQ 8'b0; wr_be <= #TCQ 8'b0; wr_addr <= #TCQ 7'b0; wr_byte <= #TCQ 12'b0; wr_compl_status <= #TCQ 3'b0; current_dw_count <= #TCQ 12'b0; wr_data <= #TCQ 128'b0; state <= #TCQ RX_IDLE; end else begin case (state) RX_IDLE : begin if (sop) begin wr_len <= #TCQ m_axis_rx_tdata[9:0]; wr_attr <= #TCQ {m_axis_rx_tdata[18], m_axis_rx_tdata[13:12]}; wr_ep <= #TCQ m_axis_rx_tdata[14]; wr_td <= #TCQ m_axis_rx_tdata[15]; wr_tc <= #TCQ m_axis_rx_tdata[22:20]; wr_byte <= #TCQ m_axis_rx_tdata[43:32]; wr_compl_status <= #TCQ m_axis_rx_tdata[47:45]; wr_cid <= #TCQ m_axis_rx_tdata[63:48]; wr_addr <= #TCQ m_axis_rx_tdata[70:64]; wr_tag <= #TCQ m_axis_rx_tdata[79:72]; wr_rid <= #TCQ m_axis_rx_tdata[95:80]; wr_data <= #TCQ {96'b0, m_axis_rx_tdata_be[127:96]}; current_dw_count <= #TCQ 11'h1; if ( s_axis_rc_tready) begin state <= #TCQ ((m_axis_rx_tdata[9:0] == 10'b1) || (m_axis_rx_tdata[47:45]!= 3'b0)) ? RX_IDLE : RX_DATA; end else begin state <= #TCQ RX_IDLE; end end else begin wr_len <= #TCQ 10'b0; wr_attr <= #TCQ 3'b0; wr_ep <= #TCQ wr_ep; wr_td <= #TCQ 1'b0; wr_tc <= #TCQ 3'b0; wr_byte <= #TCQ 12'b0; wr_compl_status <= #TCQ 3'b0; wr_cid <= #TCQ 16'b0; wr_addr <= #TCQ 7'b0; wr_tag <= #TCQ 8'b0; wr_rid <= #TCQ 16'b0; wr_data <= #TCQ 127'b0; current_dw_count <= #TCQ current_dw_count; state <= #TCQ RX_IDLE; end end RX_DATA : begin wr_addr <= #TCQ wr_addr; wr_len <= #TCQ wr_len; wr_attr <= #TCQ wr_attr; wr_ep <= #TCQ wr_ep; wr_td <= #TCQ wr_td; wr_tc <= #TCQ wr_tc; wr_byte <= #TCQ wr_byte; wr_compl_status <= #TCQ wr_compl_status; wr_cid <= #TCQ wr_cid; wr_tag <= #TCQ wr_tag; current_dw_count <= #TCQ current_dw_count + 11'h4; wr_data <= #TCQ m_axis_rx_tdata_be; state <= #TCQ ( s_axis_rc_tready)? ( (pending_dw_count <= 3'h4)? RX_IDLE : RX_DATA) : RX_DATA; end endcase end end always @ (*) begin if (user_reset) begin s_axis_rc_tdata = 64'b0; s_axis_rc_tvalid = 1'b0; s_axis_rc_tkeep = 8'h0; s_axis_rc_tlast = 2'b0; s_axis_rc_tuser = 4'h0; m_axis_rx_tready = 1'h1; end else begin m_axis_rx_tready = s_axis_rc_tready; case (state) RX_IDLE: begin s_axis_rc_tdata = { // Bits m_axis_rx_tdata_be[127:96], // 32 1'b0, // 1 - Reserved {m_axis_rx_tdata[18], m_axis_rx_tdata[13:12]}, // 3 m_axis_rx_tdata[22:20], // 3 1'b0, // 1 - Reserved m_axis_rx_tdata[63:48], // 16 m_axis_rx_tdata[79:72], // 8 m_axis_rx_tdata[95:80], // 16 {1'b0}, // 1 - Reserved m_axis_rx_tdata[14], // 1 - Poisoned Packet m_axis_rx_tdata[47:45], // 3 {1'b0, m_axis_rx_tdata[9:0]}, // 11 {1'b0}, // 1 - Reserved ( (m_axis_rx_tdata[43:34] <= m_axis_rx_tdata[9:0])? 1'b1 : 1'b0 ), // 1 - Request Completed {1'b0}, // 1 - Locked Read Completion {1'b0, m_axis_rx_tdata[43:32]}, // 13 (m_axis_rx_tdata[47:45] == 3'b0? 4'h0 : 4'h2 ) , // 4 - Error code {5'b0, m_axis_rx_tdata[70:64]} // 12 }; if (m_axis_rx_tdata[47:45]!= 3'b0) begin // Not a successful completion s_axis_rc_tkeep = 4'h7; s_axis_rc_tuser = {40'b0, 1'b1, 2'b1, 32'h0000}; //Setting SOP = 1, EOP = 1 s_axis_rc_tlast = 1'b1 ; end else begin s_axis_rc_tkeep = 4'hF; s_axis_rc_tuser = ((m_axis_rx_tdata[9:0] == 10'b1))? {40'b0, 1'b1, 2'b1, 32'hF000} : {42'b0, 1'b1, 32'hF000}; //Setting SOP = 1 s_axis_rc_tlast = (m_axis_rx_tdata[9:0] == 10'b1)? 1'b1 : 1'b0; end s_axis_rc_tvalid = (sop)? 1'b1 : 1
67,487
thestackv1_concat_by_repo-long/65536-65536
hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca4f15910d10778eefaaaa8887b9495784}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+None}} = 0, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca761ed6272c6b5a28331098bc5dc0ee5e}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Assert\+Failure}} = 1, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca181c1c207ded629c9ad4232e138551cf}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Exception}} = 2, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca896e419208c7e3fa2b278b633f81df40}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Crash}} = 4, \newline \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca242c0cf46e6519678bab9edb1754ff7c}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Too\+Many\+Failed\+Asserts}} = 8, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca5aa2b9ef1d3ca5c10b4bf255707cc7b4}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Timeout}} = 16, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3cab494df14d91aab9717d0da875f40deae}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Should\+Have\+Failed\+But\+Didnt}} = 32, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca4f8693d44118d3e873608bda76a4962f}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Should\+Have\+Failed\+And\+Did}} = 64, \newline \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca2090673a7a700a62f9dcbd89955ccf65}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Didnt\+Fail\+Exactly\+Num\+Times}} = 128, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca127f67bd6b608d4ea828d6d390dc8511}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Failed\+Exactly\+Num\+Times}} = 256, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca849e81a84122d2eaa7eb880db782dace}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Could\+Have\+Failed\+And\+Did}} = 512, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca4f15910d10778eefaaaa8887b9495784}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+None}} = 0, \newline \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca761ed6272c6b5a28331098bc5dc0ee5e}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Assert\+Failure}} = 1, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca181c1c207ded629c9ad4232e138551cf}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Exception}} = 2, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca896e419208c7e3fa2b278b633f81df40}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Crash}} = 4, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca242c0cf46e6519678bab9edb1754ff7c}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Too\+Many\+Failed\+Asserts}} = 8, \newline \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca5aa2b9ef1d3ca5c10b4bf255707cc7b4}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Timeout}} = 16, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3cab494df14d91aab9717d0da875f40deae}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Should\+Have\+Failed\+But\+Didnt}} = 32, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca4f8693d44118d3e873608bda76a4962f}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Should\+Have\+Failed\+And\+Did}} = 64, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca2090673a7a700a62f9dcbd89955ccf65}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Didnt\+Fail\+Exactly\+Num\+Times}} = 128, \newline \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca127f67bd6b608d4ea828d6d390dc8511}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Failed\+Exactly\+Num\+Times}} = 256, \mbox{\hyperlink{namespacedoctest_1_1_test_case_failure_reason_aecb2ca1f80416d60f0d6b96f65859d3ca849e81a84122d2eaa7eb880db782dace}{doctest\+::\+Test\+Case\+Failure\+Reason\+::\+Could\+Have\+Failed\+And\+Did}} = 512 \} \end{DoxyCompactItemize} \doxysubsection*{Functions} \begin{DoxyCompactItemize} \item \mbox{\hyperlink{doctest__fwd_8h_a628491cf2971a026350d5401986bf6d3}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+L\+A\+N\+G\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+N\+G\+\_\+\+P\+U\+SH}} \mbox{\hyperlink{doctest__fwd_8h_a8015d10af2883db80a955ce0d523886d}{D\+O\+C\+T\+E\+S\+T\+\_\+\+G\+C\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+N\+G\+\_\+\+P\+U\+SH}} \mbox{\hyperlink{doctest__fwd_8h_aec6d713a9dde361b8e68afe78c5bf3cf}{D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+N\+G\+\_\+\+P\+U\+SH}} \mbox{\hyperlink{doctest__fwd_8h_a03d36bae0d7ed8dcce87834d61051290}{D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG}} (4616) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4619) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4996) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4706) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4512) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4127) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4820) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4625) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4626) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(5027) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(5026) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4623) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4640) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(26439) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(26495) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(26451) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(26444) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(26812) \mbox{\hyperlink{doctest__fwd_8h_a758d9627ba7331f195ffbba94e5931a1}{D\+O\+C\+T\+E\+S\+T\+\_\+\+S\+T\+D\+\_\+\+N\+A\+M\+E\+S\+P\+A\+C\+E\+\_\+\+B\+E\+G\+IN}} typedef decltype(nullptr) nullptr\+\_\+t \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} bool \mbox{\hyperlink{namespacedoctest_ae332e5e775f83a532884303780f79f9f}{doctest\+::operator==}} (const String \&lhs, const String \&rhs) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} bool \mbox{\hyperlink{namespacedoctest_ab9a88e4c19857cd86a0f037d27bcad72}{doctest\+::operator!=}} (const String \&lhs, const String \&rhs) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} bool \mbox{\hyperlink{namespacedoctest_afa15b277b9a277793b7adf129e0128d9}{doctest\+::operator$<$}} (const String \&lhs, const String \&rhs) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} bool \mbox{\hyperlink{namespacedoctest_acef5990b03a973c74ff2dd6cfc112913}{doctest\+::operator$>$}} (const String \&lhs, const String \&rhs) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} bool \mbox{\hyperlink{namespacedoctest_a27c6c308e814ad9384499bafc03f9e39}{doctest\+::operator$<$=}} (const String \&lhs, const String \&rhs) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} bool \mbox{\hyperlink{namespacedoctest_ac32accb42e937cf870de2f6865ea236a}{doctest\+::operator$>$=}} (const String \&lhs, const String \&rhs) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} \mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} \& \mbox{\hyperlink{namespacedoctest_a7817aba561f42fc42fdccb1b312c7678}{doctest\+::operator$<$$<$}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} \&\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, const String \&in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} \mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} \& \mbox{\hyperlink{namespacedoctest_1_1_color_a2cc3f4bdda7bfd2e0e3faf7e678d3b98}{doctest\+::\+Color\+::operator$<$$<$}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} \&\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, Color\+::\+Enum code) \item const \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} char $\ast$ \mbox{\hyperlink{namespacedoctest_ab56f4f5033407b30858e190309901ff2}{doctest\+::assert\+String}} (assert\+Type\+::\+Enum at) \item const \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} char $\ast$ \mbox{\hyperlink{namespacedoctest_aecddb31b1dc613674128b2b386493385}{doctest\+::failure\+String}} (assert\+Type\+::\+Enum at) \item const \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} char $\ast$ \mbox{\hyperlink{namespacedoctest_a360d10b305d4e64d753e99484308edbd}{doctest\+::skip\+Path\+From\+Filename}} (const char $\ast$file) \item \mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} \& \mbox{\hyperlink{namespacedoctest_1_1detail_1_1has__insertion__operator__impl_a50dfa929b76e3581c300a3a8b87d21e2}{doctest\+::detail\+::has\+\_\+insertion\+\_\+operator\+\_\+impl\+::os}} () \item {\footnotesize template$<$class T $>$ }\\\mbox{\hyperlink{namespacedoctest_1_1detail_1_1has__insertion__operator__impl_aca675e788cb45921358501d70f0a2529}{doctest\+::detail\+::has\+\_\+insertion\+\_\+operator\+\_\+impl\+::\+D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+F\+\_\+\+W\+R\+AP}} (T) val() \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a4027cb5407ce2ff132645e89bba97010}{doctest\+::detail\+::my\+\_\+memcpy}} (void $\ast$dest, const void $\ast$src, unsigned num) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} \mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$ \mbox{\hyperlink{namespacedoctest_1_1detail_ab4df12a4ff9fad5f16edcc1c54f6c4fc}{doctest\+::detail\+::get\+Tls\+Oss}} () \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_1_1detail_a7b0b3df5fe79d7ffa8fa138201476df1}{doctest\+::detail\+::get\+Tls\+Oss\+Result}} () \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_1_1detail_adb894f73b88fb3b39d6c48d80451f5ff}{doctest\+::detail\+::raw\+Memory\+To\+String}} (const void $\ast$object, unsigned size) \item {\footnotesize template$<$typename T $>$ }\\String \mbox{\hyperlink{namespacedoctest_1_1detail_a28da75fd01ab3d943436aa69876b7151}{doctest\+::detail\+::raw\+Memory\+To\+String}} (const \mbox{\hyperlink{doctest__fwd_8h_af2901cafb023c57fb672ccb1bf14f2eb}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+F\+\_\+\+W\+R\+AP}}(T) object) \item {\footnotesize template$<$typename T $>$ }\\const char $\ast$ \mbox{\hyperlink{namespacedoctest_1_1detail_ad64c6c2fd8d7302e8a5e3452cdfb3f75}{doctest\+::detail\+::type\+\_\+to\+\_\+string}} () \item {\footnotesize template$<$typename T, typename detail\+::enable\+\_\+if$<$!detail\+::is\+\_\+enum$<$ T $>$\+::value, bool $>$\+::type = true$>$ }\\String \mbox{\hyperlink{namespacedoctest_a468ff6c2b0a692bcf88a7a97a5de0a53}{doctest\+::to\+String}} (const \mbox{\hyperlink{doctest__fwd_8h_af2901cafb023c57fb672ccb1bf14f2eb}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+F\+\_\+\+W\+R\+AP}}(T) value) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_a70fd23e88074d38b9d61476005305df5}{doctest\+::to\+String}} (bool in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_a68660ce630bd88a551ab3108709e6592}{doctest\+::to\+String}} (float in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_a43b51978c9505f682cbff9462a02f8af}{doctest\+::to\+String}} (double in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_ae4e12dd9865bb31f417f9df0c41813cf}{doctest\+::to\+String}} (double long in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_af106dff2a0c068d301349b754c466378}{doctest\+::to\+String}} (char in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_a1f910fdc13d84a538090b959a97a6fa5}{doctest\+::to\+String}} (char signed in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_ae2c3e60e3ee32da5d8fc4f778b7a225a}{doctest\+::to\+String}} (char unsigned in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_aaff61384b81d700818094342c6110d2c}{doctest\+::to\+String}} (int short in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_a04b10595f3fac969e7682a48fd3ad0c6}{doctest\+::to\+String}} (int short unsigned in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_a0318ba5a1fbeb9e2fe84227a2f007dac}{doctest\+::to\+String}} (int in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_a6de63ae787cb530ee050b3632106907d}{doctest\+::to\+String}} (int unsigned in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_aac941ce13f416e31d72d9fb114681bb2}{doctest\+::to\+String}} (int long in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_ac1c9dfb0453eb7d222bed9d2a4cf62fd}{doctest\+::to\+String}} (int long unsigned in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_ada057336406349bd947f26b1ddb97bd0}{doctest\+::to\+String}} (int long long in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_a0996f0f29ee1288fc2363c958fd4fd05}{doctest\+::to\+String}} (int long long unsigned in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_a88b03675f9b7b8afe5e6d4fa15117181}{doctest\+::to\+String}} (std\+::nullptr\+\_\+t in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} String \mbox{\hyperlink{namespacedoctest_a63aa06a8555c5aa34a7a6e76e87a3bca}{doctest\+::to\+String}} (const Approx \&in) \item const \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} Context\+Options $\ast$ \mbox{\hyperlink{namespacedoctest_a426c38f4b2561bf6cfb10a370bddc3da}{doctest\+::get\+Context\+Options}} () \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} bool \mbox{\hyperlink{namespacedoctest_1_1detail_acec9ff072dd86af95225a8beb9c57298}{doctest\+::detail\+::check\+If\+Should\+Throw}} (assert\+Type\+::\+Enum at) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a60ffd50b9ee7adfcafc078f333aac8b6}{doctest\+::detail\+::throw\+Exception}} () \item {\footnotesize template$<$typename L, typename R $>$ }\\String \mbox{\hyperlink{namespacedoctest_1_1detail_a6879a79aea397a22e296e4afd0a90e3b}{doctest\+::detail\+::stringify\+Binary\+Expr}} (const \mbox{\hyperlink{doctest__fwd_8h_af2901cafb023c57fb672ccb1bf14f2eb}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+F\+\_\+\+W\+R\+AP}}(L) lhs, const char $\ast$op, const \mbox{\hyperlink{doctest__fwd_8h_af2901cafb023c57fb672ccb1bf14f2eb}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+F\+\_\+\+W\+R\+AP}}(R) rhs) \item \mbox{\hyperlink{doctest__fwd_8h_a628491cf2971a026350d5401986bf6d3}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+L\+A\+N\+G\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+N\+G\+\_\+\+P\+U\+SH}} \mbox{\hyperlink{doctest__fwd_8h_a8015d10af2883db80a955ce0d523886d}{D\+O\+C\+T\+E\+S\+T\+\_\+\+G\+C\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+N\+G\+\_\+\+P\+U\+SH}} \mbox{\hyperlink{doctest__fwd_8h_aec6d713a9dde361b8e68afe78c5bf3cf}{D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+N\+G\+\_\+\+P\+U\+SH}} \mbox{\hyperlink{namespacedoctest_1_1detail_a3b966d87ac1e25498fae773355c43d90}{doctest\+::detail\+::\+D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG}} (4388) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4389) D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+S\+V\+C\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(4018) template$<$ typename L $>$ struct Expression\+\_\+lhs \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} int \mbox{\hyperlink{namespacedoctest_1_1detail_a00f99edefb8490a8e2602d58c96431f4}{doctest\+::detail\+::reg\+Test}} (const Test\+Case \&\mbox{\hyperlink{doctest_8cpp_aa04e2177279260cb81d1c6afc66bab2c}{tc}}) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} int \mbox{\hyperlink{namespacedoctest_1_1detail_ae79cb8df06d35468dd0ba9f04c85802c}{doctest\+::detail\+::set\+Test\+Suite}} (const Test\+Suite \&ts) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} bool \mbox{\hyperlink{namespacedoctest_1_1detail_a013828c4e677241cc26aeea33f762710}{doctest\+::detail\+::is\+Debugger\+Active}} () \item {\footnotesize template$<$typename T $>$ }\\int \mbox{\hyperlink{namespacedoctest_1_1detail_aad401b097a9af4df1d4a9d0911957c0f}{doctest\+::detail\+::instantiation\+Helper}} (const T \&) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a0ff832be68bf666d856aefd539e1ce81}{doctest\+::detail\+::failed\+\_\+out\+\_\+of\+\_\+a\+\_\+testing\+\_\+context}} (const Assert\+Data \&ad) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a6d4efb043e9e5a6fa0db64f0e230a7a7}{doctest\+::detail\+::decomp\+\_\+assert}} (assert\+Type\+::\+Enum at, const char $\ast$file, int line, const char $\ast$expr, Result result) \item {\footnotesize template$<$int comparison, typename L, typename R $>$ }\\\mbox{\hyperlink{doctest__fwd_8h_a47e9d3609dfcc90b9a630ff33b9524d6}{D\+O\+C\+T\+E\+S\+T\+\_\+\+N\+O\+I\+N\+L\+I\+NE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a570279a22ca888528e87a426853a0288}{doctest\+::detail\+::binary\+\_\+assert}} (assert\+Type\+::\+Enum at, const char $\ast$file, int line, const char $\ast$expr, const \mbox{\hyperlink{doctest__fwd_8h_af2901cafb023c57fb672ccb1bf14f2eb}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+F\+\_\+\+W\+R\+AP}}(L) lhs, const \mbox{\hyperlink{doctest__fwd_8h_af2901cafb023c57fb672ccb1bf14f2eb}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+F\+\_\+\+W\+R\+AP}}(R) rhs) \item {\footnotesize template$<$typename L $>$ }\\\mbox{\hyperlink{doctest__fwd_8h_a47e9d3609dfcc90b9a630ff33b9524d6}{D\+O\+C\+T\+E\+S\+T\+\_\+\+N\+O\+I\+N\+L\+I\+NE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a5343d1b26df7f86767d5e7026c03bf0f}{doctest\+::detail\+::unary\+\_\+assert}} (assert\+Type\+::\+Enum at, const char $\ast$file, int line, const char $\ast$expr, const \mbox{\hyperlink{doctest__fwd_8h_af2901cafb023c57fb672ccb1bf14f2eb}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+F\+\_\+\+W\+R\+AP}}(L) val) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a3887426da16e0d12e6f0e270a767a6a5}{doctest\+::detail\+::register\+Exception\+Translator\+Impl}} (const I\+Exception\+Translator $\ast$et) \item {\footnotesize template$<$typename T $>$ }\\void \mbox{\hyperlink{namespacedoctest_1_1detail_a71b40611173c82709726b36715229179}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, const T \&value) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a54f817dd0c3e33a4f96de3e638d4c559}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, bool in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_ac0ab7be576543b52b480df7f44ee13c5}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, float in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_aa0aa6b2f4cd2ab8cc0b5c4c6a1745e05}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, double in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_aa7f9d8383116a268a72993244a43d74d}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, double long in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_aee32c9e6a9e1b419c6feb44e8c1b6205}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, char in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_aba277e0f00b9cf14b7161bbe033b126f}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, char signed in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a23f8f4324507a40de4fb636f20f36fb7}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, char unsigned in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_aaa111edaaf87cd57961d2c1923d762cb}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, int short in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a72d0259a5b3c0f0f3a88ea8d732223f8}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, int short unsigned in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_af6f60470d3f0f2b858a03dad822ca9c6}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, int in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a7001b8028c2c21968f2a0deb3417e9a4}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, int unsigned in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a830b2dd9dae3bc74ae0c9002b7a2dbed}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, int long in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a82d6e6a85cac7cfb399d8215308369fc}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, int long unsigned in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a359e9b95a3fbe0322056d9d9c7385cde}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, int long long in) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a22df719818a3df2b975ba0f7045cc8fd}{doctest\+::detail\+::to\+Stream}} (\mbox{\hyperlink{doctest__fwd_8h_a116af65cb5e924b33ad9d9ecd7a783f3}{std\+::ostream}} $\ast$\mbox{\hyperlink{doctest_8cpp_a856811d3486b5ce13dac633470f21574}{s}}, int long long unsigned in) \item {\footnotesize template$<$typename L $>$ }\\Context\+Scope$<$ L $>$ \mbox{\hyperlink{namespacedoctest_1_1detail_af15c2ff0484248d0966fc38a4b0d3a66}{doctest\+::detail\+::\+Make\+Context\+Scope}} (const L \&lambda) \item \mbox{\hyperlink{namespacedoctest_a104a0e533475e45acbddd9266c4d687e}{doctest\+::\+D\+O\+C\+T\+E\+S\+T\+\_\+\+D\+E\+F\+I\+N\+E\+\_\+\+D\+E\+C\+O\+R\+A\+T\+OR}} (test\+\_\+suite, const char $\ast$, \char`\"{}\char`\"{}) \item \mbox{\hyperlink{namespacedoctest_a07f4a26e2b7cce41abb7d71124951792}{doctest\+::\+D\+O\+C\+T\+E\+S\+T\+\_\+\+D\+E\+F\+I\+N\+E\+\_\+\+D\+E\+C\+O\+R\+A\+T\+OR}} (description, const char $\ast$, \char`\"{}\char`\"{}) \item \mbox{\hyperlink{namespacedoctest_a0ce903d8e37a8fdc185f6e8c73f9b1dd}{doctest\+::\+D\+O\+C\+T\+E\+S\+T\+\_\+\+D\+E\+F\+I\+N\+E\+\_\+\+D\+E\+C\+O\+R\+A\+T\+OR}} (skip, bool, true) \item \mbox{\hyperlink{namespacedoctest_a676e4a5ac5927180d445cf8d15d5e723}{doctest\+::\+D\+O\+C\+T\+E\+S\+T\+\_\+\+D\+E\+F\+I\+N\+E\+\_\+\+D\+E\+C\+O\+R\+A\+T\+OR}} (no\+\_\+breaks, bool, true) \item \mbox{\hyperlink{namespacedoctest_affa95f6124caa21081e93dc81eee67d6}{doctest\+::\+D\+O\+C\+T\+E\+S\+T\+\_\+\+D\+E\+F\+I\+N\+E\+\_\+\+D\+E\+C\+O\+R\+A\+T\+OR}} (no\+\_\+output, bool, true) \item \mbox{\hyperlink{namespacedoctest_a09d01a6e97677b7bb508bf925e421963}{doctest\+::\+D\+O\+C\+T\+E\+S\+T\+\_\+\+D\+E\+F\+I\+N\+E\+\_\+\+D\+E\+C\+O\+R\+A\+T\+OR}} (timeout, double, 0) \item \mbox{\hyperlink{namespacedoctest_a44ea7d81a1561f2222b8ffa69eecc599}{doctest\+::\+D\+O\+C\+T\+E\+S\+T\+\_\+\+D\+E\+F\+I\+N\+E\+\_\+\+D\+E\+C\+O\+R\+A\+T\+OR}} (may\+\_\+fail, bool, true) \item \mbox{\hyperlink{namespacedoctest_a0da07f59e77fcb14943788b2c85e2355}{doctest\+::\+D\+O\+C\+T\+E\+S\+T\+\_\+\+D\+E\+F\+I\+N\+E\+\_\+\+D\+E\+C\+O\+R\+A\+T\+OR}} (should\+\_\+fail, bool, true) \item \mbox{\hyperlink{namespacedoctest_ab1678966da9d93629130f083220403da}{doctest\+::\+D\+O\+C\+T\+E\+S\+T\+\_\+\+D\+E\+F\+I\+N\+E\+\_\+\+D\+E\+C\+O\+R\+A\+T\+OR}} (expected\+\_\+failures, int, 0) \item {\footnotesize template$<$typename T $>$ }\\int \mbox{\hyperlink{namespacedoctest_a8e23e6bb4c6982688652060dbe41385d}{doctest\+::register\+Exception\+Translator}} (String($\ast$translate\+Function)(T)) \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} \mbox{\hyperlink{structdoctest_1_1detail_1_1_test_suite}{doctest\+::detail\+::\+Test\+Suite}} \& \mbox{\hyperlink{namespacedoctest__detail__test__suite__ns_a63d04c2e0ba35dff1e33cf0a24ec66c8}{doctest\+\_\+detail\+\_\+test\+\_\+suite\+\_\+ns\+::get\+Current\+Test\+Suite}} () \item \mbox{\hyperlink{doctest__fwd_8h_a9c16ffc635ec47f07797d21ede26b1a5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+T\+E\+R\+F\+A\+CE}} void \mbox{\hyperlink{namespacedoctest_1_1detail_a828e011bb6028ab94eb14a3c7d8bd2c4}{doctest\+::detail\+::register\+Reporter\+Impl}} (const char $\ast$\mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}}, int prio, reporter\+Creator\+Func c, bool is\+Reporter) \item {\footnotesize template$<$typename Reporter $>$ }\\I\+Reporter $\ast$ \mbox{\hyperlink{namespacedoctest_1_1detail_ac78a52271e895d8485356c4516a18685}{doctest\+::detail\+::reporter\+Creator}} (const Context\+Options \&o) \item {\footnotesize template$<$typename Reporter $>$ }\\int \mbox{\hyperlink{namespacedoctest_a9e878a811f7bf0a615b3a39de3004673}{doctest\+::register\+Reporter}} (const char $\ast$\mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}}, int priority, bool is\+Reporter) \end{DoxyCompactItemize} \doxysubsection{Macro Definition Documentation} \mbox{\Hypertarget{doctest__fwd_8h_a1937649cc9503739c20b3c81b97b5e5d}\label{doctest__fwd_8h_a1937649cc9503739c20b3c81b97b5e5d}} \index{doctest\_fwd.h@{doctest\_fwd.h}!ADD\_FAIL\_AT@{ADD\_FAIL\_AT}} \index{ADD\_FAIL\_AT@{ADD\_FAIL\_AT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{ADD\_FAIL\_AT}{ADD\_FAIL\_AT}} {\footnotesize\ttfamily \#define A\+D\+D\+\_\+\+F\+A\+I\+L\+\_\+\+AT(\begin{DoxyParamCaption}\item[{}]{file, }\item[{}]{line, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ab9997c8323295559d5bd9275a59d3873}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+F\+A\+I\+L\+\_\+\+AT}}(file, line, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2512 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a4608a06d7117332c14b21b93f9655653}\label{doctest__fwd_8h_a4608a06d7117332c14b21b93f9655653}} \index{doctest\_fwd.h@{doctest\_fwd.h}!ADD\_FAIL\_CHECK\_AT@{ADD\_FAIL\_CHECK\_AT}} \index{ADD\_FAIL\_CHECK\_AT@{ADD\_FAIL\_CHECK\_AT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{ADD\_FAIL\_CHECK\_AT}{ADD\_FAIL\_CHECK\_AT}} {\footnotesize\ttfamily \#define A\+D\+D\+\_\+\+F\+A\+I\+L\+\_\+\+C\+H\+E\+C\+K\+\_\+\+AT(\begin{DoxyParamCaption}\item[{}]{file, }\item[{}]{line, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a903e2a8556f8177e0015df1425a47de0}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+F\+A\+I\+L\+\_\+\+C\+H\+E\+C\+K\+\_\+\+AT}}(file, line, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2511 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_adb66a4c291609d4a1c554ad0a23f0662}\label{doctest__fwd_8h_adb66a4c291609d4a1c554ad0a23f0662}} \index{doctest\_fwd.h@{doctest\_fwd.h}!ADD\_MESSAGE\_AT@{ADD\_MESSAGE\_AT}} \index{ADD\_MESSAGE\_AT@{ADD\_MESSAGE\_AT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{ADD\_MESSAGE\_AT}{ADD\_MESSAGE\_AT}} {\footnotesize\ttfamily \#define A\+D\+D\+\_\+\+M\+E\+S\+S\+A\+G\+E\+\_\+\+AT(\begin{DoxyParamCaption}\item[{}]{file, }\item[{}]{line, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ac89750ba2aa929667cd6c813dc5d0b0e}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+M\+E\+S\+S\+A\+G\+E\+\_\+\+AT}}(file, line, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2510 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_aff5ab767c4b4b5f02218e9060d09e826}\label{doctest__fwd_8h_aff5ab767c4b4b5f02218e9060d09e826}} \index{doctest\_fwd.h@{doctest\_fwd.h}!AND\_THEN@{AND\_THEN}} \index{AND\_THEN@{AND\_THEN}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{AND\_THEN}{AND\_THEN}} {\footnotesize\ttfamily \#define A\+N\+D\+\_\+\+T\+H\+EN(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}} }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a98336975a3b162f382cad2ae2c058276}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+N\+D\+\_\+\+T\+H\+EN}}(\mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}})} Definition at line 2570 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a49fd020eb5d05b1e021d84558ef297a5}\label{doctest__fwd_8h_a49fd020eb5d05b1e021d84558ef297a5}} \index{doctest\_fwd.h@{doctest\_fwd.h}!AND\_WHEN@{AND\_WHEN}} \index{AND\_WHEN@{AND\_WHEN}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{AND\_WHEN}{AND\_WHEN}} {\footnotesize\ttfamily \#define A\+N\+D\+\_\+\+W\+H\+EN(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}} }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a9e696b9f04c18580c871e07653affcbf}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+N\+D\+\_\+\+W\+H\+EN}}(\mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}})} Definition at line 2568 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a0cd84d289552018d72489c085df0a9ca}\label{doctest__fwd_8h_a0cd84d289552018d72489c085df0a9ca}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CAPTURE@{CAPTURE}} \index{CAPTURE@{CAPTURE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CAPTURE}{CAPTURE}} {\footnotesize\ttfamily \#define C\+A\+P\+T\+U\+RE(\begin{DoxyParamCaption}\item[{}]{x }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a5a8ade28d558f5fcb66f8493d0596e6c}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+A\+P\+T\+U\+RE}}(x)} Definition at line 2509 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a836cca6b6ed3a1706353f6d1bca0935f}\label{doctest__fwd_8h_a836cca6b6ed3a1706353f6d1bca0935f}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK@{CHECK}} \index{CHECK@{CHECK}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK}{CHECK}} {\footnotesize\ttfamily \#define C\+H\+E\+CK(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a8f40c4072e85f02a3e58c5f67a182297}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+CK}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2525 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_acab009b596160e614aec1ace5aa8560b}\label{doctest__fwd_8h_acab009b596160e614aec1ace5aa8560b}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_EQ@{CHECK\_EQ}} \index{CHECK\_EQ@{CHECK\_EQ}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_EQ}{CHECK\_EQ}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+EQ(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a2ac8b5624c3b8d9520c75a68634cb8c1}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+EQ}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2573 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a7bf095d8512cb180f8ff3a2258a6eaac}\label{doctest__fwd_8h_a7bf095d8512cb180f8ff3a2258a6eaac}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_FALSE@{CHECK\_FALSE}} \index{CHECK\_FALSE@{CHECK\_FALSE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_FALSE}{CHECK\_FALSE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+F\+A\+L\+SE(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a7ecf2c25ffc2fad220a251af0ab37ff8}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+F\+A\+L\+SE}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2526 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a8b06db4f03a3ddfbd641ab2fe31c5f1c}\label{doctest__fwd_8h_a8b06db4f03a3ddfbd641ab2fe31c5f1c}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_FALSE\_MESSAGE@{CHECK\_FALSE\_MESSAGE}} \index{CHECK\_FALSE\_MESSAGE@{CHECK\_FALSE\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_FALSE\_MESSAGE}{CHECK\_FALSE\_MESSAGE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+F\+A\+L\+S\+E\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{cond, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_afce21f03a310657b5bafd6e98b4442de}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+F\+A\+L\+S\+E\+\_\+\+M\+E\+S\+S\+A\+GE}}(cond, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2548 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a09d1acce35b0cf75630ee57cbbcfb8ec}\label{doctest__fwd_8h_a09d1acce35b0cf75630ee57cbbcfb8ec}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_GE@{CHECK\_GE}} \index{CHECK\_GE@{CHECK\_GE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_GE}{CHECK\_GE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+GE(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a296f8caf3497fbc9433d2e77691b0b3e}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+GE}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2585 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ab5d3af75a2193b292ec73d1c5e9aa3b8}\label{doctest__fwd_8h_ab5d3af75a2193b292ec73d1c5e9aa3b8}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_GT@{CHECK\_GT}} \index{CHECK\_GT@{CHECK\_GT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_GT}{CHECK\_GT}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+GT(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a8d3a9781fd7a67021ec12e0aea024ed6}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+GT}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2579 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a123814e11f856f998a4a46abeffa033b}\label{doctest__fwd_8h_a123814e11f856f998a4a46abeffa033b}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_LE@{CHECK\_LE}} \index{CHECK\_LE@{CHECK\_LE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_LE}{CHECK\_LE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+LE(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a25823108f6fed8787303bbad7c619f35}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+LE}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2588 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a5016b178adeb924d156f914b97d50c22}\label{doctest__fwd_8h_a5016b178adeb924d156f914b97d50c22}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_LT@{CHECK\_LT}} \index{CHECK\_LT@{CHECK\_LT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_LT}{CHECK\_LT}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+LT(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a4e1d83dffb779a2829552c4fefbb516a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+LT}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2582 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a73e7aad74289b7337329539f44cd9a97}\label{doctest__fwd_8h_a73e7aad74289b7337329539f44cd9a97}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_MESSAGE@{CHECK\_MESSAGE}} \index{CHECK\_MESSAGE@{CHECK\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_MESSAGE}{CHECK\_MESSAGE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{cond, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a786fe34d54658c61956b291befcb2bcb}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+M\+E\+S\+S\+A\+GE}}(cond, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2547 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a7402f391d8e0b60455c52e88612b920e}\label{doctest__fwd_8h_a7402f391d8e0b60455c52e88612b920e}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_NE@{CHECK\_NE}} \index{CHECK\_NE@{CHECK\_NE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_NE}{CHECK\_NE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+NE(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_afe1e20e7078d65704c6b2f4e55bbfc03}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+NE}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2576 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a78e70f011f20c4ade1d1ac2b8fd33626}\label{doctest__fwd_8h_a78e70f011f20c4ade1d1ac2b8fd33626}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_NOTHROW@{CHECK\_NOTHROW}} \index{CHECK\_NOTHROW@{CHECK\_NOTHROW}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_NOTHROW}{CHECK\_NOTHROW}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+N\+O\+T\+H\+R\+OW(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_aac7b7640f3d6611423a2c5a18d905069}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+N\+O\+T\+H\+R\+OW}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2531 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a9350021e018cf7d05158c211ca5bc4b8}\label{doctest__fwd_8h_a9350021e018cf7d05158c211ca5bc4b8}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_NOTHROW\_MESSAGE@{CHECK\_NOTHROW\_MESSAGE}} \index{CHECK\_NOTHROW\_MESSAGE@{CHECK\_NOTHROW\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_NOTHROW\_MESSAGE}{CHECK\_NOTHROW\_MESSAGE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+N\+O\+T\+H\+R\+O\+W\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a8b75d37da2864af17a65dd436038614b}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+N\+O\+T\+H\+R\+O\+W\+\_\+\+M\+E\+S\+S\+A\+GE}}(expr, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2553 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a5c646dfe831e596b59073014c1c8b9e5}\label{doctest__fwd_8h_a5c646dfe831e596b59073014c1c8b9e5}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_THROWS@{CHECK\_THROWS}} \index{CHECK\_THROWS@{CHECK\_THROWS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_THROWS}{CHECK\_THROWS}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+WS(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a4390850609b0f465bc8a4e7355f91177}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+WS}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2527 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_aabaaa591d46f29cf307dbed1a5abba83}\label{doctest__fwd_8h_aabaaa591d46f29cf307dbed1a5abba83}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_THROWS\_AS@{CHECK\_THROWS\_AS}} \index{CHECK\_THROWS\_AS@{CHECK\_THROWS\_AS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_THROWS\_AS}{CHECK\_THROWS\_AS}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+AS(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a84f4eb0aeb37b27b3cad5f3e44c08195}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+AS}}(expr, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2528 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a75a03e5bbd28410e78d318d3788396d9}\label{doctest__fwd_8h_a75a03e5bbd28410e78d318d3788396d9}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_THROWS\_AS\_MESSAGE@{CHECK\_THROWS\_AS\_MESSAGE}} \index{CHECK\_THROWS\_AS\_MESSAGE@{CHECK\_THROWS\_AS\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_THROWS\_AS\_MESSAGE}{CHECK\_THROWS\_AS\_MESSAGE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+A\+S\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{ex, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a72345d4052cc19f881c5adf40226155d}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+A\+S\+\_\+\+M\+E\+S\+S\+A\+GE}}(expr, ex, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2550 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a9a0787ef037d0d3b59ef15db7558105e}\label{doctest__fwd_8h_a9a0787ef037d0d3b59ef15db7558105e}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_THROWS\_MESSAGE@{CHECK\_THROWS\_MESSAGE}} \index{CHECK\_THROWS\_MESSAGE@{CHECK\_THROWS\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_THROWS\_MESSAGE}{CHECK\_THROWS\_MESSAGE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ad989f89d414af6c3472b22ad2d6bfe54}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+M\+E\+S\+S\+A\+GE}}(expr, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2549 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ab692b033f5869d5a0def84b3a65e092b}\label{doctest__fwd_8h_ab692b033f5869d5a0def84b3a65e092b}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_THROWS\_WITH@{CHECK\_THROWS\_WITH}} \index{CHECK\_THROWS\_WITH@{CHECK\_THROWS\_WITH}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_THROWS\_WITH}{CHECK\_THROWS\_WITH}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+TH(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a141ab91ff9697fa7d978989d56ce42d5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+TH}}(expr, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2529 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a60213e8e60022a5ec9ca8eaca4e8c61f}\label{doctest__fwd_8h_a60213e8e60022a5ec9ca8eaca4e8c61f}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_THROWS\_WITH\_AS@{CHECK\_THROWS\_WITH\_AS}} \index{CHECK\_THROWS\_WITH\_AS@{CHECK\_THROWS\_WITH\_AS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_THROWS\_WITH\_AS}{CHECK\_THROWS\_WITH\_AS}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+T\+H\+\_\+\+AS(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{with, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ac53fee45159d080520c2d16416e6468f}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+T\+H\+\_\+\+AS}}(expr, with, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2530 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a6aae9c5bc6386274308d27eb4bffa7c8}\label{doctest__fwd_8h_a6aae9c5bc6386274308d27eb4bffa7c8}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_THROWS\_WITH\_AS\_MESSAGE@{CHECK\_THROWS\_WITH\_AS\_MESSAGE}} \index{CHECK\_THROWS\_WITH\_AS\_MESSAGE@{CHECK\_THROWS\_WITH\_AS\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_THROWS\_WITH\_AS\_MESSAGE}{CHECK\_THROWS\_WITH\_AS\_MESSAGE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+T\+H\+\_\+\+A\+S\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{with, }\item[{}]{ex, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ae08de7161897c76ce0a87767fc171f4f}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+T\+H\+\_\+\+A\+S\+\_\+\+M\+E\+S\+S\+A\+GE}}(expr, with, ex, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2552 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ae3425ab2dc96a8ded456ce4dc7c30d15}\label{doctest__fwd_8h_ae3425ab2dc96a8ded456ce4dc7c30d15}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_THROWS\_WITH\_MESSAGE@{CHECK\_THROWS\_WITH\_MESSAGE}} \index{CHECK\_THROWS\_WITH\_MESSAGE@{CHECK\_THROWS\_WITH\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_THROWS\_WITH\_MESSAGE}{CHECK\_THROWS\_WITH\_MESSAGE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+T\+H\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{with, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ab989b8025f31020a0f172ec67cf06a76}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+T\+H\+\_\+\+M\+E\+S\+S\+A\+GE}}(expr, with, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2551 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_abcf94ba403b7c0d3a652a7c8da342858}\label{doctest__fwd_8h_abcf94ba403b7c0d3a652a7c8da342858}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_UNARY@{CHECK\_UNARY}} \index{CHECK\_UNARY@{CHECK\_UNARY}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_UNARY}{CHECK\_UNARY}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+RY(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a660ce2901f42d4d2a82327204a6a3602}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+RY}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2591 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ab6e15c04937a22c57a3222e8436d4fac}\label{doctest__fwd_8h_ab6e15c04937a22c57a3222e8436d4fac}} \index{doctest\_fwd.h@{doctest\_fwd.h}!CHECK\_UNARY\_FALSE@{CHECK\_UNARY\_FALSE}} \index{CHECK\_UNARY\_FALSE@{CHECK\_UNARY\_FALSE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{CHECK\_UNARY\_FALSE}{CHECK\_UNARY\_FALSE}} {\footnotesize\ttfamily \#define C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+R\+Y\+\_\+\+F\+A\+L\+SE(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a9ff04e98b0891f79528c180a4e7d6d36}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+R\+Y\+\_\+\+F\+A\+L\+SE}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2594 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ab70c0e91885a1f48ff582a67b61f6771}\label{doctest__fwd_8h_ab70c0e91885a1f48ff582a67b61f6771}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ADD\_AT\_IMPL@{DOCTEST\_ADD\_AT\_IMPL}} \index{DOCTEST\_ADD\_AT\_IMPL@{DOCTEST\_ADD\_AT\_IMPL}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ADD\_AT\_IMPL}{DOCTEST\_ADD\_AT\_IMPL}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+A\+T\+\_\+\+I\+M\+PL(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{doctest_8cpp_a75b160f574a0be26114bae2c7686a5e1}{type}}, }\item[{}]{file, }\item[{}]{line, }\item[{}]{mb, }\item[{}]{... }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keywordflow}{do} \{ \(\backslash\)} \DoxyCodeLine{ doctest::detail::MessageBuilder mb(file, line, \mbox{\hyperlink{doctest_8cpp_a75b160f574a0be26114bae2c7686a5e1}{doctest::assertType::type}}); \(\backslash\)} \DoxyCodeLine{ mb * \_\_VA\_ARGS\_\_; \(\backslash\)} \DoxyCodeLine{ DOCTEST\_ASSERT\_LOG\_AND\_REACT(mb); \(\backslash\)} \DoxyCodeLine{ \} \textcolor{keywordflow}{while}(\textcolor{keyword}{false})} \end{DoxyCode} Definition at line 2005 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ab9997c8323295559d5bd9275a59d3873}\label{doctest__fwd_8h_ab9997c8323295559d5bd9275a59d3873}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ADD\_FAIL\_AT@{DOCTEST\_ADD\_FAIL\_AT}} \index{DOCTEST\_ADD\_FAIL\_AT@{DOCTEST\_ADD\_FAIL\_AT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ADD\_FAIL\_AT}{DOCTEST\_ADD\_FAIL\_AT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+F\+A\+I\+L\+\_\+\+AT(\begin{DoxyParamCaption}\item[{}]{file, }\item[{}]{line, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ab70c0e91885a1f48ff582a67b61f6771}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+A\+T\+\_\+\+I\+M\+PL}}(is\+\_\+require, file, line, \mbox{\hyperlink{doctest__fwd_8h_ac2799231daab4b10ca221f997ef94981}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+N\+O\+N\+Y\+M\+O\+US}}(\+\_\+\+D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+E\+S\+S\+A\+G\+E\+\_\+), \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2015 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a903e2a8556f8177e0015df1425a47de0}\label{doctest__fwd_8h_a903e2a8556f8177e0015df1425a47de0}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ADD\_FAIL\_CHECK\_AT@{DOCTEST\_ADD\_FAIL\_CHECK\_AT}} \index{DOCTEST\_ADD\_FAIL\_CHECK\_AT@{DOCTEST\_ADD\_FAIL\_CHECK\_AT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ADD\_FAIL\_CHECK\_AT}{DOCTEST\_ADD\_FAIL\_CHECK\_AT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+F\+A\+I\+L\+\_\+\+C\+H\+E\+C\+K\+\_\+\+AT(\begin{DoxyParamCaption}\item[{}]{file, }\item[{}]{line, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ab70c0e91885a1f48ff582a67b61f6771}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+A\+T\+\_\+\+I\+M\+PL}}(is\+\_\+check, file, line, \mbox{\hyperlink{doctest__fwd_8h_ac2799231daab4b10ca221f997ef94981}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+N\+O\+N\+Y\+M\+O\+US}}(\+\_\+\+D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+E\+S\+S\+A\+G\+E\+\_\+), \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2014 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ac89750ba2aa929667cd6c813dc5d0b0e}\label{doctest__fwd_8h_ac89750ba2aa929667cd6c813dc5d0b0e}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ADD\_MESSAGE\_AT@{DOCTEST\_ADD\_MESSAGE\_AT}} \index{DOCTEST\_ADD\_MESSAGE\_AT@{DOCTEST\_ADD\_MESSAGE\_AT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ADD\_MESSAGE\_AT}{DOCTEST\_ADD\_MESSAGE\_AT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+M\+E\+S\+S\+A\+G\+E\+\_\+\+AT(\begin{DoxyParamCaption}\item[{}]{file, }\item[{}]{line, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ab70c0e91885a1f48ff582a67b61f6771}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+A\+T\+\_\+\+I\+M\+PL}}(is\+\_\+warn, file, line, \mbox{\hyperlink{doctest__fwd_8h_ac2799231daab4b10ca221f997ef94981}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+N\+O\+N\+Y\+M\+O\+US}}(\+\_\+\+D\+O\+C\+T\+E\+S\+T\+\_\+\+M\+E\+S\+S\+A\+G\+E\+\_\+), \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2013 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a74415dda5235fab1484227e6e6d8e7f4}\label{doctest__fwd_8h_a74415dda5235fab1484227e6e6d8e7f4}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ALIGNMENT@{DOCTEST\_ALIGNMENT}} \index{DOCTEST\_ALIGNMENT@{DOCTEST\_ALIGNMENT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ALIGNMENT}{DOCTEST\_ALIGNMENT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+L\+I\+G\+N\+M\+E\+NT(\begin{DoxyParamCaption}\item[{}]{x }\end{DoxyParamCaption})~\+\_\+\+\_\+attribute\+\_\+\+\_\+((aligned(x)))} \mbox{\Hypertarget{doctest__fwd_8h_a98336975a3b162f382cad2ae2c058276}\label{doctest__fwd_8h_a98336975a3b162f382cad2ae2c058276}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_AND\_THEN@{DOCTEST\_AND\_THEN}} \index{DOCTEST\_AND\_THEN@{DOCTEST\_AND\_THEN}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_AND\_THEN}{DOCTEST\_AND\_THEN}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+N\+D\+\_\+\+T\+H\+EN(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}} }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a5acad2b6cef499ee884b8027ef41fbf6}{D\+O\+C\+T\+E\+S\+T\+\_\+\+S\+U\+B\+C\+A\+SE}}(\char`\"{} And\+: \char`\"{} name)} Definition at line 2487 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a9e696b9f04c18580c871e07653affcbf}\label{doctest__fwd_8h_a9e696b9f04c18580c871e07653affcbf}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_AND\_WHEN@{DOCTEST\_AND\_WHEN}} \index{DOCTEST\_AND\_WHEN@{DOCTEST\_AND\_WHEN}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_AND\_WHEN}{DOCTEST\_AND\_WHEN}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+N\+D\+\_\+\+W\+H\+EN(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}} }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a5acad2b6cef499ee884b8027ef41fbf6}{D\+O\+C\+T\+E\+S\+T\+\_\+\+S\+U\+B\+C\+A\+SE}}(\char`\"{}And when\+: \char`\"{} name)} Definition at line 2485 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ac2799231daab4b10ca221f997ef94981}\label{doctest__fwd_8h_ac2799231daab4b10ca221f997ef94981}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ANONYMOUS@{DOCTEST\_ANONYMOUS}} \index{DOCTEST\_ANONYMOUS@{DOCTEST\_ANONYMOUS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ANONYMOUS}{DOCTEST\_ANONYMOUS}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+N\+O\+N\+Y\+M\+O\+US(\begin{DoxyParamCaption}\item[{}]{x }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_aa13d3659f8aef0e4de7eab8eb5a70888}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+AT}}(x, \+\_\+\+\_\+\+L\+I\+N\+E\+\_\+\+\_\+)} \mbox{\Hypertarget{doctest__fwd_8h_a6f0e0a277346b049dd3812f801d0c9cc}\label{doctest__fwd_8h_a6f0e0a277346b049dd3812f801d0c9cc}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ASSERT\_IMPLEMENT\_1@{DOCTEST\_ASSERT\_IMPLEMENT\_1}} \index{DOCTEST\_ASSERT\_IMPLEMENT\_1@{DOCTEST\_ASSERT\_IMPLEMENT\_1}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ASSERT\_IMPLEMENT\_1}{DOCTEST\_ASSERT\_IMPLEMENT\_1}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+I\+M\+P\+L\+E\+M\+E\+N\+T\+\_\+1(\begin{DoxyParamCaption}\item[{}]{assert\+\_\+type, }\item[{}]{... }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keywordflow}{do} \{ \(\backslash\)} \DoxyCodeLine{ DOCTEST\_ASSERT\_IMPLEMENT\_2(assert\_type, \_\_VA\_ARGS\_\_); \(\backslash\)} \DoxyCodeLine{ \} \textcolor{keywordflow}{while}(\textcolor{keyword}{false})} \end{DoxyCode} Definition at line 2036 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ae0ef8a67578eac1dcda25d35d11df981}\label{doctest__fwd_8h_ae0ef8a67578eac1dcda25d35d11df981}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ASSERT\_IMPLEMENT\_2@{DOCTEST\_ASSERT\_IMPLEMENT\_2}} \index{DOCTEST\_ASSERT\_IMPLEMENT\_2@{DOCTEST\_ASSERT\_IMPLEMENT\_2}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ASSERT\_IMPLEMENT\_2}{DOCTEST\_ASSERT\_IMPLEMENT\_2}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+I\+M\+P\+L\+E\+M\+E\+N\+T\+\_\+2(\begin{DoxyParamCaption}\item[{}]{assert\+\_\+type, }\item[{}]{... }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \mbox{\hyperlink{doctest__fwd_8h_aeffeb8afb2053d165c856f4ee520b62b}{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_WITH\_PUSH}}(\textcolor{stringliteral}{"-\/Woverloaded-\/shift-\/op-\/parentheses"}) \(\backslash\)} \DoxyCodeLine{ doctest::detail::ResultBuilder \_DOCTEST\_RB(doctest::assertType::assert\_type, \_\_FILE\_\_, \(\backslash\)} \DoxyCodeLine{ \_\_LINE\_\_, \#\_\_VA\_ARGS\_\_); \(\backslash\)} \DoxyCodeLine{ DOCTEST\_WRAP\_IN\_TRY(\_DOCTEST\_RB.setResult( \(\backslash\)} \DoxyCodeLine{ \mbox{\hyperlink{structdoctest_1_1detail_1_1_expression_decomposer}{doctest::detail::ExpressionDecomposer}}(doctest::assertType::assert\_type) \(\backslash\)} \DoxyCodeLine{ << \_\_VA\_ARGS\_\_)) \(\backslash\)} \DoxyCodeLine{ DOCTEST\_ASSERT\_LOG\_AND\_REACT(\_DOCTEST\_RB) \(\backslash\)} \DoxyCodeLine{ DOCTEST\_CLANG\_SUPPRESS\_WARNING\_POP} \end{DoxyCode} Definition at line 2026 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a91330bd2fb42d1fac4aa07e425a20f2e}\label{doctest__fwd_8h_a91330bd2fb42d1fac4aa07e425a20f2e}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ASSERT\_IN\_TESTS@{DOCTEST\_ASSERT\_IN\_TESTS}} \index{DOCTEST\_ASSERT\_IN\_TESTS@{DOCTEST\_ASSERT\_IN\_TESTS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ASSERT\_IN\_TESTS}{DOCTEST\_ASSERT\_IN\_TESTS}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+I\+N\+\_\+\+T\+E\+S\+TS(\begin{DoxyParamCaption}\item[{}]{decomp }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ ResultBuilder rb(at, file, line, expr); \(\backslash\)} \DoxyCodeLine{ rb.m\_failed = failed; \(\backslash\)} \DoxyCodeLine{ if(rb.m\_failed || \mbox{\hyperlink{namespacedoctest_a426c38f4b2561bf6cfb10a370bddc3da}{getContextOptions}}()-\/>success) \(\backslash\)} \DoxyCodeLine{ rb.m\_decomp = decomp; \(\backslash\)} \DoxyCodeLine{ if(rb.log()) \(\backslash\)} \DoxyCodeLine{ DOCTEST\_BREAK\_INTO\_DEBUGGER(); \(\backslash\)} \DoxyCodeLine{ if(rb.m\_failed \&\& \mbox{\hyperlink{namespacedoctest_1_1detail_acec9ff072dd86af95225a8beb9c57298}{checkIfShouldThrow}}(at)) \(\backslash\)} \DoxyCodeLine{ throwException()} \end{DoxyCode} Definition at line 1397 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a8e164a058ac26ae189718da03547f9fd}\label{doctest__fwd_8h_a8e164a058ac26ae189718da03547f9fd}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ASSERT\_LOG\_AND\_REACT@{DOCTEST\_ASSERT\_LOG\_AND\_REACT}} \index{DOCTEST\_ASSERT\_LOG\_AND\_REACT@{DOCTEST\_ASSERT\_LOG\_AND\_REACT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ASSERT\_LOG\_AND\_REACT}{DOCTEST\_ASSERT\_LOG\_AND\_REACT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+L\+O\+G\+\_\+\+A\+N\+D\+\_\+\+R\+E\+A\+CT(\begin{DoxyParamCaption}\item[{}]{b }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keywordflow}{if}(b.log()) \(\backslash\)} \DoxyCodeLine{ DOCTEST\_BREAK\_INTO\_DEBUGGER(); \(\backslash\)} \DoxyCodeLine{ b.react()} \end{DoxyCode} Definition at line 1779 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_af4883c6ce28524bfc7510a1e84c537bc}\label{doctest__fwd_8h_af4883c6ce28524bfc7510a1e84c537bc}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ASSERT\_NOTHROW@{DOCTEST\_ASSERT\_NOTHROW}} \index{DOCTEST\_ASSERT\_NOTHROW@{DOCTEST\_ASSERT\_NOTHROW}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ASSERT\_NOTHROW}{DOCTEST\_ASSERT\_NOTHROW}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+N\+O\+T\+H\+R\+OW(\begin{DoxyParamCaption}\item[{}]{assert\+\_\+type, }\item[{}]{... }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keywordflow}{do} \{ \(\backslash\)} \DoxyCodeLine{ doctest::detail::ResultBuilder \_DOCTEST\_RB(doctest::assertType::assert\_type, \_\_FILE\_\_, \(\backslash\)} \DoxyCodeLine{ \_\_LINE\_\_, \#\_\_VA\_ARGS\_\_); \(\backslash\)} \DoxyCodeLine{ try \{ \(\backslash\)} \DoxyCodeLine{ DOCTEST\_CAST\_TO\_VOID(\_\_VA\_ARGS\_\_) \(\backslash\)} \DoxyCodeLine{ \} \textcolor{keywordflow}{catch}(...) \{ \_DOCTEST\_RB.translateException(); \} \(\backslash\)} \DoxyCodeLine{ DOCTEST\_ASSERT\_LOG\_AND\_REACT(\_DOCTEST\_RB); \(\backslash\)} \DoxyCodeLine{ \} \textcolor{keywordflow}{while}(\textcolor{keyword}{false})} \end{DoxyCode} Definition at line 2099 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ab4f2e4a4e2bbb1ea221db5cdf117a014}\label{doctest__fwd_8h_ab4f2e4a4e2bbb1ea221db5cdf117a014}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ASSERT\_OUT\_OF\_TESTS@{DOCTEST\_ASSERT\_OUT\_OF\_TESTS}} \index{DOCTEST\_ASSERT\_OUT\_OF\_TESTS@{DOCTEST\_ASSERT\_OUT\_OF\_TESTS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ASSERT\_OUT\_OF\_TESTS}{DOCTEST\_ASSERT\_OUT\_OF\_TESTS}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+O\+U\+T\+\_\+\+O\+F\+\_\+\+T\+E\+S\+TS(\begin{DoxyParamCaption}\item[{}]{decomp }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keywordflow}{do} \{ \(\backslash\)} \DoxyCodeLine{ if(!\mbox{\hyperlink{namespacedoctest_a0b03060093b3894c976b6ae84e55f3f2}{is\_running\_in\_test}}) \{ \(\backslash\)} \DoxyCodeLine{ if(failed) \{ \(\backslash\)} \DoxyCodeLine{ ResultBuilder rb(at, file, line, expr); \(\backslash\)} \DoxyCodeLine{ rb.m\_failed = failed; \(\backslash\)} \DoxyCodeLine{ rb.m\_decomp = decomp; \(\backslash\)} \DoxyCodeLine{ failed\_out\_of\_a\_testing\_context(rb); \(\backslash\)} \DoxyCodeLine{ if(\mbox{\hyperlink{namespacedoctest_1_1detail_a013828c4e677241cc26aeea33f762710}{isDebuggerActive}}() \&\&!\mbox{\hyperlink{namespacedoctest_a426c38f4b2561bf6cfb10a370bddc3da}{getContextOptions}}()-\/>no\_breaks) \(\backslash\)} \DoxyCodeLine{ DOCTEST\_BREAK\_INTO\_DEBUGGER(); \(\backslash\)} \DoxyCodeLine{ if(\mbox{\hyperlink{namespacedoctest_1_1detail_acec9ff072dd86af95225a8beb9c57298}{checkIfShouldThrow}}(at)) \(\backslash\)} \DoxyCodeLine{ throwException(); \(\backslash\)} \DoxyCodeLine{ \} \(\backslash\)} \DoxyCodeLine{ return; \(\backslash\)} \DoxyCodeLine{ \} \(\backslash\)} \DoxyCodeLine{ \} \textcolor{keywordflow}{while}(\textcolor{keyword}{false})} \end{DoxyCode} Definition at line 1380 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a2e518f9a0e6ac2fafa273ea56f286887}\label{doctest__fwd_8h_a2e518f9a0e6ac2fafa273ea56f286887}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ASSERT\_THROWS\_AS@{DOCTEST\_ASSERT\_THROWS\_AS}} \index{DOCTEST\_ASSERT\_THROWS\_AS@{DOCTEST\_ASSERT\_THROWS\_AS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ASSERT\_THROWS\_AS}{DOCTEST\_ASSERT\_THROWS\_AS}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+AS(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{assert\+\_\+type, }\item[{}]{\mbox{\hyperlink{doctest_8cpp_a36bd74109f547f7f8198faf5a12d2879}{message}}, }\item[{}]{... }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keywordflow}{do} \{ \(\backslash\)} \DoxyCodeLine{ if(!\mbox{\hyperlink{namespacedoctest_a426c38f4b2561bf6cfb10a370bddc3da}{doctest::getContextOptions}}()-\/>no\_throw) \{ \(\backslash\)} \DoxyCodeLine{ doctest::detail::ResultBuilder \_DOCTEST\_RB(doctest::assertType::assert\_type, \_\_FILE\_\_, \(\backslash\)} \DoxyCodeLine{ \_\_LINE\_\_, \#expr, \#\_\_VA\_ARGS\_\_, \mbox{\hyperlink{doctest_8cpp_a36bd74109f547f7f8198faf5a12d2879}{message}}); \(\backslash\)} \DoxyCodeLine{ try \{ \(\backslash\)} \DoxyCodeLine{ DOCTEST\_CAST\_TO\_VOID(expr) \(\backslash\)} \DoxyCodeLine{ \} \textcolor{keywordflow}{catch}(\textcolor{keyword}{const} \textcolor{keyword}{typename} \mbox{\hyperlink{structdoctest_1_1detail_1_1remove__const}{doctest::detail::remove\_const}}< \(\backslash\)} \DoxyCodeLine{ \textcolor{keyword}{typename} \mbox{\hyperlink{structdoctest_1_1detail_1_1remove__reference_ab3cba0e8bc4c71b7f4ecdf85476ec4cc}{doctest::detail::remove\_reference<\_\_VA\_ARGS\_\_>::type}}>::\mbox{\hyperlink{doctest_8cpp_a75b160f574a0be26114bae2c7686a5e1}{type}}\&) \{ \(\backslash\)} \DoxyCodeLine{ \_DOCTEST\_RB.translateException(); \(\backslash\)} \DoxyCodeLine{ \_DOCTEST\_RB.m\_threw\_as = \textcolor{keyword}{true}; \(\backslash\)} \DoxyCodeLine{ \} \textcolor{keywordflow}{catch}(...) \{ \_DOCTEST\_RB.translateException(); \} \(\backslash\)} \DoxyCodeLine{ DOCTEST\_ASSERT\_LOG\_AND\_REACT(\_DOCTEST\_RB); \(\backslash\)} \DoxyCodeLine{ \} \(\backslash\)} \DoxyCodeLine{ \} \textcolor{keywordflow}{while}(\textcolor{keyword}{false})} \end{DoxyCode} Definition at line 2071 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a833efe98e345c23d2c40d4d8f9ba9a61}\label{doctest__fwd_8h_a833efe98e345c23d2c40d4d8f9ba9a61}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_ASSERT\_THROWS\_WITH@{DOCTEST\_ASSERT\_THROWS\_WITH}} \index{DOCTEST\_ASSERT\_THROWS\_WITH@{DOCTEST\_ASSERT\_THROWS\_WITH}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_ASSERT\_THROWS\_WITH}{DOCTEST\_ASSERT\_THROWS\_WITH}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+TH(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{expr\+\_\+str, }\item[{}]{assert\+\_\+type, }\item[{}]{... }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keywordflow}{do} \{ \(\backslash\)} \DoxyCodeLine{ if(!\mbox{\hyperlink{namespacedoctest_a426c38f4b2561bf6cfb10a370bddc3da}{doctest::getContextOptions}}()-\/>no\_throw) \{ \(\backslash\)} \DoxyCodeLine{ doctest::detail::ResultBuilder \_DOCTEST\_RB(doctest::assertType::assert\_type, \_\_FILE\_\_, \(\backslash\)} \DoxyCodeLine{ \_\_LINE\_\_, expr\_str, \textcolor{stringliteral}{""}, \_\_VA\_ARGS\_\_); \(\backslash\)} \DoxyCodeLine{ try \{ \(\backslash\)} \DoxyCodeLine{ DOCTEST\_CAST\_TO\_VOID(expr) \(\backslash\)} \DoxyCodeLine{ \} \textcolor{keywordflow}{catch}(...) \{ \_DOCTEST\_RB.translateException(); \} \(\backslash\)} \DoxyCodeLine{ DOCTEST\_ASSERT\_LOG\_AND\_REACT(\_DOCTEST\_RB); \(\backslash\)} \DoxyCodeLine{ \} \(\backslash\)} \DoxyCodeLine{ \} \textcolor{keywordflow}{while}(\textcolor{keyword}{false})} \end{DoxyCode} Definition at line 2087 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a60862298c47edf3eaeb30b3cac4d62d8}\label{doctest__fwd_8h_a60862298c47edf3eaeb30b3cac4d62d8}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_BINARY\_ASSERT@{DOCTEST\_BINARY\_ASSERT}} \index{DOCTEST\_BINARY\_ASSERT@{DOCTEST\_BINARY\_ASSERT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_BINARY\_ASSERT}{DOCTEST\_BINARY\_ASSERT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+B\+I\+N\+A\+R\+Y\+\_\+\+A\+S\+S\+E\+RT(\begin{DoxyParamCaption}\item[{}]{assert\+\_\+type, }\item[{}]{comp, }\item[{}]{... }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keywordflow}{do} \{ \(\backslash\)} \DoxyCodeLine{ doctest::detail::ResultBuilder \_DOCTEST\_RB(doctest::assertType::assert\_type, \_\_FILE\_\_, \(\backslash\)} \DoxyCodeLine{ \_\_LINE\_\_, \#\_\_VA\_ARGS\_\_); \(\backslash\)} \DoxyCodeLine{ DOCTEST\_WRAP\_IN\_TRY( \(\backslash\)} \DoxyCodeLine{ \_DOCTEST\_RB.binary\_assert<doctest::detail::binaryAssertComparison::comp>( \(\backslash\)} \DoxyCodeLine{ \_\_VA\_ARGS\_\_)) \(\backslash\)} \DoxyCodeLine{ DOCTEST\_ASSERT\_LOG\_AND\_REACT(\_DOCTEST\_RB); \(\backslash\)} \DoxyCodeLine{ \} \textcolor{keywordflow}{while}(\textcolor{keyword}{false})} \end{DoxyCode} Definition at line 2149 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a709ccd44cac02b9af890e6e1880e406e}\label{doctest__fwd_8h_a709ccd44cac02b9af890e6e1880e406e}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_BINARY\_RELATIONAL\_OP@{DOCTEST\_BINARY\_RELATIONAL\_OP}} \index{DOCTEST\_BINARY\_RELATIONAL\_OP@{DOCTEST\_BINARY\_RELATIONAL\_OP}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_BINARY\_RELATIONAL\_OP}{DOCTEST\_BINARY\_RELATIONAL\_OP}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+B\+I\+N\+A\+R\+Y\+\_\+\+R\+E\+L\+A\+T\+I\+O\+N\+A\+L\+\_\+\+OP(\begin{DoxyParamCaption}\item[{}]{n, }\item[{}]{op }\end{DoxyParamCaption})~template $<$class L, class R$>$ struct Relational\+Comparator$<$n, L, R$>$ \{ bool operator()(const \mbox{\hyperlink{doctest__fwd_8h_af2901cafb023c57fb672ccb1bf14f2eb}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+F\+\_\+\+W\+R\+AP}}(L) lhs, const \mbox{\hyperlink{doctest__fwd_8h_af2901cafb023c57fb672ccb1bf14f2eb}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+F\+\_\+\+W\+R\+AP}}(R) rhs) const \{ return op(lhs, rhs); \} \};} Definition at line 1323 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a156f7857b0e423d51c56ea8398d0cb94}\label{doctest__fwd_8h_a156f7857b0e423d51c56ea8398d0cb94}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_BREAK\_INTO\_DEBUGGER@{DOCTEST\_BREAK\_INTO\_DEBUGGER}} \index{DOCTEST\_BREAK\_INTO\_DEBUGGER@{DOCTEST\_BREAK\_INTO\_DEBUGGER}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_BREAK\_INTO\_DEBUGGER}{DOCTEST\_BREAK\_INTO\_DEBUGGER}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+B\+R\+E\+A\+K\+\_\+\+I\+N\+T\+O\+\_\+\+D\+E\+B\+U\+G\+G\+ER(\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})~raise(S\+I\+G\+T\+R\+AP)} \mbox{\Hypertarget{doctest__fwd_8h_a5a8ade28d558f5fcb66f8493d0596e6c}\label{doctest__fwd_8h_a5a8ade28d558f5fcb66f8493d0596e6c}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CAPTURE@{DOCTEST\_CAPTURE}} \index{DOCTEST\_CAPTURE@{DOCTEST\_CAPTURE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CAPTURE}{DOCTEST\_CAPTURE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+A\+P\+T\+U\+RE(\begin{DoxyParamCaption}\item[{}]{x }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_abaa42cd51b4d27384c51ef5d957b888a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+FO}}(\#x \char`\"{} \+:= \char`\"{}, x)} Definition at line 2003 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a70f4ca15fe554a44bb0e2b8109e45822}\label{doctest__fwd_8h_a70f4ca15fe554a44bb0e2b8109e45822}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CAST\_TO\_VOID@{DOCTEST\_CAST\_TO\_VOID}} \index{DOCTEST\_CAST\_TO\_VOID@{DOCTEST\_CAST\_TO\_VOID}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CAST\_TO\_VOID}{DOCTEST\_CAST\_TO\_VOID}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+A\+S\+T\+\_\+\+T\+O\+\_\+\+V\+O\+ID(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+;} Definition at line 1799 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_aa13d3659f8aef0e4de7eab8eb5a70888}\label{doctest__fwd_8h_aa13d3659f8aef0e4de7eab8eb5a70888}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CAT@{DOCTEST\_CAT}} \index{DOCTEST\_CAT@{DOCTEST\_CAT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CAT}{DOCTEST\_CAT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+AT(\begin{DoxyParamCaption}\item[{}]{s1, }\item[{}]{s2 }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a3e1308af156afd15b2abde1ebe778421}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+A\+T\+\_\+\+I\+M\+PL}}(s1, s2)} \mbox{\Hypertarget{doctest__fwd_8h_a3e1308af156afd15b2abde1ebe778421}\label{doctest__fwd_8h_a3e1308af156afd15b2abde1ebe778421}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CAT\_IMPL@{DOCTEST\_CAT\_IMPL}} \index{DOCTEST\_CAT\_IMPL@{DOCTEST\_CAT\_IMPL}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CAT\_IMPL}{DOCTEST\_CAT\_IMPL}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+A\+T\+\_\+\+I\+M\+PL(\begin{DoxyParamCaption}\item[{}]{s1, }\item[{}]{s2 }\end{DoxyParamCaption})~s1\#\#s2} \mbox{\Hypertarget{doctest__fwd_8h_a8f40c4072e85f02a3e58c5f67a182297}\label{doctest__fwd_8h_a8f40c4072e85f02a3e58c5f67a182297}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK@{DOCTEST\_CHECK}} \index{DOCTEST\_CHECK@{DOCTEST\_CHECK}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK}{DOCTEST\_CHECK}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+CK(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a6f0e0a277346b049dd3812f801d0c9cc}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+I\+M\+P\+L\+E\+M\+E\+N\+T\+\_\+1}}(D\+T\+\_\+\+C\+H\+E\+CK, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2056 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a2ac8b5624c3b8d9520c75a68634cb8c1}\label{doctest__fwd_8h_a2ac8b5624c3b8d9520c75a68634cb8c1}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_EQ@{DOCTEST\_CHECK\_EQ}} \index{DOCTEST\_CHECK\_EQ@{DOCTEST\_CHECK\_EQ}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_EQ}{DOCTEST\_CHECK\_EQ}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+EQ(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a60862298c47edf3eaeb30b3cac4d62d8}{D\+O\+C\+T\+E\+S\+T\+\_\+\+B\+I\+N\+A\+R\+Y\+\_\+\+A\+S\+S\+E\+RT}}(D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+EQ, eq, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2180 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a7ecf2c25ffc2fad220a251af0ab37ff8}\label{doctest__fwd_8h_a7ecf2c25ffc2fad220a251af0ab37ff8}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_FALSE@{DOCTEST\_CHECK\_FALSE}} \index{DOCTEST\_CHECK\_FALSE@{DOCTEST\_CHECK\_FALSE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_FALSE}{DOCTEST\_CHECK\_FALSE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+F\+A\+L\+SE(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a6f0e0a277346b049dd3812f801d0c9cc}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+I\+M\+P\+L\+E\+M\+E\+N\+T\+\_\+1}}(D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+F\+A\+L\+SE, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2059 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_afce21f03a310657b5bafd6e98b4442de}\label{doctest__fwd_8h_afce21f03a310657b5bafd6e98b4442de}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_FALSE\_MESSAGE@{DOCTEST\_CHECK\_FALSE\_MESSAGE}} \index{DOCTEST\_CHECK\_FALSE\_MESSAGE@{DOCTEST\_CHECK\_FALSE\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_FALSE\_MESSAGE}{DOCTEST\_CHECK\_FALSE\_MESSAGE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+F\+A\+L\+S\+E\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{cond, }\item[{}]{... }\end{DoxyParamCaption})~do \{ \mbox{\hyperlink{doctest__fwd_8h_abaa42cd51b4d27384c51ef5d957b888a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+FO}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+); \mbox{\hyperlink{doctest__fwd_8h_ae0ef8a67578eac1dcda25d35d11df981}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+I\+M\+P\+L\+E\+M\+E\+N\+T\+\_\+2}}(D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+F\+A\+L\+SE, cond); \} while(false)} Definition at line 2067 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a296f8caf3497fbc9433d2e77691b0b3e}\label{doctest__fwd_8h_a296f8caf3497fbc9433d2e77691b0b3e}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_GE@{DOCTEST\_CHECK\_GE}} \index{DOCTEST\_CHECK\_GE@{DOCTEST\_CHECK\_GE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_GE}{DOCTEST\_CHECK\_GE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+GE(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a60862298c47edf3eaeb30b3cac4d62d8}{D\+O\+C\+T\+E\+S\+T\+\_\+\+B\+I\+N\+A\+R\+Y\+\_\+\+A\+S\+S\+E\+RT}}(D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+GE, ge, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2192 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a8d3a9781fd7a67021ec12e0aea024ed6}\label{doctest__fwd_8h_a8d3a9781fd7a67021ec12e0aea024ed6}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_GT@{DOCTEST\_CHECK\_GT}} \index{DOCTEST\_CHECK\_GT@{DOCTEST\_CHECK\_GT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_GT}{DOCTEST\_CHECK\_GT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+GT(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a60862298c47edf3eaeb30b3cac4d62d8}{D\+O\+C\+T\+E\+S\+T\+\_\+\+B\+I\+N\+A\+R\+Y\+\_\+\+A\+S\+S\+E\+RT}}(D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+GT, gt, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2186 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a25823108f6fed8787303bbad7c619f35}\label{doctest__fwd_8h_a25823108f6fed8787303bbad7c619f35}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_LE@{DOCTEST\_CHECK\_LE}} \index{DOCTEST\_CHECK\_LE@{DOCTEST\_CHECK\_LE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_LE}{DOCTEST\_CHECK\_LE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+LE(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a60862298c47edf3eaeb30b3cac4d62d8}{D\+O\+C\+T\+E\+S\+T\+\_\+\+B\+I\+N\+A\+R\+Y\+\_\+\+A\+S\+S\+E\+RT}}(D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+LE, le, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2195 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a4e1d83dffb779a2829552c4fefbb516a}\label{doctest__fwd_8h_a4e1d83dffb779a2829552c4fefbb516a}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_LT@{DOCTEST\_CHECK\_LT}} \index{DOCTEST\_CHECK\_LT@{DOCTEST\_CHECK\_LT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_LT}{DOCTEST\_CHECK\_LT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+LT(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a60862298c47edf3eaeb30b3cac4d62d8}{D\+O\+C\+T\+E\+S\+T\+\_\+\+B\+I\+N\+A\+R\+Y\+\_\+\+A\+S\+S\+E\+RT}}(D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+LT, lt, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2189 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a786fe34d54658c61956b291befcb2bcb}\label{doctest__fwd_8h_a786fe34d54658c61956b291befcb2bcb}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_MESSAGE@{DOCTEST\_CHECK\_MESSAGE}} \index{DOCTEST\_CHECK\_MESSAGE@{DOCTEST\_CHECK\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_MESSAGE}{DOCTEST\_CHECK\_MESSAGE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{cond, }\item[{}]{... }\end{DoxyParamCaption})~do \{ \mbox{\hyperlink{doctest__fwd_8h_abaa42cd51b4d27384c51ef5d957b888a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+FO}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+); \mbox{\hyperlink{doctest__fwd_8h_ae0ef8a67578eac1dcda25d35d11df981}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+I\+M\+P\+L\+E\+M\+E\+N\+T\+\_\+2}}(D\+T\+\_\+\+C\+H\+E\+CK, cond); \} while(false)} Definition at line 2064 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_afe1e20e7078d65704c6b2f4e55bbfc03}\label{doctest__fwd_8h_afe1e20e7078d65704c6b2f4e55bbfc03}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_NE@{DOCTEST\_CHECK\_NE}} \index{DOCTEST\_CHECK\_NE@{DOCTEST\_CHECK\_NE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_NE}{DOCTEST\_CHECK\_NE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+NE(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a60862298c47edf3eaeb30b3cac4d62d8}{D\+O\+C\+T\+E\+S\+T\+\_\+\+B\+I\+N\+A\+R\+Y\+\_\+\+A\+S\+S\+E\+RT}}(D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+NE, ne, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2183 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_aac7b7640f3d6611423a2c5a18d905069}\label{doctest__fwd_8h_aac7b7640f3d6611423a2c5a18d905069}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_NOTHROW@{DOCTEST\_CHECK\_NOTHROW}} \index{DOCTEST\_CHECK\_NOTHROW@{DOCTEST\_CHECK\_NOTHROW}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_NOTHROW}{DOCTEST\_CHECK\_NOTHROW}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+N\+O\+T\+H\+R\+OW(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_af4883c6ce28524bfc7510a1e84c537bc}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+N\+O\+T\+H\+R\+OW}}(D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+N\+O\+T\+H\+R\+OW, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2127 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a8b75d37da2864af17a65dd436038614b}\label{doctest__fwd_8h_a8b75d37da2864af17a65dd436038614b}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_NOTHROW\_MESSAGE@{DOCTEST\_CHECK\_NOTHROW\_MESSAGE}} \index{DOCTEST\_CHECK\_NOTHROW\_MESSAGE@{DOCTEST\_CHECK\_NOTHROW\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_NOTHROW\_MESSAGE}{DOCTEST\_CHECK\_NOTHROW\_MESSAGE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+N\+O\+T\+H\+R\+O\+W\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{... }\end{DoxyParamCaption})~do \{ \mbox{\hyperlink{doctest__fwd_8h_abaa42cd51b4d27384c51ef5d957b888a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+FO}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+); \mbox{\hyperlink{doctest__fwd_8h_aac7b7640f3d6611423a2c5a18d905069}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+N\+O\+T\+H\+R\+OW}}(expr); \} while(false)} Definition at line 2143 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a4390850609b0f465bc8a4e7355f91177}\label{doctest__fwd_8h_a4390850609b0f465bc8a4e7355f91177}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_THROWS@{DOCTEST\_CHECK\_THROWS}} \index{DOCTEST\_CHECK\_THROWS@{DOCTEST\_CHECK\_THROWS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_THROWS}{DOCTEST\_CHECK\_THROWS}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+WS(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a833efe98e345c23d2c40d4d8f9ba9a61}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+TH}}((\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+), \#\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+, D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+WS, \char`\"{}\char`\"{})} Definition at line 2111 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a84f4eb0aeb37b27b3cad5f3e44c08195}\label{doctest__fwd_8h_a84f4eb0aeb37b27b3cad5f3e44c08195}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_THROWS\_AS@{DOCTEST\_CHECK\_THROWS\_AS}} \index{DOCTEST\_CHECK\_THROWS\_AS@{DOCTEST\_CHECK\_THROWS\_AS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_THROWS\_AS}{DOCTEST\_CHECK\_THROWS\_AS}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+AS(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a2e518f9a0e6ac2fafa273ea56f286887}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+AS}}(expr, D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+AS, \char`\"{}\char`\"{}, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2115 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a72345d4052cc19f881c5adf40226155d}\label{doctest__fwd_8h_a72345d4052cc19f881c5adf40226155d}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_THROWS\_AS\_MESSAGE@{DOCTEST\_CHECK\_THROWS\_AS\_MESSAGE}} \index{DOCTEST\_CHECK\_THROWS\_AS\_MESSAGE@{DOCTEST\_CHECK\_THROWS\_AS\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_THROWS\_AS\_MESSAGE}{DOCTEST\_CHECK\_THROWS\_AS\_MESSAGE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+A\+S\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{ex, }\item[{}]{... }\end{DoxyParamCaption})~do \{ \mbox{\hyperlink{doctest__fwd_8h_abaa42cd51b4d27384c51ef5d957b888a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+FO}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+); \mbox{\hyperlink{doctest__fwd_8h_a84f4eb0aeb37b27b3cad5f3e44c08195}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+AS}}(expr, ex); \} while(false)} Definition at line 2134 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ad989f89d414af6c3472b22ad2d6bfe54}\label{doctest__fwd_8h_ad989f89d414af6c3472b22ad2d6bfe54}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_THROWS\_MESSAGE@{DOCTEST\_CHECK\_THROWS\_MESSAGE}} \index{DOCTEST\_CHECK\_THROWS\_MESSAGE@{DOCTEST\_CHECK\_THROWS\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_THROWS\_MESSAGE}{DOCTEST\_CHECK\_THROWS\_MESSAGE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{... }\end{DoxyParamCaption})~do \{ \mbox{\hyperlink{doctest__fwd_8h_abaa42cd51b4d27384c51ef5d957b888a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+FO}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+); \mbox{\hyperlink{doctest__fwd_8h_a4390850609b0f465bc8a4e7355f91177}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+WS}}(expr); \} while(false)} Definition at line 2131 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a141ab91ff9697fa7d978989d56ce42d5}\label{doctest__fwd_8h_a141ab91ff9697fa7d978989d56ce42d5}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_THROWS\_WITH@{DOCTEST\_CHECK\_THROWS\_WITH}} \index{DOCTEST\_CHECK\_THROWS\_WITH@{DOCTEST\_CHECK\_THROWS\_WITH}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_THROWS\_WITH}{DOCTEST\_CHECK\_THROWS\_WITH}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+TH(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a833efe98e345c23d2c40d4d8f9ba9a61}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+TH}}(expr, \#expr, D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+TH, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2119 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ac53fee45159d080520c2d16416e6468f}\label{doctest__fwd_8h_ac53fee45159d080520c2d16416e6468f}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_THROWS\_WITH\_AS@{DOCTEST\_CHECK\_THROWS\_WITH\_AS}} \index{DOCTEST\_CHECK\_THROWS\_WITH\_AS@{DOCTEST\_CHECK\_THROWS\_WITH\_AS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_THROWS\_WITH\_AS}{DOCTEST\_CHECK\_THROWS\_WITH\_AS}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+T\+H\+\_\+\+AS(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{\mbox{\hyperlink{doctest_8cpp_a36bd74109f547f7f8198faf5a12d2879}{message}}, }\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a2e518f9a0e6ac2fafa273ea56f286887}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+S\+S\+E\+R\+T\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+AS}}(expr, D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+T\+H\+\_\+\+AS, \mbox{\hyperlink{doctest_8cpp_a36bd74109f547f7f8198faf5a12d2879}{message}}, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2123 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ae08de7161897c76ce0a87767fc171f4f}\label{doctest__fwd_8h_ae08de7161897c76ce0a87767fc171f4f}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_THROWS\_WITH\_AS\_MESSAGE@{DOCTEST\_CHECK\_THROWS\_WITH\_AS\_MESSAGE}} \index{DOCTEST\_CHECK\_THROWS\_WITH\_AS\_MESSAGE@{DOCTEST\_CHECK\_THROWS\_WITH\_AS\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_THROWS\_WITH\_AS\_MESSAGE}{DOCTEST\_CHECK\_THROWS\_WITH\_AS\_MESSAGE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+T\+H\+\_\+\+A\+S\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{with, }\item[{}]{ex, }\item[{}]{... }\end{DoxyParamCaption})~do \{ \mbox{\hyperlink{doctest__fwd_8h_abaa42cd51b4d27384c51ef5d957b888a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+FO}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+); \mbox{\hyperlink{doctest__fwd_8h_ac53fee45159d080520c2d16416e6468f}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+T\+H\+\_\+\+AS}}(expr, with, ex); \} while(false)} Definition at line 2140 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ab989b8025f31020a0f172ec67cf06a76}\label{doctest__fwd_8h_ab989b8025f31020a0f172ec67cf06a76}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_THROWS\_WITH\_MESSAGE@{DOCTEST\_CHECK\_THROWS\_WITH\_MESSAGE}} \index{DOCTEST\_CHECK\_THROWS\_WITH\_MESSAGE@{DOCTEST\_CHECK\_THROWS\_WITH\_MESSAGE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_THROWS\_WITH\_MESSAGE}{DOCTEST\_CHECK\_THROWS\_WITH\_MESSAGE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+T\+H\+\_\+\+M\+E\+S\+S\+A\+GE(\begin{DoxyParamCaption}\item[{}]{expr, }\item[{}]{with, }\item[{}]{... }\end{DoxyParamCaption})~do \{ \mbox{\hyperlink{doctest__fwd_8h_abaa42cd51b4d27384c51ef5d957b888a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+I\+N\+FO}}(\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+); \mbox{\hyperlink{doctest__fwd_8h_a141ab91ff9697fa7d978989d56ce42d5}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+T\+H\+R\+O\+W\+S\+\_\+\+W\+I\+TH}}(expr, with); \} while(false)} Definition at line 2137 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a660ce2901f42d4d2a82327204a6a3602}\label{doctest__fwd_8h_a660ce2901f42d4d2a82327204a6a3602}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_UNARY@{DOCTEST\_CHECK\_UNARY}} \index{DOCTEST\_CHECK\_UNARY@{DOCTEST\_CHECK\_UNARY}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_UNARY}{DOCTEST\_CHECK\_UNARY}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+RY(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ac80cb844919d4d049c456446354c1b58}{D\+O\+C\+T\+E\+S\+T\+\_\+\+U\+N\+A\+R\+Y\+\_\+\+A\+S\+S\+E\+RT}}(D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+RY, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2199 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a9ff04e98b0891f79528c180a4e7d6d36}\label{doctest__fwd_8h_a9ff04e98b0891f79528c180a4e7d6d36}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CHECK\_UNARY\_FALSE@{DOCTEST\_CHECK\_UNARY\_FALSE}} \index{DOCTEST\_CHECK\_UNARY\_FALSE@{DOCTEST\_CHECK\_UNARY\_FALSE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CHECK\_UNARY\_FALSE}{DOCTEST\_CHECK\_UNARY\_FALSE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+R\+Y\+\_\+\+F\+A\+L\+SE(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ac80cb844919d4d049c456446354c1b58}{D\+O\+C\+T\+E\+S\+T\+\_\+\+U\+N\+A\+R\+Y\+\_\+\+A\+S\+S\+E\+RT}}(D\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+R\+Y\+\_\+\+F\+A\+L\+SE, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2202 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_aa8185dcb93ad97061498679342d1e683}\label{doctest__fwd_8h_aa8185dcb93ad97061498679342d1e683}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CLANG@{DOCTEST\_CLANG}} \index{DOCTEST\_CLANG@{DOCTEST\_CLANG}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CLANG}{DOCTEST\_CLANG}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+L\+A\+NG~0} Definition at line 82 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_abfc21b2dc3aad9632b9e2689f468646c}\label{doctest__fwd_8h_abfc21b2dc3aad9632b9e2689f468646c}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CLANG\_SUPPRESS\_WARNING@{DOCTEST\_CLANG\_SUPPRESS\_WARNING}} \index{DOCTEST\_CLANG\_SUPPRESS\_WARNING@{DOCTEST\_CLANG\_SUPPRESS\_WARNING}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CLANG\_SUPPRESS\_WARNING}{DOCTEST\_CLANG\_SUPPRESS\_WARNING}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+L\+A\+N\+G\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+NG(\begin{DoxyParamCaption}\item[{}]{w }\end{DoxyParamCaption})} Definition at line 101 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a569dfd3f8dfae352f35e8f62aadbdbc4}\label{doctest__fwd_8h_a569dfd3f8dfae352f35e8f62aadbdbc4}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CLANG\_SUPPRESS\_WARNING\_POP@{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_POP}} \index{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_POP@{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_POP}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_POP}{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_POP}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+L\+A\+N\+G\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+N\+G\+\_\+\+P\+OP} Definition at line 102 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a628491cf2971a026350d5401986bf6d3}\label{doctest__fwd_8h_a628491cf2971a026350d5401986bf6d3}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CLANG\_SUPPRESS\_WARNING\_PUSH@{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_PUSH}} \index{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_PUSH@{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_PUSH}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_PUSH}{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_PUSH}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+L\+A\+N\+G\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+N\+G\+\_\+\+P\+U\+SH} Definition at line 100 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_aeffeb8afb2053d165c856f4ee520b62b}\label{doctest__fwd_8h_aeffeb8afb2053d165c856f4ee520b62b}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CLANG\_SUPPRESS\_WARNING\_WITH\_PUSH@{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_WITH\_PUSH}} \index{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_WITH\_PUSH@{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_WITH\_PUSH}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_WITH\_PUSH}{DOCTEST\_CLANG\_SUPPRESS\_WARNING\_WITH\_PUSH}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+L\+A\+N\+G\+\_\+\+S\+U\+P\+P\+R\+E\+S\+S\+\_\+\+W\+A\+R\+N\+I\+N\+G\+\_\+\+W\+I\+T\+H\+\_\+\+P\+U\+SH(\begin{DoxyParamCaption}\item[{}]{w }\end{DoxyParamCaption})} Definition at line 103 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_affded31d2dc937d95785e3d17332765b}\label{doctest__fwd_8h_affded31d2dc937d95785e3d17332765b}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CMP\_EQ@{DOCTEST\_CMP\_EQ}} \index{DOCTEST\_CMP\_EQ@{DOCTEST\_CMP\_EQ}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CMP\_EQ}{DOCTEST\_CMP\_EQ}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+M\+P\+\_\+\+EQ(\begin{DoxyParamCaption}\item[{}]{l, }\item[{}]{r }\end{DoxyParamCaption})~l == r} \mbox{\Hypertarget{doctest__fwd_8h_a8d05cc6960a068bd84bc215d98112973}\label{doctest__fwd_8h_a8d05cc6960a068bd84bc215d98112973}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CMP\_GE@{DOCTEST\_CMP\_GE}} \index{DOCTEST\_CMP\_GE@{DOCTEST\_CMP\_GE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CMP\_GE}{DOCTEST\_CMP\_GE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+M\+P\+\_\+\+GE(\begin{DoxyParamCaption}\item[{}]{l, }\item[{}]{r }\end{DoxyParamCaption})~l $>$= r} \mbox{\Hypertarget{doctest__fwd_8h_a6cd6ec78f910453372adbdca54d28e96}\label{doctest__fwd_8h_a6cd6ec78f910453372adbdca54d28e96}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CMP\_GT@{DOCTEST\_CMP\_GT}} \index{DOCTEST\_CMP\_GT@{DOCTEST\_CMP\_GT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CMP\_GT}{DOCTEST\_CMP\_GT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+M\+P\+\_\+\+GT(\begin{DoxyParamCaption}\item[{}]{l, }\item[{}]{r }\end{DoxyParamCaption})~l $>$ r} \mbox{\Hypertarget{doctest__fwd_8h_a324adcbcbb7e31481c2f619a5a0d5a56}\label{doctest__fwd_8h_a324adcbcbb7e31481c2f619a5a0d5a56}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CMP\_LE@{DOCTEST\_CMP\_LE}} \index{DOCTEST\_CMP\_LE@{DOCTEST\_CMP\_LE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CMP\_LE}{DOCTEST\_CMP\_LE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+M\+P\+\_\+\+LE(\begin{DoxyParamCaption}\item[{}]{l, }\item[{}]{r }\end{DoxyParamCaption})~l $<$= r} \mbox{\Hypertarget{doctest__fwd_8h_ad17ac1cc3242c45a461b1364c13cde55}\label{doctest__fwd_8h_ad17ac1cc3242c45a461b1364c13cde55}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CMP\_LT@{DOCTEST\_CMP\_LT}} \index{DOCTEST\_CMP\_LT@{DOCTEST\_CMP\_LT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CMP\_LT}{DOCTEST\_CMP\_LT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+M\+P\+\_\+\+LT(\begin{DoxyParamCaption}\item[{}]{l, }\item[{}]{r }\end{DoxyParamCaption})~l $<$ r} \mbox{\Hypertarget{doctest__fwd_8h_a4848f1d467fb5ef1dae4f31d56b8760a}\label{doctest__fwd_8h_a4848f1d467fb5ef1dae4f31d56b8760a}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CMP\_NE@{DOCTEST\_CMP\_NE}} \index{DOCTEST\_CMP\_NE@{DOCTEST\_CMP\_NE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CMP\_NE}{DOCTEST\_CMP\_NE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+M\+P\+\_\+\+NE(\begin{DoxyParamCaption}\item[{}]{l, }\item[{}]{r }\end{DoxyParamCaption})~l!= r} \mbox{\Hypertarget{doctest__fwd_8h_a4a746a6cb24ff5b89c7b9a86a20335e8}\label{doctest__fwd_8h_a4a746a6cb24ff5b89c7b9a86a20335e8}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_COMPARISON\_RETURN\_TYPE@{DOCTEST\_COMPARISON\_RETURN\_TYPE}} \index{DOCTEST\_COMPARISON\_RETURN\_TYPE@{DOCTEST\_COMPARISON\_RETURN\_TYPE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_COMPARISON\_RETURN\_TYPE}{DOCTEST\_COMPARISON\_RETURN\_TYPE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+O\+M\+P\+A\+R\+I\+S\+O\+N\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+T\+Y\+PE~bool} \mbox{\Hypertarget{doctest__fwd_8h_a04223c76a58ee7c4f865afb6d57d048f}\label{doctest__fwd_8h_a04223c76a58ee7c4f865afb6d57d048f}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_COMPILER@{DOCTEST\_COMPILER}} \index{DOCTEST\_COMPILER@{DOCTEST\_COMPILER}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_COMPILER}{DOCTEST\_COMPILER}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+O\+M\+P\+I\+L\+ER(\begin{DoxyParamCaption}\item[{}]{M\+A\+J\+OR, }\item[{}]{M\+I\+N\+OR, }\item[{}]{P\+A\+T\+CH }\end{DoxyParamCaption})~((M\+A\+J\+OR)$\ast$10000000 + (M\+I\+N\+OR)$\ast$100000 + (P\+A\+T\+CH))} Definition at line 60 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a8d99d050db88cb183c1d02bba4e798b0}\label{doctest__fwd_8h_a8d99d050db88cb183c1d02bba4e798b0}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CONFIG\_NO\_EXCEPTIONS@{DOCTEST\_CONFIG\_NO\_EXCEPTIONS}} \index{DOCTEST\_CONFIG\_NO\_EXCEPTIONS@{DOCTEST\_CONFIG\_NO\_EXCEPTIONS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CONFIG\_NO\_EXCEPTIONS}{DOCTEST\_CONFIG\_NO\_EXCEPTIONS}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+O\+N\+F\+I\+G\+\_\+\+N\+O\+\_\+\+E\+X\+C\+E\+P\+T\+I\+O\+NS} \mbox{\Hypertarget{doctest__fwd_8h_a631e7295c7abd3a071464fae6be07250}\label{doctest__fwd_8h_a631e7295c7abd3a071464fae6be07250}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CONFIG\_NO\_TRY\_CATCH\_IN\_ASSERTS@{DOCTEST\_CONFIG\_NO\_TRY\_CATCH\_IN\_ASSERTS}} \index{DOCTEST\_CONFIG\_NO\_TRY\_CATCH\_IN\_ASSERTS@{DOCTEST\_CONFIG\_NO\_TRY\_CATCH\_IN\_ASSERTS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CONFIG\_NO\_TRY\_CATCH\_IN\_ASSERTS}{DOCTEST\_CONFIG\_NO\_TRY\_CATCH\_IN\_ASSERTS}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+O\+N\+F\+I\+G\+\_\+\+N\+O\+\_\+\+T\+R\+Y\+\_\+\+C\+A\+T\+C\+H\+\_\+\+I\+N\+\_\+\+A\+S\+S\+E\+R\+TS} \mbox{\Hypertarget{doctest__fwd_8h_a03d1f35ae32484c0778dc0130e41de35}\label{doctest__fwd_8h_a03d1f35ae32484c0778dc0130e41de35}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CONFIG\_POSIX\_SIGNALS@{DOCTEST\_CONFIG\_POSIX\_SIGNALS}} \index{DOCTEST\_CONFIG\_POSIX\_SIGNALS@{DOCTEST\_CONFIG\_POSIX\_SIGNALS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CONFIG\_POSIX\_SIGNALS}{DOCTEST\_CONFIG\_POSIX\_SIGNALS}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+O\+N\+F\+I\+G\+\_\+\+P\+O\+S\+I\+X\+\_\+\+S\+I\+G\+N\+A\+LS} \mbox{\Hypertarget{doctest__fwd_8h_acc08da2add47137024ca50062129be4b}\label{doctest__fwd_8h_acc08da2add47137024ca50062129be4b}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION@{DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION}} \index{DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION@{DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION}{DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+R\+E\+A\+T\+E\+\_\+\+A\+N\+D\+\_\+\+R\+E\+G\+I\+S\+T\+E\+R\+\_\+\+F\+U\+N\+C\+T\+I\+ON(\begin{DoxyParamCaption}\item[{}]{f, }\item[{}]{decorators }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keyword}{static} \textcolor{keywordtype}{void} f(); \(\backslash\)} \DoxyCodeLine{ DOCTEST\_REGISTER\_FUNCTION(\mbox{\hyperlink{doctest__fwd_8h_ab46a6d1a6d00f0bda5fcf8b93966a20a}{DOCTEST\_EMPTY}}, f, decorators) \(\backslash\)} \DoxyCodeLine{ static \textcolor{keywordtype}{void} f()} \end{DoxyCode} Definition at line 1826 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a4e084d2cf8ff31bcd011a8291a3d2afd}\label{doctest__fwd_8h_a4e084d2cf8ff31bcd011a8291a3d2afd}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION\_IN\_CLASS@{DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION\_IN\_CLASS}} \index{DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION\_IN\_CLASS@{DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION\_IN\_CLASS}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION\_IN\_CLASS}{DOCTEST\_CREATE\_AND\_REGISTER\_FUNCTION\_IN\_CLASS}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+R\+E\+A\+T\+E\+\_\+\+A\+N\+D\+\_\+\+R\+E\+G\+I\+S\+T\+E\+R\+\_\+\+F\+U\+N\+C\+T\+I\+O\+N\+\_\+\+I\+N\+\_\+\+C\+L\+A\+SS(\begin{DoxyParamCaption}\item[{}]{f, }\item[{}]{proxy, }\item[{}]{decorators }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keyword}{static} \mbox{\hyperlink{namespacedoctest_1_1detail_a18864cbacb31064865de0c5bc24b08c0}{doctest::detail::funcType}} proxy() \{ \textcolor{keywordflow}{return} f; \} \(\backslash\)} \DoxyCodeLine{ DOCTEST\_REGISTER\_FUNCTION(\textcolor{keyword}{inline} \textcolor{keyword}{const}, proxy(), decorators) \(\backslash\)} \DoxyCodeLine{ static \textcolor{keywordtype}{void} f()} \end{DoxyCode} Definition at line 1831 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a70e5d466aeb2ec395124cd6366b08499}\label{doctest__fwd_8h_a70e5d466aeb2ec395124cd6366b08499}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_DEFINE\_DECORATOR@{DOCTEST\_DEFINE\_DECORATOR}} \index{DOCTEST\_DEFINE\_DECORATOR@{DOCTEST\_DEFINE\_DECORATOR}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_DEFINE\_DECORATOR}{DOCTEST\_DEFINE\_DECORATOR}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+D\+E\+F\+I\+N\+E\+\_\+\+D\+E\+C\+O\+R\+A\+T\+OR(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}}, }\item[{}]{\mbox{\hyperlink{doctest_8cpp_a75b160f574a0be26114bae2c7686a5e1}{type}}, }\item[{}]{def }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keyword}{struct }\mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}} \(\backslash\)} \DoxyCodeLine{ \{ \(\backslash\)} \DoxyCodeLine{ type data; \(\backslash\)} \DoxyCodeLine{ name(\mbox{\hyperlink{doctest_8cpp_a75b160f574a0be26114bae2c7686a5e1}{type}} in = def) \(\backslash\)} \DoxyCodeLine{ : data(in) \{\} \(\backslash\)} \DoxyCodeLine{ void fill(\mbox{\hyperlink{namespacedoctest_1_1detail_ade1619b532a3d3e6f19ee1187ff3c514}{detail::TestCase}}\& state)\textcolor{keyword}{ const }\{ state.DOCTEST\_CAT(m\_, \mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}}) = data; \} \(\backslash\)} \DoxyCodeLine{ void fill(detail::TestSuite\& state)\textcolor{keyword}{ const }\{ state.DOCTEST\_CAT(m\_, \mbox{\hyperlink{doctest_8cpp_a9b45b3e13bd9167aab02e17e08916231}{name}}) = data; \} \(\backslash\)} \DoxyCodeLine{ \}} \end{DoxyCode} Definition at line 1582 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a924a81d1115ba1ad170b51800e46d3cf}\label{doctest__fwd_8h_a924a81d1115ba1ad170b51800e46d3cf}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_DO\_BINARY\_EXPRESSION\_COMPARISON@{DOCTEST\_DO\_BINARY\_EXPRESSION\_COMPARISON}} \index{DOCTEST\_DO\_BINARY\_EXPRESSION\_COMPARISON@{DOCTEST\_DO\_BINARY\_EXPRESSION\_COMPARISON}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_DO\_BINARY\_EXPRESSION\_COMPARISON}{DOCTEST\_DO\_BINARY\_EXPRESSION\_COMPARISON}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+D\+O\+\_\+\+B\+I\+N\+A\+R\+Y\+\_\+\+E\+X\+P\+R\+E\+S\+S\+I\+O\+N\+\_\+\+C\+O\+M\+P\+A\+R\+I\+S\+ON(\begin{DoxyParamCaption}\item[{}]{op, }\item[{}]{op\+\_\+str, }\item[{}]{op\+\_\+macro }\end{DoxyParamCaption})} {\bfseries Value\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ \textcolor{keyword}{template} <\textcolor{keyword}{typename} R> \(\backslash\)} \DoxyCodeLine{ DOCTEST\_NOINLINE Result \textcolor{keyword}{operator} op(\textcolor{keyword}{const} \mbox{\hyperlink{doctest__fwd_8h_af2901cafb023c57fb672ccb1bf14f2eb}{DOCTEST\_REF\_WRAP}}(R) rhs) \{ \(\backslash\)} \DoxyCodeLine{ bool res = op\_macro(lhs, rhs); \(\backslash\)} \DoxyCodeLine{ if(m\_at \& \mbox{\hyperlink{namespacedoctest_1_1assert_type_ae1bb5bed722f34f1c38b83cb19d326d3a812e83ede566e134017f41d5c72b2ac5}{assertType::is\_false}}) \(\backslash\)} \DoxyCodeLine{ res =!res; \(\backslash\)} \DoxyCodeLine{ if(!res || \mbox{\hyperlink{namespacedoctest_a426c38f4b2561bf6cfb10a370bddc3da}{doctest::getContextOptions}}()-\/>success) \(\backslash\)} \DoxyCodeLine{ return Result(res, \mbox{\hyperlink{namespacedoctest_1_1detail_a6879a79aea397a22e296e4afd0a90e3b}{stringifyBinaryExpr}}(lhs, op\_str, rhs)); \(\backslash\)} \DoxyCodeLine{ return Result(res); \(\backslash\)} \DoxyCodeLine{ \}} \end{DoxyCode} Definition at line 1048 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ab46a6d1a6d00f0bda5fcf8b93966a20a}\label{doctest__fwd_8h_ab46a6d1a6d00f0bda5fcf8b93966a20a}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_EMPTY@{DOCTEST\_EMPTY}} \index{DOCTEST\_EMPTY@{DOCTEST\_EMPTY}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_EMPTY}{DOCTEST\_EMPTY}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+E\+M\+P\+TY} \mbox{\Hypertarget{doctest__fwd_8h_a992b3865a0604856760b211fa5ba57c9}\label{doctest__fwd_8h_a992b3865a0604856760b211fa5ba57c9}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAIL@{DOCTEST\_FAIL}} \index{DOCTEST\_FAIL@{DOCTEST\_FAIL}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAIL}{DOCTEST\_FAIL}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+IL(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_ab9997c8323295559d5bd9275a59d3873}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+F\+A\+I\+L\+\_\+\+AT}}(\+\_\+\+\_\+\+F\+I\+L\+E\+\_\+\+\_\+, \+\_\+\+\_\+\+L\+I\+N\+E\+\_\+\+\_\+, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2020 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a90bd92692a93b4e8c7c32e91d5078212}\label{doctest__fwd_8h_a90bd92692a93b4e8c7c32e91d5078212}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAIL\_CHECK@{DOCTEST\_FAIL\_CHECK}} \index{DOCTEST\_FAIL\_CHECK@{DOCTEST\_FAIL\_CHECK}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAIL\_CHECK}{DOCTEST\_FAIL\_CHECK}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+I\+L\+\_\+\+C\+H\+E\+CK(\begin{DoxyParamCaption}\item[{}]{... }\end{DoxyParamCaption})~\mbox{\hyperlink{doctest__fwd_8h_a903e2a8556f8177e0015df1425a47de0}{D\+O\+C\+T\+E\+S\+T\+\_\+\+A\+D\+D\+\_\+\+F\+A\+I\+L\+\_\+\+C\+H\+E\+C\+K\+\_\+\+AT}}(\+\_\+\+\_\+\+F\+I\+L\+E\+\_\+\+\_\+, \+\_\+\+\_\+\+L\+I\+N\+E\+\_\+\+\_\+, \+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)} Definition at line 2019 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ab4a30ae5781ec52a8651c7cb695fb266}\label{doctest__fwd_8h_ab4a30ae5781ec52a8651c7cb695fb266}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_CHECK\_EQ@{DOCTEST\_FAST\_CHECK\_EQ}} \index{DOCTEST\_FAST\_CHECK\_EQ@{DOCTEST\_FAST\_CHECK\_EQ}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_CHECK\_EQ}{DOCTEST\_FAST\_CHECK\_EQ}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+EQ~\mbox{\hyperlink{doctest__fwd_8h_a2ac8b5624c3b8d9520c75a68634cb8c1}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+EQ}}} Definition at line 2448 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a1ae0024144fb0081522e3778e2f3fe77}\label{doctest__fwd_8h_a1ae0024144fb0081522e3778e2f3fe77}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_CHECK\_GE@{DOCTEST\_FAST\_CHECK\_GE}} \index{DOCTEST\_FAST\_CHECK\_GE@{DOCTEST\_FAST\_CHECK\_GE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_CHECK\_GE}{DOCTEST\_FAST\_CHECK\_GE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+GE~\mbox{\hyperlink{doctest__fwd_8h_a296f8caf3497fbc9433d2e77691b0b3e}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+GE}}} Definition at line 2460 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_aad48a1ad33a37268303363fe3285bb2c}\label{doctest__fwd_8h_aad48a1ad33a37268303363fe3285bb2c}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_CHECK\_GT@{DOCTEST\_FAST\_CHECK\_GT}} \index{DOCTEST\_FAST\_CHECK\_GT@{DOCTEST\_FAST\_CHECK\_GT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_CHECK\_GT}{DOCTEST\_FAST\_CHECK\_GT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+GT~\mbox{\hyperlink{doctest__fwd_8h_a8d3a9781fd7a67021ec12e0aea024ed6}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+GT}}} Definition at line 2454 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a4eaef3b35d06f2cd9a1b38ef4b8aa137}\label{doctest__fwd_8h_a4eaef3b35d06f2cd9a1b38ef4b8aa137}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_CHECK\_LE@{DOCTEST\_FAST\_CHECK\_LE}} \index{DOCTEST\_FAST\_CHECK\_LE@{DOCTEST\_FAST\_CHECK\_LE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_CHECK\_LE}{DOCTEST\_FAST\_CHECK\_LE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+LE~\mbox{\hyperlink{doctest__fwd_8h_a25823108f6fed8787303bbad7c619f35}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+LE}}} Definition at line 2463 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a2b5cbb281f86f22f30ca08e453ecb7f3}\label{doctest__fwd_8h_a2b5cbb281f86f22f30ca08e453ecb7f3}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_CHECK\_LT@{DOCTEST\_FAST\_CHECK\_LT}} \index{DOCTEST\_FAST\_CHECK\_LT@{DOCTEST\_FAST\_CHECK\_LT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_CHECK\_LT}{DOCTEST\_FAST\_CHECK\_LT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+LT~\mbox{\hyperlink{doctest__fwd_8h_a4e1d83dffb779a2829552c4fefbb516a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+LT}}} Definition at line 2457 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_aef35956b9f6316059552577b28b63b76}\label{doctest__fwd_8h_aef35956b9f6316059552577b28b63b76}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_CHECK\_NE@{DOCTEST\_FAST\_CHECK\_NE}} \index{DOCTEST\_FAST\_CHECK\_NE@{DOCTEST\_FAST\_CHECK\_NE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_CHECK\_NE}{DOCTEST\_FAST\_CHECK\_NE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+NE~\mbox{\hyperlink{doctest__fwd_8h_afe1e20e7078d65704c6b2f4e55bbfc03}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+NE}}} Definition at line 2451 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_aef39710e57f05a74423ef552b9756a29}\label{doctest__fwd_8h_aef39710e57f05a74423ef552b9756a29}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_CHECK\_UNARY@{DOCTEST\_FAST\_CHECK\_UNARY}} \index{DOCTEST\_FAST\_CHECK\_UNARY@{DOCTEST\_FAST\_CHECK\_UNARY}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_CHECK\_UNARY}{DOCTEST\_FAST\_CHECK\_UNARY}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+RY~\mbox{\hyperlink{doctest__fwd_8h_a660ce2901f42d4d2a82327204a6a3602}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+RY}}} Definition at line 2467 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a4d91d1f535ad191f829bc3cf81b967eb}\label{doctest__fwd_8h_a4d91d1f535ad191f829bc3cf81b967eb}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_CHECK\_UNARY\_FALSE@{DOCTEST\_FAST\_CHECK\_UNARY\_FALSE}} \index{DOCTEST\_FAST\_CHECK\_UNARY\_FALSE@{DOCTEST\_FAST\_CHECK\_UNARY\_FALSE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_CHECK\_UNARY\_FALSE}{DOCTEST\_FAST\_CHECK\_UNARY\_FALSE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+R\+Y\+\_\+\+F\+A\+L\+SE~\mbox{\hyperlink{doctest__fwd_8h_a9ff04e98b0891f79528c180a4e7d6d36}{D\+O\+C\+T\+E\+S\+T\+\_\+\+C\+H\+E\+C\+K\+\_\+\+U\+N\+A\+R\+Y\+\_\+\+F\+A\+L\+SE}}} Definition at line 2470 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_aa25a354bc0f83e31ec1184eff29ec0d9}\label{doctest__fwd_8h_aa25a354bc0f83e31ec1184eff29ec0d9}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_REQUIRE\_EQ@{DOCTEST\_FAST\_REQUIRE\_EQ}} \index{DOCTEST\_FAST\_REQUIRE\_EQ@{DOCTEST\_FAST\_REQUIRE\_EQ}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_REQUIRE\_EQ}{DOCTEST\_FAST\_REQUIRE\_EQ}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+EQ~\mbox{\hyperlink{doctest__fwd_8h_a8820dcb94345362c2fd94aea26a3eabc}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+EQ}}} Definition at line 2449 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a2b6364c039a90a1b8519af193027c3a4}\label{doctest__fwd_8h_a2b6364c039a90a1b8519af193027c3a4}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_REQUIRE\_GE@{DOCTEST\_FAST\_REQUIRE\_GE}} \index{DOCTEST\_FAST\_REQUIRE\_GE@{DOCTEST\_FAST\_REQUIRE\_GE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_REQUIRE\_GE}{DOCTEST\_FAST\_REQUIRE\_GE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+GE~\mbox{\hyperlink{doctest__fwd_8h_ad75b722f83eb3f81662af7fccae74732}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+GE}}} Definition at line 2461 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a74a2b5ebb76b33c7124bf3d5bc200cc6}\label{doctest__fwd_8h_a74a2b5ebb76b33c7124bf3d5bc200cc6}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_REQUIRE\_GT@{DOCTEST\_FAST\_REQUIRE\_GT}} \index{DOCTEST\_FAST\_REQUIRE\_GT@{DOCTEST\_FAST\_REQUIRE\_GT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_REQUIRE\_GT}{DOCTEST\_FAST\_REQUIRE\_GT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+GT~\mbox{\hyperlink{doctest__fwd_8h_a87d30bb902d1bfca7427a9eb51d130eb}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+GT}}} Definition at line 2455 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_ab9fe58a6ab535c836df028567aa68693}\label{doctest__fwd_8h_ab9fe58a6ab535c836df028567aa68693}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_REQUIRE\_LE@{DOCTEST\_FAST\_REQUIRE\_LE}} \index{DOCTEST\_FAST\_REQUIRE\_LE@{DOCTEST\_FAST\_REQUIRE\_LE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_REQUIRE\_LE}{DOCTEST\_FAST\_REQUIRE\_LE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+LE~\mbox{\hyperlink{doctest__fwd_8h_a9101f25bfe135de1e306e3ed342e248a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+LE}}} Definition at line 2464 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a17c6c39d376b0b97b0d883e7ec3fa728}\label{doctest__fwd_8h_a17c6c39d376b0b97b0d883e7ec3fa728}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_REQUIRE\_LT@{DOCTEST\_FAST\_REQUIRE\_LT}} \index{DOCTEST\_FAST\_REQUIRE\_LT@{DOCTEST\_FAST\_REQUIRE\_LT}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_REQUIRE\_LT}{DOCTEST\_FAST\_REQUIRE\_LT}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+LT~\mbox{\hyperlink{doctest__fwd_8h_ab88925759665843f59b14f097213351c}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+LT}}} Definition at line 2458 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a181b3b01fecc87de85f3ce2647f05e9b}\label{doctest__fwd_8h_a181b3b01fecc87de85f3ce2647f05e9b}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_REQUIRE\_NE@{DOCTEST\_FAST\_REQUIRE\_NE}} \index{DOCTEST\_FAST\_REQUIRE\_NE@{DOCTEST\_FAST\_REQUIRE\_NE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_REQUIRE\_NE}{DOCTEST\_FAST\_REQUIRE\_NE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+NE~\mbox{\hyperlink{doctest__fwd_8h_aa34e39b7d59335760ffa1b9fce45cc4b}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+NE}}} Definition at line 2452 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a028cfc971ad12bc510b303622b9bc35f}\label{doctest__fwd_8h_a028cfc971ad12bc510b303622b9bc35f}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_REQUIRE\_UNARY@{DOCTEST\_FAST\_REQUIRE\_UNARY}} \index{DOCTEST\_FAST\_REQUIRE\_UNARY@{DOCTEST\_FAST\_REQUIRE\_UNARY}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_REQUIRE\_UNARY}{DOCTEST\_FAST\_REQUIRE\_UNARY}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+U\+N\+A\+RY~\mbox{\hyperlink{doctest__fwd_8h_a77558db4dc0f1758c756da740b64413a}{D\+O\+C\+T\+E\+S\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+U\+N\+A\+RY}}} Definition at line 2468 of file doctest\+\_\+fwd.\+h. \mbox{\Hypertarget{doctest__fwd_8h_a3c0e9e0c03a62a810aae8e282b807938}\label{doctest__fwd_8h_a3c0e9e0c03a62a810aae8e282b807938}} \index{doctest\_fwd.h@{doctest\_fwd.h}!DOCTEST\_FAST\_REQUIRE\_UNARY\_FALSE@{DOCTEST\_FAST\_REQUIRE\_UNARY\_FALSE}} \index{DOCTEST\_FAST\_REQUIRE\_UNARY\_FALSE@{DOCTEST\_FAST\_REQUIRE\_UNARY\_FALSE}!doctest\_fwd.h@{doctest\_fwd.h}} \doxysubsubsection{\texorpdfstring{DOCTEST\_FAST\_REQUIRE\_UNARY\_FALSE}{DOCTEST\_FAST\_REQUIRE\_UNARY\_FALSE}} {\footnotesize\ttfamily \#define D\+O\+C\+T\+E\+S\+T\+\_\+\+F\+A\+S\+T
71,598
thestackv1_concat_by_repo-long/65536-65536
.InternalPorts { var sslProfile *RouterSslProfile if internalPort.Protocol == v1.MessagingProtocolAMQPS || (internalPort.Protocol == v1.MessagingProtocolAMQPWSS &&!endpoint.IsEdgeTerminated()) { sslProfile = &RouterSslProfile{ Name: sslProfileName(internalPort.Name), CertFile: fmt.Sprintf("/etc/enmasse-project-certs/%s.%s.crt", endpoint.Namespace, endpoint.Name), PrivateKeyFile: fmt.Sprintf("/etc/enmasse-project-certs/%s.%s.key", endpoint.Namespace, endpoint.Name), } if endpoint.Spec.Tls!= nil { if endpoint.Spec.Tls.Protocols!= nil { sslProfile.Protocols = *endpoint.Spec.Tls.Protocols } if endpoint.Spec.Tls.Ciphers!= nil { sslProfile.Ciphers = *endpoint.Spec.Tls.Ciphers } } routerEntities = append(routerEntities, sslProfile) } // TODO separate authhost per endpoint required (so that the service can apply the correct SASL config) - use global one for now authHost := fmt.Sprintf("access-control-%s.%s.svc.cluster.local:5671", i.infrastructureName, i.infrastructureNamespace) //authService := &RouterAuthServicePlugin{ // Host: authHost, // Port: "5671", // Realm: authHost, // SslProfile: "infra_tls", //} websockets := (internalPort.Protocol == v1.MessagingProtocolAMQPWS || internalPort.Protocol == v1.MessagingProtocolAMQPWSS) listener := &RouterListener{ Name: listenerName(internalPort.Name), Host: "0.0.0.0", Port: fmt.Sprintf("%d", internalPort.Port), Role: "normal", RequireSsl: false, AuthenticatePeer: true, IdleTimeoutSeconds: idleTimeoutSeconds, PolicyVhost: endpoint.Namespace, // LinkCapacity: TODO: Make configurable? MultiTenant: true, Websockets: websockets, Http: websockets, Healthz: false, Metrics: false, SaslPlugin: authHost, } if sslProfile!= nil { listener.SslProfile = sslProfile.Name // Do not set require SSL for websockets, due to https://issues.apache.org/jira/browse/DISPATCH-1040 listener.RequireSsl =!websockets } routerEntities = append(routerEntities, listener) } return routerEntities, nil } /** * Add router entities that should exist for a given address for a given endpoint. */ func (i *infraClient) buildRouterAddressEntities(address *v1.MessagingAddress) ([]RouterEntity, error) { // Skip endpoints that are not active or do not have hosts defined routerEntities := make([]RouterEntity, 0) project := i.projects[resourceKey{Name: "default", Namespace: address.Namespace}] projectId := project.Namespace // If transactional, rely on link route to be created if project.Status.Broker!= nil { return routerEntities, nil } // Build desired state addressName := addressName(projectId, address) fullAddress := qualifiedAddress(projectId, address.GetAddress()) if address.Spec.Anycast!= nil { routerEntities = append(routerEntities, &RouterAddress{ Name: addressName, Prefix: fullAddress, Distribution: "balanced", Waypoint: false, }) } else if address.Spec.Multicast!= nil { routerEntities = append(routerEntities, &RouterAddress{ Name: addressName, Prefix: fullAddress, Distribution: "multicast", Waypoint: false, }) } else if address.Spec.Queue!= nil { routerEntities = append(routerEntities, &RouterAddress{ Name: addressName, Prefix: fullAddress, Distribution: "balanced", Waypoint: true, }) for _, broker := range address.Status.Brokers { host := i.hostMap[broker.Host] brokerState := i.brokers[host] if brokerState == nil { return nil, fmt.Errorf("unable to configure address autoLink (project %s address %s) for unknown broker %s", projectId, address.GetAddress(), broker.Host) } connector := connectorName(brokerState) routerEntities = append(routerEntities, &RouterAutoLink{ Name: autoLinkName(projectId, address, broker.Host, "in"), Address: fullAddress, Direction: "in", Connection: connector, ExternalAddress: fullAddress, }) routerEntities = append(routerEntities, &RouterAutoLink{ Name: autoLinkName(projectId, address, broker.Host, "out"), Address: fullAddress, Direction: "out", Connection: connector, ExternalAddress: fullAddress, }) } } else if address.Spec.DeadLetter!= nil { // Deadletter addresses should be read-only and consumable from all known brokers routerEntities = append(routerEntities, &RouterAddress{ Name: addressName, Prefix: fullAddress, Distribution: "balanced", Waypoint: true, }) for _, brokerState := range i.brokers { connector := connectorName(brokerState) routerEntities = append(routerEntities, &RouterAutoLink{ Name: autoLinkName(projectId, address, brokerState.Host().Hostname, "in"), Address: fullAddress, Direction: "in", Connection: connector, ExternalAddress: fullAddress, }) } } else if address.Spec.Topic!= nil { // Topic addresses are link routed to a single broker, and they can only be present on one broker. However, the following // logic relies on the scheduler to make the decision on which broker they are located. routerEntities = append(routerEntities, &RouterAddress{ Name: addressName, Prefix: fullAddress, Distribution: "balanced", Waypoint: true, }) for _, broker := range address.Status.Brokers { host := i.hostMap[broker.Host] brokerState := i.brokers[host] if brokerState == nil { return nil, fmt.Errorf("unable to configure address linkRoute (project %s address %s) for unknown broker %s", projectId, address.GetAddress(), broker.Host) } connector := connectorName(brokerState) routerEntities = append(routerEntities, &RouterLinkRoute{ Name: linkRouteName(projectId, address, broker.Host, "out"), Prefix: fullAddress, Direction: "out", Connection: connector, }) routerEntities = append(routerEntities, &RouterLinkRoute{ Name: linkRouteName(projectId, address, broker.Host, "in"), Prefix: fullAddress, Direction: "in", Connection: connector, }) } } else if address.Spec.Subscription!= nil { // Subscription addresses are read only and consumable from only the broker where the subscription is scheduled (same as topic). routerEntities = append(routerEntities, &RouterAddress{ Name: addressName, Prefix: fullAddress, Distribution: "balanced", Waypoint: true, }) for _, broker := range address.Status.Brokers { host := i.hostMap[broker.Host] brokerState := i.brokers[host] if brokerState == nil { return nil, fmt.Errorf("unable to configure address autoLink (project %s address %s) for unknown broker %s", projectId, address.GetAddress(), broker.Host) } connector := connectorName(brokerState) routerEntities = append(routerEntities, &RouterAutoLink{ Name: autoLinkName(projectId, address, brokerState.Host().Hostname, "in"), Address: fullAddress, Direction: "in", Connection: connector, ExternalAddress: fmt.Sprintf("%s::%s", qualifiedAddress(projectId, address.Spec.Subscription.Topic), fullAddress), }) } } return routerEntities, nil } /** * Add broker entities to be created for a given addresss */ func (i *infraClient) buildBrokerAddressEntities(address *v1.MessagingAddress) (map[Host][]BrokerEntity, error) { brokerEntities := make(map[Host][]BrokerEntity, 0) project := i.projects[resourceKey{Name: "default", Namespace: address.Namespace}] projectId := project.Namespace // Build desired state fullAddress := qualifiedAddress(projectId, address.GetAddress()) if address.Spec.Queue!= nil { for _, broker := range address.Status.Brokers { host := i.hostMap[broker.Host] brokerState := i.brokers[host] if brokerState == nil { return nil, fmt.Errorf("unable to configure queue (project %s address %s) for unknown broker %s", projectId, address.GetAddress(), broker.Host) } if len(brokerEntities[host]) == 0 { brokerEntities[host] = make([]BrokerEntity, 0) } brokerEntities[host] = append(brokerEntities[host], &BrokerAddress{ Name: fullAddress, RoutingType: RoutingTypeAnycast, }) // TODO: Influence setting based on properties and plans brokerEntities[host] = append(brokerEntities[host], &BrokerQueue{ Name: fullAddress, Address: fullAddress, RoutingType: RoutingTypeAnycast, MaxConsumers: -1, Durable: true, PurgeOnNoConsumers: false, AutoCreateAddress: false, }) settings := createDefaultAddressSettings(fullAddress) if address.Spec.Queue.DeadLetterAddress!= "" { settings.DeadLetterAddress = qualifiedAddress(projectId, address.Spec.Queue.DeadLetterAddress) } if address.Spec.Queue.ExpiryAddress!= "" { settings.ExpiryAddress = qualifiedAddress(projectId, address.Spec.Queue.ExpiryAddress) } brokerEntities[host] = append(brokerEntities[host], settings) } } else if address.Spec.DeadLetter!= nil { for _, brokerState := range i.brokers { host := brokerState.Host() if len(brokerEntities[host]) == 0 { brokerEntities[host] = make([]BrokerEntity, 0) } brokerEntities[host] = append(brokerEntities[host], &BrokerAddress{ Name: fullAddress, RoutingType: RoutingTypeAnycast, }) brokerEntities[host] = append(brokerEntities[host], &BrokerQueue{ Name: fullAddress, Address: fullAddress, RoutingType: RoutingTypeAnycast, MaxConsumers: -1, Durable: true, PurgeOnNoConsumers: false, AutoCreateAddress: false, }) } } else if address.Spec.Topic!= nil { // TODO: Influence setting based on properties and plans for _, broker := range address.Status.Brokers { host := i.hostMap[broker.Host] brokerState := i.brokers[host] if brokerState == nil { return nil, fmt.Errorf("unable to configure topic (project %s address %s) for unknown broker %s", projectId, address.GetAddress(), broker.Host) } if len(brokerEntities[host]) == 0 { brokerEntities[host] = make([]BrokerEntity, 0) } brokerEntities[host] = append(brokerEntities[host], &BrokerAddress{ Name: fullAddress, RoutingType: RoutingTypeMulticast, }) } } else if address.Spec.Subscription!= nil { // TODO: Influence setting based on properties and plans for _, broker := range address.Status.Brokers { host := i.hostMap[broker.Host] brokerState := i.brokers[host] if brokerState == nil { return nil, fmt.Errorf("unable to configure subscription (project %s address %s) for unknown broker %s", projectId, address.GetAddress(), broker.Host) } if len(brokerEntities[host]) == 0 { brokerEntities[host] = make([]BrokerEntity, 0) } brokerEntities[host] = append(brokerEntities[host], &BrokerQueue{ Name: fullAddress, Address: qualifiedAddress(projectId, address.Spec.Subscription.Topic), RoutingType: RoutingTypeMulticast, MaxConsumers: 1, Durable: true, PurgeOnNoConsumers: false, AutoCreateAddress: false, }) } } return brokerEntities, nil } func (i *infraClient) Shutdown() error { i.lock.Lock() defer i.lock.Unlock() i.syncerStop <- true <-i.syncerStopped i.deleterStop <- true <-i.deleterStopped for _, router := range i.routers { router.Shutdown() } for _, broker := range i.brokers { broker.Shutdown() } return nil } func (i *infraClient) DeleteEndpoint(endpoint *v1.MessagingEndpoint) error { log.Info(fmt.Sprintf("Deleting endpoint %s/%s", endpoint.Namespace, endpoint.Name)) req := &request{ resource: endpoint, done: make(chan error, 1), } select { case i.deleteRequests <- req: return <-req.done default: close(req.done) return NotDeletedError } } func (i *infraClient) DeleteAddress(address *v1.MessagingAddress) error { log.Info(fmt.Sprintf("Deleting address %s/%s", address.Namespace, address.Name)) req := &request{ resource: address, done: make(chan error, 1), } select { case i.deleteRequests <- req: return <-req.done default: close(req.done) return NotDeletedError } } func (i *infraClient) DeleteProject(project *v1.MessagingProject) error { log.Info(fmt.Sprintf("Deleting project %s/%s", project.Namespace, project.Name)) req := &request{ resource: project, done: make(chan error, 1), } select { case i.deleteRequests <- req: return <-req.done default: close(req.done) return NotDeletedError } } func (i *infraClient) doDelete() { toDelete := i.collectRequests(i.deleteRequests) if len(toDelete) == 0 { return } log.Info(fmt.Sprintf("Going to delete %d resources in infra", len(toDelete))) i.lock.Lock() defer i.lock.Unlock() if!i.initialized { for _, req := range toDelete { req.done <- NotInitializedError } return } checkDelete := func(resource metav1.Object) error { var err error for key, _ := range i.addresses { if resource.GetNamespace() == key.Namespace { err = ResourceInUseError break } } return err } valid := make([]*request, 0, len(toDelete)) for _, req := range toDelete { switch req.resource.(type) { case *v1.MessagingProject: err := checkDelete(req.resource) if err!= nil { req.done <- err continue } valid = append(valid, req) default: valid = append(valid, req) } } builtRequests, routerEntities, brokerEntities := i.buildEntities(valid) ctx := context.Background() err := i.deleteEntities(ctx, routerEntities, brokerEntities) for _, req := range builtRequests { key := resourceKey{Name: req.resource.GetName(), Namespace: req.resource.GetNamespace()} switch v := req.resource.(type) { case *v1.MessagingAddress: if err == nil { delete(i.addresses, key) log.Info(fmt.Sprintf("Deleted address %s/%s", key.Namespace, key.Name)) } req.done <- err case *v1.MessagingEndpoint: endpoint := v if err == nil { i.freePortsInternal(endpoint) delete(i.endpoints, key) log.Info(fmt.Sprintf("Deleted endpoint %s/%s", endpoint.Namespace, endpoint.Name)) } req.done <- err case *v1.MessagingProject: if err == nil { delete(i.projects, key) log.Info(fmt.Sprintf("Deleted project %s/%s", key.Namespace, key.Name)) } req.done <- err default: req.done <- fmt.Errorf("unknown resource type %T", v) } log.Info(fmt.Sprintf("State updated to (err %+v) for %s/%s", err, key.Namespace, key.Name)) } } func (i *infraClient) deleteEntities(ctx context.Context, routerEntities []RouterEntity, brokerEntities map[Host][]BrokerEntity) error { // Delete from routers err := i.applyRouters(ctx, func(router *RouterState) error { return router.DeleteEntities(ctx, routerEntities) }) if err!= nil { return err } // Delete from brokers return i.applyBrokers(ctx, func(brokerState *BrokerState) error { return brokerState.DeleteEntities(ctx, brokerEntities[brokerState.Host()]) }) } func connectorToStatus(host string, connector *RouterConnector) ConnectorStatus { return ConnectorStatus{ Router: host, Broker: connector.Host, Connected: connector.ConnectionStatus == "SUCCESS", Message: connector.ConnectionMsg, } } /** * Collect up to maxBatchSize requests from a channel or until 5 seconds without incoming requests has passed. */ func (i *infraClient) collectRequests(c chan *request) []*request { timeout := 1 * time.Second requests := make([]*request, 0, maxBatchSize) for { select { case r := <-c: requests = append(requests, r) if len(requests) >= maxBatchSize { return requests } // If we would block and have gathered some requests, then return whatever we have, if we have requests case <-time.After(timeout): return requests } } } func createDefaultAddressSettings(address string) *BrokerAddressSetting { return &BrokerAddressSetting{ Name: address, ExpiryDelay: -1, DeliveryAttempts: 10, MaxSizeBytes: -1, PageSizeBytes: 10485760, PageMaxCacheSize: 5, RedeliveryDelay: 0, RedeliveryMultiplier: 1.0, MaxRedeliveryDelay: 10000, RedistributionDelay: -1, AddressFullMessagePolicy: AddressFullPolicyFail, SlowConsumerThreshold: -1, SlowConsumerCheckPeriod: -1, SlowConsumerPolicy: SlowConsumerPolicyKill, } } func autoLinkName(projectId string, address *v1.MessagingAddress, host string, direction string) string { return fmt.Sprintf("autoLink-%s-%s-%s-%s", projectId, address.Name, host, direction) } func globalLinkRouteName(projectId string, host string, direction string) string { return fmt.Sprintf("linkRoute-%s-%s-%s", projectId, host, direction) } func linkRouteName(projectId string, address *v1.MessagingAddress, host string, direction string) string { return fmt.Sprintf("linkRoute-%s-%s-%s-%s", projectId, address.Name, host, direction) } func addressName(projectId string, address *v1.MessagingAddress) string { return fmt.Sprintf("address-%s-%s", projectId, address.Name) } func qualifiedAddress(projectId string, address string) string { return fmt.Sprintf("%s/%s", projectId, address) } func connectorName(broker *BrokerState) string { return fmt.Sprintf("connector-%s-%d", broker.Host().Hostname, broker.Port()) } func portName(endpoint *v1.MessagingEndpoint, protocol v1.MessagingEndpointProtocol) string { return fmt.Sprintf("%s-%s-%s", endpoint.Namespace, endpoint.Name, protocol) } func listenerName(portName string) string { return fmt.Sprintf("listener-%s", portName) } func sslProfileName(portName string) string { return fmt.Sprintf("sslProfile-%s", portName) } ======================= File: pkg/state/broker/broker.go ======================= /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package broker import ( "context" "crypto/tls" "encoding/json" "fmt" "time" "github.com/enmasseproject/enmasse/pkg/amqpcommand" . "github.com/enmasseproject/enmasse/pkg/state/common" . "github.com/enmasseproject/enmasse/pkg/state/errors" logf "sigs.k8s.io/controller-runtime/pkg/log" "golang.org/x/sync/errgroup" "pack.ag/amqp" ) var log = logf.Log.WithName("broker") const ( brokerCommandAddress = "activemq.management" brokerCommandResponseAddress = "activemq.management_broker_command_response" maxOrder = 2 ) func NewBrokerState(host Host, port int32, tlsConfig *tls.Config) *BrokerState { opts := make([]amqp.ConnOption, 0) opts = append(opts, amqp.ConnConnectTimeout(10*time.Second)) opts = append(opts, amqp.ConnProperty("product", "controller-manager")) if tlsConfig!= nil { opts = append(opts, amqp.ConnSASLExternal()) opts = append(opts, amqp.ConnTLS(true)) opts = append(opts, amqp.ConnTLSConfig(tlsConfig)) } state := &BrokerState{ host: host, port: port, initialized: false, entities: make(map[BrokerEntityType]map[string]BrokerEntity, 0), commandClient: amqpcommand.NewCommandClient(fmt.Sprintf("amqps://%s:%d", host.Ip, port), brokerCommandAddress, brokerCommandResponseAddress, opts...), } state.commandClient.Start() state.reconnectCount = state.commandClient.ReconnectCount() return state } func NewTestBrokerState(host Host, port int32, client amqpcommand.Client) *BrokerState { return &BrokerState{ host: host, port: port, commandClient: client, entities: make(map[BrokerEntityType]map[string]BrokerEntity, 0), } } func (b *BrokerState) Initialize(nextResync time.Time) error { if b.reconnectCount!= b.commandClient.ReconnectCount() { b.initialized = false } if b.initialized { return nil } b.nextResync = nextResync log.Info(fmt.Sprintf("[Broker %s] Initializing...", b.host)) b.reconnectCount = b.commandClient.ReconnectCount() totalEntities := 0 entityTypes := []BrokerEntityType{BrokerQueueEntity, BrokerAddressEntity, BrokerDivertEntity, BrokerAddressSettingEntity} for _, t := range entityTypes { list, err := b.readEntities(t) if err!= nil { return err } b.entities[t] = list totalEntities += len(list) } log.Info(fmt.Sprintf("[Broker %s] Initialized controller state with %d entities", b.host, totalEntities)) b.initialized = true return nil } func (b *BrokerState) Host() Host { return b.host } func (b *BrokerState) Port() int32 { return b.port } func (b *BrokerState) NextResync() time.Time { return b.nextResync } /** * Perform management request against this broker. */ func doRequest(client amqpcommand.Client, request *amqp.Message) (*amqp.Message, error) { // If by chance we got disconnected while waiting for the request response, err := client.RequestWithTimeout(request, 10*time.Second) return response, err } func (b *BrokerState) readEntities(t BrokerEntityType) (map[string]BrokerEntity, error) { switch t { case BrokerQueueEntity: message, err := newManagementMessage("broker", "getQueueNames", "") if err!= nil { return nil, err } result, err := doRequest(b.commandClient, message) if err!= nil { return nil, err } if!success(result) { return nil, fmt.Errorf("error reading queues: %+v", result.Value) } switch v := result.Value.(type) { case string: entities := make(map[string]BrokerEntity, 0) var list [][]string err := json.Unmarshal([]byte(result.Value.(string)), &list) if err!= nil { return nil, err } for _, entry := range list { for _, name := range entry { entities[name] = &BrokerQueue{ Name: name, } } } log.Info(fmt.Sprintf("[broker %s] Found queues: %+v", b.host, entities)) return entities, nil default: return nil, fmt.Errorf("unexpected value with type %T", v) } case BrokerAddressEntity: message, err := newManagementMessage("broker", "getAddressNames", "") if err!= nil { return nil, err } result, err := doRequest(b.commandClient, message) if err!= nil { return nil, err } if!success(result) { return nil, fmt.Errorf("error reading addresses: %+v", result.Value) } switch v := result.Value.(type) { case string: entities := make(map[string]BrokerEntity, 0) var list [][]string err := json.Unmarshal([]byte(result.Value.(string)), &list) if err!= nil { return nil, err } for _, entry := range list { for _, name := range entry { entities[name] = &BrokerAddress{ Name: name, } } } log.Info(fmt.Sprintf("[broker %s] Found addresses: %+v", b.host, entities)) return entities, nil default: return nil, fmt.Errorf("unexpected value with type %T", v) } case BrokerDivertEntity: message, err := newManagementMessage("broker", "getDivertNames", "") if err!= nil { return nil, err } result, err := doRequest(b.commandClient, message) if err!= nil { return nil, err } if!success(result) { return nil, fmt.Errorf("error reading diverts: %+v", result.Value) } switch v := result.Value.(type) { case string: entities := make(map[string]BrokerEntity, 0) var list [][]string err := json.Unmarshal([]byte(result.Value.(string)), &list) if err!= nil { return nil, err } for _, entry := range list { for _, name := range entry { entities[name] = &BrokerDivert{ Name: name, } } } log.Info(fmt.Sprintf("[broker %s] Found diverts: %+v", b.host, entities)) return entities, nil default: return nil, fmt.Errorf("unexpected value with type %T", v) } case BrokerAddressSettingEntity: entities := make(map[string]BrokerEntity, 0) for name, _ := range b.entities[BrokerQueueEntity] { message, err := newManagementMessage("broker", "getAddressSettingsAsJSON", "", name) if err!= nil { return nil, err } result, err := doRequest(b.commandClient, message) if err!= nil { return nil, err } if!success(result) { return nil, fmt.Errorf("error reading address setting: %+v", result.Value) } switch v := result.Value.(type) { case string: var entry []string err := json.Unmarshal([]byte(v), &entry) if err!= nil { return nil, err } for _, e := range entry { var setting BrokerAddressSetting err := json.Unmarshal([]byte(e), &setting) if err!= nil { return nil, err } setting.Name = name entities[name] = &setting } default: return nil, fmt.Errorf("unexpected value with type %T", v) } } log.Info(fmt.Sprintf("[broker %s] Found address settings: %+v", b.host, entities)) return entities, nil default: return nil, fmt.Errorf("Unsupported entity type %s", t) } } func (b *BrokerState) EnsureEntities(ctx context.Context, entities []BrokerEntity) error { if!b.initialized { return NotInitializedError } toCreate := make([]BrokerEntity, 0, len(entities)) for _, entity := range entities { typeMap := b.entities[entity.Type()] existing, ok := typeMap[entity.GetName()] if ok { if!existing.Equals(entity) { log.Info(fmt.Sprintf("Changing from '%+v' to '%+v'\n", existing, entity)) return fmt.Errorf("broker entity %s %s was updated - updates are not supported", entity.Type(), existing.GetName()) } } else { toCreate = append(toCreate, entity) } } completed := make(chan BrokerEntity, len(toCreate)) var err error for order := 0; order < maxOrder; order++ { g, _ := errgroup.WithContext(ctx) for _, entity := range toCreate { e := entity if e.Order() == order { if _, ok := b.entities[e.Type()][e.GetName()];!ok { g.Go(func() error { err := e.Create(b.commandClient) if err!= nil { return err } completed <- e return nil }) } } } err = g.Wait() if err!= nil { break } } close(completed) if isConnectionError(err) { b.Reset() } if err!= nil { log.Info(fmt.Sprintf("[Broker %s] EnsureQueues error: %+v", b.host, err)) } for entity := range completed { b.entities[entity.Type()][entity.GetName()] = entity } return err } func (b *BrokerState) DeleteEntities(ctx context.Context, entities []BrokerEntity) error { if!b.initialized { return NotInitializedError } completed := make(chan BrokerEntity, len(entities)) var err error for order := maxOrder - 1; order >= 0; order-- { g, _ := errgroup.WithContext(ctx) for _, entity := range entities { e := entity if e.Order() == order { if _, ok := b.entities[e.Type()][e.GetName()]; ok { g.Go(func() error { err := e.Delete(b.commandClient) if err!= nil { return err } completed <- e return nil }) } } } err = g.Wait() if err!= nil { break } } close(completed) if isConnectionError(err) { b.Reset() } if err!= nil { log.Info(fmt.Sprintf("[Broker %s] DeleteEntities error: %+v", b.host, err)) } for entity := range completed { delete(b.entities[entity.Type()], entity.GetName()) } return err } func success(response *amqp.Message) bool { successProp, ok := response.ApplicationProperties["_AMQ_OperationSucceeded"] if!ok { return false } return successProp.(bool) } func newManagementMessage(resource string, operation string, attribute string, parameters...interface{}) (*amqp.Message, error) { properties := make(map[string]interface{}) properties["_AMQ_ResourceName"] = resource if operation!= "" { properties["_AMQ_OperationName"] = operation } if attribute!= "" { properties["_AMQ_Attribute"] = attribute } var value string if len(parameters) > 0 { encoded, err := json.Marshal(parameters) if err!= nil { return nil, err } value = string(encoded) } else { value = "[]" } return &amqp.Message{ Properties: &amqp.MessageProperties{}, ApplicationProperties: properties, Value: value, }, nil } /* * Reset broker state from broker (i.e. drop all internal state and rebuild from actual router state) */ func (b *BrokerState) Reset() { if b.commandClient!= nil && b.initialized { log.Info(fmt.Sprintf("[Broker %s] Resetting connection", b.host)) b.commandClient.Stop() b.initialized = false b.commandClient.Start() } } func isConnectionError(err error) bool { // TODO: Handle errors that are not strictly connection-related potentially with retries return err!= nil } func (b *BrokerState) Shutdown() { if b.commandClient!= nil { b.commandClient.Stop() } } func (b *BrokerQueue) Type() BrokerEntityType { return BrokerQueueEntity } func (b *BrokerQueue) GetName() string { return b.Name } func (b *BrokerQueue) Order() int { return 1 } // Updates not allowed for queues: they are the same if they have the same type and name. func (b *BrokerQueue) Equals(other BrokerEntity) bool { return b.Type() == other.Type() && b.Name == other.GetName() } func (b *BrokerQueue) Create(client amqpcommand.Client) error { config, err := json.Marshal(b) if err!= nil { return err } log.Info(fmt.Sprintf("[Broker %s] creating queue json: '%s'", client.Addr(), string(config))) message, err := newManagementMessage("broker", "createQueue", "", string(config)) if err!= nil { return err } log.Info(fmt.Sprintf("Creating queue %s on %s: %+v", b.Name, client.Addr(), message)) response, err := doRequest(client, message) if err!= nil { return err } if!success(response) { return fmt.Errorf("error creating queue %s: %+v", b.Name, response.Value) } log.Info(fmt.Sprintf("Queue %s created successfully on %s", b.Name, client.Addr())) return nil } func (b *BrokerQueue) Delete(client amqpcommand.Client) error { message, err := newManagementMessage("broker", "destroyQueue", "", b.Name, true) if err!= nil { return err } log.Info(fmt.Sprintf("Destroying queue %s on %s", b.Name, client.Addr())) response, err := doRequest(client, message) if err!= nil { return err } if!success(response) { return fmt.Errorf("error deleting queue %s: %+v", b.Name, response.Value) } log.Info(fmt.Sprintf("Queue %s destroyed successfully on %s", b.Name, client.Addr())) return nil } func (b *BrokerAddress) Type() BrokerEntityType { return BrokerAddressEntity } func (b *BrokerAddress) GetName() string { return b.Name } func (b *BrokerAddress) Order() int { return 0 } // Updates not allowed for addresses: they are the same if they have the same type and name. func (b *BrokerAddress) Equals(other BrokerEntity) bool { return b.Type() == other.Type() && b.Name == other.GetName() } func (b *BrokerAddress) Create(client amqpcommand.Client) error { log.Info(fmt.Sprintf("[Broker %s] creating address: '%s'", client.Addr(), b.Name)) message, err := newManagementMessage("broker", "createAddress", "", b.Name, b.RoutingType) if err!= nil { return err } log.Info(fmt.Sprintf("Creating address %s on %s: %+v", b.Name, client.Addr(), message)) response, err := doRequest(client, message) if err!= nil { return err } if!success(response) { return fmt.Errorf("error creating address %s: %+v", b.Name, response.Value) } log.Info(fmt.Sprintf("Address %s created successfully on %s", b.Name, client.Addr())) return nil } func (b *BrokerAddress) Delete(client amqpcommand.Client) error { message, err := newManagementMessage("broker", "deleteAddress", "", b.Name, true) if err!= nil { return err } log.Info(fmt.Sprintf("Deleting address %s on %s", b.Name, client.Addr())) response, err := doRequest(client, message) if err!= nil { return err } if!success(response) { return fmt.Errorf("error deleting address %s: %+v", b.Name, response.Value) } log.Info(fmt.Sprintf("Address %s deleted successfully on %s", b.Name, client.Addr())) return nil } /** * Broker Diverts */ func (b *BrokerDivert) Type() BrokerEntityType { return BrokerDivertEntity } func (b *BrokerDivert) GetName() string { return b.Name } func (b *BrokerDivert) Order() int { return 0 } // Updates not allowed for addresses: they are the same if they have the same type and name. func (b *BrokerDivert) Equals(other BrokerEntity) bool { return b.Type() == other.Type() && b.Name == other.GetName() } func (b *BrokerDivert) Create(client amqpcommand.Client) error { log.Info(fmt.Sprintf("[Broker %s] creating divert: '%s'", client.Addr(), b.Name)) message, err := newManagementMessage("broker", "createDivert", "", b.Name, b.RoutingName, b.Address, b.ForwardingAddress, b.Exclusive, b.FilterString, nil) if err!= nil { return err } log.Info(fmt.Sprintf("Creating divert %s on %s: %+v", b.Name, client.Addr(), message)) response, err := doRequest(client, message) if err!= nil { return err } if!success(response) { return fmt.Errorf("error creating divert %s: %+v", b.Name, response.Value) } log.Info(fmt.Sprintf("Divert %s created successfully on %s", b.Name, client.Addr())) return nil } func (b *BrokerDivert) Delete(client amqpcommand.Client) error { message, err := newManagementMessage("broker", "destroyDivert", "", b.Name) if err!= nil { return err } log.Info(fmt.Sprintf("Destroying divert %s on %s", b.Name, client.Addr())) response, err := doRequest(client, message) if err!= nil { return err } if!success(response) { return fmt.Errorf("error destroying divert %s: %+v", b.Name, response.Value) } log.Info(fmt.Sprintf("Divert %s destroyed successfully on %s", b.Name, client.Addr())) return nil } /** * Broker address settings */ func (b *BrokerAddressSetting) Type() BrokerEntityType { return BrokerAddressSettingEntity } func (b *BrokerAddressSetting) GetName() string { return b.Name } func (b *BrokerAddressSetting) Order() int { return 0 } func (b *BrokerAddressSetting) Equals(e BrokerEntity) bool { if b.Type()!= e.Type() { return false } other := e.(*BrokerAddressSetting) return b.Name == other.GetName() // TODO: Compare more fields when we support updates } func (b *BrokerAddressSetting) Create(client amqpcommand.Client) error { log.Info(fmt.Sprintf("[Broker %s] creating address setting: '%s'", client.Addr(), b.Name)) message, err := newManagementMessage("broker", "addAddressSettings", "", b.Name, b.DeadLetterAddress, b.ExpiryAddress, b.ExpiryDelay, b.LastValueQueue, b.DeliveryAttempts, b.MaxSizeBytes, b.PageSizeBytes, b.PageMaxCacheSize, b.RedeliveryDelay, b.RedeliveryMultiplier, b.MaxRedeliveryDelay, b.RedistributionDelay, b.SendToDLAOnNoRoute, b.AddressFullMessagePolicy, b.SlowConsumerThreshold, b.SlowConsumerCheckPeriod, b.SlowConsumerPolicy, b.AutoCreateJmsQueues, b.AutoDeleteJmsQueues, b.AutoCreateJmsTopics, b.AutoDeleteJmsTopics, b.AutoCreateQueues, b.AutoDeleteQueues, b.AutoCreateAddresses, b.AutoDeleteAddresses) if err!= nil { return err } log.Info(fmt.Sprintf("Creating address setting %s on %s: %+v", b.Name, client.Addr(), message)) response, err := doRequest(client, message) if err!= nil { return err } if!success(response) { return fmt.Errorf("error creating address setting %s: %+v", b.Name, response.Value) } log.Info(fmt.Sprintf("Address setting %s created successfully on %s", b.Name, client.Addr())) return nil } func (b *BrokerAddressSetting) Delete(client amqpcommand.Client) error { message, err := newManagementMessage("broker", "removeAddressSettings", "", b.Name) if err!= nil { return err } log.Info(fmt.Sprintf("Removing address setting %s on %s", b.Name, client.Addr())) response, err := doRequest(client, message) if err!= nil { return err } if!success(response) { return fmt.Errorf("error removing address setting %s: %+v", b.Name, response.Value) } log.Info(fmt.Sprintf("Address setting %s destroyed successfully on %s", b.Name, client.Addr())) return nil } ======================= File: pkg/client/clientset/versioned/typed/admin/v1beta1/consoleservice.go ======================= /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 import ( "time" v1beta1 "github.com/enmasseproject/enmasse/pkg/apis/admin/v1beta1" scheme "github.com/enmasseproject/enmasse/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" ) // ConsoleServicesGetter has a method to return a ConsoleServiceInterface. // A group's client should implement this interface. type ConsoleServicesGetter interface { ConsoleServices(namespace string) ConsoleServiceInterface } // ConsoleServiceInterface has methods to work with ConsoleService resources. type ConsoleServiceInterface interface { Create(*v1beta1.ConsoleService) (*v1beta1.ConsoleService, error) Update(*v1beta1.ConsoleService) (*v1beta1.ConsoleService, error) UpdateStatus(*v1beta1.ConsoleService) (*v1beta1.ConsoleService, error) Delete(name string, options *v1.DeleteOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error Get(name string, options v1.GetOptions) (*v1beta1.ConsoleService, error) List(opts v1.ListOptions) (*v1beta1.ConsoleServiceList, error) Watch(opts v1.ListOptions) (watch.Interface, error) Patch(name string, pt types.PatchType, data []byte, subresources...string) (result *v1beta1.ConsoleService, err error) ConsoleServiceExpansion } // consoleServices implements ConsoleServiceInterface type consoleServices struct { client rest.Interface ns string } // newConsoleServices returns a ConsoleServices func newConsoleServices(c *AdminV1beta1Client, namespace string) *consoleServices { return &consoleServices{ client: c.RESTClient(), ns: namespace, } } // Get takes name of the consoleService, and returns the corresponding consoleService object, and an error if there is any. func (c *consoleServices) Get(name string, options v1.GetOptions) (result *v1beta1.ConsoleService, err error) { result = &v1beta1.ConsoleService{} err = c.client.Get(). Namespace(c.ns). Resource("consoleservices"). Name(name). VersionedParams(&options, scheme.ParameterCodec). Do(). Into(result) return } // List takes label and field selectors, and returns the list of ConsoleServices that match those selectors. func (c *consoleServices) List(opts v1.ListOptions) (result *v1beta1.ConsoleServiceList, err error) { var timeout time.Duration if opts.TimeoutSeconds!= nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } result = &v1beta1.ConsoleServiceList{} err = c.client.Get(). Namespace(c.ns). Resource("consoleservices"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Do(). Into(result) return } // Watch returns a watch.Interface that watches the requested consoleServices. func (c *consoleServices) Watch(opts v1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds!= nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } opts.Watch = true return c.client.Get(). Namespace(c.ns). Resource("consoleservices"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). Watch() } // Create takes the representation of a consoleService and creates it. Returns the server's representation of the consoleService, and an error, if there is any. func (c *consoleServices) Create(consoleService *v1beta1.ConsoleService) (result *v1beta1.ConsoleService, err error) { result = &v1beta1.ConsoleService{} err = c.client.Post(). Namespace(c.ns). Resource("consoleservices"). Body(consoleService). Do(). Into(result) return } // Update takes the representation of a consoleService and updates it. Returns the server's representation of the consoleService, and an error, if there is any. func (c *consoleServices) Update(consoleService *v1beta1.ConsoleService) (result *v1beta1.ConsoleService, err error) { result = &v1beta1.ConsoleService{} err = c.client.Put(). Namespace(c.ns). Resource("consoleservices"). Name(consoleService.Name). Body(consoleService). Do(). Into(result) return } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). func (c *consoleServices) UpdateStatus(consoleService *v1beta1.ConsoleService) (result *v1beta1.ConsoleService, err error) { result = &v1beta1.ConsoleService{} err = c.client.Put(). Namespace(c.ns). Resource("consoleservices"). Name(consoleService.Name). SubResource("status"). Body(consoleService). Do(). Into(result) return } // Delete takes name of the consoleService and deletes it. Returns an error if one occurs. func (c *consoleServices) Delete(name string, options *v1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("consoleservices"). Name(name). Body(options). Do(). Error() } // DeleteCollection deletes a collection of objects. func (c *consoleServices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { var timeout time.Duration if listOptions.TimeoutSeconds!= nil { timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). Resource("consoleservices"). VersionedParams(&listOptions, scheme.ParameterCodec). Timeout(timeout). Body(options). Do(). Error() } // Patch applies the patch and returns the patched consoleService. func (c *consoleServices) Patch(name string, pt types.PatchType, data []byte, subresources...string) (result *v1beta1.ConsoleService, err error) { result = &v1beta1.ConsoleService{} err = c.client.Patch(pt). Namespace(c.ns). Resource("consoleservices"). SubResource(subresources...). Name(name). Body(data). Do(). Into(result) return } ======================= File: pkg/client/clientset/versioned/typed/admin/v1beta1/fake/fake_consoleservice.go ======================= <filename>pkg/client/clientset/versioned/typed/admin/v1beta1/fake/fake_consoleservice.go /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1beta1 "github.com/enmasseproject/enmasse/pkg/apis/admin/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" ) // FakeConsoleServices implements ConsoleServiceInterface type FakeConsoleServices struct { Fake *FakeAdminV1beta1 ns string } var consoleservicesResource = schema.GroupVersionResource{Group: "admin.enmasse.io", Version: "v1beta1", Resource: "consoleservices"} var consoleservicesKind = schema.GroupVersionKind{Group: "admin.enmasse.io", Version: "v1beta1", Kind: "ConsoleService"} // Get takes name of the consoleService, and returns the corresponding consoleService object, and an error if there is any. func (c *FakeConsoleServices) Get(name string, options v1.GetOptions) (result *v1beta1.ConsoleService, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(consoleservicesResource, c.ns, name), &v1beta1.ConsoleService{}) if obj == nil { return nil, err } return obj.(*v1beta1.ConsoleService), err } // List takes label and field selectors, and returns the list of ConsoleServices that match those selectors. func (c *FakeConsoleServices) List(opts v1.ListOptions) (result *v1beta1.ConsoleServiceList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(consoleservicesResource, consoleservicesKind, c.ns, opts), &v1beta1.ConsoleServiceList{}) if obj == nil { return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &v1beta1.ConsoleServiceList{ListMeta: obj.(*v1beta1.ConsoleServiceList).ListMeta} for _, item := range obj.(*v1beta1.ConsoleServiceList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } } return list, err } // Watch returns a watch.Interface that watches the requested consoleServices. func (c *FakeConsoleServices) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(consoleservicesResource, c.ns, opts)) } // Create takes the representation of a consoleService and creates it. Returns the server's representation of the consoleService, and an error, if there is any. func (c *FakeConsoleServices) Create(consoleService *v1beta1.ConsoleService) (result *v1beta1.ConsoleService, err error) { obj, err := c.Fake. Invokes(testing.NewCreateAction(consoleservicesResource, c.ns, consoleService), &v1beta1.ConsoleService{}) if obj == nil { return nil, err } return obj.(*v1beta1.ConsoleService), err } // Update takes the representation of a consoleService and updates it. Returns the server's representation of the consoleService, and an error, if there is any. func (c *FakeConsoleServices) Update(consoleService *v1beta1.ConsoleService) (result *v1beta1.ConsoleService, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(consoleservicesResource, c.ns, consoleService), &v1beta1.ConsoleService{}) if obj == nil { return nil, err } return obj.(*v1beta1.ConsoleService), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). func (c *FakeConsoleServices) UpdateStatus(consoleService *v1beta1.ConsoleService) (*v1beta1.ConsoleService, error) { obj, err := c.Fake. Invokes(testing.NewUpdateSubresourceAction(consoleservicesResource, "status", c.ns, consoleService), &v1beta1.ConsoleService{}) if obj == nil { return nil, err } return obj.(*v1beta1.ConsoleService), err } // Delete takes name of the consoleService and deletes it. Returns an error if one occurs. func (c *FakeConsoleServices) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. Invokes(testing.NewDeleteAction(consoleservicesResource, c.ns, name), &v1beta1.ConsoleService{}) return err } // DeleteCollection deletes a collection of objects. func (c *FakeConsoleServices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(consoleservicesResource, c.ns, listOptions) _, err := c.Fake.Invokes(action, &v1beta1.ConsoleServiceList{}) return err } // Patch applies the patch and returns the patched consoleService. func (c *FakeConsoleServices) Patch(name string, pt types.PatchType, data []byte, subresources...string) (result *v1beta1.ConsoleService, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(consoleservicesResource, c.ns, name, pt, data, subresources...), &v1beta1.ConsoleService{}) if obj == nil { return nil, err } return obj.(*v1beta1.ConsoleService), err } ======================= File: pkg/client/listers/user/v1beta1/expansion_generated.go ======================= /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 // MessagingUserListerExpansion allows custom methods to be added to // MessagingUserLister. type MessagingUserListerExpansion interface{} // MessagingUserNamespaceListerExpansion allows custom methods to be added to // MessagingUserNamespaceLister. type MessagingUserNamespaceListerExpansion interface{} ======================= File: pkg/apis/iot/v1alpha1/types_test.go ======================= /* * Copyright 2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package v1alpha1 import ( "encoding/json" "testing" ) const testExpected1 = `{"downstream":{"addresses":{"telemetry":{},"event":{},"command":{}}},"configuration":{"enabled":true,"ext":{"bar":"baz","bar2":2}}}` // Test to decode and re-encode the generic config section func TestSerializeConfiguration(t *testing.T) { spec := &IoTProjectSpec{} if err := json.Unmarshal([]byte(` { "configuration": { "enabled": true, "ext": { "bar": "baz", "bar2": 2 } } } `), spec); err!= nil { t.Fatalf("Failed to decode: %v", err) return } data, err := json.Marshal(spec) if err!= nil { t.Fatalf("Failed to encode: %v", err) return } if string(data)!= testExpected1 { t.Error("Expected JSON to be: ", testExpected1, " but was ", string(data)) } } ======================= File: pkg/util/ptr_values.go ======================= <reponame>anukritijha/enmasse /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package util func FalsePtr() *bool { value := false return &value } ======================= File: pkg/consolegraphql/metric/metric_updater_test.go ======================= <filename>pkg/consolegraphql/metric/metric_updater_test.go /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). * */ package metric import ( "fmt" "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta1" "github.com/enmasseproject/enmasse/pkg/consolegraphql" "github.com/enmasseproject/enmasse/pkg/consolegraphql/cache" "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "testing" "time" ) func newTestMetricUpdater(t *testing.T) cache.Cache { objectCache, err := cache.CreateObjectCache() assert.NoError(t, err) return objectCache } func TestMetricUpdater(t *testing.T) { objectCache := newTestMetricUpdater(t) namespace := "mynamespace" addressspace := "myaddressspace" addressname := fmt.Sprintf("%s.myaddr", addressspace) addr := createAddress(namespace, addressname, (*consolegraphql.Metric)(consolegraphql.NewRateCalculatingMetric("foo", "mytype", "myunit"))) now := time.Now() addr.Metrics[0].AddTimeSeriesDataPoint(0, now.Add(time.Minute*-1)) addr.Metrics[0].AddTimeSeriesDataPoint(1500, now) assert.Equal(t, float64(0), addr.Metrics[0].Value, "unexpected address metric value") err := objectCache.Add(addr) assert.NoError(t, err) err, updated := UpdateAllMetrics(objectCache, "round(rate(unused_label[5m]), 0.01)") assert.NoError(t, err) assert.Equal(t, 1, updated) objs, err := objectCache.Get(cache.PrimaryObjectIndex, fmt.Sprintf("Address/%s/%s", namespace, addressname), nil) assert.NoError(t, err) assert.Equal(t, 1, len(objs), "unexpected number of addresses") retrievedAddr := objs[0].(*consolegraphql.AddressHolder) assert.NotEqual(t, float64(0), retrievedAddr.Metrics[0].Value, "unexpected address metric value") } func createAddress(namespace, name string, metrics...*consolegraphql.Metric) *consolegraphql.AddressHolder { return &consolegraphql.AddressHolder{ Address: v1beta1.Address{ TypeMeta: metav1.TypeMeta{ Kind: "Address", }, ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, }, }, Metrics: metrics, } } ======================= File: pkg/util/errors_test.go ======================= <gh_stars>1-10 /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package util import ( "fmt" "github.com/pkg/errors" "go.uber.org/multierr" "testing" ) func TestOnlyNonRecoverableErrors(t *testing.T) { for _, entry := range []struct { input error output bool }{ {input: fmt.Errorf("just a test"), output: false}, {input: NewConfigurationError("just another test"), output: true}, {input: WrapAsNonRecoverable(fmt.Errorf("just a test")), output: true}, {input: multierr.Append( NewConfigurationError("test 1"), NewConfigurationError("test 2")), output: true}, {input: multierr.Append( fmt.Errorf("just a test"), NewConfigurationError("test 2")), output: false}, {input: multierr.Append( errors.Wrap(fmt.Errorf("just a test"), "it's a wrap"), NewConfigurationError("test 2")), output: false}, {input: multierr.Append( fmt.Errorf("just a test"), errors.Wrap(NewConfigurationError("test 2"), "it's a wrap")), output: false}, {input: multierr.Append( NewConfigurationError("test 1"), errors.Wrap(NewConfigurationError("test 2"), "it's a wrap")), output: true}, {input: multierr.Append( errors.Wrap(NewConfigurationError("test 1"), "it's a wrap"), errors.Wrap(NewConfigurationError("test 2"), "it's a wrap")), output: true}, } { if result := OnlyNonRecoverableErrors(entry.input); result!= entry.output { t.Errorf("Wrong result - expected: %v, actual: %v, input: %v", entry.output, result, entry.input) } } } func TestOnlyNonRecoverableErrorsForNil(t *testing.T) { if result := OnlyNonRecoverableErrors(nil); result!= true { t.Errorf("Wrong result - expected: %v, actual: %v, input: %v", true, result, nil) } } ======================= File: pkg/util/cchange/change_test.go ======================= <filename>pkg/util/cchange/change_test.go /* * Copyright 2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package cchange import ( "testing" ) func TestStringEqual(t *testing.T) { change1 := NewRecorder() change2 := NewRecorder() change1.AddString("foo") change2.AddString("foo") if change1.HashString()!= change2.HashString() { t.Errorf("Should be equal - 1: %s, 2: %s", change1.HashString(), change2.HashString()) } } func TestMap1(t *testing.T) { change1 := NewRecorder() change2 := NewRecorder() change1.AddStringsFromMap(map[string]string{ "baz": "123", }) change2.AddStringsFromMap(map[string]string{ "baz": "123", }) if change1.HashString()!= change2.HashString() { t.Error("Should be equal") } } func TestMap2(t *testing.T) { change1 := NewRecorder() change2 := NewRecorder() change1.AddStringsFromMap(map[string]string{ "baz": "123", "foo": "456", }, "baz") change2.AddStringsFromMap(map[string]string{ "baz": "123", }) if change1.HashString()!= change2.HashString() { t.Error("Should be equal") } } ======================= File: pkg/util/modules_test.go ======================= /* * Copyright 2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package util import ( "testing" ) var envs = []struct { vars map[string]string module string result bool }{ {map[string]string{}, "iot", true}, {map[string]string{"CONTROLLER_DISABLE_ALL": "false"}, "iot", true}, {map[string]string{"CONTROLLER_DISABLE_ALL": "true"}, "iot", false}, {map[string]string{"CONTROLLER_ENABLE_ALL": "true", "CONTROLLER_DISABLE_ALL": "true"}, "iot", true}, {map[string]string{"CONTROLLER_ENABLE_IOT": "true", "CONTROLLER_DISABLE_ALL": "true"}, "iot", true}, {map[string]string{"CONTROLLER_ENABLE_IOT": "false", "CONTROLLER_DISABLE_ALL": "true"}, "iot", false}, } func TestEnabled(t *testing.T) { // CONTROLLER_ENABLE_IOT = false // CONTROLLER_ENABLE_IOT = true // CONTROLLER_DISABLE_ALL = true for _, data := range envs { env := MockEnvironmentProvider{Environment: data.vars} if ret := isModuleEnabled(env, data.module); ret!= data.result { t.Errorf("Expected module %s to be state = %t, but was %t", data.module, data.result, ret) } } } func TestSimpleExample(t *testing.T) { env1 := MockEnvironmentProvider{Environment: map[string]string{ "CONTROLLER_ENABLE_IOT": "false", }} env2 := MockEnvironmentProvider{Environment: map[string]string{ "CONTROLLER_ENABLE_IOT": "true", "CONTROLLER_DISABLE_ALL": "true", }} // test env1 if isModuleEnabled(env1, "iot")!= false { t.Errorf("Module 'iot' must be disabled in environment #1") } if isModuleEnabled(env1, "foo")!= true { t.Errorf("Module 'foo' must be enabled in environment #1") } // test env2 if isModuleEnabled(env2, "iot")!= true { t.Errorf("Module 'iot' must be enabled in environment #2") } if isModuleEnabled(env2, "foo")!= false { t.Errorf("Module 'foo' must be disabled in environment #1") } } ======================= File: pkg/client/informers/externalversions/admin/v1beta1/interface.go ======================= /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by informer-gen. DO NOT EDIT. package v1beta1 import ( internalinterfaces "github.com/enmasseproject/enmasse/pkg/client/informers/externalversions/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // AuthenticationServices returns a AuthenticationServiceInformer. AuthenticationServices() AuthenticationServiceInformer // ConsoleServices returns a ConsoleServiceInformer. ConsoleServices() ConsoleServiceInformer } type version struct { factory internalinterfaces.SharedInformerFactory namespace string tweakListOptions internalinterfaces.TweakListOptionsFunc } // New returns a new Interface. func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } // AuthenticationServices returns a AuthenticationServiceInformer. func (v *version) AuthenticationServices() AuthenticationServiceInformer { return &authenticationServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // ConsoleServices returns a ConsoleServiceInformer. func (v *version) ConsoleServices() ConsoleServiceInformer { return &consoleServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } ======================= File: pkg/consolegraphql/resolvers/resolver_authenticationservice_test.go ======================= <reponame>anukritijha/enmasse<gh_stars>1-10 /* * Copyright 2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package resolvers import ( "context" "github.com/enmasseproject/enmasse/pkg/apis/admin/v1beta1" "github.com/enmasseproject/enmasse/pkg/consolegraphql/cache" "github.com/google/uuid" "github.com/stretchr/testify/assert" v12 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "reflect" "testing" ) func newTestAuthenticationServiceResolver(t *testing.T) *Resolver { objectCache, err := cache.CreateObjectCache() assert.NoError(t, err) resolver := Resolver{} resolver.Cache = objectCache return &resolver } func TestQueryAuthenticationService(t *testing.T) { r := newTestAuthenticationServiceResolver(t) authenticationService := &v1beta1.AuthenticationService{ TypeMeta: v12.TypeMeta{ Kind: "AuthenticationService", }, ObjectMeta: v12.ObjectMeta{ Name: "none-authservice", UID: types.UID(uuid.New().String()), }, } err := r.Cache.Add(authenticationService) if err!= nil { t.Fatal(err) } objs, err := r.Query().AuthenticationServices(context.TODO()) if err!= nil { t.Fatal(err) } if!reflect.DeepEqual(authenticationService.Spec, objs[0].Spec) { t.Fatalf("Unexpected authenticationService spec, expected %+v actual %+v", authenticationService.Spec, objs[0].Spec) } if!reflect.DeepEqual(authenticationService.ObjectMeta, objs[0].ObjectMeta) { t.Fatalf("Unexpected authenticationService object meta, expected %+v actual %+v", authenticationService.ObjectMeta, objs[0].ObjectMeta) } } ======================= File: cmd/access-control-server/main.go ======================= /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package main import ( "crypto/tls" "fmt" "github.com/enmasseproject/enmasse/pkg/accesscontrolserver" serverAmqp "github.com/enmasseproject/enmasse/pkg/accesscontrolserver/amqp" "github.com/enmasseproject/enmasse/pkg/util" "log" "os" "os/signal" "syscall" "time" ) /* access-control-server - presents a AMQP SASL server that implements CRD driven authentication and authorization. For development purposes, you can run the access-control-server backend outside the container. See the Makefile target 'run'. */ type logWriter struct { } func (writer logWriter) Write(bytes []byte) (int, error) { return fmt.Print(time.Now().UTC().Format("2006-01-02T15:04:05.999Z") + " " + string(bytes)) } func main() { log.SetFlags(0) log.SetOutput(new(logWriter)) sigs := make(chan os.Signal, 1) done := make(chan bool, 1) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) port := uint16(util.GetUintEnvOrDefault("PORT", 0, 16, 0)) bindAddress := util.GetEnvOrDefault("BIND_ADDRESS", "localhost") tlsCertFile := util.GetEnvOrDefault("TLS_CERT_FILE", "") tlsKeyFile := util.GetEnvOrDefault("TLS_KEY_FILE", "") // TODO watch the files and restart the listener in the event of change(s) in order to support certificate rotation.. var tlsConfig *tls.Config if tlsCertFile!= "" && tlsKeyFile!= "" { cer, err := tls.LoadX509KeyPair(tlsCertFile, tlsKeyFile) if err!= nil { log.Panic(err) } tlsConfig = &tls.Config{Certificates: []tls.Certificate{cer}} } server, err := accesscontrolserver.NewServer(tlsConfig, bindAddress, port, serverAmqp.WithSASLAnonymous()) if err!= nil { log.Panic(err) } log.Printf("Listening : %s TLS : %t", server.GetAddress(), tlsConfig!= nil) go func() { _ = <-sigs log.Println("Shutting down") server.Stop() done <- true }() <-done log.Println("Done") } ======================= File: cmd/broker-probe/main.go ======================= /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package main import ( "log" "os" "time" "pack.ag/amqp" ) func main() { probeAddress := os.Getenv("PROBE_ADDRESS") if probeAddress == "" { log.Fatal("Error looking up PROBE_ADDRESS") } log.Println("Found probe address, connecting") username := os.Getenv("PROBE_USERNAME") if username == "" { username = "probe" } password := os.Getenv("PROBE_PASSWORD") if password == "" { password = "<PASSWORD>" } probeTimeoutStr := os.Getenv("PROBE_TIMEOUT") if probeTimeoutStr == "" { probeTimeoutStr = "2s" } probeTimeout, err := time.ParseDuration(probeTimeoutStr) if err!= nil { log.Fatal(err, "Error parsing duration") } done := make(chan error) go func() { done <- runProbe("amqp://127.0.0.1:5672", probeAddress, username, password, probeTimeout) }() select { case <-time.After(probeTimeout): os.Exit(1) case err := <-done: if err!= nil { os.Exit(1) } } } func runProbe(url, probeAddress, username, password string, probeTimeout time.Duration) error { client, err := amqp.Dial(url, amqp.ConnSASLPlain(username, password), amqp.ConnConnectTimeout(probeTimeout), amqp.ConnProperty("product", "broker-probe")) if err!= nil { log.Println(err, "Error dialing broker") return err } log.Println("Connected, creating session") defer func() { _ = client.Close() }() session, err := client.NewSession() if err!= nil { log.Println(err, "Error creating session") return err } log.Println("Session created") _, err = session.NewReceiver(amqp.LinkAddress(probeAddress)) if err!= nil { log.Println(err, "Error attaching link") return err } log.Println("Link created") return nil } ======================= File: pkg/controller/iotconfig/adapter_test.go ======================= <reponame>anukritijha/enmasse /* * Copyright 2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package iotconfig import ( "reflect" "testing" "github.com/enmasseproject/enmasse/pkg/apis/iot/v1alpha1" ) func TestMerge(t *testing.T) { input := []struct { first *v1alpha1.AdapterOptions second *v1alpha1.AdapterOptions result v1alpha1.AdapterOptions }{ { first: nil, second: nil, result: v1alpha1.AdapterOptions{}, }, { first: nil, second: &v1alpha1.AdapterOptions{ TenantIdleTimeout: "1m", }, result: v1alpha1.AdapterOptions{ TenantIdleTimeout: "1m", }, }, { first: &v1alpha1.AdapterOptions{ TenantIdleTimeout: "1m", }, second: nil, result: v1alpha1.AdapterOptions{ TenantIdleTimeout: "1m", }, }, { first: &v1alpha1.AdapterOptions{ TenantIdleTimeout: "1m", }, second: &v1alpha1.AdapterOptions{ TenantIdleTimeout: "2m", }, result: v1alpha1.AdapterOptions{ TenantIdleTimeout: "2m", }, }, } for _, i := range input { r := mergeAdapterOptions(i.first, i.second) if!reflect.DeepEqual(i.result, r) { t.Errorf("Failed to merge - expected: %v, actual: %v", i.result, r) } } } ======================= File: pkg/controller/iotconfig/device_registry.go ======================= <reponame>anukritijha/enmasse<gh_stars>1-10 /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package iotconfig import ( "context" iotv1alpha1 "github.com/enmasseproject/enmasse/pkg/apis/iot/v1alpha1" "github.com/enmasseproject/enmasse/pkg/util" "github.com/enmasseproject/enmasse/pkg/util/cchange" "github.com/enmasseproject/enmasse/pkg/util/install" "github.com/enmasseproject/enmasse/pkg/util/recon" routev1 "github.com/openshift/api/route/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/controller-runtime/pkg/reconcile" ) const nameDeviceRegistry = "iot-device-registry" const nameDeviceRegistryManagement = "iot-device-registry-management" const routeDeviceRegistry = "device-registry" func isSplitRegistry(config *iotv1alpha1.IoTConfig) (bool, error) { switch config.EvalDeviceRegistryImplementation() { case iotv1alpha1.DeviceRegistryInfinispan: return false, nil case iotv1alpha1.DeviceRegistryJdbc: return config.Spec.ServicesConfig.DeviceRegistry.JDBC.IsSplitRegistry() default: return false, util.NewConfigurationError("illegal device registry configuration") } } func (r *ReconcileIoTConfig) processDeviceRegistry(ctx context.Context, config *iotv1alpha1.IoTConfig, authServicePsk *cchange.ConfigChangeRecorder) (reconcile.Result, error) { // detect mode of deployment splitRegistry, err := isSplitRegistry(config) if err!= nil { return reconcile.Result{}, err } rc := recon.ReconcileContext{} // process rc.Process(func() (reconcile.Result, error) { switch config.EvalDeviceRegistryImplementation() { case iotv1alpha1.DeviceRegistryInfinispan: return r.processInfinispanDeviceRegistry(ctx, config, authServicePsk) case iotv1alpha1.DeviceRegistryJdbc: return r.processJdbcDeviceRegistry(ctx, config, authServicePsk) default: return reconcile.Result{}, util.NewConfigurationError("illegal device registry configuration") } }) // create services if splitRegistry { // endpoint - adapter rc.ProcessSimple(func() error { return r.processService(ctx, nameDeviceRegistry, config, false, r.reconcileDeviceRegistryAdapterService) }) // endpoint - add extra management rc.ProcessSimple(func() error { return r.processService(ctx, nameDeviceRegistryManagement, config, false, r.reconcileDeviceRegistryManagementService) }) // metrics - add extra management rc.ProcessSimple(func() error { return r.processService(ctx, nameDeviceRegistryManagement+"-metrics", config, false, r.reconcileMetricsService(nameDeviceRegistryManagement)) }) } else { // endpoint - combined rc.ProcessSimple(func() error { return r.processService(ctx, nameDeviceRegistry, config, false, r.reconcileDeviceRegistryCombinedService) }) // endpoint - delete extra management rc.Delete(ctx, r.client, &corev1.Service{ObjectMeta: metav1.ObjectMeta{Namespace: config.Namespace, Name: nameDeviceRegistryManagement}}) // metrics - delete extra management rc.Delete(ctx, r.client, &corev1.Service{ObjectMeta: metav1.ObjectMeta{Namespace: config.Namespace, Name: nameDeviceRegistryManagement + "-metrics"}}) } // metrics - common service rc.ProcessSimple(func() error { return r.processService(ctx, nameDeviceRegistry+"-metrics", config, false, r.reconcileMetricsService(nameDeviceRegistry)) }) // create routes rc.ProcessSimple(func() error { return r.processServiceRoute(ctx, config, routeDeviceRegistry, config.Spec.ServicesConfig.DeviceRegistry.Management.Endpoint, r.reconcileDeviceRegistryRoute, r.reconcileDeviceRegistryManagementServiceExternal) }) // done return rc.Result() } func getRegistryManagementServiceName(config *iotv1alpha1.IoTConfig) (string, error) { is, err := isSplitRegistry(config) if err!= nil { return "", err } if is { return nameDeviceRegistryManagement, nil } else { return nameDeviceRegistry, nil } } func (r *ReconcileIoTConfig) reconcileDeviceRegistryRoute(config *iotv1alpha1.IoTConfig, route *routev1.Route, endpointStatus *iotv1alpha1.EndpointStatus) error { install.ApplyDefaultLabels(&route.ObjectMeta, "iot", route.Name) // Port route.Spec.Port = &routev1.RoutePort{ TargetPort: intstr.FromString("https"), } // Path route.Spec.Path = "" // TLS if route.Spec.TLS == nil { route.Spec.TLS = &routev1.TLSConfig{} } if config.Spec.ServicesConfig.DeviceRegistry.Management.Endpoint.HasCustomCertificate() { route.Spec.TLS.Termination = routev1.TLSTerminationPassthrough route.Spec.TLS.InsecureEdgeTerminationPolicy = routev1.InsecureEdgeTerminationPolicyNone } else { route.Spec.TLS.Termination = routev1.TLSTerminationReencrypt route.Spec.TLS.InsecureEdgeTerminationPolicy = routev1.InsecureEdgeTerminationPolicyNone } // Service route.Spec.To.Kind = "Service" if name, err := getRegistryManagementServiceName(config); err!= nil { return err } else { route.Spec.To.Name = name } // Update endpoint updateEndpointStatus("https", false, route, endpointStatus) // return return nil } func (r *ReconcileIoTConfig) reconcileDeviceRegistryManagementServiceExternal(config *iotv1alpha1.IoTConfig, service *corev1.Service) error { install.ApplyServiceDefaults(service, "iot", service.Name) service.Spec.Type = corev1.ServiceTypeLoadBalancer // set a single port, but don't overwrite the NodePort if len(service.Spec.Ports)!= 1 { service.Spec.Ports = make([]corev1.ServicePort, 1) } service.Spec.Ports[0].Name = "https" service.Spec.Ports[0].Port = 31443 service.Spec.Ports[0].TargetPort = intstr.FromInt(8443) service.Spec.Ports[0].Protocol = corev1.ProtocolTCP if service.Annotations == nil { service.Annotations = make(map[string]string) } // we must point the selector to the management deployment name, err := getRegistryManagementServiceName(config) if err!= nil { return err } service.Spec.Selector["name"] = name return nil } func (r *ReconcileIoTConfig) reconcileDeviceRegistryCombinedService(config *iotv1alpha1.IoTConfig, service *corev1.Service) error { install.ApplyServiceDefaults(service, "iot", service.Name) service.Spec.Type = corev1.ServiceTypeClusterIP // AMQPS port service.Spec.Ports = []corev1.ServicePort{ { Name: "amqps", Port: 5671, TargetPort: intstr.FromInt(5671), Protocol: corev1.ProtocolTCP, }, { Name: "https", Port: 8443, TargetPort: intstr.FromInt(8443), Protocol: corev1.ProtocolTCP, }, } // annotations if service.Annotations == nil { service.Annotations = make(map[string]string) } if err := ApplyInterServiceForService(config, service, nameDeviceRegistry); err!= nil { return err } if err := applyEndpointService(config.Spec.ServicesConfig.DeviceRegistry.Management.Endpoint, service, nameDeviceRegistry); err!= nil { return err } return nil } func (r *ReconcileIoTConfig) reconcileDeviceRegistryAdapterService(config *iotv1alpha1.IoTConfig, service *corev1.Service) error { install.ApplyServiceDefaults(service, "iot", service.Name) service.Spec.Type = corev1.ServiceTypeClusterIP // AMQPS port service.Spec.Ports = []corev1.ServicePort{ { Name: "amqps", Port: 5671, TargetPort: intstr.FromInt(5671), Protocol: corev1.ProtocolTCP, }, } // annotations if service.Annotations == nil { service.Annotations = make(map[string]string) } if err := ApplyInterServiceForService(config, service, nameDeviceRegistry); err!= nil { return err } return nil } func (r *ReconcileIoTConfig) reconcileDeviceRegistryManagementService(config *iotv1alpha1.IoTConfig, service *corev1.Service) error { install.ApplyServiceDefaults(service, "iot", service.Name) service.Spec.Type = corev1.ServiceTypeClusterIP // HTTP port service.Spec.Ports = []corev1.ServicePort{ { Name: "https", Port: 8443, TargetPort: intstr.FromInt(8443), Protocol: corev1.ProtocolTCP, }, } // annotations if service.Annotations == nil { service.Annotations = make(map[string]string) } if err := ApplyInterServiceForService(config, service, nameDeviceRegistryManagement); err!= nil { return err } return nil } ======================= File: pkg/client/clientset/versioned/typed/admin/v1beta2/fake/fake_addressplan.go ======================= /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1beta2 "github.com/enmasseproject/enmasse/pkg/apis/admin/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" ) // FakeAddressPlans implements AddressPlanInterface type FakeAddressPlans struct { Fake *FakeAdminV1beta2 ns string } var addressplansResource = schema.GroupVersionResource{Group: "admin.enmasse.io", Version: "v1beta2", Resource: "addressplans"} var addressplansKind = schema.GroupVersionKind{Group: "admin.enmasse.io", Version: "v1beta2", Kind: "AddressPlan"} // Get takes name of the addressPlan, and returns the corresponding addressPlan object, and an error if there is any. func (c *FakeAddressPlans) Get(name string, options v1.GetOptions) (result *v1beta2.AddressPlan, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(addressplansResource, c.ns, name), &v1beta2.AddressPlan{}) if obj == nil { return nil, err } return obj.(*v1beta2.AddressPlan), err } // List takes label and field selectors, and returns the list of AddressPlans that match those selectors. func (c *FakeAddressPlans) List(opts v1.ListOptions) (result *v1beta2.AddressPlanList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(addressplansResource, addressplansKind, c.ns, opts), &v1beta2.AddressPlanList{}) if obj == nil { return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &v1beta2.AddressPlanList{ListMeta: obj.(*v1beta2.AddressPlanList).ListMeta} for _, item := range obj.(*v1beta2.AddressPlanList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } } return list, err } // Watch returns a watch.Interface that watches the requested addressPlans. func (c *FakeAddressPlans) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(addressplansResource, c.ns, opts)) } // Create takes the representation of a addressPlan and creates it. Returns the server's representation of the addressPlan, and an error, if there is any. func (c *FakeAddressPlans) Create(addressPlan *v1beta2.AddressPlan) (result *v1beta2.AddressPlan, err error) { obj, err := c.Fake. Invokes(testing.NewCreateAction(addressplansResource, c.ns, addressPlan), &v1beta2.AddressPlan{}) if obj == nil { return nil, err } return obj.(*v1beta2.AddressPlan), err } // Update takes the representation of a addressPlan and updates it. Returns the server's representation of the addressPlan, and an error, if there is any. func (c *FakeAddressPlans) Update(addressPlan *v1beta2.AddressPlan) (result *v1beta2.AddressPlan, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(addressplansResource, c.ns, addressPlan), &v1beta2.AddressPlan{}) if obj == nil { return nil, err } return obj.(*v1beta2.AddressPlan), err } // Delete takes name of the addressPlan and deletes it. Returns an error if one occurs. func (c *FakeAddressPlans) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. Invokes(testing.NewDeleteAction(addressplansResource, c.ns, name), &v1beta2.AddressPlan{}) return err } // DeleteCollection deletes a collection of objects. func (c *FakeAddressPlans) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(addressplansResource, c.ns, listOptions) _, err := c.Fake.Invokes(action, &v1beta2.AddressPlanList{}) return err } // Patch applies the patch and returns the patched addressPlan. func (c *FakeAddressPlans) Patch(name string, pt types.PatchType, data []byte, subresources...string) (result *v1beta2.AddressPlan, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(addressplansResource, c.ns, name, pt, data, subresources...), &v1beta2.AddressPlan{}) if obj == nil { return nil, err } return obj.(*v1beta2.AddressPlan), err } ======================= File: pkg/apis/enmasse/v1/types_addressplan.go ======================= <filename>pkg/apis/enmasse/v1/types_addressplan.go /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package v1 import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) /* * Be careful with the comments in this file. The prefix "+" indicates that this is being processed * by the client generator. The location, empty lines, and other comments in this file may confuse * the generator, and produce a non-version version. */ // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:resource:shortName=msgap;msgaddressplan;msgaddressplans,categories=enmasse // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The current phase." // +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",priority=1,description="Message describing the reason for the current Phase." // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" type MessagingAddressPlan struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec MessagingAddressPlanSpec `json:"spec,omitempty"` Status MessagingAddressPlanStatus `json:"status,omitempty"` } type MessagingAddressPlanSpec struct { // A selector defining which namespaces this plan should serve. Default is all namespaces. NamespaceSelector *NamespaceSelector `json:"namespaceSelector,omitempty"` } type MessagingAddressPlanStatus struct { // +kubebuilder:printcolumn Phase MessagingAddressPlanPhase `json:"phase,omitempty"` Message string `json:"message,omitempty"` Conditions []MessagingAddressPlanCondition `json:"conditions,omitempty"` } type MessagingAddressPlanCondition struct { Type MessagingAddressPlanConditionType `json:"type"` Status corev1.ConditionStatus `json:"status"` LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` Reason string `json:"reason,omitempty"` Message string `json:"message,omitempty"` } type MessagingAddressPlanConditionType string const ( MessagingAddressPlanReady MessagingAddressPlanConditionType = "Ready" ) type MessagingAddressPlanPhase string const ( MessagingAddressPlanConfiguring MessagingAddressPlanPhase = "Configuring" MessagingAddressPlanActive MessagingAddressPlanPhase = "Active" MessagingAddressPlanTerminating MessagingAddressPlanPhase = "Terminating" ) // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type MessagingAddressPlanList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []MessagingAddressPlan `json:"items"` } ======================= File: pkg/client/listers/admin/v1beta2/expansion_generated.go ======================= /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by lister-gen. DO NOT EDIT. package v1beta2 // AddressPlanListerExpansion allows custom methods to be added to // AddressPlanLister. type AddressPlanListerExpansion interface{} // AddressPlanNamespaceListerExpansion allows custom methods to be added to // AddressPlanNamespaceLister. type AddressPlanNamespaceListerExpansion interface{} // AddressSpacePlanListerExpansion allows custom methods to be added to // AddressSpacePlanLister. type AddressSpacePlanListerExpansion interface{} // AddressSpacePlanNamespaceListerExpansion allows custom methods to be added to // AddressSpacePlanNamespaceLister. type AddressSpacePlanNamespaceListerExpansion interface{} ======================= File: pkg/consolegraphql/resolvers/resolver_namespace.go ======================= /* * Copyright 2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package resolvers import ( "context" "fmt" "github.com/enmasseproject/enmasse/pkg/consolegraphql/cache" "github.com/enmasseproject/enmasse/pkg/consolegraphql/server" "k8s.io/api/core/v1" ) func (r *Resolver) NamespaceStatus_v1() NamespaceStatus_v1Resolver { return &namespaceStatusK8sResolver{r} } func (r *queryResolver) Namespaces(ctx context.Context) ([]*v1.Namespace, error) { requestState := server.GetRequestStateFromContext(ctx) viewFilter := requestState.AccessController.ViewFilter() objects, e := r.Cache.Get(cache.PrimaryObjectIndex, "Namespace/", viewFilter) if e!= nil { return nil, e } nss := make([]*v1.Namespace, len(objects)) for i, o := range objects { ns, ok := o.(*v1.Namespace) if!ok { return nil, fmt.Errorf("unexpected type %T", o) } nss[i] = ns } return nss, e } type namespaceStatusK8sResolver struct{ *Resolver } func (n *namespaceStatusK8sResolver) Phase(ctx context.Context, obj *v1.NamespaceStatus) (string, error) { if obj!= nil { return string(obj.Phase), nil } return "", nil } ======================= File: pkg/consolegraphql/metric/metric_calculator.go ======================= /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). * */ package metric import ( "container/ring" "context" "github.com/enmasseproject/enmasse/pkg/consolegraphql" "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/pkg/timestamp" "github.com/prometheus/prometheus/prompb" "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/storage" "github.com/prometheus/prometheus/storage/remote" "math" "time" ) type Calculator interface { Calc(timeSeries *ring.Ring) (float64, error) } type promQLCalculator struct { engine *promql.Engine promQLExpression string } func New(promQLExpression string) (p *promQLCalculator) { return &promQLCalculator{ engine: promql.NewEngine(promql.EngineOpts{ MaxConcurrent: 1, MaxSamples: 100, Timeout: 10 * time.Second, }), promQLExpression: promQLExpression, } } func (p *promQLCalculator) Calc(timeSeries *ring.Ring) (float64, error) { now := time.Now() query, err := p.engine.NewInstantQuery(&adaptingQueryable{ dataPointRing: timeSeries, }, p.promQLExpression, now) if err!= nil { return 0, err } result := query.Exec(context.TODO()) if result.Err!= nil { return 0, result.Err } vector := result.Value.(promql.Vector) if len(vector) == 0 { return 0, nil } else { v := vector[0].V if v > 1 { v = math.Round(v) } return v, nil } } type adaptingQueryable struct { dataPointRing *ring.Ring } type adaptingQuerier struct { queryResults *prompb.QueryResult labels []prompb.Label } func (aqr adaptingQuerier) Select(*storage.SelectParams,...*labels.Matcher) (storage.SeriesSet, storage.Warnings, error) { return remote.FromQueryResult(aqr.queryResults), nil, nil } func (aqr adaptingQuerier) LabelValues(string) ([]string, storage.Warnings, error) { values := make([]string, len(aqr.labels)) for i, v := range aqr.labels { values[i] = v.Value } return values, nil, nil } func (aqr adaptingQuerier) LabelNames() ([]string, storage.Warnings, error) { names := make([]string, len(aqr.labels)) for i, v := range aqr.labels { names[i] = v.Name } return names, nil, nil } func (aqr adaptingQuerier) Close() error { return nil } func (aq adaptingQueryable) Querier(context.Context, int64, int64) (storage.Querier, error) { samples := make([]prompb.Sample, 0) aq.dataPointRing.Do(func(rv interface{}) { if rv!= nil { pair := rv.(consolegraphql.DataPointTimePair) samples = append(samples, prompb.Sample{ Value: pair.DataPoint, Timestamp: timestamp.FromTime(pair.Timestamp), }) } }) labs := []prompb.Label{{Name: "unused_label", Value: "unused_value"}} ts := make([]*prompb.TimeSeries, 0) ts = append(ts, &prompb.TimeSeries{ Labels: labs, Samples: samples, }) qr := &prompb.QueryResult{ Timeseries: ts, } return &adaptingQuerier{ qr, labs, }, nil } ======================= File: pkg/client/clientset/versioned/typed/enmasse/v1/fake/fake_enmasse_client.go ======================= /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1 "github.com/enmasseproject/enmasse/pkg/client/clientset/versioned/typed/enmasse/v1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) type FakeEnmasseV1 struct { *testing.Fake } func (c *FakeEnmasseV1) MessagingAddresses(namespace string) v1.MessagingAddressInterface { return &FakeMessagingAddresses{c, namespace} } func (c *FakeEnmasseV1) MessagingAddressPlans(namespace string) v1.MessagingAddressPlanInterface { return &FakeMessagingAddressPlans{c, namespace} } func (c *FakeEnmasseV1) MessagingEndpoints(namespace string) v1.MessagingEndpointInterface { return &FakeMessagingEndpoints{c, namespace} } func (c *FakeEnmasseV1) MessagingInfrastructures(namespace string) v1.MessagingInfrastructureInterface { return &FakeMessagingInfrastructures{c, namespace} } func (c *FakeEnmasseV1) MessagingPlans(namespace string) v1.MessagingPlanInterface { return &FakeMessagingPlans{c, namespace} } func (c *FakeEnmasseV1) MessagingProjects(namespace string) v1.MessagingProjectInterface { return &FakeMessagingProjects{c, namespace} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeEnmasseV1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } ======================= File: pkg/controller/messaginginfra/broker/controller_test.go ======================= /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package broker import ( //"fmt" "context" "testing" "time" "github.com/stretchr/testify/assert" logrtesting "github.com/go-logr/logr/testing" appsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/scheme" // "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" v1 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1" "github.com/enmasseproject/enmasse/pkg/controller/messaginginfra/cert" ) func setup(t *testing.T) *BrokerController { s := scheme.Scheme s.AddKnownTypes(v1.SchemeGroupVersion, &v1.MessagingInfrastructure{}) cl := fake.NewFakeClientWithScheme(s) certController := cert.NewCertController(cl, s, 1*time.Hour, 1*time.Hour) return NewBrokerController(cl, s, certController) } func TestReconcileBrokerPool(t *testing.T) { bc := setup(t) infra := v1.MessagingInfrastructure{ ObjectMeta: metav1.ObjectMeta{Name: "infra1", Namespace: "test"}, Spec: v1.MessagingInfrastructureSpec{ Broker: v1.MessagingInfrastructureSpecBroker{ ScalingStrategy: &v1.MessagingInfrastructureSpecBrokerScalingStrategy{ Static: &v1.MessagingInfrastructureSpecBrokerScalingStrategyStatic{ PoolSize: 2, }, }, }, }, } _, err := bc.certController.ReconcileCa(context.TODO(), logrtesting.TestLogger{}, &infra) assert.Nil(t, err) hosts, err := bc.ReconcileBrokers(context.TODO(), logrtesting.TestLogger{}, &infra) assert.Nil(t, err) setList := &appsv1.StatefulSetList{} err = bc.client.List(context.TODO(), setList, client.InNamespace("test")) assert.Nil(t, err) assert.Equal(t, 2, len(setList.Items)) assert.Equal(t, 2, len(hosts)) // Scale up infra.Spec.Broker.ScalingStrategy.Static.PoolSize = 3 hosts, err = bc.ReconcileBrokers(context.TODO(), logrtesting.TestLogger{}, &infra) assert.Nil(t, err) err = bc.client.List(context.TODO(), setList, client.InNamespace("test")) assert.Nil(t, err) assert.Equal(t, 3, len(setList.Items)) assert.Equal(t, 3, len(hosts)) // Scale down infra.Spec.Broker.ScalingStrategy.Static.PoolSize = 1 hosts, err = bc.ReconcileBrokers(context.TODO(), logrtesting.TestLogger{}, &infra) assert.Nil(t, err) err = bc.client.List(context.TODO(), setList, client.InNamespace("test")) assert.Nil(t, err) assert.Equal(t, 1, len(setList.Items)) assert.Equal(t, 1, len(hosts)) } ======================= File: vendor/pack.ag/amqp/doc.go ======================= /* Package amqp provides an AMQP 1.0 client implementation. AMQP 1.0 is not compatible with AMQP 0-9-1 or 0-10, which are the most common AMQP protocols in use today. The example below shows how to use this package to connect to a Microsoft Azure Service Bus queue. */ package amqp // import "github.com/interconnectedcloud/go-amqp" ======================= File: pkg/consolegraphql/server/utils_test.go ======================= <reponame>anukritijha/enmasse /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). * */ package server import ( "github.com/stretchr/testify/assert" "sync/atomic" "testing" "time" ) func TestRunOnce(t *testing.T) { var count int32 cancel := RunAfter(time.Millisecond, func() { atomic.AddInt32(&count, 1) }) assert.Eventually(t, func() bool { return atomic.LoadInt32(&count) == 1 }, time.Second*10, time.Millisecond*100) cancel() } func TestRunOnceCancelled(t *testing.T) { var count int32 cancel := RunAfter(time.Hour, func() { atomic.AddInt32(&count, 1) }) cancel() assert.Equal(t, int32(0), atomic.LoadInt32(&count)) } ======================= File: pkg/client/informers/externalversions/admin/v1beta2/addressplan.go ======================= <reponame>anukritijha/enmasse /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by informer-gen. DO NOT EDIT. package v1beta2 import ( time "time" adminv1beta2 "github.com/enmasseproject/enmasse/pkg/apis/admin/v1beta2" versioned "github.com/enmasseproject/enmasse/pkg/client/clientset/versioned" internalinterfaces "github.com/enmasseproject/enmasse/pkg/client/informers/externalversions/internalinterfaces" v1beta2 "github.com/enmasseproject/enmasse/pkg/client/listers/admin/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" ) // AddressPlanInformer provides access to a shared informer and lister for // AddressPlans. type AddressPlanInformer interface { Informer() cache.SharedIndexInformer Lister() v1beta2.AddressPlanLister } type addressPlanInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } // NewAddressPlanInformer constructs a new informer for AddressPlan type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewAddressPlanInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredAddressPlanInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredAddressPlanInformer constructs a new informer for AddressPlan type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredAddressPlanInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions!= nil { tweakListOptions(&options) } return client.AdminV1beta2().AddressPlans(namespace).List(options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions!= nil { tweakListOptions(&options) } return client.AdminV1beta2().AddressPlans(namespace).Watch(options) }, }, &adminv1beta2.AddressPlan{}, resyncPeriod, indexers, ) } func (f *addressPlanInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewFilteredAddressPlanInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *addressPlanInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&adminv1beta2.AddressPlan{}, f.defaultInformer) } func (f *addressPlanInformer) Lister() v1beta2.AddressPlanLister { return v1beta2.NewAddressPlanLister(f.Informer().GetIndexer()) } ======================= File: pkg/consolegraphql/filter/orderby_test.go ======================= /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). * */ package filter import ( "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "testing" "time" ) func TestParseOrderBy(t *testing.T) { testCases := []struct { expr string num int }{ {"", 0}, {"`$.Foo`", 1}, {"`$.Foo` ASC", 1}, {"`$.Foo` DESC, `$.Boo`", 2}, } for _, tc := range testCases { orderBy, err := ParseOrderByExpression(tc.expr) assert.NoErrorf(t, err, "Unexpected error for case : %s", tc.expr) assert.Equal(t, tc.num, len(orderBy), "Unexpected number of order clauses for case : %s", tc.expr) } } func TestEvalOrderBy(t *testing.T) { now := time.Now() later := now.Add(1 * time.Minute) earlier := now.Add(-1 * time.Minute) earlierStill := earlier.Add(-1 * time.Second) nowv1 := metav1.NewTime(now) laterv1 := metav1.NewTime(later) earlierv1 := metav1.NewTime(earlier) earlierStillv1 := metav1.NewTime(earlierStill) type Inner struct { Bif int } type Outer struct { Bar *Inner } testCases := []struct { name string expr string data interface{} expected interface{} }{ {"alpha order", "`$.Foo`", []struct{ Foo string }{{"a"}, {"v"}, {"b"}, {"z"}}, []struct{ Foo string }{{"a"}, {"b"}, {"v"}, {"z"}}, }, {"alpha order - explicit ASC", "`$.Foo` ASC", []struct{ Foo string }{{"a"}, {"v"}, {"b"}, {"z"}}, []struct{ Foo string }{{"a"}, {"b"}, {"v"}, {"z"}}, }, {"alpha order - DESC", "`$.Foo` DESC", []struct{ Foo string }{{"a"}, {"v"}, {"b"}, {"z"}}, []struct{ Foo string }{{"z"}, {"v"}, {"b"}, {"a"}}, }, {"int order - DESC", "`$.Foo` DESC", []struct{ Foo int }{{4}, {2}, {8}, {1}}, []struct{ Foo int }{{8}, {4}, {2}, {1}}, }, {"float order", "`$.Foo`", []struct{ Foo float64 }{{4}, {2}, {8}, {1}}, []struct{ Foo float64 }{{1}, {2}, {4}, {8}}, }, {"uint order", "`$.Foo`", []struct{ Foo uint }{{4}, {2}, {8}, {1}}, []struct{ Foo uint }{{1}, {2}, {4}, {8}}, }, {"time.Time order", "`$.Foo`", []struct{ Foo time.Time }{{earlier}, {now}, {later}, {earlierStill}}, []struct{ Foo time.Time }{{earlierStill}, {earlier}, {now}, {later}}, }, {"v1.Time order", "`$.Foo`", []struct{ Foo metav1.Time }{{earlierv1}, {nowv1}, {laterv1}, {earlierStillv1}}, []struct{ Foo metav1.Time }{{earlierStillv1}, {earlierv1}, {nowv1}, {laterv1}}, }, {"nested", "`$.Bar.Bif`", []Outer{{&Inner{4}}, {&Inner{2}}, {&Inner{8}}, {&Inner{1}}}, []Outer{{&Inner{1}}, {&Inner{2}}, {&Inner{4}}, {&Inner{8}}}, }, {"nested - null first semantics", "`$.Bar.Bif`", []Outer{{&Inner{4}}, {nil}, {&Inner{8}}, {&Inner{1}}}, []Outer{{nil}, {&Inner{1}}, {&Inner{4}}, {&Inner{8}}}, }, {"two column ordering", "`$.Foo`, `$.Inner`", []struct { Foo string Baz int }{ {"a", 1}, {"v", 4}, {"a", 2}, {"z", 9}, }, []struct { Foo string Baz int }{ {"a", 1}, {"a", 2}, {"v", 4}, {"z", 9}, }}, } for _, tc := range testCases { orderBy, err := ParseOrderByExpression(tc.expr) assert.NoErrorf(t, err, "Unexpected error for case %s : %s", tc.name, tc.expr) err = orderBy.Sort(tc.data) assert.NoErrorf(t, err, "Unexpected error for case %s : %s", tc.name, tc.expr) assert.Equal(t, tc.expected, tc.data, "Unexpected results ordering for case %s : %s", tc.name, tc.expr) } } ======================= File: pkg/client/listers/enmasse/v1/messagingproject.go ======================= <gh_stars>1-10 /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by lister-gen. DO NOT EDIT. package v1 import ( v1 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // MessagingProjectLister helps list MessagingProjects. type MessagingProjectLister interface { // List lists all MessagingProjects in the indexer. List(selector labels.Selector) (ret []*v1.MessagingProject, err error) // MessagingProjects returns an object that can list and get MessagingProjects. MessagingProjects(namespace string) MessagingProjectNamespaceLister MessagingProjectListerExpansion } // messagingProjectLister implements the MessagingProjectLister interface. type messagingProjectLister struct { indexer cache.Indexer } // NewMessagingProjectLister returns a new MessagingProjectLister. func NewMessagingProjectLister(indexer cache.Indexer) MessagingProjectLister { return &messagingProjectLister{indexer: indexer} } // List lists all MessagingProjects in the indexer. func (s *messagingProjectLister) List(selector labels.Selector) (ret []*v1.MessagingProject, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { ret = append(ret, m.(*v1.MessagingProject)) }) return ret, err } // MessagingProjects returns an object that can list and get MessagingProjects. func (s *messagingProjectLister) MessagingProjects(namespace string) MessagingProjectNamespaceLister { return messagingProjectNamespaceLister{indexer: s.indexer, namespace: namespace} } // MessagingProjectNamespaceLister helps list and get MessagingProjects. type MessagingProjectNamespaceLister interface { // List lists all MessagingProjects in the indexer for a given namespace. List(selector labels.Selector) (ret []*v1.MessagingProject, err error) // Get retrieves the MessagingProject from the indexer for a given namespace and name. Get(name string) (*v1.MessagingProject, error) MessagingProjectNamespaceListerExpansion } // messagingProjectNamespaceLister implements the MessagingProjectNamespaceLister // interface. type messagingProjectNamespaceLister struct { indexer cache.Indexer namespace string } // List lists all MessagingProjects in the indexer for a given namespace. func (s messagingProjectNamespaceLister) List(selector labels.Selector) (ret []*v1.MessagingProject, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { ret = append(ret, m.(*v1.MessagingProject)) }) return ret, err } // Get retrieves the MessagingProject from the indexer for a given namespace and name. func (s messagingProjectNamespaceLister) Get(name string) (*v1.MessagingProject, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err!= nil { return nil, err } if!exists { return nil, errors.NewNotFound(v1.Resource("messagingproject"), name) } return obj.(*v1.MessagingProject), nil } ======================= File: pkg/util/x500.go ======================= /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package util import ( "crypto/x509/pkix" "encoding/asn1" "fmt" ) // Convert a name from an X509 certificate into a string // // We cannot use the Go method pkix.Name.ToString() function as // the whole name decoding logic in Go is full of assumptions which // are not correct. Go takes the RDNSequence and re-arranges and // re-encodes the entries in a way that they no longer correspond to // the original sequence. Thus we simply take the raw value, and encode // it ourselves as string. // // Also see: https://github.com/golang/go/issues/27401 func ToX500Name(asn1Name []byte) (string, error) { // prepare the sequence var name pkix.RDNSequence // unmarshal from ASN.1 rest, err := asn1.Unmarshal(asn1Name, &name) if err!= nil { return "", err } else if len(rest) > 0 { return "", fmt.Errorf("remaining bytes after decoding name (len: %d)", len(rest)) } // return the plain sequence as string return name.String(), nil } ======================= File: pkg/client/clientset/versioned/typed/iot/v1alpha1/fake/fake_iot_client.go ======================= /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1alpha1 "github.com/enmasseproject/enmasse/pkg/client/clientset/versioned/typed/iot/v1alpha1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) type FakeIotV1alpha1 struct { *testing.Fake } func (c *FakeIotV1alpha1) IoTConfigs(namespace string) v1alpha1.IoTConfigInterface { return &FakeIoTConfigs{c, namespace} } func (c *FakeIotV1alpha1) IoTProjects(namespace string) v1alpha1.IoTProjectInterface { return &FakeIoTProjects{c, namespace} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeIotV1alpha1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } ======================= File: pkg/controller/iotproject/iot_utils.go ======================= <reponame>anukritijha/enmasse /* * Copyright 2018, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package iotproject import ( "context" iotv1alpha1 "github.com/enmasseproject/enmasse/pkg/apis/iot/v1alpha1" ) func (r *ReconcileIoTProject) findIoTProjectsByPredicate(predicate func(project *iotv1alpha1.IoTProject) bool) ([]iotv1alpha1.IoTProject, error) { var result []iotv1alpha1.IoTProject list := &iotv1alpha1.IoTProjectList{} err := r.client.List(context.TODO(), list) if err!= nil { return nil, err } for _, item := range list.Items { if predicate(&item) { result = append(result, item) } } return result, nil } ======================= File: pkg/consolegraphql/watchers/manager.go ======================= <filename>pkg/consolegraphql/watchers/manager.go<gh_stars>1-10 /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). * */ package watchers import ( "crypto/tls" "github.com/enmasseproject/enmasse/pkg/consolegraphql/agent" "github.com/enmasseproject/enmasse/pkg/consolegraphql/cache" "github.com/enmasseproject/enmasse/pkg/consolegraphql/server" "k8s.io/client-go/rest" "log" "sync" "time" ) type WatcherManager interface { // starts the watcher manager but does not begin watching. must not called more than once. Start() // initiates watching if not currently watching (idempotent). BeginWatching() // ceases watching if currently watching (idempotent). EndWatching() // shuts down the watcher manager. If watchers are watching they will be stopped. must not called more than once. Shutdown() GetCollector(infra string) agent.Delegate } type command int const ( beginWatching command = iota endWatching command = iota ) type resourceManager struct { creators []func() (ResourceWatcher, error) resourcewatchers []ResourceWatcher command chan command stopped chan struct{} objectCache *cache.MemdbCache resyncInterval time.Duration config *rest.Config infraNamespace string developmentMode *bool agentCommandDelegateExpiryPeriod time.Duration agentAmqpConnectTimeout time.Duration agentAmqpMaxFrameSize uint32 collectorMux sync.Mutex collector func(infraUuid string) agent.Delegate } func New(objectCache *cache.MemdbCache, resyncInterval time.Duration, config *rest.Config, infraNamespace string, developmentMode *bool, agentCommandDelegateExpiryPeriod time.Duration, agentAmqpConnectTimeout time.Duration, agentAmqpMaxFrameSize uint32) WatcherManager { manager := &resourceManager{ command: make(chan command), stopped: make(chan struct{}), objectCache: objectCache, resyncInterval: resyncInterval, config: config, infraNamespace: infraNamespace, developmentMode: developmentMode, agentCommandDelegateExpiryPeriod: agentCommandDelegateExpiryPeriod, agentAmqpConnectTimeout: agentAmqpConnectTimeout, agentAmqpMaxFrameSize: agentAmqpMaxFrameSize, } return manager } func (rm *resourceManager) Start() { rm.creators = []func() (ResourceWatcher, error){ func() (ResourceWatcher, error) { return NewAddressSpaceWatcher(rm.objectCache, &rm.resyncInterval, AddressSpaceWatcherConfig(rm.config), AddressSpaceWatcherFactory(AddressSpaceCreate, AddressSpaceUpdate)) }, func() (ResourceWatcher, error) { return NewAddressWatcher(rm.objectCache, &rm.resyncInterval, AddressWatcherConfig(rm.config), AddressWatcherFactory(AddressCreate, AddressUpdate)) }, func() (ResourceWatcher, error) { return NewNamespaceWatcher(rm.objectCache, &rm.resyncInterval, NamespaceWatcherConfig(rm.config)) }, func() (ResourceWatcher, error) { return NewAddressSpacePlanWatcher(rm.objectCache, &rm.resyncInterval, rm.infraNamespace, AddressSpacePlanWatcherConfig(rm.config)) }, func() (ResourceWatcher, error) { return NewAddressPlanWatcher(rm.objectCache, &rm.resyncInterval, rm.infraNamespace, AddressPlanWatcherConfig(rm.config)) }, func() (ResourceWatcher, error) { return NewAuthenticationServiceWatcher(rm.objectCache, &rm.resyncInterval, rm.infraNamespace, AuthenticationServiceWatcherConfig(rm.config)) }, func() (ResourceWatcher, error) { return NewAddressSpaceSchemaWatcher(rm.objectCache, &rm.resyncInterval, AddressSpaceSchemaWatcherConfig(rm.config)) }, func() (ResourceWatcher, error) { watcherConfigs := make([]WatcherOption, 0) watcherConfigs = append(watcherConfigs, AgentWatcherServiceConfig(rm.config)) if *rm.developmentMode { watcherConfigs = append(watcherConfigs, AgentWatcherRouteConfig(rm.config)) } watcher, err := NewAgentWatcher(rm.objectCache, &rm.resyncInterval, rm.infraNamespace, func(host string, port int32, infraUuid string, addressSpace string, addressSpaceNamespace string, tlsConfig *tls.Config) agent.Delegate { return agent.NewAmqpAgentDelegate(rm.config.BearerToken, host, port, tlsConfig, addressSpaceNamespace, addressSpace, infraUuid, rm.agentCommandDelegateExpiryPeriod, rm.agentAmqpConnectTimeout, rm.agentAmqpMaxFrameSize) }, *rm.developmentMode, watcherConfigs...) rm.collectorMux.Lock() defer rm.collectorMux.Unlock() rm.collector = watcher.Collector return watcher, err }, } go func() { defer close(rm.stopped) var watching = false var cancelTask func() for { select { case event, chok := <-rm.command: if cancelTask!= nil { cancelTask() cancelTask = nil } if!chok { // command channel closed if watching { rm.endAllWatchers() watching = false } return } switch event { case beginWatching: if!watching { err := rm.beginAllWatchers() if err!= nil { log.Printf("failed to begin watchers (will retry in 1m): %s", err) cancelTask = server.RunAfter(time.Minute*1, func() { rm.BeginWatching() }) } else { watching = true } } case endWatching: if watching { rm.endAllWatchers() watching = false } } } } }() } func (rm *resourceManager) BeginWatching() { rm.command <- beginWatching } func (rm *resourceManager) EndWatching() { rm.command <- endWatching } func (rm *resourceManager) Shutdown() { close(rm.command) <-rm.stopped } func (rm *resourceManager) GetCollector(s string) agent.Delegate { // TODO: message passing to the manager would be better rm.collectorMux.Lock() defer rm.collectorMux.Unlock() return rm.collector(s) } func (rm *resourceManager) beginAllWatchers() error { rm.resourcewatchers = make([]ResourceWatcher, 0) for _, f := range rm.creators { watcher, err := f() if err!= nil { return err } rm.resourcewatchers = append(rm.resourcewatchers, watcher) err = watcher.Watch() if err!= nil { return err } } return nil } func (rm *resourceManager) endAllWatchers() { for _, w := range rm.resourcewatchers { w.Shutdown() } rm.resourcewatchers = make([]ResourceWatcher, 0) } ======================= File: pkg/controller/messaginginfra/cert/internal.go ======================= <reponame>anukritijha/enmasse /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package cert import ( "bytes" "errors" "time" "encoding/pem" "math/big" "crypto/rand" "crypto/rsa" "crypto/x509" "crypto/x509/pkix" pkcs12 "software.sslmate.com/src/go-pkcs12" ) func getCertExpiryDate(certBytes []byte) (time.Time, error) { cert, err := parsePemCertificate(certBytes) if err!= nil { return time.Time{}, err } return cert.NotAfter, nil } func generateCa(now time.Time, caKey []byte, caCert []byte, expiryDate time.Time) ([]byte, []byte, error) { var err error var caPrivateKey *rsa.PrivateKey if caKey == nil { caPrivateKey, err = rsa.GenerateKey(rand.Reader, 4096) if err!= nil { return nil, nil, err } } else { caPrivateKey, err = parsePemKey(caKey) if err!= nil { return nil, nil, err } } serialNumber := big.NewInt(2020) if caCert!= nil { existingCa, err := parsePemCertificate(caCert) if err!= nil { return nil, nil, err } serialNumber = existingCa.SerialNumber.Add(existingCa.SerialNumber, big.NewInt(1)) } ca := &x509.Certificate{ SerialNumber: serialNumber, Subject: pkix.Name{ Organization: []string{"EnMasse"}, Country: []string{"US"}, Province: []string{""}, Locality: []string{""}, StreetAddress: []string{""}, PostalCode: []string{""}, }, NotBefore: now, NotAfter: expiryDate, IsCA: true, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, BasicConstraintsValid: true, } caBytes, err := x509.CreateCertificate(rand.Reader, ca, ca, &caPrivateKey.PublicKey, caPrivateKey) if err!= nil { return nil, nil, err } encodedPemKey, err := encodePemKey(caPrivateKey) if err!= nil { return nil, nil, err } encodedPemCert, err := encodePemCert(caBytes) if err!= nil { return nil, nil, err } return encodedPemKey, encodedPemCert, nil } func generateCert(now time.Time, keyPem []byte, certPem []byte, caKeyPem []byte, caCertPem []byte, expiryDate time.Time, commonName string, dnsNames []string) ([]byte, []byte, []byte, []byte, error) { caKey, err := parsePemKey(caKeyPem) if err!= nil { return nil, nil, nil, nil, err } caCert, err := parsePemCertificate(caCertPem) if err!= nil { return nil, nil, nil, nil, err } var certPrivateKey *rsa.PrivateKey if keyPem == nil { certPrivateKey, err = rsa.GenerateKey(rand.Reader, 4096) if err!= nil { return nil, nil, nil, nil, err } } else { certPrivateKey, err = parsePemKey(keyPem) if err!= nil { return nil, nil, nil, nil, err } } serialNumber := big.NewInt(2020) if certPem!= nil { existingCert, err := parsePemCertificate(certPem) if err!= nil { return nil, nil, nil, nil, err } serialNumber = existingCert.SerialNumber.Add(existingCert.SerialNumber, big.NewInt(1)) } cert := &x509.Certificate{ SerialNumber: serialNumber, Subject: pkix.Name{ Organization: []string{"EnMasse"}, Country: []string{"US"}, Province: []string{""}, Locality: []string{""}, StreetAddress: []string{""}, CommonName: commonName, PostalCode: []string{""}, }, NotBefore: now, NotAfter: expiryDate, DNSNames: dnsNames, IsCA: false, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, SubjectKeyId: []byte{1, 2, 3, 4, 6}, KeyUsage: x509.KeyUsageDigitalSignature, BasicConstraintsValid: true, } certBytes, err := x509.CreateCertificate(rand.Reader, cert, caCert, &certPrivateKey.PublicKey, caKey) if err!= nil { return nil, nil, nil, nil, err } c, err := x509.ParseCertificate(certBytes) if err!= nil { return nil, nil, nil, nil, err } keyStore, err := pkcs12.Encode(rand.Reader, certPrivateKey, c, []*x509.Certificate{caCert}, "enmasse") if err!= nil { return nil, nil, nil, nil, err } trustStore, err := pkcs12.EncodeTrustStore(rand.Reader, []*x509.Certificate{caCert}, "enmasse") if err!= nil { return nil, nil, nil, nil, err } encodedPemKey, err := encodePemKey(certPrivateKey) if err!= nil { return nil, nil, nil, nil, err } encodedPemCert, err := encodePemCert(certBytes) if err!= nil { return nil, nil, nil, nil, err } return encodedPemKey, encodedPemCert, keyStore, trustStore, nil } func parsePemCertificate(data []byte) (*x509.Certificate, error) { block, _ := pem.Decode(data) if block == nil { return nil, errors.New("Failed to parse PEM certificate") } cert, err := x509.ParseCertificate(block.Bytes) return cert, err } func parsePemKey(data []byte) (*rsa.PrivateKey, error) { block, _ := pem.Decode(data) if block == nil { return nil, errors.New("Failed to parse PEM private key") } key, err := x509.ParsePKCS1PrivateKey(block.Bytes) return key, err } func encodePemKey(key *rsa.PrivateKey) ([]byte, error) { certPrivateKeyPem := new(bytes.Buffer) err := pem.Encode(certPrivateKeyPem, &pem.Block{ Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key), }) if err!= nil { return nil, err } return certPrivateKeyPem.Bytes(), nil } func encodePemCert(certBytes []byte) ([]byte, error) { certPem := new(bytes.Buffer) err := pem.Encode(certPem, &pem.Block{ Type: "CERTIFICATE", Bytes: certBytes, }) if err!= nil { return nil, err } return certPem.Bytes(), nil } ======================= File: pkg/state/broker/broker_test.go ======================= /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package broker import ( "testing" "time" "github.com/stretchr/testify/assert" fakecommand "github.com/enmasseproject/enmasse/pkg/amqpcommand/test" . "github.com/enmasseproject/enmasse/pkg/state/common" "pack.ag/amqp" ) func TestInitializeBroker(t *testing.T) { client := fakecommand.NewFakeClient() state := &BrokerState{ host: Host{}, port: 0, initialized: false, commandClient: client, entities: make(map[BrokerEntityType]map[string]BrokerEntity, 0), } client.Handler = func(req *amqp.Message) (*amqp.Message, error) { op := req.ApplicationProperties["_AMQ_OperationName"] if op == "getAddressSettingsAsJSON" { return &amqp.Message{ ApplicationProperties: map[string]interface{}{"_AMQ_OperationSucceeded": true}, Value: "[]", }, nil } else { return &amqp.Message{ ApplicationProperties: map[string]interface{}{"_AMQ_OperationSucceeded": true}, Value: "[[\"queue1\",\"queue2\"]]", }, nil } } err := state.Initialize(time.Time{}) assert.Nil(t, err) assert.NotNil(t, state.entities) assert.Equal(t, 2, len(state.entities[BrokerQueueEntity])) assert.NotNil(t, state.entities[BrokerQueueEntity]["queue1"]) assert.NotNil(t, state.entities[BrokerQueueEntity]["queue2"]) } ======================= File: vendor/github.com/vektah/gqlparser/v2/validator/rules/known_argument_names.go ======================= <gh_stars>100-1000 package validator import ( "github.com/vektah/gqlparser/v2/ast" . "github.com/vektah/gqlparser/v2/validator" ) func init() { AddRule("KnownArgumentNames", func(observers *Events, addError AddErrFunc) { // A GraphQL field is only valid if all supplied arguments are defined by that field. observers.OnField(func(walker *Walker, field *ast.Field) { if field.Definition == nil || field.ObjectDefinition == nil { return } for _, arg := range field.Arguments { def := field.Definition.Arguments.ForName(arg.Name) if def!= nil { continue } var suggestions []string for _, argDef := range field.Definition.Arguments { suggestions = append(suggestions, argDef.Name) } addError( Message(`Unknown argument "%s" on field "%s" of type "%s".`, arg.Name, field.Name, field.ObjectDefinition.Name), SuggestListQuoted("Did you mean", arg.Name, suggestions), At(field.Position), ) } }) observers.OnDirective(func(walker *Walker, directive *ast.Directive) { if directive.Definition == nil { return } for _, arg := range directive.Arguments { def := directive.Definition.Arguments.ForName(arg.Name) if def!= nil { continue } var suggestions []string for _, argDef := range directive.Definition.Arguments { suggestions = append(suggestions, argDef.Name) } addError( Message(`Unknown argument "%s" on directive "@%s".`, arg.Name, directive.Name), SuggestListQuoted("Did you mean", arg.Name, suggestions), At(directive.Position), ) } }) }) } ======================= File: pkg/client/clientset/versioned/typed/iot/v1alpha1/fake/fake_iotconfig.go ======================= <filename>pkg/client/clientset/versioned/typed/iot/v1alpha1/fake/fake_iotconfig.go /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by client-gen. DO NOT EDIT. package fake import ( v1alpha1 "github.com/enmasseproject/enmasse/pkg/apis/iot/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" ) // FakeIoTConfigs implements IoTConfigInterface type FakeIoTConfigs struct { Fake *FakeIotV1alpha1 ns string } var iotconfigsResource = schema.GroupVersionResource{Group: "iot.enmasse.io", Version: "v1alpha1", Resource: "iotconfigs"} var iotconfigsKind = schema.GroupVersionKind{Group: "iot.enmasse.io", Version: "v1alpha1", Kind: "IoTConfig"} // Get takes name of the ioTConfig, and returns the corresponding ioTConfig object, and an error if there is any. func (c *FakeIoTConfigs) Get(name string, options v1.GetOptions) (result *v1alpha1.IoTConfig, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(iotconfigsResource, c.ns, name), &v1alpha1.IoTConfig{}) if obj == nil { return nil, err } return obj.(*v1alpha1.IoTConfig), err } // List takes label and field selectors, and returns the list of IoTConfigs that match those selectors. func (c *FakeIoTConfigs) List(opts v1.ListOptions) (result *v1alpha1.IoTConfigList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(iotconfigsResource, iotconfigsKind, c.ns, opts), &v1alpha1.IoTConfigList{}) if obj == nil { return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &v1alpha1.IoTConfigList{ListMeta: obj.(*v1alpha1.IoTConfigList).ListMeta} for _, item := range obj.(*v1alpha1.IoTConfigList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } } return list, err } // Watch returns a watch.Interface that watches the requested ioTConfigs. func (c *FakeIoTConfigs) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(iotconfigsResource, c.ns, opts)) } // Create takes the representation of a ioTConfig and creates it. Returns the server's representation of the ioTConfig, and an error, if there is any. func (c *FakeIoTConfigs) Create(ioTConfig *v1alpha1.IoTConfig) (result *v1alpha1.IoTConfig, err error) { obj, err := c.Fake. Invokes(testing.NewCreateAction(iotconfigsResource, c.ns, ioTConfig), &v1alpha1.IoTConfig{}) if obj == nil { return nil, err } return obj.(*v1alpha1.IoTConfig), err } // Update takes the representation of a ioTConfig and updates it. Returns the server's representation of the ioTConfig, and an error, if there is any. func (c *FakeIoTConfigs) Update(ioTConfig *v1alpha1.IoTConfig) (result *v1alpha1.IoTConfig, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(iotconfigsResource, c.ns, ioTConfig), &v1alpha1.IoTConfig{}) if obj == nil { return nil, err } return obj.(*v1alpha1.IoTConfig), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). func (c *FakeIoTConfigs) UpdateStatus(ioTConfig *v1alpha1.IoTConfig) (*v1alpha1.IoTConfig, error) { obj, err := c.Fake. Invokes(testing.NewUpdateSubresourceAction(iotconfigsResource, "status", c.ns, ioTConfig), &v1alpha1.IoTConfig{}) if obj == nil { return nil, err } return obj.(*v1alpha1.IoTConfig), err } // Delete takes name of the ioTConfig and deletes it. Returns an error if one occurs. func (c *FakeIoTConfigs) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. Invokes(testing.NewDeleteAction(iotconfigsResource, c.ns, name), &v1alpha1.IoTConfig{}) return err } // DeleteCollection deletes a collection of objects. func (c *FakeIoTConfigs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(iotconfigsResource, c.ns, listOptions) _, err := c.Fake.Invokes(action, &v1alpha1.IoTConfigList{}) return err } // Patch applies the patch and returns the patched ioTConfig. func (c *FakeIoTConfigs) Patch(name string, pt types.PatchType, data []byte, subresources...string) (result *v1alpha1.IoTConfig, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(iotconfigsResource, c.ns, name, pt, data, subresources...), &v1alpha1.IoTConfig{}) if obj == nil { return nil, err } return obj.(*v1alpha1.IoTConfig), err } ======================= File: pkg/util/openshift_test.go ======================= <gh_stars>1-10 /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package util import ( "k8s.io/apimachinery/pkg/runtime/schema" "os" "testing" ) func TestHasApiWithEnvTrue(t *testing.T) { // reset cache before testing apis = make(map[string]bool, 0) name := "ENMASSE_HAS_API_FOO.BAR_V0ALPHA0_BAZ" if err := os.Setenv(name, "true"); err!= nil { t.Error(err) return } if!HasApi(schema.GroupVersionKind{ Group: "foo.bar", Version: "v0alpha0", Kind: "Baz", }) { t.Error("Result should be 'true'") } if err := os.Unsetenv(name); err!= nil { t.Error(err) return } } func TestHasApiWithEnvFalse(t *testing.T) { // reset cache before testing apis = make(map[string]bool, 0) name := "ENMASSE_HAS_API_FOO.BAR_V0ALPHA0_BAZ" if err := os.Setenv(name, "false"); err!= nil { t.Error(err) return } if HasApi(schema.GroupVersionKind{ Group: "foo.bar", Version: "v0alpha0", Kind: "Baz", }) { t.Error("Result should be 'false'") } if err := os.Unsetenv(name); err!= nil { t.Error(err) return } } ======================= File: pkg/client/listers/admin/v1beta2/addressplan.go ======================= /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by lister-gen. DO NOT EDIT. package v1beta2 import ( v1beta2 "github.com/enmasseproject/enmasse/pkg/apis/admin/v1beta2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // AddressPlanLister helps list AddressPlans. type AddressPlanLister interface { // List lists all AddressPlans in the indexer. List(selector labels.Selector) (ret []*v1beta2.AddressPlan, err error) // AddressPlans returns an object that can list and get AddressPlans. AddressPlans(namespace string) AddressPlanNamespaceLister AddressPlanListerExpansion } // addressPlanLister implements the AddressPlanLister interface. type addressPlanLister struct { indexer cache.Indexer } // NewAddressPlanLister returns a new AddressPlanLister. func NewAddressPlanLister(indexer cache.Indexer) AddressPlanLister { return &addressPlanLister{indexer: indexer} } // List lists all AddressPlans in the indexer. func (s *addressPlanLister) List(selector labels.Selector) (ret []*v1beta2.AddressPlan, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { ret = append(ret, m.(*v1beta2.AddressPlan)) }) return ret, err } // AddressPlans returns an object that can list and get AddressPlans. func (s *addressPlanLister) AddressPlans(namespace string) AddressPlanNamespaceLister { return addressPlanNamespaceLister{indexer: s.indexer, namespace: namespace} } // AddressPlanNamespaceLister helps list and get AddressPlans. type AddressPlanNamespaceLister interface { // List lists all AddressPlans in the indexer for a given namespace. List(selector labels.Selector) (ret []*v1beta2.AddressPlan, err error) // Get retrieves the AddressPlan from the indexer for a given namespace and name. Get(name string) (*v1beta2.AddressPlan, error) AddressPlanNamespaceListerExpansion } // addressPlanNamespaceLister implements the AddressPlanNamespaceLister // interface. type addressPlanNamespaceLister struct { indexer cache.Indexer namespace string } // List lists all AddressPlans in the indexer for a given namespace. func (s addressPlanNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.AddressPlan, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { ret = append(ret, m.(*v1beta2.AddressPlan)) }) return ret, err } // Get retrieves the AddressPlan from the indexer for a given namespace and name. func (s addressPlanNamespaceLister) Get(name string) (*v1beta2.AddressPlan, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err!= nil { return nil, err } if!exists { return nil, errors.NewNotFound(v1beta2.Resource("addressplan"), name) } return obj.(*v1beta2.AddressPlan), nil } ======================= File: pkg/util/openshift.go ======================= /* * Copyright 2019-2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package util import ( "context" "encoding/json" "fmt" userapiv1 "github.com/openshift/api/user/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/version" "k8s.io/client-go/kubernetes" "net/url" "os" "regexp" "sigs.k8s.io/controller-runtime/pkg/client" "strconv" "strings" "time" "sigs.k8s.io/controller-runtime/pkg/client/config" routev1 "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1" logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" ) var ( openshift *bool openshift4 *bool apis = make(map[string]bool, 0) log = logf.Log.WithName("util") ) const ConnectsTo = "app.openshift.io/connects-to" const EnMasseOpenshiftEnvVar = "ENMASSE_OPENSHIFT" const EnMasseOpenshift4EnvVar = "ENMASSE_OPENSHIFT4" var UserGVK = userapiv1.GroupVersion.WithKind("User") func IsOpenshift() bool { if openshift == nil { b := detectOpenshift() openshift = &b } return *openshift } // detect if we are running on openshift 4 func IsOpenshift4() bool { if openshift4 == nil { b := detectOpenshift4() openshift4 = &b } return *openshift4 } func HasApi(gvk schema.GroupVersionKind) bool { if has, ok := apis[gvk.String()]; ok { return has } has := detectApi(gvk) apis[gvk.String()] = has return has } func detectApi(gvk schema.GroupVersionKind) bool { name := fmt.Sprintf("ENMASSE_HAS_API_%s_%s_%s", strings.ToUpper(gvk.Group), strings.ToUpper(gvk.Version), strings.ToUpper(gvk.Kind)) value, ok := os.LookupEnv(name) if ok { log.Info("Set by env-var '" + name + "': " + value) return strings.ToLower(value) == "true" } cfg, err := config.GetConfig() if err!= nil { log.Error(err, "Error getting config") return false } cli, err := client.New(cfg, client.Options{}) if err!= nil { log.Error(err, "Failed to create new client") return false } namespace, err := GetInfrastructureNamespace() if err!= nil { log.Info("Infra namespace not defined, cannot detect api") return false } var probeApi func() error if gvk == UserGVK { // special case the User API as listing user will not normally be permitted (or possible) get := unstructured.Unstructured{} get.SetGroupVersionKind(gvk) probeApi = func() error { err := cli.Get(context.Background(), client.ObjectKey{Namespace: namespace, Name: "~"}, &get) log.V(2).Info(fmt.Sprintf("Body: %v", get)) return err } } else { list := unstructured.UnstructuredList{} list.SetGroupVersionKind(gvk) probeApi = func() error { err := cli.List(context.Background(), &list, client.Limit(1), client.InNamespace(namespace)) log.V(2).Info(fmt.Sprintf("Body: %v", list)) return err } } get := unstructured.Unstructured{} get.SetGroupVersionKind(gvk) retries := 10 for retries > 0 { log.Info("Start probing API", "groupVersionKind", gvk) err = probeApi() log.Info("Request error", "error", err) if err == nil { return true } se, ok := err.(*errors.StatusError) if ok { code := se.Status().Code log.Info(fmt.Sprintf("Response code: %d", code)) if code!= 503 { return code >= 200 && code < 300 } } retries -= 1 time.Sleep(2 * time.Second) } return false } func detectOpenshift() bool { log.Info("Detect if openshift is running") value, ok := os.LookupEnv(EnMasseOpenshiftEnvVar) if ok { log.Info("Set by env-var '" + EnMasseOpenshiftEnvVar + "': " + value) return strings.ToLower(value) == "true" } return HasApi(UserGVK) } func detectOpenshift4() bool { log.Info("Detect if openshift 4 is running") value, ok := os.LookupEnv(EnMasseOpenshift4EnvVar) if ok { log.Info("Set by env-var '" + EnMasseOpenshift4EnvVar + "': " + value) return strings.ToLower(value) == "true" } if!IsOpenshift() { // we not running on any version of OpenShift return false } cfg, err := config.GetConfig() if err!= nil { log.Error(err, "Error getting config") return false } cli, err := kubernetes.NewForConfig(cfg) if err!= nil { log.Error(err, "Error creating client") return false } var v *version.Info retries := 10 for retries > 0 { v, err = cli.ServerVersion() if err == nil && v!= nil { break } retries-- } if err!= nil || v == nil { log.Error(err, "Error getting kubernetes version") return false } log.Info("Version Info", "version", v, "major", v.Major, "minor", v.Minor) m, err := regexp.MatchString(`^\d+\+$`, v.Minor) if err!= nil { panic(fmt.Sprintf("Failed to compile regexp for version check: %v", err)) } if!m { log.Error(err, "Unknown kubernetes version format") return false } minor, err := strconv.ParseInt(strings.TrimRight(v.Minor, "+"), 10, 32) if err!= nil { log.Error(err, "Error parsing kubernetes version") return false } return v.Major == "1" && minor > 11 } func OpenshiftUri() (*url.URL, bool, error) { data, err := WellKnownOauthMetadata() if err!= nil { log.Error(err, "Error getting well-known OAuth metadata: %v") return nil, false, err } openshiftUrl := data["issuer"].(string) rewritten := false // When oc cluster is run without a --public-hostname= argument, openshiftUrl will refer to a loopback, which // cannot be used from within a pod. This works around this problem. if openshiftUrl == "" || strings.Contains(openshiftUrl, "https://localhost:8443") || strings.Contains(openshiftUrl, "https://127.0.0.1:8443") { openshiftUrl = fmt.Sprintf("https://%s:%s", GetEnvOrDefault("KUBERNETES_SERVICE_HOST", "172.30.0.1"), GetEnvOrDefault("KUBERNETES_SERVICE_PORT", "443")) rewritten = true } u, err := url.Parse(openshiftUrl) if err!= nil { return nil, false, err } return u, rewritten, nil } func WellKnownOauthMetadata() (map[string]interface{}, error) { cfg, err := config.GetConfig() if err!= nil { log.Error(err, "Error getting config: %v") return nil, err } cli, err := routev1.NewForConfig(cfg) if err!= nil { return nil, err } result := cli.RESTClient().Get().AbsPath("/.well-known/oauth-authorization-server").Do() if err := result.Error(); err!= nil { return nil, err } ret, err := result.Raw() if err!= nil { return nil, err } data := make(map[string]interface{}) err = json.Unmarshal(ret, &data) if err!= nil { return nil, err } return data, nil } ======================= File: scripts/tools.go ======================= <reponame>anukritijha/enmasse // +build tools package tools // Keeps the code generator dependency known to Go modules (otherwise go mod tidy will remove them) // https://github.com/golang/go/issues/27899 import ( _ "k8s.io/code-generator/cmd/client-gen" _ "k8s.io/code-generator/cmd/deepcopy-gen" _ "k8s.io/code-generator/cmd/defaulter-gen" _ "k8s.io/code-generator/cmd/informer-gen" _ "k8s.io/code-generator/cmd/lister-gen" ) ======================= File: pkg/util/altclient/forwarding.go ======================= /* * Copyright 2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package altclient import ( "context" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/client" ) type forwardingClient struct { reader client.Reader writer client.Writer status client.StatusWriter } var _ client.Client = &forwardingClient{} func NewForwarding(reader client.Reader, writer client.Writer, status client.StatusWriter) client.Client { return forwardingClient{ reader: reader, writer: writer, status: status, } } func (f forwardingClient) Get(ctx context.Context, key client.ObjectKey, obj runtime.Object) error { return f.reader.Get(ctx, key, obj) } func (f forwardingClient) List(ctx context.Context, list runtime.Object, opts...client.ListOption) error { return f.reader.List(ctx, list, opts...) } func (f forwardingClient) Create(ctx context.Context, obj runtime.Object, opts...client.CreateOption) error { return f.writer.Create(ctx, obj, opts...) } func (f forwardingClient) Delete(ctx context.Context, obj runtime.Object, opts...client.DeleteOption) error { return f.writer.Delete(ctx, obj, opts...) } func (f forwardingClient) Update(ctx context.Context, obj runtime.Object, opts...client.UpdateOption) error { return f.writer.Update(ctx, obj, opts...) } func (f forwardingClient) Patch(ctx context.Context, obj runtime.Object, patch client.Patch, opts...client.PatchOption) error { return f.writer.Patch(ctx, obj, patch, opts...) } func (f forwardingClient) DeleteAllOf(ctx context.Context, obj runtime.Object, opts...client.DeleteAllOfOption) error { return f.writer.DeleteAllOf(ctx, obj, opts...) } func (f forwardingClient) Status() client.StatusWriter { return f.status } ======================= File: pkg/util/install/hash.go ======================= /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package install import ( "context" "github.com/enmasseproject/enmasse/pkg/util" "github.com/enmasseproject/enmasse/pkg/util/cchange" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "sigs.k8s.io/controller-runtime/pkg/client" ) // Get the hash of the content of a config map, and apply this to the pod so // that a change in the content of the config map will trigger a re-rollout. func ApplyConfigMapHash(c client.Client, pod *corev1.PodTemplateSpec, annotationName string, namespace string, configMapName string, keys...string) error { cm := &corev1.ConfigMap{} // fetch secret if err := c.Get(context.Background(), client.ObjectKey{Namespace: namespace, Name: configMapName}, cm); err!= nil { if apierrors.IsNotFound(err) { // we could pause reconciling until the config map is provided return util.NewConfigurationError("ConfigMap '" + configMapName + "' missing for deployment") } return err } // create hash rec := cchange.NewRecorder() if len(keys) == 0 { rec.AddStringsFromMap(cm.Data) } else { for _, k := range keys { if v, ok := cm.Data[k]; ok { rec.AddString(v) } else { return util.NewConfigurationError("Missing key '%s' in data section of ConfigMap %s/%s", k, namespace, configMapName) } } } // store hash setHashInformation(pod, annotationName, rec) // done return nil } // Get the hash of the content of a secret, and apply this to the pod so // that a change in the content of the secret will trigger a re-rollout. func ApplySecretHash(c client.Client, pod *corev1.PodTemplateSpec, annotationName string, namespace string, secretName string, keys...string) error { secret := &corev1.Secret{} // fetch secret if err := c.Get(context.Background(), client.ObjectKey{Namespace: namespace, Name: secretName}, secret); err!= nil { if apierrors.IsNotFound(err) { // we could pause reconciling until the secret is provided return util.NewConfigurationError("Secret '" + secretName + "' missing for deployment") } return err } // create hash rec := cchange.NewRecorder() if len(keys) == 0 { rec.AddBytesFromMap(secret.Data) } else { for _, k := range keys { if v, ok := secret.Data[k]; ok { rec.AddBytes(v) } else { return util.NewConfigurationError("Missing key '%s' in data section of Secret %s/%s", k, namespace, secretName) } } } // store hash setHashInformation(pod, annotationName, rec) // done return nil } func setHashInformation(pod *corev1.PodTemplateSpec, labelName string, rec *cchange.ConfigChangeRecorder) { if pod.Annotations == nil { pod.Annotations = make(map[string]string) } pod.Annotations[labelName] = rec.HashString() } ======================= File: pkg/controller/iotconfig/jdbc_device_registry.go ======================= /* * Copyright 2019-2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package iotconfig import ( "context" "github.com/enmasseproject/enmasse/pkg/util" "github.com/enmasseproject/enmasse/pkg/util/cchange" "github.com/enmasseproject/enmasse/pkg/util/ext" "github.com/enmasseproject/enmasse/pkg/util/recon" "github.com/ghodss/yaml" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/reconcile" "github.com/enmasseproject/enmasse/pkg/util/install" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" iotv1alpha1 "github.com/enmasseproject/enmasse/pkg/apis/iot/v1alpha1" ) // this aligns with the Java side properties type JdbcDeviceProperties struct { Adapter *iotv1alpha1.JdbcConnectionInformation `json:"adapter,omitempty"` Management *iotv1alpha1.JdbcConnectionInformation `json:"management,omitempty"` } func (r *ReconcileIoTConfig) processJdbcDeviceRegistry(ctx context.Context, config *iotv1alpha1.IoTConfig, authServicePsk *cchange.ConfigChangeRecorder) (reconcile.Result, error) { rc := &recon.ReconcileContext{} change := cchange.NewRecorder() if config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Management!= nil && config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Adapter == nil { // combined deployment rc.ProcessSimple(func() error { return r.processConfigMap(ctx, nameDeviceRegistry+"-config", config, false, func(config *iotv1alpha1.IoTConfig, configMap *corev1.ConfigMap) error { service := config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Management return r.reconcileJdbcDeviceRegistryConfigMap(config, service, configMap, change) }) }) rc.ProcessSimple(func() error { return r.processDeployment(ctx, nameDeviceRegistry, config, false, func(config *iotv1alpha1.IoTConfig, deployment *appsv1.Deployment) error { return r.reconcileCommonJdbcDeviceRegistryDeployment( config, deployment, change, authServicePsk, config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Management.ServiceConfig, config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Management.CommonServiceConfig, nameDeviceRegistry, nameDeviceRegistry+"-config", "registry-adapter,registry-management", true, true, ) }) }) // delete extra management rc.Delete(ctx, r.client, &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: config.Namespace, Name: nameDeviceRegistryManagement + "-config"}}) rc.Delete(ctx, r.client, &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Namespace: config.Namespace, Name: nameDeviceRegistryManagement}}) } else if config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Management!= nil && config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Adapter!= nil { // split deployment rc.ProcessSimple(func() error { return r.processConfigMap(ctx, nameDeviceRegistry+"-config", config, false, func(config *iotv1alpha1.IoTConfig, configMap *corev1.ConfigMap) error { service := config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Adapter return r.reconcileJdbcDeviceRegistryConfigMap(config, service, configMap, change) }) }) rc.ProcessSimple(func() error { return r.processConfigMap(ctx, nameDeviceRegistryManagement+"-config", config, false, func(config *iotv1alpha1.IoTConfig, configMap *corev1.ConfigMap) error { service := config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Management return r.reconcileJdbcDeviceRegistryConfigMap(config, service, configMap, change) }) }) rc.ProcessSimple(func() error { return r.processDeployment(ctx, nameDeviceRegistry, config, false, func(config *iotv1alpha1.IoTConfig, deployment *appsv1.Deployment) error { return r.reconcileCommonJdbcDeviceRegistryDeployment( config, deployment, change, authServicePsk, config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Adapter.ServiceConfig, config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Adapter.CommonServiceConfig, nameDeviceRegistry, nameDeviceRegistry+"-config", "registry-adapter", true, false, ) }) }) rc.ProcessSimple(func() error { return r.processDeployment(ctx, nameDeviceRegistryManagement, config, false, func(config *iotv1alpha1.IoTConfig, deployment *appsv1.Deployment) error { return r.reconcileCommonJdbcDeviceRegistryDeployment( config, deployment, change, authServicePsk, config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Management.ServiceConfig, config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Management.CommonServiceConfig, nameDeviceRegistryManagement, nameDeviceRegistryManagement+"-config", "registry-management", false, true, ) }) }) } else if config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Management == nil && config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Adapter!= nil { // read-only deployment rc.ProcessSimple(func() error { return r.processConfigMap(ctx, nameDeviceRegistry+"-config", config, false, func(config *iotv1alpha1.IoTConfig, configMap *corev1.ConfigMap) error { service := config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Adapter return r.reconcileJdbcDeviceRegistryConfigMap(config, service, configMap, change) }) }) rc.ProcessSimple(func() error { return r.processDeployment(ctx, nameDeviceRegistry, config, false, func(config *iotv1alpha1.IoTConfig, deployment *appsv1.Deployment) error { return r.reconcileCommonJdbcDeviceRegistryDeployment( config, deployment, change, authServicePsk, config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Adapter.ServiceConfig, config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External.Adapter.CommonServiceConfig, nameDeviceRegistry, nameDeviceRegistry+"-config", "registry-adapter", true, false, ) }) }) // delete extra management rc.Delete(ctx, r.client, &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Namespace: config.Namespace, Name: nameDeviceRegistryManagement + "-config"}}) rc.Delete(ctx, r.client, &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Namespace: config.Namespace, Name: nameDeviceRegistryManagement}}) } else { return reconcile.Result{}, util.NewConfigurationError("illegal device registry configuration") } // done return rc.Result() } func (r *ReconcileIoTConfig) reconcileCommonJdbcDeviceRegistryDeployment( config *iotv1alpha1.IoTConfig, deployment *appsv1.Deployment, change *cchange.ConfigChangeRecorder, authServicePsk *cchange.ConfigChangeRecorder, serviceConfig iotv1alpha1.ServiceConfig, commonConfig iotv1alpha1.CommonServiceConfig, serviceNameForTls string, configMapName string, profiles string, adapter bool, management bool, ) error { install.ApplyDeploymentDefaults(deployment, "iot", deployment.Name) deployment.Annotations[RegistryTypeAnnotation] = "jdbc" deployment.Annotations[util.ConnectsTo] = "iot-auth-service" deployment.Spec.Template.Spec.ServiceAccountName = "iot-device-registry" deployment.Spec.Template.Annotations[RegistryTypeAnnotation] = "jdbc" service := config.Spec.ServicesConfig.DeviceRegistry applyDefaultDeploymentConfig(deployment, serviceConfig, change) cchange.ApplyTo(authServicePsk, "iot.enmasse.io/auth-psk-hash", &deployment.Spec.Template.Annotations) // container var tracingContainer *corev1.Container err := install.ApplyDeploymentContainerWithError(deployment, "device-registry", func(container *corev1.Container) error { tracingContainer = container if err := install.SetContainerImage(container, "iot-device-registry-jdbc", config); err!= nil { return err } container.Args = []string{"/iot-device-registry-jdbc.jar"} container.Command = nil // set default resource limits container.Resources = corev1.ResourceRequirements{ Limits: corev1.ResourceList{ corev1.ResourceMemory: *resource.NewQuantity(512*1024*1024 /* 512Mi */, resource.BinarySI), }, } container.Ports = []corev1.ContainerPort{ {Name: "amqps", ContainerPort: 5671, Protocol: corev1.ProtocolTCP}, {Name: "http", ContainerPort: 8080, Protocol: corev1.ProtocolTCP}, {Name: "https", ContainerPort: 8443, Protocol: corev1.ProtocolTCP}, } container.Ports = appendHonoStandardPorts(container.Ports) SetHonoProbes(container) // environment container.Env = []corev1.EnvVar{ {Name: "SPRING_CONFIG_LOCATION", Value: "file:///etc/config/"}, {Name: "SPRING_PROFILES_ACTIVE", Value: profiles}, {Name: "LOGGING_CONFIG", Value: "file:///etc/config/logback-spring.xml"}, {Name: "KUBERNETES_NAMESPACE", ValueFrom: install.FromFieldNamespace()}, {Name: "HONO_AUTH_HOST", Value: FullHostNameForEnvVar("iot-auth-service")}, {Name: "HONO_AUTH_VALIDATION_SHARED_SECRET", ValueFrom: install.FromSecret(nameAuthServicePskSecret, keyInterServicePsk)}, } install.ApplyOrRemoveEnvSimple(container, "ENMASSE_IOT_REST_AUTH_TOKEN_CACHE_EXPIRATION", service.JDBC.Management.AuthTokenCacheExpiration) applyServiceConnectionOptions(container, "HONO_AUTH", config.Spec.ServicesConfig.Authentication.TlsVersions(config)) appendCommonHonoJavaEnv(container, "ENMASSE_IOT_AMQP_", config, &commonConfig) appendCommonHonoJavaEnv(container, "ENMASSE_IOT_REST_", config, &commonConfig) AppendStandardHonoJavaOptions(container) // append trust stores if err := AppendTrustStores(config, container, []string{"HONO_AUTH_TRUST_STORE_PATH"}); err!= nil { return err } // volume mounts install.ApplyVolumeMountSimple(container, "config", "/etc/config", true) if adapter { install.ApplyVolumeMountSimple(container, "tls", "/etc/tls-internal", true) } else { install.DropVolumeMount(container, "tls") } if management { install.ApplyVolumeMountSimple(container, "tls-endpoint", "/etc/tls-external", true) } else { install.DropVolumeMount(container, "tls-endpoint") } install.DropVolumeMount(container, "registry") // extensions ext.MapExtensionVolume(container) // apply container options if service.JDBC!= nil { applyContainerConfig(container, commonConfig.Container.ContainerConfig) } // return return nil }) if err!= nil { return err } // extension containers if service.JDBC.Server.External!= nil { if err := ext.AddExtensionContainers(service.JDBC.Server.External.Extensions, &deployment.Spec.Template.Spec, "ext-"); err!= nil { return err } } else { // we don't support any init containers deployment.Spec.Template.Spec.InitContainers = nil } // tracing SetupTracing(config, deployment, tracingContainer) // volumes install.ApplyConfigMapVolume(&deployment.Spec.Template.Spec, "config", configMapName) install.DropVolume(&deployment.Spec.Template.Spec, "registry") ext.AddExtensionVolume(&deployment.Spec.Template.Spec) // inter service secrets var interServiceName string if adapter { // only set when we have an internal service (adapter facing service) interServiceName = serviceNameForTls } else { interServiceName = "" } if err := ApplyInterServiceForDeployment(r.client, config, deployment, tlsServiceKeyVolumeName, interServiceName); err!= nil { return err } // endpoint if management { // if the management part is enabled, set the management endpoint if err := applyEndpointDeployment(r.client, service.Management.Endpoint, deployment, serviceNameForTls, "tls-endpoint"); err!= nil { return err } } // return return nil } func ExternalJdbcRegistryConnections(config *iotv1alpha1.IoTConfig) (*JdbcDeviceProperties, error) { // apply JDBC server options service := config.Spec.ServicesConfig.DeviceRegistry.JDBC.Server.External if service.Management!= nil && service.Adapter == nil { // combined mode return &JdbcDeviceProperties{ Adapter: &service.Management.Connection, Management: &service.Management.Connection, }, nil } else if service.Management!= nil && service.Adapter!= nil { // split mode return &JdbcDeviceProperties{ Adapter: &service.Adapter.Connection, Management: &service.Management.Connection, }, nil } else if service.Management == nil && service.Adapter!= nil { // read only mode return &JdbcDeviceProperties{ Adapter: &service.Adapter.Connection, Management: nil, // remains nil }, nil } else { return nil, util.NewConfigurationError("illegal device registry configuration") } } func (r *ReconcileIoTConfig) reconcileJdbcDeviceRegistryConfigMap(config *iotv1alpha1.IoTConfig, service *iotv1alpha1.ExternalJdbcRegistryService, configMap *corev1.ConfigMap, change *cchange.ConfigChangeRecorder) error { install.ApplyDefaultLabels(&configMap.ObjectMeta, "iot", configMap.Name) if configMap.Data == nil { configMap.Data = make(map[string]string) } configMap.Data["logback-spring.xml"] = service.RenderConfiguration(config, logbackDefault, configMap.Data["logback-custom.xml"]) devices, err := ExternalJdbcRegistryConnections(config) if err!= nil { return err } // app config sections app := map[string]interface{}{ "hono": map[string]interface{}{ "auth": map[string]interface{}{ "port": 5671, "keyPath": "/etc/tls/tls.key", "certPath": "/etc/tls/tls.crt", "keyFormat": "PEM", "trustStorePath": "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt", "trustStoreFormat": "PEM", }, }, "enmasse": map[string]interface{}{ "iot": map[string]interface{}{ "app": map[string]interface{}{ "maxInstances": 1, }, "vertx": map[string]interface{}{ "preferNative": true, }, "healthCheck": map[string]interface{}{ "insecurePortBindAddress": "0.0.0.0", "startupTimeout": 90, }, "registry": map[string]interface{}{ "device": map[string]interface{}{ "credentials": map[string]interface{}{ "ttl": "1m", }, }, "jdbc": devices, }, "credentials": map[string]interface{}{ "credentials": map[string]interface{}{ "svc": map[string]interface{}{ "maxBcryptIterations": 10, }, }, }, "amqp": map[string]interface{}{ "bindAddress": "0.0.0.0", "keyPath": "/etc/tls-internal/tls.key", "certPath": "/etc/tls-internal/tls.crt", "keyFormat": "PEM", }, "rest": map[string]interface{}{ "bindAddress": "0.0.0.0", "keyPath": "/etc/tls-external/tls.key", "certPath": "/etc/tls-external/tls.crt", "keyFormat": "PEM", }, }, }, } // encode app config appStr, err := yaml.Marshal(app) if err!= nil { return err } configMap.Data["application.yml"] = string(appStr) // config change change.AddStringsFromMap(configMap.Data, "application.yml", "logback-spring.xml") // return ok return nil } ======================= File: pkg/apis/iot/v1alpha1/interfaces.go ======================= <reponame>anukritijha/enmasse /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package v1alpha1 type CommonJavaContainerOptions interface { IsNativeTlsRequired(config *IoTConfig) bool TlsVersions(config *IoTConfig) []string } // ensure we implement the interface var _ CommonJavaContainerOptions = &CommonAdapterConfig{} var _ CommonJavaContainerOptions = &CommonServiceConfig{} ======================= File: pkg/controller/iotproject/iotproject_controller.go ======================= <filename>pkg/controller/iotproject/iotproject_controller.go /* * Copyright 2018, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package iotproject import ( "context" enmassev1 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1" "github.com/enmasseproject/enmasse/pkg/util" "github.com/enmasseproject/enmasse/pkg/util/loghandler" "k8s.io/client-go/tools/record" "reflect" corev1 "k8s.io/api/core/v1" "github.com/enmasseproject/enmasse/pkg/util/finalizer" "github.com/enmasseproject/enmasse/pkg/util/recon" iotv1alpha1 "github.com/enmasseproject/enmasse/pkg/apis/iot/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/reconcile" logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" "sigs.k8s.io/controller-runtime/pkg/source" ) const ControllerName = "iotproject-controller" var log = logf.Log.WithName("controller_iotproject") // Gets called by parent "init", adding as to the manager func Add(mgr manager.Manager) error { return add(mgr, newReconciler(mgr)) } func newReconciler(mgr manager.Manager) *ReconcileIoTProject { return &ReconcileIoTProject{ client: mgr.GetClient(), reader: mgr.GetAPIReader(), scheme: mgr.GetScheme(), recorder: mgr.GetEventRecorderFor(ControllerName), } } func add(mgr manager.Manager, r *ReconcileIoTProject) error { // Create a new controller c, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: r}) if err!= nil { return err } // Watch for changes to primary resource IoTProject err = c.Watch(&source.Kind{Type: &iotv1alpha1.IoTProject{}}, loghandler.New(&handler.EnqueueRequestForObject{}, log, "IoTProject")) if err!= nil { return err } // watch for messaging users // FIXME: need a solution /* err = c.Watch(&source.Kind{Type: &userv1beta1.MessagingUser{}}, loghandler.New(&handler.EnqueueRequestForOwner{ IsController: true, OwnerType: &iotv1alpha1.IoTProject{}, }, log.V(2), "MessagingUser")) if err!= nil { return err } */ // watch for addresses err = c.Watch(&source.Kind{Type: &enmassev1.MessagingAddress{}}, loghandler.New(&handler.EnqueueRequestForOwner{ IsController: true, OwnerType: &iotv1alpha1.IoTProject{}, }, log.V(2), "Address")) if err!= nil { return err } return nil } var _ reconcile.Reconciler = &ReconcileIoTProject{} type ReconcileIoTProject struct { // This client, initialized using mgr.Client() above, is a split client // that reads objects from the cache and writes to the apiserver client client.Client reader client.Reader scheme *runtime.Scheme recorder record.EventRecorder } func (r *ReconcileIoTProject) updateProjectStatus(ctx context.Context, originalProject *iotv1alpha1.IoTProject, reconciledProject *iotv1alpha1.IoTProject, rc *recon.ReconcileContext) (reconcile.Result, error) { reqLogger := log.WithValues("Request.Namespace", originalProject.Namespace, "Request.Name", originalProject.Name) newProject := reconciledProject.DeepCopy() // get conditions for ready resourcesCreatedCondition := newProject.Status.GetProjectCondition(iotv1alpha1.ProjectConditionTypeResourcesCreated) resourcesReadyCondition := newProject.Status.GetProjectCondition(iotv1alpha1.ProjectConditionTypeResourcesReady) readyCondition := newProject.Status.GetProjectCondition(iotv1alpha1.ProjectConditionTypeReady) if reconciledProject.DeletionTimestamp!= nil { newProject.Status.Phase = iotv1alpha1.ProjectPhaseTerminating newProject.Status.Message = "Project deleted" readyCondition.SetStatus(corev1.ConditionFalse, "Deconstructing", "Project is being deleted") resourcesCreatedCondition.SetStatus(corev1.ConditionFalse, "Deconstructing", "Project is being deleted") resourcesReadyCondition.SetStatus(corev1.ConditionFalse, "Deconstructing", "Project is being deleted") } else { // eval ready state if rc.Error() == nil && resourcesCreatedCondition.IsOk() && resourcesReadyCondition.IsOk() { newProject.Status.Phase = iotv1alpha1.ProjectPhaseActive newProject.Status.Message = "" } else { newProject.Status.Phase = iotv1alpha1.ProjectPhaseConfiguring } // fill main "ready" condition var reason = "" var message = "" var status = corev1.ConditionUnknown if rc.Error()!= nil { reason = "ProcessingError" message = rc.Error().Error() } if newProject.Status.Phase == iotv1alpha1.ProjectPhaseActive { status = corev1.ConditionTrue } else { status = corev1.ConditionFalse } readyCondition.SetStatus(status, reason, message) } // update status if!reflect.DeepEqual(newProject, originalProject) { reqLogger.Info("Project changed, updating status") err := r.client.Status().Update(ctx, newProject) // when something changed, we never ask for being re-queued // but we do return the update error, which might re-trigger us return reconcile.Result{}, err } else { reqLogger.Info("No project change", "needRequeue", rc.NeedRequeue()) if rc.Error()!= nil && util.OnlyNonRecoverableErrors(rc.Error()) { // we cannot recover based on the error, so don't report back that error, but record it reqLogger.Info("Only non-recoverable errors", "error", rc.Error()) r.recorder.Event(originalProject, corev1.EventTypeWarning, "ReconcileError", rc.Error().Error()) return rc.PlainResult(), nil } else { // no change, just return the result, may re-queue return rc.Result() } } } // Reconcile by reading the IoT project spec and making required changes // // returning an error will get the request re-queued func (r *ReconcileIoTProject) Reconcile(request reconcile.Request) (reconcile.Result, error) { reqLogger := log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name) reqLogger.V(2).Info("Reconciling IoTProject") ctx := context.Background() // Get project project := &iotv1alpha1.IoTProject{} err := r.client.Get(ctx, request.NamespacedName, project) if err!= nil { if errors.IsNotFound(err) { reqLogger.Info("Project was not found") // Request object not found, could have been deleted after reconcile request. // Owned objects are automatically garbage collected. For additional cleanup logic use finalizers. // Return and don't requeue return reconcile.Result{}, nil } // Error reading the object - requeue the request. return reconcile.Result{}, err } // make copy for change detection original := project.DeepCopy() // start reconcile process rc := &recon.ReconcileContext{} if project.DeletionTimestamp!= nil && project.Status.Phase!= iotv1alpha1.ProjectPhaseTerminating { reqLogger.Info("Re-queue after setting phase to terminating") return r.updateProjectStatus(ctx, original, project, &recon.ReconcileContext{}) } // process finalizers rc.Process(func() (result reconcile.Result, e error) { return finalizer.ProcessFinalizers(ctx, r.client, r.reader, r.recorder, project, finalizers) }) if rc.Error()!= nil { reqLogger.Error(rc.Error(), "Failed to process finalizers") // processing finalizers failed return rc.Result() } if rc.NeedRequeue() { // persist changes from finalizers, this is signaled to use via "need requeue" // Note: we cannot use "updateProjectStatus" here, as we don't update the status section reqLogger.Info("Re-queue after processing finalizers") if!reflect.DeepEqual(project, original) { err := r.client.Update(ctx, project) return reconcile.Result{}, err } else { return rc.Result() } // processing the finalizers required a persist step, and so we stop early // the call to Update will re-trigger us, and we don't need to set "requeue" } rc.ProcessSimple(func() error { return project.Status.GetProjectCondition(iotv1alpha1.ProjectConditionTypeConfigurationAccepted). RunWith("ConfigurationNotAccepted", func() error { return r.acceptConfiguration(project) }) }) rc.Process(func() (result reconcile.Result, e error) { return r.reconcileManaged(ctx, project) }) return r.updateProjectStatus(ctx, original, project, rc) } // get the first, active endpoint for an IoTProject // returns an error if there is one func findFirstActiveEndpoint(ctx context.Context, c client.Client, project *iotv1alpha1.IoTProject) (*enmassev1.MessagingEndpoint, error) { endpoints := &enmassev1.MessagingEndpointList{} if err := c.List(ctx, endpoints, client.InNamespace(project.Namespace)); err!= nil { return nil, err } for _, e := range endpoints.Items { if!e.IsActive() { continue } return &e, nil } return nil, util.NewConfigurationError("No active endpoint found in namespace '%s'", project.Namespace) } ======================= File: pkg/client/listers/enmasse/v1beta1/addressspace.go ======================= <filename>pkg/client/listers/enmasse/v1beta1/addressspace.go /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 import ( v1beta1 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // AddressSpaceLister helps list AddressSpaces. type AddressSpaceLister interface { // List lists all AddressSpaces in the indexer. List(selector labels.Selector) (ret []*v1beta1.AddressSpace, err error) // AddressSpaces returns an object that can list and get AddressSpaces. AddressSpaces(namespace string) AddressSpaceNamespaceLister AddressSpaceListerExpansion } // addressSpaceLister implements the AddressSpaceLister interface. type addressSpaceLister struct { indexer cache.Indexer } // NewAddressSpaceLister returns a new AddressSpaceLister. func NewAddressSpaceLister(indexer cache.Indexer) AddressSpaceLister { return &addressSpaceLister{indexer: indexer} } // List lists all AddressSpaces in the indexer. func (s *addressSpaceLister) List(selector labels.Selector) (ret []*v1beta1.AddressSpace, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { ret = append(ret, m.(*v1beta1.AddressSpace)) }) return ret, err } // AddressSpaces returns an object that can list and get AddressSpaces. func (s *addressSpaceLister) AddressSpaces(namespace string) AddressSpaceNamespaceLister { return addressSpaceNamespaceLister{indexer: s.indexer, namespace: namespace} } // AddressSpaceNamespaceLister helps list and get AddressSpaces. type AddressSpaceNamespaceLister interface { // List lists all AddressSpaces in the indexer for a given namespace. List(selector labels.Selector) (ret []*v1beta1.AddressSpace, err error) // Get retrieves the AddressSpace from the indexer for a given namespace and name. Get(name string) (*v1beta1.AddressSpace, error) AddressSpaceNamespaceListerExpansion } // addressSpaceNamespaceLister implements the AddressSpaceNamespaceLister // interface. type addressSpaceNamespaceLister struct { indexer cache.Indexer namespace string } // List lists all AddressSpaces in the indexer for a given namespace. func (s addressSpaceNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.AddressSpace, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { ret = append(ret, m.(*v1beta1.AddressSpace)) }) return ret, err } // Get retrieves the AddressSpace from the indexer for a given namespace and name. func (s addressSpaceNamespaceLister) Get(name string) (*v1beta1.AddressSpace, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err!= nil { return nil, err } if!exists { return nil, errors.NewNotFound(v1beta1.Resource("addressspace"), name) } return obj.(*v1beta1.AddressSpace), nil } ======================= File: vendor/github.com/99designs/gqlgen/graphql/errcode/codes.go ======================= package errcode import ( "github.com/vektah/gqlparser/v2/gqlerror" ) const ValidationFailed = "GRAPHQL_VALIDATION_FAILED" const ParseFailed = "GRAPHQL_PARSE_FAILED" type ErrorKind int const ( // issues with graphql (validation, parsing). 422s in http, GQL_ERROR in websocket KindProtocol ErrorKind = iota // user errors, 200s in http, GQL_DATA in websocket KindUser ) var codeType = map[string]ErrorKind{ ValidationFailed: KindProtocol, ParseFailed: KindProtocol, } // RegisterErrorType should be called by extensions that want to customize the http status codes for errors they return func RegisterErrorType(code string, kind ErrorKind) { codeType[code] = kind } // Set the error code on a given graphql error extension func Set(err *gqlerror.Error, value string) { if err.Extensions == nil { err.Extensions = map[string]interface{}{} } err.Extensions["code"] = value } // get the kind of the first non User error, defaults to User if no errors have a custom extension func GetErrorKind(errs gqlerror.List) ErrorKind { for _, err := range errs { if code, ok := err.Extensions["code"].(string); ok { if kind, ok := codeType[code]; ok && kind!= KindUser { return kind } } } return KindUser } ======================= File: pkg/controller/messaginginfra/common/labels.go ======================= <filename>pkg/controller/messaginginfra/common/labels.go<gh_stars>1-10 /* * Copyright 2020, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package common const LABEL_INFRA = "infra" ======================= File: pkg/controller/consoleservice/domain.go ======================= <gh_stars>1-10 /* * Copyright 2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package consoleservice import ( "strings" ) func GetCommonDomain(all_fqdns []string) (*string, int) { if len(all_fqdns) <= 1 { return nil, 0 } first_fqdn := strings.Split(all_fqdns[0], ".") remaining_fqdns := all_fqdns[1:] common := make([]string, 0) matching := true for len(first_fqdn) > 0 && matching { common = append(first_fqdn[len(first_fqdn)-1:], common...) first_fqdn = first_fqdn[:len(first_fqdn)-1] trial_common_subdomain := "." + strings.Join(common, ".") for _, other_fqdn := range remaining_fqdns { if!strings.HasSuffix(other_fqdn, trial_common_subdomain) { common = common[1:] matching = false break } } } if len(common) == 0 { return nil, 0 } else { common_sub := "." + strings.Join(common, ".") return &common_sub, len(common) } } ======================= File: pkg/consolegraphql/resolvers/resolver_messagingendpoint_test.go ======================= <reponame>anukritijha/enmasse /* * Copyright 2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package resolvers import ( "context" "fmt" "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1" "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta1" "github.com/enmasseproject/enmasse/pkg/consolegraphql/accesscontroller" "github.com/enmasseproject/enmasse/pkg/consolegraphql/cache" "github.com/enmasseproject/enmasse/pkg/consolegraphql/server" v12 "github.com/openshift/api/route/v1" "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "testing" ) func newTestMessagingEndpointResolver(t *testing.T) (*Resolver, context.Context) { objectCache, err := cache.CreateObjectCache() assert.NoError(t, err, "failed to create object cache") resolver := Resolver{} resolver.Cache = objectCache requestState := &server.RequestState{ AccessController: accesscontroller.NewAllowAllAccessController(), } ctx := server.ContextWithRequestState(requestState, context.TODO()) return &resolver, ctx } func TestQueryMessagingEndpointNoEndpoints(t *testing.T) { r, ctx := newTestMessagingEndpointResolver(t) addressSpace := createAddressSpace("myas", "mynamespace") err := r.Cache.Add(addressSpace) assert.NoError(t, err) objs, err := r.Query().MessagingEndpoints(ctx, nil, nil, nil, nil) assert.NoError(t, err) assert.Equal(t, 0, objs.Total, "Unexpected number of endpoints") } func TestQueryMessagingEndpointClusterOnly(t *testing.T) { r, ctx := newTestMessagingEndpointResolver(t) endpointSpec := v1beta1.EndpointSpec{ Name: "myendpoint", Service: v1beta1.EndpointServiceTypeMessaging, } endpointStatus := v1beta1.EndpointStatus{ Name: "myendpoint", ServiceHost: "messaging-queuespace.enmasse-infra.svc", ServicePorts: []v1beta1.Port{ {Name: "amqps", Port: 5671}, }, } addressSpace := createAddressSpace("myas", "mynamespace", withEndpoint(endpointSpec, endpointStatus)) err := r.Cache.Add(addressSpace) assert.NoError(t, err) objs, err := r.Query().MessagingEndpoints(ctx, nil, nil, nil, nil) assert.NoError(t, err) assert.Equal(t, 1, objs.Total, "Unexpected number of messagingEndpoints") messagingEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging.cluster", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging.cluster"), }, Spec: v1.MessagingEndpointSpec{ Cluster: &v1.MessagingEndpointSpecCluster{}, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPS}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeCluster, Host: "messaging-queuespace.enmasse-infra.svc", Ports: []v1.MessagingEndpointPort{ {Name: "amqps", Protocol: v1.MessagingProtocolAMQPS, Port: 5671}, }, }, } assert.Equal(t, messagingEndpoint, objs.MessagingEndpoints[0], "Unexpected messagingEndpoint") } func TestQueryMessagingEndpointAmqpsRouteAndCluster(t *testing.T) { r, ctx := newTestMessagingEndpointResolver(t) endpointSpec := v1beta1.EndpointSpec{ Name: "messaging", Service: v1beta1.EndpointServiceTypeMessaging, Expose: &v1beta1.ExposeSpec{ Type: v1beta1.ExposeTypeRoute, RouteServicePort: v1beta1.RouteServicePortAmqps, RouteTlsTermination: v1beta1.RouteTlsTerminationPassthrough, }, } endpointStatus := v1beta1.EndpointStatus{ Name: "messaging", ServiceHost: "messaging-queuespace.enmasse-infra.svc", ServicePorts: []v1beta1.Port{ {Name: "amqps", Port: 5671}, }, ExternalHost: "messaging-queuespace-enmasse-infra.apps-crc.testing", ExternalPorts: []v1beta1.Port{ {Name: "amqps", Port: 443}, }, } addressSpace := createAddressSpace("myas", "mynamespace", withEndpoint(endpointSpec, endpointStatus)) err := r.Cache.Add(addressSpace) assert.NoError(t, err) objs, err := r.Query().MessagingEndpoints(ctx, nil, nil, nil, nil) assert.NoError(t, err) assert.Equal(t, 2, objs.Total, "Unexpected number of endpoints") clusterEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging.cluster", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging.cluster"), }, Spec: v1.MessagingEndpointSpec{ Cluster: &v1.MessagingEndpointSpecCluster{}, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPS}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeCluster, Host: "messaging-queuespace.enmasse-infra.svc", Ports: []v1.MessagingEndpointPort{ {Name: "amqps", Protocol: v1.MessagingProtocolAMQPS, Port: 5671}, }, }, } assert.Equal(t, clusterEndpoint, objs.MessagingEndpoints[0], "Unexpected messagingEndpoints") routeEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging"), }, Spec: v1.MessagingEndpointSpec{ Route: &v1.MessagingEndpointSpecRoute{}, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPS}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeRoute, Host: "messaging-queuespace-enmasse-infra.apps-crc.testing", Ports: []v1.MessagingEndpointPort{ {Name: "amqps", Protocol: v1.MessagingProtocolAMQPS, Port: 443}, }, }, } assert.Equal(t, routeEndpoint, objs.MessagingEndpoints[1], "Unexpected messagingEndpoints") } func TestQueryMessagingEndpointAmqpWssRouteAndCluster(t *testing.T) { r, ctx := newTestMessagingEndpointResolver(t) endpointSpec := v1beta1.EndpointSpec{ Name: "messaging-wss", Service: v1beta1.EndpointServiceTypeMessaging, Expose: &v1beta1.ExposeSpec{ Type: v1beta1.ExposeTypeRoute, RouteServicePort: v1beta1.RouteServicePortHttps, RouteTlsTermination: v1beta1.RouteTlsTerminationReencrypt, }, } endpointStatus := v1beta1.EndpointStatus{ Name: "messaging-wss", ServiceHost: "messaging-queuespace.enmasse-infra.svc", ServicePorts: []v1beta1.Port{ {Name: "amqp-wss", Port: 443}, }, ExternalHost: "messaging-wss-queuespace-enmasse-infra.apps-crc.testing", ExternalPorts: []v1beta1.Port{ {Name: "https", Port: 443}, }, } addressSpace := createAddressSpace("myas", "mynamespace", withEndpoint(endpointSpec, endpointStatus)) err := r.Cache.Add(addressSpace) assert.NoError(t, err) objs, err := r.Query().MessagingEndpoints(ctx, nil, nil, nil, nil) assert.NoError(t, err) assert.Equal(t, 2, objs.Total, "Unexpected number of endpoints") clusterEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging.cluster", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging.cluster"), }, Spec: v1.MessagingEndpointSpec{ Cluster: &v1.MessagingEndpointSpecCluster{}, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPWSS}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeCluster, Host: "messaging-queuespace.enmasse-infra.svc", Ports: []v1.MessagingEndpointPort{ {Name: "amqp-wss", Protocol: v1.MessagingProtocolAMQPWSS, Port: 443}, }, }, } assert.Equal(t, clusterEndpoint, objs.MessagingEndpoints[0], "Unexpected messagingEndpoints") reencrypt := v12.TLSTerminationReencrypt routeEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging-wss", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging-wss"), }, Spec: v1.MessagingEndpointSpec{ Route: &v1.MessagingEndpointSpecRoute{ TlsTermination: &reencrypt, }, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPWSS}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeRoute, Host: "messaging-wss-queuespace-enmasse-infra.apps-crc.testing", Ports: []v1.MessagingEndpointPort{ {Name: "amqp-wss", Protocol: v1.MessagingProtocolAMQPWSS, Port: 443}, }, }, } assert.Equal(t, routeEndpoint, objs.MessagingEndpoints[1], "Unexpected messagingEndpoints") } func TestQueryMessagingEndpointSharedServiceAndTwoRoutes(t *testing.T) { r, ctx := newTestMessagingEndpointResolver(t) serviceName := v1beta1.EndpointServiceTypeMessaging serviceHost := "messaging-queuespace.enmasse-infra.svc" servicePorts := []v1beta1.Port{ {Name: "amqps", Port: 5671}, {Name: "amqp", Port: 5672}, {Name: "amqp-wss", Port: 443}, } endpointSpec1 := v1beta1.EndpointSpec{ Name: "messaging", Service: serviceName, Expose: &v1beta1.ExposeSpec{ Type: v1beta1.ExposeTypeRoute, RouteServicePort: v1beta1.RouteServicePortAmqps, RouteTlsTermination: v1beta1.RouteTlsTerminationPassthrough, }, } endpointStatus1 := v1beta1.EndpointStatus{ Name: "messaging", ServiceHost: serviceHost, ServicePorts: servicePorts, ExternalHost: "messaging-queuespace-enmasse-infra.apps-crc.testing", ExternalPorts: []v1beta1.Port{ {Name: "amqps", Port: 443}, }, } endpointSpec2 := v1beta1.EndpointSpec{ Name: "messaging-wss", Service: serviceName, Expose: &v1beta1.ExposeSpec{ Type: "route", RouteServicePort: "https", RouteTlsTermination: "reencrypt", }, } endpointStatus2 := v1beta1.EndpointStatus{ Name: "messaging-wss", ServiceHost: serviceHost, ServicePorts: servicePorts, ExternalHost: "messaging-wss-queuespace-enmasse-infra.apps-crc.testing", ExternalPorts: []v1beta1.Port{ {Name: "https", Port: 443}, }, } addressSpace := createAddressSpace("myas", "mynamespace", withEndpoint(endpointSpec1, endpointStatus1), withEndpoint(endpointSpec2, endpointStatus2)) err := r.Cache.Add(addressSpace) assert.NoError(t, err) objs, err := r.Query().MessagingEndpoints(ctx, nil, nil, nil, nil) assert.NoError(t, err) assert.Equal(t, 3, objs.Total, "Unexpected number of endpoints") clusterEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging.cluster", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging.cluster"), }, Spec: v1.MessagingEndpointSpec{ Cluster: &v1.MessagingEndpointSpecCluster{}, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPS, v1.MessagingProtocolAMQP, v1.MessagingProtocolAMQPWSS}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeCluster, Host: serviceHost, Ports: []v1.MessagingEndpointPort{ {Name: "amqps", Protocol: v1.MessagingProtocolAMQPS, Port: 5671}, {Name: "amqp", Protocol: v1.MessagingProtocolAMQP, Port: 5672}, {Name: "amqp-wss", Protocol: v1.MessagingProtocolAMQPWSS, Port: 443}, }, }, } assert.Equal(t, clusterEndpoint, objs.MessagingEndpoints[0], "Unexpected messagingEndpoints") amqpsRouteEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging"), }, Spec: v1.MessagingEndpointSpec{ Route: &v1.MessagingEndpointSpecRoute{}, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPS}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeRoute, Host: "messaging-queuespace-enmasse-infra.apps-crc.testing", Ports: []v1.MessagingEndpointPort{ {Name: "amqps", Protocol: v1.MessagingProtocolAMQPS, Port: 443}, }, }, } assert.Equal(t, amqpsRouteEndpoint, objs.MessagingEndpoints[1], "Unexpected messagingEndpoints") reencrypt := v12.TLSTerminationReencrypt amqpwssRouteEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging-wss", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging-wss"), }, Spec: v1.MessagingEndpointSpec{ Route: &v1.MessagingEndpointSpecRoute{ TlsTermination: &reencrypt, }, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPWSS}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeRoute, Host: "messaging-wss-queuespace-enmasse-infra.apps-crc.testing", Ports: []v1.MessagingEndpointPort{ {Name: "amqp-wss", Protocol: v1.MessagingProtocolAMQPWSS, Port: 443}, }, }, } assert.Equal(t, amqpwssRouteEndpoint, objs.MessagingEndpoints[2], "Unexpected messagingEndpoints") } func TestQueryMessagingEndpointLoadbalancerAndCluster(t *testing.T) { r, ctx := newTestMessagingEndpointResolver(t) endpointSpec := v1beta1.EndpointSpec{ Name: "messaging", Service: v1beta1.EndpointServiceTypeMessaging, Expose: &v1beta1.ExposeSpec{ Type: v1beta1.ExposeTypeLoadBalancer, LoadBalancerPorts: []string{"amqp", "amqps"}, LoadBalancerSourceRanges: []string{"10.0.0.0/8"}, }, } endpointStatus := v1beta1.EndpointStatus{ Name: "messaging", ServiceHost: "messaging-queuespace.enmasse-infra.svc", ServicePorts: []v1beta1.Port{ {Name: "amqps", Port: 5671}, }, ExternalPorts: []v1beta1.Port{ {Name: "amqps", Port: 443}, }, } addressSpace := createAddressSpace("myas", "mynamespace", withEndpoint(endpointSpec, endpointStatus)) err := r.Cache.Add(addressSpace) assert.NoError(t, err) objs, err := r.Query().MessagingEndpoints(ctx, nil, nil, nil, nil) assert.NoError(t, err) assert.Equal(t, 2, objs.Total, "Unexpected number of endpoints") clusterEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging.cluster", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging.cluster"), }, Spec: v1.MessagingEndpointSpec{ Cluster: &v1.MessagingEndpointSpecCluster{}, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPS}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeCluster, Host: "messaging-queuespace.enmasse-infra.svc", Ports: []v1.MessagingEndpointPort{ {Name: "amqps", Protocol: v1.MessagingProtocolAMQPS, Port: 5671}, }, }, } assert.Equal(t, clusterEndpoint, objs.MessagingEndpoints[0], "Unexpected messagingEndpoints") loadbalancerEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging"), }, Spec: v1.MessagingEndpointSpec{ LoadBalancer: &v1.MessagingEndpointSpecLoadBalancer{}, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPS}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeLoadBalancer, Ports: []v1.MessagingEndpointPort{ {Name: "amqps", Protocol: v1.MessagingProtocolAMQPS, Port: 443}, }, }, } assert.Equal(t, loadbalancerEndpoint, objs.MessagingEndpoints[1], "Unexpected messagingEndpoints") } func TestFilterMessagingEndpoints(t *testing.T) { r, ctx := newTestMessagingEndpointResolver(t) as1EndpointSpec := v1beta1.EndpointSpec{ Name: "messaging", Service: v1beta1.EndpointServiceTypeMessaging, } endpointStatus := v1beta1.EndpointStatus{ Name: "messaging", ServiceHost: "messaging-queuespace.enmasse-infra.svc", ServicePorts: []v1beta1.Port{ {Name: "amqps", Port: 5671}, }, } as1 := createAddressSpace("myas1", "mynamespace", withEndpoint(as1EndpointSpec, endpointStatus)) as2 := createAddressSpace("myas2", "mynamespace", withEndpoint(as1EndpointSpec, endpointStatus)) err := r.Cache.Add(as1, as2) assert.NoError(t, err) clusterFilter := fmt.Sprint("`$.metadata.name` LIKE'myas1.%'") objs, err := r.Query().MessagingEndpoints(ctx, nil, nil, &clusterFilter, nil) assert.NoError(t, err) assert.Equal(t, 1, objs.Total, "Unexpected number of endpoints") } func TestQueryMessagingEndpointTlsSelfSigned(t *testing.T) { r, ctx := newTestMessagingEndpointResolver(t) endpointSpec := v1beta1.EndpointSpec{ Name: "myendpoint", Service: v1beta1.EndpointServiceTypeMessaging, Certificate: &v1beta1.CertificateSpec{ Provider: v1beta1.CertificateProviderTypeCertSelfsigned, }, } endpointStatus := v1beta1.EndpointStatus{ Name: "myendpoint", ServiceHost: "messaging-queuespace.enmasse-infra.svc", ServicePorts: []v1beta1.Port{ {Name: "amqps", Port: 5671}, }, } addressSpace := createAddressSpace("myas", "mynamespace", withEndpoint(endpointSpec, endpointStatus), withCACertificate([]byte("cacert"))) err := r.Cache.Add(addressSpace) assert.NoError(t, err) objs, err := r.Query().MessagingEndpoints(ctx, nil, nil, nil, nil) assert.NoError(t, err) assert.Equal(t, 1, objs.Total, "Unexpected number of messagingEndpoints") messagingEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging.cluster", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging.cluster"), }, Spec: v1.MessagingEndpointSpec{ Tls: &v1.MessagingEndpointSpecTls{ Selfsigned: &v1.MessagingEndpointSpecTlsSelfsigned{}, }, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPS}, Cluster: &v1.MessagingEndpointSpecCluster{}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeCluster, Host: "messaging-queuespace.enmasse-infra.svc", Ports: []v1.MessagingEndpointPort{ {Name: "amqps", Protocol: v1.MessagingProtocolAMQPS, Port: 5671}, }, Tls: &v1.MessagingEndpointStatusTls{ CaCertificate: "cacert", }, }, } assert.Equal(t, messagingEndpoint, objs.MessagingEndpoints[0], "Unexpected messagingEndpoint") } func TestQueryMessagingEndpointTlsOpenShift(t *testing.T) { r, ctx := newTestMessagingEndpointResolver(t) endpointSpec := v1beta1.EndpointSpec{ Name: "myendpoint", Service: v1beta1.EndpointServiceTypeMessaging, Certificate: &v1beta1.CertificateSpec{ Provider: v1beta1.CertificateProviderTypeCertOpenshift, }, } endpointStatus := v1beta1.EndpointStatus{ Name: "myendpoint", ServiceHost: "messaging-queuespace.enmasse-infra.svc", ServicePorts: []v1beta1.Port{ {Name: "amqps", Port: 5671}, }, } addressSpace := createAddressSpace("myas", "mynamespace", withEndpoint(endpointSpec, endpointStatus)) err := r.Cache.Add(addressSpace) assert.NoError(t, err) objs, err := r.Query().MessagingEndpoints(ctx, nil, nil, nil, nil) assert.NoError(t, err) assert.Equal(t, 1, objs.Total, "Unexpected number of messagingEndpoints") messagingEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging.cluster", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging.cluster"), }, Spec: v1.MessagingEndpointSpec{ Tls: &v1.MessagingEndpointSpecTls{ Openshift: &v1.MessagingEndpointSpecTlsOpenshift{}, }, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPS}, Cluster: &v1.MessagingEndpointSpecCluster{}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeCluster, Host: "messaging-queuespace.enmasse-infra.svc", Ports: []v1.MessagingEndpointPort{ {Name: "amqps", Protocol: v1.MessagingProtocolAMQPS, Port: 5671}, }, Tls: &v1.MessagingEndpointStatusTls{}, }, } assert.Equal(t, messagingEndpoint, objs.MessagingEndpoints[0], "Unexpected messagingEndpoint") } func TestQueryMessagingEndpointTlsExternal(t *testing.T) { r, ctx := newTestMessagingEndpointResolver(t) endpointSpec := v1beta1.EndpointSpec{ Name: "myendpoint", Service: v1beta1.EndpointServiceTypeMessaging, Certificate: &v1beta1.CertificateSpec{ Provider: v1beta1.CertificateProviderTypeCertBundle, TlsKey: []byte("base64PEM"), TlsCert: []byte("base64PEM"), }, } endpointStatus := v1beta1.EndpointStatus{ Name: "myendpoint", ServiceHost: "messaging-queuespace.enmasse-infra.svc", ServicePorts: []v1beta1.Port{ {Name: "amqps", Port: 5671}, }, } addressSpace := createAddressSpace("myas", "mynamespace", withEndpoint(endpointSpec, endpointStatus)) err := r.Cache.Add(addressSpace) assert.NoError(t, err) objs, err := r.Query().MessagingEndpoints(ctx, nil, nil, nil, nil) assert.NoError(t, err) assert.Equal(t, 1, objs.Total, "Unexpected number of messagingEndpoints") messagingEndpoint := &v1.MessagingEndpoint{ ObjectMeta: metav1.ObjectMeta{ Namespace: addressSpace.Namespace, Name: "myas.messaging.cluster", UID: createStableUuidV5(addressSpace.ObjectMeta, "myas.messaging.cluster"), }, Spec: v1.MessagingEndpointSpec{ Tls: &v1.MessagingEndpointSpecTls{ External: &v1.MessagingEndpointSpecTlsExternal{ Key: v1.InputValue{ Value: string(endpointSpec.Certificate.TlsKey), }, Certificate: v1.InputValue{ Value: string(endpointSpec.Certificate.TlsCert), }, }, }, Protocols: []v1.MessagingEndpointProtocol{v1.MessagingProtocolAMQPS}, Cluster: &v1.MessagingEndpointSpecCluster{}, }, Status: v1.MessagingEndpointStatus{ Phase: v1.MessagingEndpointActive, Type: v1.MessagingEndpointTypeCluster, Host: "messaging-queuespace.enmasse-infra.svc", Ports: []v1.MessagingEndpointPort{ {Name: "amqps", Protocol: v1.MessagingProtocolAMQPS, Port: 5671}, }, Tls: &v1.MessagingEndpointStatusTls{}, }, } assert.Equal(t, messagingEndpoint, objs.MessagingEndpoints[0], "Unexpected messagingEndpoint") } ======================= File: vendor/github.com/go-resty/resty/v2/response.go ======================= <gh_stars>1-10 // Copyright (c) 2015-2019 <NAME> (<EMAIL>), All rights reserved. // resty source code and usage is governed by a MIT style // license that can be found in the LICENSE file. package resty import ( "encoding/json" "fmt" "io" "net/http" "strings" "time" ) //‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ // Response struct and methods //_______________________________________________________________________ // Response struct holds response values of executed request. type Response struct { Request *Request RawResponse *http.Response body []byte size int64 receivedAt time.Time } // Body method returns HTTP response as []byte array for the executed request. // // Note: `Response.Body` might be nil, if `Request.SetOutput` is used. func (r *Response) Body() []byte { if r.RawResponse == nil { return []byte{} } return r.body } // Status method returns the HTTP status string for the executed request. // Example: 200 OK func (r *Response) Status() string { if r.RawResponse == nil { return "" } return r.RawResponse.Status } // StatusCode method returns the HTTP status code for the executed request. // Example: 200 func (r *Response) StatusCode() int { if r.RawResponse == nil { return 0 } return r.RawResponse.StatusCode } // Result method returns the response value as an object if it has one func (r *Response) Result() interface{} { return r.Request.Result } // Error method returns the error object if it has one func (r *Response) Error() interface{} { return r.Request.Error } // Header method returns the response headers func (r *Response) Header() http.Header { if r.RawResponse == nil { return http.Header{} } return r.RawResponse.Header } // Cookies method to access all the response cookies func (r *Response) Cookies() []*http.Cookie { if r.RawResponse == nil { return make([]*http.Cookie, 0) } return r.RawResponse.Cookies() } // String method returns the body of the server response as String. func (r *Response) String() string { if r.body == nil { return "" } return strings.TrimSpace(string(r.body)) } // Time method returns the time of HTTP response time that from request we sent and received a request. // // See `Response.ReceivedAt` to know when client recevied response and see `Response.Request.Time` to know // when client sent a request. func (r *Response) Time() time.Duration { if r.Request.clientTrace!= nil { return r.receivedAt.Sub(r.Request.clientTrace.getConn) } return r.receivedAt.Sub(r.Request.Time) } // ReceivedAt method returns when response got recevied from server for the request. func (r *Response) ReceivedAt() time.Time { return r.receivedAt } // Size method returns the HTTP response size in bytes. Ya, you can relay on HTTP `Content-Length` header, // however it won't be good for chucked transfer/compressed response. Since Resty calculates response size // at the client end. You will get actual size of the http response. func (r *Response) Size() int64 { return r.size } // RawBody method exposes the HTTP raw response body. Use this method in-conjunction with `SetDoNotParseResponse` // option otherwise you get an error as `read err: http: read on closed response body`. // // Do not forget to close the body, otherwise you might get into connection leaks, no connection reuse. // Basically you have taken over the control of response parsing from `Resty`. func (r *Response) RawBody() io.ReadCloser { if r.RawResponse == nil { return nil } return r.RawResponse.Body } // IsSuccess method returns true if HTTP status `code >= 200 and <= 299` otherwise false. func (r *Response) IsSuccess() bool { return r.StatusCode() > 199 && r.StatusCode() < 300 } // IsError method returns true if HTTP status `code >= 400` otherwise false. func (r *Response) IsError() bool { return r.StatusCode() > 399 } //‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ // Response Unexported methods //_______________________________________________________________________ func (r *Response) fmtBodyString(sl int64) string { if r.body!= nil { if int64(len(r.body)) > sl { return fmt.Sprintf("***** RESPONSE TOO LARGE (size - %d) *****", len(r.body)) } ct := r.Header().Get(hdrContentTypeKey) if IsJSONType(ct) { out := acquireBuffer() defer releaseBuffer(out) if err := json.Indent(out, r.body, "", " "); err == nil { return out.String() } } return r.String() } return "***** NO CONTENT *****" } ======================= File: pkg/consolegraphql/non_kubernetes_types.go ======================= /* * Copyright 2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package consolegraphql import ( "container/ring" "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta1" "github.com/enmasseproject/enmasse/pkg/util" authv1 "k8s.io/api/authorization/v1" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "time" ) var rateMetricTimeSeriesElements = util.GetUintEnvOrDefault("RATE_METRIC_TIME_SERIES_ELEMENTS", 0, 8, 100) type HasMetrics interface { GetMetrics() []*Metric } type Connection struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec ConnectionSpec `json:"spec,omitempty"` Metrics []*Metric `json:"metrics"` } func (c *Connection) GetControllingResourceAttributes() *authv1.ResourceAttributes { return &authv1.ResourceAttributes{ Resource: "addressspaces", Group: "enmasse.io", Version: "v1beta1", Namespace: c.ObjectMeta.Namespace, } } func (c *Connection) GetMetrics() []*Metric { return c.Metrics } type ConnectionSpec struct { AddressSpace string `json:"addressSpace,omitempty"` Hostname string `json:"hostname,omitempty"` ContainerId string `json:"containerId,omitempty"` Protocol string `json:"protocol,omitempty"` Encrypted bool `json:"encrypted,omitempty"` Properties map[string]string `json:"properties,omitempty"` Principal string `json:"principal,omitempty"` } type Link struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec LinkSpec `json:"spec,omitempty"` Metrics []*Metric `json:"metrics,omitempty"` } func (l *Link) GetMetrics() []*Metric { return l.Metrics } type LinkSpec struct { Connection string `json:"connection,omitempty"` AddressSpace string `json:"addressSpace,omitempty"` Address string `json:"address,omitempty"` Role string `json:"role,omitempty"` } type Metric struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Value float64 `json:"value,omitempty"` Unit string `json:"unit,omitempty"` Time time.Time `json:"time,omitempty"` timeseries *ring.Ring } type DataPointTimePair struct { DataPoint float64 `json:"dataPoint"` Timestamp time.Time `json:"timestamp"` } func (m *Metric) GetTimeSeries() *ring.Ring { return m.timeseries } func (m *Metric) AddTimeSeriesDataPoint(v float64, ts time.Time) { m.timeseries.Value = DataPointTimePair{v, ts} m.timeseries = m.timeseries.Next() m.Time = ts } type SimpleMetric Metric type RateCalculatingMetric Metric func FindOrCreateSimpleMetric(existing []*Metric, n string, t string) (*SimpleMetric, []*Metric) { for _, m := range existing { if m.Name == n { return (*SimpleMetric)(m), existing } } m := NewSimpleMetric(n, t) existing = append(existing, (*Metric)(m)) return m, existing } func FindOrCreateRateCalculatingMetric(existing []*Metric, n string, t string, unit string) (*RateCalculatingMetric, []*Metric) { for _, m := range existing { if m.Name == n { return (*RateCalculatingMetric)(m), existing } } m := NewRateCalculatingMetric(n, t, unit) existing = append(existing, (*Metric)(m)) return m, existing } func NewSimpleMetric(n string, t string) *SimpleMetric { metric := SimpleMetric{ Name: n, Type: t, } return &metric } func (m *SimpleMetric) Update(v float64, ts time.Time) { m.Value = v m.Time = ts return } func NewRateCalculatingMetric(n string, t string, u string) *RateCalculatingMetric { m := RateCalculatingMetric{ Name: n, Type: t, Unit: u, timeseries: ring.New(int(rateMetricTimeSeriesElements)), } return &m } func (m *RateCalculatingMetric) Update(v float64, ts time.Time) { m.timeseries.Value = DataPointTimePair{v, ts} m.timeseries = m.timeseries.Next() m.Time = ts return } type AddressSpaceHolder struct { v1beta1.AddressSpace `json:",inline"` Metrics []*Metric `json:"metrics"` } func (ash *AddressSpaceHolder) GetMetrics() []*Metric { return ash.Metrics } func (ash *AddressSpaceHolder) GetControllingResourceAttributes() *authv1.ResourceAttributes { gvk := ash.TypeMeta.GroupVersionKind() return getResourceAttributes(gvk, ash.Namespace) } type AddressHolder struct { v1beta1.Address `json:",inline"` Metrics []*Metric `json:"metrics"` } func (ah *AddressHolder) GetMetrics() []*Metric { return ah.Metrics } func (ah *AddressHolder) GetControllingResourceAttributes() *authv1.ResourceAttributes { gvk := ah.TypeMeta.GroupVersionKind() return getResourceAttributes(gvk, ah.Namespace) } func getResourceAttributes(gvk schema.GroupVersionKind, name string) *authv1.ResourceAttributes { return &authv1.ResourceAttributes{ Resource: kindToResource(gvk), Group: gvk.Group, Version: gvk.Version, Namespace: name, } } func kindToResource(gvk schema.GroupVersionKind) string { plural, _ := meta.UnsafeGuessKindToResource(gvk) resource := plural.Resource return resource } ======================= File: pkg/apis/enmasse/v1/zz_generated.deepcopy.go ======================= <gh_stars>0 // +build!ignore_autogenerated /* * Copyright 2018-2019, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ // Code generated by deepcopy-gen. DO NOT EDIT. package v1 import ( v1beta1 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta1" routev1 "github.com/openshift/api/route/v1" corev1 "k8s.io/api/core/v1" resource "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InputValue) DeepCopyInto(out *InputValue) { *out = *in if in.ValueFromSecret!= nil { in, out := &in.ValueFromSecret, &out.ValueFromSecret *out = new(corev1.SecretKeySelector) (*in).DeepCopyInto(*out) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InputValue. func (in *InputValue) DeepCopy() *InputValue { if in == nil { return nil } out := new(InputValue) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddress) DeepCopyInto(out *MessagingAddress) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddress. func (in *MessagingAddress) DeepCopy() *MessagingAddress { if in == nil { return nil } out := new(MessagingAddress) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingAddress) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressBroker) DeepCopyInto(out *MessagingAddressBroker) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressBroker. func (in *MessagingAddressBroker) DeepCopy() *MessagingAddressBroker { if in == nil { return nil } out := new(MessagingAddressBroker) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressCondition) DeepCopyInto(out *MessagingAddressCondition) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressCondition. func (in *MessagingAddressCondition) DeepCopy() *MessagingAddressCondition { if in == nil { return nil } out := new(MessagingAddressCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressList) DeepCopyInto(out *MessagingAddressList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items!= nil { in, out := &in.Items, &out.Items *out = make([]MessagingAddress, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressList. func (in *MessagingAddressList) DeepCopy() *MessagingAddressList { if in == nil { return nil } out := new(MessagingAddressList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingAddressList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressPlan) DeepCopyInto(out *MessagingAddressPlan) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressPlan. func (in *MessagingAddressPlan) DeepCopy() *MessagingAddressPlan { if in == nil { return nil } out := new(MessagingAddressPlan) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingAddressPlan) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressPlanCondition) DeepCopyInto(out *MessagingAddressPlanCondition) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressPlanCondition. func (in *MessagingAddressPlanCondition) DeepCopy() *MessagingAddressPlanCondition { if in == nil { return nil } out := new(MessagingAddressPlanCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressPlanList) DeepCopyInto(out *MessagingAddressPlanList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items!= nil { in, out := &in.Items, &out.Items *out = make([]MessagingAddressPlan, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressPlanList. func (in *MessagingAddressPlanList) DeepCopy() *MessagingAddressPlanList { if in == nil { return nil } out := new(MessagingAddressPlanList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingAddressPlanList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressPlanSpec) DeepCopyInto(out *MessagingAddressPlanSpec) { *out = *in if in.NamespaceSelector!= nil { in, out := &in.NamespaceSelector, &out.NamespaceSelector *out = new(NamespaceSelector) (*in).DeepCopyInto(*out) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressPlanSpec. func (in *MessagingAddressPlanSpec) DeepCopy() *MessagingAddressPlanSpec { if in == nil { return nil } out := new(MessagingAddressPlanSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressPlanStatus) DeepCopyInto(out *MessagingAddressPlanStatus) { *out = *in if in.Conditions!= nil { in, out := &in.Conditions, &out.Conditions *out = make([]MessagingAddressPlanCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressPlanStatus. func (in *MessagingAddressPlanStatus) DeepCopy() *MessagingAddressPlanStatus { if in == nil { return nil } out := new(MessagingAddressPlanStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressSpec) DeepCopyInto(out *MessagingAddressSpec) { *out = *in if in.Address!= nil { in, out := &in.Address, &out.Address *out = new(string) **out = **in } if in.Anycast!= nil { in, out := &in.Anycast, &out.Anycast *out = new(MessagingAddressSpecAnycast) **out = **in } if in.Multicast!= nil { in, out := &in.Multicast, &out.Multicast *out = new(MessagingAddressSpecMulticast) **out = **in } if in.Queue!= nil { in, out := &in.Queue, &out.Queue *out = new(MessagingAddressSpecQueue) **out = **in } if in.Topic!= nil { in, out := &in.Topic, &out.Topic *out = new(MessagingAddressSpecTopic) **out = **in } if in.Subscription!= nil { in, out := &in.Subscription, &out.Subscription *out = new(MessagingAddressSpecSubscription) **out = **in } if in.DeadLetter!= nil { in, out := &in.DeadLetter, &out.DeadLetter *out = new(MessagingAddressSpecDeadLetter) **out = **in } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressSpec. func (in *MessagingAddressSpec) DeepCopy() *MessagingAddressSpec { if in == nil { return nil } out := new(MessagingAddressSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressSpecAnycast) DeepCopyInto(out *MessagingAddressSpecAnycast) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressSpecAnycast. func (in *MessagingAddressSpecAnycast) DeepCopy() *MessagingAddressSpecAnycast { if in == nil { return nil } out := new(MessagingAddressSpecAnycast) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressSpecDeadLetter) DeepCopyInto(out *MessagingAddressSpecDeadLetter) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressSpecDeadLetter. func (in *MessagingAddressSpecDeadLetter) DeepCopy() *MessagingAddressSpecDeadLetter { if in == nil { return nil } out := new(MessagingAddressSpecDeadLetter) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressSpecMulticast) DeepCopyInto(out *MessagingAddressSpecMulticast) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressSpecMulticast. func (in *MessagingAddressSpecMulticast) DeepCopy() *MessagingAddressSpecMulticast { if in == nil { return nil } out := new(MessagingAddressSpecMulticast) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressSpecQueue) DeepCopyInto(out *MessagingAddressSpecQueue) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressSpecQueue. func (in *MessagingAddressSpecQueue) DeepCopy() *MessagingAddressSpecQueue { if in == nil { return nil } out := new(MessagingAddressSpecQueue) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressSpecSubscription) DeepCopyInto(out *MessagingAddressSpecSubscription) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressSpecSubscription. func (in *MessagingAddressSpecSubscription) DeepCopy() *MessagingAddressSpecSubscription { if in == nil { return nil } out := new(MessagingAddressSpecSubscription) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressSpecTopic) DeepCopyInto(out *MessagingAddressSpecTopic) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressSpecTopic. func (in *MessagingAddressSpecTopic) DeepCopy() *MessagingAddressSpecTopic { if in == nil { return nil } out := new(MessagingAddressSpecTopic) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressStatus) DeepCopyInto(out *MessagingAddressStatus) { *out = *in if in.Conditions!= nil { in, out := &in.Conditions, &out.Conditions *out = make([]MessagingAddressCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.Brokers!= nil { in, out := &in.Brokers, &out.Brokers *out = make([]MessagingAddressBroker, len(*in)) copy(*out, *in) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressStatus. func (in *MessagingAddressStatus) DeepCopy() *MessagingAddressStatus { if in == nil { return nil } out := new(MessagingAddressStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpoint) DeepCopyInto(out *MessagingEndpoint) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpoint. func (in *MessagingEndpoint) DeepCopy() *MessagingEndpoint { if in == nil { return nil } out := new(MessagingEndpoint) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingEndpoint) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointCertValidity) DeepCopyInto(out *MessagingEndpointCertValidity) { *out = *in in.NotBefore.DeepCopyInto(&out.NotBefore) in.NotAfter.DeepCopyInto(&out.NotAfter) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointCertValidity. func (in *MessagingEndpointCertValidity) DeepCopy() *MessagingEndpointCertValidity { if in == nil { return nil } out := new(MessagingEndpointCertValidity) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointCondition) DeepCopyInto(out *MessagingEndpointCondition) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointCondition. func (in *MessagingEndpointCondition) DeepCopy() *MessagingEndpointCondition { if in == nil { return nil } out := new(MessagingEndpointCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointList) DeepCopyInto(out *MessagingEndpointList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items!= nil { in, out := &in.Items, &out.Items *out = make([]MessagingEndpoint, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointList. func (in *MessagingEndpointList) DeepCopy() *MessagingEndpointList { if in == nil { return nil } out := new(MessagingEndpointList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingEndpointList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointPort) DeepCopyInto(out *MessagingEndpointPort) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointPort. func (in *MessagingEndpointPort) DeepCopy() *MessagingEndpointPort { if in == nil { return nil } out := new(MessagingEndpointPort) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointSpec) DeepCopyInto(out *MessagingEndpointSpec) { *out = *in if in.Tls!= nil { in, out := &in.Tls, &out.Tls *out = new(MessagingEndpointSpecTls) (*in).DeepCopyInto(*out) } if in.Annotations!= nil { in, out := &in.Annotations, &out.Annotations *out = make(map[string]string, len(*in)) for key, val := range *in { (*out)[key] = val } } if in.Protocols!= nil { in, out := &in.Protocols, &out.Protocols *out = make([]MessagingEndpointProtocol, len(*in)) copy(*out, *in) } if in.Host!= nil { in, out := &in.Host, &out.Host *out = new(string) **out = **in } if in.Cluster!= nil { in, out := &in.Cluster, &out.Cluster *out = new(MessagingEndpointSpecCluster) **out = **in } if in.Ingress!= nil { in, out := &in.Ingress, &out.Ingress *out = new(MessagingEndpointSpecIngress) **out = **in } if in.Route!= nil { in, out := &in.Route, &out.Route *out = new(MessagingEndpointSpecRoute) (*in).DeepCopyInto(*out) } if in.NodePort!= nil { in, out := &in.NodePort, &out.NodePort *out = new(MessagingEndpointSpecNodePort) **out = **in } if in.LoadBalancer!= nil { in, out := &in.LoadBalancer, &out.LoadBalancer *out = new(MessagingEndpointSpecLoadBalancer) **out = **in } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointSpec. func (in *MessagingEndpointSpec) DeepCopy() *MessagingEndpointSpec { if in == nil { return nil } out := new(MessagingEndpointSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointSpecCluster) DeepCopyInto(out *MessagingEndpointSpecCluster) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointSpecCluster. func (in *MessagingEndpointSpecCluster) DeepCopy() *MessagingEndpointSpecCluster { if in == nil { return nil } out := new(MessagingEndpointSpecCluster) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointSpecIngress) DeepCopyInto(out *MessagingEndpointSpecIngress) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointSpecIngress. func (in *MessagingEndpointSpecIngress) DeepCopy() *MessagingEndpointSpecIngress { if in == nil { return nil } out := new(MessagingEndpointSpecIngress) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointSpecLoadBalancer) DeepCopyInto(out *MessagingEndpointSpecLoadBalancer) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointSpecLoadBalancer. func (in *MessagingEndpointSpecLoadBalancer) DeepCopy() *MessagingEndpointSpecLoadBalancer { if in == nil { return nil } out := new(MessagingEndpointSpecLoadBalancer) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointSpecNodePort) DeepCopyInto(out *MessagingEndpointSpecNodePort) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointSpecNodePort. func (in *MessagingEndpointSpecNodePort) DeepCopy() *MessagingEndpointSpecNodePort { if in == nil { return nil } out := new(MessagingEndpointSpecNodePort) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointSpecRoute) DeepCopyInto(out *MessagingEndpointSpecRoute) { *out = *in if in.TlsTermination!= nil { in, out := &in.TlsTermination, &out.TlsTermination *out = new(routev1.TLSTerminationType) **out = **in } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointSpecRoute. func (in *MessagingEndpointSpecRoute) DeepCopy() *MessagingEndpointSpecRoute { if in == nil { return nil } out := new(MessagingEndpointSpecRoute) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointSpecTls) DeepCopyInto(out *MessagingEndpointSpecTls) { *out = *in if in.Protocols!= nil { in, out := &in.Protocols, &out.Protocols *out = new(string) **out = **in } if in.Ciphers!= nil { in, out := &in.Ciphers, &out.Ciphers *out = new(string) **out = **in } if in.Selfsigned!= nil { in, out := &in.Selfsigned, &out.Selfsigned *out = new(MessagingEndpointSpecTlsSelfsigned) **out = **in } if in.Openshift!= nil { in, out := &in.Openshift, &out.Openshift *out = new(MessagingEndpointSpecTlsOpenshift) **out = **in } if in.External!= nil { in, out := &in.External, &out.External *out = new(MessagingEndpointSpecTlsExternal) (*in).DeepCopyInto(*out) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointSpecTls. func (in *MessagingEndpointSpecTls) DeepCopy() *MessagingEndpointSpecTls { if in == nil { return nil } out := new(MessagingEndpointSpecTls) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointSpecTlsExternal) DeepCopyInto(out *MessagingEndpointSpecTlsExternal) { *out = *in in.Key.DeepCopyInto(&out.Key) in.Certificate.DeepCopyInto(&out.Certificate) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointSpecTlsExternal. func (in *MessagingEndpointSpecTlsExternal) DeepCopy() *MessagingEndpointSpecTlsExternal { if in == nil { return nil } out := new(MessagingEndpointSpecTlsExternal) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointSpecTlsOpenshift) DeepCopyInto(out *MessagingEndpointSpecTlsOpenshift) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointSpecTlsOpenshift. func (in *MessagingEndpointSpecTlsOpenshift) DeepCopy() *MessagingEndpointSpecTlsOpenshift { if in == nil { return nil } out := new(MessagingEndpointSpecTlsOpenshift) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointSpecTlsSelfsigned) DeepCopyInto(out *MessagingEndpointSpecTlsSelfsigned) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointSpecTlsSelfsigned. func (in *MessagingEndpointSpecTlsSelfsigned) DeepCopy() *MessagingEndpointSpecTlsSelfsigned { if in == nil { return nil } out := new(MessagingEndpointSpecTlsSelfsigned) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointStatus) DeepCopyInto(out *MessagingEndpointStatus) { *out = *in if in.Conditions!= nil { in, out := &in.Conditions, &out.Conditions *out = make([]MessagingEndpointCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.Ports!= nil { in, out := &in.Ports, &out.Ports *out = make([]MessagingEndpointPort, len(*in)) copy(*out, *in) } if in.Tls!= nil { in, out := &in.Tls, &out.Tls *out = new(MessagingEndpointStatusTls) (*in).DeepCopyInto(*out) } if in.InternalPorts!= nil { in, out := &in.InternalPorts, &out.InternalPorts *out = make([]MessagingEndpointPort, len(*in)) copy(*out, *in) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointStatus. func (in *MessagingEndpointStatus) DeepCopy() *MessagingEndpointStatus { if in == nil { return nil } out := new(MessagingEndpointStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingEndpointStatusTls) DeepCopyInto(out *MessagingEndpointStatusTls) { *out = *in if in.CertificateValidity!= nil { in, out := &in.CertificateValidity, &out.CertificateValidity *out = new(MessagingEndpointCertValidity) (*in).DeepCopyInto(*out) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingEndpointStatusTls. func (in *MessagingEndpointStatusTls) DeepCopy() *MessagingEndpointStatusTls { if in == nil { return nil } out := new(MessagingEndpointStatusTls) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructure) DeepCopyInto(out *MessagingInfrastructure) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructure. func (in *MessagingInfrastructure) DeepCopy() *MessagingInfrastructure { if in == nil { return nil } out := new(MessagingInfrastructure) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingInfrastructure) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureCondition) DeepCopyInto(out *MessagingInfrastructureCondition) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureCondition. func (in *MessagingInfrastructureCondition) DeepCopy() *MessagingInfrastructureCondition { if in == nil { return nil } out := new(MessagingInfrastructureCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureList) DeepCopyInto(out *MessagingInfrastructureList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items!= nil { in, out := &in.Items, &out.Items *out = make([]MessagingInfrastructure, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureList. func (in *MessagingInfrastructureList) DeepCopy() *MessagingInfrastructureList { if in == nil { return nil } out := new(MessagingInfrastructureList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingInfrastructureList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureSpec) DeepCopyInto(out *MessagingInfrastructureSpec) { *out = *in if in.NamespaceSelector!= nil { in, out := &in.NamespaceSelector, &out.NamespaceSelector *out = new(NamespaceSelector) (*in).DeepCopyInto(*out) } in.Router.DeepCopyInto(&out.Router) in.Broker.DeepCopyInto(&out.Broker) in.AccessControl.DeepCopyInto(&out.AccessControl) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureSpec. func (in *MessagingInfrastructureSpec) DeepCopy() *MessagingInfrastructureSpec { if in == nil { return nil } out := new(MessagingInfrastructureSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureSpecAccessControl) DeepCopyInto(out *MessagingInfrastructureSpecAccessControl) { *out = *in if in.Replicas!= nil { in, out := &in.Replicas, &out.Replicas *out = new(int32) **out = **in } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureSpecAccessControl. func (in *MessagingInfrastructureSpecAccessControl) DeepCopy() *MessagingInfrastructureSpecAccessControl { if in == nil { return nil } out := new(MessagingInfrastructureSpecAccessControl) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureSpecBroker) DeepCopyInto(out *MessagingInfrastructureSpecBroker) { *out = *in if in.InitImage!= nil { in, out := &in.InitImage, &out.InitImage *out = new(v1beta1.ImageOverride) **out = **in } if in.Image!= nil { in, out := &in.Image, &out.Image *out = new(v1beta1.ImageOverride) **out = **in } if in.ScalingStrategy!= nil { in, out := &in.ScalingStrategy, &out.ScalingStrategy *out = new(MessagingInfrastructureSpecBrokerScalingStrategy) (*in).DeepCopyInto(*out) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureSpecBroker. func (in *MessagingInfrastructureSpecBroker) DeepCopy() *MessagingInfrastructureSpecBroker { if in == nil { return nil } out := new(MessagingInfrastructureSpecBroker) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureSpecBrokerScalingStrategy) DeepCopyInto(out *MessagingInfrastructureSpecBrokerScalingStrategy) { *out = *in if in.Static!= nil { in, out := &in.Static, &out.Static *out = new(MessagingInfrastructureSpecBrokerScalingStrategyStatic) **out = **in } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureSpecBrokerScalingStrategy. func (in *MessagingInfrastructureSpecBrokerScalingStrategy) DeepCopy() *MessagingInfrastructureSpecBrokerScalingStrategy { if in == nil { return nil } out := new(MessagingInfrastructureSpecBrokerScalingStrategy) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureSpecBrokerScalingStrategyStatic) DeepCopyInto(out *MessagingInfrastructureSpecBrokerScalingStrategyStatic) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureSpecBrokerScalingStrategyStatic. func (in *MessagingInfrastructureSpecBrokerScalingStrategyStatic) DeepCopy() *MessagingInfrastructureSpecBrokerScalingStrategyStatic { if in == nil { return nil } out := new(MessagingInfrastructureSpecBrokerScalingStrategyStatic) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureSpecRouter) DeepCopyInto(out *MessagingInfrastructureSpecRouter) { *out = *in if in.Image!= nil { in, out := &in.Image, &out.Image *out = new(v1beta1.ImageOverride) **out = **in } if in.ScalingStrategy!= nil { in, out := &in.ScalingStrategy, &out.ScalingStrategy *out = new(MessagingInfrastructureSpecRouterScalingStrategy) (*in).DeepCopyInto(*out) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureSpecRouter. func (in *MessagingInfrastructureSpecRouter) DeepCopy() *MessagingInfrastructureSpecRouter { if in == nil { return nil } out := new(MessagingInfrastructureSpecRouter) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureSpecRouterScalingStrategy) DeepCopyInto(out *MessagingInfrastructureSpecRouterScalingStrategy) { *out = *in if in.Static!= nil { in, out := &in.Static, &out.Static *out = new(MessagingInfrastructureSpecRouterScalingStrategyStatic) **out = **in } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureSpecRouterScalingStrategy. func (in *MessagingInfrastructureSpecRouterScalingStrategy) DeepCopy() *MessagingInfrastructureSpecRouterScalingStrategy { if in == nil { return nil } out := new(MessagingInfrastructureSpecRouterScalingStrategy) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureSpecRouterScalingStrategyStatic) DeepCopyInto(out *MessagingInfrastructureSpecRouterScalingStrategyStatic) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureSpecRouterScalingStrategyStatic. func (in *MessagingInfrastructureSpecRouterScalingStrategyStatic) DeepCopy() *MessagingInfrastructureSpecRouterScalingStrategyStatic { if in == nil { return nil } out := new(MessagingInfrastructureSpecRouterScalingStrategyStatic) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureStatus) DeepCopyInto(out *MessagingInfrastructureStatus) { *out = *in if in.Conditions!= nil { in, out := &in.Conditions, &out.Conditions *out = make([]MessagingInfrastructureCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.Routers!= nil { in, out := &in.Routers, &out.Routers *out = make([]MessagingInfrastructureStatusRouter, len(*in)) copy(*out, *in) } if in.Brokers!= nil { in, out := &in.Brokers, &out.Brokers *out = make([]MessagingInfrastructureStatusBroker, len(*in)) copy(*out, *in) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureStatus. func (in *MessagingInfrastructureStatus) DeepCopy() *MessagingInfrastructureStatus { if in == nil { return nil } out := new(MessagingInfrastructureStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureStatusBroker) DeepCopyInto(out *MessagingInfrastructureStatusBroker) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureStatusBroker. func (in *MessagingInfrastructureStatusBroker) DeepCopy() *MessagingInfrastructureStatusBroker { if in == nil { return nil } out := new(MessagingInfrastructureStatusBroker) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingInfrastructureStatusRouter) DeepCopyInto(out *MessagingInfrastructureStatusRouter) { *out = *in return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingInfrastructureStatusRouter. func (in *MessagingInfrastructureStatusRouter) DeepCopy() *MessagingInfrastructureStatusRouter { if in == nil { return nil } out := new(MessagingInfrastructureStatusRouter) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingPlan) DeepCopyInto(out *MessagingPlan) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingPlan. func (in *MessagingPlan) DeepCopy() *MessagingPlan { if in == nil { return nil } out := new(MessagingPlan) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingPlan) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingPlanCondition) DeepCopyInto(out *MessagingPlanCondition) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingPlanCondition. func (in *MessagingPlanCondition) DeepCopy() *MessagingPlanCondition { if in == nil { return nil } out := new(MessagingPlanCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingPlanList) DeepCopyInto(out *MessagingPlanList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items!= nil { in, out := &in.Items, &out.Items *out = make([]MessagingPlan, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingPlanList. func (in *MessagingPlanList) DeepCopy() *MessagingPlanList { if in == nil { return nil } out := new(MessagingPlanList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingPlanList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingPlanSpec) DeepCopyInto(out *MessagingPlanSpec) { *out = *in if in.NamespaceSelector!= nil { in, out := &in.NamespaceSelector, &out.NamespaceSelector *out = new(NamespaceSelector) (*in).DeepCopyInto(*out) } if in.Resources!= nil { in, out := &in.Resources, &out.Resources *out = new(MessagingPlanSpecResources) (*in).DeepCopyInto(*out) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingPlanSpec. func (in *MessagingPlanSpec) DeepCopy() *MessagingPlanSpec { if in == nil { return nil } out := new(MessagingPlanSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingPlanSpecResources) DeepCopyInto(out *MessagingPlanSpecResources) { *out = *in if in.Limits!= nil { in, out := &in.Limits, &out.Limits *out = make(map[MessagingPlanResource]resource.Quantity, len(*in)) for key, val := range *in { (*out)[key] = val.DeepCopy() } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingPlanSpecResources. func (in *MessagingPlanSpecResources) DeepCopy() *MessagingPlanSpecResources { if in == nil { return nil } out := new(MessagingPlanSpecResources) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingPlanStatus) DeepCopyInto(out *MessagingPlanStatus) { *out = *in if in.Conditions!= nil { in, out := &in.Conditions, &out.Conditions *out = make([]MessagingPlanCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingPlanStatus. func (in *MessagingPlanStatus) DeepCopy() *MessagingPlanStatus { if in == nil { return nil } out := new(MessagingPlanStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingProject) DeepCopyInto(out *MessagingProject) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingProject. func (in *MessagingProject) DeepCopy() *MessagingProject { if in == nil { return nil } out := new(MessagingProject) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingProject) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingProjectCondition) DeepCopyInto(out *MessagingProjectCondition) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingProjectCondition. func (in *MessagingProjectCondition) DeepCopy() *MessagingProjectCondition { if in == nil { return nil } out := new(MessagingProjectCondition) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingProjectList) DeepCopyInto(out *MessagingProjectList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items!= nil { in, out := &in.Items, &out.Items *out = make([]MessagingProject, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingProjectList. func (in *MessagingProjectList) DeepCopy() *MessagingProjectList { if in == nil { return nil } out := new(MessagingProjectList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *MessagingProjectList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c!= nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingProjectSpec) DeepCopyInto(out *MessagingProjectSpec) { *out = *in if in.MessagingInfrastructureRef!= nil { in, out := &in.MessagingInfrastructureRef, &out.MessagingInfrastructureRef *out = new(ObjectReference) **out = **in } if in.MessagingPlanRef!= nil { in, out := &in.MessagingPlanRef, &out.MessagingPlanRef *out = new(ObjectReference) **out = **in } if in.Capabilities!= nil { in, out := &in.Capabilities, &out.Capabilities *out = make([]MessagingCapability, len(*in)) copy(*out, *in) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingProjectSpec. func (in *MessagingProjectSpec) DeepCopy() *MessagingProjectSpec { if in == nil { return nil } out := new(MessagingProjectSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingProjectStatus) DeepCopyInto(out *MessagingProjectStatus) { *out = *in out.MessagingInfrastructureRef = in.MessagingInfrastructureRef if in.MessagingPlanRef!= nil { in, out := &in.MessagingPlanRef, &out.MessagingPlanRef *out = new(ObjectReference) **out = **in } if in.AppliedMessagingPlan!= nil { in, out := &in.AppliedMessagingPlan, &out.AppliedMessagingPlan *out = new(MessagingPlanSpec) (*in).DeepCopyInto(*out) } if in.Conditions!= nil { in, out := &in.Conditions, &out.Conditions *out = make([]MessagingProjectCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.Capabilities!= nil { in, out := &in.Capabilities, &out.Capabilities *out = make([]MessagingCapability, len
65,836