blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
048ff63801b0605f9393642b823b3b4f4fb331bb
b940216c424595df75c42e535845397f8152d438
/ToMauScanLine/ToMauScanLine.cpp
d40f4fad85cfc8e1f5ca7e19fbec966603ca0654
[]
no_license
lechitu/DoHoa
506beab7a781163eb5acd4e4942205073e444ac3
5dde77dc13a7911b169623948dad046a24b5c092
refs/heads/master
2020-04-26T08:25:04.798667
2019-03-20T10:51:46
2019-03-20T10:51:46
173,422,287
1
0
null
null
null
null
UTF-8
C++
false
false
1,438
cpp
ToMauScanLine.cpp
#include <iostream> #include <conio.h> #include <graphics.h> #include <stdlib.h> using namespace std; struct ToaDo{ int x, y; }; void nhapDaGiac(ToaDo p[], int v){ int i; for(i=0;i<v;i++){ cout<<"\nNhap toa do dinh "<<i+1<<": "; cout<<"\n\tx["<<(i+1)<<"] = ";cin>>p[i].x; cout<<"\n\ty["<<(i+1)<<"] = ";cin>>p[i].y; } p[i].x=p[0].x; p[i].y=p[0].y; } void veDaGiac(ToaDo p[], int v){ for(int i=0;i<v;i++){ line(p[i].x, p[i].y, p[i+1].x, p[i+1].y); } } void scanLine(ToaDo p[], int v){ int xmin, xmax, ymin, ymax, c, mang[50]; xmin=xmax=p[0].x; ymin=ymax=p[0].y; for(int i=0;i<v;i++){ if(xmin>p[i].x) xmin=p[i].x; if(xmax<p[i].x) xmax=p[i].x; if(ymin>p[i].y) ymin=p[i].y; if(ymax<p[i].y) ymax=p[i].y; } float y; y=ymin+0.01; while(y<=ymax){ int x, x1, x2, y1, y2, tg; c=0; for(int i=0;i<v;i++){ x1=p[i].x; y1=p[i].y; x2=p[i+1].x; y2=p[i+1].y; if(y2<y1){ tg=x1;x1=x2;x2=tg; tg=y1;y1=y2;y2=tg; } if(y<=y2 && y>=y1){ if(y1==y2) x=x1; else{ x=((y-y1)*(x2-x1))/(y2-y1); x+=x1; } if(x<=xmax && x>=xmin) mang[c++]=x; } } for(int i=0;i<c;i+=2){ delay(30); line(mang[i], y, mang[i+1], y); } y++; } } int main(){ int c = BLUE; int driver=0,mode; initgraph(&driver,&mode,""); int v; do{ cout<<"nhap so dinh da giac: ";cin>>v; }while(v<3); ToaDo p[v]; nhapDaGiac(p, v); veDaGiac(p, v); setcolor(c); scanLine(p, v); getch(); }
fc7e5dd4b13987363137e9dcff9aebfb9a4d26bf
660f80c548c920c4222bb4af1676edfb8f6ce301
/DirectX/Mesh/VertexArray.h
f0876cdd59f85d281f5efd53d9ac14465e9e4eeb
[]
no_license
soelusoelu/DirectXBase
a2fd4c163f5a73ecf738e8ccae45cebddb4b3762
029cd93b913ca75be1fda11a1f9ab2c6774cda97
refs/heads/master
2020-11-28T12:12:03.970203
2020-06-20T00:13:41
2020-06-20T00:13:41
229,805,694
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
1,121
h
VertexArray.h
#pragma once #include <memory> #include <vector> class IndexBuffer; class VertexBuffer; class VertexArray { using IndexBufferPtr = std::unique_ptr<IndexBuffer>; using IndexBufferPtrArray = std::vector<IndexBufferPtr>; public: VertexArray(); ~VertexArray(); void setNumVerts(unsigned num); unsigned getNumVerts() const; void setNumNormal(unsigned num); unsigned getNumNormal() const; void setNumTex(unsigned num); unsigned getNumTex() const; void setNumFace(unsigned num); unsigned getNumFace() const; void createVertexBuffer(unsigned vertexSize, const void* data); void createIndexBuffer(unsigned index, unsigned numFace, const void* data); void setVertexBuffer(unsigned numStream = 1, unsigned start = 0, unsigned offset = 0); void setIndexBuffer(unsigned index, unsigned offset = 0); private: unsigned mNumVerts; //頂点数 unsigned mNumNormal; //法線数 unsigned mNumTex; //テクスチャ座標数 unsigned mNumFace; //ポリゴン数 std::unique_ptr<VertexBuffer> mVertexBuffer; IndexBufferPtrArray mIndexBuffer; };
b515c58d6afdcadb551852d865c97690dc6a9eec
ae5e633003f23b107350e640d8e21e6e61f6b097
/include/ncine/LuaIInputEventHandler.h
8c013877c58bdfaacaca4d1bd191adacfc303f4e
[ "MIT" ]
permissive
nCine/nCine
6a723f0a26d53fd5d1f6694ad244122cbcdbe4e0
d80f0e651be8981fde21ddccbc8a695b7a738727
refs/heads/master
2023-07-20T02:43:48.931548
2023-07-10T20:59:49
2023-07-10T20:59:49
189,073,851
954
70
MIT
2021-06-30T16:55:45
2019-05-28T17:31:43
C++
UTF-8
C++
false
false
2,220
h
LuaIInputEventHandler.h
#ifndef CLASS_NCINE_LUAIINPUTEVENTHANDLER #define CLASS_NCINE_LUAIINPUTEVENTHANDLER #include "common_defines.h" struct lua_State; namespace ncine { class KeyboardEvent; class TextInputEvent; class MouseEvent; class MouseState; class ScrollEvent; class JoyButtonEvent; class JoyHatEvent; class JoyAxisEvent; class JoyMappedButtonEvent; class JoyMappedAxisEvent; class JoyConnectionEvent; class TouchEvent; class AccelerometerEvent; /// Wrapper around the `IInputEventHandler` class class DLL_PUBLIC LuaIInputEventHandler { public: static void onKeyPressed(lua_State *L, const KeyboardEvent &event); static void onKeyReleased(lua_State *L, const KeyboardEvent &event); static void onTextInput(lua_State *L, const TextInputEvent &event); static void onTouchDown(lua_State *L, const TouchEvent &event); static void onTouchUp(lua_State *L, const TouchEvent &event); static void onTouchMove(lua_State *L, const TouchEvent &event); static void onPointerDown(lua_State *L, const TouchEvent &event); static void onPointerUp(lua_State *L, const TouchEvent &event); #ifdef __ANDROID__ static void onAcceleration(lua_State *L, const AccelerometerEvent &event); #endif static void onMouseButtonPressed(lua_State *L, const MouseEvent &event); static void onMouseButtonReleased(lua_State *L, const MouseEvent &event); static void onMouseMoved(lua_State *L, const MouseState &state); static void onScrollInput(lua_State *L, const ScrollEvent &event); static void onJoyButtonPressed(lua_State *L, const JoyButtonEvent &event); static void onJoyButtonReleased(lua_State *L, const JoyButtonEvent &event); static void onJoyHatMoved(lua_State *L, const JoyHatEvent &event); static void onJoyAxisMoved(lua_State *L, const JoyAxisEvent &event); static void onJoyMappedButtonPressed(lua_State *L, const JoyMappedButtonEvent &event); static void onJoyMappedButtonReleased(lua_State *L, const JoyMappedButtonEvent &event); static void onJoyMappedAxisMoved(lua_State *L, const JoyMappedAxisEvent &event); static void onJoyConnected(lua_State *L, const JoyConnectionEvent &event); static void onJoyDisconnected(lua_State *L, const JoyConnectionEvent &event); static bool onQuitRequest(lua_State *L); }; } #endif
fd5e8c13103f64c340a70f9609405459d76e16f5
8e26dc682cb00586220a855dc737656e4ad538fd
/cs3130-hw2/main.cpp
40badf7701f4266b0dbf4e38c1d49801c558d457
[]
no_license
neuromanxr/data-structures-class
888b7cb4877c166c6d4cd9e928ebf23bb35e15f1
2b74e999968e0e03bb261b8fe596d3404c073fcb
refs/heads/master
2016-09-16T10:14:28.114980
2014-07-10T17:02:56
2014-07-10T17:02:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,901
cpp
main.cpp
#include <iostream> #include <fstream> #include <sstream> #include <string> #include <cstdlib> /* CIS 3130 ASSIGNMENT # 2 KELVIN LEE Multi-dimension Arrays */ using namespace std; void readInCards(string cardsArray[18][5]); string intToString(int number); int main() { int cardsItem1 = 0; int cardsItem2 = 0; int cardsItem3 = 0; int recordItem1 = 0; int recordItem2 = 0; int recordItem3 = 0; int totalItem1 = 0; int totalItem2 = 0; int totalItem3 = 0; float price; int mostOfItem; string item1; string item2; string item3; string warehouseRecord[5][4] = { {"NY", "0", "0", "0"}, {"LA", "0", "0", "0"}, {"Miami", "0", "0", "0"}, {"Houston", "0", "0", "0"}, {"Chicago", "0", "0", "0"} }; float priceOfItems[3] = {2.00, 7.00, 8.50}; string cardsArray[18][5]; readInCards(cardsArray); for (int i = 0; i < 5; i++) { for (int n = 0; n < 18; n++) { if (warehouseRecord[i][0] == cardsArray[n][1]) { if (cardsArray[n][0] == "s") { cout << "Shipment read in: " << warehouseRecord[i][0] << " " << cardsArray[n][2] << " " << cardsArray[n][3] << " " << cardsArray[n][4] << endl; cardsItem1 = atoi(cardsArray[n][2].c_str()); // convert cards item 1 to int cardsItem2 = atoi(cardsArray[n][3].c_str()); // convert cards item 2 to int cardsItem3 = atoi(cardsArray[n][4].c_str()); // convert cards item 3 to int recordItem1 = atoi(warehouseRecord[i][1].c_str()); recordItem2 = atoi(warehouseRecord[i][2].c_str()); recordItem3 = atoi(warehouseRecord[i][3].c_str()); totalItem1 = cardsItem1 + recordItem1; // add shipment to warehouse totalItem2 = cardsItem2 + recordItem2; totalItem3 = cardsItem3 + recordItem3; item1 = intToString(totalItem1); // convert back to string item2 = intToString(totalItem2); item3 = intToString(totalItem3); warehouseRecord[i][1] = item1; // put new value to array warehouseRecord[i][2] = item2; warehouseRecord[i][3] = item3; cout << "In warehouse: " << warehouseRecord[i][0] << " " << warehouseRecord[i][1] << " " << warehouseRecord[i][2] << " " << warehouseRecord[i][3] << endl; } else if (cardsArray[n][0] == "o") { cout << "Order read in: " << warehouseRecord[i][0] << " " << cardsArray[n][2] << " " << cardsArray[n][3] << " " << cardsArray[n][4] << endl; cardsItem1 = atoi(cardsArray[n][2].c_str()); cardsItem2 = atoi(cardsArray[n][3].c_str()); cardsItem3 = atoi(cardsArray[n][4].c_str()); recordItem1 = atoi(warehouseRecord[i][1].c_str()); recordItem2 = atoi(warehouseRecord[i][2].c_str()); recordItem3 = atoi(warehouseRecord[i][3].c_str()); if (cardsItem1 < recordItem1) { totalItem1 = recordItem1 - cardsItem1; price = totalItem1 * priceOfItems[0]; // calculate price of item1 item1 = intToString(totalItem1); warehouseRecord[i][1] = item1; cout << "Item 1: Order filled. Price of order: $" << price << endl; } else { for(int i = 0; i < 5; i++) // go through each city warehouse and check for item 1 availability, find the most { cout << "Looking through warehouse in: " << warehouseRecord[i][0] << endl; if (atoi(warehouseRecord[i][1].c_str()) > cardsItem1) // does this city warehouse have enough of item 1? { // set this warehouse record to be the most and compare it to the order quantity // if the quantity is enough, send from this warehouse to the warehouse that is short on supply cout << "Item 1: Order filled." << endl; } else // other city warehouses don't have enough of item 1 { cout << "Item 1: Order Unfilled" << endl; } } } if (cardsItem2 < recordItem2) { totalItem2 = recordItem2 - cardsItem2; price = totalItem2 * priceOfItems[1]; item2 = intToString(totalItem2); warehouseRecord[i][2] = item2; cout << "Item 2: Order filled. Price of order: $" << price << endl; } else { for(int i = 0; i < 5; i++) // go through each city warehouse and check for item 2 availability, find the most { cout << "Looking through warehouse in: " << warehouseRecord[i][0] << endl; if (atoi(warehouseRecord[i][2].c_str()) > cardsItem2) // does this city warehouse have enough of item 2? { // set this warehouse record to be the most and compare it to the order quantity // if the quantity is enough, send from this warehouse to the warehouse that is short on supply cout << "Item 2: Order filled." << endl; } else // other city warehouses don't have enough of item 2 { cout << "Item 2: Order Unfilled" << endl; } } } if (cardsItem3 < recordItem3) { totalItem3 = recordItem3 - cardsItem3; price = totalItem3 * priceOfItems[2]; item3 = intToString(totalItem3); warehouseRecord[i][3] = item3; cout << "Item 3: Order filled. Price of order: $" << price << endl; } else { for(int i = 0; i < 5; i++) // go through each city warehouse and check for item 3 availability, find the most { cout << "Looking through warehouse in: " << warehouseRecord[i][0] << endl; if (atoi(warehouseRecord[i][3].c_str()) > cardsItem3) // does this city warehouse have enough of item 3? { // set this warehouse record to be the most and compare it to the order quantity // if the quantity is enough, send from this warehouse to the warehouse that is short on supply cout << "Item 3: Order filled." << endl; } else // other city warehouses don't have enough of item 3 { cout << "Item 3: Order Unfilled" << endl; } } } } } } } // What's in the warehouseRecord for (int i = 0; i < 5; i++) { cout << warehouseRecord[i][0] << " " << warehouseRecord[i][1] << " " << warehouseRecord[i][2] << " " << warehouseRecord[i][3] << endl; } return 0; } void readInCards(string cardsArray[18][5]) { ifstream cardsIn("cards.txt"); if (cardsIn) { cout << "File open successful" << endl; // read in cards file for (int i = 0; i < 18; i++) { cardsIn >> cardsArray[i][0] >> cardsArray[i][1] >> cardsArray[i][2] >> cardsArray[i][3] >> cardsArray[i][4]; } // for (int i = 0; i < 18; i++) // { // cout << cardsArray[i][0] << " " << cardsArray[i][1] << " " << cardsArray[i][2] << " " << cardsArray[i][3] << " " << cardsArray[i][4] << endl; // } cardsIn.close(); } } string intToString(int number) { string numberBackToArray; stringstream ss(stringstream::in | stringstream::out); ss << number; numberBackToArray = ss.str(); return numberBackToArray; }
448df73da136ae1b74761455d20b53d7055a5938
ebc779fb8626699a3297288830d75adabfd173af
/tests/usb_test.cpp
315b833b7e7ca8ede29f0f5666ff54697e281577
[ "MIT" ]
permissive
weiyongwill/hFramework
226f7353d17ee288fee554ee5e6adc3c0d8d34f2
ca8254a276597b427fadf56b410d38f784f792cd
refs/heads/master
2021-02-17T10:53:43.123947
2020-01-14T10:38:28
2020-01-14T10:38:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
993
cpp
usb_test.cpp
#include <cstddef> #include <cstdint> #include <stdio.h> #include "hFramework.h" hMotor hMot1(1); int bytes = 0; void led1() { while (1) { sys.delay(1000); sys.log("b %d\r\n", bytes); bytes = 0; } } void led() { int i = 0; while (1) { if (Usb.isConnected()) LED1.on(); else LED1.off(); LED2.toggle(); char d[50]; if (Usb.isConnected()) { if (Usb.isDataAvailable()) { int r = Usb.read(d, 50, 1000); // sys.log("read %d\r\n", r); if (r > 0) { bytes += r; if (d[0] == 'S') { int val; sscanf(d + 1, "%d", &val); // sys.log("val %d\r\n", val); hMot1.setPower((val - 50) * 6); } } } char t[300]; static int cnt = 0; sprintf(t, "S%d", cnt++); int r = Usb.write(t, 63, 500); if (r != 0) sys.log("send res: %d\r\n", r); } sys.delay(1); } } void hMain(void) { sys.setLogDev(&Serial); sys.log("Start!\n\r"); sys.taskCreate(led); sys.taskCreate(led1); }
f488085bf53bf8ad644ca2e2807f7b0bdff17145
1c3dbc41112f6abbbf917e402a8970aad0ffe301
/obelus/client/interfaces/i_console.hpp
4fdc38748595c9df9b243a6111d7dcbbf15f85f1
[ "MIT" ]
permissive
TurkLee/obelus-hack
362a3f756af7d442cc8b4f784beebd1c356a31bd
8e83eb89ef56788c1b9c5af66b815824d17f309d
refs/heads/main
2023-06-15T22:45:31.427393
2021-07-08T09:21:39
2021-07-08T09:21:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,224
hpp
i_console.hpp
#pragma once #include "../../sdk/classes/convar.hpp" #include "../../sdk/misc/color.hpp" #include "i_app_system.hpp" class IConsole; class convar; class con_command; class con_command_base; typedef int cvar_dll_indentifier_t; class IConsole_display_func { public: virtual void color_print( const uint8_t *clr, const char *msg ) = 0; virtual void print( const char *msg ) = 0; virtual void drint( const char *msg ) = 0; }; class IConsole : public i_app_system { public: virtual cvar_dll_indentifier_t allocate_dll_indentifier() = 0; virtual void register_con_command( con_command_base *base ) = 0; virtual void unregister_con_command( con_command_base *base ) = 0; virtual void unregister_con_commands( cvar_dll_indentifier_t id ) = 0; virtual const char *get_command_line_value( const char *name ) = 0; virtual con_command_base *find_command_base( const char *name ) = 0; virtual const con_command_base *find_command_base( const char *name ) const = 0; virtual convar *FindVar( const char *var_name ) = 0; virtual const convar *FindVar( const char *var_name ) const = 0; virtual con_command *find_command( const char *name ) = 0; virtual const con_command *find_command( const char *name ) const = 0; virtual void install_global_change_callback( fn_change_callback_t callback ) = 0; virtual void remove_global_change_callback( fn_change_callback_t callback ) = 0; virtual void call_global_change_callbacks( convar *var, const char *old_str, float old_val ) = 0; virtual void install_console_display_func( IConsole_display_func *func ) = 0; virtual void remove_console_display_func( IConsole_display_func *func ) = 0; virtual void console_color_printf( const Color &clr, const char *format, ... ) const = 0; virtual void console_printf( const char *format, ... ) const = 0; virtual void dconsole_dprintf( const char *format, ... ) const = 0; virtual void rever_flagged_convars( int flag ) = 0; template< typename... arguments > void ConsoleColorPrintf(const ValveColor& color, const char* format, arguments ... args) { return utilities::GetMethod< void(__cdecl*)(decltype(this), const ValveColor&, const char*, ...)>(this, 25)(this, color, format, args...); } };
258db36b6f300f744e0d1dc2d0b1f4d317a568ea
38de3636f5ab661c404f19cbe5e2f63bb7ae9750
/leetcode/3.cpp
adf52257fcf2dd1591e1be07f645d94000b77aec
[ "MIT" ]
permissive
Akeepers/algorithm
5b20e7bf6ae29f15574b4685bcf426870903cdf1
c62ee51f01c994df580507f1aa4518c1b10e0339
refs/heads/master
2021-07-16T22:53:50.044424
2020-06-07T08:50:43
2020-06-07T08:50:43
173,255,673
21
0
null
null
null
null
UTF-8
C++
false
false
899
cpp
3.cpp
#include <iostream> #include <unordered_map> #include <vector> using namespace std; class Solution { public: int lengthOfLongestSubstring(string s) { if (s.size() < 2) return s.size(); unordered_map<char, int> indexs; indexs[s[0]] = 0; int dp[s.size()] = {1}; int length = 1; dp[0] = 1; for (int i = 1; i < s.size(); ++i) { if (indexs.find(s[i]) == indexs.end() || i - indexs[s[i]] > dp[i - 1]) { dp[i] = dp[i - 1] + 1; } else { dp[i] = i - indexs[s[i]]; } indexs[s[i]] = i; length = max(length, dp[i]); } return length; } }; int main() { Solution solution; solution.lengthOfLongestSubstring("abcabcbb"); system("pause"); return 0; }
a9ec86e9830c9f8f30e4d4f2d445d661f5be4106
af833d30aa294472ac0f6f445fb2175c7717e244
/plugin/noise/library_main.cpp
c9146935531258163c8a6bceae535954539fc951
[ "Apache-2.0" ]
permissive
nomadsinteractive/ark
338451f9891edf4c369719596cad2368a11d12a0
b8cd2672aac6f4576e4a3196c5ba0cdcea8c10e8
refs/heads/master
2023-06-07T19:43:25.805463
2023-05-31T06:10:32
2023-05-31T06:10:32
108,817,094
7
1
null
null
null
null
UTF-8
C++
false
false
339
cpp
library_main.cpp
#include "core/base/plugin.h" #include "core/base/api.h" #include "core/base/plugin_manager.h" #include "core/types/shared_ptr.h" #include "generated/noise_plugin.h" using namespace ark; extern "C" ARK_API Plugin* __ark_noise_initialize__(Ark&); Plugin* __ark_noise_initialize__(Ark&) { return new plugin::noise::NoisePlugin(); }
975b58636e5e22ce387a060dd035c57bc0727114
24bc4990e9d0bef6a42a6f86dc783785b10dbd42
/third_party/blink/common/interest_group/interest_group_utils_unittest.cc
a5d89d24c7c58ccb543eb2e5cbad3b8a8376e18f
[ "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "Apache-2.0", "MIT", "BSD-3-Clause" ]
permissive
nwjs/chromium.src
7736ce86a9a0b810449a3b80a4af15de9ef9115d
454f26d09b2f6204c096b47f778705eab1e3ba46
refs/heads/nw75
2023-08-31T08:01:39.796085
2023-04-19T17:25:53
2023-04-19T17:25:53
50,512,158
161
201
BSD-3-Clause
2023-05-08T03:19:09
2016-01-27T14:17:03
null
UTF-8
C++
false
false
2,250
cc
interest_group_utils_unittest.cc
// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "third_party/blink/public/common/interest_group/interest_group_utils.h" #include <string> #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/interest_group/interest_group.h" namespace blink { namespace { void RunTest(const base::StringPiece input, double expected_val, blink::InterestGroup::Size::LengthUnit expected_unit) { auto [out_val, out_units] = blink::ParseInterestGroupSizeString(input); EXPECT_EQ(out_val, expected_val); EXPECT_EQ(out_units, expected_unit); } } // namespace TEST(InterestGroupUtilsTest, ParseSizeStringPixels) { RunTest("200px", 200, blink::InterestGroup::Size::LengthUnit::kPixels); } TEST(InterestGroupUtilsTest, ParseSizeStringScreenWidth) { RunTest("200sw", 200, blink::InterestGroup::Size::LengthUnit::kScreenWidth); } TEST(InterestGroupUtilsTest, ParseSizeStringWithSpace) { RunTest("200 px", 200, blink::InterestGroup::Size::LengthUnit::kPixels); } TEST(InterestGroupUtilsTest, ParseSizeStringWithLotsOfSpaces) { RunTest("200 px", 200, blink::InterestGroup::Size::LengthUnit::kPixels); } TEST(InterestGroupUtilsTest, ParseSizeStringNoValue) { RunTest("px", 0, blink::InterestGroup::Size::LengthUnit::kInvalid); } TEST(InterestGroupUtilsTest, ParseSizeStringSpacesButNoValue) { RunTest(" px", 0, blink::InterestGroup::Size::LengthUnit::kPixels); } TEST(InterestGroupUtilsTest, ParseSizeStringValueButNoUnits) { RunTest("10", 10, blink::InterestGroup::Size::LengthUnit::kInvalid); } TEST(InterestGroupUtilsTest, ParseSizeStringInvalidUnit) { RunTest("10in", 10, blink::InterestGroup::Size::LengthUnit::kInvalid); } TEST(InterestGroupUtilsTest, ParseSizeStringValueAndUnitSwapped) { RunTest("px200", 0, blink::InterestGroup::Size::LengthUnit::kInvalid); } TEST(InterestGroupUtilsTest, ParseSizeStringEmptyString) { RunTest("", 0, blink::InterestGroup::Size::LengthUnit::kInvalid); } TEST(InterestGroupUtilsTest, ParseSizeStringGarbageInString) { RunTest("123abc456px", 123, blink::InterestGroup::Size::LengthUnit::kPixels); } } // namespace blink
84195b87c0917b53233c93484c7be353ce90f48b
16326b2493938dad9e4939f7960357af1f4dd7a4
/Source/Engine/RenderEngine/NBE_Renderer_DX12/private/Head/CommandListManager.h
519e56d952ee82c6cfe02acef1b0e1509aa14001
[ "MIT" ]
permissive
CCCarrion/NewBieEngine
f806f0e255eae512c8d1a282ebb0de404cc3f2c9
3c064a9c7521a520376a3cfd507e5fcd3007f46c
refs/heads/master
2021-01-23T11:21:33.461785
2017-07-18T12:13:12
2017-07-18T12:13:12
93,135,175
0
0
null
null
null
null
UTF-8
C++
false
false
1,008
h
CommandListManager.h
#ifndef __CommandListManager_h__ #define __CommandListManager_h__ #include "Config/Config.h" #include "Util/public/SmartPointer.h" #include "GPU_MemoryManager_DX12.h" #include "d3d12.h" #include "wrl/client.h" NBE_NS_Render_START using Microsoft::WRL::ComPtr; class CommandQueue { public: CommandQueue(D3D12_COMMAND_LIST_TYPE); ~CommandQueue(); void Create(ID3D12Device*); ID3D12CommandQueue* GetCommandQueue(); private: const D3D12_COMMAND_LIST_TYPE m_type; ComPtr<ID3D12CommandQueue> m_pCommandQueue; }; class CommandListManager { public: CommandListManager(ID3D12Device*,GPU_MemoryManager_DX12*); ~CommandListManager(); ID3D12CommandQueue* GetGraphicQueue(); public: private: GPU_MemoryManager_DX12* m_pGpuMemoryManager; CommandQueue m_graphicQueue; CommandQueue m_computeQueue; CommandQueue m_copyQueue; //Bundle Queue? }; NBE_Ptr_Typedef(CommandListManager) NBE_NS_Render_END #endif
e5b8328b7131bd67d62c7ef7e8f8022154f8eea1
8f5bd8801e302d0d37945b0dc54d4aaf06404d29
/UVA/12406595_AC_0ms_0kB.cpp
bdca804ec2063f911a5ca75ce265850aeed2395f
[]
no_license
antanvir/Problem-Solving
6374e897e7369c829781598ab3e788ec9aabadf8
038de8c332fdc557fd860b9d2cf13b1f73d76059
refs/heads/master
2021-06-09T11:45:11.885874
2021-05-05T06:12:52
2021-05-05T06:12:52
131,049,259
0
0
null
null
null
null
UTF-8
C++
false
false
387
cpp
12406595_AC_0ms_0kB.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int in,fi,se,th; while(cin>>in>>fi>>se>>th){ if(!in&&!fi&&!se&&!th)break; long long deg=2*360+360; (in>=fi) ?deg+=(in-fi)*9 :deg+=(in-fi+40)*9; (fi<=se) ?deg+=(se-fi)*9 :deg+=(se-fi+40)*9; (se>=th) ?deg+=(se-th)*9 :deg+=(se-th+40)*9; cout<<deg<<endl; } return 0; }
618e270645ebe8ea5a92a3945ee1a31037e226b6
e9c49f603a39251a8b8185ad89bc80346fc2ae04
/dataStructures/list_hash/list.cpp
aa4142991415ba76ec613b8d2d975093e3490f6f
[]
no_license
HarisMagdalinos/dataStructures
f400423be2d878faee7b9bad5a275e68fae8e84e
7d3d3d2e1c8e1a64062786cdb88dd198bd058691
refs/heads/master
2021-05-08T22:55:03.311958
2018-01-31T13:28:23
2018-01-31T13:28:23
119,604,234
0
0
null
null
null
null
UTF-8
C++
false
false
1,377
cpp
list.cpp
#include "list.h" #include <stdio.h> #include <cstdlib> #include <iostream> List::List() :m_numOfNodes(0),m_first(NULL),m_last(NULL),m_current(NULL) {} List::~List() { while(!empty()) { Node* temp=m_first; m_first=m_first->next; delete temp; m_numOfNodes--; } } Node* List::first() { return m_first; } bool List::empty() { return !m_numOfNodes; } Node* List::newListNode(int key, int value){ Node* temp=new Node; temp->key=key; temp->value=value; temp->next=NULL; return temp; } bool List::exists(int key, int* value){ if(!empty()) { Node* temp=m_first; while(temp->next!=NULL && temp->key!=key) { temp=temp->next; } if(temp->next==NULL) { return 0; } if(key==temp->key) { *value=temp->value; return 1; } } else { return 0; } } void List::addToEndList(int key, int value){ if(empty()) { m_first=newListNode(key,value); m_last=m_first; m_numOfNodes++; } else { Node* temp=newListNode(key,value); m_last->next=temp; m_last=temp; m_numOfNodes++; } } void List::printList(){ if(!empty()) { m_current=m_first; for(int i=0; i < m_numOfNodes-1; i++) { std::cout << "(" <<m_current->key << ","; std::cout << m_current->value <<")" <<" | "; m_current=m_current->next; } std::cout << "( " <<m_current->key << ","; std::cout << m_current->value << ")" <<std::endl; } }
2b34a460992517549c3e85cb09ec98b3dfd075d0
62deda4b6011aaa01b41317c677fee5a3fcaeca1
/Game/Field.cpp
aa33a1440e5ad20eaad99bf5a092ebcbb319636e
[]
no_license
MAilieva/Game
726df161845bcc4a7776ffe6ff6243a2b6ffea36
e1c95acd5e298f2bba870195fdce7ee4aea73e7f
refs/heads/master
2021-01-01T05:52:52.203632
2017-07-15T06:43:53
2017-07-15T06:43:53
97,297,059
0
0
null
null
null
null
UTF-8
C++
false
false
659
cpp
Field.cpp
#include "Cell.h" #include"Field.h" #include <string> Cell * Field::viewCells(int x,int y ) { for (int i = 0; i < 20; i++) { for (int j = 0; j < 20; j++) { if(i==x&&j==y) return field[i][j]; } } return new Cell(-1, -1); } Field::Field() { for (int i = 0; i < 20; i++) { for (int j = 0; j < 20; j++) { field[i][j] = new Cell(i, j); } } } Field::~Field() { } void Field::fieldToString() { std::string result = ""; for (int i = 0; i < 20; i++) { for (int j = 0; j < 20; j++) { if (field[i][j]->hasAString()) { result += "X"; } result += "*"; } result += "\n"; } }
29d12cebdf46ff5b08377735da5113cfd252c0b7
03abc58e31d1d86061660a80630d038a4891aaab
/Civilizations/ResourcesNames.h
0b47daccb8a537907ccde680607699507e0db0eb
[ "MIT" ]
permissive
WowSoLaggy/Civilizations
e8cc2dbb55bd7e3c38cca1b268f2d2b91fe20e68
84f44c16e012c65c95e213efb98c06ae298400f1
refs/heads/master
2021-06-01T08:10:04.839183
2016-08-28T21:06:45
2016-08-28T21:06:45
40,181,643
1
0
null
null
null
null
UTF-8
C++
false
false
3,596
h
ResourcesNames.h
#pragma once #ifndef RESOURCESNAMES_H #define RESOURCESNAMES_H const std::string resourcesNames[] = { "Data\\Textures\\Texture_error.png", /* 0 */ "Data\\Textures\\Water.png", /* 1 */ "Data\\Textures\\Grass.png", /* 2 */ "Data\\Textures\\Desert.png", /* 3 */ "Data\\Textures\\Oak_young.png", /* 4 */ "Data\\Textures\\Oak_adult.png", /* 5 */ "Data\\Textures\\Oak_dead.png", /* 6 */ "Data\\Textures\\Cursor.png", /* 7 */ "Data\\Textures\\Grid.png", /* 8 */ "Data\\Textures\\Gui_top_1024.png", /* 9 */ "Data\\Textures\\Gui_bottom_1024.png", /* 10 */ "Data\\Textures\\Gui_minimap.png", /* 11 */ "Data\\Textures\\Gui_minimapFrame.png", /* 12 */ "Data\\Textures\\Snow.png", /* 13 */ "Data\\Textures\\Ice.png", /* 14 */ "Data\\Textures\\Fir_young.png", /* 15 */ "Data\\Textures\\Fir_adult.png", /* 16 */ "Data\\Textures\\Fir_dead.png", /* 17 */ "Data\\Textures\\Cactus_young.png", /* 18 */ "Data\\Textures\\Cactus_adult.png", /* 19 */ "Data\\Textures\\Cactus_dead.png", /* 20 */ "Data\\Textures\\Mountain_Grass.png", /* 21 */ "Data\\Textures\\Mountain_Snow.png", /* 22 */ "Data\\Textures\\Mountain_Desert.png", /* 23 */ "Data\\Textures\\Palm_young.png", /* 24 */ "Data\\Textures\\Palm_adult.png", /* 25 */ "Data\\Textures\\Palm_dead.png", /* 26 */ "Data\\Textures\\Coast.png", /* 27 */ "Data\\Textures\\Oasis.png", /* 28 */ "Data\\Textures\\Mountain_coast.png", /* 29 */ "Data\\Textures\\Mountain_oasis.png", /* 30 */ "Data\\Textures\\Tropics.png", /* 31 */ "Data\\Textures\\Savanna.png", /* 32 */ "Data\\Textures\\Tundra.png", /* 33 */ "Data\\Textures\\Mountain_Tundra.png", /* 34 */ "Data\\Textures\\Mountain_Savanna.png", /* 35 */ "Data\\Textures\\Mountain_Tropics.png", /* 36 */ "Data\\Textures\\Juniper_young.png", /* 37 */ "Data\\Textures\\Juniper_adult.png", /* 38 */ "Data\\Textures\\Juniper_dead.png", /* 39 */ "Data\\Textures\\Baobab_young.png", /* 40 */ "Data\\Textures\\Baobab_adult.png", /* 41 */ "Data\\Textures\\Baobab_dead.png", /* 42 */ "Data\\Textures\\Mountain_Reef.png", /* 43 */ "Data\\Textures\\Mountain_ReefIce.png", /* 44 */ "Data\\Textures\\DeepWater.png", /* 45 */ "Data\\Textures\\Water_fresh.png", /* 46 */ "Data\\Textures\\Gui_top_2048.png", /* 47 */ "Data\\Textures\\Gui_bottom_2048.png", /* 48 */ "Data\\Textures\\Raspberry.png", /* 49 */ "Data\\Textures\\Camelthorn.png", /* 50 */ "Data\\Textures\\Dwarfbirch.png", /* 51 */ "Data\\Textures\\Aloe.png", /* 52 */ "Data\\Textures\\Fern.png", /* 53 */ "Data\\Textures\\Acacia_young.png", /* 54 */ "Data\\Textures\\Acacia_adult.png", /* 55 */ "Data\\Textures\\Acacia_dead.png", /* 56 */ "Data\\Textures\\Hill_Coast.png", /* 57 */ "Data\\Textures\\Hill_Desert.png", /* 58 */ "Data\\Textures\\Hill_Grass.png", /* 59 */ "Data\\Textures\\Hill_Oasis.png", /* 60 */ "Data\\Textures\\Hill_Savanna.png", /* 61 */ "Data\\Textures\\Hill_Snow.png", /* 62 */ "Data\\Textures\\Hill_Tropics.png", /* 63 */ "Data\\Textures\\Hill_Tundra.png", /* 64 */ "Data\\Textures\\Hare.png", /* 65 */ "Data\\Textures\\Fox.png", /* 66 */ "Data\\Textures\\Monkey.png", /* 67 */ "Data\\Textures\\Fish.png", /* 68 */ "Data\\Textures\\Horse.png", /* 69 */ "Data\\Textures\\Crocodile.png", /* 70 */ "Data\\Textures\\Whale.png", /* 71 */ "Data\\Textures\\Polar_bear.png", /* 72 */ "Data\\Textures\\Pinguin.png", /* 73 */ "Data\\Textures\\Seal.png", /* 74 */ "Data\\Textures\\Deer.png", /* 75 */ "Data\\Textures\\Bear.png", /* 76 */ }; #endif // RESOURCESNAMES_H
6b7a920e53b6c419f337a31fa57158914fda4e2b
16f63d6f656ee3ad32f428c031709658a1d08915
/Pokemon-lab/main.cpp
a4a59d06b6d1dcf6083fd91d8d9c7460cb0a0c5a
[]
no_license
petertaoyang/lab-2
509e5d9c94348117d13b8b983ed4ffcab1d8d1da
d303f9d74b103e63289041dc239cd7888d876ba2
refs/heads/master
2021-01-08T14:08:08.129025
2020-02-21T03:59:31
2020-02-21T03:59:31
242,049,186
0
0
null
null
null
null
UTF-8
C++
false
false
9,138
cpp
main.cpp
#include "Set.h" #include "Map.h" #include <string> #include <sstream> #include <iostream> #include <fstream> #ifdef _MSC_VER #define _CRTDBG_MAP_ALLOC #include <crtdbg.h> #define VS_MEM_CHECK _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #else #define VS_MEM_CHECK #endif bool ifEffective(string inputType, string key, Map<string, Set<string>> &effectivies); bool ifIneffective(string inputType, string key, Map<string, Set<string>> &ineffectives); int main(int argc, char * argv[]) { VS_MEM_CHECK ifstream in(argv[1]); ofstream out(argv[2]); string inputLine; string inputCommand; string inputName; string inputType; Map<string, string> pokemon; Map<string, string> moves; Map<string, Set<string>> effectives; Map<string, Set<string>> ineffectives; Set<string> pokemonList; while (getline(in, inputLine)) { if (inputLine == "") { continue; } stringstream iss(inputLine); iss >> inputCommand; iss >> inputName; if (inputCommand != "Effectivities" && inputCommand != "Ineffectivities" && inputCommand != "Pokemon" && inputCommand != "Moves" && inputCommand != "Battle:") { out << inputLine << endl; } if (inputCommand == "Set:") { pokemonList.clear(); do { pokemonList.insert(inputName); } while (iss >> inputName); out << " [" << pokemonList.toString() << "]" << endl << endl; } if (inputCommand == "Pokemon:") { iss >> inputType; pokemon[inputName] = inputType; } if (inputCommand == "Move:") { iss >> inputType; moves[inputName] = inputType; } if (inputCommand == "Effective:") { iss >> inputType; do { effectives[inputName].insert(inputType); } while (iss >> inputType); } if (inputCommand == "Ineffective:") { iss >> inputType; do { ineffectives[inputName].insert(inputType); //cout << ineffectives.toString() << endl; } while (iss >> inputType); } if (inputCommand == "Effectivities") { out << endl; stringstream ss; ss << "Effectivities: " << effectives.size() << "/" << effectives.max_size() << endl; ss << effectives.toString(); out << ss.str(); } if (inputCommand == "Pokemon") { out << endl; stringstream ss; ss << "Pokemon: " << pokemon.size() << "/" << pokemon.max_size() << endl; ss << pokemon.toString(); out << ss.str(); //out << endl; } if (inputCommand == "Moves") { out << endl; stringstream ss; ss << "Moves: " << moves.size() << "/" << moves.max_size() << endl; ss << moves.toString(); out << ss.str(); } if (inputCommand == "Ineffectivities") { out << endl; stringstream ss; ss << "Ineffectivities: " << ineffectives.size() << "/" << ineffectives.max_size() << endl; ss << ineffectives.toString(); out << ss.str(); //out << endl; } if (inputCommand == "Battle:") { out << endl; stringstream ss; string pokemominputName; string moveinputType; iss >> inputType; iss >> pokemominputName; iss >> moveinputType; string pokemon1inputType = pokemon[inputName]; string move1inputType = moves[inputType]; string pokemon2inputType = pokemon[pokemominputName]; string move2inputType = moves[moveinputType]; bool ifEffect1 = false; bool ifIneffect1 = false; bool ifEffect2 = false; bool ifIneffect2 = false; string gameWinner = "default"; string result1; string result2; string effectivites1; string effectivites2; ifEffect1 = ifEffective(pokemon2inputType, move1inputType, effectives); ifIneffect1 = ifIneffective(pokemon2inputType, move1inputType, ineffectives); ifEffect2 = ifEffective(pokemon1inputType, move2inputType, effectives); ifIneffect2 = ifIneffective(pokemon1inputType, move2inputType, ineffectives); //check if the first pokemon's move is effect or ineffect or regular to the second pokemon if (ifEffect1 == true) { result1 = inputName + "'s " + inputType + " is super effective against " + pokemominputName; effectivites1 = "super effective"; } else if (ifIneffect1 == true) { result1 = inputName + "'s " + inputType + " is ineffective against " + pokemominputName; effectivites1 = "ineffective"; } else { result1 = inputName + "'s " + inputType + " is effective against " + pokemominputName; effectivites1 = "effective"; } //------------------------------------------------------------------------------------------------------------------ //check if the second pokemon's move is effect or ineffect or regular to the first pokemon if (ifEffect2 == true) { result2 = pokemominputName + "'s " + moveinputType + " is super effective against " + inputName; effectivites2 = "super effective"; } else if (ifIneffect2 == true) { result2 = pokemominputName + "'s " + moveinputType + " is ineffective against " + inputName; effectivites2 = "ineffective"; } else { result2 = pokemominputName + "'s " + moveinputType + " is effective against " + inputName; effectivites2 = "effective"; } //--------------------------------------------------------------------------------------------------- //check the gameWinner if (effectivites1 == "super effective" && effectivites2 == "super effective") { gameWinner = " is a tie."; } else if (effectivites1 == "super effective" && effectivites2 == "effective") { gameWinner = ", " + inputName + " wins!"; } else if (effectivites1 == "super effective" && effectivites2 == "ineffective") { gameWinner = ", " + inputName + " wins!"; } else if (effectivites1 == "effective" && effectivites2 == "super effective") { gameWinner = ", " + pokemominputName + " wins!"; } else if (effectivites1 == "effective" && effectivites2 == "effective") { gameWinner = " is a tie."; } else if (effectivites1 == "effective" && effectivites2 == "ineffective") { gameWinner = ", " + inputName + " wins!"; } else if (effectivites1 == "ineffective" && effectivites2 == "super effective") { gameWinner = ", " + pokemominputName + " wins!"; } else if (effectivites1 == "ineffective" && effectivites2 == "effective") { gameWinner = ", " + pokemominputName + " wins!"; } else if (effectivites1 == "ineffective" && effectivites2 == "ineffective") { gameWinner = " is a tie."; } ss << "Battle: " << inputName << " " << inputType << " " << pokemominputName << " " << moveinputType << endl; ss << " " << inputName << " (" << inputType << ") vs " << pokemominputName << " (" << moveinputType << ")" << endl; ss << " " << inputName << " is a " << pokemon1inputType << " inputType Pokemon." << endl; ss << " " << pokemominputName << " is a " << pokemon2inputType << " inputType Pokemon." << endl; ss << " " << inputType << " is a " << move1inputType << " inputType move." << endl; ss << " " << moveinputType << " is a " << move2inputType << " inputType move." << endl; //checking the size of effectivies pokemonList. Marking sure is not equal to zero if (effectives[move1inputType].size() == 0) { ss << " " << inputType << " is not effective against any Pokemon." << endl; } else { ss << " " << inputType << " is super effective against [" << effectives[move1inputType] << "]" << " inputType Pokemon." << endl; } if (ineffectives[move1inputType].size() == 0) { ss << " " << inputType << " is not ineffective against any Pokemon." << endl; } else { ss << " " << inputType << " is ineffective against [" << ineffectives[move1inputType] << "]" << " inputType Pokemon." << endl; } ss << " " << result1 << endl; //checking the size of effectivies pokemonList. Marking sure is not equal to zero if (effectives[move2inputType].size() == 0) { ss << " " << moveinputType << " is not effective against any Pokemon" << endl; } else { ss << " " << moveinputType << " is super effective against [" << effectives[move2inputType] << "]" << " inputType Pokemon." << endl; } if (ineffectives[move2inputType].size() == 0) { ss << " " << moveinputType << " is not ineffective against any Pokemon." << endl; } else { ss << " " << moveinputType << "is ineffective against [" << ineffectives[move2inputType] << "]" << " inputType Pokemon." << endl; } ss << " " << result2 << endl; if (gameWinner == " is a tie.") { ss << " " << "The battle between " << inputName << " and " << pokemominputName << gameWinner << endl; } else { ss << " " << "In the battle between " << inputName << " and " << pokemominputName << gameWinner << endl; } //ss << endl; out << ss.str(); } } return 0; } bool ifEffective(string inputType, string key, Map<string, Set<string>> &effectivies) { if (effectivies[key].count(inputType) == 1) { return true; } else { return false; } } bool ifIneffective(string inputType, string key, Map<string, Set<string>> &ineffectives) { if (ineffectives[key].count(inputType) == 1) { return true; } else { return false; } }
0e3944ca7be52798655c5406839841cd6981b369
91721cafcc790673eb39c99be05bad570aedef74
/Leetcode practice/410. Split Array Largest Sum.cpp
c870a5984b25ac6409a898939267234d1d507886
[]
no_license
olee12/Leetcode-practice
6631d559377d926c480b3115c75b1348be5c55fe
ea4649601af66193da036c4cce6032a22b1a673b
refs/heads/master
2022-07-09T09:04:26.542487
2022-07-02T05:16:10
2022-07-02T05:16:10
81,569,221
0
0
null
2020-10-13T10:30:13
2017-02-10T13:45:44
C++
UTF-8
C++
false
false
2,136
cpp
410. Split Array Largest Sum.cpp
#include <bits/stdc++.h> using namespace std; class Solution { public: int splitArray(vector<int>& nums, int m) { vector<vector<long long>> dp(nums.size(), vector<long long>(m+1, -1)); return binarySolve(nums, m); } long long rec(int pos, int m, vector<int>& nums, vector<vector<long long>> &dp) { if (m == 0) { if (pos == nums.size()) return 0; return numeric_limits<int>::max(); } if (pos >= nums.size()) { if (m) return numeric_limits<int>::max(); return 0; } long long &ret = dp[pos][m]; if (ret != -1) { return ret; } ret = numeric_limits<int>::max(); long long sum = 0; for(int i = pos;i<nums.size();i++) { sum += nums[i]; ret = min(ret, max(sum , rec(i+1, m-1, nums, dp))); // printf("---- pos: %d, i: %d, m: %d, sum: %lld, rec: %lld, ret: %lld\n", pos, i, m, sum, rec(i+1, m-1, nums, dp), ret); } return ret; } int binarySolve(vector<int>& hight, int m) { long long high = 0; for(auto it: hight) high+=it; long long low = 1; while(low <= high) { long long mid = (low + high) / 2; printf("mid: %d, split: %d\n", mid, split(hight, m, mid)); if (split(hight, m, mid)) { high = mid - 1; }else { low = mid + 1; } } return low; } bool split(vector<int>& hight, int m, long long val) { int sum = 0; for(int i = 0;i<hight.size();i++){ if(hight[i] > val) return false; if ((sum + hight[i]) > val) { m--; sum = 0; } sum+=hight[i]; } // if (m >= 1 && sum <= val) return true; return m>=1; } }; int main(int argc, char const *argv[]) { Solution sol; vector<int> inp1 = {1,4,4}; int m1 = 3; cout << sol.splitArray(inp1, m1)<<"\n"; assert(sol.splitArray(inp1, m1)==9); /* code */ return 0; }
2b60645339fa7d8a57f5c8c39cb37ffa3c4b7730
e2213ddd06147a5f45aeb734c608de1183f6dc80
/AngelMethodHeader.h
a7b28fd4ea5a5e39e79245d8d8e3da8aa4e449a2
[]
no_license
tolgahandikmen/Internship_Project
dbe3ebc69b44ae6323b05824568f0586c40a30be
7ad549770ec34187a5ac7c62269a71d0a8dd397f
refs/heads/master
2020-03-24T00:28:31.994099
2018-07-25T11:54:51
2018-07-25T11:54:51
142,292,985
0
0
null
null
null
null
UTF-8
C++
false
false
230
h
AngelMethodHeader.h
#pragma once #include "ReadFileHeader.h" #include <math.h> const double M_PI = 3.141592653589793238463; class AngelMethodHeader { public: static bool subOfAngels(std::list <Graph> anEdge, double lat, double lgt); };
a89682e43619b3eff17896ce63c0d89f3e3b2241
37695821fea740c507e60701a2781df027377212
/CrearPOP3.cpp
90ae31a5b9e60e06c6981e1801336bd7bbf776e1
[]
no_license
rorra/phcp-cgi
25f16fbce411fb3c327a3bf4df9b26e398563a30
7588ba1c3f76c92a7509ffd2b7bc4e43519eae3c
refs/heads/master
2021-01-21T19:28:24.869430
2012-09-17T12:28:22
2012-09-17T12:28:22
null
0
0
null
null
null
null
ISO-8859-1
C++
false
false
4,476
cpp
CrearPOP3.cpp
#include "log.h" #include "dominio.h" #include "servicio.h" #include "interfaz.h" #include "util.h" #include "configuracion.h" #include "servicioPOP3.h" #include "servicioAlias.h" #include "CrearPOP3.h" using namespace std; int main(int argc, char *argv[]) { //Inicializar el dominio cDominio dominio; if (!dominio.iniciar()) reportarErrorRarisimo(string("Error al iniciar el objeto dominio")); //Inicializar el servicio cServicioPOP3 servicio(&dominio); if (!servicio.iniciar()) reportarErrorRarisimo(string("Error al iniciar el objeto servicioPOP3")); cServicioAlias servicioAlias(&dominio); if (!servicioAlias.iniciar()) reportarErrorRarisimo(string("Error al iniciar el objeto servicioAlias")); //Inicializar la clase interfaz cInterfaz interfaz; //Inicializar variables miscelaneas string mensaje; string error; int derror; string errorFile(ERROR_CREAR_POP3); string okFile(OK_CREAR_POP3); //Verificar que la pagina haya sido llamada por CrearPOP3.php if (interfaz.verificarPagina(string("CrearPOP3.php")) < 0) return(-1); //Verificar si el cliente puede crear el servicio derror = servicio.verificarCrearServicio(); if (derror == 0) { error = "Su Plan no le permite crear Cuentas POP3"; interfaz.reportarErrorComando(error, errorFile, dominio); return(-1); } else if(derror < -1) { error = "Usted ya ha creado el maximo de Cuentas POP3 permitidas para su Plan"; interfaz.reportarErrorComando(error, errorFile, dominio); return(-1); } //Obtener las variables string txtCuenta, txtPassword, txtPassword2; if ((interfaz.obtenerVariable("txtCuenta", txtCuenta, dominio)) < 0) { interfaz.reportarErrorFatal(); return(-1); } if ((interfaz.obtenerVariable("txtPassword", txtPassword, dominio)) < 0) { interfaz.reportarErrorFatal(); return(-1); } if ((interfaz.obtenerVariable("txtPassword2", txtPassword2, dominio)) < 0) { interfaz.reportarErrorFatal(); return(-1); } if (error.length() > 0) { interfaz.reportarErrorComando(error, errorFile, dominio); return(-1); } //Borar los espacios en blanco y los newlines a los costados de los campos strtrimString(txtCuenta); strtrimString(txtPassword); strtrimString(txtPassword2); //Verificar los caracteres validos para los campos error = servicio.caracterUsuarioEmail(txtCuenta, "Email"); if (error.length() > 0) { interfaz.reportarErrorComando(error, errorFile, dominio); return(-1); } error = servicio.caracterPassword(txtPassword, "Password"); if (error.length() > 0) { interfaz.reportarErrorComando(error, errorFile, dominio); return(-1); } //Verificar que los passwords sean iguales if (txtPassword != txtPassword2) { interfaz.reportarErrorComando("Los passwords deben ser identicos", errorFile, dominio); return(-1); } //Pasar a minusculas la cuenta POP3 string txtCuentaM = lowerCase(txtCuenta); //Verificar si existe la cuenta POP3 que se quiere crear derror = servicio.verificarExisteEmailDB(txtCuentaM, dominio); if (derror < 0) { interfaz.reportarErrorFatal(); return(-1); } if (derror > 0) { error = "La Cuenta POP3 " + txtCuenta + "@" + dominio.getDominio() + " ya existe"; interfaz.reportarErrorComando(error, errorFile, dominio); return(-1); } //Verificar si existe la cuenta POP3 como un alias derror = servicioAlias.verificarExisteAliasDB(txtCuentaM, dominio); if (derror < 0) { interfaz.reportarErrorFatal(); return(-1); } if (derror > 0) { error = "La Cuenta POP3 " + txtCuenta + "@" + dominio.getDominio() + " ya existe como una Cuenta Alias"; interfaz.reportarErrorComando(error, errorFile, dominio); return(-1); } derror = servicio.agregarEmail(txtCuentaM, txtPassword, dominio); if (derror < 0) { interfaz.reportarErrorFatal(); return(-1); } //Crear la cuenta POP3 en la base de datos derror = servicio.agregarEmailDB(txtCuentaM, txtPassword, dominio); if (derror < 0) { interfaz.reportarErrorFatal(); return(-1); } //Agregar al historial de la base de datos mensaje = "Se creo la Cuenta POP3 " + txtCuenta + "@" + dominio.getDominio(); servicio.agregarHistorial(mensaje, dominio); //Reportar el mensaje de ok al navegador mensaje = "La Cuenta " + txtCuenta + "@" + dominio.getDominio() + " fue creada con éxito."; interfaz.reportarOkComando(mensaje, okFile, dominio); return(0); }
a2442009542e5c8464352ba60f8490f17e902a7a
cfd1cad6442cf0d53af0183853bfc807f6c17987
/cf_contest/Codeforces Round #528 (Div. 2, based on Technocup 2019 Elimination Round 4)/A.cpp
8da436f84b78cd7af5cb522dcbb2405dc07846c1
[]
no_license
Alan-chenhx/ACM
db42a01a63914b861f638907f7e97db6d7f3e874
b3c773a89d8bb165cdd28bc3f07bfb47dc01e01d
refs/heads/master
2020-05-31T05:09:04.523435
2019-06-09T14:02:06
2019-06-09T14:02:06
190,113,338
0
0
null
null
null
null
UTF-8
C++
false
false
270
cpp
A.cpp
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; int l=s.length(); int mid=l/2+l%2-1; for (int i=0;i<l-mid;i++) { if(i==0) { cout<<s[mid]; continue; } else cout<<s[mid+i]; if((mid-i)>=0) cout<<s[mid-i]; } return 0; }
2d11bbd001a18fcddabb8371b31ba4df5f6aff47
1ae40287c5705f341886bbb5cc9e9e9cfba073f7
/Osmium/SDK/FN_AthenaHitPointBar_functions.cpp
797d147f72cc9dcead40168bb5fadd344e8a3fe1
[]
no_license
NeoniteDev/Osmium
183094adee1e8fdb0d6cbf86be8f98c3e18ce7c0
aec854e60beca3c6804f18f21b6a0a0549e8fbf6
refs/heads/master
2023-07-05T16:40:30.662392
2023-06-28T23:17:42
2023-06-28T23:17:42
340,056,499
14
8
null
null
null
null
UTF-8
C++
false
false
8,129
cpp
FN_AthenaHitPointBar_functions.cpp
// Fortnite (4.5-CL-4159770) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "../SDK.hpp" namespace SDK { //--------------------------------------------------------------------------- //Functions //--------------------------------------------------------------------------- // Function AthenaHitPointBar.AthenaHitPointBar_C.SetSize // (Public, HasDefaults, BlueprintCallable, BlueprintEvent) // Parameters: // bool UseLargeSize (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void UAthenaHitPointBar_C::SetSize(bool UseLargeSize) { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.SetSize"); UAthenaHitPointBar_C_SetSize_Params params; params.UseLargeSize = UseLargeSize; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.UpdateDBNOState // (Public, BlueprintCallable, BlueprintEvent) // Parameters: // bool bIsDBNO (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void UAthenaHitPointBar_C::UpdateDBNOState(bool bIsDBNO) { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.UpdateDBNOState"); UAthenaHitPointBar_C_UpdateDBNOState_Params params; params.bIsDBNO = bIsDBNO; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.UpdateHealthType // (Public, BlueprintCallable, BlueprintEvent) void UAthenaHitPointBar_C::UpdateHealthType() { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.UpdateHealthType"); UAthenaHitPointBar_C_UpdateHealthType_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.Update Delta Bar // (Public, BlueprintCallable, BlueprintEvent) void UAthenaHitPointBar_C::Update_Delta_Bar() { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.Update Delta Bar"); UAthenaHitPointBar_C_Update_Delta_Bar_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.Initialize Bar // (Public, HasDefaults, BlueprintCallable, BlueprintEvent) void UAthenaHitPointBar_C::Initialize_Bar() { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.Initialize Bar"); UAthenaHitPointBar_C_Initialize_Bar_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.Update Fill Bar // (Public, BlueprintCallable, BlueprintEvent) void UAthenaHitPointBar_C::Update_Fill_Bar() { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.Update Fill Bar"); UAthenaHitPointBar_C_Update_Fill_Bar_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.UpdateCurrentValue // (Public, HasDefaults, BlueprintCallable, BlueprintEvent) void UAthenaHitPointBar_C::UpdateCurrentValue() { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.UpdateCurrentValue"); UAthenaHitPointBar_C_UpdateCurrentValue_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.UpdateMaxValue // (Public, HasDefaults, BlueprintCallable, BlueprintEvent) void UAthenaHitPointBar_C::UpdateMaxValue() { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.UpdateMaxValue"); UAthenaHitPointBar_C_UpdateMaxValue_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.PreConstruct // (BlueprintCosmetic, Event, Public, BlueprintEvent) // Parameters: // bool* IsDesignTime (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void UAthenaHitPointBar_C::PreConstruct(bool* IsDesignTime) { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.PreConstruct"); UAthenaHitPointBar_C_PreConstruct_Params params; params.IsDesignTime = IsDesignTime; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.OnMaxValueChanged // (Event, Protected, BlueprintEvent) // Parameters: // float* Value (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void UAthenaHitPointBar_C::OnMaxValueChanged(float* Value) { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.OnMaxValueChanged"); UAthenaHitPointBar_C_OnMaxValueChanged_Params params; params.Value = Value; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.OnValueChangedWithReason // (Event, Protected, BlueprintEvent) // Parameters: // float* Value (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) // EFortHitPointModificationReason* Reason (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void UAthenaHitPointBar_C::OnValueChangedWithReason(float* Value, EFortHitPointModificationReason* Reason) { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.OnValueChangedWithReason"); UAthenaHitPointBar_C_OnValueChangedWithReason_Params params; params.Value = Value; params.Reason = Reason; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.OnDBNOStateChanged // (Event, Protected, BlueprintEvent) // Parameters: // bool* IsDBNO (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void UAthenaHitPointBar_C::OnDBNOStateChanged(bool* IsDBNO) { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.OnDBNOStateChanged"); UAthenaHitPointBar_C_OnDBNOStateChanged_Params params; params.IsDBNO = IsDBNO; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.OnDeltaChanged // (Event, Protected, BlueprintEvent) void UAthenaHitPointBar_C::OnDeltaChanged() { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.OnDeltaChanged"); UAthenaHitPointBar_C_OnDeltaChanged_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function AthenaHitPointBar.AthenaHitPointBar_C.ExecuteUbergraph_AthenaHitPointBar // () // Parameters: // int EntryPoint (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void UAthenaHitPointBar_C::ExecuteUbergraph_AthenaHitPointBar(int EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function AthenaHitPointBar.AthenaHitPointBar_C.ExecuteUbergraph_AthenaHitPointBar"); UAthenaHitPointBar_C_ExecuteUbergraph_AthenaHitPointBar_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
80bd8c150882e96f48c5ac0e7d95168837179d29
ceafbe46251d1dd1960b2c7e62eda2a3c726a872
/src/07_iterator.cpp
78e8a04f63f8cc5f0249fcc388c3a99cbba57e1f
[]
no_license
mzahng160/cpp-regex
89c3a4d3f3d1e7ca4b1ded358d7e6decfaf7f75b
e28c4823e0dc678f75695c183184421f8c09c776
refs/heads/master
2021-04-24T11:34:58.689390
2020-03-22T00:36:07
2020-03-22T00:36:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
691
cpp
07_iterator.cpp
#include <fstream> #include <iostream> #include <regex> using namespace std; int main() { regex word_regex("[[:alpha:]]+"); // ① ifstream file("./content.txt"); // ② string line; int word_count = 0; while(getline(file, line)) { // ③ auto iter_begin = sregex_iterator(line.begin(), line.end(), word_regex); // ④ auto iter_end = sregex_iterator(); // ⑤ for (auto iter = iter_begin; iter != iter_end; iter++) { // ⑥ word_count++; // ⑦ // cout << iter->str() << endl; // ⑧ } } cout << "It contains " << word_count << " words" << endl; // ⑨ return 0; }
5152e42611e44fb7f9cdf134ba0805a0414824e3
f8ea79b0af7b08c5b9d1fb79b8e0cc4dc9ecb436
/HookDll/ConfigDlg.h
487f9873ef99467675e1eb982574627178eb84a6
[]
no_license
NewHJX/LeakMon
5f303ed26ba21184a765af1116a2dbf4cb3529b2
9ce363406cdb99027511c289235c768a067c1417
refs/heads/master
2022-03-16T09:19:16.414821
2016-09-20T12:27:29
2016-09-20T12:27:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,903
h
ConfigDlg.h
#if !defined(AFX_ONFIGDLG_H__C97A22C8_2FBF_4D76_BD8E_8E0F794A0314__INCLUDED_) #define AFX_ONFIGDLG_H__C97A22C8_2FBF_4D76_BD8E_8E0F794A0314__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // onfigDlg.h : header file // #include "EditEx.h" #include "afxwin.h" ///////////////////////////////////////////////////////////////////////////// // ConfigDlg dialog extern bool g_IS_TEST_APP; class ConfigDlg : public CDialog { // Construction public: ConfigDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(ConfigDlg) enum { IDD = IDD_DIALOG1 }; CListCtrl m_List; //}}AFX_DATA // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(ConfigDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(ConfigDlg) afx_msg void OnPath(); virtual BOOL OnInitDialog(); afx_msg void OnCancel(); afx_msg void OnOk(); afx_msg void OnButton2(); //}}AFX_MSG DECLARE_MESSAGE_MAP() void LoadSymbols(); public: bool m_bChanged; CString m_csPath; EditEx m_EditCtrl; CDialog m_ProgressDlg; protected: virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); static UINT __cdecl ThreadEntry( LPVOID pParam ); static BOOL CALLBACK SymRegisterCallbackProc64( HANDLE hProcess, ULONG ActionCode, ULONG64 CallbackData, ULONG64 UserContext ); afx_msg void OnBnClickedButton3(); void ShowWaitDialog(); public: afx_msg void OnBnClickedRadioMem(); afx_msg void OnBnClickedRadioGdi(); afx_msg void OnBnClickedRadioHandle(); }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_ONFIGDLG_H__C97A22C8_2FBF_4D76_BD8E_8E0F794A0314__INCLUDED_)
b37e98817a7a5cfad7aa30fc11fdd92d7ea41cf2
8c8820fb84dea70d31c1e31dd57d295bd08dd644
/Online/BackgroundHTTP/Public/GenericPlatform/GenericPlatformBackgroundHttp.h
64385e62273e3c7cb443ff675bc8c1dc8be0febd
[]
no_license
redisread/UE-Runtime
e1a56df95a4591e12c0fd0e884ac6e54f69d0a57
48b9e72b1ad04458039c6ddeb7578e4fc68a7bac
refs/heads/master
2022-11-15T08:30:24.570998
2020-06-20T06:37:55
2020-06-20T06:37:55
274,085,558
3
0
null
null
null
null
UTF-8
C++
false
false
2,120
h
GenericPlatformBackgroundHttp.h
// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "Interfaces/IBackgroundHttpRequest.h" class IBackgroundHttpManager; /** * Generic version of Background Http implementations for platforms that don't need a special implementation * Intended usage is to use FPlatformBackgroundHttp instead of FGenericPlatformHttp * On platforms without a specific implementation, you should still use FPlatformBackgroundHttp and it will call into these functions */ class BACKGROUNDHTTP_API FGenericPlatformBackgroundHttp { public: /** * Platform initialization step */ static void Initialize(); /** * Platform shutdown step */ static void Shutdown(); /** * Creates a platform-specific Background HTTP manager. * Un-implemented platforms should create a FGenericPlatformBackgroundHttpManager */ static FBackgroundHttpManagerPtr CreatePlatformBackgroundHttpManager(); /** * Creates a new Background Http request instance for the current platform * that will continue to download when the application is in the background * * @return request object */ static FBackgroundHttpRequestPtr ConstructBackgroundRequest(); /** * Creates a new Background Http Response instance for the current platform * This normally is called by the request and associated with itself. * * @return response object */ static FBackgroundHttpResponsePtr ConstructBackgroundResponse(int32 ResponseCode, const FString& TempFilePath); /** * Function that takes in a URL and figures out the location we should use as the temp storage URL * * @param URL FString URL of the request that we need to find the end location for. * * @return FString File Path the temp file would be located at for the supplied URL. */ static const FString GetTemporaryFilePathFromURL(const FString& URL); /** * Function that returns the root path where all our temporary files are stored on this platform * * @return FString File path that is the root path of our temp files for background http work on this platform. */ static const FString& GetTemporaryRootPath(); };
8b1783add1e2bff3603930b069549badd696240a
96a72e0b2c2dae850d67019bc26b73864e680baa
/Study/Data struct/Tree/hw7_3.cpp
f409098a5572974a72411058a237780e35990b46
[]
no_license
SeaCanFly/CODE
7c06a81ef04d14f064e2ac9737428da88f0957c7
edf9423eb074861daf5063310a894d7870fa7b84
refs/heads/master
2021-04-12T12:15:58.237501
2019-07-15T05:02:09
2019-07-15T05:02:09
126,703,006
3
0
null
null
null
null
UTF-8
C++
false
false
3,290
cpp
hw7_3.cpp
#include<stdio.h> #include<iostream> #include<malloc.h> #define MAX 300 typedef struct Node { int data; Node* left; Node* right; }Node; Node* newNode(int data) { Node* t = (Node*)malloc(sizeof(Node)); t->data = data; t->left = nullptr; t->right = nullptr; return t; } typedef struct S { Node* s[MAX] = { 0 }; int top = -1; void push(Node* t) { if (top == MAX - 1)return; s[++top] = t; } Node* pop() { if (top == -1)return nullptr; return s[top--]; } Node* getTop() { if (top == -1)return nullptr; return s[top]; } }S; typedef struct BTree { Node* root = nullptr; S s; void newBTree() { int data; if (root)return; printf("root:"); if (scanf("%d", &data) != 1) { int c; while ((c = getchar()) != '\n'&&c != EOF); return; } root = newNode(data); Node* p = root; s.push(p); do { while (p) { printf("%d left:", p->data); if (scanf("%d", &data) != 1) { p->left = nullptr; p = p->left; int c; while ((c = getchar()) != '\n'&&c != EOF); } else { p->left = newNode(data); s.push(p->left); p = p->left; } } if (s.top != -1) { p = s.pop(); printf("%d right:", p->data); if (scanf("%d", &data) != 1) { p->right = nullptr; p = p->right; int c; while ((c = getchar()) != '\n'&&c != EOF); } else { p->right = newNode(data); s.push(p->right); p = p->right; } } } while (p || s.top != -1); } void inOrder() { Node* p = root; do { while (p) { s.push(p); p = p->left; } if (s.top != -1) { p = s.pop(); printf("%d,", p->data); p = p->right; } } while (p || s.top != -1); } ~BTree() { Node* p = root; Node* t = nullptr; do { while (p) { s.push(p); p = p->left; } if (s.top != -1) { p = s.getTop(); if (p->right == nullptr || p->right == t) { s.top--; t = p; printf("\n%d freed\n", p->data); free(p); p = nullptr; } else p = p->right; } } while (p || s.top != -1); } }BTree; int max(Node* root) { if (!root->left && !root->right) { return root->data; } else { if (root->left && root->right) { return root->data > max(root->left) ? (root->data > max(root->right) ? root->data : max(root->right)) : (max(root->left) > max(root->right) ? max(root->left) : max(root->right)); } else if (!root->left && root->right) { return root->data > max(root->right) ? root->data : max(root->right); } else { return root->data > max(root->left) ? root->data : max(root->left); } } } int min(Node* root) { if (!root->left && !root->right) { return root->data; } else { if (root->left&&root->right) { return root->data < min(root->left) ? (root->data < min(root->right) ? root->data : min(root->right)) : (min(root->left) < min(root->right) ? min(root->left) : min(root->right)); } else if (!root->left&&root->right) { return root->data < min(root->right) ? root->data : min(root->right); } else { return root->data < min(root->left) ? root->data : min(root->left); } } } int main() { BTree a; a.newBTree(); a.inOrder(); printf("\nmax:%d\n", max(a.root)); printf("min:%d\n", min(a.root)); system("pause"); return 0; }
ddb6b55025b08a2a00b259304ddf58d6564f1c32
5ff0b928d9e93667c8f6c6c9796c3af015b87f81
/Boss (Code)/Game/GameCameras/Camera2D.cpp
fc8a6986081469442200cfaf7ec1b85c7a2e4a1c
[]
no_license
DodgeeSoftware/Boss-Project-MinGW-w64
1820671b8ba07c101de678269dc718646b962730
6b3bdfc576e67f557657273d2464b68b1e9569b2
refs/heads/master
2022-03-29T12:42:44.349220
2019-11-17T21:11:40
2019-11-17T21:11:40
222,312,722
1
0
null
null
null
null
UTF-8
C++
false
false
5,091
cpp
Camera2D.cpp
#include "Camera2D.h" Camera2D::Camera2D() { // Set running Flag this->runningFlag = false; // Set paused Flag this->pausedFlag = false; // Position this->x = 0; this->y = 0; // Velocity this->xVelocity = 0.0f; this->yVelocity = 0.0f; // Acceleration this->xAcceleration = 0.0f; this->yAcceleration = 0.0f; // Dimensions this->viewPortWidth = 0; this->viewPortHeight = 0; // Bound to a region Flag this->boundFlag = false; this->boundX = 0.0f; this->boundY = 0.0f; this->boundWidth = 0.0f; this->boundHeight = 0.0f; // Zoom this->zoom = 1.0f; this->zoomFocusX = 0.0f; this->zoomFocusY = 0.0f; // Shake this->shaking = false; this->shakeX = 1.0f; this->shakeY = 1.0f; } Camera2D::~Camera2D() { } //Camera2D::Camera2D(const Camera2D& other) //{ // //} bool Camera2D::init() { // Swap to the Project Matrix glMatrixMode(GL_PROJECTION); // Reset the Projection Matrix glLoadIdentity(); // Populate thee current matrix with a projection matrix glOrtho(0, this->viewPortWidth, this->viewPortHeight, 0.0, 1.0, -1.0); // Swap to the ModelView Matrix glMatrixMode(GL_MODELVIEW); // Reset the ModelView Matrix glLoadIdentity(); // Camera successfully initialised return true; } void Camera2D::update(float dTime) { this->xVelocity += this->xAcceleration; this->yVelocity += this->yAcceleration; this->x += this->xVelocity; this->y += this->yVelocity; } void Camera2D::draw() { // Swap to the Project matrix glMatrixMode(GL_PROJECTION); // Reset the Projection Matrix glLoadIdentity(); // Populate thee current matrix with a projection matrix glOrtho(0, this->viewPortWidth, this->viewPortHeight, 0.0, 0.0, 1.0); if (this->shaking == true) { // Make the screen shake glTranslatef(((float)rand() / (float)RAND_MAX - (float)rand() / (float)RAND_MAX) * this->shakeX, ((float)rand() / (float)RAND_MAX - (float)rand() / (float)RAND_MAX) * this->shakeY, 0.0f); } // Restore the position of the camera glTranslatef(this->zoomFocusX, this->zoomFocusY, 0.0f); // Set the scale (not the same az zoom but similar results) glScalef(this->zoom, this->zoom, 1.0f); // Make the Centre of the camera the origin for zooming glTranslatef(-this->zoomFocusX, -this->zoomFocusY, 0.0f); // Swap to the Modelview matrix glMatrixMode(GL_MODELVIEW); } void Camera2D::clear() { // Position this->x = 0; this->y = 0; // Velocity this->xVelocity = 0.0f; this->yVelocity = 0.0f; // Acceleration this->xAcceleration = 0.0f; this->yAcceleration = 0.0f; // Dimensions this->viewPortWidth = 0; this->viewPortHeight = 0; // Bound to a region Flag this->boundFlag = false; this->boundX = 0.0f; this->boundY = 0.0f; this->boundWidth = 0.0f; this->boundHeight = 0.0f; // Zoom this->zoom = 1.0f; this->zoomFocusX = 0.0f; this->zoomFocusY = 0.0f; // Shake this->shaking = false; this->shakeX = 1.0f; this->shakeY = 1.0f; } void Camera2D::free() { // Position this->x = 0; this->y = 0; // Velocity this->xVelocity = 0.0f; this->yVelocity = 0.0f; // Acceleration this->xAcceleration = 0.0f; this->yAcceleration = 0.0f; // Dimensions this->viewPortWidth = 0; this->viewPortHeight = 0; // Bound to a region Flag this->boundFlag = false; this->boundX = 0.0f; this->boundY = 0.0f; this->boundWidth = 0.0f; this->boundHeight = 0.0f; // Zoom this->zoom = 1.0f; this->zoomFocusX = 0.0f; this->zoomFocusY = 0.0f; // Shake this->shaking = false; this->shakeX = 1.0f; this->shakeY = 1.0f; } void Camera2D::start() { // Set running Flag this->runningFlag = true; } void Camera2D::stop() { // Set running Flag this->runningFlag = false; } void Camera2D::pause() { // Set paused Flag this->pausedFlag = true; } void Camera2D::resume() { // Set paused Flag this->pausedFlag = false; } void Camera2D::reset() { // Position this->x = 0; this->y = 0; // Velocity this->xVelocity = 0.0f; this->yVelocity = 0.0f; this->xAcceleration = 0.0f; this->yAcceleration = 0.0f; //// Dimensions //this->viewPortWidth = 0; //this->viewPortHeight = 0; // Bound to a region Flag //this->boundFlag = false; //this->boundX = 0.0f; //this->boundY = 0.0f; //this->boundWidth = 0.0f; //this->boundHeight = 0.0f; // Zoom this->zoom = 1.0f; //this->zoomFocusX = 0.0f; //this->zoomFocusY = 0.0f; // Shake this->shaking = false; this->shakeX = 1.0f; this->shakeY = 1.0f; } void Camera2D::startShake() { this->shaking = true; } void Camera2D::stopShake() { this->shaking = false; } void Camera2D::setShakeBounds(float shakeX, float shakeY) { this->shakeX = shakeX; this->shakeY = shakeY; } void Camera2D::shake() { // TODO: Implement me }
e0749e69795c71c40dfa87c15b5ecb9bfb1c148e
7da01b304f9dafab18cffa8b159604b13ceaee6c
/aads/next_perm/main.cpp
630c2eb8d11c7349de965b9889bedac51752d9d2
[]
no_license
AgSmith95/exercises
f883b7a4851c0e42f646ebd040c2b4c9e754fe9f
89736ecddd581784a8dc2b2ca71b589c60cea909
refs/heads/master
2022-12-04T00:57:21.611272
2022-12-03T02:00:01
2022-12-03T02:00:01
137,570,441
1
1
null
2022-12-03T02:00:02
2018-06-16T09:50:33
C++
UTF-8
C++
false
false
3,626
cpp
main.cpp
#include <iostream> #include <vector> #include <algorithm> #include <cassert> template <typename It> // It - bidirectional iterator bool next_permutation(It first, It last) { // Code taken from cppreference - https://en.cppreference.com/w/cpp/algorithm/next_permutation // Explanation taken from geeksforgeeks - https://www.geeksforgeeks.org/lexicographically-next-permutation-in-cpp/ // For step 1. we need a "reversed" sequence auto r_first = std::make_reverse_iterator(last); auto r_last = std::make_reverse_iterator(first); // 1. Traverse squence from the right and find the first element that // is not following the descending order auto left = std::is_sorted_until(r_first, r_last); if(left != r_last){ // find closest greater element to the element from step 1. auto right = std::upper_bound(r_first, left, *left); // 2. Swap element from 1. with the closest greater element std::iter_swap(left, right); } // 3. Reverse what left of the sequence std::reverse(left.base(), last); return left != r_last; } // 0 1 2 5 3 3 0 // 0 1 3 0 2 3 5 template <typename T> std::vector<T> &next_permutation(std::vector<T> &seq) { size_t size = seq.size(); // 1) Find largest index I such that seq[I − 1] < seq[I] size_t I = 0; for (size_t i = size - 1; i > 0; --i) { if (seq[i] > seq[i - 1]) { I = i; break; } } // If no such I exists, then this is already the last permutation if (I == 0) { return seq; } // 2) Find largest index J such that J ≥ I and seq[J] > seq[I − 1]. size_t J = I - 1; for (size_t j = size - 1; j >= I; --j) { if (seq[j] > seq[I - 1]) { J = j; break; } } // 3) Swap seq[J] and seq[J − 1]. std::swap(seq[J], seq[I - 1]); // 4) Reverse seq[I..N] std::reverse(seq.begin() + I, seq.end()); return seq; } template <typename T> void print_vect(const std::vector<T> &v) { for (const auto &el : v) { std::cout << el << ' '; } std::cout << '\n'; } int main() { if (true) { std::vector<int> v1 = {0, 1, 2, 5, 3, 3, 0}; print_vect(v1); // next print_vect(next_permutation(v1)); // 0 1 2 5 3 3 0 print_vect(next_permutation(v1)); // 0 1 3 0 2 5 3 print_vect(next_permutation(v1)); // 0 1 3 0 3 2 5 print_vect(next_permutation(v1)); // 0 1 3 0 3 5 2 std::cout << '\n'; // check yourself std::vector<int> v1c = {0, 1, 2, 5, 3, 3, 0}; print_vect(v1c); std::next_permutation(v1c.begin(), v1c.end()); // 0 1 2 5 3 3 0 print_vect(v1c); std::next_permutation(v1c.begin(), v1c.end()); // 0 1 3 0 2 5 3 print_vect(v1c); std::next_permutation(v1c.begin(), v1c.end()); // 0 1 3 0 3 2 5 print_vect(v1c); std::next_permutation(v1c.begin(), v1c.end()); // 0 1 3 0 3 5 2 print_vect(v1c); std::cout << '\n'; } if (true) { std::vector<int> v2 = {4, 2, 5, 3, 1}; print_vect(v2); // next print_vect(next_permutation(v2)); print_vect(next_permutation(v2)); print_vect(next_permutation(v2)); print_vect(next_permutation(v2)); std::cout << '\n'; } if (true) { std::vector<char> v3 = {'F', 'A', 'D', 'E'}; print_vect(v3); // next print_vect(next_permutation(v3)); print_vect(next_permutation(v3)); print_vect(next_permutation(v3)); v3 = {'F', 'A', 'D', 'E'}; std::vector<char> v3c1 = {'F', 'A', 'D', 'E'}; std::vector<char> v3c2 = {'F', 'A', 'D', 'E'}; while (std::next_permutation(v3c1.begin(), v3c1.end())) { next_permutation(v3); ::next_permutation(v3c2.begin(), v3c2.end()); // DEBUG // print_vect(v3c1); // print_vect(v3c2); // std::cout << '\n'; assert(v3c1 == v3c2); assert(v3c1 == v3); } std::cout << '\n'; } return 0; }
f9af17d31e0f81c4494bb9dbd7e4083ba719fbdc
e050ed11d2ddf33e659fcb36de8b728ee024cb9d
/C++/OOP/Ex3/ring.h
776794ef420d4a4abb431022e25146bdde830e26
[]
no_license
sebastian16m16/Learning-C-C-
cdde0ea0aca528576c9c7bcd8752386b767393b2
0efbbef6ab96f89844eda830009c25bfb3588a03
refs/heads/master
2022-12-14T21:31:07.165364
2022-12-02T17:45:15
2022-12-02T17:45:15
203,569,678
0
0
null
null
null
null
UTF-8
C++
false
false
3,094
h
ring.h
#pragma once #include <iostream> #include <string> #include <initializer_list> #include <map> template<typename T> class ring{ private: unsigned m_capacity{}; unsigned m_pos{}; T *m_buf{}; public: ring(unsigned capacity): m_capacity{capacity}{ m_buf = new T[capacity]{}; } ring(const ring &o) : ring{o.m_capacity} { for(unsigned i = 0u; i < m_capacity; i++) add(o.m_buf[i]); m_pos = o.m_pos; } ring(unsigned capacity, std::initializer_list<T> l): ring(capacity) { m_buf = new T[capacity]{}; for(auto item : l){ add(item); } } ring(std::initializer_list<T> l) : ring(l.size()) { for(auto n : l){ add(n); } } ring &operator=(const ring &o) { m_capacity = o.m_capacity; m_pos = 0u; delete[] m_buf; m_buf = new T[o.m_capacity]{}; for(auto i = 0u; i < m_capacity; i++) add(o.m_buf[i]); m_pos = o.m_pos; return *this; } ~ring(){ if(m_buf != nullptr) //redundant delete[] m_buf; } T at(unsigned index) const{ if(index > m_capacity) throw std::string{"ring::get: index out of range"}; return m_buf[index]; } ring &add(T obj){ //daca nu e &add ci doar add... de fiecare data cand se apeleaza functia va crea un if(m_capacity == 0u) return *this; //obiect de fiecare data (Ar fi haos) m_buf[m_pos++] = obj; m_pos = m_pos % m_capacity; return *this; } friend std::ostream &operator<<(std::ostream &out, const ring &r){ out << "Capacity: " << r.m_capacity << ", Pos: " << r.m_pos; out << std::endl; for(unsigned i = 0u; i < r.m_capacity; i++) out << r.m_buf[i] << " "; return out; } class iterator; iterator begin() { return iterator{0, *this}; } iterator end() { return iterator{m_capacity, *this}; } }; template<typename T> class ring<T>::iterator //se defineste clasa iterator din clasa ring { public: iterator(unsigned pos, ring &r) : m_pos{pos}, m_ring{r} {} ~iterator(){} T operator*() {return m_ring.at(m_pos);} bool operator == (const iterator &o) { return m_pos == o.m_pos; } bool operator != (const iterator &o) { return m_pos != o.m_pos; } iterator &operator++(int) { m_pos++; return *this; } iterator &operator++() { iterator it = *this; m_pos++; return it; } private: unsigned m_pos{}; ring &m_ring; };
a176611f635ebbdf588937ff4a29846cb1aefa3d
ded7f8e9b42cde3b4bce41847eb083eb52545e67
/maze_txt.cpp
ad968d887db16f8d3061e4faf4f05cce1e526bcf
[]
no_license
Deadlica/maze-generator
ceedb24670a20cf95c368195f8b59e51f870f767
41568276473595ff70766f3ac020a2ff3c563732
refs/heads/main
2023-04-25T05:24:01.387806
2021-05-13T13:16:09
2021-05-13T13:16:09
362,181,948
0
0
null
null
null
null
UTF-8
C++
false
false
3,351
cpp
maze_txt.cpp
/* Samuel Greenberg 02/05/2021 DT019G Labyrint Projekt Siktar på betyget A */ #include "maze_txt.h" bool checkMazeFile(const std::vector<std::string> tempMaze) { if(tempMaze.empty()) { return false; } if(!checkMazeSize(tempMaze)) { // Checks that maze width is okay return false; } if(!checkMazeBorder(tempMaze)) { // Checks border chars return false; } if(!checkMazeGraphics(tempMaze)) { // Checks the chars inside the border return false; } return true; } bool checkMazeSize(const std::vector<std::string> tempMaze) { size_t rowLength = tempMaze[0].length(); if(tempMaze.size() % 2 == 0 || tempMaze.size() < 3 || rowLength % 2 == 0 || rowLength < 3) { // Size is even number std::cout << "Invalid maze size" << std::endl; return false; } for(auto it : tempMaze) { if(it.length() != rowLength) { // A row being different size than others std::cout << "Maze width is invalid" << std::endl; return false; } } return true; } bool checkMazeBorder(const std::vector<std::string> tempMaze) { int E = 0, S = 0; for(int i = 1; i < tempMaze[0].length() - 1; i++) { // Looks for S in top row if(tempMaze[0][i] == 'S') { S++; } } for(int i = 1; i < tempMaze[tempMaze.size() - 1].length() - 1; i++) { // Looks for E in bottom row if(tempMaze[tempMaze.size() - 1][i] == 'E') { E++; } } if(E == 0 || E > 1 || S == 0 || S > 1) { // if there's no or multiple starts/ends return false; } S = 0; E = 0; for(int i = 0; i < tempMaze.size(); i++) { // Checks maze border graphics if(i == 0 || i == tempMaze.size() - 1) { // Checks top and bottom row for(int j = 0; j < tempMaze[i].size(); j++) { if(!validWallChar(tempMaze[i][j]) && tempMaze[i][j] != 'S' && tempMaze[i][j] != 'E' || E > 1 || S > 1) { // Invalid char or multiple S/E return false; } if(tempMaze[i][j] == 'E') { E++; } if(tempMaze[i][j] == 'S') { S++; } } } else { // Checks other rows if(!validWallChar(tempMaze[i][0]) || !validWallChar(tempMaze[i][tempMaze[i].size() - 1])) { return false; } } } return true; } bool checkMazeGraphics(const std::vector<std::string> tempMaze) { // Checks the chars inside the border for(int y = 1; y < tempMaze.size() - 1; y++) { for(int x = 1; x < tempMaze[y].length() - 1; x++) { if(!validWallChar(tempMaze[y][x]) && tempMaze[y][x] != ' ') { // Invalid char graphic return false; } } } return true; } bool validWallChar(char graphic) { // Checks if a char is valid for the maze if(graphic >= '!' && graphic < 'E' || graphic > 'E' && graphic < 'S' || graphic > 'S' && graphic <= '~') { return true; } return false; } int getMazeFileWidth(const std::vector<std::string> tempMaze) { // Returns the maze width return tempMaze[0].length(); } int getMazeFileHeight(const std::vector<std::string> tempMaze) { // Returns the maze height return tempMaze.size(); }
ebb37347a86c94e2d98547c47be8fe0232f4bee0
cbf9d42397cc2bda21d2451d576c6e0307666243
/src/Rodin/Variational/QuadratureRule.cpp
fe261d8fc6fd45b4dec5fb7cd409e8dfaaa3f73f
[ "BSL-1.0" ]
permissive
cbritopacheco/rodin
272bd34b8d91ec825934a617d1fea751786a9632
a64520db90ac444b7ce61ca353aa9fe85e4868d0
refs/heads/master
2023-08-21T20:19:35.539806
2023-08-14T20:36:37
2023-08-14T20:36:37
422,234,328
24
5
BSL-1.0
2023-08-14T18:42:04
2021-10-28T14:22:55
C++
UTF-8
C++
false
false
140
cpp
QuadratureRule.cpp
#include "QuadratureRule.h" namespace Rodin::Variational { std::map<QuadratureRule::Key, QuadratureRule> QuadratureRule::s_rules = {}; }
13d63db28359ee5ec175bd76403cb4d5bf66cd2f
116c90f349a8957ba4ad0559c7fcc2be78f0f101
/Vlasov_Roman_kr/research_thread.cpp
277898b8d3566c511daff00bce11edba67188792
[]
no_license
Abdulrahman-gooba/ADS_7383
bd9cddd961d2fdf132f8852f15e1f2e5684f3bc5
d70d0b5a0c4dcb2ebfbc72c8e7c0f619ebe72281
refs/heads/master
2020-07-29T02:00:17.162169
2018-12-27T13:01:31
2018-12-27T13:01:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,039
cpp
research_thread.cpp
#include "research_thread.h" #include "huffmanstatic.h" #include "huffmandynamic.h" #include "shennonfano.h" #include <QMainWindow> #include <sstream> #include <cmath> #include <ctime> #include <cstdlib> #include <QtCharts/QChartView> #include <QtCharts/QValueAxis> #include <QtCharts/QSplineSeries> QT_CHARTS_USE_NAMESPACE research_thread::research_thread(QObject *parent) : QObject(parent) { } void research_thread::run() { //Depends on input size QSplineSeries *hs1 = new QSplineSeries(); QSplineSeries *sf1 = new QSplineSeries(); QSplineSeries *hd1 = new QSplineSeries(); QSplineSeries *hsop = new QSplineSeries(); QSplineSeries *sfop = new QSplineSeries(); QSplineSeries *hdop = new QSplineSeries(); QSplineSeries *theor1 = new QSplineSeries(); hs1->setName("Huffman static"); sf1->setName("Shennon-Fano"); hd1->setName("Huffman dynamic"); hsop->setName("Huffman static"); sfop->setName("Shennon-Fano"); hdop->setName("Huffman dynamic"); theor1->setName("Theoretical (n log(n))"); for (int i = 1000; i >= 1; i/=3) { std::stringstream ss; std::string ans; std::string str; for (int j = 0; j < (int)(pow(10, 6)/i); j++) str.push_back(1 + rand()%127); ss << str; HuffmanStatic<char>* hufs = new HuffmanStatic<char>(ss, false); ans = hufs->abc + hufs->encode(ss); hsop->append((int)(pow(10, 6)/i), hufs->getOp()); hs1->append((int)(pow(10, 6)/i), ans.size()); ss.clear(); ans.clear(); ss << str; ShennonFano<char>* shf = new ShennonFano<char>(ss, false); ans = shf->abc + shf->encode(ss); sf1->append((int)(pow(10, 6)/i), ans.size()); sfop->append((int)(pow(10, 6)/i), shf->getOp()); ss.clear(); ans.clear(); ss << str; HuffmanDynamic<char>* hufd = new HuffmanDynamic<char>(); ans = hufd->encode(ss); hd1->append((int)(pow(10, 6)/i), ans.size()); hdop->append((int)(pow(10, 6)/i), hufd->getOp()); delete hufs; delete shf; delete hufd; } for (int i = 1; i <= 1000001; i+= 100000) { theor1->append(i, i*log(i)/log(2)); } QChart *chart1 = new QChart(); chart1->addSeries(hs1); chart1->addSeries(sf1); chart1->addSeries(hd1); chart1->addSeries(theor1); chart1->setTitle("Size of encoded text depending on input size"); QChart *chartop = new QChart(); chartop->addSeries(hsop); chartop->addSeries(sfop); chartop->addSeries(hdop); chartop->setTitle("Operations depending on input size"); QValueAxis *axisX1 = new QValueAxis(); axisX1->setTitleText("Input text size (characters)"); axisX1->setLabelFormat("%d"); chart1->addAxis(axisX1, Qt::AlignBottom); hs1->attachAxis(axisX1); sf1->attachAxis(axisX1); hd1->attachAxis(axisX1); QValueAxis *axisY1 = new QValueAxis(); axisY1->setTitleText("Output text size (characters)"); axisY1->setLabelFormat("%d"); chart1->addAxis(axisY1, Qt::AlignLeft); hs1->attachAxis(axisY1); sf1->attachAxis(axisY1); hd1->attachAxis(axisY1); QValueAxis *axisXop = new QValueAxis(); axisXop->setTitleText("Input text size (characters)"); axisXop->setLabelFormat("%d"); chartop->addAxis(axisXop, Qt::AlignBottom); hsop->attachAxis(axisXop); sfop->attachAxis(axisXop); hdop->attachAxis(axisXop); QValueAxis *axisYop = new QValueAxis(); axisYop->setTitleText("Operations (times)"); axisYop->setLabelFormat("%d"); chartop->addAxis(axisYop, Qt::AlignLeft); hsop->attachAxis(axisYop); sfop->attachAxis(axisYop); hdop->attachAxis(axisYop); QChartView *chartView1 = new QChartView(chart1); chartView1->setRenderHint(QPainter::Antialiasing); QMainWindow *gr1 = new QMainWindow(); //gr1->resize(1500, 800); gr1->setFixedSize(1800, 1000); gr1->setWindowTitle("Different input sizes"); gr1->setCentralWidget(chartView1); gr1->show(); QChartView *chartViewop = new QChartView(chartop); chartViewop->setRenderHint(QPainter::Antialiasing); QMainWindow *grop = new QMainWindow(); //gr1->resize(1500, 800); grop->setFixedSize(1800, 1000); grop->setWindowTitle("Amount of operations"); grop->setCentralWidget(chartViewop); grop->show(); //Depends on alphabet size (500 characters) QSplineSeries *hs2 = new QSplineSeries(); QSplineSeries *sf2 = new QSplineSeries(); QSplineSeries *hd2 = new QSplineSeries(); hs2->setName("Huffman static"); sf2->setName("Shennon-Fano"); hd2->setName("Huffman dynamic"); for (int i = 1; i < 8; i++) { std::stringstream ss; std::string ans; std::string str; for (int j = 0; j < 500; j++) str.push_back(1 + rand()%(int)pow(2, i)); ss << str; HuffmanStatic<char>* hufs = new HuffmanStatic<char>(ss, false); ans = hufs->abc + hufs->encode(ss); hs2->append((int)pow(2, i), ans.size()); ss.clear(); ans.clear(); ss << str; ShennonFano<char>* shf = new ShennonFano<char>(ss, false); ans = shf->abc + shf->encode(ss); sf2->append((int)pow(2, i), ans.size()); ss.clear(); ans.clear(); ss << str; HuffmanDynamic<char>* hufd = new HuffmanDynamic<char>(); ans = hufd->encode(ss); hd2->append((int)pow(2, i), ans.size()); delete hufs; delete shf; delete hufd; } QChart *chart2 = new QChart(); chart2->addSeries(hs2); chart2->addSeries(sf2); chart2->addSeries(hd2); chart2->setTitle("Size of encoded text depending on alphabet size (500 characters)"); QValueAxis *axisX2 = new QValueAxis(); axisX2->setTitleText("Input alphabet size (characters)"); axisX2->setLabelFormat("%d"); chart2->addAxis(axisX2, Qt::AlignBottom); hs2->attachAxis(axisX2); sf2->attachAxis(axisX2); hd2->attachAxis(axisX2); QValueAxis *axisY2 = new QValueAxis(); axisY2->setTitleText("Output text size (characters)"); axisY2->setLabelFormat("%d"); chart2->addAxis(axisY2, Qt::AlignLeft); hs2->attachAxis(axisY2); sf2->attachAxis(axisY2); hd2->attachAxis(axisY2); QChartView *chartView2 = new QChartView(chart2); chartView2->setRenderHint(QPainter::Antialiasing); QMainWindow *gr2 = new QMainWindow(); //gr2->resize(1920, 1080); gr2->setFixedSize(1800, 1000); gr2->setWindowTitle("Different alphabet sizes"); gr2->setCentralWidget(chartView2); gr2->show(); //Depends on alphabet size (1500 characters) QSplineSeries *hs3 = new QSplineSeries(); QSplineSeries *sf3 = new QSplineSeries(); QSplineSeries *hd3 = new QSplineSeries(); hs3->setName("Huffman static"); sf3->setName("Shennon-Fano"); hd3->setName("Huffman dynamic"); for (int i = 1; i < 8; i++) { std::stringstream ss; std::string ans; std::string str; for (int j = 0; j < 1500; j++) str.push_back(1 + rand()%(int)pow(2, i)); ss << str; HuffmanStatic<char>* hufs = new HuffmanStatic<char>(ss, false); ans = hufs->abc + hufs->encode(ss); hs3->append((int)pow(2, i), ans.size()); ss.clear(); ans.clear(); ss << str; ShennonFano<char>* shf = new ShennonFano<char>(ss, false); ans = shf->abc + shf->encode(ss); sf3->append((int)pow(2, i), ans.size()); ss.clear(); ans.clear(); ss << str; HuffmanDynamic<char>* hufd = new HuffmanDynamic<char>(); ans = hufd->encode(ss); hd3->append((int)pow(2, i), ans.size()); delete hufs; delete shf; delete hufd; } QChart *chart3 = new QChart(); chart3->addSeries(hs3); chart3->addSeries(sf3); chart3->addSeries(hd3); chart3->setTitle("Size of encoded text depending on alphabet size (1500 characters)"); QValueAxis *axisX3 = new QValueAxis(); axisX3->setTitleText("Input alphabet size (characters)"); axisX3->setLabelFormat("%d"); chart3->addAxis(axisX3, Qt::AlignBottom); hs3->attachAxis(axisX3); sf3->attachAxis(axisX3); hd3->attachAxis(axisX3); QValueAxis *axisY3 = new QValueAxis(); axisY3->setTitleText("Output text size (characters)"); axisY3->setLabelFormat("%d"); chart3->addAxis(axisY3, Qt::AlignLeft); hs3->attachAxis(axisY3); sf3->attachAxis(axisY3); hd3->attachAxis(axisY3); QChartView *chartView3 = new QChartView(chart3); chartView3->setRenderHint(QPainter::Antialiasing); QMainWindow *gr3 = new QMainWindow(); //gr2->resize(1920, 1080); gr3->setFixedSize(1800, 1000); gr3->setWindowTitle("Different alphabet sizes"); gr3->setCentralWidget(chartView3); gr3->show(); while(gr1->isVisible() || gr2->isVisible() || gr3->isVisible() || grop->isVisible()) { ; } emit finished(); }
3b147425cd22c4a9527855f90ab974b0a89b969e
1ba754960b4df9d01c1dbd4b8d87cac7e1e8b88e
/TTT.cpp
6542fc7ce06f30ef5ab63e44fa0b73869a9e76a0
[]
no_license
ijoo2/TTT
ed2fad9ea4c65b8e1280a895a1aafa265e6b7c1e
853e35542668b6f85bed1db251e2f94c475d50dd
refs/heads/master
2020-04-06T14:27:40.859868
2014-09-13T03:43:45
2014-09-13T03:43:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
493
cpp
TTT.cpp
#include <iostream> #include <array> using namespace std; class TicTacToe { public: TicTacToe(); private: int board[3][3]; int player; char displayBoard[3][3]; } TicTacToe::TicTacToe() { player = 1; for(int i=0; i<3; i++){ for(int j=-; j<3; j++){ board[i][j] = 0; displayBoard[i][j] = ' '; } int main() { TicTacToe game; bool more = true; while(more){ return 0; }
2fbfeb1136a5ccf534953de8c1e759f709b69c65
7a6c99e37463e9eca0aaf57391e8ec2912060d34
/t2/print.cpp
c65de7f61c1bb6c4ed6f104e04e4544a85864ffe
[ "MIT" ]
permissive
taschetto/networksLab
25e58ba8e0640f16fb78aa9f8c1e0edf83d005f6
4dcdb35e5a97a1605a631fabcc879f17b418f346
refs/heads/master
2021-01-23T00:10:00.453371
2014-11-28T20:08:06
2014-11-28T20:08:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,346
cpp
print.cpp
#include <iomanip> #include <iostream> #include <sstream> #include <string> #include <net/if.h> #include <netinet/ether.h> #include <linux/ip.h> #include <arpa/inet.h> #include "ospf.h" #include "print.h" #include "colors.h" using namespace std; using namespace Colors; string ifreq_to_str(const ifreq& ifr) { ostringstream oss; oss << blue << "Ready to capture from: " << reset << ifr.ifr_name << endl; oss << blue << " Interface Index: " << reset << (int)ifr.ifr_ifindex << endl; oss << blue << " Hardware Addr: " << reset << ether_ntoa((struct ether_addr*)ifr.ifr_hwaddr.sa_data) << endl; oss << blue << " Protocol Addr: " << reset << inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr) << endl; return oss.str(); } string ether_to_str(const ether_header& ether) { ostringstream oss; oss.fill('0'); oss << endl; oss << blue << "Ethernet Packet" << reset << endl; oss << blue << "Destination: " << reset << ether_ntoa((struct ether_addr*)ether.ether_dhost) << endl; oss << blue << " Src: " << reset << ether_ntoa((struct ether_addr*)ether.ether_shost) << endl; oss << blue << " Type: " << reset << "0x" << std::setw(4) << std::hex << ntohs(ether.ether_type) << endl; return oss.str(); } string ip_to_str(const iphdr& ip) { ostringstream oss; oss.fill('0'); oss << endl; oss << blue << "IP Packet" << reset << endl; oss << blue << " IHL: " << reset << std::dec << (int)ip.ihl << endl; oss << blue << " Version: " << reset << (int)ip.version << endl; oss << blue << " TOS: " << reset << "0x" << (int)ip.tos << endl; oss << blue << " LEN: " << reset << ntohs(ip.tot_len) << endl; oss << blue << " ID: " << reset << ntohs(ip.id) << endl; oss << blue << " Frag Off: " << reset << ntohs(ip.frag_off) << endl; oss << blue << " TTL: " << reset << (int)ip.ttl << endl; oss << blue << " Protocol: " << reset << (int)ip.protocol << endl; oss << blue << " Check: " << reset << "0x" << std::setw(4) << std::hex << ntohs(ip.check) << endl; char straddr[INET_ADDRSTRLEN]; inet_ntop(AF_INET, &ip.saddr, straddr, sizeof straddr); oss << blue << " Source: " << reset << straddr << endl; inet_ntop(AF_INET, &ip.daddr, straddr, sizeof straddr); oss << blue << "Destination: " << reset << straddr << endl; return oss.str(); } string ospf_to_str(const ospfhdr& ospf) { ostringstream oss; oss.fill('0'); oss << endl; oss << blue << "OSPF Packet" << reset << endl; oss << blue << " Version: " << reset << (int)ospf.ospf_version << endl; oss << blue << " Type: " << reset << (int)ospf.ospf_type << endl; oss << blue << " Length: " << reset << ntohs(ospf.ospf_len) << endl; char straddr[INET_ADDRSTRLEN]; inet_ntop(AF_INET, &ospf.ospf_routerid, straddr, sizeof straddr); oss << blue << " RouterId: " << reset << straddr << endl; inet_ntop(AF_INET, &ospf.ospf_areaid, straddr, sizeof straddr); oss << blue << " AreaId: " << reset << straddr << endl; oss << blue << " CheckSum: " << reset << "0x" << std::setw(4) << std::hex << ntohs(ospf.ospf_chksum) << endl; oss << blue << " AuthType: " << reset << (int)ospf.ospf_authtype << endl; return oss.str(); } string ospf_hello_to_str(const ospfhdr& ospf) { ostringstream oss; oss.fill('0'); oss << endl; oss << blue << "OSPF Hello Packet" << reset << endl; char straddr[INET_ADDRSTRLEN]; inet_ntop(AF_INET, &ospf.ospf_hello.hello_mask, straddr, sizeof straddr); oss << blue << " Network Mask: " << reset << straddr << endl; oss << blue << " Hello interval: " << reset << ntohs(ospf.ospf_hello.hello_helloint) << endl; oss << blue << " Hello Options: " << reset << "0x" << std::setw(2) << std::hex << ntohs(ospf.ospf_hello.hello_options) << endl; oss << blue << " Router Priority: " << reset << (int)ospf.ospf_hello.hello_priority << endl; oss << blue << " Router Dead Interval: " << reset << (int32_t)ospf.ospf_hello.hello_deadint << endl; inet_ntop(AF_INET, &ospf.ospf_hello.hello_dr, straddr, sizeof straddr); oss << blue << " Designated Router: " << reset << straddr << endl; inet_ntop(AF_INET, &ospf.ospf_hello.hello_bdr, straddr, sizeof straddr); oss << blue << " Backup Designated Router: " << reset << straddr << endl; inet_ntop(AF_INET, &ospf.ospf_hello.hello_neighbor[0], straddr, sizeof straddr); oss << blue << " Active Neighbor: " << reset << straddr << endl; //struct in_addr hello_mask; //uint16_t hello_helloint; //uint8_t hello_options; //uint8_t hello_priority; //uint32_t hello_deadint; //struct in_addr hello_dr; //struct in_addr hello_bdr; //struct in_addr hello_neighbor[1]; return oss.str(); } string ospf_db_to_str(const ospfhdr& ospf) { ostringstream oss; oss.fill('0'); oss << endl; oss << blue << "OSPF Database Description Packet" << reset << endl; oss << blue << " DB IfMtu: " << reset << (int)ospf.ospf_db.db_ifmtu << endl; oss << blue << " DB Options: " << reset << (int)ospf.ospf_db.db_options << endl; oss << blue << " DB Flags: " << reset << (int)ospf.ospf_db.db_flags << endl; oss << blue << " DB Seq: " << reset << (int)ospf.ospf_db.db_seq << endl; // oss << blue << " DB Lshdr: " << reset << << endl; //uint16_t db_ifmtu; //uint8_t db_options; //uint8_t db_flags; //uint32_t db_seq; //struct lsa_hdr db_lshdr[1]; /* may repeat */ return oss.str(); } string ospf_lsr_to_str(const ospfhdr& ospf) { ostringstream oss; oss.fill('0'); oss << endl; oss << blue << "OSPF Link State Request Packet" << reset << endl; // oss << blue << " Options: " << reset << (int)(int)ospf.ospf_hello.hello_options << endl; return oss.str(); } string ospf_lsu_to_str(const ospfhdr& ospf) { ostringstream oss; oss.fill('0'); oss << endl; oss << blue << "OSPF Link State Update Packet" << reset << endl; // oss << blue << " Options: " << reset << (int)(int)ospf.ospf_hello.hello_options << endl; return oss.str(); } string ospf_lsa_to_str(const ospfhdr& ospf) { ostringstream oss; oss.fill('0'); oss << endl; oss << blue << "OSPF Link State Acknowledgment Packet" << reset << endl; // oss << blue << " Options: " << reset << (int)(int)ospf.ospf_hello.hello_options << endl; return oss.str(); }
52b78b30ba17c22ab483a9218f247912d9182754
3547b781f06db3422ba9960bfc99d3fbaad9ce5a
/OJ/week1/1f.cpp
dd8aed470833c62513ad4172bbd11ac92241f137
[]
no_license
lzj112/2018_Summer
9ee90d47680f402be48b628f6ea2eb650a968d6e
6b49f727f91011a26f5c6477e28fed227fcd3be4
refs/heads/master
2020-03-22T10:44:09.168753
2019-02-19T12:14:58
2019-02-19T12:14:58
139,923,626
0
0
null
null
null
null
UTF-8
C++
false
false
761
cpp
1f.cpp
#include <iostream> #include <map> // #include <> using namespace std; int main() { // map<char, int> t; int t; string str; int len, i, sum, n; cin >> n; while (n--) { while (cin >> str) { t = 0; len = str.size(); i = len - 1; while (len--) { if (str[i] >= '0' && str[i] <= '9') { // t[str[i]]++; t++; } i--; } cout << t << endl; // for (auto x : t) // { // sum += x.second; // } // cout << sum << endl; // sum = 0; } } }
388ac2389f9d41e2984bc88c1eadd93b910a8ab9
abff35ebffb4c488b8a99660ea7ba6a431987077
/DICE.cpp
b6bf246c307f17549691a98e236ab76b2219ffe9
[]
no_license
madv809/Try-Hard
3a569be33cd51e3c0f93596a801aa5557d3a3907
3832dbaa2b24e08f23dcc4588aeb52cec1671941
refs/heads/master
2023-01-02T07:55:13.090601
2020-10-24T04:04:30
2020-10-24T04:04:30
299,155,973
0
0
null
null
null
null
UTF-8
C++
false
false
1,761
cpp
DICE.cpp
#define LL long long #include <iostream> #include <algorithm> #include <sstream> #include <cstring> #include <sstream> using namespace std; const LL INF = 1000000000001; LL dp[100005], a[100005]; int heap[100005], pos[100005], trace[100005], path[100005], h; int n, k; void add (int i) { heap[++h] = i; pos[i] = h; int child = h, par = child/2; while (par) { if (dp[heap[par]] >= dp[i]) break; heap[child] = heap[par]; pos[heap[child]] = child; child = par; par /= 2; } heap[child] = i; pos[i] = child; } void update (int v) { dp[v] = -INF; int par = pos[v], child = par*2, p; while (child <= h) { if ((child + 1 <= h) && (dp[heap[child + 1]] >= dp[heap[child]])) p = child + 1; else p = child; if (dp[v] >= dp[heap[p]]) break; heap[par] = heap[p]; pos[heap[par]] = par; par = p; child = par*2; } heap[par] = v; pos[v] = par; } int main() { //freopen("D:\\test.txt", "r", stdin); //freopen("D:\\test2.txt", "w", stdout); scanf("%d%d", &n, &k); for (int i = 1; i <= n; ++i) scanf("%lli", &a[i]); add(0); int c = 0, s = 0, best = 0; LL ans = 0; for (int i = 1; i <= n; ++i) { if (i > k) update(s++); dp[i] = a[i] + dp[heap[1]]; if (ans < dp[i]) { best = i; ans = dp[best]; } trace[i] = heap[1]; add(i); } printf("%lli\n", ans); while (best) { path[++c] = best; best = trace[best]; } printf("%d %d ", c + (c != 0), 0); for (int i = c; i >= 1; --i) printf("%d ", path[i]); }
692b5a09f692179fa17891d01e26528e0d952334
4bcec17aa72f341a43177d05f1c18c53ebacbdc9
/AGECYMO/src/mainwindow.hpp
fae1c123ddd9223ca9bb94a93c46ca6eee891aba
[]
no_license
BackupTheBerlios/opale
db25e50692277c3d434db6df3328b39694529774
73ab7ab6d39e3ae325c4d1fac883b2426a36ee65
refs/heads/master
2021-01-13T02:31:40.158148
2005-01-31T22:02:38
2005-01-31T22:02:38
40,077,528
0
0
null
null
null
null
UTF-8
C++
false
false
8,059
hpp
mainwindow.hpp
#ifndef CLASS_MAINWINDOW #define CLASS_MAINWINDOW //qt stuff #include <qdict.h> #include <qstringlist.h> #include <qkeysequence.h> #include <qaction.h> #include <qmenubar.h> #include <qpopupmenu.h> #include <qmessagebox.h> #include <qmainwindow.h> #include <qapplication.h> #include <qsignalmapper.h> #include <qiconset.h> #include <qpixmap.h> #include <qtoolbar.h> #include <qstatusbar.h> #include <qlabel.h> #include <qtoolbutton.h> #include <qmultilineedit.h> //Our stuff #include "matrix.hpp" #include "abscurve.hpp" #include "curves.hpp" #include "eventswindow.hpp" #include "pluginmanager.hpp" #include "canvas2d.hpp" #include "canvas3d.hpp" #include "window3d.hpp" #include "controlpanel.hpp" #include "helpwindow.hpp" class PluginManager; class CylinderGenerator; class Canvas2D; class Canvas3D; class Window3D; const QString INPUT_COMPONENT_SEPARATOR = "/"; const QString FILE_KEY = "&File"; const QString HELP_KEY = "&Help"; const QString CYLINDER_KEY = "&Cylinder"; const QString TOOLS_KEY = "&Tools"; const QString MANUAL_DIR = "./manual/"; const QString MANUAL_INDEX= "index.html"; const QString IMAGES_DIR = "../images/"; const QString QUIT_IMAGE = "exit.png"; const QString CYLINDER_IMAGE = "cylinder.png"; /****************************************************** * derived from QMainWindow. principle window of the modeler * ******************************************************/ class MainWindow : public QMainWindow { Q_OBJECT private: const char* TITLE; /**the title*/ int _screen_w; /**screen's width*/ int _screen_h; /**screen's height*/ Window3D* _w3d; /**the 3d window*/ Window3D* _wChemin; /**the way window*/ Window3D* _wSection; /**the section window*/ Window3D* _wProfil; /**the profil window*/ ControlPanel* _controlPanel; /**the control panel*/ QDict<QPopupMenu> _menus; /**the popupMenuBar*/ QTime _chronometer; /**chrono for generation*/ QLabel* _labelStatus; /**this is the label used for the status bar*/ PluginManager* _pluginManager; /**the plugin manager*/ QToolBar* _toolBar; /**the tool bar*/ CylinderGenerator* _cylGenerator; /**in order to generate the cylinder*/ HelpWindow* _helpFrame; /**the helpWindow*/ EventsWindow* _comments; /**event window for log*/ public: /************************************************************** * * MainWindow constructor * @param screen_w the width of the screen * @param screen_h the height of the screnn * @param w_app the width of the window * @param h_app the height of the window * @param x_app the x position of the window * @param y_app the y position of the window * *************************************************************/ MainWindow( int screen_w, int screen_h, int w_app = 50, int h_app = 70, int x_app = 10, int y_app = 0, QWidget* parent = 0, const char* name = 0); /************************************************************** * * MainWindow destructor * *************************************************************/ ~MainWindow(); /************************************************************** * This is the main method which update the GUI * according to the plugin's data * @param pluginID the id of the plugin * @param type the type of the plugin * @param infos plugin informations * *************************************************************/ void updateGUIWithPluginData(const QString & pluginID, PluginType type, std::vector<MenuAddOn *> & infos); /************************************************************** * * get the canvas3D * @return the 3d canvas * *************************************************************/ Canvas3D& getCanvas3D(); /************************************************************** * * get the wayCanvas * @return the wayCanvas * *************************************************************/ Canvas2D& getCheminCanvas(); /************************************************************** * * get the profilCanvas * @return the profilCanvas * *************************************************************/ Canvas2D& getProfilCanvas(); /************************************************************** * * get the sectionCanvas * @return the sectionCanvas * *************************************************************/ Canvas2D& getSectionCanvas(); /************************************************************** * * get the eventWindow * @return the eventWindow * *************************************************************/ EventsWindow& getEventsWindow(); /************************************************************** * * get the model * @return the model (all faces) * *************************************************************/ Faces& model(); /************************************************************** * * set the model * @param faces the model * *************************************************************/ void setModel(Faces & faces); /************************************************************** * * display time indications * @param operation the name of the operation * @param timeInMilliSeconds the operation time * *************************************************************/ void displayTimeStatus( const char* operation, int timeInMilliSeconds); private: /************************************************************** * * init the frames * @param screen_height the height of the screen * @param screen_width the width of the screen * @param application_width the width of the application * *************************************************************/ void initViewFrames(int screen_height, int frame_width, int application_width = 50); /************************************************************** * * update the view frame * *************************************************************/ void updateViewFramesPosition(); /************************************************************** * * add the static menu bars * *************************************************************/ void addStaticMenuBarContent(); /************************************************************** * * adjust the section via a scale * @param ptsSection the section's points * @param scaleFactor the scale * *************************************************************/ void adjustSection(std::vector<Point3D> & ptsSection, double scaleFactor); /************************************************************** * * adjust the way via a scale * @param ptsChemin the way's points * @param scaleFactor the scale * *************************************************************/ void adjustWay(std::vector<Point3D> & ptsChemin, double scaleFactor); protected: /************************************************************** * * manage moce events * @param event the event * *************************************************************/ virtual void moveEvent(QMoveEvent* event); public slots: /************************************************************** * * display about window * *************************************************************/ void about(); /************************************************************** * * display manual window * *************************************************************/ void manual(); /************************************************************** * * generate the cylinder * *************************************************************/ void generateCylinder(); // void validation(); }; #endif
fb130d3ec543a2634e2eff16c821075931186c71
7e327b39be61b1d2494227a6e936a12bedc15b70
/1080 - Binary Simulation.cpp
6d27e24c65b88f661a2bac202f44a036acc13b81
[]
no_license
abinashkg/LightOJ
6f237581c77ce0139668ffc547bade9398c9c12d
5f03096ba5c64ebe7b6bdb9572a3a2844718fa60
refs/heads/master
2020-12-24T11:46:26.006012
2016-11-06T19:26:37
2016-11-06T19:26:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,831
cpp
1080 - Binary Simulation.cpp
//Abinash Ghosh(Om) #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <cstring> #include <climits> #include <iostream> #include <iomanip> #include <vector> #include <list> #include <stack> #include <queue> #include <map> #include <set> #include <string> #include <utility> #include <sstream> #include <algorithm> using namespace std; #define PI acos(-1.0) #define MAX 10000007 #define EPS 1e-9 #define mem(a,b) memset(a,b,sizeof(a)) #define gcd(a,b) __gcd(a,b) #define pb push_back #define mp make_pair #define x first #define y second #define Sort(x) sort(x.begin(),x.end()) #define FOR(i, b, e) for(int i = b; i <= e; i++) #define pr(x) cout<<x<<"\n" #define pr2(x,y) cout<<x<<" "<<y<<"\n" #define pr3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"; #define READ(f) freopen(f, "r", stdin) #define WRITE(f) freopen(f, "w", stdout) typedef long long ll; typedef pair <int, int> pii; typedef pair <double , double> pdd; typedef pair <ll , ll > pll; typedef vector <int> vi; typedef vector <pii> vpii; typedef vector <ll > vl; //int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction //int dx[]={1,1,0,-1,-1,-1,0,1}; //int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction //int dx[]={2,1,-1,-2,-2,-1,1,2}; //int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction // scanf("%d",&n); char s[100005]; int a[100005]; int tree[100005],l; int query(int idx) { int sum=0; while(idx>0) { sum+=tree[idx]; idx-=idx&(-idx); } return sum; } void update(int idx,int x) { while(idx<=l) { tree[idx]+=x; idx+=idx&(-idx); } } int main() { //READ("in.txt"); //WRITE("out.txt"); int T,q,c,d,x; scanf("%d",&T); FOR(t,1,T) { printf("Case %d:\n",t); scanf("%s",s+1); mem(tree,0); l=strlen(s+1); FOR(i,1,l) { if(s[i]=='0')a[i]=0; else a[i]=1; } //pr(s+1); scanf("%d",&q); //pr(q); char ch; FOR(i,1,q) { getchar(); scanf("%c",&ch); if(ch=='I') { scanf("%d %d",&c,&d); update(d+1,-1); update(c,1); // FOR(k,1,l) // { // int ans=query(k); // if(k!=1)ans-=query(k-1); // printf("%d ",ans); // } } else { scanf("%d",&x); int ans=query(x); printf("%d\n",a[x]^(ans%2)); } } } return 0; } /* 2 0011001100 6 I 1 10 I 2 7 Q 2 Q 1 Q 7 Q 5 1011110111 6 I 1 10 I 2 7 Q 2 Q 1 Q 7 Q 5 */
4bafabedd62a91e3f9f35255a0036edf7f8904c7
8e8ecad0f6cd77cfe9735608c75469c657ff5b04
/潘健/4-11/4-11.cpp
bf7d96457a13fb540a7b9e70e9e839679aa699a4
[]
no_license
panjian1998/c----
1889cd3fd939e3779d6b399bf464d0922193aeab
bf57b36499b50503ab2fd099ccef187f4f82ef92
refs/heads/master
2020-03-21T00:35:24.228626
2018-06-19T14:06:46
2018-06-19T14:06:46
137,900,068
0
0
null
null
null
null
GB18030
C++
false
false
402
cpp
4-11.cpp
#include <stdio.h> int main() { int a[4],i,j; for(i=0; i <4; i ++) { printf("请输入第%d个数字: \n",i+1); scanf("%d",&a[i]); } for(i= 0; i < 3; i++) for(j= i+1; j< 4; j++) { int t; if(a[i]>a[j]) { t= a[i]; a[i]= a[j]; a[j]= t; } } printf("这四个数字按由小到大排列的顺序为:"); for(i= 0; i < 4; i++) printf("%d,",a[i]); }
fb8aa38efc7656e94910e670b54038040f60467d
6220c1ced65a8ce035363a135aed1e0c94f4c62d
/ARRAY/DAY 4/Key Pair.cpp
9e63ad47f85c3fb6c049e0d5a510d6cc693716b0
[]
no_license
kashyap99saksham/2-Month-Course
e47cf4515c18a5bb2d7533aef8d1ff99abd7d631
88f11417172357feaa3a8b72ae4bf7f0eb0c8bda
refs/heads/master
2021-05-20T02:28:27.575572
2020-09-22T20:32:57
2020-09-22T20:32:57
252,147,579
1
1
null
null
null
null
UTF-8
C++
false
false
810
cpp
Key Pair.cpp
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int size,sum; cin>>size>>sum; unordered_map <int,int> m; for (int i = 0; i < size; i++) { int val; cin>>val; m[val]++; } bool flag = false; for(auto i : m) { int dif = sum - i.first; if(dif == i.first) { if(i.second == 1) { continue; } } if(m.find(dif) != m.end()) { flag = true; cout<<"Yes"; break; } } if(flag == false) { cout<<"No"; } cout<<endl; } }
2e7af051d2050b6fb63e485d934ab84e4ecfaf9c
0f85357a688164b945bc94df77e34b7cbf7c0e4e
/ss2/src/cap.cpp
93d8bd069ccd8f02618dd63d7d06680a0f6433df
[]
no_license
aglab2/sm64asm
185e43fe3789eda2b245c5f0d3d82ff69323824a
5b2ed8f1c98d3fcdf4aafe1a0559dd56f0f6b5d7
refs/heads/master
2023-01-12T12:56:27.991713
2022-12-27T01:59:11
2022-12-27T01:59:11
122,328,541
8
2
null
null
null
null
UTF-8
C++
false
false
223
cpp
cap.cpp
extern "C" { #include "types.h" #include "game/sound_init.h" #include "game/print.h" #include "game/area.h" } void onCapStep(u16 seqArgs) { if (0x1f != gCurrLevelNum) play_cap_music(seqArgs); }
8d7035e9fb43b07ae4c7941457205c5bba1a00f1
663f36cfff3bfaf9ad64bba430e648b0dadc0f99
/platform/gucefGUI/include/gucefGUI_CFileSystemDialog.h
9ccc6aeabe8ac8d0da8ada2ba811a58dd2e82d0d
[ "Apache-2.0" ]
permissive
LiberatorUSA/GUCEF
b579a530ac40478e8d92d8c1688dce71634ec004
2f24399949bc2b2eb20b3f445100dd3e141fe6d5
refs/heads/master
2023-09-03T18:05:25.190918
2023-09-02T17:23:59
2023-09-02T17:23:59
24,012,676
9
15
Apache-2.0
2021-07-04T04:53:42
2014-09-14T03:30:46
C++
UTF-8
C++
false
false
6,493
h
gucefGUI_CFileSystemDialog.h
/* * guceGUI: GUCE module providing GUI functionality * Copyright (C) 2002 - 2007. Dinand Vanvelzen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef GUCEF_GUI_CFILESYSTEMDIALOG_H #define GUCEF_GUI_CFILESYSTEMDIALOG_H /*-------------------------------------------------------------------------// // // // INCLUDES // // // //-------------------------------------------------------------------------*/ #ifndef GUCEF_GUI_CIFILESYSTEMINFOPROVIDER_H #include "gucefGUI_CIFileSystemInfoProvider.h" #define GUCEF_GUI_CIFILESYSTEMINFOPROVIDER_H #endif /* GUCEF_GUI_CIFILESYSTEMINFOPROVIDER_H ? */ #ifndef GUCEF_GUI_CWINDOW_H #include "gucefGUI_CWindow.h" #define GUCEF_GUI_CWINDOW_H #endif /* GUCEF_GUI_CWINDOW_H ? */ #ifndef GUCEF_GUI_CBUTTON_H #include "gucefGUI_CButton.h" #define GUCEF_GUI_CBUTTON_H #endif /* GUCEF_GUI_CBUTTON_H ? */ #ifndef GUCEF_GUI_CCOMBOBOX_H #include "gucefGUI_CCombobox.h" #define GUCEF_GUI_CCOMBOBOX_H #endif /* GUCEF_GUI_CCOMBOBOX_H ? */ #ifndef GUCEF_GUI_CEDITBOX_H #include "gucefGUI_CEditbox.h" #define GUCEF_GUI_CEDITBOX_H #endif /* GUCEF_GUI_CEDITBOX_H ? */ #ifndef GUCEF_GUI_CGRIDVIEW_H #include "gucefGUI_CGridView.h" #define GUCEF_GUI_CGRIDVIEW_H #endif /* GUCEF_GUI_CGRIDVIEW_H ? */ #ifndef GUCEF_GUI_CFORMEX_H #include "gucefGUI_CFormEx.h" #define GUCEF_GUI_CFORMEX_H #endif /* GUCEF_GUI_CFORMEX_H ? */ /*-------------------------------------------------------------------------// // // // NAMESPACE // // // //-------------------------------------------------------------------------*/ namespace GUCEF { namespace GUI { /*-------------------------------------------------------------------------// // // // CLASSES // // // //-------------------------------------------------------------------------*/ class GUCEF_GUI_PUBLIC_CPP CFileSystemDialog : public CFormEx { public: static const CORE::CEvent OkPressedEvent; static const CORE::CEvent CancelPressedEvent; static const CORE::CEvent FilterChangedEvent; static const CORE::CEvent SelectionChangedEvent; static void RegisterEvents( void ); public: typedef std::vector< CString > TStringVector; CFileSystemDialog( void ); virtual ~CFileSystemDialog(); virtual bool ShowModal( void ); CWindow* GetWindow( void ); CButton* GetOkButton( void ); CButton* GetCancelButton( void ); CGridView* GetFileSystemGridView( void ); CCombobox* GetFilterCombobox( void ); CEditbox* GetSelectionEditbox( void ); virtual void RefreshView( void ); virtual void SetAllowMultiSelect( const bool allow ); virtual bool GetAllowMultiSelect( void ) const; virtual void SetSelectedItems( const TStringVector& item ); virtual const TStringVector& GetSelectedItems( void ) const; virtual void SetItemDisplayTypes( const bool showDirs , const bool showFiles ); virtual void SetAllowedSelection( const bool allowDirSelect , const bool allowFileSelect ); virtual void SetFileSystemInfoProvider( CIFileSystemInfoProvider* provider ); virtual void SetCurrentPath( const CString& path ); virtual const CString& GetCurrentPath( void ) const; virtual bool IsItemADirectory( const CString& name ) const; protected: virtual void OnPreLayoutLoad( void ); virtual void OnPostLayoutLoad( void ); private: CFileSystemDialog( const CFileSystemDialog& src ); CFileSystemDialog& operator=( const CFileSystemDialog& src ); private: typedef std::set< CString > TStringSet; CWindow* m_window; CButton* m_okButton; CButton* m_cancelButton; CGridView* m_fsGridView; CCombobox* m_filterCombobox; CEditbox* m_selectionEditbox; }; /*-------------------------------------------------------------------------// // // // NAMESPACE // // // //-------------------------------------------------------------------------*/ } /* namespace GUI */ } /* namespace GUCEF */ /*-------------------------------------------------------------------------*/ #endif /* GUCEF_GUI_CFILESYSTEMDIALOG_H ? */ /*-------------------------------------------------------------------------// // // // Info & Changes // // // //-------------------------------------------------------------------------// - 05-09-2007 : - Designed and implemented this class. -----------------------------------------------------------------------------*/
899953847d9cc91ece05f34c5f68906bb4fdd851
4021cc20733c8ead5c235d1f89e6a95ef1cf7386
/campion.edu/grafxy/grafxy.cpp
e64a9e929ec32ad62c5eef0073a87b8498935b57
[]
no_license
MicuEmerson/AlgorithmicProblems
9462ca439f2c3b8dcf5bfccf5e3f061b3e0ff645
918a52853dd219ba315d1cb4a620cf85ed73b4fd
refs/heads/master
2020-12-24T11:46:37.771635
2016-12-23T18:14:30
2016-12-23T18:14:30
73,013,087
2
0
null
null
null
null
UTF-8
C++
false
false
912
cpp
grafxy.cpp
#include <stdio.h> #include <vector> using namespace std; FILE *fi, *fo; int N,M,i,a,b,varf; vector <int> V[100001]; vector <int> :: iterator it; int X[100001],nX; int Q[100001],p,u; int VIZ[100001]; int nY,Y; int main() { fi=fopen("grafxy.in","r"); fo=fopen("grafxy.out","w"); fscanf(fi,"%d%d",&N,&M); for (i=1;i<=M;i++) { fscanf(fi,"%d%d",&a,&b); V[a].push_back(b); V[b].push_back(a); } fscanf(fi,"%d",&nX); for (i=1;i<=nX;i++) fscanf(fi,"%d",&X[i]); p=1; u=0; fscanf(fi,"%d",&nY); for (i=1;i<=nY;i++) { fscanf(fi,"%d",&Y); VIZ[Y]=1; u++; Q[u]=Y; } while (p<=u) { // vecinii nevizitati ai lui Q[p] se depun la sfarsitul lui Q varf=Q[p]; for (it=V[varf].begin();it!=V[varf].end();it++) if (VIZ[*it]==0) { VIZ[*it]=1+VIZ[varf]; u++; Q[u]=(*it); } p++; } for (i=1;i<=nX;i++) fprintf(fo,"%d\n",VIZ[X[i]]-1); fclose(fi); fclose(fo); return 0; }
12d0b37b2adf54e0ae9e554daa2c4aa75bc16f16
0c2aa86c1c138faf1029612b8dc18e82dcb9b4eb
/enemy.h
33687a4db11686f821779d7a6377807252532790
[]
no_license
andyma419/Agame
6dc3247229d494624db2815297331d9183da3c32
1fa33527dc7385e3f397915a9fe6eda1c77145ba
refs/heads/master
2016-09-05T10:11:46.648963
2013-03-27T22:13:18
2013-03-27T22:13:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
96
h
enemy.h
#ifndef ENEMY_H #define ENEMY_H #include "hero.h" class Enemy:public Hero{ }; #endif
f0106ce023e6a70c52947317d09d5b4126268874
b68809c70404fb173ff33d5466cef5f316558e54
/711RayTracer/src/Sphere.cpp
54ab9d16f81a17419033f0c9649c20acc3809fe0
[ "Zlib" ]
permissive
kmgreg/711RayTracer
09dec14f5151b13dccc6e40095e46e13a1ff7eab
211d601d6d525c8c267df9033ad92b9f6a5ea461
refs/heads/master
2020-04-18T11:18:20.185222
2019-06-25T15:24:06
2019-06-25T15:24:06
167,495,580
0
0
null
null
null
null
UTF-8
C++
false
false
1,185
cpp
Sphere.cpp
#include "Sphere.h" #include "Shape.h" #include <cmath> #include <algorithm> using namespace Eigen; Sphere::Sphere(float r, Vector3f loc) { Shape(); radius = r; center = loc; color << 0.3, 0.0, 0.5; } Sphere::~Sphere() { //dtor } bool Sphere::checkcollision(Ray * tocheck, float& dist){ //Scratchapixel version (thank you!) Vector3f L = tocheck->getpos() - center; float a = tocheck->getdir().dot(tocheck->getdir()); float b = 2 * tocheck->getdir().dot(L); float c = L.dot(L) - (radius * radius); float disc = b*b - (4 * a * c); if (disc < 0) return false; disc = std::sqrt(disc); float t1 = (-b + disc) / (2 * a); float t2 = (-b - disc) / (2 * a); if (t1 > t2) std::swap(t1,t2); if (t1 < 0){ t1 = t2; if (t1 < 0) return false; } dist = t1; return true; } Shape * Sphere::tform(Matrix4f touse){ Vector4f n; n << center, 1.0; n = touse * n; Vector3f vec; vec << n[0], n[1], n[2]; vec.normalize(); Sphere * td = new Sphere(radius, vec); return td; } Vector3f Sphere::getnorm(Vector3f hitp){ return hitp - this->center; }
31fb3f0f3672b56621a0a2c575bea49920c16a51
350bef364f4852ae428e6e7e6b0e2ed1b31e1bfd
/codes_book_onlinegameserver/05_NpcServer/Player.cpp
07f718de86f46374863db3f437fc1ed882eac767
[ "MIT" ]
permissive
true-bear/cpp_server_study_projects_Pub
224e9b1c11dcb2345ae080835abd369d2ada564e
070802570442e6ad91b7dc17f6d3685330de9eed
refs/heads/master
2020-05-03T12:40:29.924827
2019-03-30T09:38:01
2019-03-30T09:38:01
null
0
0
null
null
null
null
UHC
C++
false
false
314
cpp
Player.cpp
#include "StdAfx.h" #include ".\cplayer.h" cPlayer::cPlayer(void) { srand( GetTickCount() ); Init(); } cPlayer::~cPlayer(void) { } //변수를 초기화 시킨다. void cPlayer::Init() { m_dwPKey = 0; m_bIsDead = false; m_dwPos = 0; //플레이어 위치 m_byArea = 0xFF; }
eef1f6c42e4ef2fb8e8c549346648b9e8c7d2935
30bdd8ab897e056f0fb2f9937dcf2f608c1fd06a
/DP/749.cpp
dfc21c831a0ac93a05554a0b738bc49e251c763d
[]
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
629
cpp
749.cpp
#include<bits/stdc++.h> using namespace std; long long n; long long a[200],s[200],cnt=0; long long i,j,k,temp=-1,sum=0; long long pre=0,curr=0,tr=0; int main(){ cin >> n; for(i=1;i<=n;i++){ cin >> a[i]; sum+=a[i]; s[i]=sum; } s[n+1]=s[n]; for(i=1;i<=n;i++){ pre=s[i-1]; for(j=i;j<=n;j++){ curr=j-i+1; tr=s[j]-s[i-1]; if(temp < (curr-tr+s[n+1]-s[j]+s[i-1])){ temp=curr-tr+s[n+1]-s[j]+s[i-1]; } } } cout << temp; return 0; }
83ae7ecfa7b064913acfa8a1827a71d07314bdd9
059d13adb54bd33703aac40cce9a1f386e9e94d0
/source/core/oofxml.cpp
db62364d2390f9791748a867bf203602e30287b1
[]
no_license
AndyDentFree/oofile
9e5bf44fc927db891f8faabbf05ab3167778ec48
c30de14a25c4e41f2908d4f71ca51c46d109cc89
refs/heads/master
2020-04-06T04:03:50.487740
2012-03-20T06:01:42
2012-03-20T06:01:42
33,068,851
1
0
null
null
null
null
UTF-8
C++
false
false
8,665
cpp
oofxml.cpp
// COPYRIGHT 1999 A.D. Software, All rights reserved // support classes for XML output including // identifier generator class // Andy's disclaimer: // this stuff was written primarily for a local project and under budget // constraints that prevented efficiency or flexibility being considered // in particular, I'd like more ease of efficiently creating tags! #ifndef H_OOFXML #include "oofxml.h" #endif #ifndef _CTYPE_H #include <ctype.h> #endif // ------------------------------------------------------- // o o f I D f a c t o r y // ------------------------------------------------------- oofIDfactory::oofIDfactory(char theSeparator,int indentDepth): mLevels(1,10,10), // default value 1, don't think reports will go much beyond 10 levels mCurrentLevel(0), mIndentSize(indentDepth), mSeparator(theSeparator) { } void oofIDfactory::reset() { mCurrentLevel = 0; mLevels.deleteAllCells(); } void oofIDfactory::leaveLevel() { mCurrentLevel--; assert (mCurrentLevel >= 0); } oofString oofIDfactory::getIDstring() { // could optimise by hanging onto the last string for each level above current // and resetting when we leave a level, so aren't sprintf'ing so many times char scrapString[40]; int index; mIDString = ""; for(index=0;index<(mCurrentLevel+1);index++){ sprintf(scrapString,"%d",mLevels[index]); mIDString += scrapString; if(index != mCurrentLevel){ mIDString += mSeparator; } } return mIDString; } oofString oofIDfactory::getQuotedIDstring() { // see getIDstring for optimisation comments char scrapString[40]; mIDString = "'"; for(int index=0;index<(mCurrentLevel+1);index++){ sprintf(scrapString,"%d",mLevels[index]); mIDString += scrapString; if(index != mCurrentLevel){ mIDString += mSeparator; } } mIDString += "'"; return mIDString; } // ------------------------------------------------------- // o o f T a g M a k e r // ------------------------------------------------------- const char* oofTagMaker::kEncodedNameOptPrefix = "Z-_"; const short oofTagMaker::kEncodedNameOptPrefixLen = strlen(kEncodedNameOptPrefix); oofString oofTagMaker::makeOpeningTag(const char* tag, const char* indentString, const char* idString, const char* otherAttributes, bool emptyTag) { oofString result = indentString; result += '<'; result += tag; if (idString && (strlen(idString)>0)) { result += " ID='"; result += idString; result += '\''; } if (otherAttributes && (strlen(otherAttributes)>0)) { result += ' '; result += otherAttributes; } if (emptyTag) result += "/>\n"; else result += '>'; return result; } oofString oofTagMaker::makeClosingTag(const char *tag, const char* indentString) { oofString result = indentString; result += "</"; result += tag; result += ">\n"; return result; } oofString oofTagMaker::makeSimpleBoundedElement(const char* body, const char* tag, const char* indentString, const char* idString, const char* otherAttributes, bool /*emptyTag*/) { oofString ret = oofTagMaker::makeOpeningTag(tag, indentString, idString, otherAttributes); ret += oofString::encodeEntity(body); ret += oofTagMaker::makeClosingTag(tag); return ret; } oofString oofTagMaker::encodeName(const oofString& inStr) { // encode all chars apart from alphanumeric // spaces become underscore (special case for common letter) // hyphen becomes double-hyphen // all others become hyphen-octal // kEncodedNameOptPrefix = "Z-_" // recognisable string to drop on parsing (Z-_ in original would become Z---055) // may not start with XML in any mixture of cases or leading non-letter, so add kEncodedNameOptPrefix const bool startsWithXML = (inStr.length()>=3) && (inStr[0]=='x' || inStr[0]=='X') && (inStr[1]=='m' || inStr[1]=='M') && (inStr[2]=='l' || inStr[2]=='L') ; if (inStr.isAlphaNumeric()) { if (startsWithXML || isdigit(inStr[0])) return oofString(kEncodedNameOptPrefix, inStr); else return inStr; //*** trivial exit - no conversion, including empty string } oofString ret; const unsigned long inLen = inStr.length(); const char* inChars = inStr; for (unsigned long i=0; i<inLen; i++) { const char ch = inChars[i]; if (ch==' ') ret += '_'; else if (ch=='-') ret += "--"; else if (isalnum(ch)) ret += ch; else { char octalNum[5]; const unsigned short asShort = ch; sprintf(octalNum, "-%03ho", asShort); ret += octalNum; } } if (startsWithXML || !isalpha(ret[0])) return oofString(kEncodedNameOptPrefix, ret); else return ret; } oofString oofTagMaker::decodeName(const oofString& inStr) { // see comments at top of decodeName if (inStr.startsWith(kEncodedNameOptPrefix)) return decodeName(inStr.subString(kEncodedNameOptPrefixLen) ); // recursively process after prefix // have to strip the prefix before processing further as it would be mangled by logic below if (inStr.isAlphaNumeric()) return inStr; //*** trivial exit - no conversion, including empty string oofString ret; const unsigned long inLen = inStr.length(); const char* inChars = inStr; for (unsigned long i=0; i<inLen; i++) { const char ch = inChars[i]; if (ch=='_') ret += ' '; else if (ch=='-') { i++; // skip to next char assert(i<inLen); // can't end with single hyphen if (inChars[i]=='-') { ret += '-'; // hyphen escape char mapped as double hyphen } else { assert(i<(inLen-2)); // must have 3 char octal code after hyphen if not double hyphen char octalNum[4]; octalNum[0] = inChars[i]; i++; octalNum[1] = inChars[i]; i++; octalNum[2] = inChars[i]; octalNum[3]='\0'; unsigned short toShort; sscanf(octalNum, "%3ho", &toShort); ret += (char) toShort; } } else { assert (isalnum(ch)); ret += ch; } } return ret; } // ------------------------------------------------------- // o o f X M L w r i t e r // ------------------------------------------------------- oofXMLwriter::oofXMLwriter() : mStr(xmlSimpleVersionString()) { } oofXMLwriter::~oofXMLwriter() { const int numStrings = mElementNames.count(); for (int i=0; i<numStrings; i++) { oofString* theString = (oofString*) mElementNames.value(i); // safe downcast delete theString; } } const char* oofXMLwriter::xmlSimpleVersionString() { return "<?xml version='1.0' standalone='yes'?>\n"; } /** avoid creating temp string if not necessary by using ternary operator in calls */ void oofXMLwriter::startElement(const char* inName, const char* otherAttributes, bool withID) { const int theLevel = mIDlevels.currentLevel(); assert(theLevel>=0); oofString* elementName = (oofString*) mElementNames.value(theLevel); // safe downcast if (!elementName) { elementName = new oofString(inName); mElementNames[theLevel] = (long)elementName; } else *elementName = inName; mStr += oofTagMaker::makeOpeningTag( inName, theLevel>0 ? mIDlevels.getIndentString().chars() : NULL, withID ? mIDlevels.getIDstring().chars() : NULL, otherAttributes ); mStr += '\n'; mIDlevels.enterLevel(); } void oofXMLwriter::endElement() { mIDlevels.leaveLevel(); const int theLevel = mIDlevels.currentLevel(); assert(theLevel>=0); oofString* elementName = (oofString*) mElementNames.value(theLevel); // safe downcast assert(elementName); mStr += oofTagMaker::makeClosingTag( elementName->chars(), mIDlevels.getIndentString() ); elementName->clear(); // wipe so know we left element // NOT YET IMPLEMENTED - something a bit more efficient for // massive yo-yoing as the above clear() deletes string body } void oofXMLwriter::addEmptyElement(const char* inName, const char* otherAttributes, bool withID) { const int theLevel = mIDlevels.currentLevel(); mStr += oofTagMaker::makeOpeningTag( inName, theLevel>0 ? mIDlevels.getIndentString().chars() : NULL, withID ? mIDlevels.getIDstring().chars() : NULL, otherAttributes, true // is empty ); } void oofXMLwriter::addSimpleElement(const char* inName, const char* inBody, const char* otherAttributes, bool withID) { const int theLevel = mIDlevels.currentLevel(); assert(theLevel>=0); mStr += oofTagMaker::makeSimpleBoundedElement( inBody, inName, theLevel>0 ? mIDlevels.getIndentString().chars() : NULL, withID ? mIDlevels.getIDstring().chars() : NULL, otherAttributes ); } bool oofXMLwriter::topLevelClosed() const { const int theLevel = mIDlevels.currentLevel(); if (theLevel!=0) return false; const oofString* theString = (oofString*) mElementNames.value(0); // safe downcast const bool hasOpenElement = (theString && !theString->isEmpty()); return !hasOpenElement; }
398fcb5cd88943e7ff60f176b87e7ffa443a52d7
2587060067657590529c0812ac821fa98a9640dd
/ui_console.h
b4c42a061474131bb918c3c35cbcb20fe9319132
[]
no_license
shadowcat219/RRPR
d0a3358b5c671e446c8e1fd537708812569ce3a1
0eb5226dce0a6c2a0ce3f9209b22de61ee11bd0f
refs/heads/master
2021-01-13T15:18:17.951655
2016-12-30T04:17:22
2016-12-30T04:17:22
76,423,380
0
0
null
null
null
null
UTF-8
C++
false
false
333
h
ui_console.h
#pragma once #define UI_CONSOLE #include <stdio.h> #include <iostream> #include <string> #include "robo_control.h" using namespace std; class ui_console { private: int select_bit; int emul_select; int HW_select; char quit_bit; robo_control cmd; public: void welcomeSplash(); void emulatorSplash(); void quitSplash(); };
63aab26ae35e672099bbcab46b702dbf3a7662a6
8e2c6a5f242fc1c531d1598e302f0b98ad194c9d
/statechart/internal/function_dispatcher_builtin_test.cc
302c6894101db468072a91d4c197c6e01d2729a7
[ "Apache-2.0" ]
permissive
kenvay/statechart
6ab35ed234a2f765a1f387ccda5811d033042b30
d283cefab5a051a91c21be46d97bc18407fd7628
refs/heads/master
2022-03-15T19:24:46.590951
2019-12-10T01:34:08
2019-12-10T01:34:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,133
cc
function_dispatcher_builtin_test.cc
// Copyright 2018 The StateChart Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "statechart/internal/function_dispatcher_builtin.h" #include <gflags/gflags.h> #include <glog/logging.h> #include <gtest/gtest.h> #include "statechart/platform/types.h" #include "include/json/json.h" namespace state_chart { namespace builtin { namespace { TEST(FunctionDispatcherBuiltins, ContainsKey) { Json::Reader reader; Json::Value value; CHECK(reader.parse(R"({ "K3" : { "lower" : "l" } } )", value)); EXPECT_FALSE(ContainsKey(value, "K")); EXPECT_TRUE(ContainsKey(value, "K3")); // Specifying a path as key does not work. EXPECT_FALSE(ContainsKey(value, "K3.lower")); } TEST(FunctionDispatcherBuiltins, FindFirstWithKeyValue) { Json::Reader reader; Json::Value value; CHECK(reader.parse(R"([ { "K1" : "V1" } , { "K2" : "V2", "foo" : "bar" }, { "K2" : "V2"}, { "K3" : { "lower" : "l" }} ])", value)); EXPECT_EQ(-1, FindFirstWithKeyValue(value, "K", "V1")); EXPECT_EQ(-1, FindFirstWithKeyValue(value, "K1", "")); EXPECT_EQ(0, FindFirstWithKeyValue(value, "K1", "V1")); EXPECT_EQ(1, FindFirstWithKeyValue(value, "K2", "V2")); Json::Value lower_value; CHECK(reader.parse(R"({ "lower" : "l" })", lower_value)); EXPECT_EQ(3, FindFirstWithKeyValue(value, "K3", lower_value)); // Specifying a path as key does not work. EXPECT_EQ(-1, FindFirstWithKeyValue(value, "K3.lower", "l")); } } // namespace } // namespace builtin } // namespace state_chart
72e9b33dcc03a65f4163be6c2e49f5ccbb921646
99f1550e0a3c2e21088e2ffc72bc5dadabb1188f
/ui/UICTRL/Src/Control/RichEdit/Helper/rehtmlencode.h
2a9aee382f94d8eda833c111e553c4baf47b1467
[]
no_license
flymolon/UI2017
0d0bb1c173e015e7fe26ada47358b4581f3b0e29
e7182b19d9227abe6d3f91600e85d13c85917e71
refs/heads/master
2020-04-11T01:42:49.336393
2017-02-12T04:15:19
2017-02-12T04:15:19
null
0
0
null
null
null
null
GB18030
C++
false
false
3,600
h
rehtmlencode.h
#pragma once #include "..\Ole\richeditolemgr.h" // re内容html编码,用于复制 namespace UI { // ole 剪粘板格式 UINT CF_HTML = ::RegisterClipboardFormat(_T("HTML Format")); class REHtmlEncode { public: REHtmlEncode(WindowlessRichEdit* pRE) { m_pRE = pRE; } void BeginEncode() { m_strText.append(TEXT("<DIV>\r\n")); } void EndEncode() { m_strText.append(TEXT("\r\n</DIV>")); } void AddText(LPCTSTR szText, int nLength) { if (szText) m_strText.append(szText); } void AddREOle(REOleBase* pOle) { CComBSTR bstr; if (SUCCEEDED(pOle->GetClipboardData(CF_HTML, &bstr))) { if (bstr && bstr.Length()) { m_strText.append(bstr); } } } void Add2DataObject(IDataObject* pDataObject) { if (!pDataObject) return; FORMATETC format = {0}; format.dwAspect = DVASPECT_CONTENT; format.cfFormat = CF_HTML; format.tymed = TYMED_HGLOBAL; STGMEDIUM medium = {0}; medium.tymed = TYMED_HGLOBAL; HGLOBAL hGlobal = GetHtmlData(CT2A(m_strText.c_str(), CP_UTF8)); medium.hGlobal = hGlobal; if (FAILED(pDataObject->SetData(&format, &medium, TRUE))) { GlobalFree(hGlobal); } } // CopyHtml() - Copies given HTML to the clipboard. // The HTML/BODY blanket is provided, so you only need to // call it like CallHtml("<b>This is a test</b>"); HGLOBAL GetHtmlData(char *html) { // Create temporary buffer for HTML header... char *buf = new char [400 + strlen(html)]; if(!buf) return NULL; // Create a template string for the HTML header... strcpy(buf, "Version:0.9\r\n" "StartHTML:00000000\r\n" "EndHTML:00000000\r\n" "StartFragment:00000000\r\n" "EndFragment:00000000\r\n" "<html><body>\r\n" "<!--StartFragment -->\r\n"); // Append the HTML... strcat(buf, html); strcat(buf, "\r\n"); // Finish up the HTML format... strcat(buf, "<!--EndFragment-->\r\n" "</body>\r\n" "</html>"); // Now go back, calculate all the lengths, and write out the // necessary header information. Note, wsprintf() truncates the // string when you overwrite it so you follow up with code to replace // the 0 appended at the end with a '\r'... char *ptr = strstr(buf, "StartHTML"); sprintf(ptr+10, "%08u", strstr(buf, "<html>") - buf); *(ptr+10+8) = '\r'; ptr = strstr(buf, "EndHTML"); sprintf(ptr+8, "%08u", strlen(buf)); *(ptr+8+8) = '\r'; ptr = strstr(buf, "StartFragment"); sprintf(ptr+14, "%08u", strstr(buf, "<!--StartFrag") - buf); *(ptr+14+8) = '\r'; ptr = strstr(buf, "EndFragment"); sprintf(ptr+12, "%08u", strstr(buf, "<!--EndFrag") - buf); *(ptr+12+8) = '\r'; // Allocate global memory for transfer... HGLOBAL hText = GlobalAlloc(GMEM_MOVEABLE |GMEM_DDESHARE, strlen(buf)+4); { // Put your string in the global memory... char *ptr = (char *)GlobalLock(hText); strcpy(ptr, buf); GlobalUnlock(hText); } // Clean up... delete [] buf; return hText; } private: String m_strText; WindowlessRichEdit* m_pRE; }; }
1fe2a5238b90b3801ea74b6ce004b913032d24b9
ccf2a87c614d7d1ecb2eda1b07ac054c0ffb3768
/mediatek/platform/mt6592/hardware/audio/include/AudioAfeReg.h
ea4c41ee67b5d93a321ae30a8c1680639cdc6cc0
[]
no_license
bq/aquaris-E10
e5a6c6a927f644e36ac1e9a0e60e3ef9fafb8609
86ca35f22a0ef104f6c7624de3bbf2e037b9e684
HEAD
2016-09-06T04:38:43.576246
2015-11-17T10:40:56
2015-11-17T10:40:56
28,911,849
4
11
null
null
null
null
UTF-8
C++
false
false
7,038
h
AudioAfeReg.h
#ifndef ANDROID_AUDIO_AFEREG_H #define ANDROID_AUDIO_AFEREG_H // AudioAfeReg only provide basic funciton to set register , // other function should be move to other module to control this class. #include <stdint.h> #include <sys/types.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <sched.h> #include <fcntl.h> #include "AudioType.h" #include "AudioDef.h" #include "AudioUtility.h" #include "AudioIoctl.h" //---------- register define ------------------------------------------------------------ #define AUDIO_TOP_CON0 (0x0000) #define AUDIO_TOP_CON1 (0x0004) #define AUDIO_TOP_CON2 (0x0008) #define AUDIO_TOP_CON3 (0x000c) #define AFE_DAC_CON0 (0x0010) #define AFE_DAC_CON1 (0x0014) #define AFE_I2S_CON (0x0018) #define AFE_CONN0 (0x0020) #define AFE_CONN1 (0x0024) #define AFE_CONN2 (0x0028) #define AFE_CONN3 (0x002c) #define AFE_CONN4 (0x0030) #define AFE_I2S_CON1 (0x0034) #define AFE_I2S_CON2 (0x0038) #define AFE_DL1_BASE (0x0040) #define AFE_DL1_CUR (0x0044) #define AFE_DL1_END (0x0048) #define AFE_I2S_CON3 (0x004c) #define AFE_DL2_BASE (0x0050) #define AFE_DL2_CUR (0x0054) #define AFE_DL2_END (0x0058) #define AFE_CONN_24BIT (0x006C) #define AFE_AWB_BASE (0x0070) #define AFE_AWB_CUR (0x0078) #define AFE_AWB_END (0x007c) #define AFE_VUL_BASE (0x0080) #define AFE_VUL_CUR (0x0088) #define AFE_VUL_END (0x008c) #define AFE_DAI_BASE (0x0090) #define AFE_DAI_CUR (0x0098) #define AFE_DAI_END (0x009c) #define AFE_MEMIF_MON0 (0x00D0) #define AFE_MEMIF_MON1 (0x00D4) #define AFE_MEMIF_MON2 (0x00D8) #define AFE_MEMIF_MON4 (0x00E0) #define AFE_ADDA_DL_SRC2_CON0 (0x00108) #define AFE_ADDA_DL_SRC2_CON1 (0x0010C) #define AFE_ADDA_UL_SRC_CON0 (0x00114) #define AFE_ADDA_UL_SRC_CON1 (0x00118) #define AFE_ADDA_TOP_CON0 (0x00120) #define AFE_ADDA_UL_DL_CON0 (0x00124) #define AFE_ADDA_SRC_DEBUG (0x0012C) #define AFE_ADDA_SRC_DEBUG_MON0 (0x00130) #define AFE_ADDA_SRC_DEBUG_MON1 (0x00134) #define AFE_ADDA_NEWIF_CFG0 (0x00138) #define AFE_ADDA_NEWIF_CFG1 (0x0013C) #define AFE_SIDETONE_DEBUG (0x01D0) #define AFE_SIDETONE_MON (0x01D4) #define AFE_SIDETONE_CON0 (0x01E0) #define AFE_SIDETONE_COEFF (0x01E4) #define AFE_SIDETONE_CON1 (0x01E8) #define AFE_SIDETONE_GAIN (0x01EC) #define AFE_SGEN_CON0 (0x01F0) #define AFE_TOP_CON0 (0x0200) #define AFE_PREDIS_CON0 (0x0260) #define AFE_PREDIS_CON1 (0x0264) #define AFE_MOD_PCM_BASE (0x0330) #define AFE_MOD_PCM_END (0x0338) #define AFE_MOD_PCM_CUR (0x033c) #define AFE_IRQ_MCU_CON (0x03A0) #define AFE_IRQ_MCU_STATUS (0x03A4) #define AFE_IRQ_CLR (0x03A8) #define AFE_IRQ_MCU_CNT1 (0x03AC) #define AFE_IRQ_MCU_CNT2 (0x03B0) #define AFE_IRQ_MCU_MON2 (0x03B8) #define AFE_IRQ1_MCN_CNT_MON (0x03C0) #define AFE_IRQ2_MCN_CNT_MON (0x03C4) #define AFE_IRQ1_MCU_EN_CNT_MON (0x03c8) #define AFE_MEMIF_MINLEN (0x03D0) #define AFE_MEMIF_MAXLEN (0x03D4) #define AFE_MEMIF_PBUF_SIZE (0x03D8) #define AFE_GAIN1_CON0 (0x0410) #define AFE_GAIN1_CON1 (0x0414) #define AFE_GAIN1_CON2 (0x0418) #define AFE_GAIN1_CON3 (0x041C) #define AFE_GAIN1_CONN (0x0420) #define AFE_GAIN1_CUR (0x0424) #define AFE_GAIN2_CON0 (0x0428) #define AFE_GAIN2_CON1 (0x042C) #define AFE_GAIN2_CON2 (0x0430) #define AFE_GAIN2_CON3 (0x0434) #define AFE_GAIN2_CONN (0x0438) #define AFE_GAIN2_CUR (0x043c) #define AFE_GAIN2_CONN2 (0x0440) // only valid in FPGA #define FPGA_CFG2 (0x004B8) #define FPGA_CFG3 (0x004BC) #define FPGA_CFG0 (0x04C0) #define FPGA_CFG1 (0x04C4) #define FPGA_STC (0x04CC) #define AFE_ASRC_CON0 (0x0500) #define AFE_ASRC_CON1 (0x0504) #define AFE_ASRC_CON2 (0x0508) #define AFE_ASRC_CON3 (0x050C) #define AFE_ASRC_CON4 (0x0510) #define AFE_ASRC_CON5 (0x0514) #define AFE_ASRC_CON6 (0x0518) #define AFE_ASRC_CON7 (0x051c) #define AFE_ASRC_CON8 (0x0520) #define AFE_ASRC_CON9 (0x0524) #define AFE_ASRC_CON10 (0x0528) #define AFE_ASRC_CON11 (0x052c) #define PCM_INTF_CON1 (0x0530) #define PCM_INTF_CON2 (0x0538) #define PCM2_INTF_CON (0x053C) #define AFE_ASRC_CON13 (0x0550) #define AFE_ASRC_CON14 (0x0554) #define AFE_ASRC_CON15 (0x0558) #define AFE_ASRC_CON16 (0x055C) #define AFE_ASRC_CON17 (0x0560) #define AFE_ASRC_CON18 (0x0564) #define AFE_ASRC_CON19 (0x0568) #define AFE_ASRC_CON20 (0x056C) #define AFE_ASRC_CON21 (0x0570) #define AFE_REGISTER_OFFSET (0x574) #define AFE_MASK_ALL (0xffffffff) //-----------register define end namespace android { //! A AFE register setting class. /*! this class is hold only the operation digital domain registers other complicated should move to higher layer. */ class AudioAfeReg { public: /** * AudioAfeReg getinstance. * setting a regiseter need to call getinstance to get pointer AudioAfeReg */ static AudioAfeReg *getInstance(); /** * a basic function to set afe regiseter * @param offset an offset of afe register * @param value value want to set to register * @param mask mask with 32 or 16 bits regiseter * @see GetAfeReg() * @return The state of set regiseter */ status_t SetAfeReg(uint32 offset, uint32 value, uint32 mask); /** * a basic function to Get afe regiseter * @param offset an offset of afe register * @see SetAfeReg() * @return The value regiseter want to get */ uint32 GetAfeReg(uint32 offset); /** * to get audio drvier file descriptor * @return Fd */ uint32 GetAfeFd(); private: /** * AudioAfeReg contructor . * use private constructor to achieve single instance */ AudioAfeReg(); ~AudioAfeReg(); /** * a basic function to check regiseter range * @param offset * @return bool */ bool CheckRegRange(uint32 offset); /** * a private variable. * file descriptor to open audio driver */ int mFd; /** * a loca varible for operation regiseter setting */ Register_Control mReg_Control; /** * a private variable. * single instance to thois class */ static AudioAfeReg *UniqueAfeRegInstance; /** * AudioAfeReg * prevent to copy this object */ AudioAfeReg(const AudioAfeReg &); // intentionally undefined AudioAfeReg &operator=(const AudioAfeReg &); // intentionally undefined }; } #endif
0d55e93ef7cc631dbdeaa542742bb41ffe7920c2
9858009e4c5aa48ef2a8c3e51ec9063a45750631
/spoj/Friends of Friends.cpp
11747d1896f3c0eb892a0fb4c5fdefd40036cab8
[]
no_license
rafid211/online-judge-solution
0becedb981c0f4dc30b5152aa6c1992966962972
448e4d2e496ec0381757f84e6977f701252ec9af
refs/heads/master
2023-04-01T11:52:43.405980
2021-04-09T10:57:35
2021-04-09T10:57:35
356,232,754
0
0
null
null
null
null
UTF-8
C++
false
false
439
cpp
Friends of Friends.cpp
#include <bits/stdc++.h> using namespace std; set<int>s; vector<int>v; int main() { int n; cin >>n; while(n--) { int f;cin >>f; v.push_back(f); int m; cin >>m; for(int i=0;i<m;i++){ int x;cin >>x; s.insert(x); } } int c=s.size(); for(int i=0;i<v.size();i++){ if(s.find(v[i])!=s.end())c--; } cout <<c<<endl; return 0; }
93b22c537d0ec7a1bed67beb1c693b0d4a8380d5
6afeae4dbceaa338102086985f10f939962108e9
/practice/solution/dynamic-programming/penukaran_emas.cpp
71f419e0724d5abc1e6cf667d95406277f38f818
[]
no_license
azaky/alterra-cp-mentoring
8360c879382bfbd4fb4dd7046195f7f6aa069c8a
673eedeb5a24ea9ea2bf91122a45277924d11a96
refs/heads/main
2023-08-26T14:41:07.095779
2021-10-26T07:49:41
2021-10-26T07:49:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
285
cpp
penukaran_emas.cpp
#include <bits/stdc++.h> using namespace std; int solve(int n) { vector<int> dp(n + 1); for (int i = 1; i <= n; ++i) { dp[i] = max(i, dp[i / 2] + dp[i / 3] + dp[i / 4]); } return dp[n]; } int main() { int n; scanf("%d", &n); printf("%d\n", solve(n)); return 0; }
4513454b717174cf0d28280581e531aceb5a5adf
30bdd8ab897e056f0fb2f9937dcf2f608c1fd06a
/Implementation/1619.cpp
16216f3206454201e904a2d11d8556ac5e511a0b
[]
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
362
cpp
1619.cpp
#include <iostream> using namespace std; int main() { string s; cin >> s; int dem=1; bool check=true; for(int i=0; i<s.length(); i++) { if(s[i+1]==s[i]) dem++; else dem=1; if(dem==7) check=false; } if(check==true) cout << "NO"; if(check==false) cout << "YES"; }
03d799b4e780b872e935555ca12e27cd2ade07b0
06bed8ad5fd60e5bba6297e9870a264bfa91a71d
/libPr3/Signal/acelatrafficcontroller.h
3c1eb4b7e4a3d4d0ecb2f63fad25b4c77806659d
[]
no_license
allenck/DecoderPro_app
43aeb9561fe3fe9753684f7d6d76146097d78e88
226c7f245aeb6951528d970f773776d50ae2c1dc
refs/heads/master
2023-05-12T07:36:18.153909
2023-05-10T21:17:40
2023-05-10T21:17:40
61,044,197
4
3
null
null
null
null
UTF-8
C++
false
false
3,528
h
acelatrafficcontroller.h
#ifndef ACELATRAFFICCONTROLLER_H #define ACELATRAFFICCONTROLLER_H #include "abstractmrnodetrafficcontroller.h" #include "acelanode.h" #include "acelasystemconnectionmemo.h" #include "acelalistener.h" class AcelaTrafficController : public AbstractMRNodeTrafficController { Q_OBJECT public: AcelaTrafficController(QObject* parent = nullptr); /*public*/ /*synchronized*/ void addAcelaListener(AcelaListener* l); /*public*/ /*synchronized*/ void removeAcelaListener(AcelaListener* l); /*public*/ int getMinimumNodeAddress(); /*public*/ int getMaximumNumberOfNodes(); /*public*/ bool getAcelaTrafficControllerState(); /*public*/ void setAcelaTrafficControllerState(bool newstate); /*public*/ /*synchronized*/ void resetStartingAddresses(); /*public*/ bool getAcelaSensorsState(); /*public*/ void setAcelaSensorsState(bool newstate) ; /*public*/ void incrementAcelaSensorInitCount(); /*public*/ int getAcelaSensorInitCount(); /*public*/ /*synchronized*/ bool getNeedToPollNodes() ; /*public*/ /*synchronized*/ void setNeedToPollNodes(bool newstate); /*public*/ bool getReallyReadyToPoll(); /*public*/ void setReallyReadyToPoll(bool newstate); /*public*/ AcelaSystemConnectionMemo* getSystemConnectionMemo(); /*public*/ void setSystemConnectionMemo(AcelaSystemConnectionMemo* m); /*public*/ void registerAcelaNode(AcelaNode* node); /*public*/ void initializeAcelaNode(AcelaNode* node); /*public*/ int lookupAcelaNodeAddress(int bitAddress, bool isSensor); private: static Logger* log; /** * Reference to the system connection memo. */ AcelaSystemConnectionMemo* mMemo = nullptr; /*transient*/ int curAcelaNodeIndex = -1; // cycles over defined nodes when pollMessage is called /*transient*/ /*private*/ int currentOutputAddress = -1; // Incremented as Acela Nodes are created and registered // Corresponds to next available output address in nodeArray // Start at -1 to avoid issues with bit address 0 /*transient*/ /*private*/ int currentSensorAddress = -1; // Incremented as Acela Nodes are created and registered // Corresponds to next available sensor address in nodeArray // Start at -1 to avoid issues with bit address 0 /*private*/ bool acelaTrafficControllerState = false; // Flag to indicate which state we are in: // false == Initializing Acela Network // true == Polling Sensors /*private*/ bool reallyReadyToPoll = false; // Flag to indicate that we are really ready to poll nodes /*transient*/ /*private*/ bool needToPollNodes = true; // Flag to indicate that nodes have not yet been created /*private*/ bool needToInitAcelaNetwork = true; // Flag to indicate that Acela network must be initialized /*private*/ int needToCreateNodesState = 0; // Need to do a few things: // Reset Acela Network // Set Acela Network Online // Poll for Acela Nodes (and create and register the nodes) /*private*/ bool acelaSensorsState = false; // Flag to indicate whether we have an active sensor and therefore need to poll: // false == No active sensor // true == Active sensor, need to poll sensors /*private*/ int acelaSensorInitCount = 0; // Need to count sensors initialized so we know when we can poll them /*private*/ static const int SPECIALNODE = 0; // Needed to initialize system protected: /*protected*/ AbstractMRMessage* enterProgMode(); /*protected*/ AbstractMRMessage* enterNormalMode(); }; #endif // ACELATRAFFICCONTROLLER_H
67a83d2932006a57dfb3f62d5024fe01ed758be2
cdebc1eef7cff2289f9fd68717505fdcaddafe6f
/1_Arrays_Vectors/4_Longest_Band.cpp
37ae6abcaf28b8191219b710176bfc4cfeabf6a3
[]
no_license
anurag-saraswat/DS-Practice
114f2eeb11c5e6e93a19ddda274da3030fc7614d
5fdf9a0a4966b787992a97559150a0d7d7b7a9df
refs/heads/master
2023-05-10T09:25:20.709031
2021-06-09T19:20:44
2021-06-09T19:20:44
370,376,306
0
0
null
null
null
null
UTF-8
C++
false
false
983
cpp
4_Longest_Band.cpp
/* Longest Band : Given an array containing N integers, find length of longest band. Band is defined as a subsequence which can be reordered in such a manner all element appear consecutive(i.e with absolute difference of 1 between meighbouring elements). A longest band is the band(subsequence) which contains maximum integers. */ #include <iostream> #include <vector> #include <unordered_set> using namespace std; int largestBand(vector<int> arr) { int largest = 0; unordered_set<int> s; for (auto i : arr) { s.insert(i); } for (auto i : arr) { int parent = i - 1; // Checking if parent exist if (s.find(parent) == s.end()) { int len = 0; int temp = i; while (s.find(temp) != s.end()) { len++; temp++; } largest = max(largest, len); } } return largest; } int main() { vector<int> arr = {1, 9, 3, 0, 18, 5, 2, 4, 10, 7, 12, 6}; auto res = largestBand(arr); cout << "Largest Band is of length: " << res << endl; return 0; }
c5bab8027b741a00686b0dc18cf4bde4bf89ab14
238d9522a3041c14bda8ab5bb75aaa9f6b453ae9
/Common/Utility/GHill.h
52cd6c2aeae18aade1b0f0b51f4a4f122c20290c
[]
no_license
geoffrey-jon/Renderer11
f4fbca6ecb32158c4765c92a6c51ba85ebc786a6
ffce3727bf77bfa28819b2b79d3b7a3ca51f3a49
refs/heads/master
2021-01-20T19:39:53.883734
2017-07-06T21:04:24
2017-07-06T21:04:24
64,797,499
1
1
null
null
null
null
UTF-8
C++
false
false
478
h
GHill.h
/* ======================= Summary: ======================= */ #ifndef GHILL_H #define GHILL_H #include "GObject.h" #include "GeometryGenerator.h" __declspec(align(16)) class GHill : public GObject { public: GHill(); ~GHill(); void* operator new(size_t i) { return _mm_malloc(i,16); } void operator delete(void* p) { _mm_free(p); } private: float GetHillHeight(float x, float z)const; DirectX::XMFLOAT3 GetHillNormal(float x, float z)const; }; #endif // GHILL_H
5281c0d003e198e6c7c4945cff94ca763f27208c
7b8787f01c7c3f14c5055418f8a6bde6af62943c
/src/MeteringSDK/MCOM/MonitorFile.cpp
6c0af8cd3134200797c6272309c21b2333abedc3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
beroset/C12Adapter
42feee4b7d686be05e8c44564e775eae3df7a6ba
593b201db169481245b0673813e19d174560a41e
refs/heads/master
2021-08-29T14:47:57.127377
2021-08-25T21:12:15
2021-08-25T21:12:15
194,516,157
0
1
MIT
2019-06-30T12:57:28
2019-06-30T12:57:28
null
UTF-8
C++
false
false
7,887
cpp
MonitorFile.cpp
// File MCOM/MonitorFile.cpp #include "MCOMExtern.h" #include "MCOMExceptions.h" #include "MonitorFile.h" #include "MonitorFilePrivateThread.h" #include <MCORE/MTime.h> #if !M_NO_MCOM_MONITOR && !M_NO_MULTITHREADING && !M_NO_FILESYSTEM #if !M_NO_REFLECTION static MMonitorFile* DoNew1(const MStdString& clientAddress) { return M_NEW MMonitorFile(clientAddress); } /// Constructor that creates a file monitor without giving a file name. /// /// No monitoring will be done until the file name is assigned. /// /// \pre The object should be created on a heap with operator new, /// and handled with a shared pointer, otherwise the behavior is undefined. /// File, if given, shall be a valid directory or a file name, /// but the check is deferred to the attaching time. /// static MMonitorFile* DoNew0() { return DoNew1(MVariant::s_emptyString); } #endif M_START_PROPERTIES(MonitorFile) M_OBJECT_PROPERTY_UINT (MonitorFile, MaxFileSizeKB) M_OBJECT_PROPERTY_BOOL (MonitorFile, Obfuscate) M_OBJECT_PROPERTY_STRING (MonitorFile, FileName, ST_constMStdStringA_X, ST_X_constMStdStringA) M_START_METHODS(MonitorFile) M_OBJECT_SERVICE (MonitorFile, DeleteFile, ST_X) M_CLASS_FRIEND_SERVICE_OVERLOADED(MonitorFile, New, DoNew1, 1, ST_MObjectP_S_constMStdStringA) M_CLASS_FRIEND_SERVICE_OVERLOADED(MonitorFile, New, DoNew0, 0, ST_MObjectP_S) M_END_CLASS(MonitorFile, Monitor) MMonitorFile::MMonitorFile(const MStdString& fileName) : m_foregroundThreadBufferLock(), m_fileLock(), m_foregroundThreadBuffer(), m_maxFileSizeKB(0u), m_fileName(), m_logFile(NULL), m_syncMessagePosted(false), m_isFinished(false), m_obfuscate(false), m_fileWasDeleted(false) { SetFileName(fileName); MMonitorFilePrivateThread::AttachMonitor(this); // this can attempt to attach the monitor again, no problem } MMonitorFile::~MMonitorFile() { DoFinish(); DoFileDetach(); delete m_logFile; } void MMonitorFile::SetMaxFileSizeKB(unsigned size) { if ( size != 0 ) MENumberOutOfRange::CheckInteger(64, 0x7FFF, int(size), M_OPT_STR("MaxFileSizeKB")); MCriticalSection::Locker lock(m_fileLock); m_maxFileSizeKB = size; // set the local value if ( m_logFile != NULL ) m_logFile->SetMaxFileSizeKB(size); } void MMonitorFile::SetFileName(const MStdString& name) { MCriticalSection::Locker lock(m_fileLock); if ( name != m_fileName || m_fileWasDeleted ) { if ( !m_fileName.empty() ) OnIdle(); // do this once "by hand" on the foreground thread m_fileWasDeleted = false; m_fileName = name; // and set the local value too if ( name.empty() ) DoFileDetach(); else { if ( m_logFile == NULL ) m_logFile = M_NEW MLogFileWriter; m_logFile->SetObfuscate(m_obfuscate); m_logFile->Open(name, m_maxFileSizeKB); // it is okay if the object is created, but the exception is thrown m_listening = -1; } } } void MMonitorFile::SetObfuscate(bool yes) { m_obfuscate = yes; if ( m_logFile != NULL ) m_logFile->SetObfuscate(m_obfuscate); } void MMonitorFile::DoFileDetach() { MCriticalSection::Locker lock(m_fileLock); m_fileWasDeleted = false; if ( m_logFile != NULL ) m_logFile->Close(); } void MMonitorFile::DeleteFile() { MCriticalSection::Locker lock(m_fileLock); if ( !m_fileName.empty() && MUtilities::IsPathExisting(m_fileName) ) { DoFileDetach(); MUtilities::DeleteFile(m_fileName); // this will report a good error if the file was not deleted for some reason m_fileWasDeleted = true; } } void MMonitorFile::Attach(const MStdString& mediaIdentification) { m_listening = -1; // initiate sending of the information m_syncMessagePosted = 0; MMonitor::Attach(mediaIdentification); } void MMonitorFile::Detach() { MMonitor::Detach(); DoFileDetach(); } void MMonitorFile::OnMessage(MMonitor::MessageType code, const char* data, int length) { MMonitor::OnMessage(code, data, length); if ( m_fileWasDeleted && !m_fileName.empty() ) { try { SetFileName(m_fileName); } #if M_DEBUG catch ( MException& ex ) { M_USED_VARIABLE(ex); M_ASSERT(0); } #endif catch ( ... ) { M_ASSERT(0); // never consider an error in release, we are possibly communicating } } unsigned currentTimestamp = MUtilities::GetTickCount(); MLogFile::PacketHeader header; header.m_length = Muint32(length + MLogFile::PACKET_HEADER_SIZE); header.m_timeStamp = Muint32(currentTimestamp); header.m_code = Muint16(code); { MCriticalSection::Locker lock(m_foregroundThreadBufferLock); m_foregroundThreadBuffer.append((const char*)&header, MLogFile::PACKET_HEADER_SIZE); m_foregroundThreadBuffer.append(data, length); } // send synchronize message if ( !m_syncMessagePosted && code != MessageProtocolSynchronize ) PostSyncMessage(); } void MMonitorFile::OnPageBoundHit() { m_syncMessagePosted = false; } void MMonitorFile::DoFinish() { if ( !m_isFinished ) // this could be finished earlier { m_isFinished = true; MMonitorFilePrivateThread::DetachMonitor(this); OnIdle(); // do this once "by hand" on the foreground thread } } void MMonitorFile::OnIdle() M_NO_THROW { try { MByteString backgroundThreadBuffer; { // Do this operation in a separate scope to minimize locking MCriticalSection::Locker lock(m_foregroundThreadBufferLock); m_foregroundThreadBuffer.swap(backgroundThreadBuffer); m_foregroundThreadBuffer.clear(); } if ( m_listening != 0 && !backgroundThreadBuffer.empty() ) { unsigned result = DoSendBackgroundBuffer(backgroundThreadBuffer); if ( result == 0 && m_client == NULL ) // only in this case reset `m_listening` m_listening = 0; } } catch ( ... ) { // ignore errors in release version M_ASSERT(0); } } unsigned MMonitorFile::DoSendBackgroundBuffer(const MByteString& backgroundThreadBuffer) { MCriticalSection::Locker lock(m_fileLock); if ( m_logFile != NULL && m_logFile->IsOpen() ) { try { // set listener m_logFile->SetListener(this); m_logFile->WriteMultipleMessages(backgroundThreadBuffer); // unset listener (helpful for debug) m_logFile->SetListener(NULL); return (unsigned)-1; // success, we are interested in data } catch ( ... ) { } } return 0; // we are not interested in further data for whatever reason } void MMonitorFile::PostSyncMessage() { char buffer [ 64 ]; #if M_OS & M_OS_POSIX struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz); MTime t(tv.tv_sec + tz.tz_minuteswest * 60); // format is YYYY.MM.DD hh:mm:ss.ms size_t buflen = MFormat(buffer, sizeof(buffer), "Timestamp %04u.%02u.%02u %02u:%02u:%02u.%03u", t.GetYear(), t.GetMonth(), t.GetDayOfMonth(), t.GetHours(), t.GetMinutes(), t.GetSeconds(), tv.tv_usec / 1000); #else SYSTEMTIME st; GetSystemTime(&st); // format is YYYY.MM.DD hh:mm:ss.ms size_t buflen = MFormat(buffer, sizeof(buffer), "Timestamp %04u.%02u.%02u %02u:%02u:%02u.%03u", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); #endif M_ASSERT(buflen > 0 && buflen < sizeof(buffer)); // check if the supplied buffer fits (due to the supplied format it does) OnMessage(MMonitor::MessageProtocolSynchronize, buffer, static_cast<int>(buflen)); m_syncMessagePosted = true; } #endif // !M_NO_MCOM_MONITOR
a362b61f7dc6fa2dcd04bcdc2a621d0e01d44573
942e53b7a655cda18b1ad24d127f87ebdd49d1a1
/cpp/network/src/network/IpAddress.cpp
dcac6897142ca55f7bc892b89aa504de5ad06d93
[]
no_license
GuillaumeBouchetEpitech/tmp_repo
7b81467ebd4155f1a25084f77c491f5cca7e9c7a
3275903c4ebd7a134ea56354812bdbf23ba746ed
refs/heads/master
2022-03-12T11:42:31.878447
2021-05-13T07:02:49
2021-05-13T07:02:49
92,138,765
0
0
null
2022-02-27T14:12:40
2017-05-23T06:43:57
C++
UTF-8
C++
false
false
491
cpp
IpAddress.cpp
#include "IpAddress.hpp" #include <arpa/inet.h> // inet_addr namespace network { IpAddress::IpAddress(int addr) : _addr(addr) {} IpAddress::IpAddress(const char* addr) : _addr(inet_addr(addr)) {} // void IpAddress::reset() { _addr = 0; } // std::string IpAddress::toString() const { struct in_addr tmpAddr; // tmpAddr.s_addr = htonl(_addr); tmpAddr.s_addr = _addr; return inet_ntoa(tmpAddr); } int IpAddress::toInteger() const { return _addr; } };
637de38cff311094ad47c2d784115357d95fffae
caf904ce8f2766c13917e4e7c894af594d71f453
/Agent.h
258b898bffac39239159a078b6e136f83db80125
[ "MIT" ]
permissive
ryuichiueda/IAS14_CODE
6c2b6437b27cf708d7d10230ae9938564ca012bf
4f4df0b6afe234fda60f3438ab5d28388f7186e2
refs/heads/master
2020-04-02T05:13:48.704513
2016-06-09T01:52:57
2016-06-09T01:52:57
60,743,074
0
0
null
null
null
null
UTF-8
C++
false
false
487
h
Agent.h
#ifndef _AGENT__H__ #define _AGENT__H__ #include <vector> #include <string> using namespace std; class Event; typedef vector<Event> Episode; class ParticleFilter; class Agent { public: Agent(ifstream *ifs); ~Agent(); string decision(char state,bool food); void print(ofstream *ofs); void printLastTrial(ofstream *ofs); protected: Episode m_episode; ParticleFilter* m_pf; string randomDecision(char state); }; /* map --------- 3 2 4 --- --- | 1 | */ #endif
0d1080f973594bb678405d611a7d8481308a2942
839a6a4ddda03aa89be42e010dc4c8d87bd00751
/PROG/BN_robot/Robot/Arm.hpp
f15d4bb173d229785a5d75a9bc17d733d64469b4
[]
no_license
JeanSOUDIER/PRJ_NUMBER_DETECT
41c19770795165a7c16f58743e8a3516430cc9cf
f422409704533dd7c89b412557fcbf63c2e09a87
refs/heads/master
2023-03-08T23:27:04.509027
2021-02-21T13:49:33
2021-02-21T13:49:33
294,946,329
3
0
null
null
null
null
UTF-8
C++
false
false
7,009
hpp
Arm.hpp
#ifndef ARM_H #define ARM_H #include <iostream> #include <complex> #include <cmath> #include <vector> #include <wiringPi.h> #include <termios.h> #include <string.h> #include "Usb.hpp" #include "../Joystick/js.hpp" #include "../SequenceHandler_STL/sequencehandler.h" #include "../SequenceHandler_STL/sequencewriter.h" /** Arm class DUHAMEL Erwan (erwanduhamel@outlook.com) SOUDIER Jean (jean.soudier@insa-strasbourg.fr) Provides a class for Arm control. Features : • Full position control of a 6 axis arm Functions : • Arm | Constructor with arguments nb (number of motors), nb_usb (the port number of the arm in USB), the baudrate of the USB, the limits (min/max), the time to move the arm • SetLimAxe(nb,lim_min,lim_max) | Function that manages the position limits of a motor with nb the number of the motor, lim_min the minimum value and lim_max the max value • SetLimMinAxe(nb,lim) | Function to manage the min limit of the motor nb • SetLimMaxAxe(nb,lim) | Function to manage the max limit of the motor nb • SetAxePos(nb,pos) | Function to change the goal position to a motor to a position between pi/2 and -pi/2 • SetAxePosTic(nb,pos) | Function to change the goal position to a motor to a position between lim_max and lim_min • GetAxePos(nb) | Function that returns the psition of the motor in Tic • GetBdRate() | Function that returns the baudrate • GetPortNb() | Function that returns the USB port number • GetTime() | Function that returns the time to move motors • GetNbMot() | Function that returns the number of motors • MoveArm(withDelay) | Function to move the arm with the positions in the buffer [SetAxePos or SetAxePosTic] • PlaceArm(x,y,z) | Function to move the arm with inverse kinematic to an (x,y,z) position of the end effector from the base of the arm, return the success • WriteOn() | Function that sets the position of the end effector to write • WriteOff() | Function that sets the position of the end effector to not write • Homing() | Function to place the robot to the start position • PosWriting(state,time) | Function to place the arm to write something with state of the end effector (on/off) and the time to go • PosPreWriting(state,time) | Function to pre place the arm to write something with state of the end effector (on/off) and the time to go • PosToMove() | Function to place the robot to a good position to move the mobile base • ToKeyboard(GamePad) | Function to move the arm with a control of a Keyboard (GamePad=false) or a GamePad Xbox360 (GamePad=true) • Send(ins,data) | Function to send a command to the arm with ins the instruction and data the datas • getch() | Function to get the actual key with is pess on the keyboard Const variables : • Lr | Variable of the min length allow to the arm in coordinate r = Norm(X,Y) • Lz | Variable of the min Z allowed A4b Motor6---------End effector | | A4a | Motor5 -------Motor3--------------------------Motor4 | A2 \ | \ | \ A3 | \ | \ | A1 Motor5-------Motor6 | A4b | | Z |-| A1thet /\ | | | || | Motor2 _______________________________ | Motor1 | _______________________________________----> R = Norm(X,Y) */ constexpr int ARB_SIZE_POSE = 7; //instructions constexpr int ARB_LOAD_POSE = 8; constexpr int ARB_LOAD_SEQ = 9; constexpr int ARB_PLAY_SEQ = 10; constexpr int ARB_LOOP_SEQ = 11; constexpr int ARB_DO_FULL = 12; class Arm { public: Arm(const int nb,const int nb_usb, const int bdrate); Arm(const int nb, const int nb_usb, const int bdrate, const int time); Arm(const int nb, const int nb_usb, const int bdrate, const std::vector<int> &lim_min, const std::vector<int> &lim_max); Arm(const int nb, const int nb_usb, const int bdrate, const std::vector<int> &lim_min, const std::vector<int> &lim_max, int time); ~Arm(); void SetLimAxe(int nb, int lim_min, int lim_max); void SetLimMinAxe(int nb, int lim); void SetLimMaxAxe(int nb, int lim); void SetAxePos(int nb, double pos); void SetAxePosTic(int nb, int pos); void SetTime(const int time); int GetLimMinAxe(int nb); int GetLimMaxAxe(int nb); int GetAxePos(int nb); int GetBdRate(void); int GetPortNb(void); int GetTime(void); int GetNbMot(void); void MoveArm(bool withDelay); bool PlaceArm(double x, double y, double z); void WriteOn(); void WriteOff(); void Homing(); std::vector<int> PosWriting(bool state, int time); std::vector<int> PosPreWriting(bool state, int time); void PosToMove(); void ToKeyboard(bool GamePad); private: void Send(int ins, const std::vector<char> &data); char getch(); const int Lr = 179; const int Lz = -236; const int A1 = 155; const int A2 = 150; const int A3 = 80; const int A4a = 110; const int A4b = 105; const int A4 = sqrt(A4a*A4a+A4b*A4b); const double A1thet = 0.37; const int limTimeMin = 300; const int limTimeMax = 60000; std::vector<int> m_PosArm; std::vector<int> m_LimMinArm; std::vector<int> m_LimMaxArm; bool m_active = false; int m_port_nr; int m_bdrate; int m_TimeArm = 5000; int m_nb = 6; Usb *m_usb; }; #endif //ARM_H
487a49e109085d83ae6cd01e09d456713745f949
001b05f8eb69dd0e52b4fd6f7a7cc95e813807c2
/src/SocketServer.cpp
78ce0398efedd83f2bc93f8079491cfe4b082da3
[]
no_license
Jeblas/Shark
8f5861ec9bf6f7960ec3848f6fc4a56f4c267ef8
d8c73560d7d00829d605be2500c3d196135253c8
refs/heads/master
2022-01-20T15:51:25.794187
2019-05-30T02:09:58
2019-05-30T02:09:58
110,398,829
0
0
null
null
null
null
UTF-8
C++
false
false
202
cpp
SocketServer.cpp
#include "SocketServer.h" int server (int client_socket) { while (1) { int length; char * text; //read length of message from the Socket if read == 0 client stopped // if (read (c)) } }
8a1e70c30655b2ce6f5570f223acbffbf8b4570f
263df0bea1e364ae110adb5e9ba2e4f2555ca5af
/PurpleBook/example/P188_增量构造法.cpp
3f552a6204b5f237b64488e997db0a38284f64f3
[]
no_license
ShmilyBelon/ACM_Works
d610970c1742fba50d495101c0e21f0037a2ce7c
b1d6549a2bc6f3f1ff8a4cd169342e853a7b99d8
refs/heads/master
2020-03-23T16:33:37.013813
2018-07-21T14:12:01
2018-07-21T14:12:01
141,817,468
0
0
null
null
null
null
UTF-8
C++
false
false
1,124
cpp
P188_增量构造法.cpp
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e3+10; int S[maxn]; int subS[maxn]; /*本例子中讨论的集合S中不能有重复元素*/ void print_subset(int n,int S[] , int subS[] , int cur) { for(int i=0;i<cur;i++) printf(" %d ",subS[i]); printf("\n"); for(int i=cur;i<n;i++)//i从cur开始是因为,比上一个加入子集的元素大的元素一定在S中下标cur~n范围内,因为S已经被排序。 { if(cur>=1 && subS[cur-1]>=S[i])/*重点!这行的意思是当前选的加入子集合中的元素必须比上一个加入子集的元素大,通过这种有序来保证,集合的唯一性去除{1,3,2}这种情况,因为之前一定已经输出了{1,2,3},它们是同一个集合。*/ continue; subS[cur] = S[i]; print_subset(n,S,subS,cur+1); } } int main(void) { int n; while(scanf("%d",&n)!=EOF) { memset(subS,0,n); for(int i=0;i<n;i++) scanf("%d",&S[i]); sort(S,S+n); print_subset(n,S,subS,0); } return 0; }
fd443a4964dfaafd0daed14c36c45f93fb22173b
c508dbf8dd2d505936b5ac3a05b30f94aa82a413
/src/main/engine.h
830a97ab67d2d1ae4ecd26153937b5c5b8a77de7
[]
no_license
AJ92/Quark2
db36c97cf7397fbdcca250d0647297e546e78415
6e67c64ea9cdde12b69519fb02b40ddadcd09a46
refs/heads/master
2022-06-22T16:16:01.764639
2022-06-19T18:21:24
2022-06-19T18:21:24
60,587,429
0
0
null
null
null
null
UTF-8
C++
false
false
1,609
h
engine.h
#ifndef ENGINE_H #define ENGINE_H #define GLM_FORCE_RADIANS #define GLM_FORCE_DEPTH_ZERO_TO_ONE #define GLFW_INCLUDE_VULKAN #include <glfw3.h> #include "base/gfx/vulkan/vulkan.h" #include "base/systems/scriptsystem.h" #include "base/comp/management/entitymanagement.h" #include <chrono> #include <memory> //#include <audio.h> namespace quark{ // has to be destroyed before script system for dtor order (script comps destroy within script interpreter) static std::shared_ptr<ComponentManagement> mComponentManagement; static std::shared_ptr<EntityManagement> mEntityManagement; class Engine { public: Engine(); ~Engine(); void run(); std::shared_ptr<Vulkan> getVulkanRenderer(); private: bool isDebug; bool preInit(); bool initAllcoators(); bool initComponentManagement(); bool initWindow(); bool initAudio(); bool initScripting(); //VULKAN INIT bool initVulkan(); static void onWindowResized(GLFWwindow* window, int width, int height); bool postInit(); bool mainLoop(); bool cleanUp(); //diagnostics... probably better to put it in an extra system! void initDiagnostics(); void updateDiagnostics(); //tests void testScripts(); GLFWwindow * mWindow; int mWindowWidth; int mWindowHeight; std::chrono::time_point<std::chrono::high_resolution_clock> mFrameStart, mFrameEnd; std::chrono::duration<double> mCumFrameTimeElapsed; uint64_t mCumFrameCount = 0; uint64_t mCurrentFrame = 0; //std::shared_ptr<Audio> mAudio; std::shared_ptr<Vulkan> mVulkan; std::shared_ptr<ScriptSystem> mScriptSystem; }; }; #endif // ENGINE_H
f4f1996dfe5aa88d5cac3a5ba2fbc2613c3df77e
f556301fd9bdba0e463bb6f08bd83db0fd258a8d
/extensions/third_party/perfetto/protos/perfetto/trace/track_event/thread_descriptor.pb.cc
f18428538978381b7286727d1154281d90563e39
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
blockspacer/chromium_base_conan
ce7c0825b6a62c2c1272ccab5e31f15d316aa9ac
726d2a446eb926f694e04ab166c0bbfdb40850f2
refs/heads/master
2022-09-14T17:13:27.992790
2022-08-24T11:04:58
2022-08-24T11:04:58
225,695,691
18
2
null
null
null
null
UTF-8
C++
false
true
28,441
cc
thread_descriptor.pb.cc
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: protos/perfetto/trace/track_event/thread_descriptor.proto #include "protos/perfetto/trace/track_event/thread_descriptor.pb.h" #include <algorithm> #include <google/protobuf/stubs/common.h> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/wire_format_lite.h> #include <google/protobuf/io/zero_copy_stream_impl_lite.h> // @@protoc_insertion_point(includes) #include <google/protobuf/port_def.inc> namespace perfetto { namespace protos { class ThreadDescriptorDefaultTypeInternal { public: ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<ThreadDescriptor> _instance; } _ThreadDescriptor_default_instance_; } // namespace protos } // namespace perfetto static void InitDefaultsscc_info_ThreadDescriptor_protos_2fperfetto_2ftrace_2ftrack_5fevent_2fthread_5fdescriptor_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; { void* ptr = &::perfetto::protos::_ThreadDescriptor_default_instance_; new (ptr) ::perfetto::protos::ThreadDescriptor(); ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); } ::perfetto::protos::ThreadDescriptor::InitAsDefaultInstance(); } ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ThreadDescriptor_protos_2fperfetto_2ftrace_2ftrack_5fevent_2fthread_5fdescriptor_2eproto = {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_ThreadDescriptor_protos_2fperfetto_2ftrace_2ftrack_5fevent_2fthread_5fdescriptor_2eproto}, {}}; namespace perfetto { namespace protos { bool ThreadDescriptor_ChromeThreadType_IsValid(int value) { switch (value) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 50: case 51: return true; default: return false; } } static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> ThreadDescriptor_ChromeThreadType_strings[14] = {}; static const char ThreadDescriptor_ChromeThreadType_names[] = "CHROME_THREAD_COMPOSITOR" "CHROME_THREAD_COMPOSITOR_WORKER" "CHROME_THREAD_IO" "CHROME_THREAD_MAIN" "CHROME_THREAD_MEMORY_INFRA" "CHROME_THREAD_POOL_BG_BLOCKING" "CHROME_THREAD_POOL_BG_WORKER" "CHROME_THREAD_POOL_FB_BLOCKING" "CHROME_THREAD_POOL_FG_WORKER" "CHROME_THREAD_POOL_SERVICE" "CHROME_THREAD_SAMPLING_PROFILER" "CHROME_THREAD_SERVICE_WORKER" "CHROME_THREAD_UNSPECIFIED" "CHROME_THREAD_VIZ_COMPOSITOR"; static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ThreadDescriptor_ChromeThreadType_entries[] = { { {ThreadDescriptor_ChromeThreadType_names + 0, 24}, 8 }, { {ThreadDescriptor_ChromeThreadType_names + 24, 31}, 10 }, { {ThreadDescriptor_ChromeThreadType_names + 55, 16}, 2 }, { {ThreadDescriptor_ChromeThreadType_names + 71, 18}, 1 }, { {ThreadDescriptor_ChromeThreadType_names + 89, 26}, 50 }, { {ThreadDescriptor_ChromeThreadType_names + 115, 30}, 6 }, { {ThreadDescriptor_ChromeThreadType_names + 145, 28}, 3 }, { {ThreadDescriptor_ChromeThreadType_names + 173, 30}, 5 }, { {ThreadDescriptor_ChromeThreadType_names + 203, 28}, 4 }, { {ThreadDescriptor_ChromeThreadType_names + 231, 26}, 7 }, { {ThreadDescriptor_ChromeThreadType_names + 257, 31}, 51 }, { {ThreadDescriptor_ChromeThreadType_names + 288, 28}, 11 }, { {ThreadDescriptor_ChromeThreadType_names + 316, 25}, 0 }, { {ThreadDescriptor_ChromeThreadType_names + 341, 28}, 9 }, }; static const int ThreadDescriptor_ChromeThreadType_entries_by_number[] = { 12, // 0 -> CHROME_THREAD_UNSPECIFIED 3, // 1 -> CHROME_THREAD_MAIN 2, // 2 -> CHROME_THREAD_IO 6, // 3 -> CHROME_THREAD_POOL_BG_WORKER 8, // 4 -> CHROME_THREAD_POOL_FG_WORKER 7, // 5 -> CHROME_THREAD_POOL_FB_BLOCKING 5, // 6 -> CHROME_THREAD_POOL_BG_BLOCKING 9, // 7 -> CHROME_THREAD_POOL_SERVICE 0, // 8 -> CHROME_THREAD_COMPOSITOR 13, // 9 -> CHROME_THREAD_VIZ_COMPOSITOR 1, // 10 -> CHROME_THREAD_COMPOSITOR_WORKER 11, // 11 -> CHROME_THREAD_SERVICE_WORKER 4, // 50 -> CHROME_THREAD_MEMORY_INFRA 10, // 51 -> CHROME_THREAD_SAMPLING_PROFILER }; const std::string& ThreadDescriptor_ChromeThreadType_Name( ThreadDescriptor_ChromeThreadType value) { static const bool dummy = ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( ThreadDescriptor_ChromeThreadType_entries, ThreadDescriptor_ChromeThreadType_entries_by_number, 14, ThreadDescriptor_ChromeThreadType_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( ThreadDescriptor_ChromeThreadType_entries, ThreadDescriptor_ChromeThreadType_entries_by_number, 14, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : ThreadDescriptor_ChromeThreadType_strings[idx].get(); } bool ThreadDescriptor_ChromeThreadType_Parse( const std::string& name, ThreadDescriptor_ChromeThreadType* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( ThreadDescriptor_ChromeThreadType_entries, 14, name, &int_value); if (success) { *value = static_cast<ThreadDescriptor_ChromeThreadType>(int_value); } return success; } #if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_UNSPECIFIED; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_MAIN; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_IO; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_POOL_BG_WORKER; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_POOL_FG_WORKER; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_POOL_FB_BLOCKING; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_POOL_BG_BLOCKING; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_POOL_SERVICE; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_COMPOSITOR; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_VIZ_COMPOSITOR; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_COMPOSITOR_WORKER; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_SERVICE_WORKER; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_MEMORY_INFRA; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_SAMPLING_PROFILER; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::ChromeThreadType_MIN; constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::ChromeThreadType_MAX; constexpr int ThreadDescriptor::ChromeThreadType_ARRAYSIZE; #endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) // =================================================================== void ThreadDescriptor::InitAsDefaultInstance() { } class ThreadDescriptor::_Internal { public: using HasBits = decltype(std::declval<ThreadDescriptor>()._has_bits_); static void set_has_pid(HasBits* has_bits) { (*has_bits)[0] |= 2u; } static void set_has_tid(HasBits* has_bits) { (*has_bits)[0] |= 4u; } static void set_has_thread_name(HasBits* has_bits) { (*has_bits)[0] |= 1u; } static void set_has_chrome_thread_type(HasBits* has_bits) { (*has_bits)[0] |= 16u; } static void set_has_reference_timestamp_us(HasBits* has_bits) { (*has_bits)[0] |= 32u; } static void set_has_reference_thread_time_us(HasBits* has_bits) { (*has_bits)[0] |= 64u; } static void set_has_reference_thread_instruction_count(HasBits* has_bits) { (*has_bits)[0] |= 128u; } static void set_has_legacy_sort_index(HasBits* has_bits) { (*has_bits)[0] |= 8u; } }; ThreadDescriptor::ThreadDescriptor() : ::PROTOBUF_NAMESPACE_ID::MessageLite(), _internal_metadata_(nullptr) { SharedCtor(); // @@protoc_insertion_point(constructor:perfetto.protos.ThreadDescriptor) } ThreadDescriptor::ThreadDescriptor(const ThreadDescriptor& from) : ::PROTOBUF_NAMESPACE_ID::MessageLite(), _internal_metadata_(nullptr), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom(from._internal_metadata_); thread_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); if (from.has_thread_name()) { thread_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.thread_name_); } ::memcpy(&pid_, &from.pid_, static_cast<size_t>(reinterpret_cast<char*>(&reference_thread_instruction_count_) - reinterpret_cast<char*>(&pid_)) + sizeof(reference_thread_instruction_count_)); // @@protoc_insertion_point(copy_constructor:perfetto.protos.ThreadDescriptor) } void ThreadDescriptor::SharedCtor() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_ThreadDescriptor_protos_2fperfetto_2ftrace_2ftrack_5fevent_2fthread_5fdescriptor_2eproto.base); thread_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); ::memset(&pid_, 0, static_cast<size_t>( reinterpret_cast<char*>(&reference_thread_instruction_count_) - reinterpret_cast<char*>(&pid_)) + sizeof(reference_thread_instruction_count_)); } ThreadDescriptor::~ThreadDescriptor() { // @@protoc_insertion_point(destructor:perfetto.protos.ThreadDescriptor) SharedDtor(); } void ThreadDescriptor::SharedDtor() { thread_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } void ThreadDescriptor::SetCachedSize(int size) const { _cached_size_.Set(size); } const ThreadDescriptor& ThreadDescriptor::default_instance() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ThreadDescriptor_protos_2fperfetto_2ftrace_2ftrack_5fevent_2fthread_5fdescriptor_2eproto.base); return *internal_default_instance(); } void ThreadDescriptor::Clear() { // @@protoc_insertion_point(message_clear_start:perfetto.protos.ThreadDescriptor) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { thread_name_.ClearNonDefaultToEmptyNoArena(); } if (cached_has_bits & 0x000000feu) { ::memset(&pid_, 0, static_cast<size_t>( reinterpret_cast<char*>(&reference_thread_instruction_count_) - reinterpret_cast<char*>(&pid_)) + sizeof(reference_thread_instruction_count_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); } #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* ThreadDescriptor::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); CHK_(ptr); switch (tag >> 3) { // optional int32 pid = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { _Internal::set_has_pid(&has_bits); pid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional int32 tid = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { _Internal::set_has_tid(&has_bits); tid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional int32 legacy_sort_index = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { _Internal::set_has_legacy_sort_index(&has_bits); legacy_sort_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional .perfetto.protos.ThreadDescriptor.ChromeThreadType chrome_thread_type = 4; case 4: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); if (PROTOBUF_PREDICT_TRUE(::perfetto::protos::ThreadDescriptor_ChromeThreadType_IsValid(val))) { set_chrome_thread_type(static_cast<::perfetto::protos::ThreadDescriptor_ChromeThreadType>(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); } } else goto handle_unusual; continue; // optional string thread_name = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(mutable_thread_name(), ptr, ctx); CHK_(ptr); } else goto handle_unusual; continue; // optional int64 reference_timestamp_us = 6; case 6: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) { _Internal::set_has_reference_timestamp_us(&has_bits); reference_timestamp_us_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional int64 reference_thread_time_us = 7; case 7: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { _Internal::set_has_reference_thread_time_us(&has_bits); reference_thread_time_us_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional int64 reference_thread_instruction_count = 8; case 8: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) { _Internal::set_has_reference_thread_instruction_count(&has_bits); reference_thread_instruction_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag & 7) == 4 || tag == 0) { ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool ThreadDescriptor::MergePartialFromCodedStream( ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::PROTOBUF_NAMESPACE_ID::uint32 tag; ::PROTOBUF_NAMESPACE_ID::internal::LiteUnknownFieldSetter unknown_fields_setter( &_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::io::StringOutputStream unknown_fields_output( unknown_fields_setter.buffer()); ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream unknown_fields_stream( &unknown_fields_output, false); // @@protoc_insertion_point(parse_start:perfetto.protos.ThreadDescriptor) for (;;) { ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); tag = p.first; if (!p.second) goto handle_unusual; switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional int32 pid = 1; case 1: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { _Internal::set_has_pid(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( input, &pid_))); } else { goto handle_unusual; } break; } // optional int32 tid = 2; case 2: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { _Internal::set_has_tid(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( input, &tid_))); } else { goto handle_unusual; } break; } // optional int32 legacy_sort_index = 3; case 3: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) { _Internal::set_has_legacy_sort_index(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( input, &legacy_sort_index_))); } else { goto handle_unusual; } break; } // optional .perfetto.protos.ThreadDescriptor.ChromeThreadType chrome_thread_type = 4; case 4: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (32 & 0xFF)) { int value = 0; DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>( input, &value))); if (::perfetto::protos::ThreadDescriptor_ChromeThreadType_IsValid(value)) { set_chrome_thread_type(static_cast< ::perfetto::protos::ThreadDescriptor_ChromeThreadType >(value)); } else { unknown_fields_stream.WriteVarint32(32u); unknown_fields_stream.WriteVarint32( static_cast<::PROTOBUF_NAMESPACE_ID::uint32>(value)); } } else { goto handle_unusual; } break; } // optional string thread_name = 5; case 5: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (42 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( input, this->mutable_thread_name())); } else { goto handle_unusual; } break; } // optional int64 reference_timestamp_us = 6; case 6: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (48 & 0xFF)) { _Internal::set_has_reference_timestamp_us(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( input, &reference_timestamp_us_))); } else { goto handle_unusual; } break; } // optional int64 reference_thread_time_us = 7; case 7: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (56 & 0xFF)) { _Internal::set_has_reference_thread_time_us(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( input, &reference_thread_time_us_))); } else { goto handle_unusual; } break; } // optional int64 reference_thread_instruction_count = 8; case 8: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (64 & 0xFF)) { _Internal::set_has_reference_thread_instruction_count(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>( input, &reference_thread_instruction_count_))); } else { goto handle_unusual; } break; } default: { handle_unusual: if (tag == 0) { goto success; } DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SkipField( input, tag, &unknown_fields_stream)); break; } } } success: // @@protoc_insertion_point(parse_success:perfetto.protos.ThreadDescriptor) return true; failure: // @@protoc_insertion_point(parse_failure:perfetto.protos.ThreadDescriptor) return false; #undef DO_ } #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void ThreadDescriptor::SerializeWithCachedSizes( ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:perfetto.protos.ThreadDescriptor) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional int32 pid = 1; if (cached_has_bits & 0x00000002u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32(1, this->pid(), output); } // optional int32 tid = 2; if (cached_has_bits & 0x00000004u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32(2, this->tid(), output); } // optional int32 legacy_sort_index = 3; if (cached_has_bits & 0x00000008u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32(3, this->legacy_sort_index(), output); } // optional .perfetto.protos.ThreadDescriptor.ChromeThreadType chrome_thread_type = 4; if (cached_has_bits & 0x00000010u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnum( 4, this->chrome_thread_type(), output); } // optional string thread_name = 5; if (cached_has_bits & 0x00000001u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased( 5, this->thread_name(), output); } // optional int64 reference_timestamp_us = 6; if (cached_has_bits & 0x00000020u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(6, this->reference_timestamp_us(), output); } // optional int64 reference_thread_time_us = 7; if (cached_has_bits & 0x00000040u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(7, this->reference_thread_time_us(), output); } // optional int64 reference_thread_instruction_count = 8; if (cached_has_bits & 0x00000080u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(8, this->reference_thread_instruction_count(), output); } output->WriteRaw(_internal_metadata_.unknown_fields().data(), static_cast<int>(_internal_metadata_.unknown_fields().size())); // @@protoc_insertion_point(serialize_end:perfetto.protos.ThreadDescriptor) } size_t ThreadDescriptor::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.ThreadDescriptor) size_t total_size = 0; total_size += _internal_metadata_.unknown_fields().size(); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x000000ffu) { // optional string thread_name = 5; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->thread_name()); } // optional int32 pid = 1; if (cached_has_bits & 0x00000002u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( this->pid()); } // optional int32 tid = 2; if (cached_has_bits & 0x00000004u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( this->tid()); } // optional int32 legacy_sort_index = 3; if (cached_has_bits & 0x00000008u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( this->legacy_sort_index()); } // optional .perfetto.protos.ThreadDescriptor.ChromeThreadType chrome_thread_type = 4; if (cached_has_bits & 0x00000010u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->chrome_thread_type()); } // optional int64 reference_timestamp_us = 6; if (cached_has_bits & 0x00000020u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( this->reference_timestamp_us()); } // optional int64 reference_thread_time_us = 7; if (cached_has_bits & 0x00000040u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( this->reference_thread_time_us()); } // optional int64 reference_thread_instruction_count = 8; if (cached_has_bits & 0x00000080u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( this->reference_thread_instruction_count()); } } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } void ThreadDescriptor::CheckTypeAndMergeFrom( const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const ThreadDescriptor*>( &from)); } void ThreadDescriptor::MergeFrom(const ThreadDescriptor& from) { // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.ThreadDescriptor) GOOGLE_DCHECK_NE(&from, this); _internal_metadata_.MergeFrom(from._internal_metadata_); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 0x000000ffu) { if (cached_has_bits & 0x00000001u) { _has_bits_[0] |= 0x00000001u; thread_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.thread_name_); } if (cached_has_bits & 0x00000002u) { pid_ = from.pid_; } if (cached_has_bits & 0x00000004u) { tid_ = from.tid_; } if (cached_has_bits & 0x00000008u) { legacy_sort_index_ = from.legacy_sort_index_; } if (cached_has_bits & 0x00000010u) { chrome_thread_type_ = from.chrome_thread_type_; } if (cached_has_bits & 0x00000020u) { reference_timestamp_us_ = from.reference_timestamp_us_; } if (cached_has_bits & 0x00000040u) { reference_thread_time_us_ = from.reference_thread_time_us_; } if (cached_has_bits & 0x00000080u) { reference_thread_instruction_count_ = from.reference_thread_instruction_count_; } _has_bits_[0] |= cached_has_bits; } } void ThreadDescriptor::CopyFrom(const ThreadDescriptor& from) { // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.ThreadDescriptor) if (&from == this) return; Clear(); MergeFrom(from); } bool ThreadDescriptor::IsInitialized() const { return true; } void ThreadDescriptor::InternalSwap(ThreadDescriptor* other) { using std::swap; _internal_metadata_.Swap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); thread_name_.Swap(&other->thread_name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); swap(pid_, other->pid_); swap(tid_, other->tid_); swap(legacy_sort_index_, other->legacy_sort_index_); swap(chrome_thread_type_, other->chrome_thread_type_); swap(reference_timestamp_us_, other->reference_timestamp_us_); swap(reference_thread_time_us_, other->reference_thread_time_us_); swap(reference_thread_instruction_count_, other->reference_thread_instruction_count_); } std::string ThreadDescriptor::GetTypeName() const { return "perfetto.protos.ThreadDescriptor"; } // @@protoc_insertion_point(namespace_scope) } // namespace protos } // namespace perfetto PROTOBUF_NAMESPACE_OPEN template<> PROTOBUF_NOINLINE ::perfetto::protos::ThreadDescriptor* Arena::CreateMaybeMessage< ::perfetto::protos::ThreadDescriptor >(Arena* arena) { return Arena::CreateInternal< ::perfetto::protos::ThreadDescriptor >(arena); } PROTOBUF_NAMESPACE_CLOSE // @@protoc_insertion_point(global_scope) #include <google/protobuf/port_undef.inc>
4bcf645f3ee86ec53f167e272284e9050b1001ec
6a117dfa4ec8b89301fc98beaa6efa227094bf1d
/proxy/http/HttpTransactCache.h
610f01221dfe3f4605fd1e6460b2b6c79d542021
[ "LicenseRef-scancode-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-3-Clause", "TCL", "MIT", "HPND", "ISC", "BSD-2-Clause" ]
permissive
pixiv/trafficserver
ab1e0736afdfee512d81ffc73b7d5b6eeef3f6bf
79b01ca4e98d1ffde94324ca25ec6c7c3fce5a03
refs/heads/release
2023-04-10T12:01:37.946504
2016-03-02T00:59:27
2016-03-02T00:59:27
52,246,093
1
1
Apache-2.0
2023-03-27T03:04:55
2016-02-22T04:05:04
C++
UTF-8
C++
false
false
4,954
h
HttpTransactCache.h
/** @file A brief file description @section license License Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /**************************************************************************** HttpTransactCache.h -- Created On : Thu Mar 26 17:19:35 1998 ****************************************************************************/ #if !defined(_HttpTransactCache_h_) #define _HttpTransactCache_h_ #include "libts.h" struct CacheHTTPInfoVector; class CacheLookupHttpConfig { public: bool cache_global_user_agent_header; // 'global' user agent flag (don't need to marshal/unmarshal) bool cache_enable_default_vary_headers; unsigned ignore_accept_mismatch; unsigned ignore_accept_language_mismatch; unsigned ignore_accept_encoding_mismatch; unsigned ignore_accept_charset_mismatch; char *cache_vary_default_text; char *cache_vary_default_images; char *cache_vary_default_other; inkcoreapi int marshal_length(); inkcoreapi int marshal(char *buf, int length); int unmarshal(Arena *arena, const char *buf, int length); CacheLookupHttpConfig() : cache_global_user_agent_header(false), cache_enable_default_vary_headers(false), ignore_accept_mismatch(0), ignore_accept_language_mismatch(0), ignore_accept_encoding_mismatch(0), ignore_accept_charset_mismatch(0), cache_vary_default_text(NULL), cache_vary_default_images(NULL), cache_vary_default_other(NULL) { } void *operator new(size_t size, void *mem); void operator delete(void *mem); }; extern ClassAllocator<CacheLookupHttpConfig> CacheLookupHttpConfigAllocator; // this is a global CacheLookupHttpConfig used to bypass SelectFromAlternates extern CacheLookupHttpConfig global_cache_lookup_config; inline void *CacheLookupHttpConfig::operator new(size_t size, void *mem) { (void)size; return mem; } inline void CacheLookupHttpConfig::operator delete(void *mem) { CacheLookupHttpConfigAllocator.free((CacheLookupHttpConfig *)mem); } enum Variability_t { VARIABILITY_NONE = 0, VARIABILITY_SOME, VARIABILITY_ALL, }; enum ContentEncoding { NO_GZIP = 0, GZIP, }; class HttpTransactCache { public: ///////////////////////////////// // content negotiation support // ///////////////////////////////// static int SelectFromAlternates(CacheHTTPInfoVector *cache_vector_data, HTTPHdr *client_request, CacheLookupHttpConfig *cache_lookup_http_config_params); static float calculate_quality_of_match(CacheLookupHttpConfig *http_config_params, HTTPHdr *client_request, // in HTTPHdr *obj_client_request, // in HTTPHdr *obj_origin_server_response); // in static float calculate_quality_of_accept_match(MIMEField *accept_field, MIMEField *content_field); static float calculate_quality_of_accept_charset_match(MIMEField *accept_field, MIMEField *content_field, MIMEField *cached_accept_field = NULL); static float calculate_quality_of_accept_encoding_match(MIMEField *accept_field, MIMEField *content_field, MIMEField *cached_accept_field = NULL); static ContentEncoding match_gzip(MIMEField *accept_field); static float calculate_quality_of_accept_language_match(MIMEField *accept_field, MIMEField *content_field, MIMEField *cached_accept_field = NULL); /////////////////////////////////////////////// // variability & server negotiation routines // /////////////////////////////////////////////// static Variability_t CalcVariability(CacheLookupHttpConfig *http_config_params, HTTPHdr *client_request, // in HTTPHdr *obj_client_request, // in HTTPHdr *obj_origin_server_response // in ); static HTTPStatus match_response_to_request_conditionals(HTTPHdr *ua_request, HTTPHdr *c_response); }; #endif
e1d3d6f66b79af800473c60e42323a28743e34df
b095e81d47a637f9a57212dcad0be038c0a3cfe3
/include/v4l2reader.h
5adb003f608c5daffeeb84e37dff3dce3a7b33b5
[]
no_license
pkarasev3/dvgrab
4d372a22d58a11ee9398c46a6b381ed9edc68b17
5d85eef4520190017c7719b0b3a8145329c2fd54
refs/heads/master
2016-09-05T10:40:24.386015
2011-06-14T19:06:42
2011-06-14T19:06:42
1,892,453
0
0
null
null
null
null
UTF-8
C++
false
false
1,533
h
v4l2reader.h
/* * ieee1394io.cc -- grab DV/MPEG-2 from V4L2 * Copyright (C) 2007 Dan Dennedy <dan@dennedy.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _V4L2IO_H #define _V4L2IO_H 1 #if 1 #include <config.h> #endif #ifdef HAVE_LINUX_VIDEODEV2_H #include "ieee1394io.h" class Frame; class v4l2Reader: public IEEE1394Reader { public: v4l2Reader( const char *filename, int frames = 50, bool hdv = false ); ~v4l2Reader(); bool Open( void ); void Close( void ); bool StartReceive( void ); void StopReceive( void ); bool StartThread( void ); void StopThread( void ); void* Thread( void ); private: struct buffer { void *start; size_t length; }; static void* ThreadProxy( void *arg ); bool Handler( void ); int ioctl( int request, void *arg ); const char* m_device; int m_fd; unsigned int m_bufferCount; struct buffer* m_buffers; }; #endif #endif
fce620475808f53657a58310dcb5b469d6ed80cb
1c0e204cead5c568f70643b7641adea429a12163
/Item_Manager/Item/UserType.h
5bf63aa54d08c9ce2cf1b375f876dd5b3360bac3
[]
no_license
andyworkingholiday/Data_Structure
a1ebb339ac3161c7f702c36f31b90557890b5665
897750ffa1616942f4065b4941f658bcd7793e44
refs/heads/master
2021-04-21T06:48:58.191342
2020-10-20T05:18:02
2020-10-20T05:18:02
249,758,447
0
0
null
null
null
null
UHC
C++
false
false
3,966
h
UserType.h
#ifndef _USER_TYPE_H #define _USER_TYPE_H class UserType { protected: string m_sID; ///< user's ID string m_sPW; ///< user's password string m_sName; ///< user's name public: /** * default constructor. */ UserType() { m_sID = ""; m_sPW = ""; m_sName = ""; }; /** * parameterized constructor. */ UserType(string inID, string inPW, string inName) { m_sID = inID; m_sPW = inPW; m_sName = inName; } /** * destructor. */ ~UserType() {}; /** * @brief Get user ID. * @pre user ID is set. * @post none. * @return user ID. */ string GetID() { return m_sID; } /** * @brief Get user password. * @pre user password is set. * @post none. * @return user password. */ string GetPW() { return m_sPW; } /** * @brief Get user name. * @pre user name is set. * @post none. * @return user name. */ string GetName() { return m_sName; } /** * @brief Set user ID. * @pre none. * @post user ID is set. * @param inID user ID. */ void SetID(string inID) { m_sID = inID; } /** * @brief Set user password. * @pre none. * @post user password is set. * @param inPW user password. */ void SetPW(string inPW) { m_sPW = inPW; } /** * @brief Set user name. * @pre none. * @post user name is set. * @param inName user name. */ void SetName(string inName) { m_sName = inName; } /** * @brief Set user record. * @pre none. * @post user record is set. * @param inID user ID. * @param inPW user password. * @param inName user name. */ void SetRecord(string inID, string inPW, string inName) { SetID(inID); SetPW(inPW); SetName(inName); } /** * @brief Display user ID on screen. * @pre user ID is set. * @post user ID is on screen. */ void DisplayIDOnScreen() { cout << "\tID\t : " << m_sID << endl; } /** * @brief Display user password on screen. * @pre user password is set. * @post user password is on screen. */ void DisplayPWOnScreen() { cout << "\tPW\t : " << m_sPW << endl; } /** * @brief Display user name on screen. * @pre user name is set. * @post user name is on screen. */ void DisplayNameOnScreen() { cout << "\tName\t : " << m_sName << endl; } /** * @brief Display an user record on screen. * @pre user record is set. * @post user record is on screen. */ void DisplayRecordOnScreen() { cout << endl; DisplayIDOnScreen(); DisplayPWOnScreen(); DisplayNameOnScreen(); } /** * @brief Set user ID from keyboard. * @pre none. * @post user ID is set. */ void SetIDFromKB(); /** * @brief Set user passwoed from keyboard. * @pre none. * @post user password is set. */ void SetPWFromKB(); /** * @brief Set user name from keyboard. * @pre none. * @post user name is set. */ void SetNameFromKB(); /** * @brief Set user record from keyboard. * @pre none. * @post user record is set. */ void SetRecordFromKB(); /** * @brief Read a record from file. * @pre the target file is opened. * @post student record is set. * @param fin file descriptor. * @return return 1 if this function works well, otherwise 0. */ int ReadDataFromFile(ifstream& fin); /** * @brief Write a record into file. * @pre the target file is opened. And the list should be initialized. * @post the target file is included the new student record. * @param fout file descriptor. * @return return 1 if this function works well, otherwise 0. */ int WriteDataToFile(ofstream& fout); // 연산자 오버로딩 bool operator==(const UserType& data) { return (this->m_sID == data.m_sID); } bool operator!=(const UserType& data) { return !(*this == data); } bool operator<(const UserType& data) { if (this->m_sID < data.m_sID) return true; else return false; } bool operator<=(const UserType& data) { return (*this == data || *this < data); } bool operator>(const UserType& data) { return !(*this <= data); } bool operator>=(const UserType& data) { return !(*this < data); } }; #endif // _USER_TYPE_H
2ac7699ad83705982ae8782c4cd16b7b5c5c8400
35815d4ec2a07fc2154897b55d9b9d834ef7fb31
/benchmarks/openjpeg/src/lib/openjp2/opj_clock.c
bb4cae734ad075705fee65bd8769bb51e282804c
[ "Apache-2.0", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
fuzzm/fuzzm-project
4401058e9630375c2d37b8fa63423e80fd2d1c3e
93c7a7e6c934a6de106c27d2042baa6938685d54
refs/heads/master
2023-08-27T12:27:42.207317
2021-10-25T18:19:56
2021-10-25T18:19:56
356,208,272
28
4
Apache-2.0
2021-08-25T10:34:18
2021-04-09T09:09:45
C
UTF-8
C++
false
false
2,776
c
opj_clock.c
/* * The copyright in this software is being made available under the 2-clauses * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * * Copyright (c) 2005, Herve Drolon, FreeImage Team * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include "opj_includes.h" #ifdef _WIN32 #include <windows.h> #else #include <sys/time.h> #include <sys/resource.h> #include <sys/times.h> #endif /* _WIN32 */ OPJ_FLOAT64 opj_clock(void) { #ifdef _WIN32 /* _WIN32: use QueryPerformance (very accurate) */ LARGE_INTEGER freq , t ; /* freq is the clock speed of the CPU */ QueryPerformanceFrequency(&freq) ; /* cout << "freq = " << ((double) freq.QuadPart) << endl; */ /* t is the high resolution performance counter (see MSDN) */ QueryPerformanceCounter ( & t ) ; return ( t.QuadPart /(OPJ_FLOAT64) freq.QuadPart ) ; #else /* Unix or Linux: use resource usage */ struct rusage t; OPJ_FLOAT64 procTime; /* (1) Get the rusage data structure at this moment (man getrusage) */ getrusage(0,&t); /* (2) What is the elapsed time ? - CPU time = User time + System time */ /* (2a) Get the seconds */ procTime = (OPJ_FLOAT64)(t.ru_utime.tv_sec + t.ru_stime.tv_sec); /* (2b) More precisely! Get the microseconds part ! */ return ( procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6 ) ; #endif }
cb872502f4ce21e106ce7b2eabfb16254147ca24
1bbfeca83bac53d22b1110ca7f6c9a28bc46c22e
/ru-olymp-train-winter-2009/Submits/081220b/15_55_08_12_A_1848.cpp
54da7d3029bcefa2be04b35fd99cbd3169e2d201
[]
no_license
stden/olymp
a633c1dfb1dd8d184a123d6da89f46163d5fad93
d85a4bb0b88797ec878b64db86ad8ec8854a63cd
refs/heads/master
2016-09-06T06:30:56.466755
2013-07-13T08:48:16
2013-07-13T08:48:16
5,158,472
1
0
null
null
null
null
UTF-8
C++
false
false
1,030
cpp
15_55_08_12_A_1848.cpp
#include <iostream> #include <algorithm> #include <iomanip> #include <functional> #include <sstream> #include <set> #include <map> #include <queue> #include <cstring> using namespace std; int const N=10005; int a[N], b[N]; void get(int *a) { char s[N]; scanf("%s", s); int n=strlen(s); a[0]=n; for (int i=1; i<=n; i++) a[i]=s[n-i]-'0'; } void put(int *a) { for (int i=a[0]; i>0; i--) printf ("%d", a[i]); } int cmp(int *a, int *b) { if (a[0]!=b[0]) return a[0]<b[0] ? -1 : 1; for (int i=a[0]; i>0; i--) if (a[i]!=b[i]) return a[i]<b[i] ? -1 : 1; return 0; } void sub(int *a, int *b) { for (int i=1; i<=b[0]; i++) a[i]-=b[i]; for (int i=1; i<=a[0]; i++) if (a[i]<0) a[i]+=10, a[i+1]--; while(a[0]>1 && a[a[0]]==0) a[0]--; } int main () { freopen("aplusminusb.in", "r", stdin); freopen("aplusminusb.out", "w", stdout); get(a); get(b); if (cmp(a, b)<0) { printf ("-"); sub(b, a); put(b); } else { sub(a, b); put(a); } return 0; }
4a4364c41851bee6364d929ee57444d3ef1db7cb
604b98184de326e87b6bc290763b4bcede48eea6
/cpp/constructBinaryTreeFromInorderAndPostorderTraversal/constructBinaryTreeFromInorderAndPostorderTraversal.cpp
df7edf8b46c7b5f030ed7968c65b2a07845d29d6
[]
no_license
xienan6/leetcode
b980fb736e8dac34e5c137afeeb35dddd10eed1e
da16b439f0f3b7c146c42191c66cda1bec0b3e94
refs/heads/master
2020-04-09T12:38:31.567787
2020-01-14T05:44:34
2020-01-14T05:44:34
160,358,300
5
0
null
null
null
null
UTF-8
C++
false
false
1,374
cpp
constructBinaryTreeFromInorderAndPostorderTraversal.cpp
// Source : https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ // Author : Nan // Date : 2019-04-02 // Runtime: 16 ms /* * Recursion. The last one in postorder is root. * Find index i in inorder. [0,i-1] is left tree * and [i+1, :] is right tree. * * Time complexity O(n), Space complexity O(n) */ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) { unordered_map<int, int> m; for (int i = 0; i < inorder.size(); ++i) m[inorder[i]] = i; return getSubTree(inorder, postorder, 0, inorder.size() - 1, 0, postorder.size() - 1, m); } TreeNode* getSubTree(vector<int>& inorder, vector<int>& postorder, int iLeft, int iRight, int pLeft, int pRight, unordered_map<int, int> &m) { if (pLeft > pRight || iLeft > iRight) return NULL; int i = m[postorder[pRight]]; TreeNode *cur = new TreeNode(postorder[pRight]); cur->left = getSubTree(inorder, postorder, iLeft, i - 1, pLeft, pLeft + i - 1 - iLeft, m); cur->right = getSubTree(inorder, postorder, i + 1, iRight, pLeft + i - iLeft, pRight - 1, m); return cur; } };
1ff2851f374ecf6bca22a3cb5812cb95a7dd8b20
58eee66e7025a0758c82ba10066f0676724f7e58
/FinalProject_Aditi-Mehta_Anish-Narsian/grammar.h
60f40d7e0843de52896738ed23a25ad142401ed0
[]
no_license
anarsian/OpenGL-project
6241832e1e12ea0e8c3ec7344715639dbfc2b131
80878e9fe5e129cd5c6bb5b78869699acc875a1e
refs/heads/master
2021-01-15T20:58:08.760753
2014-12-31T18:51:07
2014-12-31T18:51:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
864
h
grammar.h
// // grammar.h // Final Project // // Created by anish Narsian on 12/10/14. // Copyright (c) 2014 Anish Narsian. All rights reserved. // #ifndef __Final_Project__grammar__ #define __Final_Project__grammar__ #include <stdio.h> #include <vector> #include <string> #include "Vector3.h" #include "Turtle.h" #include <stack> #include "Vector4.h" class Grammar { public: double minX; double minY; double minZ; double maxX; double maxY; double maxZ; Turtle trt; std::stack<Vector4> st; float randomVal, dist_length; //std::vector<Vector3> structure; std::string str; Grammar(); void grow(); void grow3(); void render(float dist); void line(double x, double y, double z); void rotRight(); void rotLeft(); void makeChild(); }; #endif /* defined(__Final_Project__grammar__) */
f5a46dc16d2a85d1bb846f8cc30d606c9037fc4b
35918be245e2857156fd9e646aa53c5757f33573
/src/wmesh_io.cpp
125a2f7d3444f356a22d2f38f086326d7944ed67
[]
no_license
YvanMokwinski/WGRID
d795b635f6214d1b07cadea844c426e29c67511c
e35bc0ff51fb65cd13086aae65bb00787818188b
refs/heads/master
2022-11-12T21:41:20.986032
2020-07-08T18:42:28
2020-07-08T18:42:28
258,705,105
0
0
null
null
null
null
UTF-8
C++
false
false
13,331
cpp
wmesh_io.cpp
#include <array> #include <stdlib.h> #include <string.h> #include <stdarg.h> #include <valarray> #include <iostream> #include "wmesh-types.hpp" #include "wmesh-status.h" #include <chrono> //#include "wfe_element.h" #include "bms.h" #include <array> #include <string.h> #include <stdarg.h> #include <valarray> #include <iostream> #include "wmesh-types.hpp" #include "wmesh-status.h" #include "wmesh_t.hpp" #include <chrono> #include <fstream> #include <iostream> #include <iomanip> using namespace std::chrono; using namespace std::chrono; extern "C" { wmesh_status_t wmesh_write_medit(const wmesh_t* self_, bool is_binary_, const char * filename_, ...) { WMESH_CHECK_POINTER(self_); WMESH_CHECK_POINTER(filename_); wmesh_status_t status; wmesh_str_t filename; { va_list args; va_start(args,filename_); vsprintf(filename,filename_,args); va_end(args); } int64_t inm; int32_t version; if (is_binary_) { #if WMESH_ILP64 version = 4; #else version = 3; #endif } else { version = 1; } status = bms_write_medit_open(&inm,filename,version,self_->m_coo_m); WMESH_STATUS_CHECK(status); // // Write the geometry. // wmesh_int_t coo_m = self_->m_coo_m; wmesh_int_t coo_n = self_->m_coo_n; wmesh_int_t coo_ld = self_->m_coo_ld; const double*__restrict__ coo_v = self_->m_coo; status = bms_write_medit_geometry(inm, coo_m, coo_n, coo_v, coo_ld, self_->m_n_c.v, self_->m_n_c.ld); WMESH_STATUS_CHECK(status); status = bms_write_medit_topology(inm, self_->m_c2n.m_size, self_->m_c2n.m_ptr, self_->m_c2n.m_m, self_->m_c2n.m_n, self_->m_c2n.m_data, self_->m_c2n.m_ld, self_->m_c_c.m_size, self_->m_c_c.m_ptr, self_->m_c_c.m_m, self_->m_c_c.m_n, self_->m_c_c.m_data, self_->m_c_c.m_ld); WMESH_STATUS_CHECK(status); #if 0 if (self_->m_bf2n.m_size > 0) { status = bms_write_medit_topology(inm, self_->m_bf2n.m_size, self_->m_bf2n.m_ptr, self_->m_bf2n.m_m, self_->m_bf2n.m_n, self_->m_bf2n.m_data, self_->m_bf2n.m_ld, self_->m_bf_c.m_size, self_->m_bf_c.m_ptr, self_->m_bf_c.m_m, self_->m_bf_c.m_n, self_->m_bf_c.m_data, self_->m_bf_c.m_ld); WMESH_STATUS_CHECK(status); } #endif // // Close. // status = bms_medit_close(inm); WMESH_STATUS_CHECK(status); return WMESH_STATUS_SUCCESS; }; wmesh_status_t wmesh_read_medit(wmesh_t** self__, bool is_binary_, const char * filename_, ...) { wmesh_status_t status; char filename[256]; { va_list args; va_start(args,filename_); vsprintf(filename,filename_,args); va_end(args); } int32_t dim; int32_t version; int64_t inm; status = bms_read_medit_open(filename, &inm, &version, &dim); WMESH_STATUS_CHECK(status); int32_t ref_version = 1; if (is_binary_) { #if WMESH_ILP64 ref_version = 4; #else ref_version = 3; #endif } else { ref_version = 1; } if (version != ref_version) { std::cerr << "// ERROR::wmesh_read_medit: the version " << version << " is incompatible with the installation one (=" << ref_version << ")" << std::endl; WMESH_STATUS_CHECK(WMESH_STATUS_INVALID_CONFIG); } wmesh_int_t topology_dimension = 0, num_nodes = 0, num_edges = 0, num_triangles = 0, num_quadrilaterals = 0, num_tetrahedra = 0, num_pyramids = 0, num_wedges = 0, num_hexahedra = 0; status = bms_read_medit_stat(inm, &num_nodes, &num_edges, &num_triangles, &num_quadrilaterals, &num_tetrahedra, &num_pyramids, &num_wedges, &num_hexahedra); WMESH_STATUS_CHECK(status); // std::cout << "numnodes " << num_nodes << std::endl; wmesh_int_t coo_m = dim; wmesh_int_t coo_n = num_nodes; wmesh_int_t coo_ld = coo_m; double * coo_v = nullptr; wmesh_int_t nflags_ld = 1; wmesh_int_p nflags_v; wmesh_int_t c2n_size = 0; wmesh_int_t c2n_ptr[4+1]; wmesh_int_t c2n_m[4]{4,5,6,8}; wmesh_int_t c2n_n[4]; wmesh_int_t c2n_ld[4]; wmesh_int_p c2n_v = nullptr; wmesh_int_t c_c_size = 0; wmesh_int_t c_c_ptr[4+1]; wmesh_int_t c_c_m[4]{1,1,1,1}; wmesh_int_t c_c_n[4]; wmesh_int_t c_c_ld[4]; wmesh_int_p c_c_v = nullptr; c2n_n[0] = num_tetrahedra; c2n_n[1] = num_pyramids; c2n_n[2] = num_wedges; c2n_n[3] = num_hexahedra; wmesh_int_t bf2n_size = 0; wmesh_int_t bf2n_ptr[2+1]; wmesh_int_t bf2n_m[2]{3,4}; wmesh_int_t bf2n_n[2]; wmesh_int_t bf2n_ld[2]; wmesh_int_p bf2n_v = nullptr; wmesh_int_t bf_c_size = 0; wmesh_int_t bf_c_ptr[4+1]; wmesh_int_t bf_c_m[4]{1,1,1,1}; wmesh_int_t bf_c_n[4]; wmesh_int_t bf_c_ld[4]; wmesh_int_p bf_c_v = nullptr; wmesh_int_t total_num_bfaces = 0; wmesh_int_t total_num_cells = c2n_n[0] + c2n_n[1] + c2n_n[2] + c2n_n[3]; if (total_num_cells > 0) { topology_dimension = 3; c2n_size = 4; bf2n_n[0] = num_triangles; bf2n_n[1] = num_quadrilaterals; total_num_bfaces = bf2n_n[0] + bf2n_n[1]; if (total_num_bfaces > 0) { bf2n_size = 2; } } else { c2n_m[0] = 3; c2n_m[1] = 4; c2n_n[0] = num_triangles; c2n_n[1] = num_quadrilaterals; total_num_cells = c2n_n[0] + c2n_n[1]; if (total_num_cells > 0) { topology_dimension = 2; c2n_size = 2; bf2n_n[0] = num_edges; total_num_bfaces = bf2n_n[0]; if (total_num_bfaces > 0) { bf2n_m[0] = 2; bf2n_size = 1; } } else { c2n_n[0] = num_edges; total_num_cells = c2n_n[0]; if (total_num_cells > 0) { topology_dimension = 1; c2n_size = 1; } else { return WMESH_STATUS_INVALID_CONFIG; } } } c_c_size = c2n_size; for (wmesh_int_t i=0;i<c2n_size;++i) c_c_n[i] = c2n_n[i]; for (wmesh_int_t i=0;i<c2n_size;++i) c_c_ld[i] = c_c_m[i]; c_c_ptr[0] = 0; for (wmesh_int_t i=0;i<c2n_size;++i) c_c_ptr[i+1] = c_c_ptr[i] + c_c_n[i] * c_c_ld[i]; bf_c_size = bf2n_size; for (wmesh_int_t i=0;i<bf2n_size;++i) bf_c_n[i] = bf2n_n[i]; for (wmesh_int_t i=0;i<bf2n_size;++i) bf_c_ld[i] = bf_c_m[i]; bf_c_ptr[0] = 0; for (wmesh_int_t i=0;i<bf2n_size;++i) bf_c_ptr[i+1] = bf_c_ptr[i] + bf_c_n[i] * bf_c_ld[i]; for (wmesh_int_t i=0;i<c2n_size;++i) { c2n_ld[i] = c2n_m[i]; } c2n_ptr[0] = 0; for (wmesh_int_t i=0;i<c2n_size;++i) { c2n_ptr[i+1] = c2n_ptr[i] + c2n_ld[i] * c2n_n[i]; } for (wmesh_int_t i=0;i<c2n_size;++i) { bf2n_ld[i] = bf2n_m[i]; } bf2n_ptr[0] = 0; for (wmesh_int_t i=0;i<bf2n_size;++i) { bf2n_ptr[i+1] = bf2n_ptr[i] + bf2n_ld[i] * bf2n_n[i]; } if (bf2n_size > 0) { bf2n_v = (wmesh_int_p)malloc(bf2n_ptr[bf2n_size] * sizeof(wmesh_int_t)); bf_c_v = (wmesh_int_p)malloc(bf_c_ptr[bf_c_size] * sizeof(wmesh_int_t)); } c2n_v = (wmesh_int_p)malloc(c2n_ptr[c2n_size] * sizeof(wmesh_int_t)); c_c_v = (wmesh_int_p)malloc(c_c_ptr[c_c_size]*sizeof(wmesh_int_t)); nflags_v = (wmesh_int_p)malloc(num_nodes*sizeof(wmesh_int_t)); coo_v = (double*)malloc((3*num_nodes)*sizeof(double)); if (!coo_v) { WMESH_STATUS_CHECK(WMESH_STATUS_ERROR_MEMORY); } status = bms_read_medit_geometry(inm, coo_m, coo_n, coo_v, coo_ld, nflags_v, nflags_ld); WMESH_STATUS_CHECK(status); status = bms_read_medit_topology(inm, c2n_size, c2n_ptr, c2n_m, c2n_n, c2n_v, c2n_ld, c_c_size, c_c_ptr, c_c_m, c_c_n, c_c_v, c_c_ld); WMESH_STATUS_CHECK(status); if (bf2n_size > 0) { status = bms_read_medit_topology(inm, bf2n_size, bf2n_ptr, bf2n_m, bf2n_n, bf2n_v, bf2n_ld, bf_c_size, bf_c_ptr, bf_c_m, bf_c_n, bf_c_v, bf_c_ld); WMESH_STATUS_CHECK(status); } status = bms_medit_close(inm); WMESH_STATUS_CHECK(status); status = wmesh_factory(self__, topology_dimension, c2n_size, c2n_ptr, c2n_m, c2n_n, c2n_v, c2n_ld, c_c_size, c_c_ptr, c_c_m, c_c_n, c_c_v, c_c_ld, bf2n_size, bf2n_ptr, bf2n_m, bf2n_n, bf2n_v, bf2n_ld, bf_c_size, bf_c_ptr, bf_c_m, bf_c_n, bf_c_v, bf_c_ld, dim, num_nodes, coo_v, coo_ld, nflags_v, 1); return WMESH_STATUS_SUCCESS; }; typedef enum __eVtkElement{ ERROR=0, VERTEX=1, POLYVERTEX=2, LINE=3, POLYLINE=4, TRIANGLE=5, TRIANGLE_STRIP=6, POLYGON=7, PIXEL=8, QUAD=9, TETRA=10, VOXEL=11, HEXA=12, WEDGE=13, PYRAMID=14, QUADRATICEDGE=21, QUADRATICTRIANGLE=22, QUADRATICQUAD=23, QUADRATICTETRA=24, QUADRATICHEXA=25, ALL} eVtkElement; wmesh_status_t wmesh_write_vtk(const wmesh_t* self__, const char * filename_, ...) { wmesh_t*self_ = (wmesh_t*)self__; wmesh_str_t filename; { va_list args; va_start(args,filename_); vsprintf(filename,filename_,args); va_end(args); } std::ofstream out(filename); out.precision(15); out.setf(std::ios::scientific); out << "# vtk DataFile Version 3.0" << std::endl << "vtk output" << std::endl << "ASCII" << std::endl << "DATASET UNSTRUCTURED_GRID" << std::endl << "POINTS " << self_->m_num_nodes << " double" << std::endl; // geometry for (wmesh_int_t i=0;i<self_->m_num_nodes;++i) { for (wmesh_int_t j=0;j<self_->m_coo_m;++j) { out << " " << self_->m_coo[self_->m_coo_ld*i+j]; } out << std::endl; } unsigned long long int total_numCellsData = 0; wmesh_int_t num_cells = 0; for (wmesh_int_t i=0;i<self_->m_c2n.m_size;++i) { num_cells += self_->m_c2n.m_n[i]; } // topology for (wmesh_int_t i=0;i<self_->m_c2n.m_size;++i) { wmesh_int_t m = self_->m_c2n.m_m[i]; wmesh_int_t n = self_->m_c2n.m_n[i]; total_numCellsData += n * ( 1 + m ); } out << "CELLS " << num_cells << " " << total_numCellsData << std::endl; for (wmesh_int_t i=0;i<self_->m_c2n.m_size;++i) { wmesh_int_t m = self_->m_c2n.m_m[i]; wmesh_int_t n = self_->m_c2n.m_n[i]; wmesh_int_t ld = self_->m_c2n.m_ld[i]; wmesh_int_t ptr = self_->m_c2n.m_ptr[i]; const_wmesh_int_p x = self_->m_c2n.m_data + ptr; for (wmesh_int_t idx =0;idx<n;++idx) { out << m; for (wmesh_int_t j=0;j<m;++j) { out << " " << x[idx * ld + j]-1; } out << std::endl; } } out << "CELL_TYPES " << num_cells << std::endl; if (self_->m_topology_dimension == 3) { if (self_->m_c2n.m_n[0]>0) { for (wmesh_int_t idx =0;idx<self_->m_c2n.m_n[0];++idx) { out << TETRA << std::endl; } } if (self_->m_c2n.m_n[1]>0) { for (wmesh_int_t idx =0;idx<self_->m_c2n.m_n[1];++idx) { out << PYRAMID << std::endl; } } if (self_->m_c2n.m_n[2]>0) { for (wmesh_int_t idx =0;idx<self_->m_c2n.m_n[2];++idx) { out << WEDGE << std::endl; } } if (self_->m_c2n.m_n[3]>0) { for (wmesh_int_t idx =0;idx<self_->m_c2n.m_n[3];++idx) { out << HEXA << std::endl; } } } else if (self_->m_topology_dimension == 2) { if (self_->m_c2n.m_n[0]>0) { for (wmesh_int_t idx =0;idx<self_->m_c2n.m_n[0];++idx) { out << TRIANGLE << std::endl; } } if (self_->m_c2n.m_n[1]>0) { for (wmesh_int_t idx =0;idx<self_->m_c2n.m_n[1];++idx) { out << QUAD << std::endl; } } } else if (self_->m_topology_dimension == 1) { if (self_->m_c2n.m_n[0]>0) { for (wmesh_int_t idx =0;idx<self_->m_c2n.m_n[0];++idx) { out << LINE << std::endl; } } } out << "CELL_DATA " << num_cells << std::endl; out << "SCALARS scalars int 1" << std::endl; out << "LOOKUP_TABLE default" << std::endl; for (wmesh_int_t s = 0;s<self_->m_c_c.m_size ;++s) { for (wmesh_int_t j = 0;j < self_->m_c_c.m_n[ s ];++j) { for (wmesh_int_t i = 0;i < self_->m_c_c.m_m[ s ];++i) { out << self_->m_c_c.m_data[self_->m_c_c.m_ptr[s] + self_->m_c_c.m_ld[s] * j + i ] << std::endl; } } } out.close(); return WMESH_STATUS_SUCCESS; } }
510b0dd9f506861f3579f22e2f3ec06a7d7da948
6a771be9d2594a17977e12604991f5dd6c7149a8
/Solver/CardLocation.h
4296b28a889b15738bba2568aa71f7a2eb270819
[]
no_license
notjulie/Seahaven
ea5ddf2b4f6d1bdbae6907250c3f61122ebf180d
8334c63cf5a14c7b74e2ef70f99b848a83ec6976
refs/heads/master
2022-03-14T00:15:53.200880
2020-11-27T20:31:22
2020-11-27T20:31:22
205,562,438
0
0
null
2022-02-26T01:21:33
2019-08-31T15:31:47
JavaScript
UTF-8
C++
false
false
2,707
h
CardLocation.h
// // Seahaven Solver project // // Author: Randy Rasmussen // Copyright: None // Warranty: At your own risk // #ifndef CARDLOCATION_H #define CARDLOCATION_H #include "LinkID.h" #include "Suit.h" /// <summary> /// Structure representing the location of a card. Formerly just a wrapper around a LinkID, /// it is now expanded to be a friendlier face on LinkID. /// </summary> struct alignas(1) CardLocation { public: constexpr CardLocation(void); public: LinkID linkID; bool onColumn : 1; bool isThrone : 1; bool isTower : 1; bool isAce : 1; uint8_t row : 3; union { Suit suit; uint8_t column; }; public: // all we card about for equality is the link ID; if there are other differences it // is because someone is modifying the location object after creating it, which is stupid inline bool operator==(CardLocation card) const { return card.linkID == linkID; } inline bool operator!=(CardLocation card) const { return card.linkID != linkID; } public: static constexpr CardLocation Null(void); static const CardLocation Aces[4]; static const CardLocation Columns[10][5]; static const CardLocation Thrones[4]; static const CardLocation Towers[4]; static const CardLocation Links[(uint8_t)LinkID::LINK_COUNT_INCLUDING_NO_LINK]; private: static constexpr CardLocation FromLinkID(LinkID linkID); }; static_assert(sizeof(CardLocation)<=3, "CardLocation is getting chubby"); constexpr CardLocation CardLocation::FromLinkID(LinkID linkID) { CardLocation result; result.linkID = linkID; if ((uint8_t)linkID >= (uint8_t)LinkID::FIRST_COLUMN_LINK && (uint8_t)linkID - (uint8_t)LinkID::FIRST_COLUMN_LINK < 50) { result.onColumn = true; result.row = ((uint8_t)linkID - (uint8_t)LinkID::FIRST_COLUMN_LINK) % 5; result.column = ((uint8_t)linkID - (uint8_t)LinkID::FIRST_COLUMN_LINK) / 5; } else if ((uint8_t)linkID >= (uint8_t)LinkID::FIRST_THRONE_LINK && (uint8_t)linkID - (uint8_t)LinkID::FIRST_THRONE_LINK <= 3) { result.isThrone = true; result.suit = Suit::FromIndex((uint8_t)linkID - (uint8_t)LinkID::FIRST_THRONE_LINK); } else if ((uint8_t)linkID >= (uint8_t)LinkID::FIRST_ACE_LINK && (uint8_t)linkID - (uint8_t)LinkID::FIRST_ACE_LINK <= 3) { result.isAce = true; result.suit = Suit::FromIndex((uint8_t)linkID - (uint8_t)LinkID::FIRST_ACE_LINK); } else if ((uint8_t)linkID >= (uint8_t)LinkID::FIRST_TOWER_LINK && (uint8_t)linkID - (uint8_t)LinkID::FIRST_TOWER_LINK <= 3) { result.isTower = true; } return result; } constexpr CardLocation CardLocation::Null(void) { return CardLocation::FromLinkID(LinkID::NO_LINK); } #endif
bb1eed68d780832a0558bd10b9fbd34c73f6d69c
e16a3e66531da2797e95ffebb753ccf94971006d
/ULTRASONIC_SENSOR.ino
5e21d0703707403d2219e363bfbf7461cb64726a
[]
no_license
Sahanasnayak/Codes
3de67ec54c80025468a632e6c814d22f2c668ff7
2af13613c07002ab2738ef8e67d7449b6f0d75f9
refs/heads/master
2020-07-02T09:43:02.330681
2019-08-21T18:03:05
2019-08-21T18:03:05
201,490,547
0
0
null
null
null
null
UTF-8
C++
false
false
826
ino
ULTRASONIC_SENSOR.ino
#define trigpin 9 #define echopin 10 #define LED 5 #define switchpin 3 //long a; //int distance; void setup() { // put your setup code here, to run once: pinMode(echopin,INPUT); pinMode(trigpin,OUTPUT); Serial.begin(9600); pinMode(LED,OUTPUT); pinMode(switchpin,INPUT); } void loop() { int B; B=digitalRead(switchpin); if(B==HIGH){ // put your main code here, to run repeatedly: long a; long distance; //a=digitalRead(echopin); digitalWrite(trigpin,LOW); delayMicroseconds(2); digitalWrite(trigpin,HIGH); delayMicroseconds(10); digitalWrite(trigpin,LOW); a=pulseIn(echopin,HIGH); distance=(a*0.0321)/2; if(distance<10) { digitalWrite(LED,HIGH); } else { digitalWrite(LED,LOW); } Serial.print(distance); Serial.println("cm"); delay(500); } }
88c85db961e4cc9c9438d92de50bae0fb8f0d773
f2e71ead5a22f92fb97cef2661abe84d101f0ea8
/ゲーム制作プログラムファイル/GameProgramming/CVector.h
40a12562ecf1ebc08a97f9ecf5c476a09c00a93c
[]
no_license
Kato2020/Game2
7505bc5f24bc8c40afe30215d9ea2a58d14202db
44306d949f541cf237987121585f19c50af66f2e
refs/heads/master
2023-07-09T17:49:08.232893
2021-08-03T14:54:19
2021-08-03T14:54:19
368,017,298
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
1,217
h
CVector.h
#ifndef CVECTOR_H #define CVECTOR_H #include "CMatrix.h" /* ベクトルクラス ベクトルデータを扱います ベクトルは原点(0,0,0)からの移動量 */ class CVector{ public: //3D各軸での値を設定 //floatは小数型 float mX, mY, mZ; //各軸での値の設定 //Set(X座標,Y座標,Z座標) void Set(float x, float y, float z); //デフォルトコンストラクタ CVector(); //コンストラクタ //CVector(X座標,Y座標,Z座標) CVector(float x, float y, float z); //CVector*CMatrixの結果をCVectorで返す CVector operator*(const CMatrix &m); //-演算子のオーバーロード //CVector-CVectorの演算結果を返す CVector operator-(const CVector&v); //ベクトルの長さを返す float Length(); //内積 //Dot(ベクトル) float Dot(const CVector &v); //外積 //Cross(ベクトル) CVector Cross(const CVector &v); //*演算子のオーバーロード //CVector*floatの演算結果を返す CVector operator*(const float &f); //正規化 //大きさ1のベクトルを返す CVector Normalize(); //+演算子のオーバーロード //CVector+CVectorの演算結果を返す CVector operator+(const CVector &v); }; #endif
3f46dd4ef7300f01d9e9f5a58c08006bfb75f12a
99b20cdd80cd9be6fcc026a9a3498ffaa046bcd6
/libgpuimage/src/main/jni/interface/cgeDeformFilterWrapper.cpp
1bf44eea096bec19617d10c5a4ddb083bbcbed79
[ "Apache-2.0" ]
permissive
xuqiqiang/EasyCamera2-GPUImage
0833b41446e74e798b8b710937daff2a9ec6c4aa
546159a2982714de44b5c5d46597d33d1e40f670
refs/heads/master
2023-01-04T14:27:14.071480
2020-10-28T06:12:12
2020-10-28T06:12:12
297,629,811
5
2
null
null
null
null
UTF-8
C++
false
false
4,208
cpp
cgeDeformFilterWrapper.cpp
/* * cgeDeformFilterWrapper.cpp * * Created on: 2018-12-9 */ #include <cgeDeformFilterWrapper.h> #include <CGELiquifyFilter.h> using namespace CGE; extern "C" { JNIEXPORT jlong JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeCreate(JNIEnv *, jobject, jint width, jint height, jfloat stride) { auto* filter = new CGELiquifyFilter(); if(!filter->initWithMesh(width, height, stride)) { delete filter; filter = nullptr; } return (jlong)filter; } JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeRelease(JNIEnv *, jobject, jlong addr) { auto* filter = (CGELiquifyFilter*)addr; delete filter; } JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeRestore(JNIEnv *, jobject, jlong addr) { auto* filter = (CGELiquifyFilter*)addr; filter->restoreMesh(); } JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeRestoreWithIntensity(JNIEnv *, jobject, jlong addr, jfloat intensity) { auto* filter = (CGELiquifyFilter*)addr; filter->restoreMeshWithIntensity(intensity); } JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeForwardDeform(JNIEnv *, jobject, jlong addr, jfloat startX, jfloat startY, jfloat endX, jfloat endY, jfloat w, jfloat h, jfloat radius, jfloat intensity) { auto* filter = (CGELiquifyFilter*)addr; filter->forwardDeformMesh(Vec2f(startX, startY), Vec2f(endX, endY), w, h, radius, intensity); } JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeRestoreWithPoint(JNIEnv *, jobject, jlong addr, jfloat x, jfloat y, jfloat w, jfloat h, jfloat radius, jfloat intensity) { auto* filter = (CGELiquifyFilter*)addr; filter->restoreMeshWithPoint(Vec2f(x, y), w, h, radius, intensity); } JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeBloatDeform(JNIEnv *, jobject, jlong addr, jfloat x, jfloat y, jfloat w, jfloat h, jfloat radius, jfloat intensity) { auto* filter = (CGELiquifyFilter*)addr; filter->bloatMeshWithPoint(Vec2f(x, y), w, h, radius, intensity); } JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeWrinkleDeform(JNIEnv *, jobject, jlong addr, jfloat x, jfloat y, jfloat w, jfloat h, jfloat radius, jfloat intensity) { auto* filter = (CGELiquifyFilter*)addr; filter->wrinkleMeshWithPoint(Vec2f(x, y), w, h, radius, intensity); } JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeSetUndoSteps(JNIEnv *, jobject, jlong addr, jint steps) { auto* filter = (CGELiquifyFilter*)addr; filter->setUndoSteps(steps); } JNIEXPORT jboolean JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeCanUndo(JNIEnv *, jobject, jlong addr) { auto* filter = (CGELiquifyFilter*)addr; return filter->canUndo(); } JNIEXPORT jboolean JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeCanRedo(JNIEnv *, jobject, jlong addr) { auto* filter = (CGELiquifyFilter*)addr; return filter->canRedo(); } JNIEXPORT jboolean JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeUndo(JNIEnv *, jobject, jlong addr) { auto* filter = (CGELiquifyFilter*)addr; return filter->undo(); } JNIEXPORT jboolean JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeRedo(JNIEnv *, jobject, jlong addr) { auto* filter = (CGELiquifyFilter*)addr; return filter->redo(); } JNIEXPORT jboolean JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativePushDeformStep(JNIEnv *, jobject, jlong addr) { auto* filter = (CGELiquifyFilter*)addr; return filter->pushMesh(); } JNIEXPORT void JNICALL Java_org_wysaid_nativePort_CGEDeformFilterWrapper_nativeShowMesh(JNIEnv *, jobject, jlong addr, jboolean show) { auto* filter = (CGELiquifyFilter*)addr; filter->showMesh(show); } }
c584548386dbcd3e56850435d3f0d122a61ab416
9ffafb8b55f69d49c1f7a099775a479d3ea3f301
/includes/record.h
7effd0f9868e74bbaa746523d1f803930ec77d65
[]
no_license
Hienr/DBMS
ef48d9c62b533e2bf563290da7f1e831760e2a1b
0bbe51ec960e21c59c574eb796cae66f9b90d422
refs/heads/master
2021-02-16T09:38:33.038100
2020-04-23T17:24:51
2020-04-23T17:24:51
244,990,743
0
0
null
null
null
null
UTF-8
C++
false
false
830
h
record.h
#ifndef RECORDER_H #define RECORDER_H #include <iostream> #include <string.h> #include <fstream> #include <vector> #include <cassert> #include "fnc_array.h" using namespace std; class Record{ public: Record(); Record(vector<string> input); long write(fstream &outs); long read(fstream &ins, long recno); friend ostream& operator<<(ostream& outs, const Record& r){ r.print_record(outs); return outs; } string get_field_data(int field); vector<string> vectorize_fields(); void print_record(ostream& outs = cout) const; private: static const int MAX_CHARACTERS = 50, MAX_FIELDS = 10; long recno; char record[MAX_FIELDS][MAX_CHARACTERS]; }; #endif // RECORDER_H
ed5f33bbe5a7756e9d380b0989454d727999a370
2b1fd41b44de40a938f09622276c10d627cd1124
/enemy.h
b0224edbe0426952de0763f41147a373b1641ad9
[]
no_license
Team-2years/MapTool
36ebf19b0f42042e407d254fa1f1943e6974cad8
e43f9266f7681ef67a605bb39c72d4c30d7c2a2a
refs/heads/master
2023-06-25T08:31:33.483200
2021-07-28T03:35:21
2021-07-28T03:35:21
390,199,118
0
0
null
null
null
null
UHC
C++
false
false
797
h
enemy.h
#pragma once #include "gameNode.h" class enemy : public gameNode { protected: image* enemy_img; //에너미 이미지 animation* enemy_body; D2D1_RECT_F _rc; int _currentFrameX; //프레임번호로 사용할 변수 int _currentFrameY; int _count; //프레임렌더링 용 int _fireCount; //발사 카운트 용 int _Fire_interval; //발사 주기 int _direction; float _width; float _height; float _speed; float _angle; public: enemy() {}; ~enemy() {}; virtual HRESULT init(); virtual HRESULT init(const char* imageName, POINT position); virtual HRESULT init(const char* imageName, POINT position, int direction); virtual void release(); virtual void update(); virtual void render(); virtual void move(); virtual bool bullet_Fire(); void draw(); };
9a866d3c4f4bb272e3d680cbae51c57401a27285
55f01cb8735b333f17258180249dd6cc0784e7c2
/include/ecs/GraphicsSkyboxComponent.hpp
204b40eb650685fbec17696fd8161efea6dd6011
[ "MIT" ]
permissive
icebreakersentertainment/ice_engine
998b507ca9c01ac6d18b7f3e6071fd7469058dda
52a8313bc266c053366bdf554b5dc27a54ddcb25
refs/heads/master
2022-11-01T15:30:42.471040
2021-01-28T20:36:52
2021-01-28T20:36:52
114,183,848
0
2
MIT
2022-10-08T17:29:17
2017-12-14T00:43:44
C++
UTF-8
C++
false
false
1,036
hpp
GraphicsSkyboxComponent.hpp
#ifndef GRAPHICSSKYBOXCOMPONENT_H_ #define GRAPHICSSKYBOXCOMPONENT_H_ #include "graphics/SkyboxHandle.hpp" #include "graphics/SkyboxRenderableHandle.hpp" #include "ecs/Serialization.hpp" namespace ice_engine { namespace ecs { struct GraphicsSkyboxComponent { GraphicsSkyboxComponent() = default; GraphicsSkyboxComponent( graphics::SkyboxHandle skyboxHandle ) : skyboxHandle(skyboxHandle) { }; GraphicsSkyboxComponent( graphics::SkyboxHandle skyboxHandle, graphics::SkyboxRenderableHandle skyboxRenderableHandle ) : skyboxRenderableHandle(skyboxRenderableHandle), skyboxHandle(skyboxHandle) { }; static uint8 id() { return 16; } graphics::SkyboxHandle skyboxHandle; graphics::SkyboxRenderableHandle skyboxRenderableHandle; }; } } namespace boost { namespace serialization { template<class Archive> void serialize(Archive& ar, ice_engine::ecs::GraphicsSkyboxComponent& c, const unsigned int version) { ar & c.skyboxHandle & c.skyboxRenderableHandle; } } } #endif /* GRAPHICSSKYBOXCOMPONENT_H_ */
c1837e6b4bb90ee1005fc9724556bdc7fe77bef4
67c5ce99b87599182a28ee5066b8bf678bf535b7
/graphics/GlError.cpp
37a4e48d37846fc90146cc1fe48f1e5d5924c8bf
[]
no_license
igorhenri5/Collision
dd7fae4157ed0451b3a2c6ddc6ca6d0195eed373
10eb3af1216e5b465f87e54de112dd410eab39e9
refs/heads/master
2022-03-19T10:15:49.424039
2019-12-02T02:36:37
2019-12-02T02:36:37
217,926,741
1
1
null
null
null
null
UTF-8
C++
false
false
1,234
cpp
GlError.cpp
#include "GlError.hpp" void GlError::checkGlError(){ int error = glGetError(); std::string message = ""; switch(error){ case GL_INVALID_ENUM: message = "Invalid enum"; break; case GL_INVALID_VALUE: message = "Invalid value"; break; case GL_INVALID_OPERATION: message = "Invalid operation"; break; case GL_OUT_OF_MEMORY: message = "Out of memory"; } if(error != GL_NO_ERROR){ std::cout << message << std::endl; } } void GlError::checkShaderCompileError(int shader){ int compiled; glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); if(compiled == 0){ std::cout << "ERRO Shader Compilation"<< std::endl; } } void GlError::checkProgramLinkError(int program){ int linked; glGetProgramiv(program, GL_LINK_STATUS, &linked); if(linked == 0){ std::cout << "ERRO Program Link"<< std::endl; } } void GlError::checkProgramValidity(int program){ int validate; glValidateProgram(program); glGetProgramiv(program, GL_VALIDATE_STATUS, &validate); if(validate == 0){ std::cout << "ERRO Program Validate"<< std::endl; } }
e9bd4333d043fbcbb57acb487a749ac38a215df4
44bd52968b35d2a274cf8bc3d783c51f3e12a5bd
/server_old.cc
8ae1bf888f49d67311ad815f7fe1c60f1cd4fdd8
[]
no_license
smn98/KVStore
03629ea29205b53b28a60efb47667b958f86cda0
3ec3f0ce594468ab36529c8ebb42ef1113f434b8
refs/heads/master
2023-09-06T05:28:03.302854
2021-11-24T09:45:24
2021-11-24T09:45:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,863
cc
server_old.cc
#include <iostream> #include <memory> #include <string> #include <thread> #include <stdio.h> #include <fcntl.h> #include <sstream> #include "unistd.h" #include <grpc/support/log.h> #include <grpcpp/grpcpp.h> #include "keyvalue.grpc.pb.h" #include "storage.hpp" int THREADPOOL_SIZE = 4; using grpc::Server; using grpc::ServerAsyncResponseWriter; using grpc::ServerBuilder; using grpc::ServerCompletionQueue; using grpc::ServerContext; using grpc::Status; using keyvalue::KeyRequest; using keyvalue::KeyValueReply; using keyvalue::KeyValueRequest; using keyvalue::KVStore; class ServerImpl final { public: ~ServerImpl() { delete &storage_; server_->Shutdown(); for (int i = 0; i < THREADPOOL_SIZE; i++) cq_[i]->Shutdown(); } void Run() { ifstream f_config; f_config.open("config.txt"); string portno; getline(f_config, portno); string server_address("0.0.0.0:" + portno); string line; getline(f_config, line); getline(f_config, line); getline(f_config, line); stringstream ss(line); ss >> THREADPOOL_SIZE; cout << "THREADPOOL_SIZE " << THREADPOOL_SIZE << endl; cout << "port no. " << portno << endl; cq_ = new unique_ptr<ServerCompletionQueue>[THREADPOOL_SIZE]; ServerBuilder builder; builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); builder.RegisterService(&service_); for (int i = 0; i < THREADPOOL_SIZE; i++) cq_[i] = builder.AddCompletionQueue(); server_ = builder.BuildAndStart(); cout << "Server listening on " << server_address << endl; vector<thread> worker_threads; for (int i = 0; i < THREADPOOL_SIZE; ++i) worker_threads.push_back(thread(&ServerImpl::HandleRpcs, this, i)); for (auto i{0}; i < worker_threads.size(); i++) worker_threads[i].join(); } private: class CallData { public: virtual void Proceed() = 0; }; class GetKeyFunc final : public CallData { public: GetKeyFunc(KVStore::AsyncService *service, Storage *storage, ServerCompletionQueue *cq, int thread_id_) : service_(service), storage_(storage), cq_(cq), responder_(&ctx_), status_(CREATE), thread_id(thread_id_) { Proceed(); } void Proceed() { if (status_ == CREATE) { status_ = PROCESS; service_->RequestGetKey(&ctx_, &request_, &responder_, cq_, cq_, this); } else if (status_ == PROCESS) { //new client new GetKeyFunc(service_, storage_, cq_, thread_id); // The actual processing. storage_->reader_lock(); string result = storage_->handle_get(request_.key()); storage_->reader_unlock(); if (!result.compare("ERROR")) { reply_.set_message("KEY DOES NOT EXISTS"); reply_.set_status(400); } else { reply_.set_status(200); reply_.set_value(result); reply_.set_key(request_.key()); } reply_.set_timestamp(request_.timestamp()); status_ = FINISH; responder_.Finish(reply_, Status::OK, this); } else { GPR_ASSERT(status_ == FINISH); delete this; } } private: KVStore::AsyncService *service_; ServerCompletionQueue *cq_; ServerContext ctx_; Storage *storage_; KeyRequest request_; KeyValueReply reply_; int thread_id; ServerAsyncResponseWriter<KeyValueReply> responder_; enum CallStatus { CREATE, PROCESS, FINISH }; CallStatus status_; }; class PutKeyFunc final : public CallData { public: PutKeyFunc(KVStore::AsyncService *service, Storage *storage, ServerCompletionQueue *cq, int thread_id_) : service_(service), storage_(storage), cq_(cq), responder_(&ctx_), status_(CREATE), thread_id(thread_id_) { Proceed(); } void Proceed() { if (status_ == CREATE) { status_ = PROCESS; service_->RequestPutKey(&ctx_, &request_, &responder_, cq_, cq_, this); } else if (status_ == PROCESS) { //new client new PutKeyFunc(service_, storage_, cq_, thread_id); // The actual processing. storage_->writer_lock(); storage_->handle_put(request_.key(), request_.value()); storage_->writer_unlock(); reply_.set_status(200); reply_.set_key(request_.key()); reply_.set_value(request_.value()); reply_.set_timestamp(request_.timestamp()); status_ = FINISH; responder_.Finish(reply_, Status::OK, this); } else { GPR_ASSERT(status_ == FINISH); delete this; } } private: KVStore::AsyncService *service_; ServerCompletionQueue *cq_; ServerContext ctx_; Storage *storage_; KeyValueRequest request_; KeyValueReply reply_; int thread_id; ServerAsyncResponseWriter<KeyValueReply> responder_; enum CallStatus { CREATE, PROCESS, FINISH }; CallStatus status_; }; class DeleteKeyFunc final : public CallData { public: DeleteKeyFunc(KVStore::AsyncService *service, Storage *storage, ServerCompletionQueue *cq, int thread_id_) : service_(service), storage_(storage), cq_(cq), responder_(&ctx_), status_(CREATE), thread_id(thread_id_) { Proceed(); } void Proceed() { if (status_ == CREATE) { status_ = PROCESS; service_->RequestDeleteKey(&ctx_, &request_, &responder_, cq_, cq_, this); } else if (status_ == PROCESS) { //new client new DeleteKeyFunc(service_, storage_, cq_, thread_id); // The actual processing. storage_->writer_lock(); string result = storage_->handle_delete(request_.key()); storage_->writer_unlock(); if (!result.compare("ERROR")) { reply_.set_message("KEY DOES NOT EXISTS"); reply_.set_status(400); } else { reply_.set_status(200); reply_.set_key(request_.key()); } reply_.set_timestamp(request_.timestamp()); status_ = FINISH; responder_.Finish(reply_, Status::OK, this); } else { GPR_ASSERT(status_ == FINISH); delete this; } } private: KVStore::AsyncService *service_; ServerCompletionQueue *cq_; ServerContext ctx_; Storage *storage_; KeyRequest request_; KeyValueReply reply_; int thread_id; ServerAsyncResponseWriter<KeyValueReply> responder_; enum CallStatus { CREATE, PROCESS, FINISH }; CallStatus status_; }; // This can be run in multiple threads if needed. void HandleRpcs(int thread_id) { new GetKeyFunc(&service_, &storage_, cq_[thread_id].get(), thread_id); new PutKeyFunc(&service_, &storage_, cq_[thread_id].get(), thread_id); new DeleteKeyFunc(&service_, &storage_, cq_[thread_id].get(), thread_id); void *tag; bool ok; while (true) { // cout << "In Handle " << thread_id << endl; GPR_ASSERT(cq_[thread_id]->Next(&tag, &ok)); GPR_ASSERT(ok); static_cast<CallData *>(tag)->Proceed(); } } unique_ptr<ServerCompletionQueue> *cq_; KVStore::AsyncService service_; unique_ptr<Server> server_; Storage storage_; }; int main(int argc, char **argv) { ServerImpl server; int file = open("log.txt", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); dup2(file, fileno(stderr)); server.Run(); return 0; }
b6e34cb15cc8ea699094cc71e7ba7e911785dc26
6dab1c229eb3f6b5db28144b27ed56860b10cf41
/InjectDllDemo/DllTest/callDll/callDll.h
19a3eff2788b021a6ee75c62f5d320b4c87e835f
[]
no_license
fengfanchen/CAndCPP
885f7ad3ba935cdad3ce3aa1a34bb6fa5e682966
60a4d8731a5a5d186f38341da1f93b8973086d31
refs/heads/master
2023-02-18T00:46:54.315093
2023-02-16T06:12:21
2023-02-16T06:12:21
180,703,857
17
21
null
null
null
null
GB18030
C++
false
false
461
h
callDll.h
// callDll.h : PROJECT_NAME 应用程序的主头文件 // #pragma once #ifndef __AFXWIN_H__ #error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件" #endif #include "resource.h" // 主符号 // CcallDllApp: // 有关此类的实现,请参阅 callDll.cpp // class CcallDllApp : public CWinApp { public: CcallDllApp(); // 重写 public: virtual BOOL InitInstance(); // 实现 DECLARE_MESSAGE_MAP() }; extern CcallDllApp theApp;
d1f8996dc6546079a306dab275f62573e6c31a98
1d0b609eeaf5fcf0edb7b2a27b41dcff007b3f66
/src/Solids.h
eb0ccdeda41eb9de22b5211f7b431427369b7204
[ "MIT" ]
permissive
lds56/raytracer
8474fb1d41a98695280c381ce412be4f0ba19b78
b84560b16b12ed0679df88274391134b842dce15
refs/heads/master
2016-09-06T17:08:54.455250
2015-10-05T03:40:11
2015-10-05T03:40:11
42,577,186
0
0
null
null
null
null
UTF-8
C++
false
false
1,636
h
Solids.h
// // Created by Rui Chen on 9/15/15. // #ifndef RAYTRACER_SOLID_H #define RAYTRACER_SOLID_H #include "Definition.h" #include "Primitive.h" #include "Point.h" #include "Matrix.h" #include "Ray.h" class Solid : public Primitive { public: Solid(): Primitive() {} virtual Point3d getIntersection(RayPtr rPtr); }; class Cone : public Solid { public: Cone(): Solid(), apexCenter(Point3d::NullPoint), axle(Vector3d(0, 0, 0)), baseCenter(Point3d::NullPoint), apexRadius(-1), baseRadius(-1) {} Cone(Point3d apexCenter, Point3d baseCenter, float apexRadius, float baseRadius): axle((baseCenter - apexCenter).norm()), apexCenter(apexCenter), baseCenter(baseCenter), apexRadius(apexRadius), baseRadius(baseRadius) { if (apexRadius == baseRadius) apexPoint = apexCenter; else apexPoint = Point3d((baseCenter*apexRadius - apexCenter*baseRadius) / (apexRadius - baseRadius)); } Point3d getIntersection(RayPtr rPtr); protected: Vector3d axle; Point3d apexCenter, baseCenter, apexPoint; float apexRadius, baseRadius; }; class Cylinder : public Cone { public: Cylinder(Point3d apexCenter, Point3d baseCenter, float baseRadius): Cone(apexCenter, baseCenter, baseRadius, baseRadius) {} Point3d getIntersection(RayPtr rPtr); private: }; class Sphere : public Solid { public: Sphere(Point3d center, float radius): center(center), radius(radius) {} Point3d getIntersection(RayPtr rPtr); private: Point3d center; float radius; }; #endif //RAYTRACER_SOLID_H
df51369922c02a38cb3c4a7380ad4d23228443ba
10b350c03ced68c3f2f1b3f0a14a2401ac6ec5fa
/AtCoder/Tenka1_Beginner2019/B.cpp
1c422171fc8db9619f6dcec619523e13f8502e58
[]
no_license
TomyJPN/Competitive-programming
e7a4f71e5413ef3adfac1a24368c92e15c1b1423
f0a91b100ff003083974f723aa81d122fa76a5bf
refs/heads/master
2020-05-09T13:41:44.192084
2019-06-22T12:20:10
2019-06-22T12:20:10
181,164,004
0
0
null
null
null
null
UTF-8
C++
false
false
283
cpp
B.cpp
#include <cstdio> #include <iostream> using namespace std; int main(){ int n,k; char str[10]; scanf("%d",&n); scanf("%s",str); scanf("%d",&k); k--; for(int i=0;i<n;i++){ if(str[i]!=str[k]){ str[i]='*'; } } printf("%s",str); return 0; }
5870166242afe2a0c28ff330ce0206c99854ddda
7058ed10f98989af6d216ffba77ebec280bb29d3
/sources/apophenic/Introspect.hxx
1891bde127a08a6cddc1ca565b9c6c651e65aa37
[ "WTFPL" ]
permissive
KonradNoTantoo/apophenic
efdc399cbd681540bfb52892933ff21563144fdb
2f4a4ae5288f18aff07364a46297f43e970a43ff
refs/heads/master
2022-10-03T12:05:17.100855
2022-10-01T10:22:42
2022-10-01T10:22:42
218,493,237
0
0
null
null
null
null
UTF-8
C++
false
false
10,714
hxx
Introspect.hxx
#pragma once #include <string> #include <type_traits> namespace ap { namespace insp { struct Error {}; struct EBadRank : Error {}; struct EBadName : Error {}; struct EBadType : Error {}; template< typename StorageType > using member_arg = ::std::conditional< ::std::is_scalar<StorageType>::value , typename ::std::decay<StorageType>::type , StorageType const & >; template< typename StorageType > using member_access = ::std::conditional< ::std::is_array<StorageType>::value , typename ::std::decay<StorageType>::type , StorageType & >; template< typename StorageType > using member_read = ::std::conditional< ::std::is_scalar<StorageType>::value , typename ::std::decay<StorageType>::type , typename member_access< typename ::std::add_const<StorageType>::type >::type >; template< typename This > using is_this_const = ::std::is_const< typename ::std::remove_pointer<This>::type >; template< typename This, typename StorageType > using get_result = ::std::conditional< is_this_const<This>::value , typename member_read<StorageType>::type , typename member_access<StorageType>::type >; template< auto ptr_to_member > struct Member {}; template< typename MemberType, class Base, MemberType Base::*ptr_to_member > struct Member< ptr_to_member > { using type = MemberType; static char const * const kNAME; template< class T, class Implementor > static typename member_read< MemberType >::type get( T const * t ) { return static_cast< Implementor const * >(t)->*ptr_to_member; } template< class T, class Implementor > static typename member_access< MemberType >::type get( T * t ) { return static_cast< Implementor * >(t)->*ptr_to_member; } }; template< unsigned RANK, class Implementor, typename Member, typename... NextMembers > class RankedIntrospector : public RankedIntrospector< RANK+1, Implementor, NextMembers... > { public: using MemberType = typename Member::type; using Parent = RankedIntrospector< RANK+1, Implementor, NextMembers... >; using Introspector = RankedIntrospector< RANK, Implementor, Member, NextMembers... >; Introspector & introspector() { return *this; } Introspector const & introspector() const { return *this; } Parent & parent_introspector() { return *this; } Parent const & parent_introspector() const { return *this; } typename member_access<MemberType>::type front_member() { return Member::template get< RankedIntrospector, Implementor >( this ); } typename member_read<MemberType>::type front_member() const { return Member::template get< RankedIntrospector, Implementor >( this ); } static char const * front_member_name() { return Member::kNAME; } template< typename OtherType > typename member_read<OtherType>::type get( ::std::string const & name ) const { return _dyn_get<OtherType>( static_cast< RankedIntrospector const * >(this), name ); } template< typename OtherType > typename member_access<OtherType>::type get( ::std::string const & name ) { return _dyn_get<OtherType>( static_cast< RankedIntrospector * >(this), name ); } template< typename OtherType > typename member_read<OtherType>::type get( unsigned rank ) const { return _dyn_get<OtherType>( static_cast< RankedIntrospector const * >(this), rank ); } template< typename OtherType > typename member_access<OtherType>::type get( unsigned rank ) { return _dyn_get<OtherType>( static_cast< RankedIntrospector * >(this), rank ); } template< unsigned GET_RANK, typename OtherType > typename member_read<OtherType>::type get() const { return _sta_get<GET_RANK, OtherType>( static_cast< RankedIntrospector const * >(this) ); } template< unsigned GET_RANK, typename OtherType > typename member_access<OtherType>::type get() { return _sta_get<GET_RANK, OtherType>( static_cast< RankedIntrospector * >(this) ); } static ::std::size_t nb_members() { return sizeof...( NextMembers ) + 1; } static bool has_member( ::std::string const & name ) { return _check_key( name ) ? true : Parent::has_member( name ); } static char const * member_name( unsigned rank ) { return _check_key( rank ) ? Member::kNAME : Parent::member_name( rank ); } ::std::type_info const & member_type( ::std::string const & name ) const { return _check_key( name ) ? typeid( MemberType ) : _down_cast<>(this)->member_type( name ); } ::std::type_info const & member_type( unsigned rank ) const { return _check_key( rank ) ? typeid( MemberType ) : _down_cast<>(this)->member_type( rank ); } protected: static bool _check_key( ::std::string const & name ) { return Member::kNAME == name; } static bool _check_key( unsigned rank ) { return RANK == rank; } template< typename This > using DownCastType = typename ::std::conditional<is_this_const<This>::value, Parent const *, Parent *>::type; template< typename This > static auto _down_cast( This * _this ) -> DownCastType<This> { return static_cast< DownCastType<This> >( _this ); } template< typename OtherType , typename This , typename Key , typename ::std::enable_if< ::std::is_same<OtherType, MemberType>::value, int >::type = 0 > static typename get_result<This,OtherType>::type _dyn_get( This * _this, Key key ) { return _check_key(key) ? Member::template get< This, Implementor >( _this ) : _down_cast<This>(_this)->template get<OtherType>(key); } template< typename OtherType , typename This , typename Key , typename ::std::enable_if< ! ::std::is_same<OtherType, MemberType>::value, int >::type = 0 > static typename get_result<This,OtherType>::type _dyn_get( This * _this, Key key ) { if ( _check_key(key) ) throw EBadType{}; return _down_cast<This>(_this)->template get<OtherType>(key); } template< unsigned GET_RANK , typename OtherType , typename This , typename ::std::enable_if<GET_RANK == RANK, int >::type = 0 > static typename get_result<This,OtherType>::type _sta_get( This * _this ) { static_assert( ::std::is_same<OtherType, MemberType>::value, "Bad type" ); return Member::template get< This, Implementor >( _this ); } template< unsigned GET_RANK , typename OtherType , typename This , typename ::std::enable_if<GET_RANK != RANK, int >::type = 0 > static typename get_result<This,OtherType>::type _sta_get( This * _this ) { return _down_cast<This>(_this)->template get<GET_RANK, OtherType>(); } }; template< unsigned RANK, class Implementor, typename Member > class RankedIntrospector< RANK, Implementor, Member > { public: using MemberType = typename Member::type; using Introspector = RankedIntrospector< RANK, Implementor, Member >; Introspector & introspector() { return *this; } Introspector const & introspector() const { return *this; } typename member_access<MemberType>::type front_member() { return Member::template get< RankedIntrospector, Implementor >( this ); } typename member_read<MemberType>::type front_member() const { return Member::template get< RankedIntrospector, Implementor >( this ); } static char const * front_member_name() { return Member::kNAME; } template< typename OtherType > typename member_read<OtherType>::type get( ::std::string const & name ) const { return _dyn_get<OtherType>( static_cast< RankedIntrospector const * >(this), name ); } template< typename OtherType > typename member_access<OtherType>::type get( ::std::string const & name ) { return _dyn_get<OtherType>( static_cast< RankedIntrospector * >(this), name ); } template< typename OtherType > typename member_read<OtherType>::type get( unsigned rank ) const { return _dyn_get<OtherType>( static_cast< RankedIntrospector const * >(this), rank ); } template< typename OtherType > typename member_access<OtherType>::type get( unsigned rank ) { return _dyn_get<OtherType>( static_cast< RankedIntrospector * >(this), rank ); } template< unsigned GET_RANK, typename OtherType > typename member_read<OtherType>::type get() const { return _sta_get<GET_RANK, OtherType>( static_cast< RankedIntrospector const * >(this) ); } template< unsigned GET_RANK, typename OtherType > typename member_access<OtherType>::type get() { return _sta_get<GET_RANK, OtherType>( static_cast< RankedIntrospector * >(this) ); } static ::std::size_t nb_keys() { return 1; } static bool has_member( ::std::string const & name ) { return Member::kNAME == name; } static char const * member_name( unsigned rank ) { if ( RANK == rank ) return Member::kNAME; throw EBadRank{}; } ::std::type_info const & member_type( ::std::string const & name ) const { if ( Member::kNAME == name ) return typeid( MemberType ); throw EBadName{}; } ::std::type_info const & member_type( unsigned rank ) const { if ( RANK == rank ) return typeid( MemberType ); throw EBadRank{}; } protected: template< typename OtherType , typename This , typename ::std::enable_if< ::std::is_same<OtherType, MemberType>::value, int >::type = 0 > static typename get_result<This,OtherType>::type _dyn_get( This * _this, const ::std::string & name ) { if ( Member::kNAME == name ) return Member::template get< This, Implementor >( _this ); throw EBadName{}; } template< typename OtherType , typename This , typename ::std::enable_if< ! ::std::is_same<OtherType, MemberType>::value, int >::type = 0 > static typename get_result<This,OtherType>::type _dyn_get( This * _this, const ::std::string & name ) { if ( Member::kNAME == name ) throw EBadType{}; throw EBadName{}; } template< typename OtherType , typename This , typename ::std::enable_if< ::std::is_same<OtherType, MemberType>::value, int >::type = 0 > static typename get_result<This,OtherType>::type _dyn_get( This * _this, unsigned rank ) { if ( RANK == rank ) return Member::template get< This, Implementor >( _this ); throw EBadRank{}; } template< typename OtherType , typename This , typename ::std::enable_if< ! ::std::is_same<OtherType, MemberType>::value, int >::type = 0 > static typename get_result<This,OtherType>::type _dyn_get( This * _this, unsigned rank ) { if ( RANK == rank ) throw EBadType{}; throw EBadRank{}; } template< unsigned GET_RANK , typename OtherType , typename This > static typename get_result<This,OtherType>::type _sta_get( This * _this ) { static_assert( GET_RANK == RANK, "Bad rank" ); static_assert( ::std::is_same<OtherType, MemberType>::value, "Bad type" ); return Member::template get< This, Implementor >( _this ); } }; template< class Implementor, typename... Members > using Introspector = RankedIntrospector< 0, Implementor, Members... >; } // namespace insp } // namespace ap
b7d324367610c084556655482750e5d18cc4d8a4
253bc46715e1203125e4af32ccd89ad8c9bf569c
/JwtAuthentication/JwtAuthenticationModule.cpp
8efc068dfab5ce978b307b9aee6264e9606d34f1
[]
no_license
lorenzrox/JwtAuthentication
86ece9bbbbd41f514023e14623503480c453e9c9
f4b8a46f464842ec1d9526ce109cf23c03adaecf
refs/heads/master
2023-07-11T18:21:13.268668
2021-07-31T13:16:05
2021-07-31T13:16:05
388,867,699
1
0
null
null
null
null
UTF-8
C++
false
false
15,797
cpp
JwtAuthenticationModule.cpp
#include "JwtAuthenticationModule.h" #include "JwtAuthenticationModuleFactory.h" #include "JwtModuleConfiguration.h" std::string UrlDecode(PCWSTR pStart, PCWSTR pEnd) { WCHAR a, b; size_t offset = 0; std::string result(MB_CUR_MAX * (pEnd - pStart), '\0'); PCWSTR pCurrent = pStart; while (pCurrent < pEnd) { if (*pCurrent == L'%' && (pCurrent + 2 < pEnd) && (a = pCurrent[1]) && (b = pCurrent[2]) && isxdigit(a) && isxdigit(b)) { if (a >= L'a') { a -= (L'a' - L'A'); } if (a >= L'A') { a -= (L'A' - 10); } else { a -= L'0'; } if (b >= L'a') { b -= (L'a' - L'A'); } if (b >= L'A') { b -= (L'A' - 10); } else { b -= L'0'; } int len; if (wctomb_s(&len, &result[offset], result.size(), 16 * a + b) == 0) { offset += len; } pCurrent += 3; } else if (*pCurrent == L'+') { result[offset++] = ' '; pCurrent++; } else { int len; if (wctomb_s(&len, &result[offset], result.size(), *pCurrent++) == 0) { offset += len; } } } result.resize(offset); return result; } std::string UrlDecode(PCSTR pStart, PCSTR pEnd) { char a, b; size_t offset = 0; std::string result(pEnd - pStart, '\0'); PCSTR pCurrent = pStart; while (pCurrent < pEnd) { if (*pCurrent == L'%' && (pCurrent + 2 < pEnd) && (a = pCurrent[1]) && (b = pCurrent[2]) && isxdigit(a) && isxdigit(b)) { if (a >= L'a') { a -= (L'a' - L'A'); } if (a >= L'A') { a -= (L'A' - 10); } else { a -= L'0'; } if (b >= L'a') { b -= (L'a' - L'A'); } if (b >= L'A') { b -= (L'A' - 10); } else { b -= L'0'; } result[offset++] = 16 * a + b; pCurrent += 3; } else if (*pCurrent == L'+') { result[offset++] = ' '; pCurrent++; } else { result[offset++] = *pCurrent++; } } result.resize(offset); return result; } HRESULT GetHeaderJwtToken(IHttpRequest* httpRequest, JwtModuleConfiguration* pConfiguration, std::string& jwt) { USHORT length; PCSTR pHeaderValue; auto& path = pConfiguration->GetPath(); if (path.empty()) { pHeaderValue = httpRequest->GetHeader(HttpHeaderAuthorization, &length); } else { pHeaderValue = httpRequest->GetHeader(path.data(), &length); } if (length == 0) { return S_FALSE; } if (_strnicmp(pHeaderValue, "Bearer ", 7) == 0) { jwt = std::string(pHeaderValue + 7, length - 7); } else { jwt = std::string(pHeaderValue, length); } return S_OK; } HRESULT GetCookieJwtToken(IHttpRequest* httpRequest, JwtModuleConfiguration* pConfiguration, std::string& jwt) { USHORT length; PCSTR pCookie = httpRequest->GetHeader(HttpHeaderCookie, &length); if (length == 0) { return S_FALSE; } std::string path = pConfiguration->GetPath(); if (path.empty()) { static const std::string& DefaultCookieName = "access_token"; path = DefaultCookieName; } PCSTR pCookieEnd = pCookie + length; while (pCookie < pCookieEnd) { PCSTR pParamEnd = strchr(pCookie, ';'); if (pParamEnd == NULL) { pParamEnd = pCookieEnd; } if (_strnicmp(path.data(), pCookie, path.size()) == 0) { pCookie += path.size(); if (pCookie < pParamEnd && *pCookie == L'=') { jwt = UrlDecode(++pCookie, pParamEnd); return S_OK; } } pCookie = pParamEnd + 1; while (*pCookie == ' ') { pCookie++; } } return S_FALSE; } HRESULT GetUrlJwtToken(IHttpRequest* httpRequest, const JwtModuleConfiguration* pConfiguration, std::string& jwt) { auto path = std::to_wstring(pConfiguration->GetPath()); if (path.empty()) { static const std::wstring& DefaultUrlParameter = L"access_token"; path = DefaultUrlParameter; } auto rawRequest = httpRequest->GetRawHttpRequest(); if (rawRequest->CookedUrl.pQueryString) { PCWSTR pParamStart = rawRequest->CookedUrl.pQueryString + 1; PCWSTR pQueryEnd = rawRequest->CookedUrl.pQueryString + rawRequest->CookedUrl.QueryStringLength / sizeof(WCHAR); while (pParamStart < pQueryEnd) { PCWSTR pParamEnd = wcschr(pParamStart, L'&'); if (pParamEnd == NULL) { pParamEnd = pQueryEnd; } if (_wcsnicmp(path.data(), pParamStart, path.size()) == 0) { pParamStart += path.size(); if (pParamStart < pParamEnd && *pParamStart == L'=') { jwt = UrlDecode(++pParamStart, pParamEnd); return S_OK; } } pParamStart = pParamEnd + 1; } } return S_FALSE; } bool CheckAlgorithm(const std::string& algorithm, JwtModuleConfiguration* pConfiguration) { if (algorithm == "HS256") { return pConfiguration->GetAlgorithm() == JwtCryptoAlgorithm::HS256; } if (algorithm == "RS256") { return pConfiguration->GetAlgorithm() == JwtCryptoAlgorithm::RS256; } return false; } inline REQUEST_NOTIFICATION_STATUS Error(_In_ IHttpContext* pHttpContext, IHttpEventProvider* pProvider, HRESULT hr) { pHttpContext->GetResponse()->SetStatus(500, "Server Error", 0, hr); pHttpContext->SetRequestHandled(); return RQ_NOTIFICATION_FINISH_REQUEST; } inline void GetJwtTokenRoles(JwtModuleConfiguration* pConfiguration, const jwt_t& jwtToken, std::insensitive_unordered_set<std::string>& roles) { auto& roleGrant = pConfiguration->GetRoleGrant(); if (!roleGrant.empty() && jwtToken.has_payload_claim(roleGrant)) { auto claim = jwtToken.get_payload_claim(roleGrant); if (claim.get_type() == jwt::json::type::array) { for (const auto& value : claim.as_array()) { if (value.is<std::string>()) { roles.insert(value.get<std::string>()); } } } else { roles.insert(claim.as_string()); } } } inline void GetJwtTokenUser(JwtModuleConfiguration* pConfiguration, const jwt_t& jwtToken, std::string& userName) { auto& nameGrant = pConfiguration->GetNameGrant(); if (!nameGrant.empty() && jwtToken.has_payload_claim(nameGrant)) { userName = jwtToken.get_payload_claim(nameGrant).as_string(); } } JwtAuthenticationModule::JwtAuthenticationModule() : m_eventLog(NULL) { } JwtAuthenticationModule::~JwtAuthenticationModule() { if (m_eventLog != NULL) { DeregisterEventSource(m_eventLog); m_eventLog = NULL; } } HRESULT JwtAuthenticationModule::Initialize() { if ((m_eventLog = RegisterEventSource(NULL, L"IIS_JWT_AUTH")) == NULL) { return HRESULT_FROM_WIN32(GetLastError()); } return S_OK; } bool JwtAuthenticationModule::ValidateTokenSignature(JwtModuleConfiguration* pConfiguration, const jwt_t& jwtToken) { if (jwtToken.has_expires_at()) { //Check token expiration auto expiration = jwtToken.get_expires_at(); if (expiration < std::chrono::system_clock::now()) { WriteEventLog(EventLogType::Warning, "JWT token expired"); return false; } } auto& key = pConfiguration->GetKey(); if (!jwtToken.has_algorithm()) { return key.empty(); } if (key.empty()) { return true; } const auto& algoritm = jwtToken.get_algorithm(); if (!CheckAlgorithm(algoritm, pConfiguration)) { WriteEventLog(EventLogType::Warning, "JWT token signature algorithm not supported"); return false; } std::error_code error; switch (pConfiguration->GetAlgorithm()) { case JwtCryptoAlgorithm::RS256: jwt::verify().allow_algorithm(jwt::crypto::algorithm::rs256(key)).verify(jwtToken, error); break; default: jwt::verify().allow_algorithm(jwt::crypto::algorithm::hs256(key)).verify(jwtToken, error); break; } if (error) { WriteEventLog(EventLogType::Warning, "JWT token signature verification failed"); return false; } return true; } bool JwtAuthenticationModule::ValidateTokenPolicies(JwtModuleConfiguration* pConfiguration, const std::string& userName, const std::insensitive_unordered_set<std::string>& roles) { auto& policies = pConfiguration->GetPolicies(); if (policies.empty()) { return true; } HRESULT hr; bool result; for (auto& policy : policies) { RETURN_IF_FAILED(hr, policy->Check(userName, roles, &result)); if (result) { return true; } } WriteEventLog(EventLogType::Warning, "No authorization policy matched"); return false; } void JwtAuthenticationModule::WriteEventLog(EventLogType type, LPCSTR pMessage, HRESULT hr) { if (SUCCEEDED(hr)) { ::ReportEventA(m_eventLog, static_cast<WORD>(type), 0, 1, NULL, 1, 0, &pMessage, NULL); } else { CHAR buffer[4096] = ""; LPCSTR strings[2] = { pMessage, buffer }; ::FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, _countof(buffer), nullptr); ::ReportEventA(m_eventLog, static_cast<WORD>(type), 0, 0, NULL, 2, sizeof(hr), strings, &hr); } } HRESULT JwtAuthenticationModule::MapGrantHeaders(JwtModuleConfiguration* pConfiguration, IHttpRequest* pHttpRequest, const jwt_t& jwtToken) { HRESULT hr; for (auto& entry : pConfiguration->GetGrantMappings()) { if (jwtToken.has_payload_claim(entry.first)) { auto grantValue = jwtToken.get_payload_claim(entry.first).as_string(); RETURN_IF_FAILED(hr, pHttpRequest->SetHeader(entry.second.Header.data(), grantValue.data(), grantValue.size(), entry.second.Replace)); } } return S_OK; } HRESULT JwtAuthenticationModule::HandleRequest(_In_ IHttpContext* pHttpContext) { HRESULT hr; JwtModuleConfiguration* pConfiguration; RETURN_IF_FAILED(hr, JwtModuleConfiguration::EnsureConfiguration(pHttpContext->GetApplication(), &pConfiguration)); if (!pConfiguration->IsEnabled()) { return S_OK; } IHttpRequest* httpRequest = pHttpContext->GetRequest(); if (_strnicmp("OPTIONS", httpRequest->GetHttpMethod(), 8) == 0) { WriteEventLog(EventLogType::Information, "Skipped authentication for OPTIONS request"); return S_OK; } std::string jwt; switch (pConfiguration->GetValidationType()) { case JwtValidationType::Cookie: RETURN_IF_FAILED(hr, GetCookieJwtToken(httpRequest, pConfiguration, jwt)); break; case JwtValidationType::Url: RETURN_IF_FAILED(hr, GetUrlJwtToken(httpRequest, pConfiguration, jwt)); break; default: RETURN_IF_FAILED(hr, GetHeaderJwtToken(httpRequest, pConfiguration, jwt)); break; } if (jwt.empty()) { WriteEventLog(EventLogType::Warning, "JWT token not found"); } else { try { auto jwtToken = jwt::decode(jwt); if (!ValidateTokenSignature(pConfiguration, jwtToken)) { return S_FALSE; } std::string userName; GetJwtTokenUser(pConfiguration, jwtToken, userName); std::insensitive_unordered_set<std::string> roles; GetJwtTokenRoles(pConfiguration, jwtToken, roles); if (!ValidateTokenPolicies(pConfiguration, userName, roles)) { return S_FALSE; } RETURN_IF_FAILED(hr, MapGrantHeaders(pConfiguration, httpRequest, jwtToken)); return S_OK; } catch (const std::exception& ex) { WriteEventLog(EventLogType::Error, ex.what()); return E_FAIL; } } return S_FALSE; } HRESULT JwtAuthenticationModule::AuthenticateUser(_In_ IHttpContext* pHttpContext, IAuthenticationProvider* pProvider) { HRESULT hr; JwtModuleConfiguration* pConfiguration; RETURN_IF_FAILED(hr, JwtModuleConfiguration::EnsureConfiguration(pHttpContext->GetApplication(), &pConfiguration)); if (!pConfiguration->IsEnabled()) { return S_OK; } IHttpRequest* httpRequest = pHttpContext->GetRequest(); if (_strnicmp("OPTIONS", httpRequest->GetHttpMethod(), 8) == 0) { WriteEventLog(EventLogType::Information, "Skipped authentication for OPTIONS request"); return S_OK; } std::string jwt; switch (pConfiguration->GetValidationType()) { case JwtValidationType::Cookie: RETURN_IF_FAILED(hr, GetCookieJwtToken(httpRequest, pConfiguration, jwt)); break; case JwtValidationType::Url: RETURN_IF_FAILED(hr, GetUrlJwtToken(httpRequest, pConfiguration, jwt)); break; default: RETURN_IF_FAILED(hr, GetHeaderJwtToken(httpRequest, pConfiguration, jwt)); break; } if (jwt.empty()) { WriteEventLog(EventLogType::Warning, "JWT token not found"); } else { try { auto jwtToken = jwt::decode(jwt); if (!ValidateTokenSignature(pConfiguration, jwtToken)) { return S_FALSE; } std::set<std::wstring> roles; std::wstring userName; auto& nameGrant = pConfiguration->GetNameGrant(); if (!nameGrant.empty() && jwtToken.has_payload_claim(nameGrant)) { userName = std::to_wstring(jwtToken.get_payload_claim(nameGrant).as_string()); } auto& roleGrant = pConfiguration->GetRoleGrant(); if (!roleGrant.empty() && jwtToken.has_payload_claim(roleGrant)) { auto claim = jwtToken.get_payload_claim(roleGrant); if (claim.get_type() == jwt::json::type::array) { for (const auto& value : claim.as_array()) { roles.insert(std::to_wstring(value.get<std::string>())); } } else { roles.insert(std::to_wstring(claim.as_string())); } } auto user = std::make_unique<JwtClaimsUser>(std::move(userName), std::move(roles)); if (user == NULL) { return E_OUTOFMEMORY; } RETURN_IF_FAILED(hr, MapGrantHeaders(pConfiguration, httpRequest, jwtToken)); pProvider->SetUser(user.release()); return S_OK; } catch (const std::exception& ex) { WriteEventLog(EventLogType::Error, ex.what()); return E_FAIL; } } return S_FALSE; } HRESULT JwtAuthenticationModule::AuthorizeUser(_In_ IHttpContext* pHttpContext) { HRESULT hr; JwtModuleConfiguration* pConfiguration; RETURN_IF_FAILED(hr, JwtModuleConfiguration::EnsureConfiguration(pHttpContext->GetApplication(), &pConfiguration)); if (!pConfiguration->IsEnabled()) { return S_OK; } IHttpRequest* httpRequest = pHttpContext->GetRequest(); if (_strnicmp("OPTIONS", httpRequest->GetHttpMethod(), 8) == 0) { WriteEventLog(EventLogType::Information, "Skipped authrization for OPTIONS request"); return S_OK; } auto& policies = pConfiguration->GetPolicies(); if (policies.empty()) { return S_OK; } bool result; for (auto& policy : policies) { RETURN_IF_FAILED(hr, policy->Check(pHttpContext, &result)); if (result) { return S_OK; } } WriteEventLog(EventLogType::Warning, "No authorization policy matched"); return S_FALSE; } REQUEST_NOTIFICATION_STATUS JwtAuthenticationModule::OnBeginRequest(_In_ IHttpContext* pHttpContext, _In_ IHttpEventProvider* pProvider) { #ifdef DEBUG __debugbreak(); #endif HRESULT hr = HandleRequest(pHttpContext); if (FAILED(hr)) { WriteEventLog(EventLogType::Error, "An error occurred handling the request", hr); return Error(pHttpContext, pProvider, hr); } else if (hr == S_FALSE) { pHttpContext->GetResponse()->SetStatus(401, "Invalid JWT token"); pHttpContext->SetRequestHandled(); return RQ_NOTIFICATION_FINISH_REQUEST; } return RQ_NOTIFICATION_CONTINUE; } REQUEST_NOTIFICATION_STATUS JwtAuthenticationModule::OnAuthenticateRequest(_In_ IHttpContext* pHttpContext, _In_ IAuthenticationProvider* pProvider) { #ifdef DEBUG __debugbreak(); #endif HRESULT hr = AuthenticateUser(pHttpContext, pProvider); if (FAILED(hr)) { WriteEventLog(EventLogType::Error, "An error occurred handling the request", hr); return Error(pHttpContext, pProvider, hr); } else if (hr == S_FALSE) { pHttpContext->GetResponse()->SetStatus(401, "Invalid JWT token"); pHttpContext->SetRequestHandled(); return RQ_NOTIFICATION_FINISH_REQUEST; } return RQ_NOTIFICATION_CONTINUE; } REQUEST_NOTIFICATION_STATUS JwtAuthenticationModule::OnAuthorizeRequest(_In_ IHttpContext* pHttpContext, _In_ IHttpEventProvider* pProvider) { #ifdef DEBUG __debugbreak(); #endif HRESULT hr = AuthorizeUser(pHttpContext); if (FAILED(hr)) { WriteEventLog(EventLogType::Error, "An error occurred handling the request", hr); return Error(pHttpContext, pProvider, hr); } else if (hr == S_FALSE) { pHttpContext->GetResponse()->SetStatus(401, "Unauthorized"); pHttpContext->SetRequestHandled(); return RQ_NOTIFICATION_FINISH_REQUEST; } return RQ_NOTIFICATION_CONTINUE; }
62cd14846b62c0d13750195819c6a272890ec580
f1c2c22ee945eda7e0921e553101f740e671efae
/src/actor/Actor.h
da13ae4392a4eaf88f81c5ef7001050b8dd057a4
[ "Apache-2.0" ]
permissive
mhotchen/big-fish
bbfeee3df3a877ac324855799854b7ec9bcce353
707107fd6691034d2f0087bae3382129f93337dd
refs/heads/master
2020-12-25T15:08:34.226047
2016-07-25T15:35:41
2016-07-25T15:35:41
64,141,587
1
0
null
null
null
null
UTF-8
C++
false
false
1,193
h
Actor.h
#ifndef actor_h #define actor_h #include <SDL2/SDL.h> #include <vector> #include "circle/Circle.h" class Actor { public: static constexpr float MAX_VELOCITY = 5.0; static constexpr float MIN_VELOCITY = 1.5; static constexpr float ACCELERATION = 0.1; static constexpr int DESTINATION_DISTANCE = 10000; static constexpr float ANGLE_CHANGE = 6.0; Actor(int radius, SDL_Point position) : Actor(radius, position, MIN_VELOCITY) {} Actor(int radius, SDL_Point position, float velocity) : circle_(radius, position), velocity_(velocity) {} virtual void updateCourse(std::vector<Actor*> actors) = 0; void render(SDL_Renderer* renderer, SDL_Rect* camera); void move(SDL_Rect* arena); void eat(Actor* actor); bool isCollision(Actor* actor); int getRadius(); SDL_Point getPos(); protected: static constexpr float PI = 3.14159265; Circle circle_; float velocity_; SDL_Point target_, destination_; SDL_Color color_ {0, 0, 0, 255}; float getAngle(SDL_Point a, SDL_Point b); float distanceSquared(SDL_Point a, SDL_Point b); SDL_Point acquireDestination(SDL_Point position, float angle, int distance); }; #endif
40764a2fe994c00a899fe31fe05c20ec4f82cadd
d80c9c6ba63eb1bfe5673c65811f4d64ce9f4782
/GraphicsTest/OrthogonalCameraTest.cpp
49d66f503e0c545f55318ad71f6f9531b7c7bbf5
[ "Zlib", "MIT" ]
permissive
PremiumGraphicsCodes/CGLib
5d7c1a7d3e9e26b08e8df0adce4748785759e965
c63839da9d4f87b34ca497a2147a916b8180041f
refs/heads/master
2022-12-14T21:25:13.413152
2022-12-07T00:49:34
2022-12-07T00:49:34
49,645,980
1
1
null
null
null
null
UTF-8
C++
false
false
522
cpp
OrthogonalCameraTest.cpp
#include "stdafx.h" #include "../Graphics/OrthogonalCamera.h" using namespace Crystal::Math; using namespace Crystal::Graphics; using T = float; TEST(OrthogonalCameraTest, TestGetProjectionMatrix) { const OrthogonalCamera<float> c; const Matrix4d<float>& m = c.getProjectionMatrix(); EXPECT_EQ(2, m.getX00()); EXPECT_EQ(2, m.getX11()); } TEST(OrthogonalCameraTest, TestGetPosition) { OrthogonalCamera<float> c; c.setRect(-0.5, 0.5, -0.5, 0.5); c.getPosition(Vector3d<float>(1, 1, 1)); }
f42d58269a34663f541cadd30909b403b5947630
8ec58056627425e2485c9893c5d0a9da73652b16
/test/test_csv.cpp
ee164ba4649dcadac85362afa460896dfcc10115
[ "MIT" ]
permissive
Kautenja/csv
37bb157a66eda79cff2742e3d9baf92e48bb8d3f
d34c251e99bca007b195c5dc487fde6233461c43
refs/heads/master
2020-09-27T07:57:39.616183
2019-12-07T06:56:49
2019-12-07T06:56:49
226,469,479
1
0
null
null
null
null
UTF-8
C++
false
false
3,747
cpp
test_csv.cpp
// A doubly linked list data structure. // Copyright 2019 Christian Kauten // #include <sstream> #include <string> #include <vector> #include "catch.hpp" #include "csv.hpp" // // MARK: CSV::_next_line // SCENARIO("a row is read") { GIVEN("a string with a CSV row (1 item)") { auto row = ""; WHEN("the row is read") { THEN("a vector with the cells are returned") { auto stream = std::stringstream(row); auto data = CSV::_next_line(stream); REQUIRE(1 == data.size()); REQUIRE_THAT("", Catch::Equals(data[0])); } } } GIVEN("a string with a CSV row (4 items)") { auto row = "a,b,c,d"; WHEN("the row is read") { THEN("a vector with the cells are returned") { auto stream = std::stringstream(row); auto data = CSV::_next_line(stream); REQUIRE(4 == data.size()); REQUIRE_THAT("a", Catch::Equals(data[0])); REQUIRE_THAT("b", Catch::Equals(data[1])); REQUIRE_THAT("c", Catch::Equals(data[2])); REQUIRE_THAT("d", Catch::Equals(data[3])); } } } GIVEN("a string with a CSV row (4 items + trailing)") { auto row = "a,b,c,d,"; WHEN("the row is read") { THEN("a vector with the cells are returned") { auto stream = std::stringstream(row); auto data = CSV::_next_line(stream); REQUIRE(5 == data.size()); REQUIRE_THAT("a", Catch::Equals(data[0])); REQUIRE_THAT("b", Catch::Equals(data[1])); REQUIRE_THAT("c", Catch::Equals(data[2])); REQUIRE_THAT("d", Catch::Equals(data[3])); REQUIRE_THAT("", Catch::Equals(data[4])); } } } } // // MARK: CSV::load // SCENARIO("a CSV is loaded") { GIVEN("a string with a CSV") { auto csv_string = "a,b,c,d\ne,f,g,h\ni,j,k,l\n"; WHEN("the CSV is read") { auto stream = std::stringstream(csv_string); auto csv = CSV::load(stream); THEN("the returned data is correct") { REQUIRE(3 == csv.size()); REQUIRE(4 == csv[0].size()); REQUIRE_THAT("a", Catch::Equals(csv[0][0])); REQUIRE_THAT("b", Catch::Equals(csv[0][1])); REQUIRE_THAT("c", Catch::Equals(csv[0][2])); REQUIRE_THAT("d", Catch::Equals(csv[0][3])); REQUIRE(4 == csv[1].size()); REQUIRE_THAT("e", Catch::Equals(csv[1][0])); REQUIRE_THAT("f", Catch::Equals(csv[1][1])); REQUIRE_THAT("g", Catch::Equals(csv[1][2])); REQUIRE_THAT("h", Catch::Equals(csv[1][3])); REQUIRE(4 == csv[2].size()); REQUIRE_THAT("i", Catch::Equals(csv[2][0])); REQUIRE_THAT("j", Catch::Equals(csv[2][1])); REQUIRE_THAT("k", Catch::Equals(csv[2][2])); REQUIRE_THAT("l", Catch::Equals(csv[2][3])); } } } } // // MARK: CSV::print // SCENARIO("a CSV is printed") { GIVEN("a CSV") { auto expected = "a,b,c,d\ne,f,g,h\ni,j,k,l\n"; std::vector<std::vector<std::string>> csv = { {"a", "b", "c", "d"}, {"e", "f", "g", "h"}, {"i", "j", "k", "l"} }; WHEN("the CSV is printed to a string stream") { std::stringstream stream; CSV::print(csv, stream); THEN("then output string is correct") { REQUIRE_THAT(stream.str(), Catch::Equals(expected)); } } } }
1e997d98089edfea4b1605a3b96c7877b8b5bbbe
6a69d57c782e0b1b993e876ad4ca2927a5f2e863
/vendor/samsung/common/packages/apps/SBrowser/src/chrome/browser/ui/views/signed_certificate_timestamps_views.h
247cf8a89cf3e4461e88575c078128f87d1b9a1c
[ "BSD-3-Clause" ]
permissive
duki994/G900H-Platform-XXU1BOA7
c8411ef51f5f01defa96b3381f15ea741aa5bce2
4f9307e6ef21893c9a791c96a500dfad36e3b202
refs/heads/master
2020-05-16T20:57:07.585212
2015-05-11T11:03:16
2015-05-11T11:03:16
35,418,464
2
1
null
null
null
null
UTF-8
C++
false
false
2,862
h
signed_certificate_timestamps_views.h
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_VIEWS_SIGNED_CERTIFICATE_TIMESTAMPS_VIEWS_H_ #define CHROME_BROWSER_UI_VIEWS_SIGNED_CERTIFICATE_TIMESTAMPS_VIEWS_H_ #include "base/memory/scoped_ptr.h" #include "content/public/browser/notification_observer.h" #include "net/cert/signed_certificate_timestamp.h" #include "net/ssl/signed_certificate_timestamp_and_status.h" #include "ui/views/controls/combobox/combobox_listener.h" #include "ui/views/window/dialog_delegate.h" namespace content { class WebContents; } namespace views { class Combobox; class Widget; } class SignedCertificateTimestampInfoView; class SCTListModel; // The Views implementation of the signed certificate timestamps viewer. class SignedCertificateTimestampsViews : public views::DialogDelegateView, public content::NotificationObserver, public views::ComboboxListener { public: // Use ShowSignedCertificateTimestampsViewer to show. SignedCertificateTimestampsViews( content::WebContents* web_contents, const net::SignedCertificateTimestampAndStatusList& sct_list); virtual ~SignedCertificateTimestampsViews(); // views::DialogDelegate: virtual base::string16 GetWindowTitle() const OVERRIDE; virtual int GetDialogButtons() const OVERRIDE; virtual ui::ModalType GetModalType() const OVERRIDE; // views::View: virtual gfx::Size GetMinimumSize() OVERRIDE; virtual void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) OVERRIDE; private: void Init(); void ShowSCTInfo(int sct_index); // views::ComboboxListener: virtual void OnPerformAction(views::Combobox* combobox) OVERRIDE; // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; content::WebContents* web_contents_; SignedCertificateTimestampInfoView* sct_info_view_; scoped_ptr<SCTListModel> sct_list_model_; // The Combobox used to select the SCT to display. This class owns the pointer // as it has to be deleted explicitly before the views c'tor is called: // The Combobox d'tor refers to the model it holds, which will be destructed // as part of tearing down this class. So it will not be available when the // Views d'tor destroys the Combobox, leading to a crash. // Must be deleted before the model. scoped_ptr<views::Combobox> sct_selector_box_; net::SignedCertificateTimestampAndStatusList sct_list_; DISALLOW_COPY_AND_ASSIGN(SignedCertificateTimestampsViews); }; #endif // CHROME_BROWSER_UI_VIEWS_SIGNED_CERTIFICATE_TIMESTAMPS_VIEWS_H_
280eb975a6666055cb4e85ac9ebd9ff5cb78c645
5370a9369b0a84dcd863202da66caaf30baac1a6
/SuMC/containerClusters.cpp
424c5452ae0396be11acaf22d1490b3a782f3561
[]
no_license
lstruski/SuMC
c8c31c6a820fe19cfde72e0dd27b2b4af92a3250
ef3a3f379feb7dba5ed9c60155e5223d1ddce3b2
refs/heads/master
2022-04-10T04:07:42.429976
2020-03-19T17:32:23
2020-03-19T17:32:23
110,697,375
0
0
null
null
null
null
UTF-8
C++
false
false
41,473
cpp
containerClusters.cpp
// // Created by lukasz struski on 24.06.16. // #include <iostream> //#include <random> #include <thread> #include "subspaceClustering.h" using namespace subspaceClustering; /** * This function calculates index for upper matrix without diagonal (indices (i, j) used as in classical 2-dimensional matrix). */ inline int index(int i, int j, int dim) { int res; if (i == j) res = -1; else if (i < j) res = (dim - 1) * i - (i * (i - 1)) / 2 + j - i - 1; else res = (dim - 1) * j - (j * (j - 1)) / 2 + i - j - 1; return res; } /** * Constructor */ ContainerClusters::ContainerClusters() { size = 0; error = std::numeric_limits<double>::infinity(); } /** * Copy constructor */ ContainerClusters::ContainerClusters(const ContainerClusters &orig) { this->size = orig.size; this->error = orig.error; this->tableClusters.reserve(static_cast<unsigned long>(this->size)); for (int i = 0; i < this->size; i++) this->tableClusters.push_back(new Cluster(*orig.tableClusters[i])); } /** * Destructor */ ContainerClusters::~ContainerClusters() { std::vector<Cluster *>::iterator ite; for (ite = tableClusters.begin(); ite != tableClusters.end(); ite++) delete *ite; tableClusters.clear(); } /** * @return size of Container */ int ContainerClusters::getSize() const { return this->size; } /** * @return error of Container */ double ContainerClusters::getError() const { return this->error; } /** * reset error clustring */ void ContainerClusters::resetError() { this->error = std::numeric_limits<double>::infinity(); } /** * @return the container of clusters */ std::vector<Cluster *> ContainerClusters::getContainer() const { return this->tableClusters; } /** * Cleaning the contents of the container */ void ContainerClusters::clean() { this->size = 0; this->error = std::numeric_limits<double>::infinity(); for (auto &tableCluster : this->tableClusters) delete tableCluster; this->tableClusters.clear(); } /** * The (overload operator =) function copies the values of the 'orig' cluster container, deleting the previous data * * @param orig (<i><b>ContainerClusters&</b></i>) - the container of clusters * @return copy 'orig' */ ContainerClusters &ContainerClusters::operator=(const ContainerClusters &orig) { std::vector<Cluster *>::reverse_iterator ite; for (ite = this->tableClusters.rbegin(); ite != this->tableClusters.rend(); ++ite) delete *ite; this->tableClusters.clear(); this->size = orig.size; this->error = orig.error; this->tableClusters.reserve(static_cast<unsigned long>(this->size)); for (int i = 0; i < this->size; i++) this->tableClusters.push_back(new Cluster(*orig.tableClusters[i])); return *this; } /** * Create clusters, randomly linking points to clusters * * @param size (<i><b>int[]</b></i>) - size of number of samples and number of features * @param data (<i><b>double*</b></i>) - 2-dimensional array, which save data <i>row-major order</i> * @param groups (<i><b>int*</b></i>) - list of id clusters (values: 0,1,...,howClusters-1; <i>row-major order</i>) * @param howClusters (<i><b>int</b></i>) - determines how much we want to create clusters * @param allMemory (<i><b>double</b></i>) - general memory we have at our disposal */ void ContainerClusters::createCluster(const int size[], const double *data, const int *group, const int howClusters, const double allMemory, const int bits) { this->size = howClusters; this->tableClusters.reserve((unsigned long) howClusters); int i, j; for (i = 0; i < howClusters; i++) this->tableClusters.push_back(new Cluster(size[1])); auto *temp = new double[size[1]]; for (i = 0; i < size[0]; i++) { j = group[i]; this->tableClusters[j]->changePoint(data + i * Cluster::N, 1, temp); } delete[] temp; auto *matrix = new double[Cluster::N * Cluster::N]; int info; double *eigenvec = nullptr; auto *eigenvalues = new double[Cluster::N]; int n_select; for (i = 0; i < howClusters; i++) { tableClusters[i]->memory = allMemory * (double) tableClusters[i]->weight / size[0]; if (bits == 0) this->tableClusters[i]->dim = this->tableClusters[i]->memory / this->tableClusters[i]->weight; else this->tableClusters[i]->dim = (this->tableClusters[i]->memory + this->tableClusters[i]->weight * std::log2((double) this->tableClusters[i]->weight / size[0])) / (bits * this->tableClusters[i]->weight); for (j = 0; j < Cluster::N * Cluster::N; j++) matrix[j] = this->tableClusters[i]->cov[j]; if (this->tableClusters[i]->dim > static_cast<int>(Cluster::N / 2)) { // calculate the smallest eigenvalues n_select = (this->tableClusters[i]->dim - floor(this->tableClusters[i]->dim) > 0) ? static_cast<int>(Cluster::N - ceil(this->tableClusters[i]->dim) + 1) : static_cast<int>(Cluster::N - ceil(this->tableClusters[i]->dim)); n_select += bound + 1; n_select = (n_select >= Cluster::N) ? Cluster::N : n_select; } else { // calculate the largest eigenvalues n_select = -static_cast<int>(floor(this->tableClusters[i]->dim) + 1); n_select -= bound + 1; n_select = (n_select <= -Cluster::N) ? -Cluster::N : n_select; } if (n_select != 0) try { info = eigensystem(Cluster::N, n_select, matrix, eigenvalues, eigenvec); if (info != 0) throw std::runtime_error("Calculating eigenvalues failed!"); if (n_select > 0) for (int ih = 0; ih < n_select; ++ih) this->tableClusters[i]->eigenvalues[ih] = eigenvalues[ih]; else for (int ih = 0; ih < -n_select; ++ih) this->tableClusters[i]->eigenvalues[Cluster::N - 1 - ih] = eigenvalues[-n_select - 1 - ih]; } catch (std::exception const &str) { std::cerr << "Exception: " << str.what() << "\n"; } } delete[] matrix; delete[] eigenvalues; } /** * The function calculates the minimum energy of two clusters and their memory * * @param array (<i><b>double[2]</i></b>) - array, which saves cost function and memory of second cluster * @param idCluster1 (<i><b>Cluster &</i></b>) - index of the first cluster * @param idCluster2 (<i><b>Cluster &</i></b>) - index of the second cluster * @param totalWeight (<i><b>int</i></b>) - the total number of data * @param bits (<i><b>int</i></b>) - number of bits needed to memorize one scalar */ void ContainerClusters::errorsTWOclusters(double *array, const int idCluster1, const int idCluster2, const int totalWeight, const int bits) const { double ilewsp; if (bits == 0) ilewsp = this->tableClusters[idCluster1]->memory + this->tableClusters[idCluster2]->memory; else ilewsp = (this->tableClusters[idCluster1]->memory + this->tableClusters[idCluster2]->memory + std::log2((double) this->tableClusters[idCluster1]->weight / totalWeight) * this->tableClusters[idCluster1]->weight + std::log2((double) this->tableClusters[idCluster2]->weight / totalWeight) * this->tableClusters[idCluster2]->weight) / bits; //error two clusters array[0] = std::numeric_limits<double>::infinity(); //memory of cluster 'idCluster2' array[1] = this->tableClusters[idCluster2]->memory; if (ilewsp > std::numeric_limits<double>::epsilon()) { double dim1, dim2; auto *temp = new double[4]; // old dim1, dim2 dim1 = this->tableClusters[idCluster1]->memory / this->tableClusters[idCluster1]->weight; dim2 = this->tableClusters[idCluster2]->memory / this->tableClusters[idCluster2]->weight; dim1 = std::round(dim1); dim2 = std::round(dim2); for (int i = -bound; i <= bound; ++i) { if (dim1 + i < 0 || dim2 + i < 0 || dim1 + i > Cluster::N || dim2 + i > Cluster::N) continue; temp[0] = (dim1 + i) * this->tableClusters[idCluster1]->weight; temp[2] = (dim2 + i) * this->tableClusters[idCluster2]->weight; if (temp[0] <= ilewsp) { temp[1] = ilewsp - temp[0]; temp[3] = tableClusters[idCluster1]->err(dim1 + i) * tableClusters[idCluster1]->weight + tableClusters[idCluster2]->err(temp[1] / tableClusters[idCluster2]->weight) * tableClusters[idCluster2]->weight; if (temp[3] < array[0]) { array[1] = temp[1]; array[0] = temp[3]; } } if (temp[2] <= ilewsp) { temp[1] = ilewsp - temp[2]; temp[3] = this->tableClusters[idCluster1]->err(temp[1] / this->tableClusters[idCluster1]->weight) * this->tableClusters[idCluster1]->weight + this->tableClusters[idCluster2]->err(dim2 + i) * this->tableClusters[idCluster2]->weight; if (temp[3] < array[0]) { array[1] = temp[2]; array[0] = temp[3]; } } } // new dim1, dim2 dim1 = (ilewsp - array[1]) / this->tableClusters[idCluster1]->weight; dim2 = array[1] / this->tableClusters[idCluster2]->weight; this->tableClusters[idCluster1]->dim = dim1; this->tableClusters[idCluster2]->dim = dim2; delete[] temp; if (bits != 0) array[1] = -std::log2((double) this->tableClusters[idCluster2]->weight / totalWeight) * this->tableClusters[idCluster2]->weight + bits * array[1]; // new memory of cluster 'idCluster1' = old memories Cluster1+Cluster2 - new memory Cluster2 } } /** * The function improves the size and memory of two clusters * * @param idCluster1 (<i><b>Cluster &</i></b>) - index of the first cluster * @param idCluster2 (<i><b>Cluster &</i></b>) - index of the second cluster * @param totalWeight (<i><b>int</i></b>) - the total number of data * @param matrix (<i><b>double*</i></b>) - symmetric matrix * @param eigenvalues (<i><b>double*</i></b>) - eigenvalues of A (vector with size 'dim') * @param bits (<i><b>int</i></b>) - number of bits needed to memorize one scalar * * @return returns 0 or 1, 0 when cluster 'idCluster1' has an integer dimension, 1 for the second case */ int ContainerClusters::updateDim(int idCluster1, int idCluster2, int totalWeight, double *matrix, double *eigenvalues, int bits) { int ret = 0; double ilewsp; if (bits == 0) ilewsp = this->tableClusters[idCluster1]->memory + this->tableClusters[idCluster2]->memory; else ilewsp = (this->tableClusters[idCluster1]->memory + this->tableClusters[idCluster2]->memory + std::log2((double) this->tableClusters[idCluster1]->weight / totalWeight) * this->tableClusters[idCluster1]->weight + std::log2((double) this->tableClusters[idCluster2]->weight / totalWeight) * this->tableClusters[idCluster2]->weight) / bits; double tempM = 0, blad = std::numeric_limits<double>::infinity(); if (bits == 0) { this->tableClusters[idCluster1]->dim = this->tableClusters[idCluster1]->memory / this->tableClusters[idCluster1]->weight; this->tableClusters[idCluster2]->dim = this->tableClusters[idCluster2]->memory / this->tableClusters[idCluster2]->weight; } else { this->tableClusters[idCluster1]->dim = (this->tableClusters[idCluster1]->memory + this->tableClusters[idCluster1]->weight * std::log2( (double) this->tableClusters[idCluster1]->weight / totalWeight)) / (bits * this->tableClusters[idCluster1]->weight); this->tableClusters[idCluster2]->dim = (this->tableClusters[idCluster2]->memory + this->tableClusters[idCluster2]->weight * std::log2( (double) this->tableClusters[idCluster2]->weight / totalWeight)) / (bits * this->tableClusters[idCluster2]->weight); } if (this->tableClusters[idCluster1]->dim - std::floor(this->tableClusters[idCluster1]->dim) > std::numeric_limits<double>::epsilon()) ret = 1; if (ilewsp > std::numeric_limits<double>::epsilon()) { double dim1, dim2; auto *temp = new double[4]; dim1 = std::round(this->tableClusters[idCluster1]->dim); dim2 = std::round(this->tableClusters[idCluster2]->dim); for (int i = -bound; i <= bound; ++i) { if (dim1 + i < 0 || dim2 + i < 0 || dim1 + i > Cluster::N || dim2 + i > Cluster::N) continue; temp[0] = (dim1 + i) * this->tableClusters[idCluster1]->weight; temp[2] = (dim2 + i) * this->tableClusters[idCluster2]->weight; if (temp[0] <= ilewsp) { temp[1] = ilewsp - temp[0]; temp[3] = this->tableClusters[idCluster1]->err(dim1 + i) * this->tableClusters[idCluster1]->weight + this->tableClusters[idCluster2]->err(temp[1] / this->tableClusters[idCluster2]->weight) * this->tableClusters[idCluster2]->weight; if (temp[3] < blad) { tempM = temp[1]; blad = temp[3]; this->tableClusters[idCluster1]->dim = dim1 + i; this->tableClusters[idCluster2]->dim = temp[1] / this->tableClusters[idCluster2]->weight; ret = 0; } } if (temp[2] <= ilewsp) { temp[1] = ilewsp - temp[2]; temp[3] = this->tableClusters[idCluster1]->err(temp[1] / this->tableClusters[idCluster1]->weight) * this->tableClusters[idCluster1]->weight + this->tableClusters[idCluster2]->err(dim2 + i) * this->tableClusters[idCluster2]->weight; if (temp[3] < blad) { tempM = temp[2]; blad = temp[3]; this->tableClusters[idCluster1]->dim = temp[1] / this->tableClusters[idCluster1]->weight; this->tableClusters[idCluster2]->dim = dim2 + i; ret = 1; } } } delete[] temp; this->tableClusters[idCluster1]->memory = this->tableClusters[idCluster1]->memory + this->tableClusters[idCluster2]->memory; if (bits == 0) this->tableClusters[idCluster2]->memory = tempM; else this->tableClusters[idCluster2]->memory = -std::log2((double) this->tableClusters[idCluster2]->weight / totalWeight) * this->tableClusters[idCluster2]->weight + bits * tempM; this->tableClusters[idCluster1]->memory -= this->tableClusters[idCluster2]->memory; // update eigenvalues of cluster int n_select, id_, old_dim; if (ret == 1) { id_ = idCluster1; old_dim = (int) dim1; } else { id_ = idCluster2; old_dim = (int) dim2; } if (old_dim - bound > this->tableClusters[id_]->dim || this->tableClusters[id_]->dim > old_dim + bound) { double *eigenvec = nullptr; int info; if (this->tableClusters[id_]->dim > static_cast<int>(Cluster::N / 2)) { // calculate the smallest eigenvalues n_select = (this->tableClusters[id_]->dim - floor(this->tableClusters[id_]->dim) > 0) ? static_cast<int>(Cluster::N - ceil(this->tableClusters[id_]->dim) + 1) : static_cast<int>(Cluster::N - ceil(this->tableClusters[id_]->dim)); n_select += bound + 1; n_select = (n_select >= Cluster::N) ? Cluster::N : n_select; } else { // calculate the largest eigenvalues n_select = -static_cast<int>(floor(this->tableClusters[id_]->dim) + 1); n_select -= bound + 1; n_select = (n_select <= -Cluster::N) ? -Cluster::N : n_select; } if (n_select != 0) { for (int i = 0; i < Cluster::N * Cluster::N; i++) matrix[i] = this->tableClusters[id_]->cov[i]; try { info = eigensystem(Cluster::N, n_select, matrix, eigenvalues, eigenvec); if (info != 0) throw std::runtime_error("Calculating eigenvalues failed!"); if (n_select > 0) for (int ih = 0; ih < n_select; ++ih) this->tableClusters[id_]->eigenvalues[ih] = eigenvalues[ih]; else for (int ih = 0; ih < -n_select; ++ih) this->tableClusters[id_]->eigenvalues[Cluster::N - 1 - ih] = eigenvalues[-n_select - 1 - ih]; } catch (std::exception const &str) { std::cerr << "Exception: " << str.what() << "\n"; } } } } return ret; } /** * Hartigan iteration * * @param size (<i><b>int[]</b></i>) - size of data * @param data (<i><b>double*</b></i>) - 2-dimensional array, which save data <i>row-major order</i> * @param groups (<i><b>int*</b></i>) - list of id clusters (values: 0,1,...,howClusters-1; <i>row-major order</i>) * @param howClusters (<i><b>int</b></i>) - determines how much we want to create clusters * @param allMemory (<i><b>double</b></i>) - general memory we have at our disposal * @param bits (<i><b>int</i></b>) - number of bits needed to memorize one scalar */ void ContainerClusters::stepHartigan(int *grups, std::vector<int> &activeClusters, const int size[], const double *data, const double allMemory, const int bits) { bool outside, T = false; int howClusters = activeClusters.back() + 1; this->createCluster(size, data, grups, howClusters, allMemory, bits); std::vector<int>::iterator it, min_it; int l, j, m, i, min_weight, id_i, n_select; double temp, c, tempMemory = 0; auto *point = new double[size[1]]; auto *tempVec = new double[size[1]]; double array[2]; auto *matrix = new double[Cluster::N * Cluster::N]; int info; double *eigenvec = nullptr; auto *eigenvalues = new double[Cluster::N]; auto *copy = new ContainerClusters(); int stop = size[0]; bool check = true; int items = 0; double error2cluster = 0; auto *errorsTWOclustersArray = new double[(howClusters * (howClusters - 1)) / 2]; std::fill(errorsTWOclustersArray, errorsTWOclustersArray + (howClusters * (howClusters - 1)) / 2, -1.0); while (!T && items < 50) { std::cout << "\r\033[3;37mIteration \033[0;3;30;107m[" << items + 1 << "|50]\033[0;3;37m.\033[0m" << std::flush; items++; T = true; for (m = 0; m < size[0] && !(m == stop && check); m++) { check = true; copy_vec(size[1], data + m * size[1], point); l = grups[m]; if (bits != 0) { outside = true; for (it = activeClusters.begin(); it != activeClusters.end(); it++) if (l == *it) { outside = false; break; } if (outside) { temp = this->tableClusters[l]->memory / this->tableClusters[l]->weight; l = activeClusters.front(); grups[m] = l; this->tableClusters[l]->changePoint(point, 1, tempVec); this->tableClusters[l]->memory += temp; for (i = 0; i < Cluster::N * Cluster::N; i++) matrix[i] = this->tableClusters[l]->cov[i]; if (bits == 0) this->tableClusters[l]->dim = this->tableClusters[l]->memory / this->tableClusters[l]->weight; else this->tableClusters[l]->dim = (this->tableClusters[l]->memory + this->tableClusters[l]->weight * std::log2((double) this->tableClusters[l]->weight / size[0])) / (bits * this->tableClusters[l]->weight); if (this->tableClusters[l]->dim > static_cast<int>(Cluster::N / 2)) { // calculate the smallest eigenvalues n_select = (this->tableClusters[l]->dim - floor(this->tableClusters[l]->dim) > 0) ? static_cast<int>(Cluster::N - ceil(this->tableClusters[l]->dim) + 1) : static_cast<int>(Cluster::N - ceil(this->tableClusters[l]->dim)); n_select += bound + 1; n_select = (n_select >= Cluster::N) ? Cluster::N : n_select; } else { // calculate the largest eigenvalues n_select = -static_cast<int>(floor(this->tableClusters[l]->dim) + 1); n_select -= bound + 1; n_select = (n_select <= -Cluster::N) ? -Cluster::N : n_select; } if (n_select != 0) try { info = eigensystem(Cluster::N, n_select, matrix, eigenvalues, eigenvec); if (info != 0) throw std::runtime_error("Calculating eigenvalues failed!"); if (n_select > 0) for (int ih = 0; ih < n_select; ++ih) this->tableClusters[l]->eigenvalues[ih] = eigenvalues[ih]; else for (int ih = 0; ih < -n_select; ++ih) this->tableClusters[l]->eigenvalues[Cluster::N - 1 - ih] = eigenvalues[-n_select - 1 - ih]; } catch (std::exception const &str) { std::cerr << "Exception: " << str.what() << "\n"; } T = false; stop = m + 1; check = false; } } *copy = *this; copy->tableClusters[l]->changePoint(point, -1, tempVec); for (i = 0; i < Cluster::N * Cluster::N; i++) matrix[i] = copy->tableClusters[l]->cov[i]; if (copy->tableClusters[l]->dim > static_cast<int>(Cluster::N / 2)) { // calculate the smallest eigenvalues n_select = (copy->tableClusters[l]->dim - floor(copy->tableClusters[l]->dim) > 0) ? static_cast<int>(Cluster::N - ceil(copy->tableClusters[l]->dim) + 1) : static_cast<int>(Cluster::N - ceil(copy->tableClusters[l]->dim)); n_select += bound + 1; n_select = (n_select >= Cluster::N) ? Cluster::N : n_select; } else { // calculate the largest eigenvalues n_select = -static_cast<int>(floor(copy->tableClusters[l]->dim) + 1); n_select -= bound + 1; n_select = (n_select <= -Cluster::N) ? -Cluster::N : n_select; } if (n_select != 0) try { info = eigensystem(Cluster::N, n_select, matrix, eigenvalues, eigenvec); if (info != 0) throw std::runtime_error("Calculating eigenvalues failed!"); if (n_select > 0) for (int ih = 0; ih < n_select; ++ih) copy->tableClusters[l]->eigenvalues[ih] = eigenvalues[ih]; else for (int ih = 0; ih < -n_select; ++ih) copy->tableClusters[l]->eigenvalues[Cluster::N - 1 - ih] = eigenvalues[-n_select - 1 - ih]; } catch (std::exception const &str) { std::cerr << "Exception: " << str.what() << "\n"; } j = l; c = 0.0; for (it = activeClusters.begin(); it != activeClusters.end(); it++) { if (*it != l) { id_i = index(l, *it, howClusters); if (errorsTWOclustersArray[id_i] == -1) { this->errorsTWOclusters(array, l, *it, size[0], bits); temp = array[0]; errorsTWOclustersArray[id_i] = temp; } else temp = errorsTWOclustersArray[id_i]; copy->tableClusters[*it]->changePoint(point, 1, tempVec); for (i = 0; i < Cluster::N * Cluster::N; i++) matrix[i] = copy->tableClusters[*it]->cov[i]; if (copy->tableClusters[*it]->dim > static_cast<int>(Cluster::N / 2)) { // calculate the smallest eigenvalues n_select = (copy->tableClusters[*it]->dim - floor(copy->tableClusters[*it]->dim) > 0) ? static_cast<int>(Cluster::N - ceil(copy->tableClusters[*it]->dim) + 1) : static_cast<int>(Cluster::N - ceil(copy->tableClusters[*it]->dim)); n_select += bound + 1; n_select = (n_select >= Cluster::N) ? Cluster::N : n_select; } else { // calculate the largest eigenvalues n_select = -static_cast<int>(floor(copy->tableClusters[*it]->dim) + 1); n_select -= bound + 1; n_select = (n_select <= -Cluster::N) ? -Cluster::N : n_select; } if (n_select != 0) try { info = eigensystem(Cluster::N, n_select, matrix, eigenvalues, eigenvec); if (info != 0) throw std::runtime_error("Calculating eigenvalues failed!"); if (n_select > 0) for (int ih = 0; ih < n_select; ++ih) copy->tableClusters[*it]->eigenvalues[ih] = eigenvalues[ih]; else for (int ih = 0; ih < -n_select; ++ih) copy->tableClusters[*it]->eigenvalues[Cluster::N - 1 - ih] = eigenvalues[-n_select - 1 - ih]; } catch (std::exception const &str) { std::cerr << "Exception: " << str.what() << "\n"; } copy->errorsTWOclusters(array, l, *it, size[0], bits); if (array[0] < (c + temp)) { j = *it; c = array[0] - temp; tempMemory = array[1]; error2cluster = array[0]; } } if (c == -std::numeric_limits<double>::infinity()) break; } if (j != l) { T = false; stop = m + 1; check = false; grups[m] = j; for (int kk = 0; kk < howClusters; ++kk) { if (l != kk) { id_i = index(l, kk, howClusters); errorsTWOclustersArray[id_i] = -1.0; } if (j != kk) { id_i = index(j, kk, howClusters); errorsTWOclustersArray[id_i] = -1.0; } } id_i = index(l, j, howClusters); errorsTWOclustersArray[id_i] = error2cluster; this->tableClusters[l]->weight = copy->tableClusters[l]->weight; this->tableClusters[j]->weight = copy->tableClusters[j]->weight; for (int ii = 0; ii < size[1]; ii++) { this->tableClusters[l]->mean[ii] = copy->tableClusters[l]->mean[ii]; this->tableClusters[j]->mean[ii] = copy->tableClusters[j]->mean[ii]; this->tableClusters[l]->eigenvalues[ii] = copy->tableClusters[l]->eigenvalues[ii]; this->tableClusters[j]->eigenvalues[ii] = copy->tableClusters[j]->eigenvalues[ii]; for (int jj = 0; jj < size[1]; jj++) { this->tableClusters[l]->cov[ii * size[1] + jj] = copy->tableClusters[l]->cov[ii * size[1] + jj]; this->tableClusters[j]->cov[ii * size[1] + jj] = copy->tableClusters[j]->cov[ii * size[1] + jj]; } } this->tableClusters[l]->memory = this->tableClusters[l]->memory + this->tableClusters[j]->memory - tempMemory; this->tableClusters[j]->memory = tempMemory; this->tableClusters[l]->dim = copy->tableClusters[l]->dim; this->tableClusters[j]->dim = copy->tableClusters[j]->dim; } } // Delete cluster which have a small number of points if (bits != 0) { min_weight = size[0]; for (it = activeClusters.begin(); it != activeClusters.end(); it++) if (min_weight >= this->tableClusters[*it]->weight) { min_it = it; min_weight = this->tableClusters[*it]->weight; } if (this->tableClusters[*min_it]->unassign(size[0])) { activeClusters.erase(min_it); T = false; } if (activeClusters.empty()) { std::cout << "Delete all clusters. Small number of points in relation to the dimension of the data.\n" << std::flush; T = true; } } } delete copy; delete[] point; delete[] tempVec; delete[] errorsTWOclustersArray; std::cout << " \033[3;92mTraining done :)\033[0m\n" << std::flush; //update dimensions and memory of clusters if (activeClusters.size() == 1) { this->tableClusters[activeClusters.front()]->dim = this->tableClusters[activeClusters.front()]->memory / size[0]; if (bits != 0) this->tableClusters[activeClusters.front()]->dim /= bits; } else { std::vector<int> vec; vec.reserve(activeClusters.size()); for (it = activeClusters.begin(); it != activeClusters.end(); ++it) vec.push_back(*it); while (vec.size() > 1) { it = vec.begin(); i = this->updateDim(*it, *(it + 1), size[0], matrix, eigenvalues, bits); vec.erase(it + i); } vec.clear(); vec.resize(0); } delete[] matrix; delete[] eigenvalues; this->error = 0.0; if (bits != 0) { for (i = this->size - 1; i >= 0; i--) { outside = true; for (auto rit = activeClusters.rbegin(); rit != activeClusters.rend(); ++rit) if (i == *rit) { outside = false; break; } if (outside) { delete this->tableClusters[i]; this->tableClusters.erase(this->tableClusters.begin() + i); this->size -= 1; } else { this->error += this->tableClusters[i]->errorFUN(size[0], bits); } } } else { for (i = this->size - 1; i >= 0; i--) this->error += this->tableClusters[i]->errorFUN(size[0], bits); } } /** * * @param groups (<i><b>int*</b></i>) - list of id clusters (values: 0,1,...,howClusters-1; <i>row-major order</i>) * @param size (<i><b>int[]</b></i>) - size of data * @param data (<i><b>double*</b></i>) - 2-dimensional array, which save data <i>row-major order</i> * @param howClusters (<i><b>int</b></i>) - determines how much we want to create clusters * @param allMemory (<i><b>double</b></i>) - general memory we have at our disposal * @param bits (<i><b>int</i></b>) - number of bits needed to memorize one scalar * @param iteration (<i><b>int</i></b>) - number of iterations * */ void ContainerClusters::Hartigan(int *grups, const int size[], const double *data, int howClusters, const double allMemory, const int iteration, const int bits) { // std::random_device rd; // std::mt19937 gen(rd()); // std::uniform_int_distribution<> dis(0, howClusters - 1); /* initialize random seed: */ srand(time(NULL)); auto *TEMPgrups = new int[size[0]]; auto *temp = new ContainerClusters(); auto *TEMPactiveClusters = new std::vector<int>(); TEMPactiveClusters->reserve((unsigned long) howClusters); std::vector<int> *activeClusters = nullptr; if (bits != 0) { activeClusters = new std::vector<int>(); activeClusters->reserve((unsigned long) howClusters); } int i, j; for (i = 0; i < iteration; i++) { for (j = 0; j < howClusters; j++) TEMPactiveClusters->push_back(j); for (j = 0; j < size[0]; j++) // TEMPgrups[j] = dis(gen); TEMPgrups[j] = rand() % howClusters; std::cout << "\033[1;37m------------------------------------\n" "Random initialization: [" << i + 1 << "|" << iteration << "].\033[0m\n" << std::flush; temp->stepHartigan(TEMPgrups, *TEMPactiveClusters, size, data, allMemory, bits); if (abs(temp->error) < abs(this->error)) { *this = *temp; for (j = 0; j < size[0]; j++) grups[j] = TEMPgrups[j]; if (bits != 0) activeClusters->assign(TEMPactiveClusters->begin(), TEMPactiveClusters->end()); } TEMPactiveClusters->clear(); temp->clean(); } if (bits != 0 && this->size != howClusters) { j = 0; for (i = 0; i < size[0]; i++) { for (int &activeCluster : *activeClusters) { if (grups[i] == activeCluster) { grups[i] = j; break; } j++; } j = 0; } } delete temp; delete[] TEMPgrups; TEMPactiveClusters->clear(); delete TEMPactiveClusters; if (bits != 0) { activeClusters->clear(); delete activeClusters; } } /** * * function compresses data - changes "data" array * * @param size (<i><b>int[]</b></i>) - size of data * @param data (<i><b>double*</b></i>) - 2-dimensional array, which save data <i>row-major order</i> * @param groups (<i><b>int*</b></i>) - list of id clusters (values: 0,1,...,howClusters-1; <i>row-major order</i>) * */ void ContainerClusters::compression(double *data, const int size[], const int *grups) { int i, j; // create array cluster eigenvectors auto *matrix = new double[Cluster::N * Cluster::N]; auto *temp = new double[Cluster::N]; int info, n_select; try { for (j = 0; j < this->size; j++) { n_select = Cluster::N - (int) std::floor(this->tableClusters[j]->dim); this->tableClusters[j]->eigenvectors = new double[Cluster::N * n_select]; for (i = 0; i < Cluster::N * Cluster::N; i++) matrix[i] = this->tableClusters[j]->cov[i]; // one eigenvector in one column (stored columnwise) // info = eigensystem(Cluster::N, matrix, temp, this->tableClusters[j]->eigenvectors, true); info = eigensystem(Cluster::N, -n_select, matrix, temp, this->tableClusters[j]->eigenvectors, true); if (info != 0) throw "Calculating eigenvectors failed!"; } } catch (const char *str) { std::cerr << "Exception: " << str << "\n"; } delete[] matrix; delete[] temp; for (i = 0; i < size[0]; i++) { j = grups[i]; this->tableClusters[j]->compression(data + i * size[1]); } // delete eigenvectors because I do not cleare memory in destructors for (i = 0; i < this->size; i++) delete[] this->tableClusters[i]->eigenvectors; } /** * * @param data (<i><b>double*</b></i>) - 2-dimensional array, which save data <i>row-major order</i> * @param groups (<i><b>int*</b></i>) - list of id clusters (values: 0,1,...,howClusters-1; <i>row-major order</i>) * @param size (<i><b>int[]</b></i>) - size of data * @param howClusters (<i><b>int</b></i>) - determines how much we want to create clusters * @param iteration (<i><b>int</i></b>) - number of iterations * @param bits (<i><b>int</i></b>) - number of bits needed to memorize one scalar * @param allMemory (<i><b>double</b></i>) - general memory we have at our disposal * @param degreeOfCompression - Compression ratio * */ void ContainerClusters::run(double *data, int *grups, const int size[], const int howClusters, const double degreeOfCompression, const int iteration, const int bits) { double allMemory = (bits == 0) ? degreeOfCompression * size[0] * size[1] : degreeOfCompression * bits * size[0] * size[1]; this->Hartigan(grups, size, data, (unsigned int) howClusters, allMemory, iteration, bits); this->compression(data, size, grups); } /** * * * @param group (<i><b>int*</b></i>) - tablica (o wartosciach: 0,1,...,howClusters-1; <i>row-major order</i>) okreslajaca poczatkowe polozenie poszczegolnych punktow ze zbioru 'data' * @param size (<i><b>int[]</b></i>) - tablica dwuwymiarowa okrslajaca (odpowiednio): wymiar w jakim sa przedstawione dane oraz ilosc danych * @param data (<i><b>double*</b></i>) - dane <i>row-major order</i> * @param howClusters (<i><b>int</b></i>) - okresla ile chcemy stworzyc klastrow * @param allMemory (<i><b>double</b></i>) - ogolna pamiec jaka mamy do dyspozycji * @param n_threads (<i><b>int</i></b>) - liczba watkow * @param iteration (<i><b>int</i></b>) - zmienna okresla ilosc iteracji * @param bits (<i><b>int</i></b>) - bity to ilosc bitow potrzebna do pamietania jednego skalara */ void ContainerClusters::Hartigan_parallel(int *group, const int *size, const double *data, const unsigned int howClusters, const double allMemory, unsigned int n_threads, int iteration, const int bits) { unsigned int numCPU = std::thread::hardware_concurrency(); n_threads = (n_threads <= numCPU) ? n_threads : numCPU; std::vector<std::thread> threads; std::vector<ContainerClusters *> array_containerCL; auto *TEMPgrups = new int[n_threads * size[0]]; int id_min_error; double min_value; // this->error int i, j = 0, n_iteration_thread = (int) std::ceil(iteration / double(n_threads)); while (iteration > 0) { i = (iteration > n_iteration_thread) ? n_iteration_thread : iteration; std::this_thread::sleep_for(std::chrono::milliseconds(1)); array_containerCL.emplace_back(new ContainerClusters()); threads.emplace_back( std::thread(&ContainerClusters::Hartigan, array_containerCL.back(), TEMPgrups + size[0] * j++, size, data, howClusters, allMemory, i, bits)); iteration -= i; } for (auto &thread : threads) // if (thread.joinable()) thread.join(); id_min_error = -1; min_value = this->error; for (i = 0; i < array_containerCL.size(); i++) if (min_value > array_containerCL[i]->getError()) { id_min_error = i; min_value = array_containerCL[i]->getError(); } if (id_min_error != -1) { *this = *array_containerCL[id_min_error]; for (j = 0; j < size[0]; ++j) group[j] = TEMPgrups[id_min_error * size[0] + j]; } threads.clear(); for (ContainerClusters *con: array_containerCL) delete con; array_containerCL.clear(); delete[] TEMPgrups; }
dea49e3a276781488595442803af8e963ba94e7a
3edc478db837a27dbf8df7eded45df909dfe3cf9
/URI online/2574.cpp
98defe2c1073458c0dc166a1019f68380ac3ca8c
[]
no_license
ronistone/Maratonas
b60ebeb9e7e9298399652df88faa83389bd94542
8bd0bedd476645081a09b19152a007ca1497fe20
refs/heads/master
2021-01-12T10:06:04.016208
2018-10-19T02:40:54
2018-10-19T02:40:54
76,360,276
1
0
null
null
null
null
UTF-8
C++
false
false
769
cpp
2574.cpp
#include <bits/stdc++.h> using namespace std; typedef int ll; ll M[2050][2050]; main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll n,g,sum,at; bool fail; memset(M,0,sizeof M); cin >> n >> g; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cin >> M[i][j]; if(i>1) M[i][j] += M[i-1][j]; if(j>1) M[i][j] += M[i][j-1]; if(i>1 and j>1) M[i][j] -= M[i-1][j-1]; } } for(int z=1;z<=n;z*=2){ sum = 0; fail = false; for(int i=0;i<n and !fail;i+=z){ for(int j=0;j<n and !fail;j+=z){ at = M[i+z][j+z]; if(i>1) at -= M[i][j+z]; if(j>1) at -= M[i+z][j]; if(j>1 and i>1) at += M[i][j]; if(at < g){ fail = true; sum = 0; } else{ sum++; } } } if(!fail) break; } cout << sum << endl; }
bdf9bf5d192eac500c6765137e754d8a4daed880
499f220afdb8293a31041a0a06bf8a1d8af18029
/Lab_Works/OOP_Lab/Shopping_Management_System/ShoppingCart.h
1a168f42f7d1cf66880a14ab69d1a6516e950af0
[]
no_license
acharyasandeep/Lab_Works
c89660613d90599991da78a54b5738c28c467583
42676a9a8960fb86f639692ad856af6fa826ee8f
refs/heads/main
2023-03-14T06:55:21.672477
2021-02-23T17:51:12
2021-02-23T17:51:12
336,042,713
1
0
null
null
null
null
UTF-8
C++
false
false
570
h
ShoppingCart.h
#ifndef SHOPPING_CART_H #define SHOPPING_CART_H #include "ItemToPurchase.h" #include <string> using namespace std; class ShoppingCart { private: string customerName; string currentDate; vector<ItemToPurchase> cartItems; public: ShoppingCart(); ShoppingCart(string name, string date); string GetCustomerName(); string GetDate(); void AddItem(ItemToPurchase item); void RemoveItem(string name); void ModifyItem(ItemToPurchase item); int GetNumItemsInCart(); double GetCostOfCart(); void PrintTotal(); void PrintDescriptions(); }; #endif
78b2b5c38886397ddef85a4edb97af3d9928ff24
f592f20f5bc9f0dfde30392fa63f6c341bd71fb9
/type_traits.hpp
fd5aa855e6cf606b67ca79d7751efa1b553be23a
[ "MIT" ]
permissive
ho-ri1991/static-graph
344577006a6997a6ca11dee39f86bf44ef664e24
2ed0381a71e28e4b63deec68501dd2dd26597cd3
refs/heads/master
2020-04-02T02:34:23.054653
2018-10-20T15:08:18
2018-10-20T15:08:18
153,916,802
1
0
null
null
null
null
UTF-8
C++
false
false
3,088
hpp
type_traits.hpp
#ifndef TYPE_TRAITS_HPP #define TYPE_TRAITS_HPP namespace type_traits { template <typename T> struct identity { using type = T; }; template <typename Tpl, typename... Tpls> struct concat { using type = typename concat<Tpl, typename concat<Tpls...>::type>::type; }; template <template <typename...> class Tpl, typename... Ts> struct concat<Tpl<Ts...>> { using type = Tpl<Ts...>; }; template <template <typename...> class Tpl, typename... Ts, typename... Us> struct concat<Tpl<Ts...>, Tpl<Us...>> { using type = Tpl<Ts..., Us...>; }; template <typename... Tpls> using concat_t = typename concat<Tpls...>::type; template <typename Tpl> struct head; template <template <typename...> class Tpl, typename T, typename...Ts> struct head<Tpl<T, Ts...>> { using type = T; }; template <template <typename...> class Tpl> struct head<Tpl<>> {}; template <typename Tpl> using head_t = typename head<Tpl>::type; template <typename Tpl> struct tail; template <template <typename...> class Tpl, typename T, typename...Ts> struct tail<Tpl<T, Ts...>> { using type = Tpl<Ts...>; }; template <template <typename...> class Tpl> struct tail<Tpl<>> {}; template <typename Tpl> using tail_t = typename tail<Tpl>::type; template <typename Tpl> struct last: last<tail_t<Tpl>> {}; template <template <typename...> class Tpl, typename T> struct last<Tpl<T>> { using type = T; }; template <typename Tpl> using last_t = typename last<Tpl>::type; template <template <typename...> class Class, typename T> struct is_match_template: std::false_type {}; template <template <typename...> class Class, typename... Ts> struct is_match_template<Class, Class<Ts...>>: std::true_type {}; template <template <typename...> class Class, typename T> constexpr bool is_match_template_v = is_match_template<Class, T>::value; template <typename Tpl> struct size; template <template <typename...> class Tpl, typename...Ts> struct size<Tpl<Ts...>> { static constexpr std::size_t value = sizeof...(Ts); }; template <typename Tpl> constexpr std::size_t size_v = size<Tpl>::value; template <typename Tpl, typename T> struct push_back; template <template <typename...> class Tpl, typename... Ts, typename T> struct push_back<Tpl<Ts...>, T> { using type = Tpl<Ts..., T>; }; template <typename Tpl, typename T> using push_back_t = typename push_back<Tpl, T>::type; template <typename Tpl, typename T> struct push_front; template <template <typename...> class Tpl, typename... Ts, typename T> struct push_front<Tpl<Ts...>, T> { using type = Tpl<T, Ts...>; }; template <typename Tpl, typename T> using push_front_t = typename push_front<Tpl, T>::type; template <typename Tpl, template <typename> class Fn> struct for_each; template <template <typename...> class Tpl, typename... Ts, template <typename> class Fn> struct for_each<Tpl<Ts...>, Fn> { using type = Tpl<typename Fn<Ts>::type...>; }; template <typename Tpl, template <typename> class Fn> using for_each_t = typename for_each<Tpl, Fn>::type; } #endif
eb423cdfe85239b1671d0f5df5fb8a79b1dce3c9
749c8804e99f672683b2c56c6067a1ee5e386b5e
/c++/h239.cpp
6d9f5d53446fc740373718b302549cd1fd1ccce7
[]
no_license
buaawht/leetcode
0df378fe647914f3c9e69af05fd8bac5d891ae45
a2947d45978cab647bde623ff86283d54cb41f17
refs/heads/master
2020-04-19T01:52:38.577788
2019-03-09T09:01:45
2019-03-09T09:01:45
167,884,563
0
0
null
null
null
null
UTF-8
C++
false
false
2,705
cpp
h239.cpp
// // Created by buaawht on 2019-02-23. // /* Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. Return the max sliding window. Example: Input: nums = [1,3,-1,-3,5,3,6,7], and k = 3 Output: [3,3,5,5,6,7] Explanation: Window position Max --------------- ----- [1 3 -1] -3 5 3 6 7 3 1 [3 -1 -3] 5 3 6 7 3 1 3 [-1 -3 5] 3 6 7 5 1 3 -1 [-3 5 3] 6 7 5 1 3 -1 -3 [5 3 6] 7 6 1 3 -1 -3 5 [3 6 7] 7 Note: You may assume k is always valid, 1 ≤ k ≤ input array's size for non-empty array. Follow up: Could you solve it in linear time? */ #import "util.h" class Solution { public: vector<int> maxSlidingWindow(vector<int> &nums, int k) { deque<int> deque1; vector<int> res; for (int i = 0; i < nums.size(); ++i) { if (!deque1.empty() && (i - k) == deque1.front()) { deque1.pop_front(); } while (!deque1.empty() && nums[deque1.back()] < nums[i]) { deque1.pop_back(); } deque1.push_back(i); if (i >= k - 1) { res.push_back(nums[deque1.front()]); } } return res; } }; int main() { vector<int> v = {1, 3, -1, -3, 5, 3, 6, 7}; show_vector(v); Solution s; vector<int> res = s.maxSlidingWindow(v, 3); show_vector(res); } /* 思路: 这道题本来我使用的是O(N^2)的方法,后来学习了LeetCode上别人的解法,在此记录一下。 这个方法使用了一个双端队列来保存来保存窗口中的数据的index,对这个队列的具体操作如下 【虽然队列中保存的是index,但是为了方便描述,就直接描述为数据】: 1. 在插入新数据的时候,如果队列为空就直接插入 2. 如果队列不为空就判断新数据和队尾元素的大小,如果队尾元素小于新数据,那么我们可以确定,在包含队尾元素和新数据的窗口里面, 一定是新数据最大,有了这个假设,我们就可以把队尾元素移除队列,然后重复这个比较,直到遇到一个比新数据大的数才停止出队列, 然后再把新数据插入。 这个就保证了,在队首的数据一定是当前窗口中最大的,然后队首后面的是次大的数据,依次类推,我们只需要在每次更新窗口的时候 【因为只有更新窗口才会有新数据插入】把队首元素提取出来,即可得到结果 */
3394f75e31f09cb00c0d2539b5bdcfa7fd9b34fd
b9b071551e43d3d95b45474cb0b4e527bfbd16e7
/Project/Project/src/incl/Camera.cpp
190f67542c77f1d3cbb6baa545244dc21b6f0447
[]
no_license
shengxus/OpenGL
4e93fb0b5d7cdf6943e7c82361c6495a4f86743c
af84bb4d75b91d24437bf88630deeecd35755a4d
refs/heads/master
2021-01-25T04:57:35.606064
2014-11-14T05:34:15
2014-11-14T05:34:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
912
cpp
Camera.cpp
#include "Camera.h" #include "glut.h" #include <cstring> #include <cmath> using namespace std; void Camera::initCamera(const GzCoord position, const GzCoord direction, const GzCoord worldup, float fovVal){ memcpy(eye, position, sizeof(GzCoord)); memcpy(lookat, direction, sizeof(GzCoord)); memcpy(up, worldup, sizeof(GzCoord)); memset(angle, 0, sizeof(GzCoord)); FOV = fovVal; } void Camera::move(int x, int y, int z){ step[X] -= x; step[Y] -= y; step[Z] -= z; } void Camera::turn(int axis, int degree){ if(axis!=X||degree<0&&angle[axis]>-90||degree>0&&angle[axis]<90) angle[axis]+=degree; } void Camera::setCamera() const{ gluLookAt(eye[X], eye[Y], eye[Z], lookat[X], lookat[Y], lookat[Z], up[X], up[Y], up[Z]); glRotatef(angle[X], -1,0,0); glRotatef(angle[Y], 0,-1,0); glRotatef(angle[Z], 0,0,-1); glTranslatef(step[X], step[Y], step[Z]); } float Camera::getFOV() const{ return FOV; }
2ae2a2238031536f78619019f8b869b00bb42311
51621fc9c30fa13bd591bb982f2700226ff4684d
/OntoMorph2/src/edu/ucsd/ccdb/glvolume/meshsrc/vvvirtexrend.cpp
f589a69987337d09bb1de9afb9c569a98ec83795
[]
no_license
lcpsky1991/ontomorphtab
a906a0784c7baf5884e0861084e240295bc18c60
1b4a7fc80c218ffed85bfd3af6b033645f72dc76
refs/heads/master
2021-05-29T10:43:45.276140
2009-01-22T18:41:13
2009-01-22T18:41:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
33,611
cpp
vvvirtexrend.cpp
// Virvo - Virtual Reality Volume Rendering // Copyright (C) 1999-2003 University of Stuttgart, 2004-2005 Brown University // Contact: Jurgen P. Schulze, jschulze@ucsd.edu // Han S Kim, hskim@cs.ucsd.edu // // This file is part of Virvo. // // Virvo is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library (see license.txt); if not, write to the // Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "vvvirtexrend.h" #include <vvstopwatch.h> #include <math.h> #include <list> #include <queue> #include <vector> using namespace std; using namespace MipMapVideoLib; /** vvVirTexRend Constructor Virtual Texture Renderer */ vvVirTexRend::vvVirTexRend(vvVolDesc* vd, vvRenderState renderState) : vvRenderer(vd, renderState) { vvDebugMsg::msg(2, "vvVirTexRend::vvVirTexRend()"); vvDebugMsg::msg(2, "vvVirTexRend::vvVirTexRend(): ", vd->getFilename()); init(); } vvVirTexRend::vvVirTexRend(vvVolDesc* vd, BrickManager* bm, vvRenderState renderState, int _volNum, int _frameNum, vvGLSL* _shader, GLuint _fragProgram, int brickLimit) : vvRenderer(vd, renderState) { brickManager = bm; assert(brickManager != NULL); volNum = _volNum; frameNum = _frameNum; shader = _shader; fragProgram = _fragProgram; _pixelToVoxelRatio = 16; _brickLimit = brickLimit; vd = brickManager->getVolDesc(volNum, frameNum); assert(vd != NULL); // these are correct values //cerr << "vvVirTexRend::vvVirTexRend: volNum: " << volNum << " frameNum: " << frameNum << endl; //cerr << "vvVirTexRend::vvVirTexRend: " << vd->getFilename() << endl; rotation.identity(); translation.set(0.0, 0.0, 0.0); channelHue = new float[vd->chan]; // TODO: initial value for each channel? if(vd->chan < 4) { channelHue[0] = (float)0.0; channelHue[1] = (float)0.3333; channelHue[2] = (float)0.6666; } for(int i = 4; i < vd->chan; i++) channelHue[i] = (float)rand()/RAND_MAX; activeChannel = new int[vd->chan]; for(int i = 0; i < vd->chan; i++) activeChannel[i] = 1; init(); } /** vvVirTexRend Destructor */ vvVirTexRend::~vvVirTexRend() { vvDebugMsg::msg(2, "vvVirTexRend::~vvVirTexRend()"); delete[] channelHue; } /** */ void vvVirTexRend::init() { vvRenderer::init(); rendererType = VIRTEXREND; _renderState._boundaries=true; totalMemoryUsage = 0; volumeSize = vd->getSize(); // FIXME: we assume the origin of this volume is at the corner.... volumeCenter = vd->getSize(); volumeCenter.scale(0.5); vvDebugMsg::msg(2, "vvVirTexRend::init(): volumeSize=", volumeSize[0], volumeSize[1], volumeSize[2]); computeInitialLevel(); //vvDebugMsg::msg(2, "vvVirTexRend::init(): location ", vd->pos[0], vd->pos[1], vd->pos[2]); //vvDebugMsg::msg(2, "vvVirTexRend::init(): ", origSize[0], origSize[1], origSize[2]); extMinMax = vvGLTools::isGLextensionSupported("GL_EXT_blend_minmax"); extBlendEquation = vvGLTools::isGLextensionSupported("GL_EXT_blend_equation"); #ifdef WIN32 if (extBlendEquation) glBlendEquationVV = (PFNGLBLENDEQUATIONEXTPROC)vvDynLib::glSym("glBlendEquationEXT"); else glBlendEquationVV = (PFNGLBLENDEQUATIONPROC)vvDynLib::glSym("glBlendEquation"); glBlendColor = (PFNGLBLENDCOLORPROC)wglGetProcAddress("glBlendColor"); #else if (extBlendEquation) glBlendEquationVV = (glBlendEquationEXT_type*)vvDynLib::glSym("glBlendEquationEXT"); else glBlendEquationVV = (glBlendEquationEXT_type*)vvDynLib::glSym("glBlendEquation"); #endif } /** Arbitrary size image-safe conservatively computes initial level */ void vvVirTexRend::computeInitialLevel() { // we stop if one mipmap block is equal to a brick size. minimumLevel = (int)(logf((float)brickManager->getBrickSize(volNum, frameNum)) / logf((float)2.0)); // which is 10 for 1024x1024 images // round up to the closest power of 2, to be safe int initLevelX = (int)ceilf(logf((float)volumeSize[0])/logf((float)2.0)); int initLevelY = (int)ceilf(logf((float)volumeSize[1])/logf((float)2.0)); // initLevelZ == 0 if dim == 2 int initLevelZ = (int)ceilf(logf((float)volumeSize[2])/logf((float)2.0)); assert( (brickManager->getDataDimension() == 2 && initLevelZ == 0) || (brickManager->getDataDimension() == 3)); vvDebugMsg::msg(1, "initLevel X, Y, Z=", initLevelX, initLevelY, initLevelZ); // pick max(initLevelX, initLevelY, initLevelZ), to be safe // "to be safe" means we starts meshing from as high level (low resolution) as possible // so as to prevent from memory overflow // the drawback will be it takes more time to find the most appropriate meshing // if it starts from a higher level initLevel = (initLevelX < initLevelY ? initLevelY : initLevelX); initLevel = (initLevel < initLevelZ ? initLevelZ : initLevel); //initLevel -= minimumLevel; #if 0 // commented out as we always computes the meshing from the highest level while(initLevel > minimumLevel) { // TODO: you may need to reformulate this.... e.g. multichannel int blockSize = (int)pow(2.0, (float)(initLevel - 1)); int blockNumX = (int)ceil((float)origImgSizeX / blockSize); int blockNumY = (int)ceil((float)origImgSizeY / blockSize); int mipMapMemoryUsage = blockNumX * blockNumY * (int)pow((float)BrickInfo::BRICK_SIZE, 2.0); //int mipMapMemoryUsage = (int)(origImgSizeX * origImgSizeY /pow(4.0, (float)(initLevel - 1))) ; vvDebugMsg::msg(2, "mipMemoryUsage at level ", initLevel-1, mipMapMemoryUsage); vvDebugMsg::msg(2, "# of blocks in this level ", blockNumX, blockNumY, blockNumX * blockNumY); if(mipMapMemoryUsage < MEMORY_LIMIT) initLevel--; else break; } #endif //vvDebugMsg::msg(2, "initial level: ", initLevel); //vvDebugMsg::msg(2, "minimum level: ", minimumLevel); assert(initLevel >= minimumLevel); } /** */ void vvVirTexRend::renderMultipleVolume() { //vvDebugMsg::msg(2, "vvVirTexRend::renderMultipleVolume()"); //vvRenderer::renderMultipleVolume(); float quadColors[3][3] = { {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}, }; vvMatrix mv; vvMatrix invMV; // inverse of model-view matrix vvMatrix pm; // OpenGL projection matrix float glMV[16]; vvVector3 eye; vvVector3 origin; int dataDimension = brickManager->getDataDimension(); //assert(dataDimension == 2 || dataDimension == 3); // model view matrix getModelviewMatrix(&mv); mv.translate(&translation); mv.multiplyPre(&rotation); mv.makeGL(glMV); // inversed model view matrix invMV.copy(&mv); invMV.invert(); // projection matrix getProjectionMatrix(&pm); isOrtho = pm.isProjOrtho(); // eye position [object coordinate] getEyePosition(&eye); eye.multiply(&invMV); // TODO: check this part again... // set normal if(isOrtho || (viewDir.e[0] == 0.0f && viewDir.e[1] == 0.0f && viewDir.e[2] == 0.0f)) { normal.set(0.0f, 0.0f, 1.0f); normal.multiply(&invMV); origin.zero(); origin.multiply(&invMV); normal.sub(&origin); } else if(isInVolume(&eye)) { normal.copy(&viewDir); normal.negate(); } else { normal.copy(&objDir); normal.negate(); } normal.normalize(); vvStopwatch* sw = new vvStopwatch(); sw->start(); float start = sw->getTime(); // generate a mesh if(generateMeshing() < 0) { vvDebugMsg::msg(2, "vvVirTexRend::generateMeshing() failed"); exit(0); //return; } cerr << "Mesh Generation: " << sw->getTime() - start << endl; //time_t t0 = clock(); //brickManager->resetMemoryLoadingTime(); //brickManager->resetTextureLoadingTime(); // you may need to sort quadList // sort by distance from eye quadList.sort(sortingBrickPredicate()); ////////////////////////////////////////////////////////// // prefetching should be here // load data if needed /* int brickMinX = INT_MAX; int brickMaxX = INT_MIN; int brickMinY = INT_MAX; int brickMaxY = INT_MIN; */ ///////////////////////////////////////////////////////// brickManager->resetMemoryLoadingTime(); if(_renderState._showTexture) { for(list<BrickInfo*>::iterator itr = quadList.begin(); itr != quadList.end(); itr++) { BrickInfo* current = (BrickInfo*)(*itr); if(brickManager->preRendering(current) < 0) { vvDebugMsg::msg(2, "Preparing rendering step failed"); return; } /* // get min, max of X, Y, and Z among all bricks if(brickMaxX < current->getBrickX()) brickMaxX = current->getBrickX(); if(brickMinX > current->getBrickX()) brickMinX = current->getBrickX(); if(brickMaxY < current->getBrickY()) brickMaxY = current->getBrickY(); if(brickMinY > current->getBrickY()) brickMinY = current->getBrickY(); */ } //vvDebugMsg::msg(1, "current bounding box: ", brickMinX, brickMaxX, brickMinY, brickMaxY); // get diff of bounding box from the previous // then we can identify the current movement X_{n-1} // feed } #if 0 if(brickManager->getMemoryLoadingTime() > 0.01 || brickManager->getTextureLoadingTime() > 0.01) { vvDebugMsg::msg(1, "memory loading time: ", brickManager->getMemoryLoadingTime()); vvDebugMsg::msg(1, "texture loading time: ", brickManager->getTextureLoadingTime()); brickManager->resetMemoryLoadingTime(); brickManager->resetTextureLoadingTime(); } #endif //float elapsed = float(clock() - t0)/float(CLOCKS_PER_SEC); //if(elapsed > 0.0001) //printf("loading time: %f\n", elapsed); if(_renderState._showBricks) { // load model view matrix glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadMatrixf(glMV); if(dataDimension == 3) glDisable(GL_TEXTURE_3D_EXT); else glDisable(GL_TEXTURE_2D); for(list<BrickInfo*>::iterator itr = quadList.begin(); itr != quadList.end(); itr++) { BrickInfo* current = (BrickInfo*)(*itr); vvVector3 quadSize = current->getActualSize(); vvVector3 quadCenter = current->getCenter(); //vvDebugMsg::msg(2, "quadSize: ", quadSize[0], quadSize[1], quadSize[2]); //vvDebugMsg::msg(2, "current->getLevel() ", current->getLevel(), current->getLevel()%3); drawBoundingBox(&quadSize, &quadCenter, quadColors[(current->getLevel())%3]); } if(dataDimension == 3) glEnable(GL_TEXTURE_3D_EXT); else // dim == 2 glEnable(GL_TEXTURE_2D); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } start = sw->getTime(); // setting GL environment variables; setGLenvironment(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadMatrixf(glMV); //t0 = clock(); //cerr << "fragProgram: " << fragProgram << endl; shader->useProgram(fragProgram); while(!quadList.empty()) { BrickInfo* current = (BrickInfo*)quadList.front(); if(_renderState._showTexture) { for(int i = 0; i < vd->chan; i++) { char varName[20]; #ifdef WIN32 _snprintf(varName, sizeof(varName), "channelColor[%d]", i); #else snprintf(varName, sizeof(varName), "channelColor[%d]", i); #endif float channelColor[3]; vvToolshed::HSBtoRGB(channelHue[i], (float)0.8, (float)0.7, &channelColor[0], &channelColor[1], &channelColor[2]); //cerr << "channelColor value_" << i << ": " << channelColor[0] << ", " << channelColor[1] << ", " << channelColor[2] << endl; shader->setValue(fragProgram, varName, 3, 1, channelColor); #ifdef WIN32 _snprintf(varName, sizeof(varName), "active[%d]", i); #else snprintf(varName, sizeof(varName), "active[%d]", i); #endif shader->setValue(fragProgram, varName, 1, &activeChannel[i]); } if(brickManager->renderBrick(current, shader, fragProgram) < 0) { vvDebugMsg::msg(2, "Drawing a brick failed"); return; } } //vvDebugMsg::msg(1, "current level: ", current->getLevel()); quadList.pop_front(); } //elapsed = float(clock() - t0)/float(CLOCKS_PER_SEC); //if(elapsed > 0.001) //printf("rendering time: %f\n", elapsed); shader->disable(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); unsetGLenvironment(); glFinish(); cerr << "Rendering Time: " << sw->getTime() - start << endl; delete sw; } ////////////////////////////////////////////////////////////////////////// // protected methods ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// float vvVirTexRend::getChannelHue(int chan) { assert(chan < vd->chan && chan >= 0); return channelHue[chan]; } void vvVirTexRend::setChannelHue(int chan, float value) { assert(chan < vd->chan && chan >= 0); channelHue[chan] = value; //cerr << "Channel hue for channel #" << chan << " is set to " << value << endl; } int vvVirTexRend::isActiveChannel(int chan) { assert(chan < vd->chan && chan >= 0); return activeChannel[chan]; } void vvVirTexRend::setActiveChannel(int chan, int value) { assert(chan < vd->chan && chan >= 0); activeChannel[chan] = value; if(value) cerr << "Channel #" << chan << " is activated" << endl; else cerr << "Channel #" << chan << " is deactivated" << endl; } /** */ int vvVirTexRend::generateMeshing() { vvMatrix mvMatrix; vvMatrix invMV; vvMatrix projMatrix; vvMatrix vpMatrix; vvMatrix transformMatrix; vvVector3 eye; //GLfloat mv[16]; //GLfloat proj[16]; GLint vp[4]; // 1. modelview matrix getModelviewMatrix(&mvMatrix); mvMatrix.translate(&translation); mvMatrix.multiplyPre(&rotation); //mvMatrix.print("mvMatrix in generateMeshing: "); // 2. inverse modelview matrix invMV.copy(&mvMatrix); invMV.invert(); // 3. projection matrix getProjectionMatrix(&projMatrix); /* glGetFloatv(GL_PROJECTION_MATRIX, proj); projMatrix.getGL((float*)proj); projMatrix.set(proj); projMatrix.transpose(); */ // 4. viewport matrix glGetIntegerv(GL_VIEWPORT, vp); float vpElmt[16] = { (float)vp[2]/2, 0, 0, (float)vp[0]+(float)vp[2]/2, 0, (float)vp[3]/2, 0, (float)vp[1]+(float)vp[3]/2, 0, 0, (float)0.5, (float)0.5, 0, 0, 0, (float)1.0 }; vpMatrix.set(vpElmt); // 5. Find eye position getEyePosition(&eye); eye.multiply(&invMV); //vpMatrix * projMatrix * mvMatrix transformMatrix.identity(); //transformMatrix.copy(&vpMatrix); transformMatrix.multiplyPost(&mvMatrix); transformMatrix.multiplyPost(&projMatrix); transformMatrix.multiplyPost(&vpMatrix); /* transformMatrix.multiplyPre(&vpMatrix); transformMatrix.multiplyPre(&projMatrix); transformMatrix.multiplyPre(&mvMatrix); */ //mvMatrix.print("ModelView matrix: "); //projMatrix.print("Projection Matrix: "); //vpMatrix.print("Viewport Matrix: "); //transformMatrix.print("Transform matrix: "); int numBrickRendered = 0; // mesh is initialized here and all the quads initialized here are stored in quadPQueue if((numBrickRendered = meshInit(eye, &transformMatrix)) < 0) { vvDebugMsg::msg(2, "vvVirTexRend::meshInit failed"); return -1; } //cerr << "numBrickRendered after meshInit: " << numBrickRendered << endl; //vvDebugMsg::msg(2, "vvVirTexRend::generateMeshing(): quadPQueue.size()=", (int)quadPQueue.size()); //totalMemoryUsage = brickManager->getTotalMemoryUsage(); // build a finer mesh until it reaches the maximum memory size //while(totalMemoryUsage < BrickManager::TEXTURE_LIMIT && numBrickRendered < _brickLimit) while(numBrickRendered < _brickLimit) { //vvDebugMsg::msg(2, "quadPQueue size: ", (int)quadPQueue.size()); // if all quads are in quadList if(quadPQueue.empty()) { //vvDebugMsg::msg(2, "vvVirTexRend::generateMeshing(): quadPQueue.empty()"); break; } BrickInfo* current = (BrickInfo*)quadPQueue.top(); if(current == NULL) { vvDebugMsg::msg(2, "Element is NULL in quadPQueue"); return -1; } //vvDebugMsg::msg(2, "the cost at top: ", current.getCost()); // TODO: check if this code really needs if(!current->isRendered()) { cerr << "here" << endl; totalMemoryUsage -= brickManager->getMemoryUsagePerBrick(); numBrickRendered--; quadPQueue.pop(); continue; } if((powf(2.0, brickManager->getDataDimension()) - 1) * brickManager->getMemoryUsagePerBrick() + totalMemoryUsage < BrickManager::TEXTURE_LIMIT) { // pop lower resolution brick quadPQueue.pop(); if(current->isRendered() && (current->getLevel() == 0 || !current->getFiner())) { // stop because we can't have more finer quad even if we still have enough memory // move the quad into the final list, quadList //vvDebugMsg::msg(3, "pushing into quadList"); //if(!current.getFiner()) //vvDebugMsg::msg(3, "mesh is too small to have a finer quad"); quadList.push_back(current); //vvDebugMsg::msg(1, "pushed: ", (int)quadList.size()); //cerr << "level: " << current->getLevel() << " finer: " << current->getFiner() << " rendered: " << current->isRendered() << endl; } else { // we don't render current numBrickRendered--; //cerr << "numBrickRendered decreased" << endl; // let's go down one level //totalMemoryUsage += brickManager->getMemoryUsagePerBrick() * ((int)powf((float)2.0, (float)brickManager->getDataDimension()) - 1); //vvDebugMsg::msg(2, "totalMemoryUsage so far: ", totalMemoryUsage); vvVector3 bottomLeftFrontCoord = current->getCoord(0); vvVector3 centerCoord = current->getCenter(); vvVector3 newBottomLeftFrontCoord; // 0. SWF - this quad always overlaps with the image we are rendering newBottomLeftFrontCoord = bottomLeftFrontCoord; BrickInfo* newQuad1 = brickManager->getBrickInfo(volNum, frameNum, current->getLevel()-1, newBottomLeftFrontCoord); if(newQuad1 == NULL) { vvDebugMsg::msg(1, "vvVirTexRend::generateMeshing(): wrong index for BrickManager::getBrickInfo(), newQuad1"); vvDebugMsg::msg(1, "error on (l, x, y, z): ", (float)current->getLevel()-1, newBottomLeftFrontCoord[0], newBottomLeftFrontCoord[1], newBottomLeftFrontCoord[2]); return -1; } newQuad1->initialize(vd, &transformMatrix, eye, normal, volumeCenter, isOrtho, _pixelToVoxelRatio); if(newQuad1->isRendered()) { totalMemoryUsage += brickManager->getMemoryUsagePerBrick(); quadPQueue.push(newQuad1); numBrickRendered++; } /* else { totalMemoryUsage -= brickManager->getMemoryUsagePerBrick(); } */ // 1. SEF if(centerCoord[0] < volumeSize[0]) { newBottomLeftFrontCoord.set(centerCoord[0], bottomLeftFrontCoord[1], bottomLeftFrontCoord[2]); BrickInfo* newQuad2 = brickManager->getBrickInfo(volNum, frameNum, current->getLevel()-1, newBottomLeftFrontCoord); if(newQuad2 == NULL) { vvDebugMsg::msg(1, "vvVirTexRend::generateMeshing(): wrong index for BrickManager::getBrickInfo(), newQuad2"); vvDebugMsg::msg(1, "error on (l, x, y, z): ", (float)current->getLevel()-1, newBottomLeftFrontCoord[0], newBottomLeftFrontCoord[1], newBottomLeftFrontCoord[2]); return -1; } newQuad2->initialize(vd, &transformMatrix, eye, normal, volumeCenter, isOrtho, _pixelToVoxelRatio); if(newQuad2->isRendered()) { totalMemoryUsage += brickManager->getMemoryUsagePerBrick(); quadPQueue.push(newQuad2); numBrickRendered++; } /* else { totalMemoryUsage -= brickManager->getMemoryUsagePerBrick(); //newQuad2.deleteNodes(); } */ } // 2. NWF if(centerCoord[1] < volumeSize[1]) { newBottomLeftFrontCoord.set(bottomLeftFrontCoord[0], centerCoord[1], bottomLeftFrontCoord[2]); BrickInfo* newQuad3 = brickManager->getBrickInfo(volNum, frameNum, current->getLevel()-1, newBottomLeftFrontCoord); if(newQuad3 == NULL) { vvDebugMsg::msg(1, "vvVirTexRend::generateMeshing(): wrong index for BrickManager::getBrickInfo(), newQuad3"); vvDebugMsg::msg(1, "error on (l, x, y, z): ", (float)current->getLevel()-1, newBottomLeftFrontCoord[0], newBottomLeftFrontCoord[1], newBottomLeftFrontCoord[2]); return -1; } newQuad3->initialize(vd, &transformMatrix, eye, normal, volumeCenter, isOrtho, _pixelToVoxelRatio); if(newQuad3->isRendered()) { totalMemoryUsage += brickManager->getMemoryUsagePerBrick(); quadPQueue.push(newQuad3); numBrickRendered++; } /* else { totalMemoryUsage -= brickManager->getMemoryUsagePerBrick(); //newQuad3.deleteNodes(); } */ } // 3. NEF if(centerCoord[0] < volumeSize[0] && centerCoord[1] < volumeSize[1]) { newBottomLeftFrontCoord.set(centerCoord[0], centerCoord[1], bottomLeftFrontCoord[2]); BrickInfo* newQuad4 = brickManager->getBrickInfo(volNum, frameNum, current->getLevel()-1, newBottomLeftFrontCoord); if(newQuad4 == NULL) { vvDebugMsg::msg(1, "vvVirTexRend::generateMeshing(): wrong index for BrickManager::getBrickInfo(), newQuad4"); vvDebugMsg::msg(1, "error on (l, x, y, z): ", (float)current->getLevel()-1, newBottomLeftFrontCoord[0], newBottomLeftFrontCoord[1], newBottomLeftFrontCoord[2]); return -1; } newQuad4->initialize(vd, &transformMatrix, eye, normal, volumeCenter, isOrtho, _pixelToVoxelRatio); if(newQuad4->isRendered()) { totalMemoryUsage += brickManager->getMemoryUsagePerBrick(); quadPQueue.push(newQuad4); numBrickRendered++; } /* else { totalMemoryUsage -= brickManager->getMemoryUsagePerBrick(); //newQuad4.deleteNodes(); } */ } // the following four new bricks are only created for 3D data // 4. SWB - this quad always overlaps with the image we are rendering if(brickManager->getDataDimension() == 3 && centerCoord[2] < volumeSize[2]) { newBottomLeftFrontCoord.set(bottomLeftFrontCoord[0], bottomLeftFrontCoord[1], centerCoord[2]); BrickInfo* newQuad5 = brickManager->getBrickInfo(volNum, frameNum, current->getLevel()-1, newBottomLeftFrontCoord); if(newQuad5 == NULL) { vvDebugMsg::msg(1, "vvVirTexRend::generateMeshing(): wrong index for BrickManager::getBrickInfo(), newQuad5"); vvDebugMsg::msg(1, "error on (l, x, y, z): ", (float)current->getLevel()-1, newBottomLeftFrontCoord[0], newBottomLeftFrontCoord[1], newBottomLeftFrontCoord[2]); return -1; } newQuad5->initialize(vd, &transformMatrix, eye, normal, volumeCenter, isOrtho, _pixelToVoxelRatio); if(newQuad5->isRendered()) { totalMemoryUsage += brickManager->getMemoryUsagePerBrick(); quadPQueue.push(newQuad5); numBrickRendered++; } /* else { totalMemoryUsage -= brickManager->getMemoryUsagePerBrick(); //newQuad1.deleteNodes(); } */ // 5. SEB if(centerCoord[0] < volumeSize[0]) { newBottomLeftFrontCoord.set(centerCoord[0], bottomLeftFrontCoord[1], centerCoord[2]); BrickInfo* newQuad6 = brickManager->getBrickInfo(volNum, frameNum, current->getLevel()-1, newBottomLeftFrontCoord); if(newQuad6 == NULL) { vvDebugMsg::msg(1, "vvVirTexRend::generateMeshing(): wrong index for BrickManager::getBrickInfo(), newQuad6"); vvDebugMsg::msg(1, "error on (l, x, y, z): ", (float)current->getLevel()-1, newBottomLeftFrontCoord[0], newBottomLeftFrontCoord[1], newBottomLeftFrontCoord[2]); return -1; } newQuad6->initialize(vd, &transformMatrix, eye, normal, volumeCenter, isOrtho, _pixelToVoxelRatio); if(newQuad6->isRendered()) { totalMemoryUsage += brickManager->getMemoryUsagePerBrick(); quadPQueue.push(newQuad6); numBrickRendered++; } /* else { totalMemoryUsage -= brickManager->getMemoryUsagePerBrick(); //newQuad2.deleteNodes(); } */ } // 6. NWB if(centerCoord[1] < volumeSize[1]) { newBottomLeftFrontCoord.set(bottomLeftFrontCoord[0], centerCoord[1], centerCoord[2]); BrickInfo* newQuad7 = brickManager->getBrickInfo(volNum, frameNum, current->getLevel()-1, newBottomLeftFrontCoord); if(newQuad7 == NULL) { vvDebugMsg::msg(1, "vvVirTexRend::generateMeshing(): wrong index for BrickManager::getBrickInfo(), newQuad7"); vvDebugMsg::msg(1, "error on (l, x, y, z): ", (float)current->getLevel()-1, newBottomLeftFrontCoord[0], newBottomLeftFrontCoord[1], newBottomLeftFrontCoord[2]); return -1; } newQuad7->initialize(vd, &transformMatrix, eye, normal, volumeCenter, isOrtho, _pixelToVoxelRatio); if(newQuad7->isRendered()) { totalMemoryUsage += brickManager->getMemoryUsagePerBrick(); quadPQueue.push(newQuad7); numBrickRendered++; } /* else { totalMemoryUsage -= brickManager->getMemoryUsagePerBrick(); //newQuad3.deleteNodes(); } */ } // 7. NEB if(centerCoord[0] < volumeSize[0] && centerCoord[1] < volumeSize[1]) { newBottomLeftFrontCoord = centerCoord; BrickInfo* newQuad8 = brickManager->getBrickInfo(volNum, frameNum, current->getLevel()-1, newBottomLeftFrontCoord); if(newQuad8 == NULL) { vvDebugMsg::msg(1, "vvVirTexRend::generateMeshing(): wrong index for BrickManager::getBrickInfo(), newQuad8"); vvDebugMsg::msg(1, "error on (l, x, y, z): ", (float)current->getLevel()-1, newBottomLeftFrontCoord[0], newBottomLeftFrontCoord[1], newBottomLeftFrontCoord[2]); return -1; } newQuad8->initialize(vd, &transformMatrix, eye, normal, volumeCenter, isOrtho, _pixelToVoxelRatio); if(newQuad8->isRendered()) { totalMemoryUsage += brickManager->getMemoryUsagePerBrick(); quadPQueue.push(newQuad8); numBrickRendered++; } /* else { totalMemoryUsage -= brickManager->getMemoryUsagePerBrick(); //newQuad4.deleteNodes(); } */ } } // end of if(brickManager->getDataDimension() == 3 && centerCoord[2] < volumeSize[2]) } } else { //vvDebugMsg::msg(2, "current quad memory usage(): ", current->getMemoryUsage()); //vvDebugMsg::msg(2, "totalMemoryUsage so far: ", totalMemoryUsage); //vvDebugMsg::msg(2, "Reached memory Limit"); break; } } // break statements jump to here // move all the leftovers in PQ to list //cerr << "quadPQueue size: " << quadPQueue.size() << endl; while(!quadPQueue.empty()) { BrickInfo* aQuad = (BrickInfo*)quadPQueue.top(); if(aQuad->isRendered()) quadList.push_back(aQuad); quadPQueue.pop(); } //vvDebugMsg::msg(3, "vvVirTexRend::generateMeshing(): a mesh is generated"); //vvDebugMsg::msg(3, "vvVirTexRend::generateMeshing(): the size of final PQueue: ", (int)quadPQueue.size()); //vvDebugMsg::msg(1, "vvVirTexRend::generateMeshing(): the size of final List: ", (int)quadList.size()); cerr << "numBrickRendered: " << numBrickRendered << endl; return 0; } /** initialize meshing with the initial mip-map level Arbitrary size-safe! */ int vvVirTexRend::meshInit(vvVector3 eye, vvMatrix* transformMatrix) { int brickRendered = 0; int blockSize = (int)powf((float)2.0, (float)initLevel); vvDebugMsg::msg(3, "vvVirTexRend::meshInit(): intial blockSize: ", blockSize); vvDebugMsg::msg(3, "vvVirTexRend::meshInit(): initial level: ", initLevel); // clean up quadPQueue. // we may be able to optimize this by updating previous information adaptively... while(!quadPQueue.empty()) { //BrickInfo* current = (BrickInfo*)quadPQueue.top(); //current->deleteNodes(); quadPQueue.pop(); } // clean up quadList while(!quadList.empty()) { //BrickInfo current = (BrickInfo)quadList.front(); //current.deleteNodes(); quadList.pop_front(); } totalMemoryUsage = 0; for(int i = 0; i < volumeSize[0]; i+= blockSize) { for(int j = 0; j < volumeSize[1]; j+= blockSize) { // 3D volume if(brickManager->getDataDimension() == 3) { for(int k = 0; k < volumeSize[2]; k+= blockSize) { //cout << "Node(" << i << ", " << j << "), (" << (i+blockSize) << ", " << (j+blockSize) << ")" << endl; vvVector3 bottomLeft((float)i, (float)j, (float)k); BrickInfo* aCube = brickManager->getBrickInfo(volNum, frameNum, initLevel-minimumLevel, bottomLeft); if(aCube == NULL) { vvDebugMsg::msg(1, "wrong index for getBrickInfo()"); return -1; } aCube->initialize(vd, transformMatrix, eye, normal, volumeCenter, isOrtho, _pixelToVoxelRatio); // only if the quad is inside our viewport if(aCube->isRendered()) { totalMemoryUsage += brickManager->getMemoryUsagePerBrick(); quadPQueue.push(aCube); brickRendered ++; } //vvDebugMsg::msg(2, "brickInfo in meshInit: ", aCube->getLevel(), aCube->getBrickX(), aCube->getBrickY(), aCube->getBrickZ()); } } else { // 2D image vvVector3 bottomLeft((float)i, (float)j, 0); //cerr << "vvVirTexRend::meshInit: volNum=" << volNum << ", frameNum=" << frameNum << endl; BrickInfo* aQuad = brickManager->getBrickInfo(volNum, frameNum, initLevel-minimumLevel, bottomLeft); if(aQuad == NULL) { vvDebugMsg::msg(2, "wrong index for getBrickInfo()"); return -1; } aQuad->initialize(vd, transformMatrix, eye, normal, volumeCenter, isOrtho, _pixelToVoxelRatio); // only if the quad is inside our viewport if(aQuad->isRendered()) { //vvDebugMsg::msg(2, "initial bricks is inserted in the mesh, ", i, j); totalMemoryUsage += brickManager->getMemoryUsagePerBrick(); quadPQueue.push(aQuad); brickRendered++; } } } } //vvDebugMsg::msg(2, "totalMemoryUsage after meshInit() ", totalMemoryUsage); //vvDebugMsg::msg(2, "quadPQueue size after meshInit() ", (int)quadPQueue.size()); return brickRendered; } ////////////////////////////////////////////////////////////////////////// // Chih's code, un/setting environmental variables ////////////////////////////////////////////////////////////////////////// //---------------------------------------------------------------------------- /// Set GL environment for texture rendering. void vvVirTexRend::setGLenvironment() { vvDebugMsg::msg(3, "vvTexRend::setGLenvironment()"); // Save current GL state: glGetBooleanv(GL_CULL_FACE, &glsCulling); glGetBooleanv(GL_BLEND, &glsBlend); glGetBooleanv(GL_COLOR_MATERIAL, &glsColorMaterial); glGetIntegerv(GL_BLEND_SRC, &glsBlendSrc); glGetIntegerv(GL_BLEND_DST, &glsBlendDst); glGetBooleanv(GL_LIGHTING, &glsLighting); glGetBooleanv(GL_DEPTH_TEST, &glsDepthTest); glGetIntegerv(GL_MATRIX_MODE, &glsMatrixMode); glGetIntegerv(GL_DEPTH_FUNC, &glsDepthFunc); if (extMinMax) glGetIntegerv(GL_BLEND_EQUATION_EXT, &glsBlendEquation); glGetBooleanv(GL_DEPTH_WRITEMASK, &glsDepthMask); // Set new GL state: glDisable(GL_CULL_FACE); glDisable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); // default depth function glEnable(GL_COLOR_MATERIAL); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); //glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_DST_ALPHA); //glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE); //glBlendFunc(GL_ONE, GL_CONSTANT_ALPHA); //glBlendColor(1.f, 1.f, 1.f, 0.5f); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glDepthMask(GL_FALSE); _renderState._mipMode = 1; if (glBlendEquationVV) { switch (_renderState._mipMode) { // alpha compositing case 0: glBlendEquationVV(GL_FUNC_ADD); break; case 1: glBlendEquationVV(GL_MAX); break; // maximum intensity projection case 2: glBlendEquationVV(GL_MIN); break; // minimum intensity projection default: glBlendEquationVV(_renderState._mipMode); break; } } vvDebugMsg::msg(3, "vvTexRend::setGLenvironment() done"); } //---------------------------------------------------------------------------- /// Unset GL environment for texture rendering. void vvVirTexRend::unsetGLenvironment() { vvDebugMsg::msg(3, "vvTexRend::unsetGLenvironment()"); if (glsCulling==(GLboolean)true) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE); if (glsBlend==(GLboolean)true) glEnable(GL_BLEND); else glDisable(GL_BLEND); if (glsColorMaterial==(GLboolean)true) glEnable(GL_COLOR_MATERIAL); else glDisable(GL_COLOR_MATERIAL); if (glsDepthTest==(GLboolean)true) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST); if (glsLighting==(GLboolean)true) glEnable(GL_LIGHTING); else glDisable(GL_LIGHTING); glDepthMask(glsDepthMask); glDepthFunc(glsDepthFunc); glBlendFunc(glsBlendSrc, glsBlendDst); if (glBlendEquationVV) glBlendEquationVV(glsBlendEquation); glMatrixMode(glsMatrixMode); vvDebugMsg::msg(3, "vvTexRend::unsetGLenvironment() done"); } //---------------------------------------------------------------------------- /** Set user's viewing direction. This information is needed to correctly orientate the texture slices in 3D texturing mode if the user is inside the volume. @param vd viewing direction in object coordinates */ void vvVirTexRend::setViewingDirection(const vvVector3* vd) { vvDebugMsg::msg(3, "vvTexRend::setViewingDirection()"); viewDir.copy(vd); } //---------------------------------------------------------------------------- /** Set the direction from the viewer to the object. This information is needed to correctly orientate the texture slices in 3D texturing mode if the viewer is outside of the volume. @param vd object direction in object coordinates */ void vvVirTexRend::setObjectDirection(const vvVector3* vd) { vvDebugMsg::msg(3, "vvTexRend::setObjectDirection()"); objDir.copy(vd); }
129bf5176abe9e3caabe788850e1fe618435bc15
da1500e0d3040497614d5327d2461a22e934b4d8
/base/debug/invalid_access_win.cc
393d8b2dba6cc47fdfee606b4145892887993491
[ "BSD-3-Clause" ]
permissive
youtube/cobalt
34085fc93972ebe05b988b15410e99845efd1968
acefdaaadd3ef46f10f63d1acae2259e4024d383
refs/heads/main
2023-09-01T13:09:47.225174
2023-09-01T08:54:54
2023-09-01T08:54:54
50,049,789
169
80
BSD-3-Clause
2023-09-14T21:50:50
2016-01-20T18:11:34
null
UTF-8
C++
false
false
1,612
cc
invalid_access_win.cc
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/debug/invalid_access_win.h" #include <stdlib.h> #include <windows.h> #include "base/logging.h" #include "base/win/windows_version.h" #include "starboard/memory.h" #include "starboard/types.h" namespace base { namespace debug { namespace win { namespace { void CreateSyntheticHeapCorruption() { EXCEPTION_RECORD record = {}; record.ExceptionCode = STATUS_HEAP_CORRUPTION; RaiseFailFastException(&record, nullptr, FAIL_FAST_GENERATE_EXCEPTION_ADDRESS); } } // namespace void TerminateWithHeapCorruption() { __try { // Pre-Windows 10, it's hard to trigger a heap corruption fast fail, so // artificially create one instead. if (base::win::GetVersion() < base::win::VERSION_WIN10) CreateSyntheticHeapCorruption(); HANDLE heap = ::HeapCreate(0, 0, 0); CHECK(heap); CHECK(HeapSetInformation(heap, HeapEnableTerminationOnCorruption, nullptr, 0)); void* addr = ::HeapAlloc(heap, 0, 0x1000); CHECK(addr); // Corrupt heap header. char* addr_mutable = reinterpret_cast<char*>(addr); memset(addr_mutable - sizeof(addr), 0xCC, sizeof(addr)); HeapFree(heap, 0, addr); HeapDestroy(heap); } __except (EXCEPTION_EXECUTE_HANDLER) { // Heap corruption exception should never be caught. CHECK(false); } // Should never reach here. abort(); } } // namespace win } // namespace debug } // namespace base
977296ce36bda6c0348de24b5aad8874b40f06da
468e2e3be7da6ea41227048049715408301db123
/seqhound/include_cxx/slristruc_.hpp
ba85d859b40ccebb794432478bec59c9582f5a33
[]
no_license
iandonaldson/slri
b148cd03304e07eaed911330a4d8642ae707b4a9
a2a7acb7a05829f28dabc5264dc5fbdd43ec2e75
refs/heads/master
2021-01-10T10:16:50.947061
2015-05-31T19:42:58
2015-05-31T19:42:58
36,618,793
0
0
null
null
null
null
UTF-8
C++
false
false
96,797
hpp
slristruc_.hpp
/* $Id: slristruc_.hpp,v 1.2 2003/09/29 22:18:49 haocl Exp $ * =========================================================================== * * 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. * * =========================================================================== * * File Description: * This code is generated by application DATATOOL * using specifications from the data definition file * 'slristruc.asn'. * * ATTENTION: * Don't edit or check-in this file to the CVS as this file will * be overridden (by DATATOOL) without warning! * =========================================================================== */ #ifndef SLRISTRUC_BASE_HPP #define SLRISTRUC_BASE_HPP // standard includes #include <serial/serialbase.hpp> // generated includes #include <list> #include <string> BEGIN_NCBI_SCOPE #ifndef BEGIN_objects_SCOPE # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects) # define END_objects_SCOPE END_SCOPE(objects) #endif BEGIN_objects_SCOPE // namespace ncbi::objects:: // forward declarations class CBioseq; class CBiostruc; class CCdd; END_objects_SCOPE // namespace ncbi::objects:: END_NCBI_SCOPE #ifndef BEGIN_slri_SCOPE # define BEGIN_slri_SCOPE BEGIN_SCOPE(slri) # define END_slri_SCOPE END_SCOPE(slri) #endif BEGIN_slri_SCOPE // namespace slri:: class CSLRIFasta; class CSLRIValNode; END_slri_SCOPE // namespace slri:: BEGIN_NCBI_SCOPE #ifndef BEGIN_objects_SCOPE # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects) # define END_objects_SCOPE END_SCOPE(objects) #endif BEGIN_objects_SCOPE // namespace ncbi::objects:: class CSeq_entry; END_objects_SCOPE // namespace ncbi::objects:: END_NCBI_SCOPE #ifndef BEGIN_seqhound_SCOPE # define BEGIN_seqhound_SCOPE BEGIN_SCOPE(seqhound) # define END_seqhound_SCOPE END_SCOPE(seqhound) #endif BEGIN_seqhound_SCOPE // namespace seqhound:: class CStAccdbNode; class CStAsndbNode; class CStCDDdbNode; class CStCddbNode; class CStChromNode; class CStDomNameNode; class CStDomdbNode; class CStGOdbNode; class CStHistdbNode; class CStLLdbNode; class CStMmdbNode; class CStMmgiNode; class CStNucprotNode; class CStOMIMdbNode; class CStPartiNode; class CStPubseqNode; class CStRedundNode; class CStRpsNode; class CStSendbNode; class CStSengiNode; class CStTaxgiNode; // generated classes class CStTaxgiNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStTaxgiNode_Base(void); // destructor virtual ~CStTaxgiNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TGi; typedef int TTaxid; typedef int TKloodge; typedef NCBI_NS_STD::string TType; // members' getters // members' setters void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); void ResetTaxid(void); const int& GetTaxid(void) const; void SetTaxid(const int& value); int& SetTaxid(void); void ResetKloodge(void); const int& GetKloodge(void) const; void SetKloodge(const int& value); int& SetKloodge(void); void ResetType(void); const NCBI_NS_STD::string& GetType(void) const; void SetType(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetType(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStTaxgiNode_Base(const CStTaxgiNode_Base&); CStTaxgiNode_Base& operator=(const CStTaxgiNode_Base&); // members' data TGi m_Gi; TTaxid m_Taxid; TKloodge m_Kloodge; TType m_Type; }; class CStTaxgi_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStTaxgi_Base(void); // destructor virtual ~CStTaxgi_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStTaxgiNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStTaxgiNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStTaxgiNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStTaxgiNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStTaxgiNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStTaxgi_Base(const CStTaxgi_Base&); CStTaxgi_Base& operator=(const CStTaxgi_Base&); // members' data Tdata m_data; }; class CStSengiNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStSengiNode_Base(void); // destructor virtual ~CStSengiNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TSeid; typedef int TGi; typedef NCBI_NS_STD::string TDivision; // members' getters // members' setters void ResetSeid(void); const int& GetSeid(void) const; void SetSeid(const int& value); int& SetSeid(void); void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); void ResetDivision(void); const NCBI_NS_STD::string& GetDivision(void) const; void SetDivision(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetDivision(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStSengiNode_Base(const CStSengiNode_Base&); CStSengiNode_Base& operator=(const CStSengiNode_Base&); // members' data TSeid m_Seid; TGi m_Gi; TDivision m_Division; }; class CStSengi_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStSengi_Base(void); // destructor virtual ~CStSengi_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStSengiNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStSengiNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStSengiNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStSengiNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStSengiNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStSengi_Base(const CStSengi_Base&); CStSengi_Base& operator=(const CStSengi_Base&); // members' data Tdata m_data; }; class CStSendbNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStSendbNode_Base(void); // destructor virtual ~CStSendbNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TSeid; typedef NCBI_NS_NCBI::objects::CSeq_entry TAsn1; // members' getters // members' setters void ResetSeid(void); const int& GetSeid(void) const; void SetSeid(const int& value); int& SetSeid(void); void ResetAsn1(void); const NCBI_NS_NCBI::objects::CSeq_entry& GetAsn1(void) const; void SetAsn1(NCBI_NS_NCBI::objects::CSeq_entry& value); NCBI_NS_NCBI::objects::CSeq_entry& SetAsn1(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStSendbNode_Base(const CStSendbNode_Base&); CStSendbNode_Base& operator=(const CStSendbNode_Base&); // members' data TSeid m_Seid; NCBI_NS_NCBI::CRef< TAsn1 > m_Asn1; }; class CStSendb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStSendb_Base(void); // destructor virtual ~CStSendb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStSendbNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStSendbNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStSendbNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStSendbNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStSendbNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStSendb_Base(const CStSendb_Base&); CStSendb_Base& operator=(const CStSendb_Base&); // members' data Tdata m_data; }; class CStRpsdb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStRpsdb_Base(void); // destructor virtual ~CStRpsdb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStRpsNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStRpsNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStRpsNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStRpsNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStRpsNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStRpsdb_Base(const CStRpsdb_Base&); CStRpsdb_Base& operator=(const CStRpsdb_Base&); // members' data Tdata m_data; }; class CStRpsNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStRpsNode_Base(void); // destructor virtual ~CStRpsNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TGi; typedef NCBI_NS_STD::string TDom_id; typedef int TCdd_id; typedef int TFrom; typedef int TLen; typedef int TScore; typedef double TEvalue; typedef double TBitscore; typedef int TN_missing; typedef int TC_missing; typedef int TNum_of_dom; // members' getters // members' setters void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); void ResetDom_id(void); const NCBI_NS_STD::string& GetDom_id(void) const; void SetDom_id(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetDom_id(void); bool IsSetCdd_id(void) const; void ResetCdd_id(void); const int& GetCdd_id(void) const; void SetCdd_id(const int& value); int& SetCdd_id(void); void ResetFrom(void); const int& GetFrom(void) const; void SetFrom(const int& value); int& SetFrom(void); void ResetLen(void); const int& GetLen(void) const; void SetLen(const int& value); int& SetLen(void); bool IsSetScore(void) const; void ResetScore(void); const int& GetScore(void) const; void SetScore(const int& value); int& SetScore(void); void ResetEvalue(void); const double& GetEvalue(void) const; void SetEvalue(const double& value); double& SetEvalue(void); bool IsSetBitscore(void) const; void ResetBitscore(void); const double& GetBitscore(void) const; void SetBitscore(const double& value); double& SetBitscore(void); void ResetN_missing(void); const int& GetN_missing(void) const; void SetN_missing(const int& value); int& SetN_missing(void); void ResetC_missing(void); const int& GetC_missing(void) const; void SetC_missing(const int& value); int& SetC_missing(void); void ResetNum_of_dom(void); const int& GetNum_of_dom(void) const; void SetNum_of_dom(const int& value); int& SetNum_of_dom(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStRpsNode_Base(const CStRpsNode_Base&); CStRpsNode_Base& operator=(const CStRpsNode_Base&); // members' data bool m_set_Cdd_id; bool m_set_Score; bool m_set_Bitscore; TGi m_Gi; TDom_id m_Dom_id; TCdd_id m_Cdd_id; TFrom m_From; TLen m_Len; TScore m_Score; TEvalue m_Evalue; TBitscore m_Bitscore; TN_missing m_N_missing; TC_missing m_C_missing; TNum_of_dom m_Num_of_dom; }; class CStRedundNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStRedundNode_Base(void); // destructor virtual ~CStRedundNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TGi; typedef int TOrdinal; typedef int TGroup; // members' getters // members' setters void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); void ResetOrdinal(void); const int& GetOrdinal(void) const; void SetOrdinal(const int& value); int& SetOrdinal(void); void ResetGroup(void); const int& GetGroup(void) const; void SetGroup(const int& value); int& SetGroup(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStRedundNode_Base(const CStRedundNode_Base&); CStRedundNode_Base& operator=(const CStRedundNode_Base&); // members' data TGi m_Gi; TOrdinal m_Ordinal; TGroup m_Group; }; class CStRedund_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStRedund_Base(void); // destructor virtual ~CStRedund_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStRedundNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStRedundNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStRedundNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStRedundNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStRedundNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStRedund_Base(const CStRedund_Base&); CStRedund_Base& operator=(const CStRedund_Base&); // members' data Tdata m_data; }; class CStPubseqNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStPubseqNode_Base(void); // destructor virtual ~CStPubseqNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TGi; typedef int TMuid; typedef int TPmid; // members' getters // members' setters void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); void ResetMuid(void); const int& GetMuid(void) const; void SetMuid(const int& value); int& SetMuid(void); void ResetPmid(void); const int& GetPmid(void) const; void SetPmid(const int& value); int& SetPmid(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStPubseqNode_Base(const CStPubseqNode_Base&); CStPubseqNode_Base& operator=(const CStPubseqNode_Base&); // members' data TGi m_Gi; TMuid m_Muid; TPmid m_Pmid; }; class CStPubseq_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStPubseq_Base(void); // destructor virtual ~CStPubseq_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStPubseqNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStPubseqNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStPubseqNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStPubseqNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStPubseqNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStPubseq_Base(const CStPubseq_Base&); CStPubseq_Base& operator=(const CStPubseq_Base&); // members' data Tdata m_data; }; class CStPartiNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStPartiNode_Base(void); // destructor virtual ~CStPartiNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TGi; typedef NCBI_NS_STD::string TPartition; // members' getters // members' setters void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); void ResetPartition(void); const NCBI_NS_STD::string& GetPartition(void) const; void SetPartition(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetPartition(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStPartiNode_Base(const CStPartiNode_Base&); CStPartiNode_Base& operator=(const CStPartiNode_Base&); // members' data TGi m_Gi; TPartition m_Partition; }; class CStParti_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStParti_Base(void); // destructor virtual ~CStParti_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStPartiNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStPartiNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStPartiNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStPartiNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStPartiNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStParti_Base(const CStParti_Base&); CStParti_Base& operator=(const CStParti_Base&); // members' data Tdata m_data; }; class CStOMIMdbNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStOMIMdbNode_Base(void); // destructor virtual ~CStOMIMdbNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TNpid; typedef int TOmimid; // members' getters // members' setters void ResetNpid(void); const int& GetNpid(void) const; void SetNpid(const int& value); int& SetNpid(void); void ResetOmimid(void); const int& GetOmimid(void) const; void SetOmimid(const int& value); int& SetOmimid(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStOMIMdbNode_Base(const CStOMIMdbNode_Base&); CStOMIMdbNode_Base& operator=(const CStOMIMdbNode_Base&); // members' data TNpid m_Npid; TOmimid m_Omimid; }; class CStOMIMdb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStOMIMdb_Base(void); // destructor virtual ~CStOMIMdb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStOMIMdbNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStOMIMdbNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStOMIMdbNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStOMIMdbNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStOMIMdbNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStOMIMdb_Base(const CStOMIMdb_Base&); CStOMIMdb_Base& operator=(const CStOMIMdb_Base&); // members' data Tdata m_data; }; class CStNucprotNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStNucprotNode_Base(void); // destructor virtual ~CStNucprotNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TGin; typedef int TGia; // members' getters // members' setters void ResetGin(void); const int& GetGin(void) const; void SetGin(const int& value); int& SetGin(void); void ResetGia(void); const int& GetGia(void) const; void SetGia(const int& value); int& SetGia(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStNucprotNode_Base(const CStNucprotNode_Base&); CStNucprotNode_Base& operator=(const CStNucprotNode_Base&); // members' data TGin m_Gin; TGia m_Gia; }; class CStNucprot_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStNucprot_Base(void); // destructor virtual ~CStNucprot_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStNucprotNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStNucprotNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStNucprotNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStNucprotNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStNucprotNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStNucprot_Base(const CStNucprot_Base&); CStNucprot_Base& operator=(const CStNucprot_Base&); // members' data Tdata m_data; }; class CStMmgiNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStMmgiNode_Base(void); // destructor virtual ~CStMmgiNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TMmdbid; typedef int TGi; // members' getters // members' setters void ResetMmdbid(void); const int& GetMmdbid(void) const; void SetMmdbid(const int& value); int& SetMmdbid(void); void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStMmgiNode_Base(const CStMmgiNode_Base&); CStMmgiNode_Base& operator=(const CStMmgiNode_Base&); // members' data TMmdbid m_Mmdbid; TGi m_Gi; }; class CStMmgi_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStMmgi_Base(void); // destructor virtual ~CStMmgi_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStMmgiNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStMmgiNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStMmgiNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStMmgiNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStMmgiNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStMmgi_Base(const CStMmgi_Base&); CStMmgi_Base& operator=(const CStMmgi_Base&); // members' data Tdata m_data; }; class CStMmdbNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStMmdbNode_Base(void); // destructor virtual ~CStMmdbNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TMmdbid; typedef NCBI_NS_STD::string TPdbid; typedef NCBI_NS_NCBI::objects::CBiostruc TAsn1; typedef int TBwhat; typedef int TModels; typedef int TMolecules; typedef int TSize; typedef int TBzsize; // members' getters // members' setters void ResetMmdbid(void); const int& GetMmdbid(void) const; void SetMmdbid(const int& value); int& SetMmdbid(void); void ResetPdbid(void); const NCBI_NS_STD::string& GetPdbid(void) const; void SetPdbid(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetPdbid(void); void ResetAsn1(void); const NCBI_NS_NCBI::objects::CBiostruc& GetAsn1(void) const; void SetAsn1(NCBI_NS_NCBI::objects::CBiostruc& value); NCBI_NS_NCBI::objects::CBiostruc& SetAsn1(void); void ResetBwhat(void); const int& GetBwhat(void) const; void SetBwhat(const int& value); int& SetBwhat(void); void ResetModels(void); const int& GetModels(void) const; void SetModels(const int& value); int& SetModels(void); void ResetMolecules(void); const int& GetMolecules(void) const; void SetMolecules(const int& value); int& SetMolecules(void); void ResetSize(void); const int& GetSize(void) const; void SetSize(const int& value); int& SetSize(void); void ResetBzsize(void); const int& GetBzsize(void) const; void SetBzsize(const int& value); int& SetBzsize(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStMmdbNode_Base(const CStMmdbNode_Base&); CStMmdbNode_Base& operator=(const CStMmdbNode_Base&); // members' data TMmdbid m_Mmdbid; TPdbid m_Pdbid; NCBI_NS_NCBI::CRef< TAsn1 > m_Asn1; TBwhat m_Bwhat; TModels m_Models; TMolecules m_Molecules; TSize m_Size; TBzsize m_Bzsize; }; class CStMmdb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStMmdb_Base(void); // destructor virtual ~CStMmdb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStMmdbNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStMmdbNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStMmdbNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStMmdbNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStMmdbNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStMmdb_Base(const CStMmdb_Base&); CStMmdb_Base& operator=(const CStMmdb_Base&); // members' data Tdata m_data; }; class CStLLdbNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStLLdbNode_Base(void); // destructor virtual ~CStLLdbNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TNpid; typedef int TLlid; typedef NCBI_NS_STD::string TMap; // members' getters // members' setters void ResetNpid(void); const int& GetNpid(void) const; void SetNpid(const int& value); int& SetNpid(void); void ResetLlid(void); const int& GetLlid(void) const; void SetLlid(const int& value); int& SetLlid(void); void ResetMap(void); const NCBI_NS_STD::string& GetMap(void) const; void SetMap(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetMap(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStLLdbNode_Base(const CStLLdbNode_Base&); CStLLdbNode_Base& operator=(const CStLLdbNode_Base&); // members' data TNpid m_Npid; TLlid m_Llid; TMap m_Map; }; class CStLLdb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStLLdb_Base(void); // destructor virtual ~CStLLdb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStLLdbNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStLLdbNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStLLdbNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStLLdbNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStLLdbNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStLLdb_Base(const CStLLdb_Base&); CStLLdb_Base& operator=(const CStLLdb_Base&); // members' data Tdata m_data; }; class CStHistdbNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStHistdbNode_Base(void); // destructor virtual ~CStHistdbNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TGi; typedef NCBI_NS_STD::string TAccession; typedef int TVersion; typedef NCBI_NS_STD::string TDate; typedef int TAction; // members' getters // members' setters void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); void ResetAccession(void); const NCBI_NS_STD::string& GetAccession(void) const; void SetAccession(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetAccession(void); void ResetVersion(void); const int& GetVersion(void) const; void SetVersion(const int& value); int& SetVersion(void); void ResetDate(void); const NCBI_NS_STD::string& GetDate(void) const; void SetDate(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetDate(void); void ResetAction(void); const int& GetAction(void) const; void SetAction(const int& value); int& SetAction(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStHistdbNode_Base(const CStHistdbNode_Base&); CStHistdbNode_Base& operator=(const CStHistdbNode_Base&); // members' data TGi m_Gi; TAccession m_Accession; TVersion m_Version; TDate m_Date; TAction m_Action; }; class CStHistdb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStHistdb_Base(void); // destructor virtual ~CStHistdb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStHistdbNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStHistdbNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStHistdbNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStHistdbNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStHistdbNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStHistdb_Base(const CStHistdb_Base&); CStHistdb_Base& operator=(const CStHistdb_Base&); // members' data Tdata m_data; }; class CStGOdbNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStGOdbNode_Base(void); // destructor virtual ~CStGOdbNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TNpid; typedef int TGoid; typedef int TPmid; typedef NCBI_NS_STD::string TEviCode; // members' getters // members' setters void ResetNpid(void); const int& GetNpid(void) const; void SetNpid(const int& value); int& SetNpid(void); void ResetGoid(void); const int& GetGoid(void) const; void SetGoid(const int& value); int& SetGoid(void); void ResetPmid(void); const int& GetPmid(void) const; void SetPmid(const int& value); int& SetPmid(void); void ResetEviCode(void); const NCBI_NS_STD::string& GetEviCode(void) const; void SetEviCode(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetEviCode(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStGOdbNode_Base(const CStGOdbNode_Base&); CStGOdbNode_Base& operator=(const CStGOdbNode_Base&); // members' data TNpid m_Npid; TGoid m_Goid; TPmid m_Pmid; TEviCode m_EviCode; }; class CStGOdb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStGOdb_Base(void); // destructor virtual ~CStGOdb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStGOdbNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStGOdbNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStGOdbNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStGOdbNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStGOdbNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStGOdb_Base(const CStGOdb_Base&); CStGOdb_Base& operator=(const CStGOdb_Base&); // members' data Tdata m_data; }; class CStDomdbNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStDomdbNode_Base(void); // destructor virtual ~CStDomdbNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TMmdbid; typedef ::slri::CSLRIValNode TAsn1; typedef NCBI_NS_STD::string TPdbid; typedef NCBI_NS_STD::string TChain; typedef int TGi; typedef int TDomno; typedef int TDomall; typedef int TDomid; typedef int TRep; // members' getters // members' setters void ResetMmdbid(void); const int& GetMmdbid(void) const; void SetMmdbid(const int& value); int& SetMmdbid(void); void ResetAsn1(void); const ::slri::CSLRIValNode& GetAsn1(void) const; void SetAsn1(::slri::CSLRIValNode& value); ::slri::CSLRIValNode& SetAsn1(void); void ResetPdbid(void); const NCBI_NS_STD::string& GetPdbid(void) const; void SetPdbid(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetPdbid(void); void ResetChain(void); const NCBI_NS_STD::string& GetChain(void) const; void SetChain(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetChain(void); void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); void ResetDomno(void); const int& GetDomno(void) const; void SetDomno(const int& value); int& SetDomno(void); void ResetDomall(void); const int& GetDomall(void) const; void SetDomall(const int& value); int& SetDomall(void); void ResetDomid(void); const int& GetDomid(void) const; void SetDomid(const int& value); int& SetDomid(void); void ResetRep(void); const int& GetRep(void) const; void SetRep(const int& value); int& SetRep(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStDomdbNode_Base(const CStDomdbNode_Base&); CStDomdbNode_Base& operator=(const CStDomdbNode_Base&); // members' data TMmdbid m_Mmdbid; NCBI_NS_NCBI::CRef< TAsn1 > m_Asn1; TPdbid m_Pdbid; TChain m_Chain; TGi m_Gi; TDomno m_Domno; TDomall m_Domall; TDomid m_Domid; TRep m_Rep; }; class CStDomdb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStDomdb_Base(void); // destructor virtual ~CStDomdb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStDomdbNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStDomdbNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStDomdbNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStDomdbNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStDomdbNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStDomdb_Base(const CStDomdb_Base&); CStDomdb_Base& operator=(const CStDomdb_Base&); // members' data Tdata m_data; }; class CStDomNamedb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStDomNamedb_Base(void); // destructor virtual ~CStDomNamedb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStDomNameNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStDomNameNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStDomNameNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStDomNameNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStDomNameNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStDomNamedb_Base(const CStDomNamedb_Base&); CStDomNamedb_Base& operator=(const CStDomNamedb_Base&); // members' data Tdata m_data; }; class CStDomNameNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStDomNameNode_Base(void); // destructor virtual ~CStDomNameNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::string TAccession; typedef NCBI_NS_STD::string TName; typedef NCBI_NS_STD::string TPdb_id; typedef NCBI_NS_NCBI::objects::CCdd TAsn1; // members' getters // members' setters void ResetAccession(void); const NCBI_NS_STD::string& GetAccession(void) const; void SetAccession(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetAccession(void); void ResetName(void); const NCBI_NS_STD::string& GetName(void) const; void SetName(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetName(void); bool IsSetPdb_id(void) const; void ResetPdb_id(void); const NCBI_NS_STD::string& GetPdb_id(void) const; void SetPdb_id(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetPdb_id(void); void ResetAsn1(void); const NCBI_NS_NCBI::objects::CCdd& GetAsn1(void) const; void SetAsn1(NCBI_NS_NCBI::objects::CCdd& value); NCBI_NS_NCBI::objects::CCdd& SetAsn1(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStDomNameNode_Base(const CStDomNameNode_Base&); CStDomNameNode_Base& operator=(const CStDomNameNode_Base&); // members' data bool m_set_Pdb_id; TAccession m_Accession; TName m_Name; TPdb_id m_Pdb_id; NCBI_NS_NCBI::CRef< TAsn1 > m_Asn1; }; class CStChromNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStChromNode_Base(void); // destructor virtual ~CStChromNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TTaxid; typedef int TKloodge; typedef int TChromfl; typedef NCBI_NS_STD::string TAccess; typedef NCBI_NS_STD::string TName; // members' getters // members' setters void ResetTaxid(void); const int& GetTaxid(void) const; void SetTaxid(const int& value); int& SetTaxid(void); void ResetKloodge(void); const int& GetKloodge(void) const; void SetKloodge(const int& value); int& SetKloodge(void); void ResetChromfl(void); const int& GetChromfl(void) const; void SetChromfl(const int& value); int& SetChromfl(void); void ResetAccess(void); const NCBI_NS_STD::string& GetAccess(void) const; void SetAccess(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetAccess(void); void ResetName(void); const NCBI_NS_STD::string& GetName(void) const; void SetName(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetName(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStChromNode_Base(const CStChromNode_Base&); CStChromNode_Base& operator=(const CStChromNode_Base&); // members' data TTaxid m_Taxid; TKloodge m_Kloodge; TChromfl m_Chromfl; TAccess m_Access; TName m_Name; }; class CStChrom_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStChrom_Base(void); // destructor virtual ~CStChrom_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStChromNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStChromNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStChromNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStChromNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStChromNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStChrom_Base(const CStChrom_Base&); CStChrom_Base& operator=(const CStChrom_Base&); // members' data Tdata m_data; }; class CStCddbNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStCddbNode_Base(void); // destructor virtual ~CStCddbNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TGi; typedef ::slri::CSLRIFasta TAsn1; // members' getters // members' setters void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); void ResetAsn1(void); const ::slri::CSLRIFasta& GetAsn1(void) const; void SetAsn1(::slri::CSLRIFasta& value); ::slri::CSLRIFasta& SetAsn1(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStCddbNode_Base(const CStCddbNode_Base&); CStCddbNode_Base& operator=(const CStCddbNode_Base&); // members' data TGi m_Gi; NCBI_NS_NCBI::CRef< TAsn1 > m_Asn1; }; class CStCddb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStCddb_Base(void); // destructor virtual ~CStCddb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStCddbNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStCddbNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStCddbNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStCddbNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStCddbNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStCddb_Base(const CStCddb_Base&); CStCddb_Base& operator=(const CStCddb_Base&); // members' data Tdata m_data; }; class CStCDDdbNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStCDDdbNode_Base(void); // destructor virtual ~CStCDDdbNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TNpid; typedef NCBI_NS_STD::string TCddid; typedef double TEValue; // members' getters // members' setters void ResetNpid(void); const int& GetNpid(void) const; void SetNpid(const int& value); int& SetNpid(void); void ResetCddid(void); const NCBI_NS_STD::string& GetCddid(void) const; void SetCddid(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetCddid(void); void ResetEValue(void); const double& GetEValue(void) const; void SetEValue(const double& value); double& SetEValue(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStCDDdbNode_Base(const CStCDDdbNode_Base&); CStCDDdbNode_Base& operator=(const CStCDDdbNode_Base&); // members' data TNpid m_Npid; TCddid m_Cddid; TEValue m_EValue; }; class CStCDDdb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStCDDdb_Base(void); // destructor virtual ~CStCDDdb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStCDDdbNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStCDDdbNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStCDDdbNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStCDDdbNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStCDDdbNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStCDDdb_Base(const CStCDDdb_Base&); CStCDDdb_Base& operator=(const CStCDDdb_Base&); // members' data Tdata m_data; }; class CStAsndbNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStAsndbNode_Base(void); // destructor virtual ~CStAsndbNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TGi; typedef NCBI_NS_NCBI::objects::CBioseq TAsn1; typedef NCBI_NS_STD::string TDivision; typedef NCBI_NS_STD::string TRelease; typedef NCBI_NS_STD::string TType; // members' getters // members' setters void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); void ResetAsn1(void); const NCBI_NS_NCBI::objects::CBioseq& GetAsn1(void) const; void SetAsn1(NCBI_NS_NCBI::objects::CBioseq& value); NCBI_NS_NCBI::objects::CBioseq& SetAsn1(void); void ResetDivision(void); const NCBI_NS_STD::string& GetDivision(void) const; void SetDivision(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetDivision(void); void ResetRelease(void); const NCBI_NS_STD::string& GetRelease(void) const; void SetRelease(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetRelease(void); void ResetType(void); const NCBI_NS_STD::string& GetType(void) const; void SetType(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetType(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStAsndbNode_Base(const CStAsndbNode_Base&); CStAsndbNode_Base& operator=(const CStAsndbNode_Base&); // members' data TGi m_Gi; NCBI_NS_NCBI::CRef< TAsn1 > m_Asn1; TDivision m_Division; TRelease m_Release; TType m_Type; }; class CStAsndb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStAsndb_Base(void); // destructor virtual ~CStAsndb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStAsndbNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStAsndbNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStAsndbNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStAsndbNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStAsndbNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStAsndb_Base(const CStAsndb_Base&); CStAsndb_Base& operator=(const CStAsndb_Base&); // members' data Tdata m_data; }; class CStAccdbNode_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStAccdbNode_Base(void); // destructor virtual ~CStAccdbNode_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef int TGi; typedef NCBI_NS_STD::string TDb; typedef NCBI_NS_STD::string TName; typedef NCBI_NS_STD::string TAccess; typedef NCBI_NS_STD::string TChain; typedef NCBI_NS_STD::string TRelease; typedef int TVersion; typedef NCBI_NS_STD::string TTitle; typedef NCBI_NS_STD::string TNamelow; // members' getters // members' setters void ResetGi(void); const int& GetGi(void) const; void SetGi(const int& value); int& SetGi(void); void ResetDb(void); const NCBI_NS_STD::string& GetDb(void) const; void SetDb(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetDb(void); void ResetName(void); const NCBI_NS_STD::string& GetName(void) const; void SetName(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetName(void); void ResetAccess(void); const NCBI_NS_STD::string& GetAccess(void) const; void SetAccess(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetAccess(void); void ResetChain(void); const NCBI_NS_STD::string& GetChain(void) const; void SetChain(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetChain(void); void ResetRelease(void); const NCBI_NS_STD::string& GetRelease(void) const; void SetRelease(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetRelease(void); void ResetVersion(void); const int& GetVersion(void) const; void SetVersion(const int& value); int& SetVersion(void); void ResetTitle(void); const NCBI_NS_STD::string& GetTitle(void) const; void SetTitle(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetTitle(void); void ResetNamelow(void); const NCBI_NS_STD::string& GetNamelow(void) const; void SetNamelow(const NCBI_NS_STD::string& value); NCBI_NS_STD::string& SetNamelow(void); // reset whole object virtual void Reset(void); private: // Prohibit copy constructor and assignment operator CStAccdbNode_Base(const CStAccdbNode_Base&); CStAccdbNode_Base& operator=(const CStAccdbNode_Base&); // members' data TGi m_Gi; TDb m_Db; TName m_Name; TAccess m_Access; TChain m_Chain; TRelease m_Release; TVersion m_Version; TTitle m_Title; TNamelow m_Namelow; }; class CStAccdb_Base : public NCBI_NS_NCBI::CSerialObject { typedef NCBI_NS_NCBI::CSerialObject Tparent; public: // constructor CStAccdb_Base(void); // destructor virtual ~CStAccdb_Base(void); // type info DECLARE_INTERNAL_TYPE_INFO(); // members' types typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStAccdbNode > > Tdata; // members' getters // members' setters void Reset(void); const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStAccdbNode > >& Get(void) const; NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStAccdbNode > >& Set(void); operator const NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStAccdbNode > >& (void) const; operator NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CStAccdbNode > >& (void); // reset whole object private: // Prohibit copy constructor and assignment operator CStAccdb_Base(const CStAccdb_Base&); CStAccdb_Base& operator=(const CStAccdb_Base&); // members' data Tdata m_data; }; /////////////////////////////////////////////////////////// ///////////////////// inline methods ////////////////////// /////////////////////////////////////////////////////////// inline void CStTaxgiNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStTaxgiNode_Base::TGi& CStTaxgiNode_Base::GetGi(void) const { return m_Gi; } inline void CStTaxgiNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStTaxgiNode_Base::TGi& CStTaxgiNode_Base::SetGi(void) { return m_Gi; } inline void CStTaxgiNode_Base::ResetTaxid(void) { m_Taxid = 0; } inline const CStTaxgiNode_Base::TTaxid& CStTaxgiNode_Base::GetTaxid(void) const { return m_Taxid; } inline void CStTaxgiNode_Base::SetTaxid(const TTaxid& value) { m_Taxid = value; } inline CStTaxgiNode_Base::TTaxid& CStTaxgiNode_Base::SetTaxid(void) { return m_Taxid; } inline void CStTaxgiNode_Base::ResetKloodge(void) { m_Kloodge = 0; } inline const CStTaxgiNode_Base::TKloodge& CStTaxgiNode_Base::GetKloodge(void) const { return m_Kloodge; } inline void CStTaxgiNode_Base::SetKloodge(const TKloodge& value) { m_Kloodge = value; } inline CStTaxgiNode_Base::TKloodge& CStTaxgiNode_Base::SetKloodge(void) { return m_Kloodge; } inline const CStTaxgiNode_Base::TType& CStTaxgiNode_Base::GetType(void) const { return m_Type; } inline void CStTaxgiNode_Base::SetType(const TType& value) { m_Type = value; } inline CStTaxgiNode_Base::TType& CStTaxgiNode_Base::SetType(void) { return m_Type; } inline const CStTaxgi_Base::Tdata& CStTaxgi_Base::Get(void) const { return m_data; } inline CStTaxgi_Base::Tdata& CStTaxgi_Base::Set(void) { return m_data; } inline CStTaxgi_Base::operator const CStTaxgi_Base::Tdata& (void) const { return m_data; } inline CStTaxgi_Base::operator CStTaxgi_Base::Tdata& (void) { return m_data; } inline void CStSengiNode_Base::ResetSeid(void) { m_Seid = 0; } inline const CStSengiNode_Base::TSeid& CStSengiNode_Base::GetSeid(void) const { return m_Seid; } inline void CStSengiNode_Base::SetSeid(const TSeid& value) { m_Seid = value; } inline CStSengiNode_Base::TSeid& CStSengiNode_Base::SetSeid(void) { return m_Seid; } inline void CStSengiNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStSengiNode_Base::TGi& CStSengiNode_Base::GetGi(void) const { return m_Gi; } inline void CStSengiNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStSengiNode_Base::TGi& CStSengiNode_Base::SetGi(void) { return m_Gi; } inline const CStSengiNode_Base::TDivision& CStSengiNode_Base::GetDivision(void) const { return m_Division; } inline void CStSengiNode_Base::SetDivision(const TDivision& value) { m_Division = value; } inline CStSengiNode_Base::TDivision& CStSengiNode_Base::SetDivision(void) { return m_Division; } inline const CStSengi_Base::Tdata& CStSengi_Base::Get(void) const { return m_data; } inline CStSengi_Base::Tdata& CStSengi_Base::Set(void) { return m_data; } inline CStSengi_Base::operator const CStSengi_Base::Tdata& (void) const { return m_data; } inline CStSengi_Base::operator CStSengi_Base::Tdata& (void) { return m_data; } inline void CStSendbNode_Base::ResetSeid(void) { m_Seid = 0; } inline const CStSendbNode_Base::TSeid& CStSendbNode_Base::GetSeid(void) const { return m_Seid; } inline void CStSendbNode_Base::SetSeid(const TSeid& value) { m_Seid = value; } inline CStSendbNode_Base::TSeid& CStSendbNode_Base::SetSeid(void) { return m_Seid; } inline CStSendbNode_Base::TAsn1& CStSendbNode_Base::SetAsn1(void) { return (*m_Asn1); } inline const CStSendb_Base::Tdata& CStSendb_Base::Get(void) const { return m_data; } inline CStSendb_Base::Tdata& CStSendb_Base::Set(void) { return m_data; } inline CStSendb_Base::operator const CStSendb_Base::Tdata& (void) const { return m_data; } inline CStSendb_Base::operator CStSendb_Base::Tdata& (void) { return m_data; } inline const CStRpsdb_Base::Tdata& CStRpsdb_Base::Get(void) const { return m_data; } inline CStRpsdb_Base::Tdata& CStRpsdb_Base::Set(void) { return m_data; } inline CStRpsdb_Base::operator const CStRpsdb_Base::Tdata& (void) const { return m_data; } inline CStRpsdb_Base::operator CStRpsdb_Base::Tdata& (void) { return m_data; } inline void CStRpsNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStRpsNode_Base::TGi& CStRpsNode_Base::GetGi(void) const { return m_Gi; } inline void CStRpsNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStRpsNode_Base::TGi& CStRpsNode_Base::SetGi(void) { return m_Gi; } inline const CStRpsNode_Base::TDom_id& CStRpsNode_Base::GetDom_id(void) const { return m_Dom_id; } inline void CStRpsNode_Base::SetDom_id(const TDom_id& value) { m_Dom_id = value; } inline CStRpsNode_Base::TDom_id& CStRpsNode_Base::SetDom_id(void) { return m_Dom_id; } inline bool CStRpsNode_Base::IsSetCdd_id(void) const { return m_set_Cdd_id; } inline void CStRpsNode_Base::ResetCdd_id(void) { m_Cdd_id = 0; m_set_Cdd_id = false; } inline const CStRpsNode_Base::TCdd_id& CStRpsNode_Base::GetCdd_id(void) const { return m_Cdd_id; } inline void CStRpsNode_Base::SetCdd_id(const TCdd_id& value) { m_Cdd_id = value; m_set_Cdd_id = true; } inline CStRpsNode_Base::TCdd_id& CStRpsNode_Base::SetCdd_id(void) { m_set_Cdd_id = true; return m_Cdd_id; } inline void CStRpsNode_Base::ResetFrom(void) { m_From = 0; } inline const CStRpsNode_Base::TFrom& CStRpsNode_Base::GetFrom(void) const { return m_From; } inline void CStRpsNode_Base::SetFrom(const TFrom& value) { m_From = value; } inline CStRpsNode_Base::TFrom& CStRpsNode_Base::SetFrom(void) { return m_From; } inline void CStRpsNode_Base::ResetLen(void) { m_Len = 0; } inline const CStRpsNode_Base::TLen& CStRpsNode_Base::GetLen(void) const { return m_Len; } inline void CStRpsNode_Base::SetLen(const TLen& value) { m_Len = value; } inline CStRpsNode_Base::TLen& CStRpsNode_Base::SetLen(void) { return m_Len; } inline bool CStRpsNode_Base::IsSetScore(void) const { return m_set_Score; } inline void CStRpsNode_Base::ResetScore(void) { m_Score = 0; m_set_Score = false; } inline const CStRpsNode_Base::TScore& CStRpsNode_Base::GetScore(void) const { return m_Score; } inline void CStRpsNode_Base::SetScore(const TScore& value) { m_Score = value; m_set_Score = true; } inline CStRpsNode_Base::TScore& CStRpsNode_Base::SetScore(void) { m_set_Score = true; return m_Score; } inline void CStRpsNode_Base::ResetEvalue(void) { m_Evalue = 0; } inline const CStRpsNode_Base::TEvalue& CStRpsNode_Base::GetEvalue(void) const { return m_Evalue; } inline void CStRpsNode_Base::SetEvalue(const TEvalue& value) { m_Evalue = value; } inline CStRpsNode_Base::TEvalue& CStRpsNode_Base::SetEvalue(void) { return m_Evalue; } inline bool CStRpsNode_Base::IsSetBitscore(void) const { return m_set_Bitscore; } inline void CStRpsNode_Base::ResetBitscore(void) { m_Bitscore = 0; m_set_Bitscore = false; } inline const CStRpsNode_Base::TBitscore& CStRpsNode_Base::GetBitscore(void) const { return m_Bitscore; } inline void CStRpsNode_Base::SetBitscore(const TBitscore& value) { m_Bitscore = value; m_set_Bitscore = true; } inline CStRpsNode_Base::TBitscore& CStRpsNode_Base::SetBitscore(void) { m_set_Bitscore = true; return m_Bitscore; } inline void CStRpsNode_Base::ResetN_missing(void) { m_N_missing = 0; } inline const CStRpsNode_Base::TN_missing& CStRpsNode_Base::GetN_missing(void) const { return m_N_missing; } inline void CStRpsNode_Base::SetN_missing(const TN_missing& value) { m_N_missing = value; } inline CStRpsNode_Base::TN_missing& CStRpsNode_Base::SetN_missing(void) { return m_N_missing; } inline void CStRpsNode_Base::ResetC_missing(void) { m_C_missing = 0; } inline const CStRpsNode_Base::TC_missing& CStRpsNode_Base::GetC_missing(void) const { return m_C_missing; } inline void CStRpsNode_Base::SetC_missing(const TC_missing& value) { m_C_missing = value; } inline CStRpsNode_Base::TC_missing& CStRpsNode_Base::SetC_missing(void) { return m_C_missing; } inline void CStRpsNode_Base::ResetNum_of_dom(void) { m_Num_of_dom = 0; } inline const CStRpsNode_Base::TNum_of_dom& CStRpsNode_Base::GetNum_of_dom(void) const { return m_Num_of_dom; } inline void CStRpsNode_Base::SetNum_of_dom(const TNum_of_dom& value) { m_Num_of_dom = value; } inline CStRpsNode_Base::TNum_of_dom& CStRpsNode_Base::SetNum_of_dom(void) { return m_Num_of_dom; } inline void CStRedundNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStRedundNode_Base::TGi& CStRedundNode_Base::GetGi(void) const { return m_Gi; } inline void CStRedundNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStRedundNode_Base::TGi& CStRedundNode_Base::SetGi(void) { return m_Gi; } inline void CStRedundNode_Base::ResetOrdinal(void) { m_Ordinal = 0; } inline const CStRedundNode_Base::TOrdinal& CStRedundNode_Base::GetOrdinal(void) const { return m_Ordinal; } inline void CStRedundNode_Base::SetOrdinal(const TOrdinal& value) { m_Ordinal = value; } inline CStRedundNode_Base::TOrdinal& CStRedundNode_Base::SetOrdinal(void) { return m_Ordinal; } inline void CStRedundNode_Base::ResetGroup(void) { m_Group = 0; } inline const CStRedundNode_Base::TGroup& CStRedundNode_Base::GetGroup(void) const { return m_Group; } inline void CStRedundNode_Base::SetGroup(const TGroup& value) { m_Group = value; } inline CStRedundNode_Base::TGroup& CStRedundNode_Base::SetGroup(void) { return m_Group; } inline const CStRedund_Base::Tdata& CStRedund_Base::Get(void) const { return m_data; } inline CStRedund_Base::Tdata& CStRedund_Base::Set(void) { return m_data; } inline CStRedund_Base::operator const CStRedund_Base::Tdata& (void) const { return m_data; } inline CStRedund_Base::operator CStRedund_Base::Tdata& (void) { return m_data; } inline void CStPubseqNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStPubseqNode_Base::TGi& CStPubseqNode_Base::GetGi(void) const { return m_Gi; } inline void CStPubseqNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStPubseqNode_Base::TGi& CStPubseqNode_Base::SetGi(void) { return m_Gi; } inline void CStPubseqNode_Base::ResetMuid(void) { m_Muid = 0; } inline const CStPubseqNode_Base::TMuid& CStPubseqNode_Base::GetMuid(void) const { return m_Muid; } inline void CStPubseqNode_Base::SetMuid(const TMuid& value) { m_Muid = value; } inline CStPubseqNode_Base::TMuid& CStPubseqNode_Base::SetMuid(void) { return m_Muid; } inline void CStPubseqNode_Base::ResetPmid(void) { m_Pmid = 0; } inline const CStPubseqNode_Base::TPmid& CStPubseqNode_Base::GetPmid(void) const { return m_Pmid; } inline void CStPubseqNode_Base::SetPmid(const TPmid& value) { m_Pmid = value; } inline CStPubseqNode_Base::TPmid& CStPubseqNode_Base::SetPmid(void) { return m_Pmid; } inline const CStPubseq_Base::Tdata& CStPubseq_Base::Get(void) const { return m_data; } inline CStPubseq_Base::Tdata& CStPubseq_Base::Set(void) { return m_data; } inline CStPubseq_Base::operator const CStPubseq_Base::Tdata& (void) const { return m_data; } inline CStPubseq_Base::operator CStPubseq_Base::Tdata& (void) { return m_data; } inline void CStPartiNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStPartiNode_Base::TGi& CStPartiNode_Base::GetGi(void) const { return m_Gi; } inline void CStPartiNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStPartiNode_Base::TGi& CStPartiNode_Base::SetGi(void) { return m_Gi; } inline const CStPartiNode_Base::TPartition& CStPartiNode_Base::GetPartition(void) const { return m_Partition; } inline void CStPartiNode_Base::SetPartition(const TPartition& value) { m_Partition = value; } inline CStPartiNode_Base::TPartition& CStPartiNode_Base::SetPartition(void) { return m_Partition; } inline const CStParti_Base::Tdata& CStParti_Base::Get(void) const { return m_data; } inline CStParti_Base::Tdata& CStParti_Base::Set(void) { return m_data; } inline CStParti_Base::operator const CStParti_Base::Tdata& (void) const { return m_data; } inline CStParti_Base::operator CStParti_Base::Tdata& (void) { return m_data; } inline void CStOMIMdbNode_Base::ResetNpid(void) { m_Npid = 0; } inline const CStOMIMdbNode_Base::TNpid& CStOMIMdbNode_Base::GetNpid(void) const { return m_Npid; } inline void CStOMIMdbNode_Base::SetNpid(const TNpid& value) { m_Npid = value; } inline CStOMIMdbNode_Base::TNpid& CStOMIMdbNode_Base::SetNpid(void) { return m_Npid; } inline void CStOMIMdbNode_Base::ResetOmimid(void) { m_Omimid = 0; } inline const CStOMIMdbNode_Base::TOmimid& CStOMIMdbNode_Base::GetOmimid(void) const { return m_Omimid; } inline void CStOMIMdbNode_Base::SetOmimid(const TOmimid& value) { m_Omimid = value; } inline CStOMIMdbNode_Base::TOmimid& CStOMIMdbNode_Base::SetOmimid(void) { return m_Omimid; } inline const CStOMIMdb_Base::Tdata& CStOMIMdb_Base::Get(void) const { return m_data; } inline CStOMIMdb_Base::Tdata& CStOMIMdb_Base::Set(void) { return m_data; } inline CStOMIMdb_Base::operator const CStOMIMdb_Base::Tdata& (void) const { return m_data; } inline CStOMIMdb_Base::operator CStOMIMdb_Base::Tdata& (void) { return m_data; } inline void CStNucprotNode_Base::ResetGin(void) { m_Gin = 0; } inline const CStNucprotNode_Base::TGin& CStNucprotNode_Base::GetGin(void) const { return m_Gin; } inline void CStNucprotNode_Base::SetGin(const TGin& value) { m_Gin = value; } inline CStNucprotNode_Base::TGin& CStNucprotNode_Base::SetGin(void) { return m_Gin; } inline void CStNucprotNode_Base::ResetGia(void) { m_Gia = 0; } inline const CStNucprotNode_Base::TGia& CStNucprotNode_Base::GetGia(void) const { return m_Gia; } inline void CStNucprotNode_Base::SetGia(const TGia& value) { m_Gia = value; } inline CStNucprotNode_Base::TGia& CStNucprotNode_Base::SetGia(void) { return m_Gia; } inline const CStNucprot_Base::Tdata& CStNucprot_Base::Get(void) const { return m_data; } inline CStNucprot_Base::Tdata& CStNucprot_Base::Set(void) { return m_data; } inline CStNucprot_Base::operator const CStNucprot_Base::Tdata& (void) const { return m_data; } inline CStNucprot_Base::operator CStNucprot_Base::Tdata& (void) { return m_data; } inline void CStMmgiNode_Base::ResetMmdbid(void) { m_Mmdbid = 0; } inline const CStMmgiNode_Base::TMmdbid& CStMmgiNode_Base::GetMmdbid(void) const { return m_Mmdbid; } inline void CStMmgiNode_Base::SetMmdbid(const TMmdbid& value) { m_Mmdbid = value; } inline CStMmgiNode_Base::TMmdbid& CStMmgiNode_Base::SetMmdbid(void) { return m_Mmdbid; } inline void CStMmgiNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStMmgiNode_Base::TGi& CStMmgiNode_Base::GetGi(void) const { return m_Gi; } inline void CStMmgiNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStMmgiNode_Base::TGi& CStMmgiNode_Base::SetGi(void) { return m_Gi; } inline const CStMmgi_Base::Tdata& CStMmgi_Base::Get(void) const { return m_data; } inline CStMmgi_Base::Tdata& CStMmgi_Base::Set(void) { return m_data; } inline CStMmgi_Base::operator const CStMmgi_Base::Tdata& (void) const { return m_data; } inline CStMmgi_Base::operator CStMmgi_Base::Tdata& (void) { return m_data; } inline void CStMmdbNode_Base::ResetMmdbid(void) { m_Mmdbid = 0; } inline const CStMmdbNode_Base::TMmdbid& CStMmdbNode_Base::GetMmdbid(void) const { return m_Mmdbid; } inline void CStMmdbNode_Base::SetMmdbid(const TMmdbid& value) { m_Mmdbid = value; } inline CStMmdbNode_Base::TMmdbid& CStMmdbNode_Base::SetMmdbid(void) { return m_Mmdbid; } inline const CStMmdbNode_Base::TPdbid& CStMmdbNode_Base::GetPdbid(void) const { return m_Pdbid; } inline void CStMmdbNode_Base::SetPdbid(const TPdbid& value) { m_Pdbid = value; } inline CStMmdbNode_Base::TPdbid& CStMmdbNode_Base::SetPdbid(void) { return m_Pdbid; } inline CStMmdbNode_Base::TAsn1& CStMmdbNode_Base::SetAsn1(void) { return (*m_Asn1); } inline void CStMmdbNode_Base::ResetBwhat(void) { m_Bwhat = 0; } inline const CStMmdbNode_Base::TBwhat& CStMmdbNode_Base::GetBwhat(void) const { return m_Bwhat; } inline void CStMmdbNode_Base::SetBwhat(const TBwhat& value) { m_Bwhat = value; } inline CStMmdbNode_Base::TBwhat& CStMmdbNode_Base::SetBwhat(void) { return m_Bwhat; } inline void CStMmdbNode_Base::ResetModels(void) { m_Models = 0; } inline const CStMmdbNode_Base::TModels& CStMmdbNode_Base::GetModels(void) const { return m_Models; } inline void CStMmdbNode_Base::SetModels(const TModels& value) { m_Models = value; } inline CStMmdbNode_Base::TModels& CStMmdbNode_Base::SetModels(void) { return m_Models; } inline void CStMmdbNode_Base::ResetMolecules(void) { m_Molecules = 0; } inline const CStMmdbNode_Base::TMolecules& CStMmdbNode_Base::GetMolecules(void) const { return m_Molecules; } inline void CStMmdbNode_Base::SetMolecules(const TMolecules& value) { m_Molecules = value; } inline CStMmdbNode_Base::TMolecules& CStMmdbNode_Base::SetMolecules(void) { return m_Molecules; } inline void CStMmdbNode_Base::ResetSize(void) { m_Size = 0; } inline const CStMmdbNode_Base::TSize& CStMmdbNode_Base::GetSize(void) const { return m_Size; } inline void CStMmdbNode_Base::SetSize(const TSize& value) { m_Size = value; } inline CStMmdbNode_Base::TSize& CStMmdbNode_Base::SetSize(void) { return m_Size; } inline void CStMmdbNode_Base::ResetBzsize(void) { m_Bzsize = 0; } inline const CStMmdbNode_Base::TBzsize& CStMmdbNode_Base::GetBzsize(void) const { return m_Bzsize; } inline void CStMmdbNode_Base::SetBzsize(const TBzsize& value) { m_Bzsize = value; } inline CStMmdbNode_Base::TBzsize& CStMmdbNode_Base::SetBzsize(void) { return m_Bzsize; } inline const CStMmdb_Base::Tdata& CStMmdb_Base::Get(void) const { return m_data; } inline CStMmdb_Base::Tdata& CStMmdb_Base::Set(void) { return m_data; } inline CStMmdb_Base::operator const CStMmdb_Base::Tdata& (void) const { return m_data; } inline CStMmdb_Base::operator CStMmdb_Base::Tdata& (void) { return m_data; } inline void CStLLdbNode_Base::ResetNpid(void) { m_Npid = 0; } inline const CStLLdbNode_Base::TNpid& CStLLdbNode_Base::GetNpid(void) const { return m_Npid; } inline void CStLLdbNode_Base::SetNpid(const TNpid& value) { m_Npid = value; } inline CStLLdbNode_Base::TNpid& CStLLdbNode_Base::SetNpid(void) { return m_Npid; } inline void CStLLdbNode_Base::ResetLlid(void) { m_Llid = 0; } inline const CStLLdbNode_Base::TLlid& CStLLdbNode_Base::GetLlid(void) const { return m_Llid; } inline void CStLLdbNode_Base::SetLlid(const TLlid& value) { m_Llid = value; } inline CStLLdbNode_Base::TLlid& CStLLdbNode_Base::SetLlid(void) { return m_Llid; } inline const CStLLdbNode_Base::TMap& CStLLdbNode_Base::GetMap(void) const { return m_Map; } inline void CStLLdbNode_Base::SetMap(const TMap& value) { m_Map = value; } inline CStLLdbNode_Base::TMap& CStLLdbNode_Base::SetMap(void) { return m_Map; } inline const CStLLdb_Base::Tdata& CStLLdb_Base::Get(void) const { return m_data; } inline CStLLdb_Base::Tdata& CStLLdb_Base::Set(void) { return m_data; } inline CStLLdb_Base::operator const CStLLdb_Base::Tdata& (void) const { return m_data; } inline CStLLdb_Base::operator CStLLdb_Base::Tdata& (void) { return m_data; } inline void CStHistdbNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStHistdbNode_Base::TGi& CStHistdbNode_Base::GetGi(void) const { return m_Gi; } inline void CStHistdbNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStHistdbNode_Base::TGi& CStHistdbNode_Base::SetGi(void) { return m_Gi; } inline const CStHistdbNode_Base::TAccession& CStHistdbNode_Base::GetAccession(void) const { return m_Accession; } inline void CStHistdbNode_Base::SetAccession(const TAccession& value) { m_Accession = value; } inline CStHistdbNode_Base::TAccession& CStHistdbNode_Base::SetAccession(void) { return m_Accession; } inline void CStHistdbNode_Base::ResetVersion(void) { m_Version = 0; } inline const CStHistdbNode_Base::TVersion& CStHistdbNode_Base::GetVersion(void) const { return m_Version; } inline void CStHistdbNode_Base::SetVersion(const TVersion& value) { m_Version = value; } inline CStHistdbNode_Base::TVersion& CStHistdbNode_Base::SetVersion(void) { return m_Version; } inline const CStHistdbNode_Base::TDate& CStHistdbNode_Base::GetDate(void) const { return m_Date; } inline void CStHistdbNode_Base::SetDate(const TDate& value) { m_Date = value; } inline CStHistdbNode_Base::TDate& CStHistdbNode_Base::SetDate(void) { return m_Date; } inline void CStHistdbNode_Base::ResetAction(void) { m_Action = 0; } inline const CStHistdbNode_Base::TAction& CStHistdbNode_Base::GetAction(void) const { return m_Action; } inline void CStHistdbNode_Base::SetAction(const TAction& value) { m_Action = value; } inline CStHistdbNode_Base::TAction& CStHistdbNode_Base::SetAction(void) { return m_Action; } inline const CStHistdb_Base::Tdata& CStHistdb_Base::Get(void) const { return m_data; } inline CStHistdb_Base::Tdata& CStHistdb_Base::Set(void) { return m_data; } inline CStHistdb_Base::operator const CStHistdb_Base::Tdata& (void) const { return m_data; } inline CStHistdb_Base::operator CStHistdb_Base::Tdata& (void) { return m_data; } inline void CStGOdbNode_Base::ResetNpid(void) { m_Npid = 0; } inline const CStGOdbNode_Base::TNpid& CStGOdbNode_Base::GetNpid(void) const { return m_Npid; } inline void CStGOdbNode_Base::SetNpid(const TNpid& value) { m_Npid = value; } inline CStGOdbNode_Base::TNpid& CStGOdbNode_Base::SetNpid(void) { return m_Npid; } inline void CStGOdbNode_Base::ResetGoid(void) { m_Goid = 0; } inline const CStGOdbNode_Base::TGoid& CStGOdbNode_Base::GetGoid(void) const { return m_Goid; } inline void CStGOdbNode_Base::SetGoid(const TGoid& value) { m_Goid = value; } inline CStGOdbNode_Base::TGoid& CStGOdbNode_Base::SetGoid(void) { return m_Goid; } inline void CStGOdbNode_Base::ResetPmid(void) { m_Pmid = 0; } inline const CStGOdbNode_Base::TPmid& CStGOdbNode_Base::GetPmid(void) const { return m_Pmid; } inline void CStGOdbNode_Base::SetPmid(const TPmid& value) { m_Pmid = value; } inline CStGOdbNode_Base::TPmid& CStGOdbNode_Base::SetPmid(void) { return m_Pmid; } inline const CStGOdbNode_Base::TEviCode& CStGOdbNode_Base::GetEviCode(void) const { return m_EviCode; } inline void CStGOdbNode_Base::SetEviCode(const TEviCode& value) { m_EviCode = value; } inline CStGOdbNode_Base::TEviCode& CStGOdbNode_Base::SetEviCode(void) { return m_EviCode; } inline const CStGOdb_Base::Tdata& CStGOdb_Base::Get(void) const { return m_data; } inline CStGOdb_Base::Tdata& CStGOdb_Base::Set(void) { return m_data; } inline CStGOdb_Base::operator const CStGOdb_Base::Tdata& (void) const { return m_data; } inline CStGOdb_Base::operator CStGOdb_Base::Tdata& (void) { return m_data; } inline void CStDomdbNode_Base::ResetMmdbid(void) { m_Mmdbid = 0; } inline const CStDomdbNode_Base::TMmdbid& CStDomdbNode_Base::GetMmdbid(void) const { return m_Mmdbid; } inline void CStDomdbNode_Base::SetMmdbid(const TMmdbid& value) { m_Mmdbid = value; } inline CStDomdbNode_Base::TMmdbid& CStDomdbNode_Base::SetMmdbid(void) { return m_Mmdbid; } inline CStDomdbNode_Base::TAsn1& CStDomdbNode_Base::SetAsn1(void) { return (*m_Asn1); } inline const CStDomdbNode_Base::TPdbid& CStDomdbNode_Base::GetPdbid(void) const { return m_Pdbid; } inline void CStDomdbNode_Base::SetPdbid(const TPdbid& value) { m_Pdbid = value; } inline CStDomdbNode_Base::TPdbid& CStDomdbNode_Base::SetPdbid(void) { return m_Pdbid; } inline const CStDomdbNode_Base::TChain& CStDomdbNode_Base::GetChain(void) const { return m_Chain; } inline void CStDomdbNode_Base::SetChain(const TChain& value) { m_Chain = value; } inline CStDomdbNode_Base::TChain& CStDomdbNode_Base::SetChain(void) { return m_Chain; } inline void CStDomdbNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStDomdbNode_Base::TGi& CStDomdbNode_Base::GetGi(void) const { return m_Gi; } inline void CStDomdbNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStDomdbNode_Base::TGi& CStDomdbNode_Base::SetGi(void) { return m_Gi; } inline void CStDomdbNode_Base::ResetDomno(void) { m_Domno = 0; } inline const CStDomdbNode_Base::TDomno& CStDomdbNode_Base::GetDomno(void) const { return m_Domno; } inline void CStDomdbNode_Base::SetDomno(const TDomno& value) { m_Domno = value; } inline CStDomdbNode_Base::TDomno& CStDomdbNode_Base::SetDomno(void) { return m_Domno; } inline void CStDomdbNode_Base::ResetDomall(void) { m_Domall = 0; } inline const CStDomdbNode_Base::TDomall& CStDomdbNode_Base::GetDomall(void) const { return m_Domall; } inline void CStDomdbNode_Base::SetDomall(const TDomall& value) { m_Domall = value; } inline CStDomdbNode_Base::TDomall& CStDomdbNode_Base::SetDomall(void) { return m_Domall; } inline void CStDomdbNode_Base::ResetDomid(void) { m_Domid = 0; } inline const CStDomdbNode_Base::TDomid& CStDomdbNode_Base::GetDomid(void) const { return m_Domid; } inline void CStDomdbNode_Base::SetDomid(const TDomid& value) { m_Domid = value; } inline CStDomdbNode_Base::TDomid& CStDomdbNode_Base::SetDomid(void) { return m_Domid; } inline void CStDomdbNode_Base::ResetRep(void) { m_Rep = 0; } inline const CStDomdbNode_Base::TRep& CStDomdbNode_Base::GetRep(void) const { return m_Rep; } inline void CStDomdbNode_Base::SetRep(const TRep& value) { m_Rep = value; } inline CStDomdbNode_Base::TRep& CStDomdbNode_Base::SetRep(void) { return m_Rep; } inline const CStDomdb_Base::Tdata& CStDomdb_Base::Get(void) const { return m_data; } inline CStDomdb_Base::Tdata& CStDomdb_Base::Set(void) { return m_data; } inline CStDomdb_Base::operator const CStDomdb_Base::Tdata& (void) const { return m_data; } inline CStDomdb_Base::operator CStDomdb_Base::Tdata& (void) { return m_data; } inline const CStDomNamedb_Base::Tdata& CStDomNamedb_Base::Get(void) const { return m_data; } inline CStDomNamedb_Base::Tdata& CStDomNamedb_Base::Set(void) { return m_data; } inline CStDomNamedb_Base::operator const CStDomNamedb_Base::Tdata& (void) const { return m_data; } inline CStDomNamedb_Base::operator CStDomNamedb_Base::Tdata& (void) { return m_data; } inline const CStDomNameNode_Base::TAccession& CStDomNameNode_Base::GetAccession(void) const { return m_Accession; } inline void CStDomNameNode_Base::SetAccession(const TAccession& value) { m_Accession = value; } inline CStDomNameNode_Base::TAccession& CStDomNameNode_Base::SetAccession(void) { return m_Accession; } inline const CStDomNameNode_Base::TName& CStDomNameNode_Base::GetName(void) const { return m_Name; } inline void CStDomNameNode_Base::SetName(const TName& value) { m_Name = value; } inline CStDomNameNode_Base::TName& CStDomNameNode_Base::SetName(void) { return m_Name; } inline bool CStDomNameNode_Base::IsSetPdb_id(void) const { return m_set_Pdb_id; } inline const CStDomNameNode_Base::TPdb_id& CStDomNameNode_Base::GetPdb_id(void) const { return m_Pdb_id; } inline void CStDomNameNode_Base::SetPdb_id(const TPdb_id& value) { m_Pdb_id = value; m_set_Pdb_id = true; } inline CStDomNameNode_Base::TPdb_id& CStDomNameNode_Base::SetPdb_id(void) { m_set_Pdb_id = true; return m_Pdb_id; } inline CStDomNameNode_Base::TAsn1& CStDomNameNode_Base::SetAsn1(void) { return (*m_Asn1); } inline void CStChromNode_Base::ResetTaxid(void) { m_Taxid = 0; } inline const CStChromNode_Base::TTaxid& CStChromNode_Base::GetTaxid(void) const { return m_Taxid; } inline void CStChromNode_Base::SetTaxid(const TTaxid& value) { m_Taxid = value; } inline CStChromNode_Base::TTaxid& CStChromNode_Base::SetTaxid(void) { return m_Taxid; } inline void CStChromNode_Base::ResetKloodge(void) { m_Kloodge = 0; } inline const CStChromNode_Base::TKloodge& CStChromNode_Base::GetKloodge(void) const { return m_Kloodge; } inline void CStChromNode_Base::SetKloodge(const TKloodge& value) { m_Kloodge = value; } inline CStChromNode_Base::TKloodge& CStChromNode_Base::SetKloodge(void) { return m_Kloodge; } inline void CStChromNode_Base::ResetChromfl(void) { m_Chromfl = 0; } inline const CStChromNode_Base::TChromfl& CStChromNode_Base::GetChromfl(void) const { return m_Chromfl; } inline void CStChromNode_Base::SetChromfl(const TChromfl& value) { m_Chromfl = value; } inline CStChromNode_Base::TChromfl& CStChromNode_Base::SetChromfl(void) { return m_Chromfl; } inline const CStChromNode_Base::TAccess& CStChromNode_Base::GetAccess(void) const { return m_Access; } inline void CStChromNode_Base::SetAccess(const TAccess& value) { m_Access = value; } inline CStChromNode_Base::TAccess& CStChromNode_Base::SetAccess(void) { return m_Access; } inline const CStChromNode_Base::TName& CStChromNode_Base::GetName(void) const { return m_Name; } inline void CStChromNode_Base::SetName(const TName& value) { m_Name = value; } inline CStChromNode_Base::TName& CStChromNode_Base::SetName(void) { return m_Name; } inline const CStChrom_Base::Tdata& CStChrom_Base::Get(void) const { return m_data; } inline CStChrom_Base::Tdata& CStChrom_Base::Set(void) { return m_data; } inline CStChrom_Base::operator const CStChrom_Base::Tdata& (void) const { return m_data; } inline CStChrom_Base::operator CStChrom_Base::Tdata& (void) { return m_data; } inline void CStCddbNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStCddbNode_Base::TGi& CStCddbNode_Base::GetGi(void) const { return m_Gi; } inline void CStCddbNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStCddbNode_Base::TGi& CStCddbNode_Base::SetGi(void) { return m_Gi; } inline CStCddbNode_Base::TAsn1& CStCddbNode_Base::SetAsn1(void) { return (*m_Asn1); } inline const CStCddb_Base::Tdata& CStCddb_Base::Get(void) const { return m_data; } inline CStCddb_Base::Tdata& CStCddb_Base::Set(void) { return m_data; } inline CStCddb_Base::operator const CStCddb_Base::Tdata& (void) const { return m_data; } inline CStCddb_Base::operator CStCddb_Base::Tdata& (void) { return m_data; } inline void CStCDDdbNode_Base::ResetNpid(void) { m_Npid = 0; } inline const CStCDDdbNode_Base::TNpid& CStCDDdbNode_Base::GetNpid(void) const { return m_Npid; } inline void CStCDDdbNode_Base::SetNpid(const TNpid& value) { m_Npid = value; } inline CStCDDdbNode_Base::TNpid& CStCDDdbNode_Base::SetNpid(void) { return m_Npid; } inline const CStCDDdbNode_Base::TCddid& CStCDDdbNode_Base::GetCddid(void) const { return m_Cddid; } inline void CStCDDdbNode_Base::SetCddid(const TCddid& value) { m_Cddid = value; } inline CStCDDdbNode_Base::TCddid& CStCDDdbNode_Base::SetCddid(void) { return m_Cddid; } inline void CStCDDdbNode_Base::ResetEValue(void) { m_EValue = 0; } inline const CStCDDdbNode_Base::TEValue& CStCDDdbNode_Base::GetEValue(void) const { return m_EValue; } inline void CStCDDdbNode_Base::SetEValue(const TEValue& value) { m_EValue = value; } inline CStCDDdbNode_Base::TEValue& CStCDDdbNode_Base::SetEValue(void) { return m_EValue; } inline const CStCDDdb_Base::Tdata& CStCDDdb_Base::Get(void) const { return m_data; } inline CStCDDdb_Base::Tdata& CStCDDdb_Base::Set(void) { return m_data; } inline CStCDDdb_Base::operator const CStCDDdb_Base::Tdata& (void) const { return m_data; } inline CStCDDdb_Base::operator CStCDDdb_Base::Tdata& (void) { return m_data; } inline void CStAsndbNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStAsndbNode_Base::TGi& CStAsndbNode_Base::GetGi(void) const { return m_Gi; } inline void CStAsndbNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStAsndbNode_Base::TGi& CStAsndbNode_Base::SetGi(void) { return m_Gi; } inline CStAsndbNode_Base::TAsn1& CStAsndbNode_Base::SetAsn1(void) { return (*m_Asn1); } inline const CStAsndbNode_Base::TDivision& CStAsndbNode_Base::GetDivision(void) const { return m_Division; } inline void CStAsndbNode_Base::SetDivision(const TDivision& value) { m_Division = value; } inline CStAsndbNode_Base::TDivision& CStAsndbNode_Base::SetDivision(void) { return m_Division; } inline const CStAsndbNode_Base::TRelease& CStAsndbNode_Base::GetRelease(void) const { return m_Release; } inline void CStAsndbNode_Base::SetRelease(const TRelease& value) { m_Release = value; } inline CStAsndbNode_Base::TRelease& CStAsndbNode_Base::SetRelease(void) { return m_Release; } inline const CStAsndbNode_Base::TType& CStAsndbNode_Base::GetType(void) const { return m_Type; } inline void CStAsndbNode_Base::SetType(const TType& value) { m_Type = value; } inline CStAsndbNode_Base::TType& CStAsndbNode_Base::SetType(void) { return m_Type; } inline const CStAsndb_Base::Tdata& CStAsndb_Base::Get(void) const { return m_data; } inline CStAsndb_Base::Tdata& CStAsndb_Base::Set(void) { return m_data; } inline CStAsndb_Base::operator const CStAsndb_Base::Tdata& (void) const { return m_data; } inline CStAsndb_Base::operator CStAsndb_Base::Tdata& (void) { return m_data; } inline void CStAccdbNode_Base::ResetGi(void) { m_Gi = 0; } inline const CStAccdbNode_Base::TGi& CStAccdbNode_Base::GetGi(void) const { return m_Gi; } inline void CStAccdbNode_Base::SetGi(const TGi& value) { m_Gi = value; } inline CStAccdbNode_Base::TGi& CStAccdbNode_Base::SetGi(void) { return m_Gi; } inline const CStAccdbNode_Base::TDb& CStAccdbNode_Base::GetDb(void) const { return m_Db; } inline void CStAccdbNode_Base::SetDb(const TDb& value) { m_Db = value; } inline CStAccdbNode_Base::TDb& CStAccdbNode_Base::SetDb(void) { return m_Db; } inline const CStAccdbNode_Base::TName& CStAccdbNode_Base::GetName(void) const { return m_Name; } inline void CStAccdbNode_Base::SetName(const TName& value) { m_Name = value; } inline CStAccdbNode_Base::TName& CStAccdbNode_Base::SetName(void) { return m_Name; } inline const CStAccdbNode_Base::TAccess& CStAccdbNode_Base::GetAccess(void) const { return m_Access; } inline void CStAccdbNode_Base::SetAccess(const TAccess& value) { m_Access = value; } inline CStAccdbNode_Base::TAccess& CStAccdbNode_Base::SetAccess(void) { return m_Access; } inline const CStAccdbNode_Base::TChain& CStAccdbNode_Base::GetChain(void) const { return m_Chain; } inline void CStAccdbNode_Base::SetChain(const TChain& value) { m_Chain = value; } inline CStAccdbNode_Base::TChain& CStAccdbNode_Base::SetChain(void) { return m_Chain; } inline const CStAccdbNode_Base::TRelease& CStAccdbNode_Base::GetRelease(void) const { return m_Release; } inline void CStAccdbNode_Base::SetRelease(const TRelease& value) { m_Release = value; } inline CStAccdbNode_Base::TRelease& CStAccdbNode_Base::SetRelease(void) { return m_Release; } inline void CStAccdbNode_Base::ResetVersion(void) { m_Version = 0; } inline const CStAccdbNode_Base::TVersion& CStAccdbNode_Base::GetVersion(void) const { return m_Version; } inline void CStAccdbNode_Base::SetVersion(const TVersion& value) { m_Version = value; } inline CStAccdbNode_Base::TVersion& CStAccdbNode_Base::SetVersion(void) { return m_Version; } inline const CStAccdbNode_Base::TTitle& CStAccdbNode_Base::GetTitle(void) const { return m_Title; } inline void CStAccdbNode_Base::SetTitle(const TTitle& value) { m_Title = value; } inline CStAccdbNode_Base::TTitle& CStAccdbNode_Base::SetTitle(void) { return m_Title; } inline const CStAccdbNode_Base::TNamelow& CStAccdbNode_Base::GetNamelow(void) const { return m_Namelow; } inline void CStAccdbNode_Base::SetNamelow(const TNamelow& value) { m_Namelow = value; } inline CStAccdbNode_Base::TNamelow& CStAccdbNode_Base::SetNamelow(void) { return m_Namelow; } inline const CStAccdb_Base::Tdata& CStAccdb_Base::Get(void) const { return m_data; } inline CStAccdb_Base::Tdata& CStAccdb_Base::Set(void) { return m_data; } inline CStAccdb_Base::operator const CStAccdb_Base::Tdata& (void) const { return m_data; } inline CStAccdb_Base::operator CStAccdb_Base::Tdata& (void) { return m_data; } /////////////////////////////////////////////////////////// ////////////////// end of inline methods ////////////////// /////////////////////////////////////////////////////////// END_seqhound_SCOPE // namespace seqhound:: #endif // SLRISTRUC_BASE_HPP
304eecb6bb23987f2e43cc669db016d520108349
bcf138c82fcba9acc7d7ce4d3a92618b06ebe7c7
/rdr2/0x5C674EB487891F6B.cpp
d2e661d15017406a419701fef134f780d9b85381
[]
no_license
DeepWolf413/additional-native-data
aded47e042f0feb30057e753910e0884c44121a0
e015b2500b52065252ffbe3c53865fe3cdd3e06c
refs/heads/main
2023-07-10T00:19:54.416083
2021-08-12T16:00:12
2021-08-12T16:00:12
395,340,507
1
0
null
null
null
null
UTF-8
C++
false
false
1,075
cpp
0x5C674EB487891F6B.cpp
// rcm_abigail31.ysc @ L45269 void func_1435(var uParam0) { if (iLocal_58 == 1 || iLocal_58 == 4) { if (!bLocal_145 && GRAPHICS::_0x5C674EB487891F6B() < 89f) { if (!func_749()) { if (GRAPHICS::_0x5C674EB487891F6B() >= 46f && GRAPHICS::_0x5C674EB487891F6B() <= 55f) { func_761(uParam0, &iLocal_67, 15, 1, 1101004800 /* Float: 20f */, 1109393408 /* Float: 40f */); } else if (GRAPHICS::_0x5C674EB487891F6B() >= 57f && GRAPHICS::_0x5C674EB487891F6B() <= 63f) { func_761(uParam0, &iLocal_67, 14, 1, 1101004800 /* Float: 20f */, 1109393408 /* Float: 40f */); } else if (GRAPHICS::_0x5C674EB487891F6B() >= 66f && GRAPHICS::_0x5C674EB487891F6B() <= 79f) { func_761(uParam0, &iLocal_67, 16, 1, 1101004800 /* Float: 20f */, 1109393408 /* Float: 40f */); } else if (GRAPHICS::_0x5C674EB487891F6B() >= 86f) { func_761(uParam0, &iLocal_67, 17, 1, 1101004800 /* Float: 20f */, 1109393408 /* Float: 40f */); } } } } }