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
e9e729c841cfa6014440fc919e9351bb711bd51b
b7c15c33ea387e15a6bffcb36297c210851348d6
/Dungeon Escape/Player.h
832a29140027b2278a7ac08e22e2f822eecfaaa3
[]
no_license
nickc01/Dungeon-Escape-OLD
0f8e44f931ee39484b397233a2a05b7ea371ab08
652a9852520cf19174e27f928f6fcd7855bacb1e
refs/heads/master
2022-10-29T03:50:12.871308
2020-03-22T23:56:19
2020-03-22T23:56:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,480
h
Player.h
#pragma once #include "AnimatedEntity.h" //Contains the AnimatedEntity class for entities that are animated #include "WorldMap.h" //Contains the WorldMap class #include "ResourceTexture.h" //Contains the ResourceTexture class for loading in texture resources #include <SFML/Graphics.hpp> //Contains many essential SFML classes and functions for rendering #include <vector> //Contains std::vector for storing objects in an array #include "Direction.h" //Contains the Direction Enum for specifying the direction #include "Array2D.h" //Contains the Array2D class, which is for storing objects in a 2D array //The main player in the game class Player : public AnimatedEntity { static Player* currentPlayer; //The singleton object for the player class static ResourceTexture playerSpriteSheet; //The texture resource for the player bool moving = false; //Whether the player is moving or not bool invincible = false; //Whether the player is invincible or not float invincibilityTimer = 0.0f; //Keeps track of how long the player is invincible for float flickerTimer = 0.0f; //Keeps track of how long the player should be flickering float orbSpawnTimer = 0.0f; //Keeps track of how fast the player should be spawning magic orbs Direction travelDirection = Direction::Up; //The direction the player is traveling in bool reachedDoor = false; //Whether the player has reached the door or not int health = 5; //The health of the player //Updates the player sprite void UpdateSprite(); public: //Gets the currently spawned player in the game static Player* GetCurrentPlayer(); //Constructs a new player Player(const WorldMap& map, sf::Vector2f spawnPoint); //Deleting these four functions prevents the object from being copied or moved Player(const Player& player) = delete; Player(Player&& player) = delete; Player& operator=(const Player& player) = delete; Player& operator=(Player&& player) = delete; //Gets the player's traveling direction Direction GetPlayerDirection() const; //Returns whether the player is moving or not bool IsMoving() const; //Gets the health of the player int GetHealth() const; //Causes the player to take a hit and lose some health void TakeHit(); //Whether the player is alive or not bool IsAlive() const; //Whether the player has reached the door or not bool ReachedTheDoor() const; //The update loop of the player virtual void Update(sf::Time dt) override; //Destructs the player virtual ~Player(); };
9c13cbd6791bb23be4500bbe5d8c621fab2b6f52
9b9a5ed499756374b7047ea36aaed984c92c68c9
/examples/LargeFileTest/LargeFileTest.cpp
4afc0b12f29fe9b3d7a915537592f6cc0e728f5e
[ "MIT" ]
permissive
rickkas7/LittleFS-RK
af46b5e63b510b7e14d106399b6088d2592b8760
786a51f2f7a5ae308b43bf6d4a240820ff385b41
refs/heads/main
2023-01-11T16:15:39.359373
2020-11-10T22:20:13
2020-11-10T22:20:13
311,787,539
0
0
null
null
null
null
UTF-8
C++
false
false
7,010
cpp
LargeFileTest.cpp
#include "Particle.h" #include "LittleFS-RK.h" #include <fcntl.h> // Test program that creates a number of large files for testing. // Used to exercise the whole flash over time. SYSTEM_THREAD(ENABLED); SYSTEM_MODE(MANUAL); SerialLogHandler logHandler(LOG_LEVEL_WARN, { // Logging level for non-application messages { "app", LOG_LEVEL_INFO } // Default logging level for all application messages }); // Chose a flash configuration: // SpiFlashISSI spiFlash(SPI, A2); // ISSI flash on SPI (A pins) // SpiFlashISSI spiFlash(SPI1, D5); // ISSI flash on SPI1 (D pins) // SpiFlashWinbond spiFlash(SPI, A2); // Winbond flash on SPI (A pins) // SpiFlashWinbond spiFlash(SPI1, D5); // Winbond flash on SPI (D pins) // SpiFlashMacronix spiFlash(SPI, A2); // Macronix flash on SPI (A pins) SpiFlashMacronix spiFlash(SPI1, D5); // Macronix flash on SPI1 (D pins), typical config for E series // SpiFlashP1 spiFlash; // P1 external flash inside the P1 module const unsigned long TEST_PERIOD_MS = 120000; unsigned long lastTestRun = 10000 - TEST_PERIOD_MS; typedef void (*StateHandler)(); StateHandler stateHandler = 0; // This is the size of writes, not the sector size! const size_t BLOCK_SIZE = 512; // This affects RAM usage. uint8_t testBuf1[BLOCK_SIZE], testBuf2[BLOCK_SIZE]; // Number of BLOCK_SIZE bytes per file // For BLOCK_SIZE = 512, NUM_BLOCKS = 512: files are 256 Kbytes each const size_t NUM_BLOCKS = 512; size_t blockNum = 0; // Each file is 256 Kbytes = 1/4 Mbytes // The maximum number of files was determined by seeing when writes fail because the // volume was full. There is more overhead than I would have thought. // W25Q32JV = 32 Mbit = 4 Mbyte: NUM_FILES = 12, PHYS_SIZE = 4 * 1024 * 1024 // 64 Mbit = 8 Mbyte: NUM_FILES = 24 PHYS_SIZE = 8 * 1024 * 1024 // 128 Mbit = 16 Mbyte: NUM_FILES = 39, PHYS_SIZE = 16 * 1024 * 1024 // MX25L25645G = 256 Mbit = 32 Mbyte: NUM_FILES = 96, PHYS_SIZE = 32 * 1024 * 1024 const size_t NUM_FILES = 96; const size_t PHYS_SIZE = 32 * 1024 * 1024; LittleFS fs(&spiFlash, 0, PHYS_SIZE / 4096); size_t fileNum = 0; char fileName[12]; int fd; size_t curOffset = 0; unsigned long fileStartTime; void fillBuf(uint8_t *buf, size_t size); void stateWaitNextRun(); void stateChipEraseAndMount(); void stateStartNextFile(); void stateWriteAndTest(); void stateVerifyNextFile(); void stateVerifyBlocks(); void stateDeleteFiles(); void stateFailure(); class LogTime { public: inline LogTime(const char *desc) : desc(desc), start(millis()) { Log.info("starting %s", desc); } inline ~LogTime() { Log.info("finished %s: %lu ms", desc, millis() - start); } const char *desc; unsigned long start; }; void setup() { Serial.begin(); spiFlash.begin(); stateHandler = stateWaitNextRun; } void loop() { if (stateHandler) { (*stateHandler)(); } } void stateWaitNextRun() { if (millis() - lastTestRun < TEST_PERIOD_MS) { return; } lastTestRun = millis(); stateHandler = stateChipEraseAndMount; } void stateChipEraseAndMount() { Log.info("sending reset to flash chip"); spiFlash.resetDevice(); if (!spiFlash.isValid()) { Log.info("failed to detect flash chip"); stateHandler = stateFailure; return; } // If using a 256 Mbit SPI flash chip, enable 32-bit // addressing or things will not work properly if (PHYS_SIZE > (16 * 1024 * 1024)) { // Larger than 16 Mbyte requires 32-bit addressing mode spiFlash.set4ByteAddressing(true); } // Unmount if mounted LittleFS::getInstance()->unmount(); int res; { LogTime time("chipErase"); spiFlash.chipErase(); } res = LittleFS::getInstance()->mount(); Log.info("mount res=%d", res); if (res != 0) { stateHandler = stateFailure; return; } srand(0); fileNum = 0; stateHandler = stateStartNextFile; } void stateStartNextFile() { // Create a new numbered file if (++fileNum > NUM_FILES) { Log.info("writes completed, verifying files now"); srand(0); fileNum = 0; lastTestRun = millis(); stateHandler = stateVerifyNextFile; return; } snprintf(fileName, sizeof(fileName), "t%d", fileNum); fd = open(fileName, O_RDWR|O_CREAT); if (fd == -1) { Log.info("open failed %d", __LINE__); stateHandler = stateFailure; return; } curOffset = 0; blockNum = 0; stateHandler = stateWriteAndTest; fileStartTime = millis(); Log.info("writing file %u", fileNum); } void stateWriteAndTest() { if (++blockNum > NUM_BLOCKS) { // Done with this file Log.info("file %u completed in %lu ms", fileNum, millis() - fileStartTime); close(fd); stateHandler = stateStartNextFile; return; } fillBuf(testBuf1, sizeof(testBuf1)); size_t offset = curOffset; int writeResult = write(fd, testBuf1, sizeof(testBuf1)); if (writeResult != sizeof(testBuf1)) { Log.info("write failure %d != %u at offset %u", writeResult, sizeof(testBuf1), offset); close(fd); stateHandler = stateFailure; return; } curOffset += sizeof(testBuf1); lseek(fd, offset, SEEK_SET); read(fd, (char *)testBuf2, sizeof(testBuf2)); for(size_t ii = 0; ii < sizeof(testBuf1); ii++) { if (testBuf1[ii] != testBuf2[ii]) { Log.info("mismatched data blockNum=%u ii=%u expected=%02x got=%02x", blockNum, ii, testBuf1[ii], testBuf2[ii]); } } } void stateVerifyNextFile() { if (++fileNum > NUM_FILES) { Log.info("tests completed!"); stateHandler = stateDeleteFiles; return; } snprintf(fileName, sizeof(fileName), "t%d", fileNum); fd = open(fileName, O_RDWR|O_CREAT); if (fd == -1) { Log.info("open failed %d", __LINE__); stateHandler = stateFailure; return; } blockNum = 0; stateHandler = stateVerifyBlocks; fileStartTime = millis(); Log.info("verifying file %u", fileNum); } void stateVerifyBlocks() { if (++blockNum > NUM_BLOCKS) { // Done with this file Log.info("file %u verified in %lu ms", fileNum, millis() - fileStartTime); close(fd); stateHandler = stateVerifyNextFile; return; } fillBuf(testBuf1, sizeof(testBuf1)); read(fd, (char *)testBuf2, sizeof(testBuf2)); for(size_t ii = 0; ii < sizeof(testBuf1); ii++) { if (testBuf1[ii] != testBuf2[ii]) { Log.info("mismatched data blockNum=%u ii=%u expected=%02x got=%02x", blockNum, ii, testBuf1[ii], testBuf2[ii]); } } } void stateDeleteFiles() { Log.info("deleting all files"); for(size_t ii = 0; ii < NUM_FILES; ii++) { snprintf(fileName, sizeof(fileName), "t%d", ii); unlink(fileName); } Log.info("running tests again..."); srand(0); fileNum = 0; stateHandler = stateStartNextFile; } void stateFailure() { static bool reported = false; if (!reported) { reported = true; Log.info("entered failure state, tests stopped"); } } void fillBuf(uint8_t *buf, size_t size) { for(size_t ii = 0; ii < size; ii += 4) { int val = rand(); buf[ii] = (uint8_t) (val >> 24); buf[ii + 1] = (uint8_t) (val >> 16); buf[ii + 2] = (uint8_t) (val >> 8); buf[ii + 3] = (uint8_t) val; } }
39e5989c992bc508c36f4c9ee577de32952bc231
bdb971cbe6451fb3d4b19f091ee17357d5607809
/MP4/Player.cpp
9912ed1550bef5e6f650ae07ffb90caba6cb315d
[]
no_license
bobthesponge10/MP4
6d2c6fcb8eb910586bcca13b50cbc526ef488881
ab3e4339a6e7e2a85c0e7defb9c886b1b69cb7f2
refs/heads/master
2023-01-07T11:29:02.313640
2020-11-09T23:25:47
2020-11-09T23:25:47
308,957,435
0
1
null
2020-11-06T17:11:29
2020-10-31T19:31:02
C++
UTF-8
C++
false
false
12,587
cpp
Player.cpp
// Player.cpp #include "Player.h" // Sets command keywords const vector<string> help_ {"h", "help", "?", "what", "why"}; const vector<string> up_ {"w", "up"}; const vector<string> down_ {"s", "down"}; const vector<string> left_ {"a", "left"}; const vector<string> right_ {"d", "right"}; const vector<string> inventory_ {"i", "inventory", "inv"}; const vector<string> view_ {"v", "view", "interact", "see", "use"}; const vector<string> stats_ {"stats", "stat"}; const vector<string> get_ {"g", "get", "take", "grab"}; const vector<string> put_ {"p", "put", "place"}; const vector<string> fight_ {"f", "fight", "battle", "attack"}; const vector<string> equip_ {"e", "equip"}; const vector<string> unequip_ {"ue", "unequip"}; const vector<string> weapon_ {"w", "weapon"}; const vector<string> armor_ {"a", "armor"}; const vector<string> flee_ {"flee", "escape", "run"}; const vector<string> use_ {"use", "item"}; Player::Player(){ // Initializes default values set_char('@'); set_fg(Color(0, 0, 255)); set_type("player"); set_inv_name("Inventory"); max_hp = 20; hp = max_hp; } void Player::update(){ } void Player::view_tile(int x, int y){ Tile* t = get_map()->get_tile_p(x, y); // Local variable string type = t->get_type(); if(type == "chest"){ Chest* c = (Chest*)t; c->print_items(); wait_for_input(); } else if(type == "heal_station"){ hp = max_hp; print_text("Healed to full health\n\n"); wait_for_input(); } else if(type == "portal"){ Portal* p = (Portal*)t; get_map()->add_flag("m"+to_string(p->get_index())); hp = max_hp; print_text("Teleporting to level " + to_string(p->get_index() + 1) + "\n\n"); } int i = get_map()->find_entity(x, y); if(i != -1){ Entity* e = get_map()->get_entity(i); if(e->get_type() == "enemy"){ // Nested if statement Enemy* en = (Enemy*)e; print_text("----Enemy----\n"); print_text("Name: " + en->get_name() + "\n"); print_text("Health: " + to_string(en->get_hp()) + "/" + to_string(en->get_max_hp()) + "\n"); print_text("-------------\n\n"); wait_for_input(); } else if(e->get_type() == "enemy_gate"){ EnemyGate* en = (EnemyGate*)e; if(en->get_size() > 0){ print_text("Defeat all enemies to open the gate.\n\n"); wait_for_input(); }else{ print_text("The gate is now permanently locked.\n\n"); wait_for_input(); } } else if(e->get_type() == "key_gate"){ KeyGate* en = (KeyGate*)e; Item key = en->get_key(); int index = -1; for(int i = 0; i < get_inv_size(); i++){ // ++ operator if(key.is_equal(get_item(i))){ index = i; } } if(index == -1){ print_text(key.get_name() + " needed to open the gate\n\n"); wait_for_input(); }else{ print_text("Used " + key.get_name() + " to open the gate\n\n"); en->open_gate(); if(en->get_use_item()){ remove_item(index); } wait_for_input(); } } else if(e->get_type() == "sign"){ Sign* en = (Sign*)e; print_text("----Sign----\n"); print_text(en->get_text() + "\n"); print_text("------------\n\n"); wait_for_input(); } } } void Player::get_item_from_tile(int x, int y, int index){ Tile* t = get_map()->get_tile_p(x, y); string type = t->get_type(); if(type == "chest"){ Chest* c = (Chest*)t; Item i = c->get_item(index); if(i.get_name() != ""){ c->remove_item(index); add_item(i); print_text("Got " + i.get_name() + " from the chest.\n\n"); wait_for_input(); }else{ print_text("Incorrect index of item in chest.\n\n"); wait_for_input(); } } } void Player::put_item_to_tile(int x, int y, int index){ Tile* t = get_map()->get_tile_p(x, y); string type = t->get_type(); if(type == "chest"){ Chest* c = (Chest*)t; Item i = get_item(index); if(i.get_name() != ""){ remove_item(index); c->add_item(i); print_text("Put " + i.get_name() + " into the chest.\n\n"); wait_for_input(); }else{ print_text("Incorrect index of item in inventory.\n\n"); wait_for_input(); } } } bool Player::use_item(int index, Enemy* e){ bool used = false; bool usedT = false; int temp1 = 0; string temp2 = ""; Item i = get_item(index); string type = i.get_attribute("Type"); if(type=="Consumable"){ temp2 = i.get_attribute("Regen"); if(temp2!=""){ if(is_integer(temp2)){ temp1 = stoi(temp2); used = true; usedT = true; hp += temp1; // += operator } } temp2 = i.get_attribute("Damage"); if(temp2!=""){ if(is_integer(temp2)){ temp1 = stoi(temp2); used = true; usedT = true; e->set_hp(e->get_hp()-temp1); } } if(usedT){ remove_item(index); } } else if(type=="Artifact"){ if(e->get_name() == "Baphomet"){ if(e->use_item(i)){ remove_item(index); used = true; } } } usedT = false; if(hp > max_hp){ hp = max_hp; } if(used){ print_text("Used the " + i.get_name() + "\n\n"); return true; }else{ print_text("Unable to use the " + i.get_name() + "\n\n"); } return false; } void Player::print_enemy(Enemy* enemy){ int w = enemy->get_width(); clear_screen(); cout << string(w, '=') << endl; enemy->view(); cout << string(w, '=') << endl; cout << (enemy->get_name() + ": " + to_string(enemy->get_hp()) + "/" + to_string(enemy->get_max_hp()) + " Hp\n"); cout << ("Player: " + to_string(hp) + "/" + to_string(max_hp) + " Hp\n"); cout << (string(w, '=') + "\n"); } void Player::fight(int x, int y){ int e = get_map()->find_entity(x, y); if(e == -1 || get_map()->get_entity(e)->get_type() != "enemy"){ print_text("Not a valid target\n"); wait_for_input(); return; } Entity* enemy_ = get_map()->get_entity(e); Enemy* enemy = (Enemy*)enemy_; print_text("Begun battle with " + enemy->get_name() + "\n\n"); wait_for_input(); srand(time(0)); bool fight_happening = true; int temp; int damage = 0; int index = 0; string inp; stringstream ss; bool success; bool enemy_attack = false; while(fight_happening){ print_enemy(enemy); print_text("Choices: Attack, Use/Item, Flee\n"); enemy_attack = false; cout << ":"; getline(cin, inp); ss << inp; inp == ""; ss >> inp; ss.clear(); if(contains(inp, fight_)){ damage = get_damage(); enemy->set_hp(enemy->get_hp() - damage); print_text("You did " + to_string(damage) + " damage to " + enemy->get_name() + "\n\n"); wait_for_input(); enemy_attack = true; } else if(contains(inp, use_) && get_inv_size() == 0){ print_text("Your inventory is empty\n\n"); wait_for_input(); } else if(contains(inp, use_)){ print_items(); print_text("Enter index of item to use: "); getline(cin, inp); ss << inp; index = -1; ss >> index; ss.clear(); if(index >= 0 && index < get_inv_size()){ if(use_item(index, enemy)){ enemy_attack = true; }else{ print_text("Unable to use item\n\n"); } }else{ print_text("Not a valid index\n\n"); } wait_for_input(); } else if(contains(inp, flee_)){ temp = rand() % 100 + 1; // Random number generator success = temp <= enemy->get_escape_chance(); if(success){ print_text("You successfully escaped " + enemy->get_name() + "\n\n"); fight_happening = false; }else{ print_text("You failed to escape " + enemy->get_name() + "\n\n"); enemy_attack = true; } wait_for_input(); } if(enemy->get_hp()<=0){ print_enemy(enemy); enemy->die(); print_text("You defeated " + enemy->get_name() + "\n\n"); if(enemy->get_inv_size()>0){ enemy->set_inv_name("You got"); enemy->print_items(); } for(int i = 0; i < enemy->get_inv_size(); i++){ add_item(enemy->get_item(0)); enemy->remove_item(0); } fight_happening = false; wait_for_input(); } if(fight_happening && enemy_attack){ print_enemy(enemy); enemy->battle_turn(this); } if(hp <= 0){ print_enemy(enemy); print_text(enemy->get_name() + " killed you\n\n"); get_map()->add_flag("die"); fight_happening = false; wait_for_input(); } } } void Player::parse_input(string input){ stringstream ss; ss << input; vector<string> args; string temp; while(!ss.eof()){ ss >> temp; if(!ss.fail()){ transform(temp.begin(), temp.end(), temp.begin(), ::tolower); args.push_back(temp); } } int x = get_x(); int y = get_y(); int nx = x; int ny = y; int index = 0; if(args.size()>1){ if(contains(args[1], up_)){ ny = y - 1; } else if(contains(args[1], down_)){ ny = y + 1; } else if(contains(args[1], left_)){ nx = x - 1; } else if(contains(args[1], right_)){ nx = x + 1; } } if(args.size()>0){ if(contains(args[0], up_)){ move_up(); } else if(contains(args[0], down_)){ move_down(); } else if(contains(args[0], left_)){ move_left(); } else if(contains(args[0], right_)){ move_right(); } else if(contains(args[0], inventory_)){ print_text("---------Equipped--------\n"); print_text("Weapon: " + weapon.get_name() + "\n"); print_text("Armor: " + armor.get_name() + "\n"); print_items(); wait_for_input(); } else if(contains(args[0], stats_)){ int damage = get_damage(); int prot = get_protection(); print_text("----------Stats----------\n"); print_text("Health: " + to_string(hp) + "/" + to_string(max_hp) + "\n"); print_text("Damage: " + to_string(damage) + "\n"); print_text("Protection: " + to_string(prot) + "\n"); print_text("-------------------------\n\n"); wait_for_input(); } else if(contains(args[0], help_)){ print_text("Good luck\n\n"); wait_for_input(); } } if(args.size()>1){ if(contains(args[0], view_)){ view_tile(nx, ny); } else if(contains(args[0], unequip_)){ if(contains(args[1], weapon_)){ unequip_weapon(); } else if(contains(args[1], armor_)){ unequip_armor(); } } else if(contains(args[0], fight_)){ fight(nx, ny); } } if(args.size()>2){ if(contains(args[0], get_) && is_integer(args[2])){ index = stoi(args[2]); // Conversion to int get_item_from_tile(nx, ny, index); } else if(contains(args[0], put_) && is_integer(args[2])){ index = stoi(args[2]); put_item_to_tile(nx, ny, index); } else if(contains(args[0], equip_) && is_integer(args[2])){ index = stoi(args[2]); if(contains(args[1], weapon_)){ equip_weapon(index); }else if(contains(args[1], armor_)){ equip_armor(index); } } } } void Player::render_window(int w, int h, bool clear){ int w_ = get_map()->get_w(); int h_ = get_map()->get_h(); if(w > w_){ w = w_; } if(h > h_){ h = h_; } int x = get_x() - w / 2; if(x < 0){ x = 0; } if(x + w > w_){ x = w_ - w; } int y = get_y() - h / 2; if(y < 0){ y = 0; } if(y + h > h_){ y = h_ - h; } string s = get_map()->render(x, y, w, h, false); if(clear){ clear_screen(); } cout << s; } void Player::unequip_armor(){ if(armor.get_name()!=""){ add_item(armor); print_text("You unequipped the " + armor.get_name() + "\n\n"); armor = Item(); }else{ print_text("No armor currently equipped\n\n"); } wait_for_input(); } void Player::unequip_weapon(){ if(weapon.get_name()!=""){ add_item(weapon); print_text("You unequipped the " + weapon.get_name() + "\n\n"); weapon = Item(); }else{ print_text("No weapon currently equipped\n\n"); } wait_for_input(); } void Player::equip_weapon(int index){ if(weapon.get_name()!=""){ print_text("Weapon already equipped\n\n"); wait_for_input(); return; } Item i = get_item(index); if(i.get_attribute("Type") == "Weapon"){ weapon = i; print_text("You equipped the " + i.get_name() + "\n\n"); remove_item(index); }else{ print_text("Not a valid weapon\n\n"); } wait_for_input(); } void Player::equip_armor(int index){ if(armor.get_name() != ""){ print_text("Armor already equipped\n\n"); wait_for_input(); return; } Item i = get_item(index); if(i.get_attribute("Type") == "Armor"){ armor = i; print_text("You equipped the " + i.get_name() + "\n\n"); remove_item(index); }else{ print_text("Not a valid armor\n\n"); } wait_for_input(); } int Player::get_damage(){ string t = weapon.get_attribute("Damage"); int i = 1; if(is_integer(t) && t != ""){ i = stoi(t); return i; } return i; } int Player::get_protection(){ string t = armor.get_attribute("Protection"); int i = 0; if(is_integer(t) && t != ""){ i = stoi(t); return i; } return i; } void Player::set_hp(int a){ if(a < 0){ hp = 0; return; } hp = a; } int Player::get_hp(){ return hp; }
f989fa898415496866cc642ea939bb14cdf94c6c
326bdbf6363d1429772c3acb840766c461ada20c
/RedBall/Coin.cpp
35fc2e3d8b31b95b6399b5c384b6efc142f5f00c
[]
no_license
ZoRRoZ-ZeT/Red_Ball
b259b5d595fe2cccb551f0084f355262324898f0
5e8f6cab5aa7556a22b7d34a1915fdabef96deda
refs/heads/main
2023-06-03T05:03:12.097554
2021-06-22T19:46:15
2021-06-22T19:46:15
379,380,573
0
0
null
null
null
null
UTF-8
C++
false
false
215
cpp
Coin.cpp
#include "Coin.h" Coin::Coin(sf::Vector2f _position, sf::Vector2f _size, std::string path) :Obstacle(_position, _size, path) { } void Coin::Render(sf::RenderWindow * target) { target->draw(this->GetSprite()); }
11cab9cb24c293f4c276555a8fafa21ea11271fc
1f4615d0bf8fbbd7bf7082ef752af1d32fbcdab7
/vitrina/ui_contenedor_datos.h
9d93ede9a9d6ffcd926de2573acaf709e74cb365
[]
no_license
rodety/manager
be4568f4a601490f762756e7693120730a23b28f
edbf07466fd04748fb2bcc8007d8f692f7a2cc2f
refs/heads/master
2016-09-10T18:14:38.978545
2013-05-16T07:48:10
2013-05-16T07:48:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,479
h
ui_contenedor_datos.h
#ifndef UI_CONTENEDOR_DATOS_H #define UI_CONTENEDOR_DATOS_H #include <QWidget> #include "ui_almacen.h" #include "configuracion/sesion.h" #include <QInputDialog> namespace Ui { class ui_contenedor_datos; } class ui_contenedor_datos : public QWidget { Q_OBJECT private: QString idContenedor; ui_almacen* ui_almacen_parent; int behavior; int cantidadProducto; bool toAlmacen; public: QString get_idContenedor(); void set_idContenedor(QString); ui_almacen* get_ui_almacen_parent(); void set_ui_almacen_parent(ui_almacen*); int get_behavior(); void set_behavior(int); void setToAlmacen(bool tmp) { toAlmacen=tmp;} void setCantidadProducto(int tmp) { cantidadProducto=tmp;} void set_idProducto(QString); bool add_Product(); bool insert_Product(); void set_spinBox_fila(int); void set_spinBox_columna(int); void clear_widget_list_productos(); void uptate_widget_list_productos(); void update_form(); public: explicit ui_contenedor_datos(QWidget *parent = 0); ~ui_contenedor_datos(); private slots: void on_pushButton_salir_clicked(); bool on_pushButton_addProducto_clicked(); void on_pushButton_saveContenedor_clicked(); void on_pushButton_deleteContenedor_clicked(); void on_pushButton_deleteProducto_clicked(); void on_traspaso_clicked(); private: Ui::ui_contenedor_datos *ui; }; #endif // UI_CONTENEDOR_DATOS_H
95a3778f340c8036941474be6d12c7172dcc7b36
12b15a6f8f99b8b4259e537af73075995b7d04bf
/lab/lab5_pass_by_object/pass_object.cpp
17aa9f99e21764e2ec5b07c8792ed0425fde9a38
[]
no_license
PraveshPandey23/cpp_project
48cdfee60e9537a3d0cc7552d6e4f30e47f34ace
f08ded410d984d5906a8e8aceed96c4b1e332b2b
refs/heads/main
2023-06-05T22:04:35.318902
2021-06-24T11:44:34
2021-06-24T11:44:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
967
cpp
pass_object.cpp
#include<iostream> using namespace std; class Complex { private: double real,imaginery; double sum_real,sum_imaginery; public: void getdata() { cout<<"Enter complex number "<<endl; cin>>real>>imaginery; } void display_sum() { cout<<"The sum of Complex numbers is"<<endl; cout<<sum_real<<" + "<<sum_imaginery<<" i "<<endl; } int Add_num(Complex C1 , Complex C2) { //Complex n; sum_real= C1.real + C2.real; sum_imaginery = C1.imaginery + C2.imaginery; // return sum; return 0; } }; int main() { Complex C1,C2,C3; cout<<"Enter First Complex number "<<endl; C1.getdata(); cout<<"Enter Second Complex number "<<endl; C2.getdata(); C3.Add_num(C1,C2); C3.display_sum(); }
c125c17134e56715ef615143a34fd60ee854d7dd
030724b60fb4f8b63953b7401702a98072993e94
/cpp/826.most_profit_assigning_work.cpp
61c99571b6c0c119ddbc26311d70bc5e414b108b
[]
no_license
MtTsai/Leetcode
5f51a892b78cf6427ce2b4891a10bc2d4ed4d972
21e83294aee779a16a8c1b96089da4a40eb03035
refs/heads/master
2021-01-24T17:17:52.909429
2019-08-04T06:53:53
2019-08-04T06:54:23
123,228,705
0
0
null
null
null
null
UTF-8
C++
false
false
732
cpp
826.most_profit_assigning_work.cpp
class Solution { public: int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) { vector<pair<int, int>> jobs; for (int i = 0; i < difficulty.size(); i++) { jobs.push_back({profit[i], difficulty[i]}); } sort(worker.rbegin(), worker.rend()); sort(jobs.rbegin(), jobs.rend()); int ans = 0; int widx = 0; for (auto &job: jobs) { int prof = job.first, diff = job.second; while (widx < worker.size() && worker[widx] >= diff) { ans += prof; widx++; } if (widx == worker.size()) break; } return ans; } };
dabc950f38be87b4dbc8869ba81ce17479bce0ed
2d9f20e8247fb0b457628391c6a6941f756fba2e
/server/lib/MultithreadQueue.hpp
5db55055851b32ac5c41a109ccddfd38f9363189
[]
no_license
ProjectB/ProjectB
e1644a56714b26ce93b21b32d1c9a6fb0d08e592
35f04106d1ecb79730d755e79e707130046da563
refs/heads/master
2020-12-25T19:14:41.580589
2015-03-22T20:24:56
2015-03-22T20:24:56
5,298,007
0
0
null
null
null
null
UTF-8
C++
false
false
656
hpp
MultithreadQueue.hpp
/* * MultithreadQueue.hpp * * Created on: Sep 7, 2012 * Author: ricardo */ #ifndef MULTITHREADQUEUE_HPP_ #define MULTITHREADQUEUE_HPP_ #include <queue> #include <thread> template <typename T> class MultithreadQueue { private: std::queue<T> mtQueue; std::mutex mtMutex; public: void push(T elem) { mtMutex.lock(); mtQueue.push(elem); mtMutex.unlock(); } T pop() { T elem; mtMutex.lock(); elem = mtQueue.front(); mtQueue.pop(); mtMutex.unlock(); return elem; } bool empty() { bool isEmpty; mtMutex.lock(); isEmpty = mtQueue.empty(); mtMutex.unlock(); return isEmpty; } }; #endif /* MULTITHREADQUEUE_HPP_ */
ca5b2bf20013846def54024ebc0930d8e6c9a3ad
55bc718e7d994774806bef6d95e1c958243e1d37
/powerstatustray.cpp
3a02dc7471dcd46e4fcd58ec91eec8a04ea43086
[ "MIT" ]
permissive
FauxFaux/tinies
9069953b6cd75f605975b29b86ca05430d013fa0
b475c4ee2945a3c9177cdfc5e9e33d18d49dfc47
refs/heads/master
2020-06-04T07:23:25.492469
2018-05-20T20:29:35
2018-05-20T20:29:35
3,166,427
4
0
null
null
null
null
UTF-8
C++
false
false
6,522
cpp
powerstatustray.cpp
/* Tray code modified from http://damb.dk */ #pragma comment(lib, "user32.lib") #pragma comment(lib, "shell32.lib") #include "defines.h" #include <iostream> #include <string> #include <algorithm> #include <windows.h> #include <vector> #include <set> #include <utility> #include <sstream> std::vector<std::wstring> getDrives() { std::vector<std::wstring> things; { std::wstring whole; { const size_t max = 512; wchar_t str[max]; size_t l = GetLogicalDriveStrings(max - 1, &str[0]); whole = std::wstring(str, l); } std::wstring::size_type op = 0, p = 0; while((p = whole.find(L'\0', 0)) != std::wstring::npos) { things.push_back(whole.substr(0, p-1)); whole = whole.substr(p+1); } } return things; } typedef std::set<std::wstring> wstrset_t; typedef std::pair<wstrset_t, wstrset_t> doublepair_t; doublepair_t getOnOff() { const std::vector<std::wstring> things = getDrives(); doublepair_t pairs; for (std::vector<std::wstring>::const_iterator it = things.begin(); it != things.end(); ++it) { HANDLE h = CreateFile((L"\\\\.\\" + *it).c_str(), 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); BOOL b; if (h != INVALID_HANDLE_VALUE && GetDevicePowerState(h, &b)) if (b) pairs.first.insert(*it); else pairs.second.insert(*it); CloseHandle(h); } return pairs; } const UINT trayID = 123; const UINT TRAY_MESSAGE = WM_APP + trayID; const UINT IDM_TIMER = 1002; const wchar_t className[] = L"PowerStatusClass"; const wchar_t trayTip[] = L"PowerStatus tray notification"; HICON HIcon; doublepair_t previous = getOnOff(); void add(std::wstringstream &o, const wstrset_t &st) { if (st.empty()) o << L"None."; else for (wstrset_t::const_iterator it = st.begin(); it != st.end(); ++it) o << *it << " "; } std::wstring stringify() { std::wstringstream wss; doublepair_t curr = getOnOff(); wss << L"On: "; add(wss, curr.first); wss << "\n"; wss << L"Off: "; add(wss, curr.second); wss << "\n"; return wss.str(); } void SetBaloonTip(HWND hwndDlg, const std::wstring &title, const std::wstring &body) { NOTIFYICONDATA NotifyIconData; memset(&NotifyIconData, 0, sizeof(NOTIFYICONDATA)); NotifyIconData.cbSize = sizeof(NOTIFYICONDATA); NotifyIconData.uID = trayID; NotifyIconData.hWnd = hwndDlg; NotifyIconData.hIcon = HIcon; NotifyIconData.uFlags = NIF_INFO | NIF_REALTIME; NotifyIconData.uTimeout = 10000; NotifyIconData.uCallbackMessage = TRAY_MESSAGE; wcscpy_s(NotifyIconData.szInfoTitle, title.c_str()); wcscpy_s(NotifyIconData.szInfo, body.c_str()); wcscpy_s(NotifyIconData.szTip, trayTip); Shell_NotifyIcon(NIM_MODIFY, (NOTIFYICONDATA *)&NotifyIconData); } wstrset_t newItems(const wstrset_t &old, const wstrset_t &now) { wstrset_t ret; for (wstrset_t::const_iterator it = now.begin(); it != now.end(); ++it) if (old.find(*it) == old.end()) ret.insert(*it); return ret; } void add(std::wstringstream &o, const bool singular, const wchar_t *msg) { o << (singular ? L"is" : L"are") << L" now "<< msg << ".\n"; } LRESULT CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_DESTROY: PostQuitMessage(0); break; case TRAY_MESSAGE: if(lParam == WM_LBUTTONUP) SetBaloonTip(hwndDlg, L"Drive statuses:", stringify()); else if (lParam == WM_RBUTTONUP) PostQuitMessage(0); break; case WM_TIMER: { const doublepair_t curr = getOnOff(); if (curr != previous) { wstrset_t nowOn = newItems(previous.first, curr.first), nowOff = newItems(previous.second, curr.second); std::wstringstream wss; if (!nowOn.empty()) { add(wss, nowOn); add(wss, nowOn.size() == 1, L"on"); } if (!nowOff.empty()) { add(wss, nowOff); add(wss, nowOff.size() == 1, L"off"); } SetBaloonTip(hwndDlg, L"Drive status change:", wss.str()); previous = curr; } } break; } return DefWindowProc(hwndDlg, msg, wParam, lParam); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, INT) { HMODULE shell32 = LoadLibraryEx(L"shell32.dll", NULL, LOAD_LIBRARY_AS_DATAFILE); HIcon = LoadIcon(shell32, MAKEINTRESOURCE(8)); WNDCLASS wc; memset(&wc, 0, sizeof(WNDCLASS)); wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; wc.lpfnWndProc = DialogProc; wc.hInstance = hInstance; wc.hbrBackground = (HBRUSH )(COLOR_BTNFACE + 1); wc.lpszClassName = className; wc.hCursor = LoadCursor(NULL, IDC_ARROW); if(!RegisterClass(&wc)) return FALSE; HWND WindowHandle = CreateWindowW(className, L"Powerstatus", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hInstance, 0); { NOTIFYICONDATA NotifyIconData; memset(&NotifyIconData, 0, sizeof(NotifyIconData)); NotifyIconData.cbSize = sizeof(NotifyIconData); NotifyIconData.uID = trayID; NotifyIconData.hWnd = WindowHandle; NotifyIconData.hIcon = HIcon; NotifyIconData.uFlags = NIF_ICON | NIF_MESSAGE; NotifyIconData.uCallbackMessage = WM_APP + 123; wcscpy_s(NotifyIconData.szTip, trayTip); Shell_NotifyIcon(NIM_ADD, &NotifyIconData); } SetTimer(WindowHandle, IDM_TIMER, 5000, 0); MSG Msg; while(GetMessage(&Msg, WindowHandle, 0, 0xFFFF) > 0) { if(!IsDialogMessage(WindowHandle, &Msg)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } } return 0; } #if legacy_rubbish int wmain(int argc, wchar_t *argv[]) { const bool showon = argc > 1; vector<wstring> things; { wstring whole; { const size_t max = 512; wchar_t str[max]; size_t l = GetLogicalDriveStrings(max, &str[0]); whole = wstring(str, l); } wstring::size_type op = 0, p = 0; while((p = whole.find(L'\0', 0)) != wstring::npos) { things.push_back(whole.substr(0, p-1)); // Strip trailing backslash? whole = whole.substr(p+1); } } for (std::vector<wstring>::iterator it = things.begin(); it != things.end(); ++it) { HANDLE h = CreateFile((L"\\\\.\\" + *it).c_str(), 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (h == INVALID_HANDLE_VALUE) wcerr << "Unable to open " << *it << endl; BOOL b; if (GetDevicePowerState(h, &b)) { if (showon || !b) wcout << *it << " is " << (b ? "on" : "off") << endl; } else wcerr << "GetDevicePowerState failed for" << *it << endl; CloseHandle(h); } } #endif
2cc9f0006c1b3ae3f7e7bdb57fea67ea5b238434
1aa66758de93fd481fb37a5e9ca791b8a828027b
/Project/Foldable MTP/Program/Ibis/Source/Project/BankGuild/UnitCtrlBank.cpp
5f064a56578af51c96270c30c7ee78cc2c13b4df
[]
no_license
yuecl01/YW
1f632bdb110868ad6a13c18d1b16abe0f649be13
87687d4026961122b1f2f88e1689b1a1cdf7e9bb
refs/heads/master
2023-03-15T13:57:10.560018
2018-06-16T07:58:22
2018-06-16T07:58:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
195,676
cpp
UnitCtrlBank.cpp
#include "StdAfx.h" #include "UnitCtrlBank.h" #include "IbisApp.h" #include "UI\GausGUI\GxMsgBox.h" #include "Etc\FileSupport.h" #include "Etc\Ini.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ALARM_ID CUnitCtrlBank::GetAlarmID_of_Shuttle( ALARM_ID id, JIG_ID jig ) { // 전부 1000의 배수로 나뉘어지니 Shuttle Index에 1000을 곱한다 [8/30/2017 OSC] return (ALARM_ID)(id + (jig*ALM_SHUTTLE1_PART)); } //축들이 원점을 잡을때 인터락 BOOL CUnitCtrlBank::CheckOriginInterlock(AXIS_ID idAxis) { theProcBank.m_strLastKorMsg = _T(""); theProcBank.m_strLastEngMsg = _T(""); theProcBank.m_strLastVnmMsg = _T(""); BOOL bRet = TRUE; //20170912 hhkim 원점 인터락 switch(idAxis) { case AXIS_JIG_SHUTTLE_Y1: if(Inspection_Z_UP_Check(JIG_ID_A) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z1축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z1."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z1 lên."); bRet = FALSE; } if(Shuttle_Tilt_UpDown_Check(JIG_ID_A, TILT_DOWN) == FALSE) { theProcBank.m_strLastKorMsg = _T("TILT를 DOWN해주세요."); theProcBank.m_strLastEngMsg = _T("Please down TILT."); theProcBank.m_strLastVnmMsg = _T("Please down TILT."); bRet = FALSE; } break; case AXIS_JIG_SHUTTLE_Y2: if(Inspection_Z_UP_Check(JIG_ID_B) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z2축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z2."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z2 lên."); bRet = FALSE; } if(Shuttle_Tilt_UpDown_Check(JIG_ID_B, TILT_DOWN) == FALSE) { theProcBank.m_strLastKorMsg = _T("TILT를 DOWN해주세요."); theProcBank.m_strLastEngMsg = _T("Please down TILT."); theProcBank.m_strLastVnmMsg = _T("Please down TILT."); bRet = FALSE; } break; case AXIS_INSPECTION_X1: if(Inspection_Z_UP_Check(JIG_ID_A) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z1축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z1."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z1 lên."); bRet = FALSE; } break; case AXIS_INSPECTION_X2: if(Inspection_Z_UP_Check(JIG_ID_B) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z2축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z2."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z2 lên."); bRet = FALSE; } break; // Z축은 인터락 필요가없나?? 없을거 같음... } return bRet; } BOOL CUnitCtrlBank::CheckTeachMoveInterlock(TEACH_PARAM::ID idTeach, double dOffset /*= 0.*/ ) { // CDeviceMotion::TeachMove에서 축에 이동명령을 내리기 전에 확인하는 Interlock [10/26/2016 OSC] // BOOL로 return하며, 관련 Msg를 따로 멤버변수에 남기므로 티칭 UI에서는 아래 변수 Text를 MsgBox로 띄우면 됨 theProcBank.m_strLastKorMsg = _T(""); theProcBank.m_strLastEngMsg = _T(""); theProcBank.m_strLastVnmMsg = _T(""); BOOL bRet = TRUE; //20170912 hhkim TeachMveInterlock switch(idTeach) { case TEACH_PARAM::JIG_SHUTTLE_Y1_to_LOAD: if(Inspection_Z_UP_Check(JIG_ID_A) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z1축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z1."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z1 lên."); bRet = FALSE; } if(Shuttle_Tilt_UpDown_Check(JIG_ID_A, TILT_DOWN) == FALSE) { theProcBank.m_strLastKorMsg = _T("TILT를 DOWN해주세요."); theProcBank.m_strLastEngMsg = _T("Please down TILT."); theProcBank.m_strLastVnmMsg = _T("Please down TILT."); bRet = FALSE; } if(theConfigBank.m_System.m_bInlineMode) { if(PDT_IF_ArmStatus_Check(JIG_ID_A)) { theProcBank.m_strLastKorMsg = _T("Robot을 치워주세요."); theProcBank.m_strLastEngMsg = _T("Please move out Robot."); theProcBank.m_strLastVnmMsg = _T("Xin hay di chuyen Robot ra."); bRet = FALSE; } } break; case TEACH_PARAM::JIG_SHUTTLE_Y1_to_MANUAL: if(Inspection_Z_UP_Check(JIG_ID_A) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z1축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z1."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z1 lên."); bRet = FALSE; } if(Shuttle_Tilt_UpDown_Check(JIG_ID_A, TILT_DOWN) == FALSE) { theProcBank.m_strLastKorMsg = _T("TILT를 DOWN해주세요."); theProcBank.m_strLastEngMsg = _T("Please down TILT."); theProcBank.m_strLastVnmMsg = _T("Please down TILT."); bRet = FALSE; } break; case TEACH_PARAM::JIG_SHUTTLE_Y1_to_INSP: if(Inspection_Z_UP_Check(JIG_ID_A) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z1축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z1."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z1 lên."); bRet = FALSE; } if(Shuttle_Tilt_UpDown_Check(JIG_ID_A, TILT_DOWN) == FALSE) { theProcBank.m_strLastKorMsg = _T("TILT를 DOWN해주세요."); theProcBank.m_strLastEngMsg = _T("Please down TILT."); theProcBank.m_strLastVnmMsg = _T("Please down TILT."); bRet = FALSE; } break; ///////////////////////////////////////////////////////////////////////////////////////////// case TEACH_PARAM::JIG_SHUTTLE_Y2_to_LOAD: if(Inspection_Z_UP_Check(JIG_ID_B) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z2축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z2."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z2 lên."); bRet = FALSE; } if(Shuttle_Tilt_UpDown_Check(JIG_ID_B, TILT_DOWN) == FALSE) { theProcBank.m_strLastKorMsg = _T("TILT를 DOWN해주세요."); theProcBank.m_strLastEngMsg = _T("Please down TILT."); theProcBank.m_strLastVnmMsg = _T("Please down TILT."); bRet = FALSE; } if(theConfigBank.m_System.m_bInlineMode) { if(PDT_IF_ArmStatus_Check(JIG_ID_B)) { theProcBank.m_strLastKorMsg = _T("Robot을 치워주세요."); theProcBank.m_strLastEngMsg = _T("Please move out Robot."); theProcBank.m_strLastVnmMsg = _T("Xin hay di chuyen Robot ra."); bRet = FALSE; } } break; case TEACH_PARAM::JIG_SHUTTLE_Y2_to_MANUAL: if(Inspection_Z_UP_Check(JIG_ID_B) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z2축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z2."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z2 lên."); bRet = FALSE; } if(Shuttle_Tilt_UpDown_Check(JIG_ID_B, TILT_DOWN) == FALSE) { theProcBank.m_strLastKorMsg = _T("TILT를 DOWN해주세요."); theProcBank.m_strLastEngMsg = _T("Please down TILT."); theProcBank.m_strLastVnmMsg = _T("Please down TILT."); bRet = FALSE; } break; case TEACH_PARAM::JIG_SHUTTLE_Y2_to_INSP: if(Inspection_Z_UP_Check(JIG_ID_B) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z2축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z2."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z2 lên."); bRet = FALSE; } if(Shuttle_Tilt_UpDown_Check(JIG_ID_B, TILT_DOWN) == FALSE) { theProcBank.m_strLastKorMsg = _T("TILT를 DOWN해주세요."); theProcBank.m_strLastEngMsg = _T("Please down TILT."); theProcBank.m_strLastVnmMsg = _T("Please down TILT."); bRet = FALSE; } break; ////////////////////////////////////////////////////////////////////////////////////////////////// case TEACH_PARAM::INSPECTION_X1_to_INSP: if(Inspection_Z_UP_Check(JIG_ID_A) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z1축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z1."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z1 lên."); bRet = FALSE; } break; case TEACH_PARAM::INSPECTION_X2_to_INSP: if(Inspection_Z_UP_Check(JIG_ID_B) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection Z2축을 Up해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Up Inspection Z2."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục Z2 lên."); bRet = FALSE; } break; //////////////////////////////////////////////////////////////////////////////////////////////// case TEACH_PARAM::INSPECTION_Z1_to_UP: break; case TEACH_PARAM::INSPECTION_Z2_to_UP: break; ///////////////////////////////////////////////////////////////////////////////////////////////// case TEACH_PARAM::INSPECTION_Z1_to_INSP: if(Shuttle_Y_LOAD_Check(JIG_ID_A) == FALSE) { if(Inspection_X_INSP_Check(JIG_ID_A) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection X1 위치에서 Down해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Down on the Inspection X1."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục X1 xuống."); bRet = FALSE; } } break; case TEACH_PARAM::INSPECTION_Z2_to_INSP: if(Shuttle_Y_LOAD_Check(JIG_ID_B) == FALSE) { if(Inspection_X_INSP_Check(JIG_ID_B) ==FALSE) { theProcBank.m_strLastKorMsg = _T("Inspection X2 위치에서 Down해주세요."); theProcBank.m_strLastEngMsg = _T("Please Move Down on the Inspection X2."); theProcBank.m_strLastVnmMsg = _T("Xin hãy di chuyển Inspection trục X2 xuống."); bRet = FALSE; } } break; ///////////////////////////////////////////////////////////////////////////////////////////////////// case TEACH_PARAM::ACTIVE_ALIGN_X1_to_LEFT: break; case TEACH_PARAM::ACTIVE_ALIGN_X1_to_RIGHT: break; case TEACH_PARAM::ACTIVE_ALIGN_X2_to_LEFT: break; case TEACH_PARAM::ACTIVE_ALIGN_X2_to_RIGHT: break; ///////////////////////////////////////////////////////////////////////////////////////////////////// } return bRet; } //kjpark 20161030 정위치가 아니면 A존에 A지그 가도록 다이얼로그창 띄움 void CUnitCtrlBank::TeachMove(TEACH_PARAM::ID idTeach, double dOffset) { theDeviceMotion.TeachMove(m_nThreadID, idTeach); } BOOL CUnitCtrlBank::CellTagExist( CELL_POS pos ) { return theCellBank.GetCellTag(pos).IsExist(); } //kjpark 20170915 Restart 구현 BOOL CUnitCtrlBank::CellTagExist(JIG_ID jig, JIG_CH channel) { return theCellBank.GetCellTag(jig, channel).IsExist(); } BOOL CUnitCtrlBank::CellTagExist( CELL_POS posStart, CELL_POS posEnd, CHECK_OPTION chkoption /*= CHECK_OR*/ ) { // 하나라도 비어있으면 FALSE [11/5/2016 OSC] if(chkoption == CHECK_AND) { for(int i = posStart; i <= posEnd; i++) { if(theCellBank.GetCellTag((CELL_POS)i).IsExist() == FALSE) return FALSE; } return TRUE; } // 하나라도 있으면 TRUE [11/5/2016 OSC] else { for(int i = posStart; i <= posEnd; i++) { if(theCellBank.GetCellTag((CELL_POS)i).IsExist()) return TRUE; } return FALSE; } } void CUnitCtrlBank::CellTagChange( CELL_POS posBefore, CELL_POS posAfter ) { theCellBank.SetCellTagNextPosition(posBefore, posAfter); } void CUnitCtrlBank::PreInterlockHappen(CString strEFST) { // 쟁여두었던 인터락을 발생시킨다 INTERLOCK_ALARM_INFOMATION info; if(strEFST == EFST_STEP) { POSITION pos = theProcBank.m_listPreInterlockStep.GetHeadPosition(); while(pos) { if(theProcBank.m_MsgInterlockCnt > INTERLOCKMAX) break; info = theProcBank.m_listPreInterlockStep.GetNext(pos); theProcBank.SetWriteInterlockLog(info); theProcBank.m_strInterlockMsg[theProcBank.m_MsgInterlockCnt] = info.strInterlock_Message; theProcBank.m_MsgInterlockCnt++; if(theProcBank.m_strOldInterlockID == _T("")) { theProcBank.m_strOldInterlockID = theProcBank.m_strInterlockID; theProcBank.m_strInterlockID = info.strInterlock_ID; } } theProcBank.m_listPreInterlockStep.RemoveAll(); } else if(strEFST == EFST_LOADING) { POSITION pos = theProcBank.m_listPreInterlockLoad.GetHeadPosition(); while(pos) { if(theProcBank.m_MsgInterlockCnt > INTERLOCKMAX) break; info = theProcBank.m_listPreInterlockLoad.GetNext(pos); theProcBank.SetWriteInterlockLog(info); theProcBank.m_strInterlockMsg[theProcBank.m_MsgInterlockCnt] = info.strInterlock_Message; theProcBank.m_MsgInterlockCnt++; if(theProcBank.m_strOldInterlockID == _T("")) { theProcBank.m_strOldInterlockID = theProcBank.m_strInterlockID; theProcBank.m_strInterlockID = info.strInterlock_ID; } } theProcBank.m_listPreInterlockLoad.RemoveAll(); } else if(strEFST == EFST_TRANSFER) { POSITION pos = theProcBank.m_listPreInterlockTrans.GetHeadPosition(); while(pos) { if(theProcBank.m_MsgInterlockCnt > INTERLOCKMAX) break; info = theProcBank.m_listPreInterlockTrans.GetNext(pos); theProcBank.SetWriteInterlockLog(info); theProcBank.m_strInterlockMsg[theProcBank.m_MsgInterlockCnt] = info.strInterlock_Message; theProcBank.m_MsgInterlockCnt++; if(theProcBank.m_strOldInterlockID == _T("")) { theProcBank.m_strOldInterlockID = theProcBank.m_strInterlockID; theProcBank.m_strInterlockID = info.strInterlock_ID; } } theProcBank.m_listPreInterlockTrans.RemoveAll(); } theProcBank.SetInterlock(strEFST); } void CUnitCtrlBank::PreUnitInterlockHappen() { // 쟁여두었던 인터락을 발생시킨다 INTERLOCK_ALARM_INFOMATION info; POSITION pos = theProcBank.m_listPreUnitInterlock.GetHeadPosition(); while(pos) { if(theProcBank.m_UnitInterlockCnt > INTERLOCKMAX) break; info = theProcBank.m_listPreUnitInterlock.GetNext(pos); theProcBank.SetWriteInterlockLog(info); theProcBank.m_strUnitInterlockMsg[theProcBank.m_UnitInterlockCnt] = info.strInterlock_Message; theProcBank.m_UnitInterlockCnt++; theProcBank.m_strUnitInterlockID = info.strInterlock_ID; theProcBank.m_strInterlockedUnitID = info.strUnit_ID; theUnitStatusBank.SetInterlock(info.strUnit_ID); } theProcBank.PreUnitInterlock_Clear(); } //kjpark 20161016 Cell Result 항목 추가 void CUnitCtrlBank::JudgeFinalClass(JIG_ID jig, JIG_CH ch) { CCellTag tagCell = theCellBank.GetCellTag(jig, ch); if(tagCell.IsExist()==FALSE) return; CCellInfo *pCell = theCellBank.GetCellInfo(tagCell); CLASS_CELL nClass = NONE_CELL; CString strDefect; pCell->defaultData.FinalJudge = GetDefectFromJudge(ZONE_ID_MAX, pCell, strDefect, nClass); // ByPass 모드일 경우 모두 Good으로 판정한다 - LSH171208 if( theConfigBank.m_Option.m_bUseByPass ) { pCell->defaultData.m_strLastResult = _T("GOOD"); pCell->defaultData.m_LastClass = GOOD_CELL; } else { pCell->defaultData.m_strLastResult = strDefect; pCell->defaultData.m_LastClass = nClass; } if(pCell->defaultData.m_LastClass != GOOD_CELL) { // 불량코드 판정 pCell->defaultData.MesCode = MesCode(pCell->defaultData.m_strLastResult, pCell->defaultData.m_bRetryAble, pCell->defaultData.FinalJudge); // 리트라이 옵션이 꺼져 있으면 해제 [12/1/2017 OSC] if(theConfigBank.m_Option.m_bUseRetryAB == FALSE) pCell->defaultData.m_bRetryAble = FALSE; // Job Start가 안되도 리트라이 해제 [12/4/2017 OSC] if( theConfigBank.m_CIM.TRACKING_CONTROL_InCheck() && (theProcBank.GetCimState() == CONST_CIM_STATE::CIM_REMOTE) ) { if(pCell->defaultData.m_nInspectInvalidType != JOB_START) pCell->defaultData.m_bRetryAble = FALSE; } } // AB RULE 기록 if(pCell->defaultData.m_bRetryAB) { // Retry한 거면 무조건 AB pCell->defaultData.m_strABRule = AB_RULE_AB; } else { if(pCell->defaultData.m_LastClass == GOOD_CELL) { // 양품이면 공백 pCell->defaultData.m_strABRule = AB_RULE_GOOD; } else { // Retry 할 거면 A if( pCell->defaultData.m_bRetryAble && (pCell->defaultData.m_bRetryAB == FALSE) ) pCell->defaultData.m_strABRule = AB_RULE_A; } } theLog[LOG_JUDGE].AddBuf(_T("%s\t%s\tdefaultCellInfomation.FinalJudge\t%s"), pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID, CONST_JUDGE_LIST[pCell->defaultData.FinalJudge].strName); theLog[LOG_JUDGE].AddBuf(_T("%s\t%s\tFinalClass\t%d"), pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID, pCell->defaultData.m_LastClass); theLog[LOG_JUDGE].AddBuf(_T("%s\t%s\tFinalDefect\t%s"), pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID, pCell->defaultData.m_strLastResult); theLog[LOG_JUDGE].AddBuf(_T("%s\t%s\tAB RULE\t%s"), pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID, pCell->defaultData.m_strABRule); } CString CUnitCtrlBank::MesCode(CString strDefectName, BOOL &bRetryAble, int nJudge /*= CONST_JUDGE_NAME::JUDGE_MCR*/) { // 1. 전부 대문자로 바꾸고 비교 // 2. 괄호부터는 무시 CString strParsedDefectName = strDefectName; int nIndex = strDefectName.Find(_T("(")); // 괄호부터 시작하는 불량명이 있어서 그런것들은 전체 비교 if(nIndex > 3) strParsedDefectName = strDefectName.Mid(0, nIndex); strParsedDefectName.MakeUpper(); BOOL bFind = FALSE; DEFECT_MES_CODE defectUndefinedCode, defectTSPUndefinedCode, defectForceUndefinedCode,defectCurrentUndefinedCode, defectFinal; map<int, DEFECT_MES_CODE>::iterator itmap = theProcBank.iMapDefectList.begin(); for(; itmap != theProcBank.iMapDefectList.end(); ++ itmap) { //if(pCell->defaultCellInfomation.m_LastResult.Find(itmap->second.strPopup) == 0) //문자 포함할 경우 사용 if(strParsedDefectName == itmap->second.strPopup) { defectFinal = itmap->second; bFind = TRUE; } else if(TEXT_UNDEFINED == itmap->second.strPopup) { defectUndefinedCode = itmap->second; // strUndefinedCode = TEXT_UNDEFINED_CODE; } else if(TEXT_TSP_IC == itmap->second.strPopup) { defectTSPUndefinedCode = itmap->second; } // else if(TEXT_TOL_MAX_OVER== itmap->second.strPopup) // { // defectForceUndefinedCode = itmap->second; // } else if(TEXT_I_BAT_OVER== itmap->second.strPopup) { defectCurrentUndefinedCode= itmap->second; } //////////////////////////////////////////////////////////////////// } if(bFind == FALSE) { if( nJudge == CONST_JUDGE_NAME::JUDGE_TSP_START) defectFinal = defectTSPUndefinedCode; // else if((nJudge == CONST_JUDGE_NAME::JUDGE_FORCE1)|| (nJudge == CONST_JUDGE_NAME::JUDGE_FORCE2) // || (nJudge == CONST_JUDGE_NAME::JUDGE_FORCE3)) // defectFinal = defectForceUndefinedCode; else if( nJudge == CONST_JUDGE_NAME::JUDGE_WHITE_CURRENT || nJudge == CONST_JUDGE_NAME::JUDGE_HLPM_CURRENT || nJudge == CONST_JUDGE_NAME::JUDGE_SLEEP_CURRENT ) defectFinal = defectCurrentUndefinedCode; else defectFinal = defectUndefinedCode; } bRetryAble = defectFinal.bRetryAble; return defectFinal.strMES_CODE; } //kjpark 20161016 Cell Result 항목 추가 //kjpark 20161017 WoorkTable Turn int CUnitCtrlBank::GetDefectFromJudge( ZONE_ID zone, CCellInfo *pCell, CString &strDefect, CLASS_CELL &nClass ) { int nJudgeIndex = CONST_JUDGE_NAME::JUDGE_MCR; switch(zone) { case ZONE_ID_A: nJudgeIndex = AZoneJudgeFlow(pCell, strDefect, nClass); break; case ZONE_ID_B: nJudgeIndex = BZoneJudgeFlow(pCell, strDefect, nClass); break; case ZONE_ID_MAX: nJudgeIndex = LastJudgeFlow(pCell, strDefect, nClass); break; } // SDC 이성민 요청으로 존 대표 불량도 괄호 이후 삭제 [7/13/2017 OSC] int nIndex = strDefect.Find(_T("(")); if(nIndex > 3) strDefect = strDefect.Mid(0, nIndex); return nJudgeIndex; } //kjpark 20161016 Cell Result 항목 추가 int CUnitCtrlBank::AZoneJudgeFlow( CCellInfo *pCell, CString &strDefect, CLASS_CELL &nClass ) { if( pCell->defaultData.m_bPGAlarm/* && (pCell->defaultCellInfomation.m_PGAlarmZone == ZONE_ID_A)*/ ) { strDefect = pCell->defaultData.m_strPGAlarmName; nClass = REJECT_CELL; return CONST_JUDGE_NAME::JUDGE_PG_ALARM; } else { CONST_JUDGE_NAME::ID nJudge; nJudge = ModuleListJudgeFlow(&theRecipeBank.m_Module.m_vct_AZone_Bef, pCell, strDefect, nClass); if(nClass == GOOD_CELL) { nJudge = ModuleListJudgeFlow(&theRecipeBank.m_Module.m_vct_AZone_Must, pCell, strDefect, nClass); } if(nClass == GOOD_CELL) { nJudge = ModuleListJudgeFlow(&theRecipeBank.m_Module.m_vct_AZone_Aft, pCell, strDefect, nClass); } return nJudge; } } //kjpark 20161016 Cell Result 항목 추가 int CUnitCtrlBank::BZoneJudgeFlow( CCellInfo *pCell, CString &strDefect, CLASS_CELL &nClass ) { if( pCell->defaultData.m_bPGAlarm/* && (pCell->defaultCellInfomation.m_PGAlarmZone == ZONE_ID_A)*/ ) { strDefect = pCell->defaultData.m_strPGAlarmName; nClass = REJECT_CELL; return CONST_JUDGE_NAME::JUDGE_PG_ALARM; } else { CONST_JUDGE_NAME::ID nJudge; nJudge = ModuleListJudgeFlow(&theRecipeBank.m_Module.m_vct_BZone_Bef, pCell, strDefect, nClass); if(nClass == GOOD_CELL) { nJudge = ModuleListJudgeFlow(&theRecipeBank.m_Module.m_vct_BZone_Must, pCell, strDefect, nClass); } if(nClass == GOOD_CELL) { nJudge = ModuleListJudgeFlow(&theRecipeBank.m_Module.m_vct_BZone_Aft, pCell, strDefect, nClass); } return nJudge; } } int CUnitCtrlBank::MCRJudgeFlow(CCellInfo *pCell, CString &strDefect, CLASS_CELL &nClass) { // MCR 못읽었어도 불량. 하지만 모든 검사는 다 원래대로 한다 // 검사 결과에 따라 불량명이 바뀐다 if(theConfigBank.m_CIM.CELL_MCR_MODE_Check()) { if(pCell->defaultData.m_bMCR_OK == FALSE) { if(nClass == GOOD_CELL) strDefect = TEXT_MCR_READING_FAIL_GOOD; else strDefect = TEXT_MCR_READING_FAIL_NG; nClass = REJECT_CELL; return CONST_JUDGE_NAME::JUDGE_MCR; } } //kjpark 20180113 Cell infomation NG 시 Job Process 로 Last Result 남는 버그 수정 if(theProcBank.GetCimState() == CONST_CIM_STATE::CIM_REMOTE) { if(pCell->defaultData.m_strCellInfoResult != TEXT_0) { //kjpark 20180123 cellionfomation, jobprocess 페일시 라스트 리절트 정리 if(pCell->defaultData.m_CellInfoResult == NONE_CELL) { if(nClass == GOOD_CELL) strDefect = TEXT_CELL_INFO_TIMEOUT_GOOD; else strDefect = TEXT_CELL_INFO_TIMEOUT_NG; } else if((pCell->defaultData.m_CellInfoResult == SKIP_CELL) && (pCell->defaultData.m_strCellInfoResult == TIMEOUT_NG)) { if(nClass == GOOD_CELL) strDefect = TEXT_CELL_INFO_TIMEOUT_GOOD; else strDefect = TEXT_CELL_INFO_TIMEOUT_NG; } else //if(pCell->defaultData.m_CellInfoResult == REJECT_CELL) { if(nClass == GOOD_CELL) strDefect = TEXT_CELL_INFO_FAIL_GOOD; else strDefect = TEXT_CELL_INFO_FAIL_NG; } nClass = REJECT_CELL; return CONST_JUDGE_NAME::JUDGE_MCR; } } //kjpark 20171010 TMD Match 구현 //kjpark 20180120 Cell Mixing 처리(강원호 선임) - 컨텍 NG보다 셀믹싱이 우선 if(theConfigBank.m_Option.m_bUseTMDNameMatch) { if(pCell->defaultData.m_bMCR_OK) { if(pCell->defaultData.CellMixing != GOOD_CELL) { strDefect = pCell->defaultData.m_strCellMixing; nClass = REJECT_CELL; return CONST_JUDGE_NAME::JUDGE_CELL_MIXING; } } } if(theConfigBank.m_CIM.TRACKING_CONTROL_InCheck()) { if(theProcBank.GetCimState() == CONST_CIM_STATE::CIM_REMOTE) { if(pCell->defaultData.m_nInspectInvalidType != JOB_START) { //kjpark 20180123 cellionfomation, jobprocess 페일시 라스트 리절트 정리 if(pCell->defaultData.m_nInspectInvalidType == JOB_INVALID) { if(nClass == GOOD_CELL) strDefect = TEXT_VALIDATION_FAIL_GOOD; else strDefect = TEXT_VALIDATION_FAIL_NG; } //kjpark 20180124 cellionfomation, jobprocess 페일시 라스트 리절트 정리 버그 수정 else if(pCell->defaultData.m_nInspectInvalidType == JOB_DEFAULT) { if(nClass == GOOD_CELL) strDefect = TEXT_VALIDATION_TIMEOUT_GOOD; else strDefect = TEXT_VALIDATION_TIMEOUT_NG; } else if(pCell->defaultData.m_nInspectInvalidType == JOB_SKIP) { if(nClass == GOOD_CELL) strDefect = TEXT_VALIDATION_FAIL_GOOD; else strDefect = TEXT_VALIDATION_FAIL_NG; } nClass = REJECT_CELL; return CONST_JUDGE_NAME::JUDGE_MCR; } } } return CONST_JUDGE_NAME::JUDGE_MCR; } int CUnitCtrlBank::LastJudgeFlow(CCellInfo *pCell, CString &strDefect, CLASS_CELL &nClass) { int nJudge = CONST_JUDGE_NAME::JUDGE_MCR; nJudge = AZoneJudgeFlow(pCell, strDefect, nClass); if(nClass == GOOD_CELL) { nJudge = BZoneJudgeFlow(pCell, strDefect, nClass); } // SDC 이정현프로 요청으로 MCR을 맨 나중에 체크하되 우선순위 맨 위로 선정 [11/23/2017 OSC] nJudge = MCRJudgeFlow(pCell, strDefect, nClass); return nJudge; } CONST_JUDGE_NAME::ID CUnitCtrlBank::ModuleListJudgeFlow( std::vector<CString> *pVector, CCellInfo *pCell, CString &strDefect, CLASS_CELL &nClass ) { CString strModuleName = INSP_MODULE_NONE; CCellDefectInfo *pDefectInfo; int nCount = pVector->size(); for(int i = 0; i < nCount; i++) { strModuleName = pVector->at(i); pDefectInfo = pCell->GetDefectInfo(strModuleName); if(pDefectInfo) { if(pDefectInfo->m_Class != GOOD_CELL) { strDefect = pDefectInfo->m_DefectName; nClass = pDefectInfo->m_Class; return pDefectInfo->m_Judge; } } } strDefect = GOOD; nClass = GOOD_CELL; return CONST_JUDGE_NAME::JUDGE_MCR; } //kjpark 20161017 WorkTable Turn void CUnitCtrlBank::JudgeZoneDefect(JIG_ID jig, ZONE_ID defectzone) { CCellInfo* pCell; CCellTag tagCell; for (int i = 0; i < JIG_CH_MAX; i++) { tagCell = theCellBank.GetCellTag(jig, (JIG_CH)i); if(tagCell.IsExist()) { pCell = theCellBank.GetCellInfo(tagCell); switch(defectzone) { case ZONE_ID_A: GetDefectFromJudge(defectzone, pCell, pCell->m_AZone.m_DefectName, pCell->m_AZone.m_Class); break; case ZONE_ID_B: GetDefectFromJudge(defectzone, pCell, pCell->m_BZone.m_DefectName, pCell->m_BZone.m_Class); break; } } } } //kjpark 20180120 Cell Mixing 처리(강원호 선임) BOOL CUnitCtrlBank::GetCellSkipCheck( JIG_ID jig, JIG_CH nCh, BOOL bCheckContinue) { BOOL bRet = FALSE; if(theCellBank.GetCellTag(jig, nCh).IsExist()) { if(theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, nCh))->defaultData.m_bIsInspectionSkip) { if(bCheckContinue) { if(theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, nCh))->defaultData.CellMixing == REJECT_CELL) { return FALSE; } else { return TRUE; } } return FALSE; } bRet = TRUE; } return bRet; } void CUnitCtrlBank::Product_CountUpdate( JIG_ID jig ) { CCellInfo *pCell; for (int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { SetProductData(jig, (JIG_CH)i); } } } void CUnitCtrlBank::AZoneCell_RemoveSkipCell( JIG_ID jig ) { // 작업자가 SKIP이라고 처리한 채널의 CellTag를 삭제한다 [9/13/2017 OSC] CCellTag tag; for (int i = 0; i < JIG_CH_MAX; i++) { tag = theCellBank.GetCellTag(jig, (JIG_CH)i); if(theProcBank.AZoneChannelNotUse_Check(jig, (JIG_CH)i) && tag.IsExist()) { theCellBank.RemoveCellTag(jig, (JIG_CH)i); } } } BOOL CUnitCtrlBank::CellInfo_GetInspFinish(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 이 셀이 검사가 끝난 셀인지 확인 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->defaultData.m_LastClass == NONE_CELL) return FALSE; else return TRUE; } } return FALSE; } void CUnitCtrlBank::CellLog_SetOperatorID(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { CCellInfo *pCell; if(ch == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->defaultData.m_str_Operator_SSO_ID = GetMainHandler()->GetCurOperatorUserInspectorData().sID; } } } else { pCell = theCellBank.GetCellInfo(jig, ch); if(pCell) { pCell->defaultData.m_str_Operator_SSO_ID = GetMainHandler()->GetCurOperatorUserInspectorData().sID; } } } void CUnitCtrlBank::CellLog_TactTime_SetStartTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 물류 : 인터페이스 끝 ~ A존 도착 시점 // 단동 : PG On 버튼 ~ A존 도착 시점 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_TactTime.SetTimeStart(); } } } void CUnitCtrlBank::CellLog_TactTime_SetEndTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 물류 : 인터페이스 끝 ~ A존 도착 시점 // 단동 : PG On 버튼 ~ A존 도착 시점 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_TactTime.SetTimeEnd(); } } } void CUnitCtrlBank::CellLog_SetUnloadTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_UnloadTactTime.SetTimeStart(theProcBank.m_OldUnloadTime[jig][i]); pCell->m_UnloadTactTime.SetTimeEnd(); theProcBank.m_OldUnloadTime[jig][i] = pCell->m_UnloadTactTime.m_timeEnd; } } } void CUnitCtrlBank::CellLog_WaitTime_SetStartTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 물류 : A존 도착 시점 ~ 인터페이스 시작 // 단동 : A존 도착 시점 ~ 현재 Cell PG On CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(theProcBank.m_OldWaitTime[jig][i].wYear == 0) GetLocalTime(&theProcBank.m_OldWaitTime[jig][i]); } } } void CUnitCtrlBank::CellLog_WaitTime_SetEndTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 물류 : A존 도착 시점 ~ 인터페이스 시작 // 단동 : A존 도착 시점 ~ 현재 Cell PG On CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(theProcBank.m_OldWaitTime[jig][i].wYear != 0) pCell->m_WaitTime.SetTimeStart(theProcBank.m_OldWaitTime[jig][i]); pCell->m_WaitTime.SetTimeEnd(); // 값을 사용했으면 초기화 theProcBank.m_OldWaitTime[jig][i] = SYSTEMTIME(); } } } void CUnitCtrlBank::CellLog_LoadingTactTime_SetStartTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 물류 : 인터페이스 끝 ~ CELL_LOADING 시작 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_LoadingTactTime.SetTimeStart(); } } } void CUnitCtrlBank::CellLog_LoadingTactTime_SetEndTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 물류 : 인터페이스 끝 ~ CELL_LOADING 시작 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_LoadingTactTime.SetTimeEnd(); } } } void CUnitCtrlBank::CellLog_MCRReadTime_SetStartTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 셔틀 MCR 위치 도착 완료 ~ Inspection 위치 이동 시작 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_MCRReadTime.SetTimeStart(); } } } void CUnitCtrlBank::CellLog_MCRReadTime_SetEndTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 셔틀 MCR 위치 도착 완료 ~ Inspection 위치 이동 시작 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_MCRReadTime.SetTimeEnd(); } } } void CUnitCtrlBank::CellLog_AZoneETCTime_SetStartTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // A존의 Cell Loading 외 다른 검사시간. 어짜피 점등 이후니 AFT 검사만 신경쓰자 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_AZoneETCTime.SetTimeStart(); } } } void CUnitCtrlBank::CellLog_AZoneETCTime_SetEndTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // A존의 Cell Loading 외 다른 검사시간. 어짜피 점등 이후니 AFT 검사만 신경쓰자 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_AZoneETCTime.SetTimeEnd(); } } } void CUnitCtrlBank::CellLog_BZoneMTPReadyTime_SetStartTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 셔틀 C존 도착부터 B존 검사 시작 전까지 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_MTPReadyTime.SetTimeStart(); } } } void CUnitCtrlBank::CellLog_BZoneMTPReadyTime_SetEndTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 셔틀 C존 도착부터 C존 검사 시작 전까지 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_MTPReadyTime.SetTimeEnd(); } } } void CUnitCtrlBank::CellLog_BZoneETCTime_SetStartTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // C존의 MTP 검사시간 이후부터 C존 AFT 검사 완료까지 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_BZoneETCTime.SetTimeStart(); } } } void CUnitCtrlBank::CellLog_BZoneETCTime_SetEndTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // C존의 MTP 검사시간 이후부터 C존 AFT 검사 완료까지 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_BZoneETCTime.SetTimeEnd(); } } } void CUnitCtrlBank::CellLog_Write( JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/ ) { if(ch == JIG_CH_MAX) { switch(jig) { case JIG_ID_A: theCellBank.WriteCellLog(CELL_POS_SHUTTLE1_CH1); theCellBank.WriteCellLogTemp(CELL_POS_SHUTTLE1_CH1); break; case JIG_ID_B: theCellBank.WriteCellLog(CELL_POS_SHUTTLE2_CH1); theCellBank.WriteCellLogTemp(CELL_POS_SHUTTLE2_CH1); break; } } else { theCellBank.WriteCellLog(jig, ch); theCellBank.WriteCellLogTemp(jig, ch); } } //kjpark 20180107 신호기 로그에서 MTP 측정 값 가지고와서 셀로그에 넣기 void CUnitCtrlBank::GetMTP_Isnpection_Value(JIG_ID jig, JIG_CH ch) { CCellInfo *pCell; pCell = theCellBank.GetCellInfo(jig, ch); if(pCell) { SYSTEMTIME time; ::GetLocalTime(&time); if(theProcBank.m_PGData[jig][ch].ScanLog(pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID, time)) { if(theProcBank.m_PGData[jig][ch].SelectData()) { theProcBank.m_PGData[jig][ch].SetValueToCellInfo(pCell); } } } } void CUnitCtrlBank::CIM_BZoneCellInfoRequest() { CCellInfo *pCell; for (int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo((CELL_POS)(CELL_POS_SHUTTLE1_CH1 + i)); if(pCell) theSocketInterFace.m_CIM.SendCmdCellToDataPC(EQUIP_SET_CELL_INFORMATION_REQUEST, pCell); } } void CUnitCtrlBank::CIM_BZoneCellTrackIn() { CCellInfo *pCell; for (int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo((CELL_POS)(CELL_POS_SHUTTLE1_CH1 + i)); if(pCell) { theSocketInterFace.m_CIM.SendCmdCellToDataPC(EQUIP_SET_CELL_PROCESS_START_LOAD, pCell); theLog[LOG_TRACKING].AddBuf(_T("CellID[%s], InnerID[%s], Track In Send"), pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID); } } } void CUnitCtrlBank::CIM_AZoneCellDefectInfoRequest() { CCellInfo *pCell; for (int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo((CELL_POS)(CELL_POS_SHUTTLE1_CH1 + i)); if(pCell) { if(pCell->defaultData.m_strCellID != TEXT_FAIL) theSocketInterFace.m_CIM.SendCmdCellToDataPC(EQUIP_SET_CELL_LOT_INFORMATION_REQUEST, pCell, _T("DEFECT")); } } } void CUnitCtrlBank::CIM_CellExistInMachine() { CCellTag tag; BOOL bExist = FALSE; if(theConfigBank.m_System.m_bInlineMode) { if(CellTagExist(CELL_POS_SHUTTLE1_CH1, CELL_POS_SHUTTLE2_CH1)) { bExist = TRUE; } else { bExist = FALSE; } } else { if( ( CellTagExist(CELL_POS_SHUTTLE1_CH1, CELL_POS_SHUTTLE2_CH1) == FALSE ) || ( (CellLoading_RecvCheck(JIG_ID_A) == FALSE) && (CellLoading_RecvCheck(JIG_ID_B) == FALSE) ) ) { bExist = FALSE; } else { bExist = TRUE; } } if(bExist) { theSocketInterFace.m_CIM.SendCmdStateToDataPC(EQUIP_SET_EQUIPMENT_STATUS_CHANGE, E_EQST_MATCH_CELL_EXIST, _T("")); } else { theSocketInterFace.m_CIM.SendCmdStateToDataPC(EQUIP_SET_EQUIPMENT_STATUS_CHANGE, E_EQST_MATCH_CELL_NOT_EXIST, _T("")); } } void CUnitCtrlBank::CIM_CellExistInMachine( BOOL bExist ) { if(bExist) { theSocketInterFace.m_CIM.SendCmdStateToDataPC(EQUIP_SET_EQUIPMENT_STATUS_CHANGE, E_EQST_MATCH_CELL_EXIST, _T("")); } else { theSocketInterFace.m_CIM.SendCmdStateToDataPC(EQUIP_SET_EQUIPMENT_STATUS_CHANGE, E_EQST_MATCH_CELL_NOT_EXIST, TP_CODE_IDLE_RUNDOWN_RUNDOWN); } } //kjpark 20170907 Tracking CellInfomation, JobProcess 추가 void CUnitCtrlBank::CIM_CellInfoRequest(JIG_ID jig, JIG_CH nCh) { CCellInfo *pCell; if(nCh == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { //kjpark 20170912 셀아이디가 정상으로 읽혀야 Cellinfomation 요청 if(pCell->CellInfo_CheckAble() == FALSE) continue; if(pCell->defaultData.m_CellInfoResult == NONE_CELL) { theSocketInterFace.m_CIM.SendCmdCellToDataPC(EQUIP_SET_CELL_INFORMATION_REQUEST, pCell); theLog[LOG_TRACKING].AddBuf(_T("CellID[%s], InnerID[%s], Cell Infomation Request Send"), pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID); } } } } else { pCell = theCellBank.GetCellInfo(jig, nCh); if(pCell) { //kjpark 20170912 셀아이디가 정상으로 읽혀야 Cellinfomation 요청 if(pCell->CellInfo_CheckAble() == FALSE) return; if(pCell->defaultData.m_CellInfoResult == NONE_CELL) theSocketInterFace.m_CIM.SendCmdCellToDataPC(EQUIP_SET_CELL_INFORMATION_REQUEST, pCell); { theLog[LOG_TRACKING].AddBuf(_T("CellID[%s], InnerID[%s], Cell Infomation Request Send"), pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID); } } } } BOOL CUnitCtrlBank::CheckCellInfomationRecive(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { if(theConfigBank.m_Option.m_bUseCellInforRequest == FALSE) return TRUE; if(theProcBank.GetCimState() != CONST_CIM_STATE::CIM_REMOTE) return TRUE; CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->CellInfo_CheckAble()) { if(pCell->defaultData.m_CellInfoResult == NONE_CELL) { return FALSE; } } } } return TRUE; } //kjpark 20170907 Tracking CellInfomation, JobProcess 추가 BOOL CUnitCtrlBank::CheckCellInfomationSuccess(JIG_ID jig, JIG_CH nCh /*= JIG_CH_MAX*/) { if(theConfigBank.m_Option.m_bUseCellInforRequest == FALSE) return TRUE; if(theProcBank.GetCimState() != CONST_CIM_STATE::CIM_REMOTE) return TRUE; CCellInfo *pCell; pCell = theCellBank.GetCellInfo(jig, nCh); if(pCell == NULL) return FALSE; if(pCell->CellInfo_CheckAble() == FALSE) return TRUE; if(pCell->defaultData.m_strCellInfoResult == TEXT_0) { //kjpark 20170912 Cellinfomation 결과 pCell->defaultData.m_CellInfoResult = GOOD_CELL; return TRUE; } return FALSE; } //kjpark 20170710 CIM QUAL Jot Start, Cell Infomation Request 사용 //kjpark 20170907 Tracking CellInfomation, JobProcess 추가 BOOL CUnitCtrlBank::CheckCellJobStartRecive(JIG_ID jig, JIG_CH nCh) { //Invaide if(theConfigBank.m_CIM.TRACKING_CONTROL_InCheck() == FALSE) return TRUE; if(theProcBank.GetCimState() != CONST_CIM_STATE::CIM_REMOTE) return TRUE; CCellInfo *pCell; pCell = theCellBank.GetCellInfo(jig, nCh); if(pCell) { if(pCell->TrackIn_CheckAble() == FALSE) return TRUE; if(pCell->defaultData.m_nInspectInvalidType == JOB_DEFAULT) return FALSE; else return TRUE; } return TRUE; } BOOL CUnitCtrlBank::CheckCellJobStartSuccess(JIG_ID jig, JIG_CH ch) { //Invaide if(theConfigBank.m_CIM.TRACKING_CONTROL_InCheck() == FALSE) return TRUE; if(theProcBank.GetCimState() != CONST_CIM_STATE::CIM_REMOTE) return TRUE; CCellInfo *pCell; pCell = theCellBank.GetCellInfo(jig, ch); if(pCell) { if(pCell->TrackIn_CheckAble() == FALSE) return TRUE; else if(pCell->defaultData.m_nInspectInvalidType >= JOB_START) return TRUE; else return FALSE; } return TRUE; } void CUnitCtrlBank::CIM_SetCellInfoNG(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if( (pCell->defaultData.m_CellInfoResult != GOOD_CELL) && (pCell->defaultData.m_CellInfoResult != REJECT_CELL) ) { pCell->defaultData.m_CellInfoResult = SKIP_CELL; pCell->defaultData.m_strCellInfoResult = TIMEOUT_NG; CIM_SetTrackOutNG(jig, (JIG_CH)i); } } } } void CUnitCtrlBank::CIM_SetTrackOutNG(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->defaultData.m_nInspectInvalidType != JOB_START) { pCell->defaultData.m_nInspectInvalidType = JOB_SKIP; // pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } //kjpark 20170907 Tracking CellInfomation, JobProcess 추가 void CUnitCtrlBank::CIM_CellTrackIn(JIG_ID jig, JIG_CH nCh) { CCellInfo *pCell; if(nCh == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->TrackIn_CheckAble() && (pCell->defaultData.m_bTrackinFinish == FALSE) ) { theSocketInterFace.m_CIM.SendCmdCellToDataPC(EQUIP_SET_CELL_PROCESS_START_LOAD, pCell); theLog[LOG_TRACKING].AddBuf(_T("CellID[%s], InnerID[%s], Track In Send"), pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID); pCell->defaultData.m_bTrackinFinish = TRUE; } } } } else { pCell = theCellBank.GetCellInfo(jig, nCh); if(pCell) { if(pCell->TrackIn_CheckAble() && (pCell->defaultData.m_bTrackinFinish == FALSE) ) { theSocketInterFace.m_CIM.SendCmdCellToDataPC(EQUIP_SET_CELL_PROCESS_START_LOAD, pCell); theLog[LOG_TRACKING].AddBuf(_T("CellID[%s], InnerID[%s], Track In Send"), pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID); pCell->defaultData.m_bTrackinFinish = TRUE; } } } } void CUnitCtrlBank::CIM_CellCimJudge(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->CimJudge_Judge(); } } } void CUnitCtrlBank::CIM_CellLoadingStop(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 리트라이 해야 할 것들을 전부 LOSS로 바꾸고 Inspection End 보고를 다시 한다 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->defaultData.m_strCIMJudge == CIM_JUDGE_RETEST) { pCell->defaultData.m_strCIMJudge = CIM_JUDGE_LOSS; pCell->defaultData.m_bRetryAble = FALSE; CIM_CellAllInspectionEnd(jig, (JIG_CH)i); theLog[LOG_RETRY].AddBuf(_T("%cJIG %dCH InnerID[%s] CellID[%s] Retry Canceled. Because Loading Stop"), pCell->defaultData.m_JigId+_T('A'), ch+1, pCell->defaultData.m_strInnerID, pCell->defaultData.m_strCellID); } } // PDT가 걍 뒤로 보내줘야 함 [1/8/2018 OSC] theProcBank.RetryCellInfo_AllTrackOut(jig, (JIG_CH)i); } } //kjpark 20170907 Tracking CellInfomation, JobProcess 추가 void CUnitCtrlBank::CIM_CellAllInspectionEnd(JIG_ID jig, JIG_CH nCh) { CCellInfo *pCell; int nStart, nEnd; if(nCh == JIG_CH_MAX) { nStart = 0; nEnd = nCh; } else { nStart = nCh; nEnd = nCh+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->InspectionEnd_CheckAble() == FALSE) continue; theSocketInterFace.m_CIM.SendCmdCellToDataPC(EQUIP_SET_CELL_ENDINS, pCell); } } } //kjpark 20170907 Tracking CellInfomation, JobProcess 추가 void CUnitCtrlBank::CIM_CellTrackOut(JIG_ID jig, JIG_CH nCh) { if(theProcBank.GetCimState() != CONST_CIM_STATE::CIM_REMOTE) { theLog[LOG_TRACKING].AddBuf(_T("Offline, Track Out Cancel")); return; } CCellInfo *pCell; int nStart, nEnd; if(nCh == JIG_CH_MAX) { nStart = 0; nEnd = nCh; } else { nStart = nCh; nEnd = nCh+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->defaultData.m_bTrackOutFinish) continue; if(pCell->TrackOut_CheckAble()) { if(pCell->TrackIn_CancelAble()) { theSocketInterFace.m_CIM.SendCmdCellToDataPC(EQUIP_SET_CELL_PROCESS_COMPLETE_UNLOAD, pCell, CIM_JUDGE_OUT); theLog[LOG_TRACKING].AddBuf(_T("CellID[%s], InnerID[%s], Track Out Send [O]"), pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID); } else { theSocketInterFace.m_CIM.SendCmdCellToDataPC(EQUIP_SET_CELL_PROCESS_COMPLETE_UNLOAD, pCell); theLog[LOG_TRACKING].AddBuf(_T("CellID[%s], InnerID[%s], Track Out Send"), pCell->defaultData.m_strCellID, pCell->defaultData.m_strInnerID); } } } } } void CUnitCtrlBank::CIM_CellRetryCheck( JIG_ID jig, JIG_CH nCh /*= JIG_CH_MAX*/ ) { // 리트라이 셀인지 확인해서 맞으면 관련 정보 넘겨받는다 [9/27/2017 OSC] CCellInfo *pCell; if(nCh == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(theProcBank.RetryCellInfo_Find(jig, (JIG_CH)i, pCell->defaultData.m_strCellID)) { pCell->defaultData.m_bRetryAB = TRUE; pCell->defaultData.m_strABRule = AB_RULE_AB; pCell->defaultData.m_strAResult = theProcBank.m_pRetryCell->defaultData.m_strLastResult; pCell->defaultData.m_nInspectInvalidType = theProcBank.m_pRetryCell->defaultData.m_nInspectInvalidType; pCell->defaultData.m_bTrackinFinish = theProcBank.m_pRetryCell->defaultData.m_bTrackinFinish; pCell->defaultData.m_strCellInfoResult = theProcBank.m_pRetryCell->defaultData.m_strCellInfoResult; pCell->defaultData.m_CellInfoResult = theProcBank.m_pRetryCell->defaultData.m_CellInfoResult; theLog[LOG_RETRY].AddBuf(_T("%cJIG %dCH InnerID[%s] CellID[%s] Retry Start"), pCell->defaultData.m_JigId+_T('A'), pCell->defaultData.m_JigCh+1, pCell->defaultData.m_strInnerID, pCell->defaultData.m_strCellID); } } } } // 리트라이 체크 후에 자기 자신 채널에 아직도 리트라이 카운트가 남아있다면 // // 리트라이 안하고 그냥 빠져나갔을 경우이므로 걍 TrackOut L 보고해버린다 // theProcBank.RetryCellInfo_AllTrackOut(jig, JIG_CH_1); // theProcBank.RetryCellInfo_AllTrackOut(jig, JIG_CH_2); } void CUnitCtrlBank::SendPGMessage(CString strCommand, JIG_ID jig, CString strExtraData, BOOL bIgnoreInspSkip /*= FALSE*/) { if(theProcBank.m_bDryRunMode) return; for (int i = 0; i < JIG_CH_MAX; i++) { if( (strCommand == RESET) || (strCommand == SET_ZONE_A) ) { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(strCommand, jig,(JIG_CH)i, strExtraData); } else if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(bIgnoreInspSkip) { if(pCell->defaultData.m_bPGAlarm == FALSE) { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(strCommand, jig,(JIG_CH)i, strExtraData); } } else { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(strCommand, jig,(JIG_CH)i, strExtraData); } } } } } void CUnitCtrlBank::SendPGMessage(CString strCommand, JIG_ID jig, JIG_CH nCh, CString strExtraData, BOOL bIgnoreInspSkip /*= FALSE*/) { if(theProcBank.m_bDryRunMode) return; if( (strCommand == RESET) || (strCommand == SET_ZONE_B) ) { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(strCommand, jig,nCh, strExtraData); } else if(theCellBank.GetCellTag(jig, nCh).IsExist()) { if(bIgnoreInspSkip) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, nCh); if(pCell->defaultData.m_bPGAlarm == FALSE) theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(strCommand, jig,nCh, strExtraData); } else { if(theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, nCh))->defaultData.m_bIsInspectionSkip == FALSE) theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(strCommand, jig,nCh, strExtraData); } } } BOOL CUnitCtrlBank::GetMCRReadFinish( JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->defaultData.m_bMCR_OK == FALSE) return FALSE; } } return TRUE; } else { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)channel); if(pCell) { if(pCell->defaultData.m_bMCR_OK == FALSE) return FALSE; } return TRUE; } } void CUnitCtrlBank::SetZoneEnd( JIG_ID jig, ZONE_ID zone ) { theProcBank.m_bIsZoneEnd[jig][zone] = TRUE; // Zone이 끝나면 SetZone을 Reset 시킨다 [9/8/2017 OSC] theProcBank.m_bIsSetZone[jig][zone] = FALSE; } BOOL CUnitCtrlBank::GetZoneEnd( JIG_ID jig, ZONE_ID zone ) { return theProcBank.m_bIsZoneEnd[jig][zone]; } void CUnitCtrlBank::ResetZoneEnd( JIG_ID jig, ZONE_ID zone ) { theProcBank.m_bIsZoneEnd[jig][zone] = FALSE; } void CUnitCtrlBank::AZoneCellData_Create( JIG_ID jig, JIG_CH ch ) { CCellInfo* pCell; CTime time = CTime::GetCurrentTime(); CString strInnerID; CELL_POS pos = (CELL_POS)(CELL_POS_SHUTTLE1_CH1 + (jig*JIG_CH_MAX) + ch); pCell = theCellBank.GetCellInfo(jig, ch); if(pCell) { // 리트라이 가능한 셀은 리스트에 추가해놓는다. [9/29/2017 OSC] theProcBank.RetryCellInfo_Add(jig, pCell); } theCellBank.CreateCellInfo(pos); pCell = theCellBank.GetCellInfo(jig, ch); if(pCell) { int nFullCh = ((jig*JIG_CH_MAX) + ch)+1; pCell->defaultData.m_strInnerID.Format(_T("%d%02d%02d%02d"), nFullCh, time.GetHour(), time.GetMinute(), time.GetSecond()); // // 리트라이 CIM 검수용 [9/30/2017 OSC] // if(strInnerID.IsEmpty() == FALSE) // pCell->defaultCellInfomation.m_strInnerID = strInnerID; // strInnerID.Empty(); pCell->defaultData.m_JigId = (JIG_ID)(JIG_ID_A + jig); pCell->defaultData.m_JigCh = ch; // 검사 안하도록 미리 NG 처리 [9/16/2017 OSC] if(theProcBank.m_bDryRunMode || theProcBank.AZoneCellNG_Check(jig, ch)) { pCell->defaultData.m_bIsInspectionSkip = TRUE; } theUnitStatusBank.SetCellInfo(jig, ch, pCell); } } void CUnitCtrlBank::InlineCellData_Create(JIG_ID jig, JIG_CH ch, CString strCellID) { CELL_POS pos = (CELL_POS)(CELL_POS_SHUTTLE1_CH1 + (jig*JIG_CH_MAX) + ch); CTime time = CTime::GetCurrentTime(); theCellBank.CreateCellInfo(pos); CCellInfo *pCell = theCellBank.GetCellInfo(jig, ch); if(pCell) { int nFullCh = ((jig*JIG_CH_MAX) + ch)+1; pCell->defaultData.m_strInnerID.Format(_T("%d%02d%02d%02d"), nFullCh, time.GetHour(), time.GetMinute(), time.GetSecond()); pCell->defaultData.m_JigId = (JIG_ID)(JIG_ID_A + jig); pCell->defaultData.m_JigCh = ch; // PDT에서 아직 대응 안되서 주석 [12/19/2017 OSC] // pCell->defaultData.m_strCellID = strCellID; // if(strCellID.GetLength() > 15) // { // pCell->defaultData.m_bMCR_OK = TRUE; // pCell->defaultData.m_strReadUnitMCR = _T("ROBOT"); // } // 검사 안하도록 미리 NG 처리 [9/16/2017 OSC] if(theProcBank.m_bDryRunMode || theProcBank.AZoneCellNG_Check(jig, ch)) { pCell->defaultData.m_bIsInspectionSkip = TRUE; } theUnitStatusBank.SetCellInfo(jig, ch, pCell); } } void CUnitCtrlBank::InlineCellData_Remove( JIG_ID jig, JIG_CH ch ) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, ch); if(pCell) { //theProcBank.RetryCellInfo_Remove(jig, ch); // Retry 가능한 셀은 저장해놓는다 theProcBank.RetryCellInfo_Add(jig, pCell); theCellBank.RemoveCellTag(jig, ch); } } void CUnitCtrlBank::AZoneCellSkip_Reset( JIG_ID jig ) { // Cell NG 설정된 것은 한바퀴 갔다 오면 자동 해제해줘야 한다. Not Use는 계속 유지 [9/16/2017 OSC] if(theProcBank.AZoneChannelNotUse_Check(jig, JIG_CH_1) == FALSE) theProcBank.AZoneCellNG_OnOff(jig, JIG_CH_1, FALSE); } void CUnitCtrlBank::PatternReset_Send(JIG_ID jig, JIG_CH ch) { if(ch == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(RESET, jig,(JIG_CH)i); } } else { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(RESET, jig, ch); } } void CUnitCtrlBank::AZone_SetTimeStart( JIG_ID jig ) { // 물류 : 인터페이스 끝 시점 // 단동 : PG On 버튼 누른 시점 for (int i = 0; i < JIG_CH_MAX; i++) { theProcBank.m_AZone[jig][i].SetTimeStart(); // CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); // if(pCell) // pCell->m_AZone.SetTimeStart(); } } void CUnitCtrlBank::AZone_SetTimeEnd( JIG_ID jig ) { // A존 AFT 검사 완료 시점 for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_AZone.m_timeStart = theProcBank.m_AZone[jig][i].m_timeStart; pCell->m_AZone.m_RecvSetZone = theProcBank.m_AZone[jig][i].m_RecvSetZone; theProcBank.m_AZone[jig][i].Init(); pCell->m_AZone.SetTimeEnd(); } } } void CUnitCtrlBank::AZone_SetTimeWait( JIG_ID jig ) { // A존 검사 끝 ~ 셔틀 이동 전 for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) pCell->m_AZone.SetTimeWait(); } } //kjpark 20170912 MCR 위치에따른 택타임 추가 void CUnitCtrlBank::AZonetoMCR_SetTimeStart( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) pCell->m_AZonetoMCRZone.SetTimeStart(); } } //kjpark 20170912 MCR 위치에따른 택타임 추가 void CUnitCtrlBank::AZonetoMCR_SetTimeEnd( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) pCell->m_AZonetoMCRZone.SetTimeEnd(); } } //kjpark 20170912 MCR 위치에따른 택타임 추가 void CUnitCtrlBank::MCRtoBZoneSetTimeStart( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) pCell->m_MCRZonetoBZone.SetTimeStart(); } } //kjpark 20170912 MCR 위치에따른 택타임 추가 void CUnitCtrlBank::MCRtoBZoneSetTimeEnd( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) pCell->m_MCRZonetoBZone.SetTimeEnd(); } } void CUnitCtrlBank::BZone_SetTimeStart( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) pCell->m_BZone.SetTimeStart(); } } void CUnitCtrlBank::BZone_SetTimeEnd( JIG_ID jig ) { // C존 검사 끝나는 시간 for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) pCell->m_BZone.SetTimeEnd(); } } void CUnitCtrlBank::BZone_SetTimeWait( JIG_ID jig ) { // 셔틀 A존으로 이동 시작 시간 for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) pCell->m_BZone.SetTimeWait(); } } //kjpark 20170912 MCR 위치에따른 택타임 추가 void CUnitCtrlBank::BZonetoAZone_SetTimeStart( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) pCell->m_BZonetoAZone.SetTimeStart(); } } //kjpark 20170912 MCR 위치에따른 택타임 추가 void CUnitCtrlBank::BZonetoAZone_SetTimeEnd( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) pCell->m_BZonetoAZone.SetTimeEnd(); } } void CUnitCtrlBank::SetZoneA_Send( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { // CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); // if(pCell) // { // if( (pCell->defaultCellInfomation.m_bIsInspectionSkip == FALSE) && (pCell->m_AZone.m_RecvSetZone == FALSE) ) // { // theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(SET_ZONE_A, jig, (JIG_CH)i); // } // pCell->m_AZone.SetTimeStart(); // } if( (theProcBank.AZoneChannelNotUse_Check(jig, (JIG_CH)i) == FALSE) && (theProcBank.m_AZone[jig][i].m_RecvSetZone == FALSE) ) { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(SET_ZONE_A, jig, (JIG_CH)i); } } } BOOL CUnitCtrlBank::SetZoneA_Check( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theProcBank.AZoneChannelNotUse_Check(jig, (JIG_CH)i) == FALSE) { if( theProcBank.m_AZone[jig][i].m_RecvSetZone == FALSE ) return FALSE; } // CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); // if(pCell) // { // if(pCell->defaultCellInfomation.m_bIsInspectionSkip == FALSE) // { // if(pCell->m_AZone.m_RecvSetZone == FALSE) // return FALSE; // } // } } return TRUE; } void CUnitCtrlBank::SetZoneA_TimeOut( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { theProcBank.m_AZone[jig][i].m_RecvSetZone = TRUE; // CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); // if(pCell) // { // pCell->m_AZone.m_RecvSetZone = TRUE; // } } } BOOL CUnitCtrlBank::AZoneDefect_GoodCheck(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); return pCell->m_AZone.m_Class == GOOD_CELL ? TRUE:FALSE; } void CUnitCtrlBank::SetZoneC_Send( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if( (pCell->defaultData.m_bIsInspectionSkip == FALSE) && (pCell->m_BZone.m_RecvSetZone == FALSE) ) { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_BZone.m_strCommand, jig, (JIG_CH)i); } pCell->m_BZone.SetTimeStart(); } } } BOOL CUnitCtrlBank::SetZoneC_Check( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { if(pCell->m_BZone.m_RecvSetZone == FALSE) return FALSE; } } } return TRUE; } void CUnitCtrlBank::SetZoneC_TimeOut( JIG_ID jig ) { for (int i = 0; i < JIG_CH_MAX; i++) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { pCell->m_BZone.m_RecvSetZone = TRUE; } } } //kjpark 20161018 TMD_INFO 추가 void CUnitCtrlBank::TMD_INFO_Send(JIG_ID jig, JIG_CH channel /*= JIG_CH_MAX*/ ) { CCellInfo* pCell; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->defaultData.m_bReceive_TMD_Info == TMD_INFO_NOT_RECEIVE) { if(pCell->defaultData.m_strCellID == TEXT_FAIL) theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(TMD_INFO, jig,(JIG_CH)i, pCell->defaultData.m_strInnerID); else theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(TMD_INFO, jig,(JIG_CH)i, pCell->defaultData.m_strCellID); } } } } else { pCell = theCellBank.GetCellInfo(jig, channel); if(pCell) { if(pCell->defaultData.m_bReceive_TMD_Info == TMD_INFO_NOT_RECEIVE) { if(pCell->defaultData.m_strCellID == TEXT_FAIL) theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(TMD_INFO, jig, channel, pCell->defaultData.m_strInnerID); else theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(TMD_INFO, jig, channel, pCell->defaultData.m_strCellID); } } } } //kjpark 20180113 Tmd Version 추가 void CUnitCtrlBank::Host_Version_Send(JIG_ID jig, JIG_CH channel /*= JIG_CH_MAX*/ ) { if(theConfigBank.m_Option.m_bUseHostVersionSend == FALSE) return; CCellInfo* pCell; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(HOST_VER, jig,(JIG_CH)i); } } } else { pCell = theCellBank.GetCellInfo(jig, channel); if(pCell) { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(HOST_VER, jig, channel); } } } //kjpark 20180113 Tmd Version 추가 void CUnitCtrlBank::Client_Version_Send(JIG_ID jig, JIG_CH channel /*= JIG_CH_MAX*/ ) { if(theConfigBank.m_Option.m_bUseHostVersionSend == FALSE) return; CCellInfo* pCell; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(CLIENT_VER, jig,(JIG_CH)i); } } } else { pCell = theCellBank.GetCellInfo(jig, channel); if(pCell) { theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(CLIENT_VER, jig, channel); } } } //kjpark 20161018 TMD_INFO 추가 BOOL CUnitCtrlBank::TMD_INFO_Check(JIG_ID jig, JIG_CH channel) { CCellInfo* pCell; pCell = theCellBank.GetCellInfo(jig, channel); if(pCell == NULL) return FALSE; if(pCell->defaultData.m_bReceive_TMD_Info >= TMD_INFO_RECEIVE) return TRUE; return FALSE; } void CUnitCtrlBank::TMD_INFO_Timeout(JIG_ID jig) { CCellTag tag; CCellInfo* pCell; //kjaprk 20161114 zone 상태에 따라 JIG ID 반환하여 셀테그 얻어오기 for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell == NULL) return; if(pCell->defaultData.m_bReceive_TMD_Info == TMD_INFO_NOT_RECEIVE) { pCell->defaultData.m_bReceive_TMD_Info = TMD_INFO_DOWN; } } } //kjpark 20171010 TMD March 구현 void CUnitCtrlBank::CellMixingBin2Input(JIG_ID jig, JIG_CH channel ) { theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, channel))->defaultData.m_strCellMixing = TEXT_CELL_MIXING; theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, channel))->defaultData.CellMixing = REJECT_CELL; theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, channel))->defaultData.m_bIsInspectionSkip = TRUE; } void CUnitCtrlBank::CellLoading_SetStartTime( JIG_ID jig, JIG_CH channel ) { CCellInfo* pCell; pCell = theCellBank.GetCellInfo_CellLoading(jig, channel); if(pCell) { pCell->m_CellLoading.SetTimeStart(); } } void CUnitCtrlBank::CellLoading_SetEndTime(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 물류 : 인터페이스 끝 ~ CELL_LOADING 시작 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo_CellLoading(jig, (JIG_CH)i); if(pCell) { pCell->m_CellLoading.SetTimeEnd(); } } } void CUnitCtrlBank::CellLoading_Send( JIG_ID jig, JIG_CH channel, BOOL bUseInnerID) { CCellInfo* pCell; CCellTag tagCell; pCell = theCellBank.GetCellInfo_CellLoading(jig, channel); if( (pCell->defaultData.m_strCellID == TEXT_FAIL) || bUseInnerID ) theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_CellLoading.m_strCommand, jig, (JIG_CH)channel, pCell->defaultData.m_strInnerID); else theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_CellLoading.m_strCommand, jig, (JIG_CH)channel, pCell->defaultData.m_strCellID); pCell->m_CellLoading.m_CellLoadingSend = TRUE; } BOOL CUnitCtrlBank::CellLoading_SendCheck(JIG_ID jig, JIG_CH channel) { // CELL_LOADING을 날렸는지 확인. 셀이 없으면 TRUE CCellInfo* pCell; pCell = theCellBank.GetCellInfo_CellLoading(jig, channel); if(pCell) { return pCell->m_CellLoading.m_CellLoadingSend; } return TRUE; } void CUnitCtrlBank::CellLoading_InitInfo(JIG_ID jig, JIG_CH channel, BOOL bResultOnly) { CCellInfo* pCell; pCell = theCellBank.GetCellInfo_CellLoading(jig, channel); if(bResultOnly) { pCell->m_CellLoading.m_Class = NONE_CELL; pCell->m_CellLoading.m_DefectName.Empty(); } else { pCell->Init(); pCell->defaultData.m_JigId = jig; pCell->defaultData.m_JigCh = channel; int nFullCh = ((jig*JIG_CH_MAX) + channel)+1; CTime time = CTime::GetCurrentTime(); pCell->defaultData.m_strInnerID.Format(_T("CONTACT_%d%02d%02d%02d"), nFullCh, time.GetHour(), time.GetMinute(), time.GetSecond()); } pCell->defaultData.m_bIsInspectionSkip = FALSE; } BOOL CUnitCtrlBank::CellLoading_RecvCheck(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return TRUE; CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo_CellLoading(jig, (JIG_CH)i); if(pCell) { if(pCell->m_CellLoading.m_Class == NONE_CELL) return FALSE; } } return TRUE; } BOOL CUnitCtrlBank::CellLoading_GoodCheck( JIG_ID jig, JIG_CH channel ) { if(theProcBank.m_bDryRunMode) return TRUE; CCellInfo* pCell; pCell = theCellBank.GetCellInfo_CellLoading(jig, channel); return pCell->m_CellLoading.m_Class == GOOD_CELL ? TRUE:FALSE; } void CUnitCtrlBank::CellLoading_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo_CellLoading(jig, (JIG_CH)i); if(pCell) { if(pCell->m_CellLoading.m_Class == NONE_CELL) { pCell->m_CellLoading.m_Class = REJECT_CELL; //pCell->m_CellLoading.m_DefectName = pCell->m_CellLoading.m_strCommand + TEXT_DEFECT_TIME_OUT; //kjpark 20180122 CELL Loading TIMEOUT을 NG 로 변경 pCell->m_CellLoading.m_DefectName = pCell->m_CellLoading.m_strCommand + TEXT_DEFECT_NG; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::CellLoading_CopyInfo(JIG_ID jig, JIG_CH channel) { CCellInfo *pCell, *pCellCellLoading; pCell = theCellBank.GetCellInfo(jig, channel); pCellCellLoading = theCellBank.GetCellInfo_CellLoading(jig, channel); if(pCell) { pCell->m_CellLoading = pCellCellLoading->m_CellLoading; if(theProcBank.AZoneCellNG_Check(jig, channel) == FALSE) { pCell->defaultData.m_bIsInspectionSkip = pCellCellLoading->defaultData.m_bIsInspectionSkip; } } } void CUnitCtrlBank::MTPWrite_Send( JIG_ID jig, JIG_CH channel /* = JIG_CH_MAX*/ ) { if(theProcBank.m_bDryRunMode) return; CString strCellID; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_MTPWrite.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { if(pCell->defaultData.m_bMCR_OK) strCellID = pCell->defaultData.m_strCellID; else strCellID = pCell->defaultData.m_strInnerID; pCell->m_MTPWrite.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_MTPWrite.m_strCommand, jig, (JIG_CH)i, strCellID); } else { pCell->m_MTPWrite.m_Class = SKIP_CELL; pCell->m_MTPWrite.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_MTPWrite.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { if(pCell->defaultData.m_bMCR_OK) strCellID = pCell->defaultData.m_strCellID; else strCellID = pCell->defaultData.m_strInnerID; pCell->m_MTPWrite.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_MTPWrite.m_strCommand, jig, (JIG_CH)channel, strCellID); } else { pCell->m_MTPWrite.m_Class = SKIP_CELL; pCell->m_MTPWrite.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::MTPWrite_IsStarted(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 커맨드를 이미 날렸는지 체크 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_MTPWrite.IsStarted() == FALSE) return FALSE; } } return TRUE; } BOOL CUnitCtrlBank::MTPWrite_Check( JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/ ) { CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_MTPWrite.m_Class == NONE_CELL) return FALSE; } } return TRUE; } void CUnitCtrlBank::MTPWrite_TimeOut( JIG_ID jig ) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_MTPWrite.m_Class == NONE_CELL) { pCell->m_MTPWrite.m_Class = REJECT_CELL; pCell->m_MTPWrite.m_DefectName = pCell->m_MTPWrite.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::MTPVerify_Send( JIG_ID jig , JIG_CH channel /*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; CString strCellID; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_MTPVerify.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { if(pCell->defaultData.m_bMCR_OK) strCellID = pCell->defaultData.m_strCellID; else strCellID = pCell->defaultData.m_strInnerID; pCell->m_MTPVerify.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_MTPVerify.m_strCommand, jig, (JIG_CH)i, strCellID); } else { pCell->m_MTPVerify.m_Class = SKIP_CELL; pCell->m_MTPVerify.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_MTPVerify.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { if(pCell->defaultData.m_bMCR_OK) strCellID = pCell->defaultData.m_strCellID; else strCellID = pCell->defaultData.m_strInnerID; pCell->m_MTPVerify.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_MTPVerify.m_strCommand, jig, (JIG_CH)channel, strCellID); } else { pCell->m_MTPVerify.m_Class = SKIP_CELL; pCell->m_MTPVerify.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::MTPVerify_IsStarted(JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/) { // 커맨드를 이미 날렸는지 체크 CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_MTPVerify.IsStarted() == FALSE) return FALSE; } } return TRUE; } BOOL CUnitCtrlBank::MTPVerify_Check( JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/ ) { CCellInfo *pCell; int nStart, nEnd; if(ch == JIG_CH_MAX) { nStart = 0; nEnd = ch; } else { nStart = ch; nEnd = ch+1; } for (int i = nStart; i < nEnd; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_MTPVerify.m_Class == NONE_CELL) return FALSE; } } return TRUE; } void CUnitCtrlBank::MTPVerify_TimeOut( JIG_ID jig ) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_MTPVerify.m_Class == NONE_CELL) { pCell->m_MTPVerify.m_Class = REJECT_CELL; pCell->m_MTPVerify.m_DefectName = pCell->m_MTPVerify.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::WhiteCurrent_Send(JIG_ID jig, JIG_CH channel /*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_WhiteCurrent.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_WhiteCurrent.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_WhiteCurrent.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_WhiteCurrent.m_Class = SKIP_CELL; pCell->m_WhiteCurrent.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_WhiteCurrent.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_WhiteCurrent.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_WhiteCurrent.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_WhiteCurrent.m_Class = SKIP_CELL; pCell->m_WhiteCurrent.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::WhiteCurrent_Check( JIG_ID jig, JIG_CH channel ) { CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_WhiteCurrent.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::WhiteCurrent_TimeOut( JIG_ID jig ) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_WhiteCurrent.m_Class == NONE_CELL) { pCell->m_WhiteCurrent.m_Class = REJECT_CELL; pCell->m_WhiteCurrent.m_DefectName = pCell->m_WhiteCurrent.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::SleepCurrent_Send( JIG_ID jig ,JIG_CH channel /*= JIG_CH_MAX*/ ) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_SleepCurrent.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_SleepCurrent.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_SleepCurrent.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_SleepCurrent.m_Class = SKIP_CELL; pCell->m_SleepCurrent.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_SleepCurrent.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_SleepCurrent.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_SleepCurrent.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_SleepCurrent.m_Class = SKIP_CELL; pCell->m_SleepCurrent.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::SleepCurrent_Check( JIG_ID jig, JIG_CH channel ) { CCellInfo* pCell; pCell = theCellBank.GetCellInfo(jig, channel); if ( pCell == NULL ) return FALSE; if(pCell->m_SleepCurrent.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::SleepCurrent_TimeOut( JIG_ID jig ) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_SleepCurrent.m_Class == NONE_CELL) { pCell->m_SleepCurrent.m_Class = REJECT_CELL; pCell->m_SleepCurrent.m_DefectName = pCell->m_SleepCurrent.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::HlpmCurrent_Send( JIG_ID jig , JIG_CH channel /*= JIG_CH_MAX*/ ) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_HLPMCurrent.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_HLPMCurrent.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_HLPMCurrent.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_HLPMCurrent.m_Class = SKIP_CELL; pCell->m_HLPMCurrent.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_HLPMCurrent.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_HLPMCurrent.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_HLPMCurrent.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_HLPMCurrent.m_Class = SKIP_CELL; pCell->m_HLPMCurrent.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::HlpmCurrent_Check( JIG_ID jig, JIG_CH channel ) { CCellInfo* pCell; pCell = theCellBank.GetCellInfo(jig, channel); if ( pCell == NULL ) return FALSE; if(pCell->m_HLPMCurrent.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::HlpmCurrent_TimeOut( JIG_ID jig ) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_HLPMCurrent.m_Class == NONE_CELL) { pCell->m_HLPMCurrent.m_Class = REJECT_CELL; pCell->m_HLPMCurrent.m_DefectName = pCell->m_HLPMCurrent.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::TSP_START_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/ ) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_TSPStart.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_TSPStart.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_TSPStart.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_TSPStart.m_Class = SKIP_CELL; pCell->m_TSPStart.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_TSPStart.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_TSPStart.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_TSPStart.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_TSPStart.m_Class = SKIP_CELL; pCell->m_TSPStart.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::TSP_START_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_TSPStart.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::TSP_START_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_TSPStart.m_Class == NONE_CELL) { pCell->m_TSPStart.m_Class = REJECT_CELL; pCell->m_TSPStart.m_DefectName = pCell->m_TSPStart.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::EVTVersion_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_EVTVersionCheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_EVTVersionCheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_EVTVersionCheck.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_EVTVersionCheck.m_Class = SKIP_CELL; pCell->m_EVTVersionCheck.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_EVTVersionCheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_EVTVersionCheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_EVTVersionCheck.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_EVTVersionCheck.m_Class = SKIP_CELL; pCell->m_EVTVersionCheck.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::EVTVersion_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_EVTVersionCheck.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::EVTVersion_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_EVTVersionCheck.m_Class == NONE_CELL) { pCell->m_EVTVersionCheck.m_Class = REJECT_CELL; pCell->m_EVTVersionCheck.m_DefectName = pCell->m_EVTVersionCheck.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::TECheck_Send( JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/ ) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_TECheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_TECheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_TECheck.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_TECheck.m_Class = SKIP_CELL; pCell->m_TECheck.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_TECheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_TECheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_TECheck.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_TECheck.m_Class = SKIP_CELL; pCell->m_TECheck.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::TECheck_Check( JIG_ID jig, JIG_CH channel ) { CCellInfo* pCell; pCell = theCellBank.GetCellInfo(jig, channel); if ( pCell == NULL ) return FALSE; if(pCell->m_TECheck.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::TECheck_TimeOut( JIG_ID jig ) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_TECheck.m_Class == NONE_CELL) { pCell->m_TECheck.m_Class = REJECT_CELL; pCell->m_TECheck.m_DefectName = pCell->m_TECheck.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::IDCheck_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_IDCheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_IDCheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_IDCheck.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_IDCheck.m_Class = SKIP_CELL; pCell->m_IDCheck.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_IDCheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_IDCheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_IDCheck.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_IDCheck.m_Class = SKIP_CELL; pCell->m_IDCheck.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::IDCheck_Check(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_IDCheck.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::IDCheck_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_IDCheck.m_Class == NONE_CELL) { pCell->m_IDCheck.m_Class = REJECT_CELL; pCell->m_IDCheck.m_DefectName = pCell->m_IDCheck.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::OTPREG_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_OTPREGCheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OTPREGCheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OTPREGCheck.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_OTPREGCheck.m_Class = SKIP_CELL; pCell->m_OTPREGCheck.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_OTPREGCheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OTPREGCheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OTPREGCheck.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_OTPREGCheck.m_Class = SKIP_CELL; pCell->m_OTPREGCheck.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::OTPREG_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_OTPREGCheck.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::OTPREG_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_OTPREGCheck.m_Class == NONE_CELL) { pCell->m_OTPREGCheck.m_Class = REJECT_CELL; pCell->m_OTPREGCheck.m_DefectName = pCell->m_OTPREGCheck.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::ICTTest_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_ICTCheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_ICTCheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_ICTCheck.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_ICTCheck.m_Class = SKIP_CELL; pCell->m_ICTCheck.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_ICTCheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_ICTCheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_ICTCheck.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_ICTCheck.m_Class = SKIP_CELL; pCell->m_ICTCheck.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::ICTTest_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_ICTCheck.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::ICTTest_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_ICTCheck.m_Class == NONE_CELL) { pCell->m_ICTCheck.m_Class = REJECT_CELL; pCell->m_ICTCheck.m_DefectName = pCell->m_ICTCheck.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::COPR_ICTTest_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_COPRICTTest.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_COPRICTTest.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_COPRICTTest.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_COPRICTTest.m_Class = SKIP_CELL; pCell->m_COPRICTTest.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_COPRICTTest.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_COPRICTTest.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_COPRICTTest.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_COPRICTTest.m_Class = SKIP_CELL; pCell->m_COPRICTTest.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::COPR_ICTTest_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_COPRICTTest.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::COPR_ICTTest_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_COPRICTTest.m_Class == NONE_CELL) { pCell->m_COPRICTTest.m_Class = REJECT_CELL; pCell->m_COPRICTTest.m_DefectName = pCell->m_COPRICTTest.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::POCErrorCheck_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_PocErrorCheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_PocErrorCheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_PocErrorCheck.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_PocErrorCheck.m_Class = SKIP_CELL; pCell->m_PocErrorCheck.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_PocErrorCheck.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_PocErrorCheck.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_PocErrorCheck.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_PocErrorCheck.m_Class = SKIP_CELL; pCell->m_PocErrorCheck.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::POCErrorCheck_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_PocErrorCheck.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::POCErrorCheck_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_PocErrorCheck.m_Class == NONE_CELL) { pCell->m_PocErrorCheck.m_Class = REJECT_CELL; pCell->m_PocErrorCheck.m_DefectName = pCell->m_PocErrorCheck.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::DDIBlockTest_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_DDIBlockTest.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_DDIBlockTest.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_DDIBlockTest.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_DDIBlockTest.m_Class = SKIP_CELL; pCell->m_DDIBlockTest.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_DDIBlockTest.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_DDIBlockTest.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_DDIBlockTest.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_DDIBlockTest.m_Class = SKIP_CELL; pCell->m_DDIBlockTest.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::DDIBlockTest_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_DDIBlockTest.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::DDIBlockTest_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_DDIBlockTest.m_Class == NONE_CELL) { pCell->m_DDIBlockTest.m_Class = REJECT_CELL; pCell->m_DDIBlockTest.m_DefectName = pCell->m_DDIBlockTest.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::OptionCheck2_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_OptionCheck2.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck2.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck2.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_OptionCheck2.m_Class = SKIP_CELL; pCell->m_OptionCheck2.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_OptionCheck2.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck2.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck2.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_OptionCheck2.m_Class = SKIP_CELL; pCell->m_OptionCheck2.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::OptionCheck2_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_OptionCheck2.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::OptionCheck2_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_OptionCheck2.m_Class == NONE_CELL) { pCell->m_OptionCheck2.m_Class = REJECT_CELL; pCell->m_OptionCheck2.m_DefectName = pCell->m_OptionCheck2.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::OptionCheck3_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_OptionCheck3.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck3.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck3.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_OptionCheck3.m_Class = SKIP_CELL; pCell->m_OptionCheck3.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_OptionCheck3.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck3.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck3.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_OptionCheck3.m_Class = SKIP_CELL; pCell->m_OptionCheck3.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::OptionCheck3_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_OptionCheck3.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::OptionCheck3_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_OptionCheck3.m_Class == NONE_CELL) { pCell->m_OptionCheck3.m_Class = REJECT_CELL; pCell->m_OptionCheck3.m_DefectName = pCell->m_OptionCheck3.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::OptionCheck4_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_OptionCheck4.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck4.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck4.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_OptionCheck4.m_Class = SKIP_CELL; pCell->m_OptionCheck4.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_OptionCheck4.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck4.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck4.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_OptionCheck4.m_Class = SKIP_CELL; pCell->m_OptionCheck4.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::OptionCheck4_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_OptionCheck4.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::OptionCheck4_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_OptionCheck4.m_Class == NONE_CELL) { pCell->m_OptionCheck4.m_Class = REJECT_CELL; pCell->m_OptionCheck4.m_DefectName = pCell->m_OptionCheck4.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::OptionCheck5_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_OptionCheck5.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck5.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck5.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_OptionCheck5.m_Class = SKIP_CELL; pCell->m_OptionCheck5.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_OptionCheck5.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck5.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck5.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_OptionCheck5.m_Class = SKIP_CELL; pCell->m_OptionCheck5.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::OptionCheck5_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_OptionCheck5.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::OptionCheck5_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_OptionCheck5.m_Class == NONE_CELL) { pCell->m_OptionCheck5.m_Class = REJECT_CELL; pCell->m_OptionCheck5.m_DefectName = pCell->m_OptionCheck5.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::OptionCheck6_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_OptionCheck6.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck6.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck6.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_OptionCheck6.m_Class = SKIP_CELL; pCell->m_OptionCheck6.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_OptionCheck6.m_Class == NONE_CELL) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck6.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck6.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_OptionCheck6.m_Class = SKIP_CELL; pCell->m_OptionCheck6.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::OptionCheck6_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_OptionCheck6.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::OptionCheck6_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_OptionCheck6.m_Class == NONE_CELL) { pCell->m_OptionCheck6.m_Class = REJECT_CELL; pCell->m_OptionCheck6.m_DefectName = pCell->m_OptionCheck6.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::OptionCheck7_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_OptionCheck7.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck7.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck7.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_OptionCheck7.m_Class = SKIP_CELL; pCell->m_OptionCheck7.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_OptionCheck7.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck7.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck7.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_OptionCheck7.m_Class = SKIP_CELL; pCell->m_OptionCheck7.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::OptionCheck7_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_OptionCheck7.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::OptionCheck7_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_OptionCheck7.m_Class == NONE_CELL) { pCell->m_OptionCheck7.m_Class = REJECT_CELL; pCell->m_OptionCheck7.m_DefectName = pCell->m_OptionCheck7.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::OptionCheck8_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_OptionCheck8.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck8.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck8.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_OptionCheck8.m_Class = SKIP_CELL; pCell->m_OptionCheck8.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_OptionCheck8.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck8.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck8.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_OptionCheck8.m_Class = SKIP_CELL; pCell->m_OptionCheck8.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::OptionCheck8_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_OptionCheck8.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::OptionCheck8_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_OptionCheck8.m_Class == NONE_CELL) { pCell->m_OptionCheck8.m_Class = REJECT_CELL; pCell->m_OptionCheck8.m_DefectName = pCell->m_OptionCheck8.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::OptionCheck9_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_OptionCheck9.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck9.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck9.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_OptionCheck9.m_Class = SKIP_CELL; pCell->m_OptionCheck9.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_OptionCheck9.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck9.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck9.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_OptionCheck9.m_Class = SKIP_CELL; pCell->m_OptionCheck9.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::OptionCheck9_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_OptionCheck9.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::OptionCheck9_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_OptionCheck9.m_Class == NONE_CELL) { pCell->m_OptionCheck9.m_Class = REJECT_CELL; pCell->m_OptionCheck9.m_DefectName = pCell->m_OptionCheck9.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } void CUnitCtrlBank::OptionCheck10_Send(JIG_ID jig, JIG_CH channel/*= JIG_CH_MAX*/) { if(theProcBank.m_bDryRunMode) return; if(channel == JIG_CH_MAX) { for (int i = 0; i < JIG_CH_MAX; i++) { if(theCellBank.GetCellTag(jig, (JIG_CH)i).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)i)); if(pCell->m_OptionCheck10.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck10.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck10.m_strCommand, jig, (JIG_CH)i); } else { pCell->m_OptionCheck10.m_Class = SKIP_CELL; pCell->m_OptionCheck10.m_DefectName = SKIP; } } } } } else { if(theCellBank.GetCellTag(jig, (JIG_CH)channel).IsExist()) { CCellInfo *pCell = theCellBank.GetCellInfo(theCellBank.GetCellTag(jig, (JIG_CH)channel)); if(pCell->m_OptionCheck10.IsStarted() == FALSE) { if(pCell->defaultData.m_bIsInspectionSkip == FALSE) { pCell->m_OptionCheck10.SetTimeStart(); theSocketInterFace.m_PGHost.SendMassageToPatternGenerator(pCell->m_OptionCheck10.m_strCommand, jig, (JIG_CH)channel); } else { pCell->m_OptionCheck10.m_Class = SKIP_CELL; pCell->m_OptionCheck10.m_DefectName = SKIP; } } } } } BOOL CUnitCtrlBank::OptionCheck10_Check(JIG_ID jig, JIG_CH channel) { if(theProcBank.m_bDryRunMode) return TRUE; CCellTag tag; CCellInfo* pCell; tag = theCellBank.GetCellTag(jig, channel); if ( tag.IsExist() == FALSE ) return FALSE; pCell = theCellBank.GetCellInfo(tag); if(pCell->m_OptionCheck10.m_Class == NONE_CELL) return FALSE; return TRUE; } void CUnitCtrlBank::OptionCheck10_TimeOut(JIG_ID jig) { // 아직까지 판정이 없는 것들은 전부 NG판정해 버린다 [12/12/2016 OSC] CCellInfo* pCell; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->m_OptionCheck10.m_Class == NONE_CELL) { pCell->m_OptionCheck10.m_Class = REJECT_CELL; pCell->m_OptionCheck10.m_DefectName = pCell->m_OptionCheck10.m_strCommand + TEXT_DEFECT_TIME_OUT; pCell->defaultData.m_bIsInspectionSkip = TRUE; } } } } BOOL CUnitCtrlBank::CalcurateDefectSquare(JIG_ID jig) { BOOL bRet = FALSE; // theProcBank.ClearSquareData(jig); // DEFECT_PATTERN pattern; // SQUARE_POINT point; // CCellInfo *pCell; // ZONE_ID otherZone; // if(zone == ZONE_ID_B) // otherZone = ZONE_ID_D; // else // otherZone = ZONE_ID_B; // for(int ch = 0; ch < JIG_CH_MAX; ch++) // { // pCell = theCellBank.GetCellInfo(jig, (JIG_CH)ch); // if(pCell) // { // if(pCell->m_nDefectPointCount) // { // if(pCell->defaultCellInfomation.m_bIsInspectionSkip) // { // theLog[LOG_SPECIAL_PROCESS].AddBuf(_T("[%cZONE][JIG%c][Ch%d] CellID : %s is Square Skip"), // jig+_T('A'), pCell->defaultCellInfomation.m_JigId+_T('A'), ch+1, pCell->defaultCellInfomation.m_strCellID); // } // else // { // theLog[LOG_SPECIAL_PROCESS].AddBuf(_T("[%cZONE][JIG%c][Ch%d] CellID : %s Defect Square Count %d"), // jig+_T('A'), pCell->defaultCellInfomation.m_JigId+_T('A'), ch+1, pCell->defaultCellInfomation.m_strCellID, pCell->m_nDefectPointCount); // // // 상위에서 받은 불량좌표의 불량명 가지고... // for(int j = 0; j < pCell->m_nDefectPointCount; j++) // { // // 패턴파일에서 해당하는 패턴을 불러와서.... // // 각 패턴별로 그려야 할 좌표를 취합한다 // point.nX = pCell->m_DefectPoint[j].nX; // point.nY = pCell->m_DefectPoint[j].nY; // // if(theConfigBank.m_DefectPattern.FindPattern(pCell->m_DefectPoint[j], pattern, ZONE)) // { // point.colorLine = pattern.colorLine; // point.nThickness = pattern.nThickness; // point.nSize = pattern.nSize; // // theProcBank.AddDZoneSquareData((JIG_CH)ch, pattern.nPatternNo, point, jig); // theLog[LOG_SPECIAL_PROCESS].AddBuf(_T("[%cZONE][JIG%c][Ch%d] %dth Defect[%s] Square color : 0x%02X%02X%02X, Thickness : %d Size : %d Pattern : %d X : %d, Y : %d"), // jig+_T('A'), pCell->defaultCellInfomation.m_JigId+_T('A'), ch+1, j, // pCell->m_DefectPoint[j].strDefectName, // GetRValue(point.colorLine), GetGValue(point.colorLine), GetBValue(point.colorLine), // point.nThickness, point.nSize, pattern.nPatternNo, // point.nX, point.nY); // bRet = TRUE; // } // else // { // if( theConfigBank.m_DefectPattern.FindPattern(pCell->m_DefectPoint[j], pattern, otherZone) ) // { // // 다른존에 있는 거면 SKIP // } // else // { // // 패턴파일에 없으면 201패턴을 띄운다 // pattern = theConfigBank.m_DefectPattern.m_UndefinePattern; // point.colorLine = pattern.colorLine; // point.nThickness = pattern.nThickness; // point.nSize = pattern.nSize; // // theProcBank.AddDZoneSquareData((JIG_CH)ch, pattern.nPatternNo, point, zone); // theLog[LOG_SPECIAL_PROCESS].AddBuf(_T("[%cZONE][JIG%c][Ch%d] %dth Defect Not Found [%s|%s]"), // jig+_T('A'), pCell->defaultCellInfomation.m_JigId+_T('A'), ch+1, j, // pCell->m_DefectPoint[j].strDefectName, // pCell->m_DefectPoint[j].strPatternName); // bRet = TRUE; // } // } // } // } // } // } // } // 불량좌표 검사할게 있으면 TRUE return bRet; } BOOL CUnitCtrlBank::SendDefectSquare(int nIndex, JIG_ID jig) { CCellInfo *pCell; SQUARE_POINT point; POSITION pos; int nPatternNo; BOOL bContinue = FALSE; for(int i = 0; i < JIG_CH_MAX; i++) { pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->defaultData.m_bIsInspectionSkip) { // 불량은 아무것도 안한다 } else if(theProcBank.m_nSquarePatternCnt[jig][i] >= nIndex+1) { // 좌표가 있는 경우 먼저 배경 패턴을 띄우고... nPatternNo = theProcBank.m_SquarePatternInfo[jig][i][nIndex].nPatternNo; theSocketInterFace.m_PGHost.ShowDZonePattern(nPatternNo, pCell->defaultData.m_JigId, pCell->defaultData.m_JigCh); // 그려야 할 좌표를 추가한다 pos = theProcBank.m_SquarePatternInfo[jig][i][nIndex].listSquarePoint.GetHeadPosition(); while(pos) { point = theProcBank.m_SquarePatternInfo[jig][i][nIndex].listSquarePoint.GetNext(pos); theSocketInterFace.m_PGHost.AddPGSquare(point); } // 추가했던 좌표 Draw theSocketInterFace.m_PGHost.DrawPGSquare(pCell->defaultData.m_JigId, pCell->defaultData.m_JigCh); // 추가했던거 Clear theSocketInterFace.m_PGHost.ClearPGSqueare(); theLog[LOG_SPECIAL_PROCESS].AddBuf(_T("[%cZONE][JIG%c][Ch%d] CellID : %s Defect Square Draw"), jig+_T('A'), pCell->defaultData.m_JigId+_T('A'), i+1, pCell->defaultData.m_strCellID); // 다음 패턴도 있는지 확인. 5개 채널중 하나라도 다음 패턴이 있으면 TRUE if(theProcBank.m_nSquarePatternCnt[jig][i] >= nIndex+2) { bContinue = TRUE; } } else { // 좌표가 없으면 'NO CONFIRM' 메세지를 띄운다 theSocketInterFace.m_PGHost.AddPGMsg(_T("NO CONFIRM")); theSocketInterFace.m_PGHost.DrawPGMsg(pCell->defaultData.m_JigId, pCell->defaultData.m_JigCh, RGB(0,0,0), RGB(255,255,255), 20, 20, 80); theSocketInterFace.m_PGHost.ClearPGMsg(); } } } return bContinue; } CString CUnitCtrlBank::GetCellID(JIG_CH nCh, JIG_ID jig) { CCellTag tag; CCellInfo* pCell; BOOL bRet = FALSE; tag = theCellBank.GetCellTag(jig, nCh); if ( tag.IsExist() == FALSE ) return TEXT_FAIL; pCell = theCellBank.GetCellInfo(tag); return pCell->defaultData.m_strCellID; } BOOL CUnitCtrlBank::CheckTMDnProductIDMatch(JIG_ID jig, JIG_CH ch) { CString strBuf; BOOL bResult = FALSE; // TMD 파일명과 ProductID 앞 10글자(AMB632NF01)와 비교한다 CCellInfo *pCell; pCell = theCellBank.GetCellInfo(jig, ch); if(pCell == NULL) return TRUE; //pCell->defaultData.m_strProductID.Format(_T("AMB622NP13-012")); //20171001 BKH, 혼류 발생시에는 bin2처리 하도록 해야 하므로 변경한다. //kjpark 20180120 Cell Mixing 처리(강원호 선임) if(theConfigBank.m_Option.m_bUseTMDNameMatch == FALSE /*|| theConfigBank.m_Option.m_bUseCellMixingA3A4 == FALSE*/) return TRUE; // pCell->defaultData.m_strProductID = _T("AMB622NP06-006"); // pCell->defaultData.m_strTMD_Info = _T("A3-AMB622NP06-V3-AMTP-00-EIN-180110.TMD"); // MCR Fail 등으로 인해 상위로부터 정보 못받은거면 일단 스킵 if(pCell->defaultData.m_strProductID.GetLength() < 10) return TRUE; // TMD 정보를 못받은 셀도 스킵 if(pCell->defaultData.m_bReceive_TMD_Info != TMD_INFO_RECEIVE) return TRUE; //kjpark 2018018 TMD MACHING 특정 ProductID일때 전문자열 비교 CString strKeyword; strKeyword=pCell->defaultData.m_strTMD_Info.Left(5); //20180313 Cell Mixing 처리(강원호 선임) 요청사항 //kjpark 2018018 TMD MACHING 특정 ProductID일때 전문자열 비교<--- 박경진 과장님이 코딩한 부분을 대폭 수정 //20180312 BKH, CellID 앞 두글자와 TMD간 Fab Site가 동일하면? if(strKeyword.Find(pCell->defaultData.m_strCellID.Left(2))>= 0) { //int test; //20180312 BKH, 동일하다면 TMD의 Fab Site가 2개인가? 2개일 경우는 Ax-Ax 이런식으로 -A1,-A2 이런식의 숫자값이 들어가 있으므로... (A1~A9까지의 상황이 올수 있다.) if(strKeyword.Find(_T("-A1"))>= 0 || strKeyword.Find(_T("-A2"))>= 0 || strKeyword.Find(_T("-A3"))>= 0 || strKeyword.Find(_T("-A4"))>= 0 || strKeyword.Find(_T("-A5"))>= 0 || strKeyword.Find(_T("-A6"))>= 0 || strKeyword.Find(_T("-A7"))>= 0 || strKeyword.Find(_T("-A8"))>= 0 || strKeyword.Find(_T("-A9"))>= 0) {//2개일 경우에는 ProductID의 14자리와 TMD 모델명의 영업코드가 동일한가? strKeyword = pCell->defaultData.m_strProductID.Left(14); if(pCell->defaultData.m_strTMD_Info.Find(strKeyword)>=0)//14자리의 ProductID 값이 TMD내에도 동일하게 있다면? { return TRUE; } else {//동일하지 않을시에는 return false; return FALSE; } } else//TMD의 fab site가 2개가 아니면 { //tmd에 영업코드가 있는가? //영업코드 -003:v1, -005:v3, -006 v3, -008 v3, -010 v3, -012 v3, -013 v1 //영업코드가 TMD에 있는지를 검색, 만약 동별로도 구분을 해줘야 할 경우 위에 보이는 해당 동들 외에 나머지 동은 아래 if문 조건문에서 삭제하면 됨 //if(pCell->defaultData.m_strTMD_Info.Find(_T("-003"))>=0 || pCell->defaultData.m_strTMD_Info.Find(_T("-005"))>=0 || pCell->defaultData.m_strTMD_Info.Find(_T("-006"))>=0 // || pCell->defaultData.m_strTMD_Info.Find(_T("-008"))>=0 || pCell->defaultData.m_strTMD_Info.Find(_T("-010"))>=0 || pCell->defaultData.m_strTMD_Info.Find(_T("-012"))>=0 || pCell->defaultData.m_strTMD_Info.Find(_T("-013"))>=0) for(int i = 0; i< 100; i++) { strBuf.Format(_T("-%03d-"),i); if(pCell->defaultData.m_strTMD_Info.Find(strBuf)>=0) { bResult = TRUE; break; } } if(bResult) //(pCell->defaultData.m_strTMD_Info.Find(_T("-0"))>=0)//20180314 BKH, 영업코드가 -001~-099까지 올수가 있으므로.. { strKeyword = pCell->defaultData.m_strProductID.Left(14); if(pCell->defaultData.m_strTMD_Info.Find(strKeyword)>=0)//14자리의 ProductID 값이 TMD내에도 동일하게 있다면? {//ture return; strKeyword = strKeyword.Right(3);//Product ID의 마지막 3자리가 영업코드를 말하므로 if(pCell->defaultData.m_strTMD_Info.Find(strKeyword)>=0)//Product의 영업코드를 TMD내에서 찾아본다. { return TRUE; } else { return FALSE; } } else {//동일하지 않을시에는 return false; return FALSE; } } else { //영업코드가 TMD상에 존재하지 않는다면 ProductID의 10자리와 TMD의 모델명이 동일한가? strKeyword = pCell->defaultData.m_strProductID.Left(10); if( pCell->defaultData.m_strTMD_Info.Find(strKeyword)>=0) { //동일하면 return true return TRUE; } else { return FALSE; } } } } else//20180312 BKH, CellID 앞 두글자와 TMD간 Fab Site가 일치하지 않는다면 return false; { return FALSE; } //20180313 Cell Mixing 주석 ////kjpark 20180120 Cell Mixing 처리(강원호 선임) //strKeyword = pCell->defaultData.m_strProductID.Left(10); //if(pCell->defaultData.m_strTMD_Info.Find(strKeyword) >= 0) //{ // if(pCell->defaultData.m_strTMD_Info.Find(_T("A3-A4")) >= 0) // { // //kjpark 20180122 Cell Mixing 처리(강원호 선임) 005도 추가 // //kjpark 20180123 Cell Mixing 처리(강원호 선임) 010도 추가 // //cdtruong 20180214 Cell Mixing 처리(사귀진 선임) 012도 추가 // if(pCell->defaultData.m_strProductID.Find(_T("AMB622NP")) >= 0) // { // if((pCell->defaultData.m_strProductID.Find(_T("-008")) >= 0) // || (pCell->defaultData.m_strProductID.Find(_T("-005")) >= 0) // || (pCell->defaultData.m_strProductID.Find(_T("-010")) >= 0) // || (pCell->defaultData.m_strProductID.Find(_T("-012")) >= 0)) // { // return TRUE; // } // else // { // return FALSE; // } // } // } // else // { // //kjpark 20180122 Cell Mixing 처리(강원호 선임) 005도 추가 // //kjpark 20180123 Cell Mixing 처리(강원호 선임) 010도 추가 // //cdtruong 20180214 Cell Mixing 처리(사귀진 선임) 012도 추가 // if(pCell->defaultData.m_strProductID.Find(_T("AMB622NP")) >= 0) // { // if((pCell->defaultData.m_strProductID.Find(_T("-008")) >= 0) // || (pCell->defaultData.m_strProductID.Find(_T("-005")) >= 0) // || (pCell->defaultData.m_strProductID.Find(_T("-010")) >= 0) // || (pCell->defaultData.m_strProductID.Find(_T("-012")) >= 0)) // { // return FALSE; // } // else // { // return TRUE; // } // } // } //} //else //{ // return FALSE; //} return TRUE; } BOOL CUnitCtrlBank::CheckTMDnCellIDMatch(JIG_ID jig, JIG_CH ch) { // TMD 파일명과 CellID 앞 2글자(A3)와 비교한다 CCellInfo *pCell; pCell = theCellBank.GetCellInfo(jig, ch); if(pCell == NULL) return TRUE; //kjpark 20171010 TMD March 구현 if(theConfigBank.m_Option.m_bUseTMDNameMatch == FALSE) return TRUE; // Cell ID 못읽은 셀이면 스킵 if(pCell->defaultData.m_bMCR_OK == FALSE) return TRUE; // TMD 정보를 못받은 셀도 스킵 if(pCell->defaultData.m_bReceive_TMD_Info != TMD_INFO_RECEIVE) return TRUE; if(pCell->defaultData.m_strTMD_Info.Left(2) == pCell->defaultData.m_strCellID.Left(2)) { return TRUE; } else { return FALSE; } } BOOL CUnitCtrlBank::CellInfo_CheckLoadable(JIG_ID jig) { // 해당 지그가 로봇한테서 셀을 받을 상태인지 확인 // MP2100 함수 하나하나가 상당히 오래걸려 주석 [10/15/2017 OSC] // if(Shuttle_Y_LOAD_Check(jig) == FALSE) // return FALSE; if(theProcBank.AZoneChannelNotUse_Check(jig, JIG_CH_1) == FALSE) { if(CellTagExist(jig, JIG_CH_1) == FALSE) return TRUE; } return FALSE; } BOOL CUnitCtrlBank::CellInfo_CheckUnloadable( JIG_ID jig, JIG_CH ch /*= JIG_CH_MAX*/ ) { // 해당 지그가 로봇한테서 셀을 받을 상태인지 확인 // MP2100 함수 하나하나가 상당히 오래걸려 주석 [10/15/2017 OSC] // if(Shuttle_Y_LOAD_Check(jig) == FALSE) // return FALSE; if(ch == JIG_CH_MAX) { for(int i = 0; i < JIG_CH_MAX; i++) { if(theProcBank.AZoneChannelNotUse_Check(jig, (JIG_CH)i) == FALSE) { CCellInfo *pCell; pCell = theCellBank.GetCellInfo(jig, (JIG_CH)i); if(pCell) { if(pCell->defaultData.m_LastClass != NONE_CELL) return TRUE; } } } } else { if(theProcBank.AZoneChannelNotUse_Check(jig, ch) == FALSE) { CCellInfo *pCell; pCell = theCellBank.GetCellInfo(jig, ch); if(pCell) { if(pCell->defaultData.m_LastClass != NONE_CELL) return TRUE; } } } return FALSE; } //kjpark 20161027 IO Output check bug 수정 BOOL CUnitCtrlBank::GetInPutIOCheck(INPUT_ID ID) { return theIOBank.GetInputIOParma((INPUT_ID)ID).GetIOCheck(theDeviceIO.ReadInBit(ID)); } BOOL CUnitCtrlBank::GetInPutIOCheck( INPUT_ID ID, ONOFF bValue ) { return (theDeviceIO.ReadInBit(ID) == theIOBank.GetInputIOParma(ID).GetIOCheck(bValue)) ? TRUE:FALSE; } //kjpark 20161027 IO Output check bug 수정 BOOL CUnitCtrlBank::GetOutPutIOCheck(OUTPUT_ID ID) { return theIOBank.GetOutputIOParma((OUTPUT_ID)ID).GetIOCheck(theDeviceIO.ReadOutBit(ID)); } BOOL CUnitCtrlBank::GetOutPutIOCheck( OUTPUT_ID ID, ONOFF bValue ) { return (theDeviceIO.ReadOutBit(ID) == theIOBank.GetOutputIOParma(ID).GetIOCheck(bValue)) ? TRUE:FALSE; } //kjpark 20161027 IO Output check bug 수정 void CUnitCtrlBank::SetOutPutIO(OUTPUT_ID ID, BOOL bValue) { theDeviceIO.WriteOutBit((OUTPUT_ID)ID, theIOBank.GetOutputIOParma((OUTPUT_ID)ID).GetIOCheck(bValue)); ; } //kjpark 20161027 IO Output check bug 수정 void CUnitCtrlBank::SetOutPutIO(OUTPUT_ID ID, ONOFF bValue) { theDeviceIO.WriteOutBit((OUTPUT_ID)ID, theIOBank.GetOutputIOParma((OUTPUT_ID)ID).GetIOCheck(bValue)); ; } //kjpark 20161019 양수버튼 체크 BOOL CUnitCtrlBank::ReadySwitch_Check( JIG_ID jig ) { if(theProcBank.m_bDryRunMode) return TRUE; if(LightCurtain_Check(jig) == FALSE) return FALSE; return theProcBank.m_bAZoneReadyPressed[jig]; } BOOL CUnitCtrlBank::AutoTeachKey_AutoCheck(BOOL bAlarm /*= FALSE*/) { if(bAlarm == FALSE) { theProcBank.m_strLastKorMsg = _T(""); theProcBank.m_strLastEngMsg = _T(""); theProcBank.m_strLastVnmMsg = _T(""); } BOOL bRet = TRUE; //20170912 hhkim AutoTeachKey_TeachCheck if(theUnitFunc.GetInPutIOCheck(X_AUTO_TEACH_KEY)) { if(bAlarm) { theProcBank.AlarmHappen(ALM_SAFTY_KEY_TEACH); } else { theProcBank.m_strLastKorMsg = _T("auto Teach key가 Teach mode 입니다."); //한 theProcBank.m_strLastEngMsg = _T("The auto teach key is Teach mode."); //영 theProcBank.m_strLastVnmMsg =_T("Auto Teach key đang ở chế độ Teach mode") ; //베 } bRet = FALSE; } return bRet; } BOOL CUnitCtrlBank::AutoTeachKey_TeachCheck() { theProcBank.m_strLastKorMsg = _T(""); theProcBank.m_strLastEngMsg = _T(""); theProcBank.m_strLastVnmMsg = _T(""); BOOL bRet = TRUE; //20170912 hhkim AutoTeachKey_AutoCheck if(theUnitFunc.GetInPutIOCheck(X_AUTO_TEACH_KEY)==FALSE) { theProcBank.m_strLastKorMsg = _T("auto Teach key가 현재 모두 auto mode 입니다."); //한 theProcBank.m_strLastEngMsg = _T("The auto teach key is all Auto mode."); //영 theProcBank.m_strLastVnmMsg =_T("Auto Teach Key hiện tại tất cả đang chế độ Auto Mode") ; //베 bRet = FALSE; } return bRet; //return TRUE; } BOOL CUnitCtrlBank::DoorClose_Check(BOOL bAlarm /*= FALSE*/) { if(bAlarm == FALSE) { theProcBank.m_strLastKorMsg = _T(""); theProcBank.m_strLastEngMsg = _T(""); theProcBank.m_strLastVnmMsg = _T(""); } BOOL bRet = TRUE; if(theUnitFunc.GetInPutIOCheck(X_FRONT_DOOR1_SENSOR)) { if(bAlarm) { theProcBank.AlarmHappen(ALM_SHUTTLE1_LIGHT_CURTAIN); } else { theProcBank.m_strLastKorMsg = _T("FRONT DOOR1 가 열렸습니다."); //한 theProcBank.m_strLastEngMsg = _T("FRONT DOOR1 door opened."); //영 theProcBank.m_strLastVnmMsg =_T("Cửa phía trước số 1 đã bị mở.") ; //베 } bRet = FALSE; } if(theUnitFunc.GetInPutIOCheck(X_FRONT_DOOR2_SENSOR)) { if(bAlarm) { theProcBank.AlarmHappen(ALM_FRONT_DOOR2_SENSOR); } else { theProcBank.m_strLastKorMsg = _T("FRONT DOOR2 가 열렸습니다."); //한 theProcBank.m_strLastEngMsg = _T("FRONT DOOR2 door opened."); //영 theProcBank.m_strLastVnmMsg =_T("Cửa phía trước số 2 đã bị mở.") ; //베 } bRet = FALSE; } if(theUnitFunc.GetInPutIOCheck(X_RIGNT_DOOR_SENSOR)) { if(bAlarm) { theProcBank.AlarmHappen(ALM_RIGHT_DOOR_SENSOR); } else { theProcBank.m_strLastKorMsg = _T("RIGNT DOOR 가 열렸습니다."); //한 theProcBank.m_strLastEngMsg = _T("RIGNT DOOR door opened."); //영 theProcBank.m_strLastVnmMsg =_T("Cửa bên phải đã bị mở.") ; //베 } bRet = FALSE; } if(theUnitFunc.GetInPutIOCheck(X_LEFT_DOOR_SENSOR)) { if(bAlarm) { theProcBank.AlarmHappen(ALM_BACK_DOOR1_SENSOR); } else { theProcBank.m_strLastKorMsg = _T("LEFT DOOR가 열렸습니다."); //한 theProcBank.m_strLastEngMsg = _T("LEFT DOOR door opened."); //영 theProcBank.m_strLastVnmMsg =_T("Cửa phía sau số 1 đã bị mở.") ; //베 } bRet = FALSE; } return bRet; } BOOL CUnitCtrlBank::DoorLockOn_Check() { theProcBank.m_strLastKorMsg = _T(""); theProcBank.m_strLastEngMsg = _T(""); theProcBank.m_strLastVnmMsg = _T(""); BOOL bRet = TRUE; if(theUnitFunc.GetOutPutIOCheck(Y_FRONT_DOOR1_LOCK_ONOFF)) { theProcBank.m_strLastKorMsg = _T("FRONT DOOR1 LOCK을 ON해주세요"); //한 theProcBank.m_strLastEngMsg = _T("FRONT DOOR1 door unlocked."); //영 theProcBank.m_strLastVnmMsg =_T("Cửa phía trước số 1 đã bị mở.") ; //베 bRet = FALSE; } if(theUnitFunc.GetOutPutIOCheck(Y_FRONT_DOOR2_LOCK_ONOFF)) { theProcBank.m_strLastKorMsg = _T("FRONT DOOR2 LOCK을 ON해주세요"); //한 theProcBank.m_strLastEngMsg = _T("FRONT DOOR2 door unlocked."); //영 theProcBank.m_strLastVnmMsg =_T("Cửa phía trước số 2 đã bị mở.") ; //베 bRet = FALSE; } if(theUnitFunc.GetOutPutIOCheck(Y_RIGNT_DOOR_LOCK_ONOFF)) { theProcBank.m_strLastKorMsg = _T("RIGNT DOOR LOCK을 ON해주세요"); //한 theProcBank.m_strLastEngMsg = _T("RIGNT DOOR door unlocked."); //영 theProcBank.m_strLastVnmMsg =_T("Cửa bên phải đã bị mở.") ; //베 bRet = FALSE; } if(theUnitFunc.GetOutPutIOCheck(Y_LEFT_DOOR_LOCK_ONOFF)) { theProcBank.m_strLastKorMsg = _T("LEFT DOOR LOCK을 ON해주세요"); //한 theProcBank.m_strLastEngMsg = _T("LEFT DOOR door unlocked."); //영 theProcBank.m_strLastVnmMsg =_T("Cửa phía sau số 1 đã bị mở.") ; //베 bRet = FALSE; } return bRet; } BOOL CUnitCtrlBank::LightCurtain_Check(JIG_ID jig /*= JIG_ID_MAX*/, BOOL bAlarm /*= FALSE*/) { if(bAlarm == FALSE) { theProcBank.m_strLastKorMsg = _T(""); theProcBank.m_strLastEngMsg = _T(""); theProcBank.m_strLastVnmMsg = _T(""); } BOOL bRet=TRUE; if(theConfigBank.m_System.m_bInlineMode) return bRet; if( bRet && ( (jig == JIG_ID_A ) || (jig == JIG_ID_MAX) ) ) { if(GetInPutIOCheck(X_SHUTTLE_1_LIGHT_CURTAIN)) { if(bAlarm) { theProcBank.AlarmHappen(ALM_SHUTTLE1_LIGHT_CURTAIN); } else { theProcBank.m_strLastKorMsg =_T("SHUTTLE 1 Light curtain을 감지 했습니다. "); //한 theProcBank.m_strLastEngMsg =_T("SHUTTLE 1 Light curtain detected."); //영 theProcBank.m_strLastVnmMsg =_T("SHUTTLE 1 Light curtain phát hiện cảm biến.") ; //베 } bRet = FALSE; } } if( bRet && ( (jig == JIG_ID_B ) || (jig == JIG_ID_MAX) ) ) { if(GetInPutIOCheck(X_SHUTTLE_2_LIGHT_CURTAIN)) { if(bAlarm) { theProcBank.AlarmHappen(ALM_SHUTTLE2_LIGHT_CURTAIN); } else { theProcBank.m_strLastKorMsg =_T("SHUTTLE 2 light curtain을 감지 했습니다. "); //한 theProcBank.m_strLastEngMsg =_T("SHUTTLE 2 light curtain detected."); //영 theProcBank.m_strLastVnmMsg =_T("SHUTTLE 2 Light curtain phát hiện cảm biến.") ; //베 } bRet = FALSE; } } if( bRet && ( (jig == JIG_ID_B ) || (jig == JIG_ID_MAX) ) ) { if(GetInPutIOCheck(X_PDT_LIGHT_CURTAIN)) { if(bAlarm) { theProcBank.AlarmHappen(ALM_SHUTTLE2_LIGHT_CURTAIN); } else { theProcBank.m_strLastKorMsg =_T("PDT light curtain을 감지 했습니다. "); //한 theProcBank.m_strLastEngMsg =_T("PDT light curtain detected."); //영 theProcBank.m_strLastVnmMsg =_T("PDT Light curtain phát hiện cảm biến.") ; //베 } bRet = FALSE; } } return bRet; } void CUnitCtrlBank::LightCurtainMute_OnOff(JIG_ID jig, ONOFF value) { if(theConfigBank.m_System.m_bInlineMode) value = ON; switch(jig) { case JIG_ID_A: SetOutPutIO(Y_SHUTTLE_1_LIGHT_MUTING_ON_TO_SNC , value); break; case JIG_ID_B: SetOutPutIO(Y_SHUTTLE_2_LIGHT_MUTING_ON_TO_SNC , value); break; case JIG_ID_MAX: SetOutPutIO(Y_SHUTTLE_1_LIGHT_MUTING_ON_TO_SNC , value); SetOutPutIO(Y_SHUTTLE_2_LIGHT_MUTING_ON_TO_SNC , value); break; default: break; } switch(jig) { case JIG_ID_A: SetOutPutIO(Y_SHUTTLE_1_LIGHT_MUTING_ON_TO_SNC , value); break; case JIG_ID_B: SetOutPutIO(Y_SHUTTLE_2_LIGHT_MUTING_ON_TO_SNC , value); break; case JIG_ID_MAX: SetOutPutIO(Y_SHUTTLE_1_LIGHT_MUTING_ON_TO_SNC , value); SetOutPutIO(Y_SHUTTLE_2_LIGHT_MUTING_ON_TO_SNC , value); break; default: break; } } void CUnitCtrlBank::LightCurtainMuteLamp_OnOff( JIG_ID jig, ONOFF value ) { switch(jig) { case JIG_ID_A: SetOutPutIO(Y_SHUTTLE_1_LIGHT_CURTAIN_MUTING_LAMP, value); break; case JIG_ID_B: SetOutPutIO(Y_SHUTTLE_2_LIGHT_CURTAIN_MUTING_LAMP, value); break; case JIG_ID_MAX: SetOutPutIO(Y_SHUTTLE_1_LIGHT_CURTAIN_MUTING_LAMP, value); SetOutPutIO(Y_SHUTTLE_2_LIGHT_CURTAIN_MUTING_LAMP, value); break; default: break; } } BOOL CUnitCtrlBank::LightCurtainMuteLamp_Check(JIG_ID jig) { BOOL bRet = OFF; switch(jig) { case JIG_ID_A: bRet = GetOutPutIOCheck(Y_SHUTTLE_1_LIGHT_CURTAIN_MUTING_LAMP); break; case JIG_ID_B: bRet = GetOutPutIOCheck(Y_SHUTTLE_2_LIGHT_CURTAIN_MUTING_LAMP); break; } return bRet; } STO_STATE CUnitCtrlBank::STO_Check() { BOOL bSTO1 = GetInPutIOCheck(X_SHUTTLE_TABLE_STO1); BOOL bSTO2 = GetInPutIOCheck(X_SHUTTLE_TABLE_STO2); theProcBank.m_strLastKorMsg.Empty(); theProcBank.m_strLastEngMsg.Empty(); theProcBank.m_strLastVnmMsg.Empty(); if(bSTO1 && bSTO2) { theProcBank.m_strLastKorMsg =_T("STO가 걸려있습니다. RESET을 눌러주세요."); //한 theProcBank.m_strLastEngMsg =_T("STO is enabled. Please push RESET button."); //영 theProcBank.m_strLastVnmMsg =_T("STO bị tắt. Vui lòng bấm nút RESET.") ; //베 return STO_ALARM; } else if( (bSTO1 == FALSE) && (bSTO2 == FALSE) ) { return STO_READY; } else { // 원래 둘 다 살아야 하지만 라인 하나가 죽어있는 상태. 전장 조치 필요 [9/19/2017 OSC] theProcBank.m_strLastKorMsg =_T("STO Line 하나가 불량입니다. 조치가 필요합니다."); //한 theProcBank.m_strLastEngMsg =_T("STO Line 1EA is NG. Please fix STO line."); //영 theProcBank.m_strLastVnmMsg =_T("STO Line 1EA bị lỗi. Vui lòng khoi tao lai.") ; //베 return STO_WARNING; } } void CUnitCtrlBank::TowerLamp_Change( int nRed, int nYellow, int nGreen, BOOL bBuzzer ) { if(bBuzzer == TRUE) { SetOutPutIO(Y_BUZZER_K1,ON); SetOutPutIO(Y_BUZZER_K2,OFF); SetOutPutIO(Y_BUZZER_K3,OFF); SetOutPutIO(Y_BUZZER_K4,OFF); } else { SetOutPutIO(Y_BUZZER_K1,OFF); SetOutPutIO(Y_BUZZER_K2,OFF); SetOutPutIO(Y_BUZZER_K3,OFF); SetOutPutIO(Y_BUZZER_K4,OFF); } //RED if(nRed == LAMP_ON) { SetOutPutIO(Y_TOWER_LAMP_RED, ON); GetMainHandler()->m_bChkLampR_Flick = FALSE; } else if(nRed == LAMP_OFF) { SetOutPutIO(Y_TOWER_LAMP_RED, OFF); GetMainHandler()->m_bChkLampR_Flick = FALSE; } else if(nRed == LAMP_FLICKER) { GetMainHandler()->m_bChkLampR_Flick = TRUE; } // YELLOW if(nYellow == LAMP_ON) { SetOutPutIO(Y_TOWER_LAMP_YELLOW, ON); GetMainHandler()->m_bChkLampY_Flick = FALSE; } else if(nYellow == LAMP_OFF) { SetOutPutIO(Y_TOWER_LAMP_YELLOW, OFF); GetMainHandler()->m_bChkLampY_Flick = FALSE; } else if(nYellow == LAMP_FLICKER) { GetMainHandler()->m_bChkLampY_Flick = TRUE; } // GREEN if(nGreen == LAMP_ON) { SetOutPutIO(Y_TOWER_LAMP_GREEN, ON); GetMainHandler()->m_bChkLampG_Flick = FALSE; } else if(nGreen == LAMP_OFF) { SetOutPutIO(Y_TOWER_LAMP_GREEN, OFF); GetMainHandler()->m_bChkLampG_Flick = FALSE; } else if(nGreen == LAMP_FLICKER) { GetMainHandler()->m_bChkLampG_Flick = TRUE; } } void CUnitCtrlBank::Temp_Check() { if(GetInPutIOCheck(X_UTIL_BOX_TEMP_ALARM)) { theProcBank.AlarmHappen(ALM_UTIL_BOX_TEMP_ALARM); return; } if(GetInPutIOCheck(X_C_BOX_A_TEMP_ALARM)) { theProcBank.AlarmHappen(ALM_ETC_BOX_TEMP_ALARM); return; } if(GetInPutIOCheck(X_OP_PC_TEMP_ALARM)) { theProcBank.AlarmHappen(ALM_OP_PC_TEMP_ALARM); return; } if(GetInPutIOCheck(X_ALIGN_PG_PC_TEMP_ALARM)) { theProcBank.AlarmHappen(ALM_ALIGN_PG_PC_TEMP_ALARM); return; } if(GetInPutIOCheck(X_C_BOX_B_TEMP_ALARM)) { theProcBank.AlarmHappen(ALM_SERVO_BOX_TEMP_ALARM); return; } } void CUnitCtrlBank::EMSSwitch_Check() { INPUT_ID id = X_EMS_SWITCH_1; BOOL bValue = GetInPutIOCheck(id); if(theProcBank.m_OldInput[id] != bValue) { theProcBank.m_OldInput[id] = bValue; if(bValue) { theProcBank.AlarmHappen(ALM_FRONT_EMS_SWITCH); return; } } id = X_EMS_SWITCH_2; bValue = GetInPutIOCheck(id); if(theProcBank.m_OldInput[id] != bValue) { theProcBank.m_OldInput[id] = bValue; if(bValue) { theProcBank.AlarmHappen(ALM_LEFT_EMS_SWITCH); return; } } } void CUnitCtrlBank::FanAlarm_Check() { // if(GetInPutIOCheck(X_UTIL_BOX_FAN_ALARM)) // { // theProcBank.AlarmHappen(ALM_UTIL_BOX_FAN_ALARM); // return; // } // if(GetInPutIOCheck(X_ETC_BOX_FAN_ALARM)) // { // theProcBank.AlarmHappen(ALM_ETC_BOX_FAN_ALARM); // return; // } // if(GetInPutIOCheck(X_OP_PC_FAN_ALARM)) // { // theProcBank.AlarmHappen(ALM_OP_PC_FAN_ALARM); // return; // } // if(GetInPutIOCheck(X_SIGNAL_PC_FAN_ALARM)) // { // theProcBank.AlarmHappen(ALM_SIGNAL_PC_FAN_ALARM); // return; // } // if(GetInPutIOCheck(X_SERVO_BOX_FAN_ALARM)) // { // theProcBank.AlarmHappen(ALM_SERVO_BOX_FAN_ALARM); // return; // } } void CUnitCtrlBank::MCPower_Check() { if(GetInPutIOCheck(X_MC_ON_CHECK) == FALSE) { theProcBank.AlarmHappen(ALM_MC_POWER_OFF); } } //door key check yjkim void CUnitCtrlBank::Door_Key_On_Check() { //door alarm buzzer if (GetInPutIOCheck(X_FRONT_DOOR1_KEY_ON_CK) || GetInPutIOCheck(X_FRONT_DOOR2_KEY_ON_CK)) { if (GetInPutIOCheck(X_FRONT_DOOR_MODE_KEY_ON_CK) == TRUE) { SetOutPutIO(Y_FRONT_DOOR_BUZZER1,ON); } else { SetOutPutIO(Y_FRONT_DOOR_BUZZER1,OFF); } } else { SetOutPutIO(Y_FRONT_DOOR_BUZZER1,OFF); } if (GetInPutIOCheck(X_LEFT_DOOR_KEY_ON_CK)) { if (GetInPutIOCheck(X_LEFT_DOOR_MODE_KEY_ON_CK) == TRUE) { SetOutPutIO(Y_LEFT_DOOR_BUZZER1,ON); } else { SetOutPutIO(Y_LEFT_DOOR_BUZZER1,OFF); } } else { SetOutPutIO(Y_LEFT_DOOR_BUZZER1,OFF); } if (GetInPutIOCheck(X_RIGHT_DOOR_KEY_ON_CK)) { if (GetInPutIOCheck(X_RIGHT_DOOR_MODE_KEY_ON_CK) == TRUE) { SetOutPutIO(Y_RIGHT_DOOR_BUZZER1,ON); } else { SetOutPutIO(Y_RIGHT_DOOR_BUZZER1,OFF); } } else { SetOutPutIO(Y_RIGHT_DOOR_BUZZER1,OFF); } } //kjpark 20161025 MCR 구현 //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 void CUnitCtrlBank::MCR_Trigger(JIG_ID jig, JIG_CH ch, BOOL bOn ) { // Trigger On 할 때 BOOL 변수를 자동으로 FALSE해 준다 [9/18/2017 OSC] if(bOn) theProcBank.m_bMCRResultRecive[jig][ch] = FALSE; switch(jig) { case JIG_ID_A: { switch(ch) { case JIG_CH_1: //SetOutPutIO((OUTPUT_ID) Y_MCR1_TRIGGER_ONOFF, bOn); break; } } break; case JIG_ID_B: { switch(ch) { case JIG_CH_1: //SetOutPutIO((OUTPUT_ID) Y_MCR3_TRIGGER_ONOFF, bOn); break; } } break; } } //kjpark 20170912 MCR에서 읽은 셀아이디 정상 판별 BOOL CUnitCtrlBank::GetMCR_ResultRecive(JIG_ID jig, JIG_CH ch) { return theProcBank.m_bMCRResultRecive[jig][ch]; } //kjpark 20161025 MCR 구현 CString CUnitCtrlBank::GetSoftTriggerData( JIG_ID jig, JIG_CH ch ) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader ) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader->IsConnect() ) { return theSocketInterFace.m_MCR[jig][ch].m_pIDReader->GetReadString(); } } return _T(""); } //kjpark 20161025 MCR 구현 int CUnitCtrlBank::GetSoftTriggerResult( JIG_ID jig, JIG_CH ch ) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader ) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader->IsConnect() ) { return theSocketInterFace.m_MCR[jig][ch].m_pIDReader->GetReadResult(); } } return 0; } // Live 화면을 지정해준다. //kjpark 20161025 MCR 구현 BOOL CUnitCtrlBank::SetLiveMode(JIG_ID jig, JIG_CH ch, BOOL bFlag) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader ) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader->IsConnect() ) { if ( bFlag ) // Live On 요청 { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader->IsLiveOn() == FALSE ) { theSocketInterFace.m_MCR[jig][ch].m_pIDReader->LiveOn(); } return TRUE; } theSocketInterFace.m_MCR[jig][ch].m_pIDReader->LiveOff(); return TRUE; } } return FALSE; } // Live mode인가 ? //kjpark 20161025 MCR 구현 BOOL CUnitCtrlBank::GetLiveMode( JIG_ID jig, JIG_CH ch ) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader ) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader->IsConnect() ) { return theSocketInterFace.m_MCR[jig][ch].m_pIDReader->IsLiveOn(); } } return FALSE; } // 통신에 의한 Trigger 신호를 보내준다. //kjpark 20161025 MCR 구현 BOOL CUnitCtrlBank::SetSoftTrigger( JIG_ID jig, JIG_CH ch ) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader ) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader->IsConnect() ) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader->IsLiveOn() ) { theSocketInterFace.m_MCR[jig][ch].m_pIDReader->LiveOff(); SleepEx(200, NULL); } theSocketInterFace.m_MCR[jig][ch].m_pIDReader->Trigger(); return TRUE; } } return FALSE; } // 결과 화면을 저장한다. //kjpark 20161025 MCR 구현 BOOL CUnitCtrlBank::SaveResultImage(JIG_ID jig, JIG_CH ch, CString sFile) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader ) { if ( theSocketInterFace.m_MCR[jig][ch].m_pIDReader->IsConnect() ) { //kjpark 20170831 MCR 구현 채널 별 구현 완료 GetMainHandler()->m_sLastSavedImage[jig][ch] = sFile;// = _T("O:\\123.jpg"); // 마지막에 저장된 이미지 파일이름 theSocketInterFace.m_MCR[jig][ch].m_pIDReader->SaveImage(sFile); return TRUE; } } return FALSE; } //kjpark 20170912 MCR에서 읽은 셀아이디 정상 판별 void CUnitCtrlBank::SetMCRReadingID(JIG_ID shuttls, JIG_CH channel) { //Cell Info에 MCR ID 삽입. CCellInfo* pCellInfo; pCellInfo = theCellBank.GetCellInfo(shuttls, channel); if(pCellInfo) { if(theProcBank.m_strLastCellID[shuttls][channel].GetLength() < 1 || theProcBank.m_strLastCellID[shuttls][channel] == TEXT_FAIL) { // if(theConfigBank.m_System.m_bInlineMode) // { // // 로봇에서 Cell ID를 받아오니 일단 TRUE로.. [10/7/2017 OSC] // pCellInfo->defaultData.m_bMCR_OK = TRUE; // pCellInfo->defaultData.m_strReadUnitMCR = _T("ROBOT"); // } // else { pCellInfo->defaultData.m_strCellID = theProcBank.m_strLastCellID[shuttls][channel]; // 읽은것 어디서 가져다 넣는지 ? // ////////////////////////////////////////////////////////////////////////// // // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [9/26/2017 yw] // pCellInfo->defaultCellInfomation.m_bMCR_OK = TRUE; // pCellInfo->defaultCellInfomation.m_strCellID = pCellInfo->defaultCellInfomation.m_strInnerID; } } else { //20170306 kjpark MCR Read Unit pCellInfo->defaultData.m_bMCR_OK = TRUE; pCellInfo->defaultData.m_strCellID = theProcBank.m_strLastCellID[shuttls][channel]; } if(pCellInfo->defaultData.m_strReadUnitMCR.IsEmpty()) { int nFullCh = ((shuttls*JIG_CH_MAX) + channel)+1; pCellInfo->defaultData.m_strReadUnitMCR.Format(_T("MCR_CH%d"), nFullCh); } theLog[LOG_MCR].AddBuf(_T("%s InnerID[%s], CellID[%s]"), pCellInfo->defaultData.m_strReadUnitMCR, pCellInfo->defaultData.m_strInnerID, pCellInfo->defaultData.m_strCellID); } } //kjpark 20170912 MCR Retry 추가 CString CUnitCtrlBank::MCR_GetLastID(JIG_ID shuttls, JIG_CH channel) { return theProcBank.m_strLastCellID[shuttls][channel]; } BOOL CUnitCtrlBank::MCR_SuccessCheck( JIG_ID jig, JIG_CH channel ) { CCellInfo* pCellInfo; pCellInfo = theCellBank.GetCellInfo(jig, channel); if(pCellInfo == NULL) return TRUE; if(pCellInfo->defaultData.m_bMCR_OK == FALSE) return FALSE; if(pCellInfo->defaultData.m_strCellID.GetLength() < 1 || pCellInfo->defaultData.m_strCellID == TEXT_FAIL) return FALSE; return TRUE; } // 마지막에 저장된 이미지 파일이름 //kjpark 20161025 MCR 구현 //kjpark 20170831 MCR 구현 채널 별 구현 완료 CString CUnitCtrlBank::GetLastSavedImage(JIG_ID jig, JIG_CH ch) { return GetMainHandler()->m_sLastSavedImage[jig][ch]; } //kjpark 20170912 MCR Retry 추가 void CUnitCtrlBank::SaveLastMCRImage(JIG_ID jig, JIG_CH ch) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, ch); if(pCell == NULL) return; CString strPath; CTime time = CTime::GetCurrentTime(); CEtc::ApplyTimeOffset(time, theConfigBank.m_Option.m_OffsetHour, 0); strPath.Format(_T("%s\\%04u-%02u-%02u"), theConfigBank.m_System.m_strMCRImageSavePath, time.GetYear(), time.GetMonth(), time.GetDay()); if(CFileSupport::DirectoryCheck(strPath) == FALSE) { if(CFileSupport::CreateDirectory(strPath) == FALSE) return; } int nFullCh = ((jig*JIG_CH_MAX) + ch)+1; CString strFilePath; strFilePath.Format(_T("%s\\CH%d_%02u_%02u_%02u_%s.jpg"), strPath, nFullCh, time.GetHour(), time.GetMinute(), time.GetSecond(), pCell->defaultData.m_strInnerID); // 마지막 저장했던걸 복사한다 switch(jig) { case JIG_ID_A: { switch(ch) { case JIG_CH_1: CopyFile(MCRPath_CH1, strFilePath, FALSE); break; } } break; case JIG_ID_B: { switch(ch) { case JIG_CH_1: CopyFile(MCRPath_CH3, strFilePath, FALSE); break; } } break; } } // [11/8/2016 WHLEE] void CUnitCtrlBank::SetProductData(JIG_ID jig, JIG_CH ch) { CCellInfo* pCell = theCellBank.GetCellInfo(jig, ch); if (pCell == NULL) { // 셀이없음 return; } // 현재 날짜 업데이트 theProductBank.DateCheck(); /* Product */ theProductBank.IncreaseProductCount(jig, ch); /* Inspectoin result */ if(pCell->defaultData.m_LastClass == GOOD_CELL) theProductBank.IncreaseBinZoreCount(jig, ch); else if(pCell->defaultData.m_LastClass == REJECT_CELL) theProductBank.IncreaseBinOneCount(jig, ch); else theProductBank.IncreaseBinTwoCount(jig, ch); /* MCR */ if ( !(pCell->defaultData.m_strCellID == TEXT_FAIL) ) theProductBank.IncreaseMcrOkCount(jig, ch); /* First Contact */ if(pCell->m_CellLoading.m_FirstClass == GOOD_CELL) theProductBank.IncreaseFirstContactCount(jig, ch); /* Final Contact */ if(pCell->m_CellLoading.m_Class == GOOD_CELL) theProductBank.IncreaseFinalContactCount(jig, ch); // 생산 데이터 입력 - LSH171216 theProductBank.SaveReportFileToday(); // Main UI 상태 Update - LSH171216 theProductBank.MainCount_Update(pCell); } void CUnitCtrlBank::ReadFromFilePGMS() { CStdioFile file; CFileException e; CString strPGMSPath = _T("C:/PGMS_LOG/PgmsLog.ini"); if (!file.Open(strPGMSPath.GetBuffer(), CFile::modeRead, &e)) // 후에 파일이 없는경우 생성하도록 변경해야함 { return; } CIni ini(strPGMSPath);; file.Close(); int i, nIdx; CString sSection, sKey; CString sData; CString str; // //[DEVICE 1] //ID Num=1 //Nick Name= //Model=GMS2 //Channel 1=COM ERR //Channel 2=COM ERR //[DEVICE 2] //ID Num=2 //Nick Name= //Model=PGMS //Wrist State=COM ERR // 저항값 측정 sSection = _T("DEVICE 1"); for (i = 0; i < GMS_SUB_CH5; i++) { nIdx = i; sKey.Format(_T("Channel %d"), i+1); sData = ini.GetString(sSection, sKey); if ( !sData.IsEmpty()) // 데이터가 존재한다면 { sData.MakeUpper(); if ( sData.CompareNoCase(_T("COM ERR")) == 0 ) // 통신 오류 { //m_sErrMsg[nIdx] = _T("ERROR"); // 연결오류 //m_dbRcvValue[ nIdx ] = 9996; str.Format(_T("%d"), 9996);// 데이터 취득 불가 } else if ( sData.CompareNoCase(_T("OPEN")) == 0 ) // 센서 미연결 { //m_sErrMsg[nIdx] = _T("OPEN"); //m_dbRcvValue[ nIdx ] = 9999; str.Format(_T("%d"), 9999); } else if ( sData.CompareNoCase(_T("DISABLE")) == 0 ) // 미사용 설정 { //m_sErrMsg[nIdx] = _T("UNUSED"); //m_dbRcvValue[ nIdx ] = 9997; str.Format(_T("%d"), 9997); } else if ( sData.CompareNoCase(_T("RANGE OVER")) == 0 ) // 저항값 초과 { //m_sErrMsg[nIdx] = _T("OVER"); //m_dbRcvValue[ nIdx ] = 9998; str.Format(_T("%d"), 9998); } else { str.Format(_T("%s"), sData); //m_sErrMsg[nIdx] = _T(""); // 오류가 없다. //m_dbRcvValue[ nIdx ] = _tstof( sData ); // 통신에 의해 수신된 값을 변환, 00.00 자릿수를 정해준다. } } else { //m_sErrMsg[nIdx] = _T("ERROR"); // 연결오류 //m_dbRcvValue[ nIdx ] = 9996; // 데이터 취득 불가 str.Format(_T("%d"), 9996); } //kjpark 20170929 FDC 실제값, 보정값, 보고값 구분 theSerialInterFace.GetDeviceGMSHandler1()->m_LastGMSValue[(GMS_SUB_CH)i].Format(_T("%s,%s,%s"), str,str,str); }//of for i sSection = _T("DEVICE 2"); for (i = 0; i < GMS_SUB_CH5; i++) { nIdx = i; sKey.Format(_T("Channel %d"), i+1); sData = ini.GetString(sSection, sKey); if ( !sData.IsEmpty()) // 데이터가 존재한다면 { sData.MakeUpper(); if ( sData.CompareNoCase(_T("COM ERR")) == 0 ) // 통신 오류 { //m_sErrMsg[nIdx] = _T("ERROR"); // 연결오류 //m_dbRcvValue[ nIdx ] = 9996; str.Format(_T("%d"), 9996);// 데이터 취득 불가 } else if ( sData.CompareNoCase(_T("OPEN")) == 0 ) // 센서 미연결 { //m_sErrMsg[nIdx] = _T("OPEN"); //m_dbRcvValue[ nIdx ] = 9999; str.Format(_T("%d"), 9999); } else if ( sData.CompareNoCase(_T("DISABLE")) == 0 ) // 미사용 설정 { //m_sErrMsg[nIdx] = _T("UNUSED"); //m_dbRcvValue[ nIdx ] = 9997; str.Format(_T("%d"), 9997); } else if ( sData.CompareNoCase(_T("RANGE OVER")) == 0 ) // 저항값 초과 { //m_sErrMsg[nIdx] = _T("OVER"); //m_dbRcvValue[ nIdx ] = 9998; str.Format(_T("%d"), 9998); } else { str.Format(_T("%s"), sData); //m_sErrMsg[nIdx] = _T(""); // 오류가 없다. //m_dbRcvValue[ nIdx ] = _tstof( sData ); // 통신에 의해 수신된 값을 변환, 00.00 자릿수를 정해준다. } } else { //m_sErrMsg[nIdx] = _T("ERROR"); // 연결오류 //m_dbRcvValue[ nIdx ] = 9996; // 데이터 취득 불가 str.Format(_T("%d"), 9996); } //kjpark 20170929 FDC 실제값, 보정값, 보고값 구분 theSerialInterFace.GetDeviceGMSHandler2()->m_LastGMSValue[(GMS_SUB_CH)i].Format(_T("%s,%s,%s"), str,str,str); }//of for i theFDCBank.CheckGMSValue(); // PGMS 값 취득 sSection = _T("DEVICE 3"); nIdx = 2; sKey = _T("Wrist State"); sData = ini.GetString(sSection, sKey); if ( !sData.IsEmpty()) // 데이터가 존재한다면 { sData.MakeUpper(); if ( sData.CompareNoCase(_T("ON OK")) == 0 ) { //m_sErrMsg[nIdx] = _T("ON,OK"); //m_dbRcvValue[ nIdx ] = 1; str.Format(_T("%d"), 1);// 정상적인 데이터 } else if ( sData.CompareNoCase(_T("ON NG")) == 0 ) { //m_sErrMsg[nIdx] = _T("ON,NG"); // 스위치 On, 스트랩 단선 //m_dbRcvValue[ nIdx ] = 0; str.Format(_T("%d"), 0); } else if ( sData.CompareNoCase(_T("OFF OK")) == 0 ) { //m_sErrMsg[nIdx] = _T("OFF,OK"); //m_dbRcvValue[ nIdx ] = 3; // 스위치 Off, 스트랩 정상 str.Format(_T("%d"), 3); } else if ( sData.CompareNoCase(_T("OFF NG")) == 0 ) { //m_sErrMsg[nIdx] = _T("OFF,NG"); // 스위치 Off, 스트랩 단선 //m_dbRcvValue[ nIdx ] = 2; str.Format(_T("%d"), 2); } else if ( sData.CompareNoCase(_T("COM ERR")) == 0 ) // 통신 단선 { //m_sErrMsg[nIdx] = _T("ERROR"); //m_dbRcvValue[ nIdx ] = 4; str.Format(_T("%d"), 4); } else { // m_sErrMsg[nIdx] = _T("ERROR"); // 비정상적인 데이터 //m_dbRcvValue[ nIdx ] = _tstof( sData ); // 통신에 의해 수신된 값을 변환 str.Format(_T("%s"), sData); } //kjpark 20170929 FDC 실제값, 보정값, 보고값 구분 theSerialInterFace.GetDeviceGMSHandler1()->m_LastPGMS.Format(_T("%s,%s,%s"), str,str,str); theFDCBank.CheckPGMSValue(); } } BOOL CUnitCtrlBank::LoadingStop_IsAble() { if(theProcBank.m_bMachineCellExist) return FALSE; if(theConfigBank.m_System.m_bInlineMode) { // 인라인일 때 Loading Stop 발생 조건 확인 [11/24/2017 OSC] if(CellTagExist(CELL_POS_SHUTTLE1_CH1, CELL_POS_SHUTTLE2_CH1) == FALSE) { return TRUE; } } else { if(CellTagExist(CELL_POS_SHUTTLE1_CH1, CELL_POS_SHUTTLE2_CH1) == FALSE) { return TRUE; } // 단동일 때 Loading Stop 발생 조건 확인 [11/24/2017 OSC] else if( (CellLoading_RecvCheck(JIG_ID_A) == FALSE) && (CellLoading_RecvCheck(JIG_ID_B) == FALSE) ) { return TRUE; } } return FALSE; } BOOL CUnitCtrlBank::LoadingStop_IsAble(JIG_ID jig) { CELL_POS posStart, posEnd; if(jig == JIG_ID_A) { posStart = CELL_POS_SHUTTLE1_CH1; posEnd = CELL_POS_SHUTTLE1_CH1; } else if(jig == JIG_ID_B) { posStart = CELL_POS_SHUTTLE2_CH1; posEnd = CELL_POS_SHUTTLE2_CH1; } else if(jig == JIG_ID_MAX) { posStart = CELL_POS_SHUTTLE1_CH1; posEnd = CELL_POS_SHUTTLE1_CH1; } if(theConfigBank.m_System.m_bInlineMode) { // 인라인일 때 Loading Stop 발생 조건 확인 [11/24/2017 OSC] if(CellTagExist(posStart, posEnd) == FALSE) { return TRUE; } } else { if(CellTagExist(posStart, posEnd) == FALSE) { return TRUE; } else { if(jig == JIG_ID_MAX) { // 단동일 때 Loading Stop 발생 조건 확인 [11/24/2017 OSC] if( (CellLoading_RecvCheck(JIG_ID_A) == FALSE) && (CellLoading_RecvCheck(JIG_ID_B) == FALSE) ) { return TRUE; } } else { // 단동일 때 Loading Stop 발생 조건 확인 [11/24/2017 OSC] if( CellLoading_RecvCheck(jig) == FALSE ) { return TRUE; } } } } return FALSE; } BOOL CUnitCtrlBank::TransferStop_IsAble() { if( GetZoneEnd(JIG_ID_A, ZONE_ID_B) && GetZoneEnd(JIG_ID_B, ZONE_ID_B) && Shuttle_Y_LOAD_Check(JIG_ID_A) && Shuttle_Y_LOAD_Check(JIG_ID_B) ) { return TRUE; } return FALSE; } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 //kjpark 20180131 Robot Status interlock 회피 더 추가 BOOL CUnitCtrlBank::Shuttle_Y_LOAD_Move( JIG_ID jig ) { BOOL bRet = FALSE; switch(jig) { case JIG_ID_A: bRet = theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y1_to_LOAD); break; case JIG_ID_B: bRet = theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y2_to_LOAD); break; } return bRet; } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 BOOL CUnitCtrlBank::Shuttle_Y_LOAD_Check( JIG_ID jig ) { BOOL bRet = FALSE; switch(jig) { case JIG_ID_A: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y1_to_LOAD); break; case JIG_ID_B: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y2_to_LOAD); break; } return bRet; } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 void CUnitCtrlBank::Shuttle_Y_MANUAL_Move( JIG_ID jig ) { switch(jig) { case JIG_ID_A: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y1_to_MANUAL); break; case JIG_ID_B: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y2_to_MANUAL); break; } } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 BOOL CUnitCtrlBank::Shuttle_Y_MANUAL_Check( JIG_ID jig ) { BOOL bRet = FALSE; switch(jig) { case JIG_ID_A: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y1_to_MANUAL); break; case JIG_ID_B: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y2_to_MANUAL); break; } return bRet; } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 void CUnitCtrlBank::Shuttle_Y_INSP_Move( JIG_ID jig ) { switch(jig) { case JIG_ID_A: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y1_to_INSP); break; case JIG_ID_B: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y2_to_INSP); break; } } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 BOOL CUnitCtrlBank::Shuttle_Y_INSP_Check( JIG_ID jig ) { BOOL bRet = FALSE; switch(jig) { case JIG_ID_A: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y1_to_INSP); break; case JIG_ID_B: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::JIG_SHUTTLE_Y2_to_INSP); break; } return bRet; } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 void CUnitCtrlBank::Inspection_X_INSP_Move( JIG_ID jig ) { switch(jig) { case JIG_ID_A: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::INSPECTION_X1_to_INSP); break; case JIG_ID_B: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::INSPECTION_X2_to_INSP); break; } } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 BOOL CUnitCtrlBank::Inspection_X_INSP_Check( JIG_ID jig ) { BOOL bRet = FALSE; switch(jig) { case JIG_ID_A: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::INSPECTION_X1_to_INSP); break; case JIG_ID_B: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::INSPECTION_X2_to_INSP); break; } return bRet; } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 void CUnitCtrlBank::Inspection_Z_UP_Move( JIG_ID jig ) { switch(jig) { case JIG_ID_A: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::INSPECTION_Z1_to_UP); break; case JIG_ID_B: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::INSPECTION_Z2_to_UP); break; } } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 BOOL CUnitCtrlBank::Inspection_Z_UP_Check( JIG_ID jig ) { BOOL bRet = FALSE; switch(jig) { case JIG_ID_A: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::INSPECTION_Z1_to_UP); break; case JIG_ID_B: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::INSPECTION_Z2_to_UP); break; } return bRet; } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 void CUnitCtrlBank::Inspection_Z_INSP_Move( JIG_ID jig ) { switch(jig) { case JIG_ID_A: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::INSPECTION_Z1_to_INSP); break; case JIG_ID_B: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::INSPECTION_Z2_to_INSP); break; } } //kjpark 20170902 Teach Shuttle UI 및 버튼 동작 추가 BOOL CUnitCtrlBank::Inspection_Z_INSP_Check( JIG_ID jig ) { BOOL bRet = FALSE; switch(jig) { case JIG_ID_A: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::INSPECTION_Z1_to_INSP); break; case JIG_ID_B: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::INSPECTION_Z2_to_INSP); break; } return bRet; } //YJKIM 20180529 Teach Shuttle UI 및 버튼 동작 추가 void CUnitCtrlBank::Active_ALIGN_X_LEFT_Move(JIG_ID jig) { switch(jig) { case JIG_ID_A: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::ACTIVE_ALIGN_X1_to_LEFT); break; case JIG_ID_B: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::ACTIVE_ALIGN_X2_to_LEFT); break; } } BOOL CUnitCtrlBank::Active_ALIGN_X_LEFT_Check(JIG_ID jig) { BOOL bRet = FALSE; switch(jig) { case JIG_ID_A: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::ACTIVE_ALIGN_X1_to_LEFT); break; case JIG_ID_B: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::ACTIVE_ALIGN_X2_to_LEFT); break; } return bRet; } void CUnitCtrlBank::Active_ALIGN_X_RIGHT_Move(JIG_ID jig) { switch(jig) { case JIG_ID_A: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::ACTIVE_ALIGN_X1_to_RIGHT); break; case JIG_ID_B: theDeviceMotion.TeachMove(m_nThreadID, TEACH_PARAM::ACTIVE_ALIGN_X2_to_RIGHT); break; } } BOOL CUnitCtrlBank::Active_ALIGN_X_RIGHT_Check(JIG_ID jig) { BOOL bRet = FALSE; switch(jig) { case JIG_ID_A: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::ACTIVE_ALIGN_X1_to_RIGHT); break; case JIG_ID_B: bRet = theDeviceMotion.CheckTeachPosition(m_nThreadID, TEACH_PARAM::ACTIVE_ALIGN_X2_to_RIGHT); break; } return bRet; } void CUnitCtrlBank::Shuttle_Vac_OnOff( JIG_ID jig, JIG_CH ch, VAC_STATE vac, BLOW_STATE blow ) { ONOFF value = (vac== VAC_ON) ? ON:OFF; if(jig == JIG_ID_A && ch == JIG_CH_1) { SetOutPutIO(Y_SHUTTLE1_VACCUM_ONOFF,value); SetOutPutIO(Y_SHUTTLE1_BLOW_ONOFF,blow); } else if(jig == JIG_ID_B && ch == JIG_CH_1) { SetOutPutIO(Y_SHUTTLE2_VACCUM_ONOFF, value); SetOutPutIO(Y_SHUTTLE2_BLOW_ONOFF, blow); } } BOOL CUnitCtrlBank::Shuttle_Vac_Check( JIG_ID jig, JIG_CH ch, VAC_STATE vac ) { if(theProcBank.m_bDryRunMode) return TRUE; ONOFF value = (vac== VAC_ON) ? ON:OFF; BOOL bRet = FALSE; if(jig == JIG_ID_A && ch == JIG_CH_1) { bRet = GetInPutIOCheck(X_SHUTTLE_1_VACCUM_ON_SENSOR, value); } else if(jig == JIG_ID_B && ch == JIG_CH_1) { bRet = GetInPutIOCheck(X_SHUTTLE_2_VACCUM_ON_SENSOR, value); } return bRet; } BOOL CUnitCtrlBank::Shuttle_VacOut_Check( JIG_ID jig, JIG_CH ch, VAC_STATE vac ) { ONOFF value = (vac== VAC_ON) ? ON:OFF; BOOL bRet = FALSE; if(jig == JIG_ID_A && ch == JIG_CH_1) { bRet= GetOutPutIOCheck(Y_SHUTTLE1_VACCUM_ONOFF, value); } else if(jig == JIG_ID_B && ch == JIG_CH_1) { bRet = GetOutPutIOCheck(Y_SHUTTLE2_VACCUM_ONOFF, value); } return bRet; } //yjkim 180605 UI 및 버튼 동작 추가 //blow void CUnitCtrlBank::Shuttle_Blow_OnOff(JIG_ID jig, JIG_CH ch, BLOW_STATE blo) { ONOFF value = (blo == BLOW_ON) ? ON : OFF; if(jig == JIG_ID_A && ch == JIG_CH_1) { SetOutPutIO(Y_SHUTTLE1_BLOW_ONOFF,value); } else if(jig == JIG_ID_B && ch == JIG_CH_1) { SetOutPutIO(Y_SHUTTLE2_BLOW_ONOFF,value); } } BOOL CUnitCtrlBank::Shuttle_Blow_Check(JIG_ID jig, JIG_CH ch, BLOW_STATE blo) { if(theProcBank.m_bDryRunMode) return TRUE; return TRUE; } BOOL CUnitCtrlBank::Shuttle_BlowOut_Check(JIG_ID jig, JIG_CH ch, BLOW_STATE blo) { ONOFF value = (blo == BLOW_ON) ? ON : OFF ; BOOL bRet = FALSE; if(jig == JIG_ID_A && ch == JIG_CH_1) { bRet= GetOutPutIOCheck(Y_SHUTTLE1_BLOW_ONOFF, value); } else if(jig == JIG_ID_B && ch == JIG_CH_1) { bRet = GetOutPutIOCheck(Y_SHUTTLE2_BLOW_ONOFF, value); } return bRet; } //fpcb vac void CUnitCtrlBank::Shuttle_Fpcb_Vac_OnOff(JIG_ID jig, JIG_CH ch, VAC_STATE vac, BLOW_STATE blow) { ONOFF value = (vac == VAC_ON) ? ON : OFF; if (jig == JIG_ID_A && ch == JIG_CH_1) { SetOutPutIO(Y_SHUTTLE1_FPCB_VACCUM_ONOFF,value); SetOutPutIO(Y_SHUTTLE1_FPCB_BLOW_ONOFF,blow); } else if(jig == JIG_ID_B && ch == JIG_CH_1) { SetOutPutIO(Y_SHUTTLE2_FPCB_VACCUM_ONOFF,value); SetOutPutIO(Y_SHUTTLE2_FPCB_BLOW_ONOFF,blow); } } BOOL CUnitCtrlBank::Shuttle_Fpcb_Vac_Check(JIG_ID jig, JIG_CH ch, VAC_STATE vac) { if(theProcBank.m_bDryRunMode) return TRUE; ONOFF value = (vac== VAC_ON) ? ON:OFF; BOOL bRet = FALSE; if(jig == JIG_ID_A && ch == JIG_CH_1) { bRet = GetInPutIOCheck(X_SHUTTLE_1_FPCB_VACCUM_ON_SENSOR, value); } else if(jig == JIG_ID_B && ch == JIG_CH_1) { bRet = GetInPutIOCheck(X_SHUTTLE_2_FPCB_VACCUM_ON_SENSOR, value); } return bRet; } BOOL CUnitCtrlBank::Shuttle_Fpcb_VacOut_Check(JIG_ID jig, JIG_CH ch, VAC_STATE vac) { ONOFF value = (vac == BLOW_ON) ? ON : OFF ; BOOL bRet = FALSE; if(jig == JIG_ID_A && ch == JIG_CH_1) { bRet= GetOutPutIOCheck(Y_SHUTTLE1_FPCB_VACCUM_ONOFF, value); } else if(jig == JIG_ID_B && ch == JIG_CH_1) { bRet = GetOutPutIOCheck(Y_SHUTTLE2_FPCB_VACCUM_ONOFF, value); } return bRet; } //fpcb blow void CUnitCtrlBank::Shuttle_Fpcb_Blow_OnOff(JIG_ID jig, JIG_CH ch, BLOW_STATE blo) { ONOFF value = (blo == BLOW_ON) ? ON : OFF ; if (jig == JIG_ID_A && ch == JIG_CH_1) { SetOutPutIO(Y_SHUTTLE1_FPCB_BLOW_ONOFF,value); } else if(jig == JIG_ID_A && ch == JIG_CH_1) { SetOutPutIO(Y_SHUTTLE2_FPCB_BLOW_ONOFF,value); } } BOOL CUnitCtrlBank::Shuttle_Fpcb_Blow_Check(JIG_ID jig, JIG_CH ch, BLOW_STATE blo) { if(theProcBank.m_bDryRunMode) return TRUE; return TRUE; } BOOL CUnitCtrlBank::Shuttle_Fpcb_BlowOut_Check(JIG_ID jig, JIG_CH ch, BLOW_STATE blo) { ONOFF value = (blo == BLOW_ON) ? ON : OFF ; BOOL bRet = FALSE; if(jig == JIG_ID_A && ch == JIG_CH_1) { bRet= GetOutPutIOCheck(Y_SHUTTLE1_FPCB_BLOW_ONOFF, value); } else if(jig == JIG_ID_B && ch == JIG_CH_1) { bRet = GetOutPutIOCheck(Y_SHUTTLE1_FPCB_BLOW_ONOFF, value); } return bRet; } void CUnitCtrlBank::Shuttle_Tilt_UpDown(JIG_ID jig, TILT_STATE tilt) { ONOFF valueUp = (tilt == TILT_DOWN) ? OFF : ON ; ONOFF valueDown = (tilt == TILT_DOWN) ? ON : OFF ; if(jig == JIG_ID_A) { SetOutPutIO(Y_SHUTTLE_1_TILTING_UP,valueUp); SetOutPutIO(Y_SHUTTLE_1_TILTING_DOWN,valueDown); } else if(jig == JIG_ID_B) { SetOutPutIO(Y_SHUTTLE_2_TILTING_UP,valueUp); SetOutPutIO(Y_SHUTTLE_2_TILTING_DOWN,valueDown); } } BOOL CUnitCtrlBank::Shuttle_Tilt_UpDown_Check(JIG_ID jig, TILT_STATE tilt) { BOOL bRet = FALSE; if(tilt == TILT_DOWN) { if(jig == JIG_ID_A) { bRet = GetInPutIOCheck(X_SHUTTLE_1_TILTING_DOWN, ON); } else if(jig == JIG_ID_B) { bRet = GetInPutIOCheck(X_SHUTTLE_2_TILTING_DOWN, ON); } } else if(tilt == TILT_UP) { if(jig == JIG_ID_A) { bRet = GetInPutIOCheck(X_SHUTTLE_1_TILTING_UP, ON); } else if(jig == JIG_ID_B) { bRet = GetInPutIOCheck(X_SHUTTLE_2_TILTING_UP, ON); } } return bRet; // ONOFF valueUp = (tilt == TILT_DOWN) ? OFF : ON ; // ONOFF valueDown = (tilt == TILT_DOWN) ? ON : OFF ; // BOOL bRetUp = FALSE; // BOOL bRetDown = FALSE; // if(jig == JIG_ID_A) // { // bRetUp = GetInPutIOCheck(X_SHUTTLE_1_TILTING_UP, valueUp); // bRetDown = GetInPutIOCheck(X_SHUTTLE_1_TILTING_DOWN, valueDown); // } // else if(jig == JIG_ID_B) // { // bRetUp = GetInPutIOCheck(X_SHUTTLE_2_TILTING_UP, valueUp); // bRetDown = GetInPutIOCheck(X_SHUTTLE_2_TILTING_DOWN, valueDown); // } // return (bRetUp && bRetDown) ? TRUE:FALSE; } BOOL CUnitCtrlBank::Shuttle_Tilt_UpDownOut_Check(JIG_ID jig, TILT_STATE tilt) { BOOL bRet = FALSE; if(tilt == TILT_DOWN) { if(jig == JIG_ID_A) { bRet = GetOutPutIOCheck(Y_SHUTTLE_1_TILTING_DOWN, ON); } else if(jig == JIG_ID_B) { bRet = GetOutPutIOCheck(Y_SHUTTLE_2_TILTING_DOWN, ON); } } else if(tilt == TILT_UP) { if(jig == JIG_ID_A) { bRet = GetOutPutIOCheck(Y_SHUTTLE_1_TILTING_UP, ON); } else if(jig == JIG_ID_B) { bRet = GetOutPutIOCheck(Y_SHUTTLE_2_TILTING_UP, ON); } } return bRet; // ONOFF valueUp = (tilt == TILT_DOWN) ? OFF : ON ; // ONOFF valueDown = (tilt == TILT_DOWN) ? ON : OFF ; // BOOL bRetUp = FALSE; // BOOL bRetDown = FALSE; // if(jig == JIG_ID_A) // { // bRetUp = GetOutPutIOCheck(Y_SHUTTLE_1_TILTING_UP, valueUp); // bRetDown = GetOutPutIOCheck(Y_SHUTTLE_1_TILTING_DOWN, valueDown); // } // else if(jig == JIG_ID_B) // { // bRetUp = GetOutPutIOCheck(Y_SHUTTLE_2_TILTING_UP, valueUp); // bRetDown = GetOutPutIOCheck(Y_SHUTTLE_2_TILTING_DOWN, valueDown); // } // return (bRetUp && bRetDown) ? TRUE:FALSE; } void CUnitCtrlBank::MTP_IF_Servival_AllSet() { for(int jig = 0; jig < JIG_ID_MAX; jig++) { for(int ch = 0; ch < JIG_CH_MAX; ch++) { MTP_IF_Servival_OnOff((JIG_ID)jig, (JIG_CH)ch, TRUE); // if(theProcBank.AZoneChannelNotUse_Check((JIG_ID)jig, (JIG_CH)ch)) // MTP_IF_Servival_OnOff((JIG_ID)jig, (JIG_CH)ch, FALSE); // else // MTP_IF_Servival_OnOff((JIG_ID)jig, (JIG_CH)ch, TRUE); } } } void CUnitCtrlBank::MTP_IF_Servival_AllReset() { for(int jig = 0; jig < JIG_ID_MAX; jig++) { for(int ch = 0; ch < JIG_CH_MAX; ch++) { MTP_IF_Servival_OnOff((JIG_ID)jig, (JIG_CH)ch, FALSE); } } } void CUnitCtrlBank::MTP_IF_Servival_OnOff( JIG_ID jig, JIG_CH ch, BOOL bOn ) { theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH1_SURVIVAL, bOn); // theDevicePDT_IF.MTP_LB_Set(jig, ch == JIG_CH_1 ? CDevicePDT_IF::MTP_CH1_SURVIVAL:CDevicePDT_IF::MTP_CH2_SURVIVAL, bOn); } void CUnitCtrlBank::MTP_IF_Able_OnOff(JIG_ID jig, BOOL bOn) { theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_ABLE, bOn); } BOOL CUnitCtrlBank::MTP_IF_Able_Check(JIG_ID jig) { return theDevicePDT_IF.MTP_LB_Get(jig, CDevicePDT_IF::MTP_ABLE); } void CUnitCtrlBank::MTP_IF_Start_OnOff(JIG_ID jig, BOOL bOn) { theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_START, bOn); } void CUnitCtrlBank::MTP_IF_Complete_OnOff(JIG_ID jig, BOOL bOn) { theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_COMPLETE, bOn); } void CUnitCtrlBank::MTP_IF_CheckSensor_OnOff(JIG_ID jig, JIG_CH ch, BOOL bOn) { theDevicePDT_IF.MTP_LB_Set(jig, ch == JIG_CH_1 ? CDevicePDT_IF::MTP_CH1_CHECK_SENSOR_ON:CDevicePDT_IF::MTP_CH2_CHECK_SENSOR_ON, bOn); } void CUnitCtrlBank::MTP_IF_VacuumStatus_OnOff(JIG_ID jig, JIG_CH ch, BOOL bOn) { theDevicePDT_IF.MTP_LB_Set(jig, ch == JIG_CH_1 ? CDevicePDT_IF::MTP_CH1_VAC_ON_STATUS:CDevicePDT_IF::MTP_CH2_VAC_ON_STATUS, bOn); theDevicePDT_IF.MTP_LB_Set(jig, ch == JIG_CH_1 ? CDevicePDT_IF::MTP_CH1_VAC_OFF_STATUS:CDevicePDT_IF::MTP_CH2_VAC_OFF_STATUS, bOn ? FALSE:TRUE); } void CUnitCtrlBank::MTP_IF_Reset(JIG_ID jig) { theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_ABLE, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_START, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_COMPLETE, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH1_PRODUCT, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH1_INSPECTION_OK, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH1_INSPECTION_NG, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AA, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AB, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AC, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH1_LOADING_STOP, FALSE); // if(CellTagExist(jig, JIG_CH_1) == FALSE) // Shuttle_Vac_OnOff(jig, JIG_CH_1, VAC_OFF, B); //// theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH2_ABLE, FALSE); //// theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH2_START, FALSE); //// theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH2_COMPLETE, FALSE); // theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH2_PRODUCT, FALSE); // theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH2_INSPECTION_OK, FALSE); // theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH2_INSPECTION_NG, FALSE); // theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH2_INSPECTION_RETRY_AA, FALSE); // theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH2_INSPECTION_RETRY_AB, FALSE); // theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH2_INSPECTION_RETRY_AC, FALSE); // theDevicePDT_IF.MTP_LB_Set(jig, CDevicePDT_IF::MTP_CH2_LOADING_STOP, FALSE); // if(CellTagExist(jig, JIG_CH_2) == FALSE) // Shuttle_Vac_OnOff(jig, JIG_CH_2, VAC_OFF); } void CUnitCtrlBank::MTP_IF_CellInfo_Write( JIG_ID jig, JIG_CH ch ) { CCellInfo *pCell = theCellBank.GetCellInfo(jig, ch); if(pCell) { theDevicePDT_IF.MTP_LW_WriteCellID(jig, ch, pCell->defaultData.m_strCellID); theDevicePDT_IF.MTP_LW_WriteNGCode(jig, ch, pCell->defaultData.MesCode); switch(pCell->defaultData.m_LastClass) { case NONE_CELL: theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_PRODUCT, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_OK, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_NG, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AA, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AB, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AC, FALSE); break; case GOOD_CELL: theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_PRODUCT, TRUE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_OK, TRUE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_NG, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AA, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AB, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AC, FALSE); break; default: theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_PRODUCT, TRUE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_OK, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_NG, TRUE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AA, FALSE); if(pCell->Retry_CheckAble()) theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AB, TRUE); else theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AB, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AC, FALSE); break; } } else { theDevicePDT_IF.MTP_LW_WriteCellID(jig, ch, _T("")); theDevicePDT_IF.MTP_LW_WriteNGCode(jig, ch, _T("")); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_PRODUCT, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_OK, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_NG, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AA, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AB, FALSE); theDevicePDT_IF.MTP_LB_Set(jig, ch, CDevicePDT_IF::MTP_CH1_INSPECTION_RETRY_AC, FALSE); } } void CUnitCtrlBank::MTP_IF_LoadingStop_OnOff(JIG_ID jig) { if(theProcBank.LoadingStop_IsRequire()) { theDevicePDT_IF.MTP_LB_Set(jig, JIG_CH_1, CDevicePDT_IF::MTP_CH1_LOADING_STOP, TRUE); return; } for(int i = 0; i < JIG_CH_MAX; i++) { if(theProcBank.AZoneChannelNotUse_Check(jig, (JIG_CH)i)) theDevicePDT_IF.MTP_LB_Set(jig, (JIG_CH)i, CDevicePDT_IF::MTP_CH1_LOADING_STOP, TRUE); else theDevicePDT_IF.MTP_LB_Set(jig, (JIG_CH)i, CDevicePDT_IF::MTP_CH1_LOADING_STOP, FALSE); } } BOOL CUnitCtrlBank::PDT_IF_Servival_Check(JIG_ID jig) { return theDevicePDT_IF.PDT_LB_Get(jig, CDevicePDT_IF::PDT_SURVIVAL); } BOOL CUnitCtrlBank::PDT_IF_Able_Check(JIG_ID jig) { return theDevicePDT_IF.PDT_LB_Get(jig, CDevicePDT_IF::PDT_ABLE); } BOOL CUnitCtrlBank::PDT_IF_Start_Check(JIG_ID jig) { return theDevicePDT_IF.PDT_LB_Get(jig, CDevicePDT_IF::PDT_START); } BOOL CUnitCtrlBank::PDT_IF_Complete_Check(JIG_ID jig) { return theDevicePDT_IF.PDT_LB_Get(jig, CDevicePDT_IF::PDT_COMPLETE); } BOOL CUnitCtrlBank::PDT_IF_ArmStatus_Check(JIG_ID jig) { return theDevicePDT_IF.PDT_LB_Get(jig, CDevicePDT_IF::PDT_ARM_STATUS); } //kjparkk 20180131 PDT AB RULE 체크 기능 추가 BOOL CUnitCtrlBank::PDT_IF_RETRY_AB_Check(JIG_ID jig) { return theDevicePDT_IF.PDT_LB_Get(jig, CDevicePDT_IF::PDT_RETRY_AB_RLUE); } BOOL CUnitCtrlBank::PDT_IF_VacOnReq_Check(JIG_ID jig, JIG_CH ch) { return theDevicePDT_IF.PDT_LB_Get(jig, ch == JIG_CH_1 ? CDevicePDT_IF::PDT_CH1_VAC_ON_REQ:CDevicePDT_IF::PDT_CH2_VAC_ON_REQ); } BOOL CUnitCtrlBank::PDT_IF_VacOffReq_Check(JIG_ID jig, JIG_CH ch) { return theDevicePDT_IF.PDT_LB_Get(jig, ch == JIG_CH_1 ? CDevicePDT_IF::PDT_CH1_VAC_OFF_REQ:CDevicePDT_IF::PDT_CH2_VAC_OFF_REQ); } CString CUnitCtrlBank::PDT_IF_CellID_Read(JIG_ID jig, JIG_CH ch) { return theDevicePDT_IF.PDT_LW_ReadCellID(jig, ch); }
011fb970861c24252a5ddb93c49963587344a2fc
d62244cdf3f9edaac1efc0e6e39a3f749140bf68
/src/Common/Utils.h
fbafc6b0da1fdd4948c0b9946ff8782f30828b11
[]
no_license
wurui1994/BiliPlayer
640f6ad312e0be8a329c9aa47a124848636916cc
c4ddbf2550031d9da92e648a06f5a3293abec023
refs/heads/master
2020-03-29T08:39:50.003971
2019-04-03T13:38:33
2019-04-03T13:38:33
146,700,986
0
0
null
null
null
null
UTF-8
C++
false
false
4,652
h
Utils.h
#pragma once #include <QtWidgets/QWidget> #include <QtCore/QString> #include <QtCore/QTextStream> #include <QtWidgets/QMessageBox> #include <QtWidgets/QtWidgets> #define MsgBox() QMessageBox::information(NULL,__FILE__,__FUNCTION__) #define Debug() qDebug() << __FILE__ << __FUNCTION__ << __LINE__ struct Recent { Recent(QString s = QString(), QString t = QString(), int p = 0,int tt = 0) : path(s), title(t), time(p), totalTime(tt) {} operator QString() const { return path; } bool operator==(const Recent &recent) const { return (path == recent.path); } QString path; QString title; int time; int totalTime; }; class Comment { public: int mode = 0; int font; int color; qint64 time; qint64 date; QString sender; QString string; bool blocked; Comment() { mode = font = color = time = date = 0; blocked = false; } inline bool operator <(const Comment &o) const { return time < o.time; } inline bool operator==(const Comment &o) const { return mode == o.mode && font == o.font && color == o.color && qFuzzyCompare((float)time, (float)o.time) && date == o.date && sender == o.sender && string == o.string; } inline bool isLocal() const { return date == 0 && sender.isEmpty(); } inline bool isEmpty() const { return mode == 0 && font == 0 && color == 0 && time == 0 && date == 0 && sender.isEmpty() && string.isEmpty() && !blocked; } }; inline uint qHash(const Comment &c, uint seed = 0) { uint h = qHash(c.mode, seed); h = (h << 1) ^ qHash(c.font, seed); h = (h << 1) ^ qHash(c.color, seed); h = (h << 1) ^ qHash(c.date, seed); h = (h << 1) ^ qHash(c.sender, seed); h = (h << 1) ^ qHash(c.string, seed); return h; } class Record { public: bool full; qint64 delay; qint64 limit; QString source; QString string; QString access; QVector<Comment> danmaku; Record() { full = false; delay = limit = 0; } }; class MessageWidget :public QWidget { public: MessageWidget(QWidget* parent = nullptr, const QString& text = "", const QSize& size = QSize(200, 80), int timeout = 3000); // void setText(const QString& text); // void setSize(const QSize& size); // void setRect(const QRect& rect); // void setTimeOut(int timeout); // void show(); private: QLabel * m_label; QRect m_rect; QSize m_size; int m_timeout; }; // No need to be a class, like global function and constant value // but enclosed in a namespace namespace Utils { enum Site { Unknown, Bilibili, AcFun, Tudou, Letv, AcfunLocalizer, Niconico, TuCao, ASS }; enum Type { Video = 1, Audio = 2, Subtitle = 4, Danmaku = 8 }; Site parseSite(QString url); void setCenter(QWidget *widget); void setGround(QWidget *widget, QColor color); QString customUrl(Site site); QString decodeTxt(const QByteArray &data); QString decodeXml(QString string, bool fast = false); QString decodeXml(QStringRef ref, bool fast = false); QStringList getSuffix(int type, QString format = QString()); double evaluate(QString expression); // void MessageShow(QWidget* parent = nullptr, const QString& text = "", const QSize& size = QSize(200, 80), int timeout = 1500); // // platform specific QString VersionFileUrl(); // bool DimLightsSupported(); // void SetAlwaysOnTop(WId wid, bool); QString SettingsLocation(); bool IsValidFile(QString path); bool IsValidLocation(QString loc); // combined file and url void ShowInFolder(QString path, QString file); QString MonospaceFont(); // common bool IsValidUrl(QString url); QString FormatTime(int time); QString FormatRelativeTime(int time); QString FormatNumber(int val, int length); QString FormatNumberWithAmpersand(int val, int length); QString HumanSize(qint64); QString ShortenPathToParent(const Recent &recent); QStringList ToNativeSeparators(QStringList list); QStringList FromNativeSeparators(QStringList list); int GCD(int v, int u); QString Ratio(int w, int h); QString readFile(QString filePath); bool writeFile(QString filePath,QString content); // void asyncWebRequest(QString url, QString method = "get", QByteArray postData = "", std::function<void(const QString&)> callback = nullptr); // void asyncDownload(QString url,QString filePath, std::function<void(const QString&)> callback = nullptr); // QString filePath(QString fileName); // QString fileHash(QString fileName); // void openAppDataFolder(); }
78d6ae23b2cd3d13035c42d7e80c8d90137e361d
47f1b172aa4bf82afed7956742611b35983a24aa
/t5-neith/duilib/Layout/UISlideTabLayout.cpp
2c2fbb4ecd8bb76c188760c88d0d7bdc38758c95
[]
no_license
github188/TPS
92e4a822bd51e5d9f0cb8df9c3d85f2ca9bb958f
b45510bc37837feda19733bec9d3d821e9fc787a
refs/heads/master
2020-06-19T11:27:51.643398
2019-07-12T09:51:04
2019-07-12T09:51:04
196,691,872
0
1
null
2019-07-13T07:24:30
2019-07-13T07:24:29
null
GB18030
C++
false
false
7,689
cpp
UISlideTabLayout.cpp
#include "stdafx.h" #include "UISlideTabLayout.h" namespace DuiLib { CSlideTabLayoutUI::CSlideTabLayoutUI(): m_bIsVertical(false), m_bAnimating(false), m_iCurFrame(0 ) { } LPCTSTR CSlideTabLayoutUI::GetClass() const { return _T("SlideTabLayoutUI"); } LPVOID CSlideTabLayoutUI::GetInterface(LPCTSTR pstrName) { if( _tcscmp(pstrName, DUI_CTR_SLIDETABLAYOUT) == 0 ) return static_cast<CSlideTabLayoutUI*>(this); return CTabLayoutUI::GetInterface(pstrName); } bool CSlideTabLayoutUI::SelectItem(int iIndex) { if( iIndex < 0 || iIndex >= m_items.GetSize() ) return false; if( iIndex == m_iCurSel ) return true; if(iIndex > m_iCurSel ) m_nPositiveDirection = -1; if(iIndex < m_iCurSel ) m_nPositiveDirection = 1; m_bAnimating = true; m_iCurFrame = 0; RECT rcInset = GetInset(); m_rcCurPos = GetPos(); m_rcCurPos.left += rcInset.left; m_rcCurPos.top += rcInset.top; m_rcCurPos.right -= rcInset.right; m_rcCurPos.bottom -= rcInset.bottom; m_rcNextPos = m_rcCurPos; if(!m_bIsVertical ) //横向 { m_rcNextPos.left = m_rcCurPos.left - (m_rcCurPos.right - m_rcCurPos.left) * m_nPositiveDirection; m_rcNextPos.right = m_rcCurPos.right - (m_rcCurPos.right - m_rcCurPos.left) * m_nPositiveDirection; } else { m_rcNextPos.top = m_rcCurPos.top - (m_rcCurPos.bottom - m_rcCurPos.top) * m_nPositiveDirection; m_rcNextPos.bottom = m_rcCurPos.bottom - (m_rcCurPos.bottom - m_rcCurPos.top) * m_nPositiveDirection; } int iOldSel = m_iCurSel; m_iCurSel = iIndex; for(int it = 0; it < m_items.GetSize(); it++ ) { if(it == iIndex ) { m_pNextPage = GetItemAt(it); m_pNextPage->SetPos(m_rcNextPos); m_pNextPage->SetVisible(true); } else if(it == iOldSel ) { m_pCurPage = GetItemAt(it); m_pCurPage->SetVisible(true); } else GetItemAt(it)->SetVisible(false); } bool bIsTmier = m_pManager->SetTimer(this, TIMER_ANIMATION_ID, ANIMATION_ELLAPSE); if(m_pManager != NULL ) { //m_pManager->SetNextTabControl(); m_pManager->SendNotify(this, DUI_MSGTYPE_TABSELECT, m_iCurSel, iOldSel); } return true; } void CSlideTabLayoutUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) { if(_tcscmp(pstrName, _T("direction")) == 0 && _tcscmp(pstrValue, _T("vertical")) == 0 ) m_bIsVertical = true; // pstrValue = "vertical" or "horizontal" return CTabLayoutUI::SetAttribute(pstrName, pstrValue); } void CSlideTabLayoutUI::SetPos(RECT rc) { CControlUI::SetPos(rc); RECT rcInset = GetInset(); rc.left += rcInset.left; rc.top += rcInset.top; rc.right -= rcInset.right; rc.bottom -= rcInset.bottom; if(m_bAnimating) { int iStepLen = 0; if(m_iCurFrame >= ANIMATION_FRAME_COUNT ) { m_iCurFrame = 0; m_bAnimating = false; m_pManager->KillTimer(this, TIMER_ANIMATION_ID ); NeedParentUpdate(); return; } if(!m_bIsVertical ) //横向 { iStepLen = (rc.right - rc.left ) * m_nPositiveDirection / ANIMATION_FRAME_COUNT; if(m_iCurFrame != ANIMATION_FRAME_COUNT ) { //当前窗体地位 ::OffsetRect(&m_rcCurPos,iStepLen,0); m_pCurPage->SetPos(m_rcCurPos); //下一个窗体地位 ::OffsetRect(&m_rcNextPos,iStepLen,0); m_pNextPage->SetPos(m_rcNextPos); } else { m_pCurPage->SetVisible(false); ::OffsetRect(&m_rcCurPos,iStepLen,0); m_pCurPage->SetPos(m_rcCurPos); m_pNextPage->SetPos(rc); } } else //竖向 { iStepLen = (rc.bottom - rc.top ) * m_nPositiveDirection / ANIMATION_FRAME_COUNT; if(m_iCurFrame != ANIMATION_FRAME_COUNT ) { //当前窗体地位 ::OffsetRect(&m_rcCurPos,0,iStepLen); m_pCurPage->SetPos(m_rcCurPos); //下一个窗体地位 ::OffsetRect(&m_rcNextPos,0,iStepLen); m_pNextPage->SetPos(m_rcNextPos); } else { m_pCurPage->SetVisible(false); ::OffsetRect(&m_rcCurPos,0,iStepLen); m_pCurPage->SetPos(m_rcCurPos); m_pNextPage->SetPos(rc); } } m_iCurFrame ++; } else { for (int it = 0; it < GetCount(); it++) { CControlUI* pControl = GetItemAt(it); if (!pControl->IsVisible()) continue; if (pControl->IsFloat()) { SetFloatPos(it); continue; } if (it != GetCurSel()) continue; RECT rcPadding = pControl->GetPadding(); rc.left += rcPadding.left; rc.top += rcPadding.top; rc.right -= rcPadding.right; rc.bottom -= rcPadding.bottom; SIZE szAvailable = { rc.right - rc.left, rc.bottom - rc.top }; SIZE sz = pControl->EstimateSize(szAvailable); if (sz.cx == 0) { sz.cx = MAX(0, szAvailable.cx); } if (sz.cx < pControl->GetMinWidth()) sz.cx = pControl->GetMinWidth(); if (sz.cx > pControl->GetMaxWidth()) sz.cx = pControl->GetMaxWidth(); if (sz.cy == 0) { sz.cy = MAX(0, szAvailable.cy); } if (sz.cy < pControl->GetMinHeight()) sz.cy = pControl->GetMinHeight(); if (sz.cy > pControl->GetMaxHeight()) sz.cy = pControl->GetMaxHeight(); RECT rcCtrl = {rc.left, rc.top, rc.left + sz.cx, rc.top + sz.cy}; pControl->SetPos(rcCtrl); } } } void CSlideTabLayoutUI::DoEvent( TEventUI& event ) { if( event.Type == UIEVENT_TIMER && event.wParam == TIMER_ANIMATION_ID ) { OnTimer(event.wParam ); } else CContainerUI::DoEvent(event); } void CSlideTabLayoutUI::OnTimer( int nTimerID ) { OnSliderStep(); } void CSlideTabLayoutUI::OnSliderStep() { int iStepLen = 0; if(!m_bIsVertical ) //横向 { iStepLen = (m_rcItem.right - m_rcItem.left ) * m_nPositiveDirection / ANIMATION_FRAME_COUNT; if(m_iCurFrame != ANIMATION_FRAME_COUNT ) { //当前窗体地位 m_rcCurPos.left = m_rcCurPos.left + iStepLen; m_rcCurPos.right = m_rcCurPos.right +iStepLen; //下一个窗体地位 m_rcNextPos.left = m_rcNextPos.left + iStepLen; m_rcNextPos.right = m_rcNextPos.right +iStepLen; m_pCurPage->SetPos(m_rcCurPos); m_pNextPage->SetPos(m_rcNextPos); } else { m_pCurPage->SetVisible(false); m_pNextPage->SetPos(m_rcItem); } } else //竖向 { iStepLen = (m_rcItem.bottom - m_rcItem.top ) * m_nPositiveDirection / ANIMATION_FRAME_COUNT; if(m_iCurFrame != ANIMATION_FRAME_COUNT ) { //当前窗体地位 m_rcCurPos.top = m_rcCurPos.top + iStepLen; m_rcCurPos.bottom = m_rcCurPos.bottom +iStepLen; //下一个窗体地位 m_rcNextPos.top = m_rcNextPos.top + iStepLen; m_rcNextPos.bottom = m_rcNextPos.bottom +iStepLen; m_pCurPage->SetPos(m_rcCurPos); m_pNextPage->SetPos(m_rcNextPos); } else { m_pCurPage->SetVisible(false); m_pNextPage->SetPos(m_rcItem); } } //NeedParentUpdate(); if(m_iCurFrame == ANIMATION_FRAME_COUNT ) { NeedParentUpdate(); m_pManager->KillTimer(this, TIMER_ANIMATION_ID ); } else { NeedUpdate(); m_iCurFrame ++; } } }
1fa57cf9f50989ecaac89892ec050516aafd79fa
424c540b5865015e67783944f8fbdac659e42431
/mylist.cpp
33555649b5f0e1b2c86f626d80d34295bdc60bdb
[]
no_license
mpavlichenko/FifteenPlus
661993cefe6d492f437a7e8ec9eb0462f901a68d
d178c4c3beadcdd818d1cc3338cd76c70d69b11d
refs/heads/master
2020-04-15T15:13:42.522247
2015-09-07T07:38:06
2015-09-07T07:38:06
42,036,402
0
0
null
null
null
null
UTF-8
C++
false
false
139
cpp
mylist.cpp
#include "mylist.h" #include <QDebug> MyList::MyList(int someText, QString someColor): someColor(someColor), someText(someText) { }
2b659734463dc73480518134ea7abb475e5290c9
dace6e1bc4e4402837d2a36765615ae4011f5773
/webupdate-blink/webupdate-blink.ino
5a83e22d2151144083f65c6cd9afba14f5cbbc38
[]
no_license
Yoimer/nodemcu
0dbc515050ce709de816c7a8ef5a6459e8e59a41
722f1fc66d6f7e385d0f557faf3ae336603a18ef
refs/heads/master
2021-01-20T01:28:10.663355
2018-10-11T13:06:22
2018-10-11T13:06:22
89,283,559
3
1
null
null
null
null
UTF-8
C++
false
false
8,424
ino
webupdate-blink.ino
/* To upload through terminal you can use: curl -F "image=@firmware.bin" esp8266-webupdate.local/update */ #include <ESP8266WiFi.h> #include <WiFiClient.h> #include <ESP8266WebServer.h> #include <ESP8266mDNS.h> #include <ESP8266WiFiMulti.h> #include <ESP8266HTTPClient.h> ESP8266WiFiMulti WiFiMulti; const char* host = "esp8266-webupdate"; const char* ssid = "Casa"; const char* password = "remioy2006202"; bool isIncontact = false; bool isAuthorized = false; char currentLine[500] = ""; int currentLineIndex = 0; bool nextLineIsMessage = false; bool nextValidLineIsCall = false; String PhoneCallingIndex = ""; String PhoneCalling = ""; String OldPhoneCalling = ""; String BuildString = ""; String lastLine = ""; String id = ""; String phonenum = ""; int firstComma = -1; int prende = 0; int secondComma = -1; String Password = ""; int thirdComma = -1; int forthComma = -1; int fifthComma = -1; int firstQuote = -1; int secondQuote = -1; int swveces = 0; int len = -1; int j = -1; int i = -1; int f = -1; int r = 0; bool isInPhonebook = false; int x = 0; int8_t answer; unsigned long xprevious; char contact[13]; ESP8266WebServer server(80); const char* serverIndex = "<form method='POST' action='/update' enctype='multipart/form-data'><input type='file' name='update'><input type='submit' value='Update'></form>"; void setup(void){ Serial.begin(115200); Serial.println(); Serial.println("Booting Sketch..."); WiFi.mode(WIFI_AP_STA); WiFi.begin(ssid, password); if(WiFi.waitForConnectResult() == WL_CONNECTED){ MDNS.begin(host); server.on("/", HTTP_GET, [](){ server.sendHeader("Connection", "close"); server.sendHeader("Access-Control-Allow-Origin", "*"); server.send(200, "text/html", serverIndex); }); server.on("/update", HTTP_POST, [](){ server.sendHeader("Connection", "close"); server.sendHeader("Access-Control-Allow-Origin", "*"); server.send(200, "text/plain", (Update.hasError())?"FAIL":"OK"); ESP.restart(); },[](){ HTTPUpload& upload = server.upload(); if(upload.status == UPLOAD_FILE_START){ Serial.setDebugOutput(true); WiFiUDP::stopAll(); Serial.printf("Update: %s\n", upload.filename.c_str()); uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000; if(!Update.begin(maxSketchSpace)){//start with max available size Update.printError(Serial); } } else if(upload.status == UPLOAD_FILE_WRITE){ if(Update.write(upload.buf, upload.currentSize) != upload.currentSize){ Update.printError(Serial); } } else if(upload.status == UPLOAD_FILE_END){ if(Update.end(true)){ //true to set the size to the current progress Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize); } else { Update.printError(Serial); } Serial.setDebugOutput(false); } yield(); }); server.begin(); MDNS.addService("http", "tcp", 80); Serial.printf("Ready! Open http://%s.local in your browser\n", host); } else { Serial.println("WiFi Failed"); } pinMode(LED_BUILTIN, OUTPUT); //Serial.begin(115200); Serial.println("Starting SIM800 Module..."); power_on(); delay(3000); Serial.println("Connecting to the network..."); while ( (sendATcommand("AT+CREG?", "+CREG: 0,1", 5000,0) || sendATcommand("AT+CREG?", "+CREG: 0,5", 5000,0)) == 0 ); sendATcommand("AT+CMGF=1", "OK", 5000,0); sendATcommand("AT+CNMI=1,2,0,0,0", "OK", 5000,0); sendATcommand("AT+CPBR=1,1", "OK\r\n", 5000,1); Serial.println("Password:"); Serial.println(Password); } void loop(void){ /*server.handleClient(); delay(1);*/ char msgx[1024]; char telx[1024]; GetInfoFromWeb(0); // +ID#XXXXXXXXXX$MENSAJE // +9999#9999999999$ id = BuildString.substring(BuildString.indexOf("+")+1,BuildString.indexOf("#")); String tel = BuildString.substring(BuildString.indexOf("#")+1,BuildString.indexOf("$")); String msg = BuildString.substring(BuildString.indexOf("$")+1); Serial.println("id :"+id); Serial.println("tel:"+tel); Serial.println("msg:"+msg); if ( tel != "99999999999") { strcpy(telx, tel.c_str()); strcpy(msgx, msg.c_str()); sendSMS (telx,msgx) ; GetInfoFromWeb(1); } } void power_on() /////////////////////////////////////////////////////// { uint8_t answer = 0; answer = sendATcommand("AT", "OK", 5000,0); if (answer == 0) { while (answer == 0) { answer = sendATcommand("AT", "OK", 2000,0); } } } /////////////////////////////////////////////////////// int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout,int xpassword) /////////////////////////////////////////////////////// { uint8_t x = 0, answer = 0; char response[100]; unsigned long previous; memset(response, '\0', 100); delay(100); while (Serial.available()) { Serial.read(); } Serial.println(ATcommand); x = 0; previous = millis(); do { if (Serial.available() != 0) { response[x] = Serial.read(); x++; if (strstr(response, expected_answer) != NULL) { answer = 1; String numbFromSim = String(response); numbFromSim = numbFromSim.substring(numbFromSim.indexOf(":"), numbFromSim.indexOf(",129,")); numbFromSim = numbFromSim.substring((numbFromSim.indexOf(34) + 1), numbFromSim.indexOf(34, numbFromSim.indexOf(34) + 1)); if ( xpassword == 1) { numbFromSim = numbFromSim.substring( 0,4); Password = numbFromSim ; return 0; } else { numbFromSim = numbFromSim.substring( 0,11 ); } } } } while ((answer == 0) && ((millis() - previous) < timeout)); return answer; } //////////////////////////////////////////////////////// int sendSMS(char *phone_number, char *sms_text) /////////////////////////////////////////////////////// { char aux_string[30]; //char phone_number[] = "04168262667"; // ********* is the number to call //char sms_text[] = "Test-Arduino-Hello World"; Serial.print("Setting SMS mode..."); sendATcommand("AT+CMGF=1", "OK", 5000,0); // sets the SMS mode to text Serial.println("Sending SMS"); sprintf(aux_string, "AT+CMGS=\"%s\"", phone_number); answer = sendATcommand(aux_string, ">", 20000,0); // send the SMS number if (answer == 1) { Serial.println(sms_text); Serial.write(0x1A); answer = sendATcommand("", "OK", 20000,0); if (answer == 1) { Serial.println("Sent "); } else { Serial.println("error "); } } else { Serial.println("error "); Serial.println(answer, DEC); } return answer; } ///////////////////////////////////////////////////////////////////////////// void clearBuffer() ///////////////////////////////////////////////////////////////////////////// { byte w = 0; for (int i = 0; i < 10; i++) { while (Serial.available() > 0) { char k = Serial.read(); w++; delay(1); } delay(1); } } //////////////////////////////////////////////////////////////////// int GetInfoFromWeb (int router) { server.handleClient(); delay(10000); String xp; if((WiFiMulti.run() == WL_CONNECTED) ) { Serial.println("[++++++GetInfoFromWeb+++++++"); xp="http://correosmasivos-com-ve.alpha.ioticos.com/readmensajetexto.php?sw=1"; if (router == 1) { xp="http://correosmasivos-com-ve.alpha.ioticos.com/readmensajetexto.php?sw=2&id="+id; } Serial.println(xp); HTTPClient http; http.begin(xp); int httpCode = http.GET(); if(httpCode > 0) { if(httpCode == HTTP_CODE_OK) { BuildString = http.getString(); } } else { Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str()); } http.end(); } }
57ae21ef80dd618654c4a7c5d40816dbf7996fc6
38774bbe5122c4a4328f9a5e6e9f53e8e9b54df9
/misc/listpd.h
cece4b08381096d809659b9d021b8728a3e2dcb1
[]
no_license
Malows/aedcode
b2964985712e4f21cc701545bb341a942e97cd55
1b9dc6160b989a7699e8d48049ca6ffb78b24de4
refs/heads/master
2021-01-18T11:01:32.422219
2011-10-22T00:57:05
2011-10-22T00:57:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
285
h
listpd.h
// -*- mode: c++ -*- //__INSERT_LICENSE__ // $Id: listpd.h,v 1.1 2004/02/23 01:16:39 mstorti Exp $ #ifndef AED_LISTPD_H #define AED_LISTPD_H #define iterator_t list_dbl_iterator #define cell list_dbl_cell #define list list_dbl #define elem_t double #include <aedsrc/listp.h> #endif
54e253d68205bbbd8e88e39d8b529f9cf4127044
737a9d8471e4112d9bd2f839850d0f7fe55bfa66
/addons/vanguard/CfgVehicles.hpp
26939c04c9da365503acf9cac80ce75316dc4573
[]
no_license
Theseus-Aegis/Units
ab325d6701ae8066bc554530ec774d177a9e098a
55311d018de6abf88db5b8337be18d2b989759ef
refs/heads/master
2023-08-14T02:31:54.082280
2023-08-13T19:53:20
2023-08-13T19:53:20
189,776,167
4
13
null
2023-09-13T11:10:04
2019-06-01T20:46:51
C++
UTF-8
C++
false
false
843
hpp
CfgVehicles.hpp
class CfgVehicles { #include "\x\tacu\addons\assets\script_classes_vehicles.hpp" // Base Classes class TACU_Main_U_INDEP_Soldier_Base; #include "independent\CfgVehicles_Contractors_Green.hpp" #include "independent\CfgVehicles_Contractors_Sand.hpp" #include "independent\CfgVehicles_Contractors_Winter.hpp" #include "independent\CfgVehicles_Specialists.hpp" #include "opfor\CfgVehicles_Contractors_Green.hpp" #include "opfor\CfgVehicles_Contractors_Sand.hpp" #include "opfor\CfgVehicles_Contractors_Winter.hpp" #include "opfor\CfgVehicles_Specialists.hpp" #include "independent\CfgVehicles_Vehicles.hpp" #include "opfor\CfgVehicles_Vehicles.hpp" #include "independent\CfgVehicles_Turrets.hpp" #include "opfor\CfgVehicles_Turrets.hpp" #include "CfgVehicles_Backpacks.hpp" };
dbb09910df2cd6284fd6078207925d9ce2e03916
a0be71e84272af17e3f9c71b182f782c35a56974
/Image/App/ImageBase.cpp
9f8dea88f60f96f05f01521cc953c08121385f61
[]
no_license
PrLayton/SeriousFractal
52e545de2879f7260778bb41ac49266b34cec4b2
ce3b4e98d0c38fecf44d6e0715ce2dae582c94b2
refs/heads/master
2021-01-17T19:26:33.265924
2016-07-22T14:13:23
2016-07-22T14:13:23
60,533,401
3
0
null
null
null
null
UTF-8
C++
false
false
10,192
cpp
ImageBase.cpp
/*************************************************************************** * * * This is a class for holding and handling basic image data * * * * Author: Graeme van der Vlugt * * Copyright: Imetric 3D GmbH * * Year: 2004 * * * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * for detail see the LICENCE text file. * * * ***************************************************************************/ #include "PreCompiled.h" #ifndef _PreComp_ # include <cmath> # include <cstring> #endif #include "ImageBase.h" #include <Base/Exception.h> using namespace Image; // Constructor (constructs an empty image) ImageBase::ImageBase() { _pPixelData = NULL; _owner = true; _width = 0; _height = 0; _setColorFormat(IB_CF_GREY8, 8); } // Destructor ImageBase::~ImageBase() { try { clear(); } catch(...) {} } // Copy constructor ImageBase::ImageBase(const ImageBase &rhs) { // Do the copy if (rhs._owner == true) { // rhs is the owner - do a deep copy _pPixelData = NULL; _owner = false; // avoids a superfluous delete if (createCopy((void *)(rhs._pPixelData), rhs._width, rhs._height, rhs._format, rhs._numSigBitsPerSample) != 0) throw Base::Exception("ImageBase::ImageBase. Error creating copy of image"); } else { // rhs is not the owner - do a shallow copy _pPixelData = rhs._pPixelData; _owner = rhs._owner; _width = rhs._width; _height = rhs._height; _setColorFormat(rhs._format, rhs._numSigBitsPerSample); } } // = operator ImageBase & ImageBase::operator=(const ImageBase &rhs) { if (this == &rhs) return *this; // Implement any deletion necessary clear(); // Do the copy if (rhs._owner == true) { // rhs is the owner - do a deep copy _owner = false; // avoids a superfluous delete if (createCopy((void *)(rhs._pPixelData), rhs._width, rhs._height, rhs._format, rhs._numSigBitsPerSample) != 0) throw Base::Exception("ImageBase::operator=. Error creating copy of image"); } else { // rhs is not the owner - do a shallow copy _pPixelData = rhs._pPixelData; _owner = rhs._owner; _width = rhs._width; _height = rhs._height; _setColorFormat(rhs._format, rhs._numSigBitsPerSample); } return *this; } // Clears the image data // It only deletes the pixel data if this object is the owner of the data void ImageBase::clear() { // If object is the owner of the data then delete the allocated memory if (_owner == true) { delete [] _pPixelData; _pPixelData = NULL; } // Else just reset the pointer (the owner of the pixel data must be responsible for deleting it) else { _pPixelData = NULL; } // Re-initialise the other variables _owner = true; _width = 0; _height = 0; _setColorFormat(IB_CF_GREY8, 8); } // Sets the color format and the dependent parameters // Returns 0 for OK, -1 for invalid color format int ImageBase::_setColorFormat(int format, unsigned short numSigBitsPerSample) { switch (format) { case IB_CF_GREY8: _numSamples = 1; _numBitsPerSample = 8; _numBytesPerPixel = 1; break; case IB_CF_GREY16: _numSamples = 1; _numBitsPerSample = 16; _numBytesPerPixel = 2; break; case IB_CF_GREY32: _numSamples = 1; _numBitsPerSample = 32; _numBytesPerPixel = 4; break; case IB_CF_RGB24: _numSamples = 3; _numBitsPerSample = 8; _numBytesPerPixel = 3; break; case IB_CF_RGB48: _numSamples = 3; _numBitsPerSample = 16; _numBytesPerPixel = 6; break; case IB_CF_BGR24: _numSamples = 3; _numBitsPerSample = 8; _numBytesPerPixel = 3; break; case IB_CF_BGR48: _numSamples = 3; _numBitsPerSample = 16; _numBytesPerPixel = 6; break; case IB_CF_RGBA32: _numSamples = 4; _numBitsPerSample = 8; _numBytesPerPixel = 4; break; case IB_CF_RGBA64: _numSamples = 4; _numBitsPerSample = 16; _numBytesPerPixel = 8; break; case IB_CF_BGRA32: _numSamples = 4; _numBitsPerSample = 8; _numBytesPerPixel = 4; break; case IB_CF_BGRA64: _numSamples = 4; _numBitsPerSample = 16; _numBytesPerPixel = 8; break; default: return -1; } if ((numSigBitsPerSample == 0) || (numSigBitsPerSample > _numBitsPerSample)) _numSigBitsPerSample = _numBitsPerSample; else _numSigBitsPerSample = numSigBitsPerSample; _format = format; return 0; } // Allocate own space for an image based on the current color space and image size parameters // Returns: // 0 for OK // -1 for error int ImageBase::_allocate() { // Check that pixel data pointer is null if (_pPixelData != NULL) return -1; // Allocate the space needed to store the pixel data _owner = true; try { _pPixelData = new unsigned char [_width * _height * _numBytesPerPixel]; } catch(...) { // memory allocation error return -1; } return 0; } // Load an image by copying the pixel data // This object will take ownership of the copied pixel data // (the source image is still controlled by the caller) // If numSigBitsPerSample = 0 then the full range is assumed to be significant // Returns: // 0 for OK // -1 for invalid color format // -2 for memory allocation error int ImageBase::createCopy(void* pSrcPixelData, unsigned long width, unsigned long height, int format, unsigned short numSigBitsPerSample) { // Clear any existing data clear(); // Set the color format and the dependent parameters if (_setColorFormat(format, numSigBitsPerSample) != 0) return -1; // Set the image size _width = width; _height = height; // Allocate our own memory for the pixel data if (_allocate() != 0) { clear(); return -2; } // Copy the pixel data memcpy((void *)_pPixelData, pSrcPixelData, _width * _height * _numBytesPerPixel); return 0; } // Make this object point to another image source // If takeOwnership is false then: // This object will not own (control) or copy the pixel data // (the source image is still controlled by the caller) // Else if takeOwnership is true then: // This object will take ownership (control) of the pixel data // (the source image is not (should not be) controlled by the caller anymore) // In this case the memory must have been allocated with the new operator (because this class will use the delete operator) // If numSigBitsPerSample = 0 then the full range is assumed to be significant // Returns: // 0 for OK // -1 for invalid color format int ImageBase::pointTo(void* pSrcPixelData, unsigned long width, unsigned long height, int format, unsigned short numSigBitsPerSample, bool takeOwnership) { // Clear any existing data clear(); // Set the color format and the dependent parameters if (_setColorFormat(format, numSigBitsPerSample) != 0) return -1; // Set the image size _width = width; _height = height; // Point to the source pixel data _owner = false; _pPixelData = (unsigned char *)pSrcPixelData; // Flag ownership if (takeOwnership == true) _owner = true; else _owner = false; return 0; } // Gets the value of a sample at the given pixel position // Returns 0 for valid value or -1 if coordinates or sample index are out of range or // if there is no image data int ImageBase::getSample(int x, int y, unsigned short sampleIndex, double &value) { if ((_pPixelData == NULL) || (sampleIndex >= _numSamples) || (x < 0) || (x >= (int)_width) || (y < 0) || (y >= (int)_height)) return -1; // Get pointer to sample switch (_format) { case IB_CF_GREY8: case IB_CF_RGB24: case IB_CF_BGR24: case IB_CF_RGBA32: case IB_CF_BGRA32: { unsigned char* pSample = _pPixelData + _numSamples * (y * _width + x) + sampleIndex; value = (double)(*pSample); } break; case IB_CF_GREY16: case IB_CF_RGB48: case IB_CF_BGR48: case IB_CF_RGBA64: case IB_CF_BGRA64: { uint16_t* pPix16 = (uint16_t *)_pPixelData; uint16_t* pSample = pPix16 + _numSamples * (y * _width + x) + sampleIndex; value = (double)(*pSample); } break; case IB_CF_GREY32: { uint32_t* pPix32 = (uint32_t *)_pPixelData; uint32_t* pSample = pPix32 + y * _width + x; value = (double)(*pSample); } break; default: return -1; } return 0; }
a003fd79c19589e3209bbf599ce63daa25930443
9e080bbd5d0d553a0a29bde28bb4eb21f5b87a90
/temp/Set/Set/MTest.h
327a03b83f6c78afcce6fdcdc1025fb23f50c047
[]
no_license
ored95/OOP
710c1fa8fae775d4f852c40237938add078b7ab1
e1507cf826e6b51175e2dcb6f943b212c9f770d1
refs/heads/master
2021-06-19T12:05:23.140015
2017-06-28T22:58:03
2017-06-28T22:58:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
171
h
MTest.h
#pragma once #include "MSet.h" class MTest { public: char c; }; enum eType {TInt, TDouble, TClass}; void PrintSet(const MBase *set, eType type); #include "MTest.hpp"
c3784ad672f5de9df2784c8593d0d773cd006ab1
3434b3267f31bbde89fc55002c8c9d60c347aef4
/kp2/exhibit.hpp
771805b101e7c06deb1242980021ce0638d08c6d
[]
no_license
AnastasiiaLatysh/KPI-OOP
aea3af3e0a76155c21a43a91a76649b308d5718c
ba33d1015a11d21048b1555bbe30c7ce0dbe38e5
refs/heads/master
2020-05-09T14:37:00.338896
2019-04-13T16:43:55
2019-04-13T16:43:55
181,200,912
0
0
null
null
null
null
UTF-8
C++
false
false
2,159
hpp
exhibit.hpp
#include <iostream> using namespace std; class Exhibit { char *name; int length, width; Address address; public: Exhibit(); Exhibit(char*, int, int, Address); Exhibit(Exhibit&); ~Exhibit(); Exhibit& setName(char*); Exhibit& setLength(int); Exhibit& setWidth(int); Exhibit& setAddress(Address); char* getName(); int getLength(); int getWidth(); Address * getAddress(); void printFullInfo(); void printShortInfo(); }; Exhibit::Exhibit() { name=new char[20]; strcpy(name, "noExhibitName"); width = 0; length = 0; address = *new Address(); } Exhibit::Exhibit(char* nName, int wWidth, int lLength, Address aAddress) { name=new char[strlen(nName) + 1]; strcpy(name, nName); width = wWidth; length = lLength; address = * new Address(aAddress); } Exhibit::Exhibit(Exhibit&exhibit){ width = exhibit.width; length = exhibit.length; name = new char[strlen(exhibit.name) + 1]; strcpy(name, exhibit.name); address = exhibit.address; }; Exhibit::~Exhibit() { if(this->address.getCityName()) this->address = * new Address; if(name) delete[] name; }; Exhibit& Exhibit::setName(char*nName){ delete[] name; name=new char[strlen(nName)+1]; strcpy(name, nName); return *this; }; Exhibit& Exhibit::setWidth(int wWidth){ width = wWidth; return *this;}; Exhibit& Exhibit::setLength(int lLength){ length = lLength; return *this;}; Exhibit& Exhibit::setAddress(Address aAddress){address = aAddress; return *this;}; char* Exhibit::getName(){return name;}; int Exhibit::getWidth(){return width;}; int Exhibit::getLength(){return length;}; Address * Exhibit::getAddress(){return &address;}; void Exhibit::printFullInfo(){ cout << endl<< "Exhibit is: name - " << name << ", width - " << width << ", length - " << length << endl; cout << "Address of exibit is: " << endl; address.printFullInfo(); }; void Exhibit::printShortInfo(){ cout << endl << "Class name is Exibit. Name is " << name << endl; cout << "Address of exibit is: " << endl; address.printShortInfo(); };
ea97923c5d8c074737e595622884df565aac8450
1f5079b24785a0e6a8bef1f15e1bca939e94ba56
/Dev/C++/Mascaret/include/VEHA/Behavior/Activity/Activity.h
77efb50130ea1ea4b56d1fd34834c9663b561954
[]
no_license
querrec/Mascaret
7d5d0628dfb93226a602f79a7a974c14a60a88e8
c71eba3667b3e3fa8a0b18a1f40219aee358c968
refs/heads/master
2021-01-17T08:12:10.024097
2016-04-14T13:27:52
2016-04-14T13:27:52
25,727,699
0
5
null
null
null
null
UTF-8
C++
false
false
1,952
h
Activity.h
#ifndef _v2_VEHA_Behavior_Activity_Activity_H #define _v2_VEHA_Behavior_Activity_Activity_H #include "Tools/veha_plateform.h" #include "VEHA/Behavior/Common/Behavior.h" #include "VEHA/Behavior/Activity/ActivityNode.h" #include "VEHA/Behavior/Activity/ActivityPartition.h" #include "VEHA/Behavior/Activity/ActivityEdge.h" namespace VEHA { class VEHA_API Activity : public Behavior { public : Activity(const string& name); virtual ~Activity(); protected : vector< shared_ptr<ActivityNode> > _node; vector< shared_ptr<ActivityPartition> > _partitions; vector< shared_ptr<ActivityEdge> > _edges; shared_ptr<ActivityNode> _initial; public : inline vector< shared_ptr<ActivityNode> > getNode(void) { return _node;} inline shared_ptr<ActivityNode> getNode_at(int index) { return _node[index];} inline void addNode(shared_ptr<ActivityNode> value) { _node.push_back(value); value->setActivity(shared_dynamic_cast<Activity>(shared_from_this())); } inline vector< shared_ptr<ActivityPartition> > getPartition(void) { return _partitions;} inline shared_ptr<ActivityPartition> getPartition_at(int index) { return _partitions[index];} inline void addPartition(shared_ptr<ActivityPartition> value) { _partitions.push_back(value); value->setActivity(shared_dynamic_cast<Activity>(shared_from_this())); } inline vector< shared_ptr<ActivityEdge> > getEdge(void) { return _edges;} inline shared_ptr<ActivityEdge> getEdge_at(int index) { return _edges[index];} inline void addEdge(shared_ptr<ActivityEdge> value) { _edges.push_back(value); value->setActivity(shared_dynamic_cast<Activity>(shared_from_this())); } inline void setInitialNode(shared_ptr<ActivityNode> initial) {_initial = initial;} inline shared_ptr<ActivityNode> getInitialNode(void) { return _initial;} virtual shared_ptr<BehaviorExecution> createBehaviorExecution(shared_ptr<InstanceSpecification> host,const Parameters& p, bool sync =false); }; } #endif
b395d6b4480fa9cc8db66800309fb82ddea2b46a
b728c792b5171f6be6ad91919b4a76a6f198b3e9
/src/lib/datasrc/tests/memory/memory_segment_mock.h
39c0d1ff605c1a0b085d38586655aedf0a0a4f65
[ "LicenseRef-scancode-unknown-license-reference", "ISC", "BSL-1.0" ]
permissive
bundy-dns/bundy
c8beeca2c051924590794c92a3a58d1980a86024
3d41934996b82b0cd2fe22dd74d2abc1daba835d
refs/heads/master
2021-09-28T16:24:39.037808
2021-09-22T06:04:17
2021-09-22T06:04:17
19,160,469
110
33
NOASSERTION
2021-09-22T06:04:18
2014-04-25T20:54:37
C++
UTF-8
C++
false
false
2,283
h
memory_segment_mock.h
// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. #ifndef DATASRC_MEMORY_SEGMENT_TEST_H #define DATASRC_MEMORY_SEGMENT_TEST_H 1 #include <util/memory_segment_local.h> #include <cstddef> // for size_t #include <new> // for bad_alloc namespace bundy { namespace datasrc { namespace memory { namespace test { // A special memory segment that can be used for tests. It normally behaves // like a "local" memory segment. If "throw count" is set to non 0 via // setThrowCount(), it continues the normal behavior until the specified // number of calls to allocate(), exclusive, and throws an exception at the // next call. For example, if count is set to 3, the next two calls to // allocate() will succeed, and the 3rd call will fail with an exception. // This segment object can be used after the exception is thrown, and the // count is internally reset to 0. class MemorySegmentMock : public bundy::util::MemorySegmentLocal { public: MemorySegmentMock() : throw_count_(0) {} virtual void* allocate(std::size_t size) { if (throw_count_ > 0) { if (--throw_count_ == 0) { throw std::bad_alloc(); } } return (bundy::util::MemorySegmentLocal::allocate(size)); } void setThrowCount(std::size_t count) { throw_count_ = count; } private: std::size_t throw_count_; }; } // namespace test } // namespace memory } // namespace datasrc } // namespace bundy #endif // DATASRC_MEMORY_SEGMENT_TEST_H // Local Variables: // mode: c++ // End:
027714d021151cb6df7a043704f3dbf3f801442b
0f8d6679c49d26149201ef741800d82bf7dc006f
/MotorControl/Diagnostics.ino
e8d97f34d4aed4c31218bead8cfd2adc56ecfad2
[]
no_license
GeoGenesis/delicious-sky-cake
21ff3e298e16d8a1939ba5cb4aae2f73ee5e2229
fb30c157cc692172f86262290ea3e1518c7425d2
refs/heads/master
2016-08-12T22:29:16.345204
2016-04-07T10:18:43
2016-04-07T10:18:43
50,645,488
1
0
null
null
null
null
UTF-8
C++
false
false
2,733
ino
Diagnostics.ino
/* Code written by GEORGE GOODSELL Student ID: 120015759 City University, 2016 THESIS WORK */ void speedTest(){ //============================ // Servo Max Speed Test - // Assesses the Servo's maximum response time between changes // Uses customDiag() function to test max speed by decreasing delays between steps (shift states) //============================ //Testing Variables int _start = 0; // Starting Angle - DEFAULT: 0 int _end = 180; // End Angle - DEFAULT: 180 int inc = 45; // Increment angle - DEFAULT: 45 // Left to Right rotation Serial.println("========== Servo Response Time Test ========== "); Serial.println(""); // ---- Low respnse time Serial.println("1000-500 millisecond Response Time"); customDiag(_start, _end, inc, 1000); // 1 second step customDiag(_start, _end, inc, 750); // .75 seconds step customDiag(_start, _end, inc, 500); // .50 seconds step // ---- Mid response time Serial.println("500-200 millisecond Response Time"); customDiag(_start, _end, inc, 333); // .33 seconds step customDiag(_start, _end, inc, 250); // .25 seconds step customDiag(_start, _end, inc, 200); // .20 second step // ---- Fast response time Serial.println("150-75 millisecond Response Time"); customDiag(_start, _end, inc, 150); // .15 second step customDiag(_start, _end, inc, 100); // .1 second step customDiag(_start, _end, inc, 75); // .075 second step Serial.println(""); // Right to Left rotation // ---- Low respnse time Serial.println("1000-500 millisecond Response Time"); customDiag(_end, _start, inc, 1000); // 1 second step customDiag(_end, _start, inc, 750); // .75 seconds step customDiag(_end, _start, inc, 500); // .50 seconds step Serial.println("500-200 millisecond Response Time"); // ---- Mid response time customDiag(_end, _start, inc, 333); // .33 seconds step customDiag(_end, _start, inc, 250); // .25 seconds step customDiag(_end, _start, inc, 200); // .20 second step // ---- Fast response time Serial.println("150-75 millisecond Response Time"); customDiag(_end, _start, inc, 150); // .15 second step customDiag(_end, _start, inc, 100); // .1 second step customDiag(_end, _start, inc, 75); // .075 second step Serial.println(""); } void angleTest() { //============================ // Servo Angle Range Test - // Assesses the Servo Head's angular reach (in degrees) // Uses customDiag() function to test max range of servo //============================ int _start = 0; // Starting Angle - DEFAULT: 0 int _end = 180; // End Angle - DEFAULT: 180 int inc = 45; // Increment angle - DEFAULT: 10 customDiag(_end, _start, inc, 1000); }
8384b7a3a8e97ece17a0547d065b54e59b18eca5
572a29d90ac817d249d0b9f805a7e3cebbd2e9a6
/spaceshark.ino
9ff6bbb35ea407a15730b6272aa06f22b9dcb85b
[ "MIT" ]
permissive
talhaahmad96/spaceshark-firmware
42e537ab24bc16bd466ac53be727d8a80db29301
3bece9e5a0f25e2ba2ac7d03f2d87da49a6412ef
refs/heads/master
2020-03-28T03:58:48.829745
2018-09-03T00:28:41
2018-09-03T00:28:41
147,686,475
0
0
MIT
2018-09-06T14:29:45
2018-09-06T14:29:44
null
UTF-8
C++
false
false
5,691
ino
spaceshark.ino
// Space Shark microcontroller firmware for Particle Photon // See project pages at http://github.com/spaceshark #include "TinyStepper_28BYJ_48.h" // Define stepper motor pin connections const int MOTOR_IN1_PIN = 1; const int MOTOR_IN2_PIN = 2; const int MOTOR_IN3_PIN = 3; const int MOTOR_IN4_PIN = 4; // Constant values defining the value ranges for the alt-az coordinate system: const float alt_min = -90.0; const float alt_max = 90.0; const float az_min = 0.0; const float az_max = 360.0; // Create servo motor instances: Servo servo_alt; TinyStepper_28BYJ_48 stepper_az; // These are used to track how long ago each motor had its pointing updated: float lastUpdate_alt = millis(); float lastUpdate_az = millis(); float stepper_pos = 0; // The following values are particular to the hardware. Every servo motor is // a bit different, so the alt and az motors need to be calibrated for their // maximum and minimum angles. The values below are the ones given to the servo // 'write' function, which attempts to send control signals matching the angles // but will be slightly off. These need to be found empirically, e.g. by // setting the initial pointing to the min and max alt/az angles and then // nudging these limits either side of their nominal values. const float limit_alt_lo = 103.0; // Nominally 90.0 const float limit_alt_hi = 9.0; // Nominally 0.0 const float limit_az_lo = 0; // Nominally 0.0 const float limit_az_hi = 2048; // Nominally 360.0 // Set the intial pointing and track rate to use when the Shark is powered on: float posVal_sky_alt = 0.0; // 0 degrees is horizon, 90 degrees is zenith float posVal_sky_az = 0.0; // 0 degrees is north, 90 degrees is east float trackRate_alt = 0.0; // in degrees per second float trackRate_az = 0.0; // in degrees per second int optoInt_Val = 0; bool hasHomed = false; void setup() { // Define servo output pins and register cloud functions: servo_alt.attach(A4); stepper_az.connectToPins(MOTOR_IN1_PIN, MOTOR_IN2_PIN, MOTOR_IN3_PIN, MOTOR_IN4_PIN); Particle.function("point_alt_az", point_alt_az); Particle.function("track_alt", track_alt); Particle.function("track_az", track_az); Serial.begin(9600); pinMode(D7,OUTPUT); pinMode(A0,INPUT); } void loop() { if (hasHomed == true) { // This is the main loop, which never stops updating the pointning angles // based on the current tracking rate. update_pointing(); set_pos(posVal_sky_alt, posVal_sky_az); delay(50); } else { optoInt_Val = analogRead(A0); Serial.println(optoInt_Val); if (optoInt_Val <= 1000) { hasHomed = true; } else { signed int x; x = -64; stepper_az.setSpeedInStepsPerSecond(2048); stepper_az.setAccelerationInStepsPerSecondPerSecond(256); stepper_az.moveRelativeInSteps(x); } //delay(5); } } void update_pointing() { // Change the current pointing angles based on the current tracking rates if (trackRate_alt > 0) { float now = millis(); float elapsedTime_alt = now - lastUpdate_alt; posVal_sky_alt = posVal_sky_alt + (trackRate_alt*(elapsedTime_alt/1000.0)); if (posVal_sky_alt > alt_max) { posVal_sky_alt = alt_max; } lastUpdate_alt = now; } else { posVal_sky_alt = posVal_sky_alt + 0; } if (trackRate_az > 0) { float now = millis(); float elapsedTime_az = now - lastUpdate_az; posVal_sky_az = posVal_sky_az + (trackRate_az*(elapsedTime_az/1000.0)); if (posVal_sky_az > az_max) { posVal_sky_az = az_max; } lastUpdate_az = now; } else { posVal_sky_az = posVal_sky_az + 0; } } int set_pos(float alt, float az) { // Take current pointing angles, convert them, and move motors: float posVal_servo_alt = convert_alt(posVal_sky_alt); float posVal_servo_az = convert_az(posVal_sky_az); servo_alt.write(posVal_servo_alt); stepper_az.setSpeedInStepsPerSecond(156); stepper_az.setAccelerationInStepsPerSecondPerSecond(512); //float posVal_servo_az_Steps = posVal_servo_az*2048/360; float diff_move = stepper_pos- posVal_servo_az; stepper_az.moveRelativeInSteps(diff_move); stepper_pos = posVal_servo_az; return 0; } // The following functions convert 'sky' coordinates to 'servo' coordinates, // which account for the motor calibration offsets float convert_alt(float alt) { return sky_to_servo(alt, alt_min, alt_max, limit_alt_lo, limit_alt_hi); } float convert_az(float az) { return sky_to_servo(az, az_min, az_max, limit_az_lo, limit_az_hi); } float sky_to_servo( float sky, float sky_min, float sky_max, float servo_limit_lo, float servo_limit_hi) { if (sky < sky_min) return sky_min; if (sky > sky_max) return sky_max; float scale = (sky-sky_min) / (sky_max-sky_min); return scale * (servo_limit_hi - servo_limit_lo) + servo_limit_lo; } // The following fuctions are exposed to the outside world (the cloud): int point_alt_az(String posString) { int sepIndex = posString.indexOf(','); String posString_alt = posString.substring(0,sepIndex); String posString_az = posString.substring(sepIndex+1); posVal_sky_alt = posString_alt.toFloat(); posVal_sky_az = posString_az.toFloat(); float now = millis(); lastUpdate_alt = now; return 0; } int track_alt(String rate) { trackRate_alt = rate.toFloat(); return 0; } int track_az(String rate) { trackRate_az = rate.toFloat(); return 0; }
4a68db4eb5cb239c9c72785090e9cd35c3d303bd
7967197594dd6e4fb199554415f54f1014b5bc61
/instadd/mainwindow.cpp
67db8bd9e4c56b465cf48c14c63e2a181606c187
[]
no_license
marcin-filipiak/qt_instadd
a45843c860ea90e2b20565a4fedd09f471fa4b87
0727a8a991dcb9243b3a0e192db608fdacfc7df6
refs/heads/master
2023-09-01T01:01:49.114215
2023-08-24T07:29:20
2023-08-24T07:29:20
217,893,096
0
0
null
null
null
null
UTF-8
C++
false
false
1,369
cpp
mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QWebEngineView> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QWebEngineProfile *prof = QWebEngineProfile::defaultProfile(); //750x1334 prof->setHttpUserAgent("Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13F69 Instagram 8.4.0 (iPhone7,2; iPhone OS 9_3_2; nb_NO; nb-NO; scale=2.00; 690x500"); QString url = "https://instagram.com/"; view2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); this->ui->verticalLayout->addWidget(view2); view2->show(); view2->load(QUrl(url)); } //skalowanie okna void MainWindow::resizeEvent(QResizeEvent *event){ // QMainWindow::resizeEvent(event); // QRect rect = ui->centralWidget->geometry(); // ui->verticalLayoutWidget->setGeometry(10, 50, (rect.width()-20), (rect.height()-20)); } MainWindow::~MainWindow() { delete ui; } /* //klikniecie w back void MainWindow::on_BackButton_clicked() { view2->back(); } */ /* //klik i przejscie do url void MainWindow::on_GoButton_clicked() { view2->load(ui->UrlEdit->text()); QString html; view2->page()->toHtml([&html](const QString &result){ html = result; }); ui->plainTextEdit->setPlainText(html); } */
808e16e198eb66b2a87034f60bf8cc8af299b36f
a92beb5f22b9c8960b3a6a24199de8b69d4eb33d
/src/generate_data/single_triangle/python_module.cpp
6fe1b5144d306ac2d5da88193178b32c14914574
[ "MIT" ]
permissive
rgreenblatt/path
9d5336f0170a7fa5a3b6499587a8dfc80824d2a4
2057618ee3a6067c230c1c1c40856d2c9f5006b0
refs/heads/master
2023-08-07T12:14:15.128771
2021-10-04T14:47:30
2021-10-04T14:47:30
221,096,483
1
0
null
null
null
null
UTF-8
C++
false
false
3,543
cpp
python_module.cpp
#include "generate_data/single_triangle/constants.h" #include "generate_data/single_triangle/generate_data.h" #include <torch/extension.h> using namespace generate_data; using namespace generate_data::single_triangle; PYBIND11_MODULE(neural_render_generate_data_single_triangle, m) { m.def("generate_data", &generate_data::single_triangle::generate_data, "generate data in tensor form, output is scenes, coords, values"); m.def("generate_data_for_image", &generate_data_for_image, "generate data in tensor form, output is scenes, coords, values, " "indexes"); m.def("deinit_renderers", &deinit_renderers, "destroy renderers"); py::class_<PolygonInput>(m, "PolygonInput") .def_readwrite("point_values", &PolygonInput::point_values) .def_readwrite("overall_features", &PolygonInput::overall_features) .def_readwrite("counts", &PolygonInput::counts) .def_readwrite("prefix_sum_counts", &PolygonInput::prefix_sum_counts) .def_readwrite("item_to_left_idxs", &PolygonInput::item_to_left_idxs) .def_readwrite("item_to_right_idxs", &PolygonInput::item_to_right_idxs) .def("to", &PolygonInput::to); py::class_<PolygonInputForTri>(m, "PolygonInputForTri") .def_readwrite("polygon_feature", &PolygonInputForTri::polygon_feature) .def_readwrite("tri_idx", &PolygonInputForTri::tri_idx) .def("to", &PolygonInputForTri::to); py::class_<RayInput>(m, "RayInput") .def_readwrite("values", &RayInput::values) .def_readwrite("counts", &RayInput::counts) .def_readwrite("prefix_sum_counts", &RayInput::prefix_sum_counts) .def_readwrite("is_ray", &RayInput::is_ray) .def("to", &RayInput::to); py::class_<NetworkInputs>(m, "NetworkInputs") .def_readwrite("overall_scene_features", &NetworkInputs::overall_scene_features) .def_readwrite("triangle_features", &NetworkInputs::triangle_features) .def_readwrite("polygon_inputs", &NetworkInputs::polygon_inputs) .def_readwrite("ray_inputs", &NetworkInputs::ray_inputs) .def_readwrite("baryocentric_coords", &NetworkInputs::baryocentric_coords) .def("to", &NetworkInputs::to); using Stand = StandardData<NetworkInputs>; py::class_<Stand>(m, "StandardData") .def_readwrite("inputs", &Stand::inputs) .def_readwrite("values", &Stand::values) .def("to", &Stand::to); using Image = ImageData<NetworkInputs>; py::class_<Image>(m, "ImageData") .def_readwrite("standard", &Image::standard) .def_readwrite("image_indexes", &Image::image_indexes) .def("to", &Image::to); using Const = generate_data::single_triangle::Constants; py::class_<Const>(m, "Constants") .def(py::init<>()) .def_readwrite("n_tris", &Const::n_tris) .def_readwrite("n_scene_values", &Const::n_scene_values) .def_readwrite("n_dims", &Const::n_dims) .def_readwrite("n_tri_values", &Const::n_tri_values) .def_readwrite("n_baryo_dims", &Const::n_baryo_dims) .def_readwrite("n_coords_feature_values", &Const::n_coords_feature_values) .def_readwrite("n_poly_point_values", &Const::n_poly_point_values) .def_readwrite("n_rgb_dims", &Const::n_rgb_dims) .def_readwrite("n_shadowable_tris", &Const::n_shadowable_tris) .def_readwrite("n_poly_feature_values", &Const::n_poly_feature_values) .def_readwrite("n_polys", &Const::n_polys) .def_readwrite("n_ray_item_values", &Const::n_ray_item_values) .def_readwrite("n_ray_items", &Const::n_ray_items); }
f353870081322cdd7ef88473d4188690a6f74f86
be34d599008cc0b3b81177fdb9f9e2dcbd7f56ba
/src/mcu-basic/lamp.cpp
fe57beb075da70f71b15ad955be6ae633947456e
[ "Apache-2.0" ]
permissive
wouterdevinck/lamp
d5c94f98bd8b39fdf5395ae1bc129f0fe1f0e931
5020ba56f68738133934c4014166813790d04df9
refs/heads/master
2023-03-07T03:05:55.753756
2020-08-11T10:15:29
2020-08-11T10:15:29
134,090,004
2
0
Apache-2.0
2023-02-25T04:39:21
2018-05-19T18:58:27
C++
UTF-8
C++
false
false
283
cpp
lamp.cpp
#include "new.h" #include "Platform.h" #include "Lamp.h" #define BOARDS 15 using namespace lamp; extern "C" { int main(void); } int main(void) { auto platform = new Platform(BOARDS); auto lamp = new Lamp(platform); lamp->start(); while(1){ platform->loop(); } }
a6527fe19a3d38a896d3336201afe96fc0e6944b
f86385c53221aea1de25ea281d0e436e127be2f9
/src/SimpleLog.cpp
63360268f16f6c501866466a8b2b6b7c1479088b
[]
no_license
djpan0303/SimpleLog
d9a2b0f0b2559cfce73d3a3d8f67a4e0435ffd6c
b71af518010a100929b0ff836a51b4ee3da0e423
refs/heads/master
2023-06-25T00:56:50.233966
2018-11-15T12:04:46
2018-11-15T12:04:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,159
cpp
SimpleLog.cpp
#include <unistd.h> #include <iostream> #include <libgen.h> #include <SimpleLog.h> #include <StringUtil.h> namespace SLog { void* thread_proc(void* arg) { SimpleLog* thread = reinterpret_cast<SimpleLog*>(arg); while(true) { thread->svc(); } return NULL; } SimpleLog::SimpleLog(Appender *appender, Priority::Value priority) : _priority(priority) { if(appender != NULL) { _appenderStore.addAppender(appender); } #ifdef ASYNC_LOG pthread_t thread; int ret = pthread_create(&thread , NULL, thread_proc, this); if(ret != 0) { //throw } #endif } SimpleLog::~SimpleLog() { shutdown(); _appenderStore.removeAllAppenders(); } void SimpleLog::shutdown() { #ifdef ASYNC_LOG while(_logQueue.size() > 0) { usleep(300000); } #endif } void SimpleLog::setPriority(Priority::Value priority) { if (priority > Priority::NOTSET) { throw std::invalid_argument("cannot set priority NOTSET on Root SimpleLog"); } _priority = priority; // TODO:add pririty field to appeder } bool SimpleLog::addAppender(Appender* appender) { return _appenderStore.addAppender(appender); } void SimpleLog::removeAppender(Appender* appender) { _appenderStore.removeAppender(appender); } void SimpleLog::removeAllAppenders() { _appenderStore.removeAllAppenders(); } Priority::Value SimpleLog::getPriority() { return _priority; } bool SimpleLog::isPriorityEnabled(Priority::Value prio) { return prio <= _priority; } #define log_func_tmpl3(file, func, line, prio, stringFormat) do{\ if (prio < _priority)\ { \ va_list va; \ va_start(va,stringFormat); \ _logUnconditionally3(file, func, line, prio, stringFormat, va); \ va_end(va); \ } \ }while(0) #define log_func_tmpl(prio, stringFormat) do{\ if (isPriorityEnabled(prio)) \ { \ va_list va; \ va_start(va,stringFormat); \ _logUnconditionally(prio, stringFormat, va); \ va_end(va); \ } \ }while(0) void SimpleLog::_logUnconditionally(Priority::Value priority, const char* format, va_list arguments) throw() { _logUnconditionally2(priority, StringUtil::vform(format, arguments)); } void SimpleLog::_logUnconditionally2(Priority::Value priority, const std::string& message) throw() { #ifdef ASYNC_LOG std::shared_ptr<LoggingEvent> event(new LoggingEvent(message, priority)); _logQueue.push(event); #else LoggingEvent event(message, priority); _appenderStore.callAppenders(event); #endif } void SimpleLog::_logUnconditionally3(const char *file, const char *func, const int line, Priority::Value priority, const char* format, va_list arguments) throw() { std::string logPoint = std::string(basename(const_cast<char *>(file)))+std::string("@")+std::string(func)+std::string("@")+std::to_string(line); #ifdef ASYNC_LOG std::shared_ptr<LoggingEvent> event(new LoggingEvent(logPoint, StringUtil::vform(format, arguments), priority)); _logQueue.push(event); #else LoggingEvent event(logPoint, StringUtil::vform(format, arguments), priority); _appenderStore.callAppenders(event); #endif } void SimpleLog::log(Priority::Value priority, const char* stringFormat, ...) throw() { if (isPriorityEnabled(priority)) { va_list va; va_start(va, stringFormat); _logUnconditionally(priority, stringFormat, va); va_end(va); } } void SimpleLog::log(Priority::Value priority, const std::string& message) throw() { if (isPriorityEnabled(priority)) _logUnconditionally2(priority, message); } void SimpleLog::logva(Priority::Value priority, const char* stringFormat, va_list va) throw() { if (isPriorityEnabled(priority)) { _logUnconditionally(priority, stringFormat, va); } } void SimpleLog::debug(const char* stringFormat, ...) throw() { log_func_tmpl(Priority::DEBUG, stringFormat); } void SimpleLog::debug(const char *file, const char *func, const int line, const char* stringFormat, ...) throw() { log_func_tmpl3(file, func, line, Priority::DEBUG, stringFormat); } void SimpleLog::debug(const std::string& message) throw() { if (isPriorityEnabled(Priority::DEBUG)) _logUnconditionally2(Priority::DEBUG, message); } void SimpleLog::info(const char* stringFormat, ...) throw() { log_func_tmpl(Priority::INFO, stringFormat); } void SimpleLog::info(const char *file, const char *func, const int line, const char* stringFormat, ...) throw() { log_func_tmpl3(file, func, line, Priority::INFO, stringFormat); } void SimpleLog::info(const std::string& message) throw() { if (isPriorityEnabled(Priority::INFO)) _logUnconditionally2(Priority::INFO, message); } void SimpleLog::notice(const char* stringFormat, ...) throw() { log_func_tmpl(Priority::NOTICE, stringFormat); } void SimpleLog::notice(const char *file, const char *func, const int line, const char* stringFormat, ...) throw() { log_func_tmpl3(file, func, line, Priority::NOTICE, stringFormat); } void SimpleLog::notice(const std::string& message) throw() { if (isPriorityEnabled(Priority::NOTICE)) _logUnconditionally2(Priority::NOTICE, message); } void SimpleLog::warn(const char *file, const char *func, const int line, const char* stringFormat, ...) throw() { log_func_tmpl3(file, func, line, Priority::WARN, stringFormat); } void SimpleLog::warn(const std::string& message) throw() { if (isPriorityEnabled(Priority::WARN)) _logUnconditionally2(Priority::WARN, message); } void SimpleLog::error(const char* stringFormat, ...) throw() { log_func_tmpl(Priority::ERROR, stringFormat); } void SimpleLog::error(const char *file, const char *func, const int line, const char* stringFormat, ...) throw() { log_func_tmpl3(file, func, line, Priority::ERROR, stringFormat); } void SimpleLog::error(const std::string& message) throw() { if (isPriorityEnabled(Priority::ERROR)) _logUnconditionally2(Priority::ERROR, message); } void SimpleLog::crit(const char* stringFormat, ...) throw() { log_func_tmpl(Priority::CRIT, stringFormat); } void SimpleLog::crit(const char *file, const char *func, const int line, const char* stringFormat, ...) throw() { log_func_tmpl3(file, func, line, Priority::CRIT, stringFormat); } void SimpleLog::crit(const std::string& message) throw() { if (isPriorityEnabled(Priority::CRIT)) _logUnconditionally2(Priority::CRIT, message); } void SimpleLog::alert(const char* stringFormat, ...) throw() { log_func_tmpl(Priority::ALERT, stringFormat); } void SimpleLog::alert(const char *file, const char *func, const int line, const char* stringFormat, ...) throw() { log_func_tmpl3(file, func, line, Priority::ALERT, stringFormat); } void SimpleLog::alert(const std::string& message) throw() { if (isPriorityEnabled(Priority::ALERT)) _logUnconditionally2(Priority::ALERT, message); } void SimpleLog::emerg(const char* stringFormat, ...) throw() { log_func_tmpl(Priority::EMERG, stringFormat); } void SimpleLog::emerg(const char *file, const char *func, const int line, const char* stringFormat, ...) throw() { log_func_tmpl3(file, func, line, Priority::EMERG, stringFormat); } void SimpleLog::emerg(const std::string& message) throw() { if (isPriorityEnabled(Priority::EMERG)) _logUnconditionally2(Priority::EMERG, message); } void SimpleLog::fatal(const char* stringFormat, ...) throw() { log_func_tmpl(Priority::FATAL, stringFormat); } void SimpleLog::fatal(const char *file, const char *func, const int line, const char* stringFormat, ...) throw() { log_func_tmpl3(file, func, line, Priority::FATAL, stringFormat); } void SimpleLog::fatal(const std::string& message) throw() { if (isPriorityEnabled(Priority::FATAL)) _logUnconditionally2(Priority::FATAL, message); } void SimpleLog::svc() { #ifdef ASYNC_LOG LoggingEventShrPtr p = _logQueue.pop(); LoggingEvent event(*(p.get())); _appenderStore.callAppenders(event); #endif } }
8785c142ac35def63b9deac035b9ccc876e22f2a
b3dcc1fdd957f172ca43b5408f3ebf710e729e79
/Engine/include/Texture/Patterns/Stripe.h
33d18c01190bd77c9f0275c6902bd9ebb6fc2c23
[ "MIT" ]
permissive
listopat/Raymond
d548a99964820055b3294f193a743759530f2851
e29c37475b7b575c399cce03b0f4d7fafc942643
refs/heads/main
2023-04-29T06:58:31.223440
2021-05-09T12:32:55
2021-05-09T12:32:55
324,155,984
1
0
null
null
null
null
UTF-8
C++
false
false
323
h
Stripe.h
#pragma once #include <Texture/Pattern.h> class Stripe : public Pattern , public std::enable_shared_from_this<Stripe> { public: Color a, b; Stripe(const Color &s1, const Color &s2); static std::shared_ptr<Stripe> createStripe(const Color &s1, const Color &s2); Color atUV(const UV &uv) const override; };
791f6486548139fca72793b7f99221d1b7fb729a
dc219e436aa41cbd01a079fb620b5ab87e4246a7
/src/testApp.cpp
2855221c8c878c2fe8efe83489a3fd465cded602
[]
no_license
louischaman/midiLightTest2_2
63e4a0bf1bbaf37b5a6471accccf1ca6d6fb74dc
c32047da14238eabbdeeb97b212646921d221c16
refs/heads/master
2021-03-12T21:28:09.523769
2015-01-24T13:03:39
2015-01-24T13:03:39
29,776,698
0
0
null
null
null
null
UTF-8
C++
false
false
5,169
cpp
testApp.cpp
#include "testApp.h" //-------------------------------------------------------------- void testApp::setup(){ ofSetFrameRate(60); nTLights = 4; nGLights = 8; baud = 19200; ofSetVerticalSync(true); ofBackground(0); // ofSetLogLevel(OF_LOG_VERBOSE); lightSetup(); arduinoSetup(); midiSetup(); } void testApp::lightSetup(){ lightLevels.assign(nGLights, 0.0); bDamped.assign(nGLights, false); bToggled.assign(nTLights, false); lightManager.setup(nTLights, nGLights); } void testApp::envSetup(){ envAttack =30; envDecay =60; envRelease =10; envSustain =0.6; envReleaseD = pow(0.5,(1/envRelease)); envState.assign(nGLights, false); for(int i = 1 ; i<nGLights;i++){ lightLevels[i]=0; envState[i]=4; } } void testApp::arduinoSetup(){ int i = 0; arduinoMessage.assign(16, ' '); i++; arduinoMessage[i] = 0; i++; for(int j = 0; j < nTLights; j++){ arduinoMessage[i] = 0; i++; } arduinoMessage[i] = 'g'; for(int j = 0; j < nGLights; j++){ arduinoMessage[i] = 0; i++; } arduinoMessage[i] = 'e'; //cout << "Serial Message Size: " << arduinoMessage.size() << endl; bSendSerialMessage = false; unsigned char aMsg[arduinoMessage.size()]; for (int j = 0; j < arduinoMessage.size(); j++){ aMsg[j] = arduinoMessage[j]; } //cout << "message ready" << endl; serial.setup("COM3", baud); //cout << "serial ready" << endl; for (int j = 0; j < 16; j++){ serial.writeByte(aMsg[j]); //cout << j << endl; } //cout << "serial written" << endl; } void testApp::midiSetup(){ midiIn.listPorts(); midiIn.openPort(1); midiIn.ignoreTypes(false, false, false); midiIn.addListener(this); midiIn.setVerbose(true); } //-------------------------------------------------------------- void testApp::update(){ midiUpdate(); updateLights(); //arduinoUpdate(); } void testApp::arduinoUpdate(){ if(serial.isInitialized()){ int i = 2; for(int j = 0; j < nTLights; j++){ arduinoMessage[i] = static_cast<int>(bToggled[j]); i++; } i++; for (int j =0; j < nGLights; j++){ arduinoMessage[i] = lightManager.returnLevel(j); i++; if(i > arduinoMessage.size()) break; } unsigned char aMsg[arduinoMessage.size()]; for(int j = 0; j < arduinoMessage.size(); j++){ aMsg[j] = arduinoMessage[j]; } serial.writeBytes(aMsg, arduinoMessage.size()); } } void testApp::midiUpdate(){ if(midiMessage.status==0x90){ if(midiMessage.pitch==29) bToggled[0] = true; else if(midiMessage.pitch==15) bToggled[1] = true; else if(midiMessage.pitch==0x11) bToggled[2] = true; else if(midiMessage.pitch==0x1B) bToggled[3] = true; }else if(midiMessage.status==0x80){ if(midiMessage.pitch==29) bToggled[0] = false; else if(midiMessage.pitch==15) bToggled[1] = false; else if(midiMessage.pitch==0x11) bToggled[2] = false; else if(midiMessage.pitch==0x1B) bToggled[3] = false; }else if(midiMessage.status==0xB0){ int control = midiMessage.control; if((control >= 0x08) && (control <= 0x0F)){ control -= 8; // lightLevels[control] = ofMap(static_cast<float>(midiMessage.value), 0.0, 127.0, 0.0, 1.0); } } } void testApp::updateLights(){ lightManager.setLightsTriggered(bToggled); lightManager.setAllTrigger(); lightManager.setLevels(lightLevels); lightManager.updateAllGreyscale(bDamped); } //-------------------------------------------------------------- void testApp::draw(){ ofSetColor(200); ofDrawBitmapString(ofToString(midiMessage.pitch), 20, 20); lightManager.drawAll(); } //-------------------------------------------------------------- void testApp::keyPressed(int key){ } //-------------------------------------------------------------- void testApp::keyReleased(int key){ } //-------------------------------------------------------------- void testApp::mouseMoved(int x, int y ){ } //-------------------------------------------------------------- void testApp::mouseDragged(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::mousePressed(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::mouseReleased(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::windowResized(int w, int h){ } //-------------------------------------------------------------- void testApp::gotMessage(ofMessage msg){ } //-------------------------------------------------------------- void testApp::dragEvent(ofDragInfo dragInfo){ } void testApp::exit(){ midiIn.closePort(); midiIn.removeListener(this); } void testApp::newMidiMessage(ofxMidiMessage &msg){ midiMessage = msg; }
a8bff6a66da81d1e0ee0061076dbeae0500685a9
9d0ca5e92c40f4d016846f8d07639425fc88a4ba
/ioi-training-master/IOI/2007/training.cpp
83485b1e8bffed6235e1a9652d64babe9f04a14a
[]
no_license
prajneya/IOI
01532de1b92509e62214fd5a8208bc66db82c429
c509fccd5b9ef2f0748ae834aaee759582481ad8
refs/heads/master
2020-06-14T09:42:58.889117
2016-12-16T02:42:45
2016-12-16T02:42:45
75,202,750
0
0
null
null
null
null
UTF-8
C++
false
false
3,769
cpp
training.cpp
#include <algorithm> #include <cassert> #include <iostream> #include <cstdio> #include <cstring> #include <vector> #define NMAX 1010 #define SMAX ((1<<10)+10) #define MMAX 5010 #define LOGN 12 #define DEG 12 #define ALL(v) ((1<<n[(v)])-1) using namespace std; struct edge{ int u,v,cost; }; class lca_table{ private: int ances[NMAX][LOGN]; int N,dist,log; public: void init(int n, int *par){ int i,k; N = n; for(i = 0; i < N; ++i){ ances[i][0] = par[i]; } for(k = 1; (1<<k) <= N; ++k){ for(i = 0; i < N; ++i){ ances[i][k] = ances[i][k-1] < 0 ? -1 : ances[ances[i][k-1]][k-1]; } } log = k; } pair<int,int> query(int u, int v, int *lev){ assert(lev[u] >= lev[v]); dist = 1; int k; for(k = log-1; k >= 0; --k){ if(ances[u][k] < 0 || lev[ances[u][k]] <= lev[v]) continue; u = ances[u][k]; dist += (1<<k); } if(ances[u][0] == v) return make_pair(u,v); if(lev[u] != lev[v]){ u = ances[u][0]; ++dist; } for(k = log-1; k >= 0; --k){ if(ances[u][k] == ances[v][k]) continue; u = ances[u][k]; v = ances[v][k]; dist += (1<<k); dist += (1<<k); } ++dist; return make_pair(u,v); } int get_dist(){ return dist; } }; int par[NMAX]; int lev[NMAX]; int idx[NMAX]; int child[NMAX][DEG]; int n[NMAX]; int N; void dfs(int v){ int i,u; for(i = 0; i < n[v]; ++i){ u = child[v][i]; if(u == par[v]){ swap(child[v][i--],child[v][--n[v]]); continue; } par[u] = v; lev[u] = lev[v]+1; idx[u] = i; dfs(u); } } edge edges[MMAX]; pair<int,int> stree[MMAX]; int M; lca_table T; vector<int> aff[NMAX]; void init(){ int i; pair<int,int> l; par[0] = -1, idx[0] = -1; dfs(0); T.init(N,par); for(i = 0; i < M; ++i){ if(lev[edges[i].u] < lev[edges[i].v]) swap(edges[i].u,edges[i].v); l = T.query(edges[i].u,edges[i].v,lev); if(T.get_dist()&1){ //even len cycle swap(edges[i--],edges[--M]); continue; } stree[i].first = idx[l.first]; stree[i].second = par[l.first] == l.second ? -1 : idx[l.second]; assert(par[l.first] == l.second || par[l.first] == par[l.second]); aff[par[l.first]].push_back(i); } } int mem[NMAX][SMAX]; int mem_cost[NMAX][NMAX]; int max_cost(int,int); int up(int u, int v){ if(mem_cost[u][v] >= 0) return mem_cost[u][v]; int &val = mem_cost[u][v]; val = max_cost(u,ALL(u)); while(u != v){ val += (max_cost(par[u],ALL(par[u])^(1<<idx[u]))); u = par[u]; } return val; } int max_cost(int i, int sel){ int &val = mem[i][sel]; int k,tmp,u,v,j; if(val >= 0) return val; if(!sel){ val = 0; return val; } val = 0; for(k = 0; k < n[i]; ++k){ if(!(sel&(1<<k))) continue; u = child[i][k]; val += max_cost(u,ALL(u)); } for(k = 0; k < (int)aff[i].size(); ++k){ j = aff[i][k]; u = edges[j].u, v = edges[j].v; assert(stree[j].first >= 0); if(!(sel&(1<<stree[j].first))) continue; if(stree[j].second < 0){ tmp = max_cost(i,sel^(1<<stree[j].first)) + up(u,child[i][stree[j].first]) + edges[j].cost; val = max(val,tmp); continue; } if(!(sel&(1<<stree[j].second))) continue; tmp = max_cost(i,sel^(1<<stree[j].first)^(1<<stree[j].second)) + up(u,child[i][stree[j].first]) + up(v,child[i][stree[j].second]) + edges[j].cost; val = max(val,tmp); } return val; } int main(){ int i,tot,left; memset(mem,-1,sizeof(mem)); memset(mem_cost,-1,sizeof(mem_cost)); scanf("%d%d",&N,&M); tot =0 ; for(i = 0; i < M; ++i){ scanf("%d%d%d",&edges[i].u,&edges[i].v,&edges[i].cost); --edges[i].u,--edges[i].v; tot += edges[i].cost; if(edges[i].cost) continue; child[edges[i].u][n[edges[i].u]++] = edges[i].v; child[edges[i].v][n[edges[i].v]++] = edges[i].u; --i; --M; } init(); left = max_cost(0,ALL(0)); printf("%d\n",tot-left); return 0; }
1a47e8f7cb5db8f2e7210a256844a263a5023332
de4fb0931c064fa213f46f7dfc4ec58c5c8d0fbb
/dmx1a4.ino
c755e33b9326b7d2716cdecb852b9a4bea875dca
[]
no_license
DarioJorgeIglesias/LaboratorioElectronicaDigital
0de9fbfd59795e300c49b3389ed2cb2d7499246e
973a3bba73709b0ef0a179844fed8c072c7576ea
refs/heads/master
2020-05-15T23:58:50.152138
2020-03-04T08:53:41
2020-03-04T08:53:41
182,567,372
0
0
null
null
null
null
UTF-8
C++
false
false
670
ino
dmx1a4.ino
//Autor:Dario Jorge Iglesias boolean A,B,D0,D1,D2,D3,I; void setup(){ pinMode(6,INPUT); //pin 6 es la entrada I pinMode(7,INPUT); pinMode(8,INPUT);//pin7 A, pin8 B pinMode(9,OUTPUT); pinMode(10,OUTPUT);//pin 9 D0,10 D1 pinMode(11,OUTPUT);pinMode(12,OUTPUT);//11 D2,12 D3 } void loop() { I=digitalRead(6);//Entrada I en 6 A=digitalRead(7);//Entrada A en 7 B=digitalRead(8);//Leemos variable de control B D0=!A&!B&I; digitalWrite(9,D0);//Saca dato I por D0 D1=!B&A&I; digitalWrite(10,D1);//Saca dato I por D1 D2=!A&B&I; digitalWrite(11,D2);//Saca dato I por D2 D3=A&B&I; digitalWrite(12,D3);//Saca dato I por D3 }
f9d5586a2448f74e4c5e4d3502f6741df280890b
483ff5e7737805d977441ce2ea8caaf6fb95b7ba
/raspberryDriveGeany_2017-06-03/Bildanalyse.cpp
26eeae5fa802aa40477b7c4781a743f8aee782e0
[]
no_license
jonandjon/carControl
efc683976adec68396764095a235d9abb5ab83f0
5f32b52f939ec6642f04922cac300105e57e58a0
refs/heads/master
2020-05-16T04:30:49.625693
2019-05-10T18:06:04
2019-05-10T18:06:04
182,780,168
0
0
null
null
null
null
UTF-8
C++
false
false
3,286
cpp
Bildanalyse.cpp
#include "Bildanalyse.h" #include "CamPixy.h" Bildanalyse::Bildanalyse(){}; Bildanalyse::~Bildanalyse(){}; void printObjektKoordinatenX() { //? pixyPos(); //muss nicht sein, der jeweils letzte Datensatz wird gedruckt // Nur zur Kontrolle ein Aaru aller Koordnatenwerte un aller Obekte for(int index = 0; index != CamPixy::blocks_copied; ++index) { printf(" \n komponent: sig(index= %1d):%1d x:%4d y:%4d width:%4d height:%4d\n", index, CamPixy::blocks[index].signature, CamPixy::blocks[index].x, CamPixy::blocks[index].y, CamPixy::blocks[index].width, CamPixy::blocks[index].height); } //--// } //----------------------------------------------------------- /** * Beliebiger Hilfetext zur Abfrage durch den Entwickler oder Hinweise für den ANwender * */ void Bildanalyse::help() { printf("\n Klasse Bildanalyse: Methoden zur Auwertung der Bilder und der Bildparametern!\n\n"); }; /** * Liefert die Abweichung der Mitte eines Objektes zur Bildmitte * * in der x-Richtung */ int Bildanalyse::targetXcenter(int objektSig){ CamPixy::pos(); int index=objektSig -1; //T printObjektKoordinatenX(); int xPos=CamPixy::blocks[index].x + (int) (CamPixy::blocks[index].width / 2); int xDelta=xPos - (int) (CamPixy::Xmax / 2); //T printf(" \n CamPixy::Xmax: %4d | CamPixy::Xpos: %4d | xDelta: %4d \n",CamPixy::Xmax,xPos, xDelta); return xDelta; // int target } /** * STARK VEREINFACHTES ENFERNUNGSMODELL * Liefert die Entfernung zu einem spezifizierten Objektes * welches sich auf der Straße befindet. * Die Höhe der Kamera über Straße ist mit 10 cm festgelegt. * Verwendet wurde eine Geradengleichung. Das ist eine grobe Vereinfachung. * Vorteil: Parametrieren ist nicht erforderlich. * Gegebenenfalls ist eine Anpassung an das reale Modell erforderlich (Faktor 0.5). * */ int Bildanalyse::targetEnfernungY(int y, int height) { return CamPixy::BILDKANTE_S0 + (CamPixy::Ymax - y - height) *0.5; } /** * VEREINFACHTES ENFERNUNGSMODELL * Liefert die Entfernung zu einem Objektes * welches sich auf der Straße befindet. * Randbedingung: Optische Achse verläuft exakt horizonal (parallel zur Straße) * @param y - y-Koordinate in Pixel der Objektoberkante in Pixel * @param height - Objektabbild (Höhe) in y-Richtung in Pixel (Objektunterkante= y + height) * @return - Entfernung des Objektes in mm (Objektunterkante) in Bezug zur Kamera * */ int Bildanalyse::targetEnfernungY_horizont(int y, int height){ return (int) (CamPixy::Hcam * CamPixy::Scam / (y + height - CamPixy::Ymax/2)); } /** * Y-EBENEN-ENFERNUNGSMODELL * Liefert die Entfernung zu einem Objektes * welches sich auf der Straße befindet. * Optische Achse kann auch um den Winkel Beta geneigt sein * @param y - y-Koordinate in Pixel der Objektoberkante in Pixel * @param height - Objektabbild (Höhe) in y-Richtung in Pixel (Objektunterkante= y + height) * @return - Entfernung des Objektes in mm (Objektunterkante) in Bezug zur Kamera * */ int Bildanalyse::targetEnfernungY_geneigt(int y, int height){ int yhmax=y+height - CamPixy::Ymax/2; double tanBeta= tan(CamPixy::Beta); return (int) (CamPixy::Hcam * (CamPixy::Scam + yhmax*tanBeta ) / (CamPixy::Scam *tanBeta + yhmax)); }
c8c7cf3a8f9146b856ef40c940d8a1ac7dd7d217
b9687a5da36555d4f0868e6557311b2d84c3520e
/code/src/log4cplus-1.1/include/log4cplus/helpers/queue.h
ef3c64aee60b8dcc674da503373aada2a63944ee
[ "Apache-2.0", "BSD-2-Clause" ]
permissive
zleesz/ui-with-lua
7defbe35f740790270ab867bf96df72564a1db08
df37ab532073f9cda29d2352f7068ea049a37f43
refs/heads/master
2016-09-05T13:53:22.076409
2014-08-23T08:44:56
2014-08-23T08:44:56
32,198,624
1
1
null
null
null
null
UTF-8
C++
false
false
5,366
h
queue.h
// Copyright (C) 2009, Vaclav Haisman. All rights reserved. // // Redistribution and use in source and binary forms, with or without modifica- // tion, 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 ``AS IS'' AND ANY EXPRESSED 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 // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef LOG4CPLUS_HELPERS_QUEUE_H #define LOG4CPLUS_HELPERS_QUEUE_H #include <deque> #include <log4cplus/helpers/threads.h> #include <log4cplus/spi/loggingevent.h> #include <log4cplus/helpers/logloguser.h> #include <log4cplus/helpers/syncprims.h> namespace log4cplus { namespace thread { //! Single consumer, multiple producers queue. class LOG4CPLUS_EXPORT Queue : public virtual helpers::SharedObject , protected helpers::LogLogUser { public: //! Type of the state flags field. typedef unsigned flags_type; Queue (unsigned len = 100); virtual ~Queue (); // Producers' methods. //! Puts event <code>ev</code> into queue, sets QUEUE flag and //! sets internal event object into signaled state. If the EXIT //! flags is already set upon entering the function, nothing is //! inserted into the queue. The function can block on internal //! semaphore if the queue has reached maximal allowed //! length. Calling thread is unblocked either by consumer thread //! removing item from queue or by any other thread calling //! signal_exit(). //! //! \param ev spi::InternalLoggingEvent to be put into the queue. //! \return Flags. flags_type put_event (spi::InternalLoggingEvent const & ev); //! Sets EXIT flag and DRAIN flag and sets internal event object //! into signaled state. //! \param drain If true, DRAIN flag will be set, otherwise unset. //! \return Flags, ERROR_BIT can be set upon error. flags_type signal_exit (bool drain = true); // Consumer's methods. //! The get_event() function is used by queue's consumer. It fills //! <code>ev</code> argument using the first item in queue and //! sets EVENT flag in return value. If EXIT flag is already set //! in flags member upon entering the function then depending on //! DRAIN flag it either fills ev argument or does not fill the //! argument, if the queue is non-empty. The function blocks by //! waiting for internal event object to be signaled if the queue //! is empty, unless EXIT flag is set. The calling thread is //! unblocked by when items are added into the queue or when exit //! is signaled using the signal_exit() function. //! //! Upon error, return value has one of the error flags set. //! //! \param ev spi::InternalLoggingEvent instance to be filled from queue. //! \return Flags. flags_type get_event (spi::InternalLoggingEvent & ev); //! Possible state flags. enum Flags { //! EVENT flag is set in return value of get_event() call if //! the <code>ev</code> argument is filled with event from the queue. EVENT = 0x0001, //! QUEUE flag is set by producers when they put item into the //! queue. QUEUE = 0x0002, //! EXIT flag is set by signal_exit() call, signaling that the //! queue worker thread should end itself. EXIT = 0x0004, //! When DRAIN flag is set together with EXIT flag, the queue //! worker thread will first drain the queue before exiting. DRAIN = 0x0008, //! ERROR_BIT signals error. ERROR_BIT = 0x0010, //! ERROR_AFTER signals error that has occured after queue has //! already been touched. ERROR_AFTER = 0x0020 }; protected: //! Queue storage. std::deque<spi::InternalLoggingEvent> queue; //! Mutex protecting queue and flags. Mutex mutex; //! Event on which consumer can wait if it finds queue empty. ManualResetEvent ev_consumer; //! Semaphore that limits the queue length. Semaphore sem; //! State flags. flags_type flags; private: Queue (Queue const &); Queue & operator = (Queue const &); }; typedef helpers::SharedObjectPtr<Queue> QueuePtr; } } // namespace log4cplus { namespace thread { #endif // LOG4CPLUS_HELPERS_QUEUE_H
556506de49408287acea90162e8b295a466a0d23
b1aa67666ec7c8f4036a8769498cb37e16027076
/src/PrimitiveNodes/UnsupportedSink.h
ff641bbb12b0402cc832c20a22c05c1275e8905d
[ "BSD-3-Clause" ]
permissive
ucb-cyarp/vitis
acbd5fedc65afd422fbf141512eb92697461b764
e928047652d1569f2af57dd3094c8fe90b7d6cb5
refs/heads/master
2023-04-12T19:39:40.121305
2022-05-06T22:01:10
2022-05-06T22:01:10
138,628,803
1
0
null
null
null
null
UTF-8
C++
false
false
4,863
h
UnsupportedSink.h
// // Created by Christopher Yarp on 9/13/18. // #ifndef VITIS_UNSUPPORTEDSINK_H #define VITIS_UNSUPPORTEDSINK_H #include <vector> #include <memory> #include <map> #include <string> #include "PrimitiveNode.h" #include "GraphMLTools/GraphMLDialect.h" #include "GraphCore/NodeFactory.h" /** * \addtogroup PrimitiveNodes Primitives * @{ */ /** * @brief Represents a Unsupported Sink Block. This block may represent a sink in Simulink/Matlab that is * not critical for the correct function of the design. Some examples of this include datatype constraint * blocks. The DataTypeDuplicate block was implemented because it is commonly used and provides a good sanity check. * However, more complex sink logic is outside the current scope of the project. Note that if the sink block is used to * impose datatype restrictions in simulink, they types will be resolved durring the simulink export process. * * Since sinks that are not outputs are not synthesized the fact that this block's emit logic is un-implemted should * not cause a problem. A warning will be generated durring validation. * * @note For GraphML emit, the type of the node is restored to the origional unsupported type. The parameters are saved * and re-emitted */ class UnsupportedSink : public PrimitiveNode{ friend NodeFactory; private: std::string nodeType; ///<Stores the original type of node which was unsupported std::map<std::string, std::string> dataKeyValueMap; ///<Stores the parameters of the unsupported node //==== Constructors ==== /** * @brief Constructs an empty UnsupportedSink * * @note To construct from outside of hierarchy, use factories in @ref NodeFactory */ UnsupportedSink(); /** * @brief Constructs an empty UnsupportedSink with a given parent. This node is not added to the children list of the parent. * * @note To construct from outside of hierarchy, use factories in @ref NodeFactory * * @param parent parent node */ explicit UnsupportedSink(std::shared_ptr<SubSystem> parent); /** * @brief Constructs a new node with a shallow copy of parameters from the original node. Ports are not copied and neither is the parent reference. This node is not added to the children list of the parent. * * @note To construct from outside of hierarchy, use factories in @ref NodeFactory * * @note If copying a graph, the parent should be one of the copies and not from the original graph. * * @warning Because pointer (this) is passed to ports, nodes must be allocated on the heap and not moved. All interaction should be via pointers. * * @param parent parent node * @param orig The origional node from which a shallow copy is being made */ UnsupportedSink(std::shared_ptr<SubSystem> parent, UnsupportedSink* orig); public: //====Getters/Setters==== std::string getNodeType() const; void setNodeType(const std::string &nodeType); std::map<std::string, std::string> getDataKeyValueMap() const; void setDataKeyValueMap(const std::map<std::string, std::string> &dataKeyValueMap); //====Factories==== /** * @brief Creates a UnsupportedSink node from a GraphML Description * * @note This function does not add the node to the design or to the nodeID/pointer map * * @param id the ID number of the node * @param name the human readable name of a node * @param type the type of the node * @param dataKeyValueMap A map of property keys and values extracted from the data nodes in the GraphML * @param parent The parent of this node in the hierarchy * @return a pointer to the new delay node */ static std::shared_ptr<UnsupportedSink> createFromGraphML(int id, std::string name, std::string type, std::map<std::string, std::string> dataKeyValueMap, std::shared_ptr<SubSystem> parent); //==== Emit Functions ==== std::set<GraphMLParameter> graphMLParameters() override; xercesc::DOMElement* emitGraphML(xercesc::DOMDocument* doc, xercesc::DOMElement* graphNode, bool include_block_node_type = true) override ; std::string typeNameStr() override; std::string labelStr() override ; void validate() override ; std::shared_ptr<Node> shallowClone(std::shared_ptr<SubSystem> parent) override; /** * @brief Does nothing since the sink node is unsupported. Should never be called for bottom up emit but may * be called for scheduled emit. */ CExpr emitCExpr(std::vector<std::string> &cStatementQueue, SchedParams::SchedType schedType, int outputPortNum, bool imag = false) override; }; /*! @} */ #endif //VITIS_UNSUPPORTEDSINK_H
74d83364d23fb52c5c7dc63bad3ad12bc57ca59f
0cac2210f68f2c17dc2e7375bf1ae7f6427b096b
/core/include/engine/Method_MMF.hpp
55b8cccee984dfd932347df4e00e4a7c2022691f
[ "MIT" ]
permissive
spirit-code/spirit
43e4fbb3d99049490f7fe89b0fc1736589c58f29
e82250d3b14411c2c2fa292d143f13e3e111ad8c
refs/heads/master
2023-06-12T23:29:10.559514
2023-03-17T16:15:44
2023-03-17T16:16:17
69,043,835
114
61
MIT
2023-06-04T19:52:34
2016-09-23T16:51:17
C++
UTF-8
C++
false
false
2,177
hpp
Method_MMF.hpp
#pragma once #ifndef SPIRIT_CORE_ENGINE_METHOD_MMF_HPP #define SPIRIT_CORE_ENGINE_METHOD_MMF_HPP #include "Spirit_Defines.h" #include <data/Parameters_Method_MMF.hpp> #include <engine/Method_Solver.hpp> namespace Engine { /* The Minimum Mode Following (MMF) method */ template<Solver solver> class Method_MMF : public Method_Solver<solver> { public: // Constructor Method_MMF( std::shared_ptr<Data::Spin_System> system, int idx_chain ); // Method name as string std::string Name() override; private: // Calculate Forces onto Systems void Calculate_Force( const std::vector<std::shared_ptr<vectorfield>> & configurations, std::vector<vectorfield> & forces ) override; // Check if the Forces are converged bool Converged() override; // Save the current Step's Data: images and images' energies and reaction coordinates void Save_Current( std::string starttime, int iteration, bool initial = false, bool final = false ) override; // A hook into the Method before an Iteration of the Solver void Hook_Pre_Iteration() override; // A hook into the Method after an Iteration of the Solver void Hook_Post_Iteration() override; // Sets iteration_allowed to false void Finalize() override; std::shared_ptr<Data::Spin_System> system; bool switched1, switched2; // Last calculated hessian MatrixX hessian; // Last calculated gradient vectorfield gradient; // Last calculated minimum mode vectorfield minimum_mode; int mode_follow_previous; VectorX mode_2N_previous; // Last iterations spins and reaction coordinate scalar Rx_last; vectorfield spins_last; // Which minimum mode function to use // ToDo: move into parameters std::string mm_function; // Functions for getting the minimum mode of a Hessian void Calculate_Force_Spectra_Matrix( const std::vector<std::shared_ptr<vectorfield>> & configurations, std::vector<vectorfield> & forces ); void Calculate_Force_Lanczos( const std::vector<std::shared_ptr<vectorfield>> configurations, std::vector<vectorfield> & forces ); }; } // namespace Engine #endif
2d8fbd266adf378560549de59bd9a81142a8d1dd
8d81f8a15efd9a4d0f11ac3fe64d822eb98bd37d
/1_leetcode/grayCode.cpp
1d78892a5020601a15a083f525fa39d7b397cedc
[]
no_license
wyxmails/MyCode
b32a14d3b3a63dd9b3049d266231728419ed60d1
641abffc65b52b6f4a279432a8c4037a3b6a900c
refs/heads/master
2020-12-25T17:24:03.304677
2016-08-28T14:05:10
2016-08-28T14:05:10
18,900,363
2
0
null
null
null
null
UTF-8
C++
false
false
1,334
cpp
grayCode.cpp
/* Gray Code Total Accepted: 15118 Total Submissions: 47113 My Submissions The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0. For example, given n = 2, return [0,1,3,2]. Its gray code sequence is: 00 - 0 01 - 1 11 - 3 10 - 2 Note: For a given n, a gray code sequence is not uniquely defined. For example, [0,2,3,1] is also a valid gray code sequence according to the above definition. For now, the judge is able to judge based on one instance of gray code sequence. Sorry about that. */ class Solution { public: vector<int> grayCode(int n) { int m = 1<<n; vector<int> res; for(int i=0;i<m;++i){ res.push_back(i^(i>>1)); } return res; } }; class Solution { public: vector<int> grayCode(int n) { /*nth results = (n-1)th results + [(1<<(n-1))+reverse((n-1)th results)]*/ vector<int> res; res.push_back(0); for(int i=0;i<n;++i){ int len = res.size(); int highbits = 1<<i; for(int j=len-1;j>=0;--j){ res.push_back(highbits+res[j]); } } return res; } };
1eeb8d0cf645752829cba35c904a31fc97f32a0f
d2b90ca90ce2ccb730616579d8215d6ddff941db
/modeb.h
e3e22917b12b12510d94501d5f395daa9f9b2b46
[]
no_license
wanggy0201/TSP-Solutions
371dee43ef5b6fbcf6c158d908f9b49449d37e3f
3b02a2217f93740beb5db761ffc93fd375eb4a99
refs/heads/master
2021-05-01T05:38:31.274297
2017-01-23T04:05:17
2017-01-23T04:05:17
79,768,040
0
0
null
null
null
null
UTF-8
C++
false
false
438
h
modeb.h
// // modeb.hpp // 281Project4 // // Created by Guangyu Wang on 11/29/16. // Copyright © 2016 Guangyu Wang. All rights reserved. // #ifndef modeb_hpp #define modeb_hpp #include <stdio.h> #include <iostream> #include <vector> #include <limits> #include <iomanip> #include "modea.h" using namespace std; void modeb(vector<pair<int,int>>& coordinates); double distanceb(pair<int,int>& a, pair<int,int>& b); #endif /* modeb_hpp */
c1a06d8001a0ac7a215a0e1afa7d3aaa3de841c8
8a7881c1f05794c44cd462eee18cb02a612c2e20
/math/quaternion.h
9765fbda0d9c9bde41b0d97aae9fc80e90c47b4f
[]
no_license
danilob/ShootPhysics
90e71a1d4c7ea65a3d4f8a320999e38fd13afa8f
542802fa5d92eb3414aeb1d944c8a127345c1d5c
refs/heads/master
2021-08-14T15:18:14.004570
2017-11-16T03:24:39
2017-11-16T03:24:39
106,582,293
0
0
null
null
null
null
UTF-8
C++
false
false
3,636
h
quaternion.h
#ifndef QUATERNION_H #define QUATERNION_H #define EPSILON 0.00001 #define HALFPI 1.570796326794895 #include <math.h> #include <stdlib.h> #include <vector> #include "vec4.h" class QuaternionQ { public: float w,x,y,z; //construtores QuaternionQ(); QuaternionQ( float w, Vec4 v ); QuaternionQ(float thetaX, float thetaY, float thetaZ); QuaternionQ( Vec4 euler ); //ordem XYZ QuaternionQ(float r,float x, float y, float z); //Quaternion(float r, Vec4 v); ~QuaternionQ(); void setVector(Vec4 v); //retorna o quaternion que leva de qi para qf static QuaternionQ deltaQuat( QuaternionQ quatf, QuaternionQ quati ); //retorna o modulo do quaternion float module(); //retorna o quadrado do modulo do quaternion (nao tira a raiz quadrada) float module2(); //normaliza o quaternion void normalize(); QuaternionQ normalizeR(); //retorna o produto escalar entre this e quat float dot(QuaternionQ quat); //prodesc //retorna -quat QuaternionQ minusQuaternion(QuaternionQ quat); //menosq //calcula o menor arco (entre: this ate q ou this ate -q) QuaternionQ lessArc(QuaternionQ q); //menorArco void setQuaternion(float r,float x, float y, float z); float getScalar(); float getPosX(); float getPosY(); float getPosZ(); float qw(); float qx(); float qy(); float qz(); void setScalar(float s); void setPosX(float x); void setPosY(float y); void setPosZ(float z); Vec4 getVector(); //interpolacao linear esferica QuaternionQ slerp( QuaternionQ quat, float t ); void setQuaternion(QuaternionQ quat); void setQuaternion(float w, Vec4 quat); QuaternionQ operator*(float v); friend QuaternionQ operator+(QuaternionQ p,QuaternionQ q); friend QuaternionQ operator*(QuaternionQ p,QuaternionQ q); QuaternionQ conjugate(); static Vec4 getVecRotation(QuaternionQ q, Vec4 v); float normal(); static QuaternionQ getRotation(Vec4 u, Vec4 v); QuaternionQ inverse(); void toAxisAngle( Vec4* axis, float* angle ); //os angulos aqui passados como parametro ou retornados sao considerados estar em graus //converte o quaternion em angulos de Euler (ordem XYZ) Vec4 toEuler(); //toEulerXYZ //converte os angulos de Euler em um quaternion e atribui a this (ordem XYZ) void fromEuler( Vec4 euler ); static QuaternionQ fromEuler2Quat( Vec4 euler ); void showQuaternion(); QuaternionQ operator /(double k); //Quaternion operator *(Quaternion q); friend bool operator==(QuaternionQ p,QuaternionQ q); friend QuaternionQ operator-(QuaternionQ p,QuaternionQ q); static float dot(QuaternionQ p, QuaternionQ q); //converte Quaternion em dQuaternion // void to_dQuaternion( dQuaternion q ); // //converte em Quaternion a partir de dQuaternion // void from_dQuaternion( dQuaternion q ); // void from_dQuaternion( const dQuaternion q ); // //convert dVector3 (normalized_axis*angle) to Quaternion // void from_dVector3( dVector3 v ); // //convert Vec4 (normalized_axis*angle) to Quaternion // void from_Vec4( Vec4 v3D ); // //convert Quaternion to dVector3 (normalized_axis*angle) // void to_dVector3( dVector3 v ); // //convert Quaternion to Vec4 (normalized_axis*angle) // void to_Vec4( Vec4& v3D ); }; #endif
32be208ff9d829419c72eaf1c1ce78881d27d6d1
bc1d68d7a7c837b8a99e516050364a7254030727
/src/HDU/HDU2795 Billboard.cpp
325dff926bfd7c2f34cd25c8f6285f1ef872702e
[]
no_license
kester-lin/acm_backup
1e86b0b4699f8fa50a526ce091f242ee75282f59
a4850379c6c67a42da6b5aea499306e67edfc9fd
refs/heads/master
2021-05-28T20:01:31.044690
2013-05-16T03:27:21
2013-05-16T03:27:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,635
cpp
HDU2795 Billboard.cpp
/******************************************************************************* # Author : Neo Fung # Email : neosfung@gmail.com # Last modified: 2012-01-18 20:11 # Filename: HDU1689 Just a Hook.cpp # Description : ******************************************************************************/ #ifdef _MSC_VER #define DEBUG #endif #include <fstream> #include <stdio.h> #include <iostream> #include <string.h> #include <string> #include <limits.h> #include <algorithm> #include <math.h> #include <numeric> #include <functional> #include <ctype.h> #define L(x) (x<<1) #define R(x) (x<<1|1) #define MAX 200010 using namespace std; struct NODE { int l,r,sum; }node[MAX*4]; void init() { memset(node,'\0',sizeof(node)); } void build(const int &t , const int &l,const int &r,const int &sum) { node[t].l=l; node[t].r=r; node[t].sum=sum; if(l==r-1) return; int mid=(l+r)>>1; build(L(t),l,mid,sum); build(R(t),mid,r,sum); } int update(const int &t,const int &val) { if(node[t].sum<val) return -1; if(node[t].l ==node[t].r-1 && node[t].sum>=val) { node[t].sum-=val; return node[t].r; } int mid=(node[t].l+node[t].r)>>1; int ans=-1; if(node[L(t)].sum>=val) ans = update(L(t),val); else ans = update(R(t),val); node[t].sum=max(node[L(t)].sum,node[R(t)].sum); return ans; } int main(void) { #ifdef DEBUG freopen("../stdin.txt","r",stdin); freopen("../stdout.txt","w",stdout); #endif int h,w,n; while(~scanf("%d%d%d",&h,&w,&n)) { init(); build(1,0,min(h,n),w); while(n--) { scanf("%d",&w); int ans=update(1,w); printf("%d\n",ans); } } return 0; }
c0c6fd89fba78f0b5c8f890dc2a96b37ae28b09c
39cf008356c868b1163d95aa37eba05b8a2130ae
/renderer.cpp
45710ceaf2313dfefbd48106dc1e895e93351b86
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
mynameisdesmond/msbOFCore
12f9550446dc16d000f6920fda546b22ab56c123
1e0fb5919c1fdbd7aa99fe7c31f53fe94958270a
refs/heads/master
2020-04-05T19:03:07.361458
2014-04-21T16:29:16
2014-04-21T16:29:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
62,049
cpp
renderer.cpp
#include "input.h" //loaders and the like #include "spriteMeshLoader.h" #include "colladaLoader.h" //actors #include "msbLight.h" //#include "videoTextureActor.h" //buttons #include "listButton.h" #include "sliderButton.h" #include "userPopUp.h" #include "assignButton.h" #include "textInputButton.h" #include "moveButton.h" #include "rotateButton.h" //nodes #include "node.h" #include "layer.h" //data #include "meshData.h" #ifdef TARGET_WIN32 #include <Commdlg.h> #include <stdio.h> #include <conio.h> #include <tchar.h> #endif //static link Renderer* Renderer::rendererInstance=NULL; //************************************************************ // //RTTY actorInfo - Information about every Actor: // Class Name, Type, Size // //************************************************************ void Renderer::fillGlobalLists(){ //actors createActorID(new Actor); //createActorID(new VideoTextureActor); createActorID(new MsbLight); ////buttons createActorID(new BasicButton); createActorID(new Layer); createActorID(new ListButton); createActorID(new SliderButton); createActorID(new UserPopUp); createActorID(new TextInputButton); createActorID(new AssignButton); createActorID(new MoveButton); createActorID(new RotateButton); createActorID(new Node); } //************************************************************ // //Constructor and Destructor // //************************************************************ Renderer::Renderer(){ backgroundTex="NULL"; backgroundColor=Vector4f(0.0,0.3,0.5,1); lastShader="NULL"; currentLayer=0; startSceneFilename=""; bDrawLighting=true; bRenderStereo=true; bDrawMenu=true; bDrawNodes=true; bUseBlending=true; bMultisample=true; bFullscreen=false; lightLoc=Vector3f(0,3,15); //light Location ambient=Vector3f(1,1,1); fov=45; nearClip=0.2; farClip=1000; frustumTop=0.083; frustumBottom=-0.083; eyeDistance=0.10; bkgOffset = 50.0; mouseSensitivity=0.005; moveSpeed=0.1; screenX=0; screenY=0; windowX=0; windowY=0; lighting_tx = 0; // the light texture lighting_fb = 0; // the framebuffer object to render to that texture depth_tx = 0; depth_fb = 0; depth_size = 512; scene_tx = 0; scene_fb = 0; scene_size = 512; multiSample_fb = 0; multiSample_db = 0; multiSample_depth = 0; multiSample_color = 0; leftEye_tx = 0; leftEye_fb = 0; leftEyeDepth_tx = 0; leftEyeDepth_fb = 0; rightEye_tx = 0; rightEye_fb = 0; rightEyeDepth_tx = 0; rightEyeDepth_fb = 0; rightEyeFBO=NULL; leftEyeFBO=NULL; postOverlay=NULL; deltaTime=0.0; drawBuffers[0] = GL_COLOR_ATTACHMENT0_EXT; drawBuffers[1] = GL_COLOR_ATTACHMENT1_EXT; drawBuffers[2] = GL_COLOR_ATTACHMENT2_EXT; drawBuffers[3] = GL_COLOR_ATTACHMENT3_EXT; } Renderer::~Renderer(){ glDeleteFramebuffersEXT(1, &lighting_fb); glDeleteFramebuffersEXT(1, &shadow_fb); glDeleteFramebuffersEXT(1, &depth_fb); glDeleteFramebuffersEXT(1, &scene_fb); glDeleteRenderbuffersEXT(1, &multiSample_db); glDeleteRenderbuffersEXT(1, &multiSample_depth); glDeleteRenderbuffersEXT(1, &multiSample_color); glDeleteFramebuffersEXT(1, &multiSample_fb); } Renderer* Renderer::getInstance(){ if (rendererInstance) return rendererInstance; else{ rendererInstance=new Renderer; return rendererInstance; } } //************************************************************ // // Windowing stuff and screen setup // //************************************************************ void Renderer::initWindow(int x, int y, string windowName){ //screenX=x; //screenY=y; input->screenX=screenX; input->screenY=screenY; glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA | GLUT_MULTISAMPLE); // glutInitDisplayString("rgba double depth>=24 sample=8"); if (bFullscreen) { // windowXxwindowY, 32bit pixel depth, 60Hz refresh rate char* gmString = new char[64]; sprintf(gmString," %ix%i:32@60",windowX,windowY); glutGameModeString( gmString ); // start fullscreen game mode glutEnterGameMode(); } else { glutInitWindowSize(x,y); glutInitWindowPosition(input->windowX,input->windowY); glutCreateWindow(windowName.c_str()); } } void Renderer::reDrawScreen(int w, int h){ // Prevent a divide by zero, when window is too short // (you cant make a window of zero width). if(h == 0) h = 1; // float ratio = 1.0* w / h; // Reset the coordinate system before modifying glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Set the viewport to be the entire window glViewport(0, 0, w, h); // Set the correct perspective. gluPerspective(fov,(screenY==0)?(1):((float)screenX/screenY),nearClip,farClip); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(camActor->location.x, camActor->location.y,camActor->location.z, camActor->zAxis.x,camActor->zAxis.y,camActor->zAxis.z, camActor->yAxis.x, camActor->yAxis.y,camActor->yAxis.z); input->screenX=screenX; input->screenY=screenY; } // load render settings void Renderer::loadPreferences(){ #ifndef TARGET_WIN32 //switch to working directory!! CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef resourcesURL = CFBundleCopyBundleURL(mainBundle); char path[PATH_MAX]; if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) { // error! } CFRelease(resourcesURL); string myPath=path; //get rid of Moviesandbox.app at the end! myPath.erase(myPath.end()-24, myPath.end() ); cout << myPath << endl; chdir( ( ofToDataPath("..").c_str() ) ); #endif input=Input::getInstance(); colladaLoader=new ColladaLoader(); spriteMeshLoader=new SpriteMeshLoader(); //open config xml file //configure renderer cout << "Loading Config file" <<endl; TiXmlDocument doc( "config.xml" ); if (!doc.LoadFile()) { cout << "Cannot find config file, or config file corrupt. Exiting..." << endl; exit(0); } TiXmlHandle hDoc(&doc); TiXmlElement * element; TiXmlHandle hRoot(0); //*********************************************************************** //Get the "Moviesandbox" element //*********************************************************************** element=hDoc.FirstChildElement().Element(); // should always have a valid root but handle gracefully if it doesn't if (!element) return; // save this for later hRoot=TiXmlHandle(element); //now load the configuration cout << "loading render settings" << endl; element=hRoot.FirstChild( "Rendersettings" ).Element(); int val=0; double dVal=0.0; string mStr; //resolution element->Attribute("WindowSizeX", &val); windowX=val; element->Attribute("WindowSizeY", &val); windowY=val; //renderscreen element->Attribute("ScreenSizeX", &val); screenX=val; element->Attribute("ScreenSizeY", &val); screenY=val; //fullscreen on/off element->Attribute("bFullScreen", &val); bFullscreen=bool(val); backgroundTex=element->Attribute("BackgroundTex"); //light drawing on/off mStr=element->Attribute("bDrawLighting", &val); bDrawLighting=bool(val); //stereo Render on/off mStr=element->Attribute("bRenderStereo", &val); bRenderStereo=bool(val); //multisampling on/off mStr=element->Attribute("bMultisample", &val); bMultisample=bool(val); element->Attribute("numSamples", &val); numSamples=val; //rendertarget texture resolutions element->Attribute("ShadowSize", &val); shadow_size=val; element->Attribute("SceneSize", &val); scene_size=val; element->Attribute("MouseSensitivity", &dVal); mouseSensitivity=dVal; element->Attribute("MoveSpeed", &dVal); moveSpeed=dVal; element->Attribute("FOV", &dVal); fov=dVal; //setting start scene startSceneFilename=element->Attribute("StartSceneFile"); //setting libraries element=hRoot.FirstChild( "Library" ).Element(); while (element){ library.push_back(element->Attribute("Library")); element=element->NextSiblingElement("Library"); } } //************************************************************ // // Setting up and calling all Actors' update function // //************************************************************ void Renderer::setup(){ //generate Class and Type Lists fillGlobalLists(); //create base layer addLayer("baseLayer"); FreeImage_Initialise(); input->setup(); //controller gets created here! glEnable(GL_TEXTURE_RECTANGLE_ARB); //this is setting up the menu - I don't want to make this xml based now, it's too complicated for (int i=0;i<(int)library.size();i++){ input->loadTextures(library[i]); input->loadShaders(library[i]); } //background Color #ifdef TARGET_WIN32 //if (!GLEE_EXT_framebuffer_multisample){ bMultisample=false; cout << "Multisampling not supported for FBOs, switching them off..." << endl; //} //also, set back dataPath //god, this took forever to figure out... #endif //picking! cout << "Setup Error check: "; checkOpenGLError(); glGenTextures(1, &pickTexture); glBindTexture(GL_TEXTURE_2D, pickTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, 1, 1, 0, GL_BGRA, GL_FLOAT, NULL); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_NEAREST); glBindTexture (GL_TEXTURE_2D, 0); int maxColorBuffers; glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &maxColorBuffers); cout << "max colorbuffers: " << maxColorBuffers << endl; //frame buffer objects //always need them with layer system! //buffer to copy from for FSAA multisampling in FBOs createFBO(&multiSample_fb, NULL, &multiSample_db, scene_size, false, "multisampleBuffer"); createFBO(&lighting_fb, &lighting_tx, NULL, scene_size, false, "lighting"); createFBO(&shadow_fb, &shadow_tx, NULL, shadow_size, false, "shadow"); cout << "Setup Error check: "; checkOpenGLError(); //enable Blending for everyone! glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); /* * Enable Hardware Point Sprites throughout */ //Setup Point sprite textures, glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE ); //Enable Vertex Shader point-size control glEnable( GL_VERTEX_PROGRAM_POINT_SIZE ); //always enable (if disabling, re-enable afterwards! glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); if (bMultisample) glEnable(GL_MULTISAMPLE); //just in case we force multisampling glEnable(GL_NORMALIZE); cout << "Setup Error check: "; checkOpenGLError(); } void Renderer::createFBO(GLuint* fbObject, GLuint* fbTexture, GLuint* fbDepth, int fbSize, bool bDepth, string name){ //------------------------------------------------------- // framebuffer object //set up renderbuffer int maxsamples; glGetIntegerv(GL_MAX_SAMPLES_EXT,&maxsamples); GLenum sampleType=GL_RGBA16F_ARB; //GLenum sampleType=GL_RGBA32F_ARB; if (!bDepth){ if (name=="multisampleBuffer"){ //see if 16bit multisample is allowed glGenRenderbuffersEXT(1, &multiSample_color); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, multiSample_color); if (bMultisample) glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, numSamples, GL_RGBA16F_ARB, fbSize, fbSize); else glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, sampleType, fbSize, fbSize); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); //COLOR COMPONENTS glGenRenderbuffersEXT(1, &multiSample_depth); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, multiSample_depth); if (bMultisample) glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, numSamples, GL_RGBA16F_ARB, fbSize, fbSize); else glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, sampleType, fbSize, fbSize); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); glGenRenderbuffersEXT(1, &multiSample_pick); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, multiSample_pick); if (bMultisample) glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, numSamples, GL_RGBA16F_ARB, fbSize, fbSize); else glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, sampleType, fbSize, fbSize); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); glGenRenderbuffersEXT(1, &multiSample_lightData); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, multiSample_lightData); if (bMultisample) glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, numSamples, GL_RGBA16F_ARB, fbSize, fbSize); else glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, sampleType, fbSize, fbSize); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); //DEPTH COMPONENT glGenRenderbuffersEXT(1, &multiSample_db); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, multiSample_db); if (bMultisample) glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, numSamples, GL_DEPTH_COMPONENT, fbSize, fbSize); else glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, fbSize, fbSize); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); glGenFramebuffersEXT (1, fbObject); glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, *fbObject); // attach renderbuffer glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, multiSample_color); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_RENDERBUFFER_EXT, multiSample_depth); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_RENDERBUFFER_EXT, multiSample_pick); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT3_EXT, GL_RENDERBUFFER_EXT, multiSample_lightData); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, multiSample_db); } else{ //glGenRenderbuffersEXT(1, fbDepth); //glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, *fbDepth); //glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, fbSize, fbSize); //glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); glGenFramebuffersEXT (1, fbObject); glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, *fbObject); // attach renderbuffer //glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, *fbDepth); } } // create the texture we'll use for the shadow map if (name!="multisampleBuffer"){ glGenTextures(1, fbTexture); glBindTexture(GL_TEXTURE_2D, *fbTexture); if (bDepth){ glGenFramebuffersEXT (1, fbObject); glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, *fbObject); glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); glTexImage2D (GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, fbSize, fbSize, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); //float borderColor[] = { 1.0f, 1.0f, 1.0f, 1.0f }; //glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR,borderColor); // set up hardware shadow mapping //this is needed to get good results for shadow2DProj //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); //this is needed to read a texture2D from a DepthMap! //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, *fbTexture, 0); } else{ cout << "no depth in FBO!" << name << endl; // attach colorBuffer to a texture glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); glTexImage2D(GL_TEXTURE_2D, 0, sampleType, fbSize, fbSize, 0, GL_RGBA, GL_FLOAT, NULL); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, *fbTexture, 0); } } if (bDepth){ glDrawBuffer (GL_NONE); glReadBuffer (GL_NONE); } // verify all is well and restore state checkFBOStatus(); glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); glBindTexture (GL_TEXTURE_2D, 0); if (name=="multisampleBuffer") return; textureList[name]=new textureObject; textureList[name]->texture=(uint)*fbTexture; textureList[name]->nextTexture="NULL"; textureList[name]->frameRate=0; if (bDepth) textureList[name]->bAlpha=true; else textureList[name]->bAlpha=false; textureList[name]->bWrap=false; textureList[name]->texFilename="NULL"; cout << "FBO texture name " << name << endl; //------------------------------------------------------- //end framebuffer object } void Renderer::checkFBOStatus(){ GLenum status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); switch (status){ case GL_FRAMEBUFFER_COMPLETE_EXT: break; case GL_FRAMEBUFFER_UNSUPPORTED_EXT: cerr << "FBO configuration unsupported" << endl; break; case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: cerr << "FBO DrawBuffer incomplete" << endl; break; case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT: cerr << "FBO Multisample incomplete" << endl; break; default: cerr << "FBO programmer error" << endl; break; } } void Renderer::update(){ float updateTime=glutGet(GLUT_ELAPSED_TIME); //first update Nodes! for (unsigned int i=0;i<buttonList.size();i++){ Node* myNode=dynamic_cast<Node*>(buttonList[i]); NodeIO* myNodeIO=dynamic_cast<NodeIO*>(buttonList[i]); if (myNode && bDrawNodes) buttonList[i]->update(deltaTime); if (myNodeIO && bDrawNodes) buttonList[i]->update(deltaTime); if (!myNode && !myNodeIO) buttonList[i]->update(deltaTime); } //then update Actors! for (int i=0;i<(int)actorList.size();i++){ actorList[i]->objectID=(float)i; actorList[i]->update(deltaTime); } //then helpers - we are using these for brush and grid and stuff for (int i=0;i<(int)helperList.size();i++){ helperList[i]->update(deltaTime); } //then input! input->update(deltaTime); updateTime=glutGet(GLUT_ELAPSED_TIME) - updateTime; input->updateTime=updateTime; } void Renderer::addLayer(string layerName){ Layer* lay = new Layer; lay->setup(); lay->name=layerName; lay->textureID=lay->name+"_Color"; lay->depthTextureID=lay->name+"_Depth"; lay->pickTextureID=lay->name+"_Pick"; lay->lightDataTextureID=lay->name+"_lightData"; layerList.push_back(lay); createFBO(&(lay->colorFBO), &(lay->colorTex), NULL, scene_size, false, lay->textureID); createFBO(&(lay->depthFBO), &(lay->depthTex), NULL, scene_size, false, lay->depthTextureID); createFBO(&(lay->pickFBO), &(lay->pickTex), NULL, scene_size, false, lay->pickTextureID); createFBO(&(lay->lightDataFBO), &(lay->lightDataTex), NULL, scene_size, false, lay->lightDataTextureID); currentLayer=layerList.size()-1; cout << "Added new Layer:" << layerName << endl; } //************************************************************ // // Drawing to the screen - Actors, Buttons and RenderToTexture // //************************************************************ void Renderer::setupCamera(bool bCalculateMatrices){ //setup Projection glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(fov,(screenY==0)?(1):((float)screenX/screenY),nearClip,farClip); //setup camera glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(camActor->location.x, camActor->location.y,camActor->location.z, camActor->zAxis.x,camActor->zAxis.y,camActor->zAxis.z, camActor->yAxis.x, camActor->yAxis.y,camActor->yAxis.z); /* gluLookAt(0,0,0, 0,0,-1, 0,1,0); */ if (bCalculateMatrices){ glGetFloatv(GL_PROJECTION_MATRIX,projectionMatrix); glGetFloatv(GL_MODELVIEW_MATRIX,cameraMatrix); inverseCameraMatrix=cameraMatrix.inverse(); inverseProjectionMatrix=projectionMatrix.inverse(); //inverseCameraMatrix=cameraMatrix.transpose(); } } void Renderer::draw(){ glEnable(GL_LIGHTING); glEnable(GL_TEXTURE); glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); setupCamera(true); //TODO:Stereo with Layers! /* if (bRenderStereo){ drawStereoscopic(); } */ drawSceneTexture(); ///////////////////////////////////////////////////// /// 2D Elements from here ///////////////////////////////////////////////////// /* * Set Ortho viewing transformation */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0,screenX,screenY,0,-1,1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glActiveTexture(GL_TEXTURE0); glDisable(GL_DEPTH_TEST); /* * Draw Final Image */ glClearColor( backgroundColor.r,backgroundColor.g,backgroundColor.b,backgroundColor.a ); //glClear(GL_COLOR_BUFFER_BIT); for (int i=0;i<(int)layerList.size();i++){ if (bDrawLighting){ drawDeferredLighting(layerList[i]); } else layerList[i]->sceneShaderID="texture"; //then, draw our final composite drawButton(layerList[i]); } /* * DisplayDebug */ setupShading("font"); input->displayDebug(); /* * Draw all Buttons */ draw2D(); glUseProgram(0); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE); frames++; deltaTime=glutGet(GLUT_ELAPSED_TIME)-currentTime; currentTime=glutGet(GLUT_ELAPSED_TIME); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); } void Renderer::drawShadows(MsbLight* myLight){ glPushAttrib(GL_VIEWPORT_BIT); //glShadeModel(GL_FLAT); glViewport (0, 0, shadow_size, shadow_size); //setup projection glMatrixMode(GL_PROJECTION); glLoadIdentity(); glPushMatrix(); //set perspective gluPerspective(110.0f, 1.0f, nearClip, 1000.0f); //this sets the framing of the light! glGetFloatv(GL_PROJECTION_MATRIX,lightProjectionMatrix); //setup camera glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glPushMatrix(); Vector3f lAxis = myLight->location+myLight->zAxis; //lAxis=myLight->zAxis; gluLookAt( myLight->location.x, myLight->location.y, myLight->location.z, lAxis.x, lAxis.y, lAxis.z, 0.0f, 1.0f, 0.0f); glGetFloatv(GL_MODELVIEW_MATRIX,lightViewMatrix); //glDisable(GL_BLEND); glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, multiSample_fb); GLenum depthOnly={GL_COLOR_ATTACHMENT1_EXT}; glDrawBuffers(1,&depthOnly); for (int i=0;i<(int)layerList.size();i++){ glClearColor( -1.0f, -1.0f, -1.0f, -1.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); draw3D(layerList[i]); glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, multiSample_fb ); glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, shadow_fb ); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glBlitFramebufferEXT( 0, 0, scene_size-1, scene_size-1, 0, 0, scene_size-1, scene_size-1, GL_COLOR_BUFFER_BIT, GL_NEAREST ); } glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glPopAttrib (); // restore the viewport } void Renderer::drawSceneTexture(){ glPushAttrib(GL_VIEWPORT_BIT); glViewport (0, 0, scene_size, scene_size); glMatrixMode(GL_MODELVIEW); float draw3DTime=glutGet(GLUT_ELAPSED_TIME); /* int max_buffers; glGetIntegerv(GL_MAX_DRAW_BUFFERS, &max_buffers); cout << "Max Draw Buffers: " << max_buffers << endl; */ glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, multiSample_fb); glDrawBuffers(4,drawBuffers); glClearColor( -1.0f, -1.0f, -1.0f, -1.0f ); for (int i=0;i<(int)layerList.size();i++){ glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); //disable blending for second, third and fourth buffer glDisableIndexedEXT(GL_BLEND,1); glDisableIndexedEXT(GL_BLEND,2); glDisableIndexedEXT(GL_BLEND,3); glActiveTexture(GL_TEXTURE0); //drawbuffers are set up here! draw3D(layerList[i]); //color blitting glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, multiSample_fb ); glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, layerList[i]->colorFBO ); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glBlitFramebufferEXT( 0, 0, scene_size, scene_size, 0, 0, scene_size, scene_size, GL_COLOR_BUFFER_BIT, GL_NEAREST ); //depth blitting glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, layerList[i]->depthFBO ); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glBlitFramebufferEXT( 0, 0, scene_size, scene_size, 0, 0, scene_size, scene_size, GL_COLOR_BUFFER_BIT, GL_NEAREST ); //picking blitting glReadBuffer(GL_COLOR_ATTACHMENT2_EXT); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, layerList[i]->pickFBO ); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glBlitFramebufferEXT( 0, 0, scene_size, scene_size, 0, 0, scene_size, scene_size, GL_COLOR_BUFFER_BIT, GL_NEAREST ); //lightInfo blitting glReadBuffer(GL_COLOR_ATTACHMENT3_EXT); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, layerList[i]->lightDataFBO ); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glBlitFramebufferEXT( 0, 0, scene_size, scene_size, 0, 0, scene_size, scene_size, GL_COLOR_BUFFER_BIT, GL_NEAREST ); } //cleanup glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, 0 ); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, 0 ); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); pick(input->mouseX,input->mouseY); draw3DTime=glutGet(GLUT_ELAPSED_TIME) - draw3DTime; input->draw3DTime=draw3DTime; //TODO:draw brush here? glPopAttrib(); //now draw the resulting image into a quad! } void Renderer::drawStereoscopic(){ float right, left; right=screenX/screenY * frustumTop; left=screenX/screenY * frustumBottom; float nleft, nright; nright=right - (-0.0075 * right); //Thanks to Flocki for the magic numbers nleft =left - (-0.0075 * right); glPushAttrib(GL_VIEWPORT_BIT); /*********************************************************** Left Eye ************************************************************/ glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, multiSample_fb); glDrawBuffers(2, drawBuffers); glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glViewport (0, 0, scene_size, scene_size); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(nleft, nright, frustumBottom, frustumTop, nearClip, farClip); glTranslatef(eyeDistance,0,0); //drawBackground(-eyeDistance); glMatrixMode(GL_MODELVIEW); draw3D(layerList[0]); //color blitting glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, multiSample_fb ); glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, leftEye_fb ); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glBlitFramebufferEXT( 0, 0, scene_size-1, scene_size-1, 0, 0, scene_size-1, scene_size-1, GL_COLOR_BUFFER_BIT, GL_NEAREST ); //depth blitting glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, multiSample_fb ); glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, leftEyeDepth_fb ); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glBlitFramebufferEXT( 0, 0, scene_size-1, scene_size-1, 0, 0, scene_size-1, scene_size-1, GL_COLOR_BUFFER_BIT, GL_NEAREST ); //cleanup glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, 0 ); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, 0 ); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); /*********************************************************** Right Eye ************************************************************/ nright=right - (-0.0075 * right); //Thanks to Flocki for the magic numbers nleft =left - (-0.0075 * right); glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, multiSample_fb); glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glViewport (0, 0, scene_size, scene_size); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(nleft, nright, frustumBottom, frustumTop, nearClip, farClip); glTranslatef(-eyeDistance,0,0); // drawBackground(eyeDistance); glMatrixMode(GL_MODELVIEW); draw3D(layerList[0]); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); //color blit glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, multiSample_fb ); glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, rightEye_fb ); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glBlitFramebufferEXT( 0, 0, scene_size-1, scene_size-1, 0, 0, scene_size-1, scene_size-1, GL_COLOR_BUFFER_BIT, GL_NEAREST ); //depth blit glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, multiSample_fb ); glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, rightEyeDepth_fb ); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glBlitFramebufferEXT( 0, 0, scene_size-1, scene_size-1, 0, 0, scene_size-1, scene_size-1, GL_COLOR_BUFFER_BIT, GL_NEAREST ); //cleanup glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, 0 ); glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, 0 ); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); glPopAttrib (); // restore the viewport } void Renderer::drawDeferredLighting(Layer* layer){ //bind depth and pick Textures glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, layer->depthTex); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, layer->pickTex); //bind fxTexture glActiveTexture(GL_TEXTURE4); glBindTexture(GL_TEXTURE_2D, layer->lightDataTex); //preserve our unlit color content string oldTextureID=layer->textureID; //bind lighting base texture and clear it glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, lighting_fb); glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glBindFramebufferEXT (GL_FRAMEBUFFER_EXT,0); glPushAttrib(GL_VIEWPORT_BIT); glViewport (0, 0, scene_size, scene_size); //set our textureID to lighting pass layer->textureID="lighting"; //set our shader to layer->sceneShaderID="deferredLight"; ///loop from here for every shadowed light! for (int i=0;i<(int)lightList.size(); i++){ if (lightList[i]->bCastShadows) drawShadows(lightList[i]); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0,screenX,screenY,0,-1,1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); float castShadow=(float)lightList[i]->bCastShadows; //update light glLightfv(GL_LIGHT0,GL_POSITION,&lightList[i]->location.x); glLightfv(GL_LIGHT0,GL_DIFFUSE,&lightList[i]->color.r); glLightfv(GL_LIGHT0,GL_LINEAR_ATTENUATION,&lightList[i]->lightDistance); glLightfv(GL_LIGHT0,GL_SPOT_CUTOFF,&castShadow); //just to make sure... glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, lighting_tx); //set shadowTexture glActiveTexture(GL_TEXTURE3); glBindTexture(GL_TEXTURE_2D, shadow_tx); //set shadowTexture glActiveTexture(GL_TEXTURE5); glBindTexture(GL_TEXTURE_2D, textureList[backgroundTex]->texture); ///light&shadow rendering //render lighting pass into multisampled (TODO: make non-multisampled!) lighting FBO //bind multisample FBO glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, lighting_fb); //only clear depth glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); glClear( GL_DEPTH_BUFFER_BIT ); //draw using lighting_tx as base texture! drawButton(layer); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT,0); } //repeat for every shadowed light! glPopAttrib(); //set our textureID to lighting pass layer->textureID=oldTextureID; //set our shader to layer->sceneShaderID="post"; //light as 3rd texture! glActiveTexture(GL_TEXTURE3); glBindTexture(GL_TEXTURE_2D, lighting_tx); } void Renderer::draw3D(Layer* currentLayer){ glActiveTexture(GL_TEXTURE0); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glDrawBuffers(4, drawBuffers); //draw color for (int i=0;i<(int)currentLayer->actorList.size(); i++){ //update matrices when hidden if(currentLayer->actorList[i]->bHidden){ glPushMatrix(); transformActorMatrix(currentLayer->actorList[i]); glPopMatrix(); } else { //draw in all buffers for pickable actors if (currentLayer->actorList[i]->bPickable){ drawActor(currentLayer->actorList[i]); } //don't draw in picking buffer for non-pickable actors } } //reset texture Matrix transform glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); //this for xyz axis //throws openGL error! /* //glDepthMask(GL_FALSE); setupShading("color"); for (int i=0;i<(int)currentLayer->actorList.size();i++){ drawOrientation(currentLayer->actorList[i]); } */ } void Renderer::draw2D(){ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); //colored Buttons first for (unsigned int i=0;i<buttonList.size();i++){ Node* myNode=dynamic_cast<Node*>(buttonList[i]); NodeIO* myNodeIO=dynamic_cast<NodeIO*>(buttonList[i]); //if we disabled drawing nodes... if ((myNode || myNodeIO) && bDrawNodes) drawButton(buttonList[i]); //always draw everything else if (!myNode && !myNodeIO) drawButton(buttonList[i]); } //finally font rendering setupShading("font"); for (unsigned int i=0;i<buttonList.size();i++){ Node* myNode=dynamic_cast<Node*>(buttonList[i]); NodeIO* myNodeIO=dynamic_cast<NodeIO*>(buttonList[i]); if ((myNode || myNodeIO) && bDrawNodes) buttonList[i]->drawTooltip(); if (!myNode && !myNodeIO) buttonList[i]->drawTooltip(); } } void Renderer::drawButton(BasicButton* b){ //set Texture glActiveTexture(GL_TEXTURE0); //glEnable (GL_ARB_texture_rectangle); //- leave this to OpenFrameworks?? glBindTexture(GL_TEXTURE_2D, textureList[b->textureID]->texture); if (b->ofTexturePtr){ glActiveTexture(GL_TEXTURE1); glEnable (b->ofTexturePtr->texData.textureTarget); //- leave this to OpenFrameworks?? glBindTexture(b->ofTexturePtr->texData.textureTarget, b->ofTexturePtr->texData.textureID); } //setupTexturing(b->textureID,b); //set Shader setupShading(b->sceneShaderID); b->updateShaders(); glPushMatrix(); //buttons only translate glTranslatef(b->location.x,b->location.y,b->location.z); //only rotate buttons on z-Axis glRotatef(b->rotation.z,0,0,1); //draw //TODO:phase out... b->drawPlane(); //drawPlane(0.0, 0.0, b->scale.x, b->scale.y, b->color); glDisable (GL_ARB_texture_rectangle); glActiveTexture(GL_TEXTURE0); glPopMatrix(); } void Renderer::drawActor(Actor* a){ if (a->bTextured) setupTexturing(a->textureID, a); //alpha blending glBlendFunc(a->blendModeOne,a->blendModeTwo); // glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA); glBlendFuncSeparate(a->blendModeOne,a->blendModeOne,GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFuncSeparate(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA,GL_ONE, GL_ONE_MINUS_SRC_ALPHA); //start translating glPushMatrix(); //translate according to base transformActorMatrix(a); //shader setupShading(a->sceneShaderID); a->updateShaders(); if (!a->bZTest) glDisable(GL_DEPTH_TEST); if (!a->bZWrite) glDepthMask(GL_FALSE); //set Color glColor4f(a->color.r,a->color.g,a->color.b,a->color.a); //Actual Drawing takes place here! if (a->drawType==DRAW_PLANE) drawPlane(0.0,0.0,a->scale.x, -a->scale.y, a->color,true ); else if (a->drawType==DRAW_VBOMESH) drawColladaMesh(a); else if (a->drawType==DRAW_PARTICLES) drawParticles(a); //Particles else if (a->drawType==DRAW_SPRITE) a->drawSprite(); else if (a->drawType==DRAW_CUBE) drawCube(a->scale.x, a->scale.x); //Mesh else if (a->drawType==DRAW_TEA) a->drawTeapot(); else if (a->drawType==DRAW_SPECIAL) a->draw(); else if (a->drawType==DRAW_POINTPATCH) drawPatch(a->scale.x,a->scale.y,a->particleScale); if (!a->bZTest) glEnable(GL_DEPTH_TEST); if (!a->bZWrite) glDepthMask(GL_TRUE); //end translation glPopMatrix(); } void Renderer::drawOrientation(Actor* a){ //TODO: Plane orientation, yes/no? if (a->drawType==DRAW_PLANE) return; glPushMatrix(); if (a->base){ glMultMatrixf(a->base->baseMatrix); drawLine(Vector3f(0,0,0),(a->originalMatrix * a->transformMatrix).getTranslation(),Vector4f(1,1,1,1)); glMultMatrixf(a->originalMatrix); glMultMatrixf(a->transformMatrix); } else{ transformActorMatrix(a); } bool bComputeLight=a->bComputeLight; a->bComputeLight=false; a->updateShaders(); //set color to specialSelected glColor4f(1,0,1,1); glLineWidth(4); //draw code for lines //red if (input->specialSelected!=a) glColor4f(1,0,0,1); glBegin(GL_LINES); glVertex3f(0,0,0); glVertex3f(1,0,0); glEnd(); //green if (input->specialSelected!=a) glColor4f(0.0,1.0,0.0,1); glBegin(GL_LINES); glVertex3f(0,0,0); glVertex3f(0,1,0); glEnd(); //blue if (input->specialSelected!=a) glColor4f(0,0,1,1); glBegin(GL_LINES); glVertex3f(0,0,0); glVertex3f(0,0,1); glEnd(); //draw hirarchy a->bComputeLight=bComputeLight; glPopMatrix(); } void Renderer::draw3DOverlay(){ //reset blending glDisable(GL_BLEND); //glViewport(0,0,screenX,screenY); glViewport(screenX,0,screenX,screenY); //TODO: should be drawSFX glActiveTexture(GL_TEXTURE2); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, textureList["leftEyeDepthTexture"]->texture); glActiveTexture(GL_TEXTURE0); glLoadIdentity(); //translate all the way back! //glTranslatef(bkgOffset * offset,0,0.0); setupShading("post"); GLuint uniform_location=0; uniform_location = glGetUniformLocation(shaderList["post"]->shader, "tex"); glUniform1iARB(uniform_location, 0); uniform_location=0; uniform_location = glGetUniformLocation(shaderList["post"]->shader, "depthTex"); glUniform1iARB(uniform_location, 2); //zoom! float zoom3Dx=0.0, zoom3Dy=0.0; glTranslatef(640,512,0); glScalef(zoom3Dx,zoom3Dy,1.0); glTranslatef(-640,-512,0); //do for all FBOs too! glBindTexture(GL_TEXTURE_2D, textureList["leftEyeTexture"]->texture); glColor4f(1.0,1.0,1.0,1.0); /* glBegin(GL_QUADS); glTexCoord2f(0.0,1.0); glVertex3f(leftTopXLeftEye ,leftTopYLeftEye,0); glTexCoord2f(1.0,1.0); glVertex3f(rightTopXLeftEye,rightTopYLeftEye,0.0); glTexCoord2f(1.0,0.0); glVertex3f(rightBottomXLeftEye,rightBottomYLeftEye,0.0); glTexCoord2f(0.0,0.0); glVertex3f(leftBottomXLeftEye,leftBottomYLeftEye,0.0); glEnd(); // drawButton(leftEyeFBO); glViewport(2*screenX,0,screenX,screenY); //glViewport(screenX,0,screenX,screenY); //TODO: should be drawSFX glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, textureList["rightEyeDepthTexture"]->texture); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textureList["rightEyeTexture"]->texture); glColor4f(1.0,1.0,1.0,1.0); glBegin(GL_QUADS); glTexCoord2f(0.0,1.0); glVertex3f(leftTopXRightEye ,leftTopYRightEye,0); glTexCoord2f(1.0,1.0); glVertex3f(rightTopXRightEye,rightTopYRightEye,0.0); glTexCoord2f(1.0,0.0); glVertex3f(rightBottomXRightEye,rightBottomYRightEye,0.0); glTexCoord2f(0.0,0.0); glVertex3f(leftBottomXRightEye ,leftBottomYRightEye,0.0); glEnd(); */ // drawButton(rightEyeFBO); //reset viewport glViewport(0,0,screenX,screenY); glLoadIdentity(); //reset blending glEnable(GL_BLEND); } void Renderer::drawBone(float width, float height, float depth){ } void Renderer::drawCube(float scale, float cubeSize){ glutSolidCube( cubeSize / max(scale , 1.0f) ); } void Renderer::drawPlane(float x1,float y1,float x2,float y2, Vector4f color, bool bCentered){ //draw centered! //TODO:can be optional? float xOffset=0.0; float yOffset=0.0; if (bCentered){ xOffset=(x2-x1)/2.0; yOffset=(y2-y1)/2.0; } GLfloat verts[] = { x1-xOffset, y1-yOffset, x1-xOffset, y2-yOffset, x2-xOffset, y2-yOffset, x2-xOffset, y1-yOffset }; GLfloat tex_coords[] = { 0, 0, 0, 1, 1, 1, 1, 0 }; GLfloat normals[] = { 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1 }; GLfloat vColor[] ={ color.r, color.g, color.b, color.a, color.r, color.g, color.b, color.a, color.r, color.g, color.b, color.a, color.r, color.g, color.b, color.a }; glEnableClientState( GL_VERTEX_ARRAY ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glEnableClientState( GL_NORMAL_ARRAY ); glEnableClientState( GL_COLOR_ARRAY); glTexCoordPointer(2, GL_FLOAT, 0, tex_coords ); glVertexPointer(2, GL_FLOAT, 0, verts ); glNormalPointer(GL_FLOAT, 0, normals ); glColorPointer(4,GL_FLOAT,0, vColor); glDrawArrays( GL_TRIANGLE_FAN, 0, 4 ); glDisableClientState( GL_VERTEX_ARRAY ); glDisableClientState( GL_TEXTURE_COORD_ARRAY ); glDisableClientState( GL_NORMAL_ARRAY ); glDisableClientState( GL_COLOR_ARRAY); } void Renderer::drawPatch(float width, float height, float resolution){ //create a vertex array for a quad patch with "resolution" amount of vertices per side //lets do points for now... vector<Vector4f> vertices; vector<GLfloat> texCoords; for (int h=0;h<resolution;h++){ //for every line... for (int l=0;l<resolution;l++){ Vector4f myVertex; myVertex.x=float(l) * width/(resolution-1.0) - width/2.0f; //x-coord myVertex.y=float(h) * height/(resolution-1.0) - height/2.0f; myVertex.z=0.0f; myVertex.w=1.0f; vertices.push_back(myVertex); //texCoords.push_back( float(l) /(resolution-1.0) ); //x-texCoord //texCoords.push_back( float(h) /(resolution-1.0) ); //y-texCoord texCoords.push_back( float(l)); //x-texCoord texCoords.push_back( float(h)); //y-texCoord } } // activate and specify pointer to vertex array glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); GLfloat *verts=&vertices[0].x; glVertexPointer(4, GL_FLOAT, 0, verts); glTexCoordPointer(2, GL_FLOAT, 0, &texCoords[0]); // draw the patch as points glDrawArrays(GL_POINTS, 0, resolution* resolution ); // deactivate vertex arrays after drawing glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); } void Renderer::drawLine(Vector3f start, Vector3f end, Vector4f startColor, Vector4f endColor){ glLineWidth(4.0); glBegin(GL_LINES); glColor4f(startColor.r,startColor.g,startColor.b,startColor.a); glVertex3f(start.x,start.y,start.z); glColor4f(endColor.r,endColor.g,endColor.b,endColor.a); glVertex3f(end.x,end.y,end.z); glEnd(); } void Renderer::drawParticles (Actor* a){ MeshData* myMesh=vboList[a->vboMeshID]; if (!myMesh) return; if (myMesh->bTextured) glEnable( GL_POINT_SPRITE_ARB ); if (myMesh->vData.size()>0){ GLfloat *vertexIDs=&myMesh->vData[0].vertexID; GLfloat *verts=&myMesh->vData[0].location.x; GLfloat *normals=&myMesh->vData[0].normal.x; GLfloat *colors=&myMesh->vData[0].color.r; GLfloat *secondaryColors=&myMesh->vData[0].secondaryColor.r; GLfloat *vertexWeights=&myMesh->vData[0].vertexWeights.x; GLfloat *boneReferences=&myMesh->vData[0].boneReferences.x; glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_SECONDARY_COLOR_ARRAY); glVertexPointer(4, GL_FLOAT,sizeof(myMesh->vData[0]),verts); glNormalPointer(GL_FLOAT,sizeof(myMesh->vData[0]),normals); glColorPointer(4, GL_FLOAT,sizeof(myMesh->vData[0]),colors); glSecondaryColorPointer(3, GL_FLOAT,sizeof(myMesh->vData[0]),secondaryColors); //vertexID from here GLint indexThree; indexThree=glGetAttribLocation(shaderList[a->sceneShaderID]->shader,"vertexID"); glEnableVertexAttribArray(indexThree); glVertexAttribPointer(indexThree,1,GL_FLOAT,false,sizeof(myMesh->vData[0]),vertexIDs); GLint indexOne,indexTwo; //skeletal Stuff from here glDrawArrays(GL_POINTS,0,myMesh->vData.size()); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_SECONDARY_COLOR_ARRAY); glDisableVertexAttribArray(indexThree); } if (myMesh->bTextured) glDisable(GL_POINT_SPRITE_ARB); } void Renderer::drawColladaMesh (Actor* a){ MeshData* myMesh=vboList[a->vboMeshID]; if (!myMesh) return; glPushMatrix(); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glBindBufferARB(GL_ARRAY_BUFFER_ARB, myMesh->vertexBufferObject[0]); glVertexPointer(myMesh->verticesPerShapeCount, GL_FLOAT, 0, 0); glBindBufferARB(GL_ARRAY_BUFFER_ARB, myMesh->normalBufferObject[0]); glNormalPointer(GL_FLOAT, 0, 0); glBindBufferARB(GL_ARRAY_BUFFER_ARB, myMesh->texCoordBufferObject[0]); glTexCoordPointer(myMesh->texCoordPerVertexCount, GL_FLOAT, 0, 0); if (myMesh->colorBufferObject.size()>0){ glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_SECONDARY_COLOR_ARRAY); glBindBufferARB(GL_ARRAY_BUFFER_ARB, myMesh->colorBufferObject[0]); glColorPointer(4, GL_FLOAT, 0, 0); glBindBufferARB(GL_ARRAY_BUFFER_ARB, myMesh->secondaryColorBufferObject[0]); glSecondaryColorPointer(3,GL_FLOAT, 0, 0); } //skinning from here! //use two index arrays for skinning GLint indexOne,indexTwo; if (myMesh->bIsSkeletal){ indexOne=glGetAttribLocation(shaderList["skeletal"]->shader,"boneReferences"); glEnableVertexAttribArray(indexOne); glBindBufferARB(GL_ARRAY_BUFFER, myMesh->boneReferenceObject[0]); glVertexAttribPointer(indexOne,4,GL_FLOAT,false,0,0); indexTwo=glGetAttribLocation(shaderList["skeletal"]->shader,"vertexWeights"); glEnableVertexAttribArray(indexTwo); glBindBufferARB(GL_ARRAY_BUFFER, myMesh->vertexWeightsObject[0]); glVertexAttribPointer(indexTwo,4,GL_FLOAT,false,0,0); } glDrawArrays(myMesh->vertexInterpretation, 0, myMesh->vertexCount[0]); glBindBufferARB(GL_ARRAY_BUFFER_ARB,0); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); if (myMesh->bIsSkeletal){ glDisableVertexAttribArray(indexOne); glDisableVertexAttribArray(indexTwo); } if (myMesh->colorBufferObject.size()>0){ glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_SECONDARY_COLOR_ARRAY); } glPopMatrix(); } void Renderer::drawSprite(){ glBegin(GL_POINTS); glVertex3f(0,0,0); glEnd(); } void Renderer::setupShading(string shaderName){ if (shaderName!=lastShader && shaderList[shaderName]){ glUseProgram(shaderList[shaderName]->shader); lastShader=shaderName; } if (!shaderList[shaderName]) cout << "found bad shader: " << shaderName << endl; } void Renderer::setupTexturing(string texName, Actor* a){ if (!a->ofTexturePtr){ glBindTexture(GL_TEXTURE_2D, textureList[texName]->texture); }else{ //glEnable(a->ofTexturePtr->texData.textureTarget); glEnable (GL_ARB_texture_rectangle); //- leave this to OpenFrameworks?? glBindTexture(a->ofTexturePtr->texData.textureTarget, a->ofTexturePtr->texData.textureID); } if (!a) return; //texture animation if (textureList[texName]->nextTexture!="NULL" && currentTime - a->textTimer > textureList[texName]->frameRate ){ a->textTimer += textureList[texName]->frameRate; a->textureID=textureList[texName]->nextTexture; } transformTextureMatrix(a); } void Renderer::transformActorMatrix(Actor* a){ glMultMatrixf(a->baseMatrix); a->orientation=a->location+a->zAxis; } void Renderer::transformTextureMatrix(Actor* a){ glActiveTexture(GL_TEXTURE0); glMatrixMode( GL_TEXTURE ); glLoadIdentity(); // make changes to the texture glTranslatef(a->texTranslation.x,a->texTranslation.y,a->texTranslation.z); glRotatef(a->texRotation.x,1,0,0); glRotatef(a->texRotation.y,0,1,0); glRotatef(a->texRotation.z,0,0,1); glScalef(a->texScale.x,a->texScale.y,a->texScale.z); glMatrixMode(GL_MODELVIEW); } //************************************************************ // //Picking: determining what Actor the mouse points to // and mouse 3d coordinate // //************************************************************ //picking needs mouse coordinates void Renderer::pick(int x, int y){ ///World Position and object ID //draw pickTex of current layer, just on mouse coordinate, one pixel wide //read pixel color at mouse coordinate //color = xyz location //alpha = object id glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, layerList[currentLayer]->pickFBO ); float mousePos[4]; //create small picking texture glBindTexture(GL_TEXTURE_2D,pickTexture); float xRatio=(float)scene_size/(float)screenX; float yRatio=(float)scene_size/(float)screenY; glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,(int) (x * xRatio),(int) ((screenY-y)*yRatio) ,1 ,1 ); glGetTexImage(GL_TEXTURE_2D,0,GL_BGRA,GL_FLOAT,&mousePos); input->mouse3D.x=mousePos[2]; input->mouse3D.y=mousePos[1]; input->mouse3D.z=mousePos[0]; if (mousePos[3]>=0){ int aID=(int)ceil(mousePos[3]); if ((int) actorList.size() > aID) input->worldTarget=actorList[aID]; } else input->worldTarget=NULL; //special stuff //grid if ((int)floor(mousePos[3])==-2) input->worldTarget=grid; /// World Normal! glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, layerList[currentLayer]->depthFBO ); //create small picking texture glBindTexture(GL_TEXTURE_2D,pickTexture); xRatio=(float)scene_size/(float)screenX; yRatio=(float)scene_size/(float)screenY; glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,(int) (input->mouseX * xRatio),(int) ((screenY-input->mouseY)*yRatio) ,1 ,1 ); glGetTexImage(GL_TEXTURE_2D,0,GL_BGRA,GL_FLOAT,&mousePos); //get normal! Vector4f myNormal; myNormal.x=mousePos[2]; myNormal.y=mousePos[1]; myNormal.z=mousePos[0]; myNormal.w=0.0; myNormal= inverseCameraMatrix * myNormal; //TODO: implement vertexID //int vertexID = (int)ceil(mousePos[2] * 65536.0) + (int)ceil(mousePos[1]); // cout << "vertexID: " <<vertexID << endl; input->worldNormal.x=myNormal.x; input->worldNormal.y=myNormal.y; input->worldNormal.z=myNormal.z; input->worldNormal.normalize(); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT,0); glBindTexture(GL_TEXTURE_2D,0); } //************************************************************ // // Texture and Shader Loading and Initialisation functions // // //************************************************************ //generates a texture from a RAW file - needs implementation of textureList! GLuint Renderer::LoadTextureRAW( const char * filename,int size, int wrap ){ } bool Renderer::LoadTextureTGA( string filename, bool wrap, bool bAlpha, string texID ){ GLuint texture; FIBITMAP * myBitmap = FreeImage_Load(FIF_TARGA,filename.c_str(),0); FreeImage_FlipVertical(myBitmap); //allocate texture List glGenTextures( 1, &texture ); // select our current texture glBindTexture( GL_TEXTURE_2D, texture ); // when texture area is small, bilinear filter the closest mipmap glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR ); // when texture area is large, bilinear filter the first mipmap glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); // if wrap is true, the texture wraps over at the edges (repeat) // ... false, the texture ends at the edges (clamp) glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap ? GL_REPEAT : GL_CLAMP ); glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap ? GL_REPEAT : GL_CLAMP ); // build our texture and mipmaps if (bAlpha) glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, FreeImage_GetWidth(myBitmap), FreeImage_GetHeight(myBitmap), 0, GL_BGRA, GL_UNSIGNED_BYTE, FreeImage_GetBits(myBitmap) ); else glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, FreeImage_GetWidth(myBitmap), FreeImage_GetHeight(myBitmap), 0, GL_BGR, GL_UNSIGNED_BYTE, FreeImage_GetBits(myBitmap) ); FreeImage_Unload(myBitmap); textureList[texID]=new textureObject; textureList[texID]->texture=texture; textureList[texID]->bAlpha=bAlpha; textureList[texID]->bWrap=wrap; textureList[texID]->texFilename=filename; return true; } bool Renderer::loadShader(string vertexShaderFileName, string fragmentShaderFileName, string shaderProgramName){ GLuint fragmentShader; GLuint vertexShader; GLuint shaderProgram; char * vertexShaderFile; //actually holds the whole file char * fragmentShaderFile; //actually holds the whole file cout << "*************************************************************" << endl; //setup shader vertexShader=glCreateShader(GL_VERTEX_SHADER); fragmentShader=glCreateShader(GL_FRAGMENT_SHADER); cout << "processing: " << vertexShaderFileName << "\n"; cout << "processing: " << fragmentShaderFileName << "\n"; vertexShaderFile=textFileRead((char*)vertexShaderFileName.c_str()); fragmentShaderFile=textFileRead((char*)fragmentShaderFileName.c_str()); const char* ptrV = vertexShaderFile; const char* ptrF = fragmentShaderFile; glShaderSource(vertexShader, 1, &ptrV,NULL); glShaderSource(fragmentShader, 1, &ptrF,NULL); glCompileShader(vertexShader); if (vertexShader==0){ cout << "could not compile vertex shader " << vertexShaderFileName << endl; return false; } glCompileShader(fragmentShader); if (fragmentShader==0){ cout << "could not compile fragment shader " << fragmentShaderFileName << endl; return false; } cout << "Info log for " << vertexShaderFileName << endl; printShaderInfoLog(vertexShader); cout << "Info log for " << fragmentShaderFileName << endl; printShaderInfoLog(fragmentShader); //Link shaders shaderProgram=glCreateProgram(); if (shaderProgram==0){ cout << "could not compile shader " << shaderProgramName << endl; return false; } glAttachShader(shaderProgram,vertexShader); glAttachShader(shaderProgram,fragmentShader); glLinkProgram(shaderProgram); cout << "Info log for " << shaderProgramName << endl; printProgramInfoLog(shaderProgram); //cleanUp free(vertexShaderFile); free(fragmentShaderFile); shaderList[shaderProgramName]=new shaderObject; shaderList[shaderProgramName]->shader=shaderProgram; shaderList[shaderProgramName]->vertexShaderFilename=vertexShaderFileName; shaderList[shaderProgramName]->fragmentShaderFilename=fragmentShaderFileName; cout << "registered program!" << shaderProgram << "\n"; cout << "*************************************************************" << endl; return true; } void Renderer::printShaderInfoLog(GLuint obj){ int infologLength = 0; int charsWritten = 0; char *infoLog; glGetShaderiv(obj, GL_INFO_LOG_LENGTH,&infologLength); if (infologLength > 0) { infoLog = (char *)malloc(infologLength); glGetShaderInfoLog(obj, infologLength, &charsWritten, infoLog); printf("%s\n",infoLog); free(infoLog); } } void Renderer::printProgramInfoLog(GLuint obj){ int infologLength = 0; int charsWritten = 0; char *infoLog; glGetProgramiv(obj, GL_INFO_LOG_LENGTH,&infologLength); if (infologLength > 0) { infoLog = (char *)malloc(infologLength); glGetProgramInfoLog(obj, infologLength, &charsWritten, infoLog); printf("%s\n",infoLog); free(infoLog); } } void Renderer::checkOpenGLError(){ GLenum err=glGetError(); switch(err){ case GL_INVALID_ENUM: cout << "ERROR: invalid enum" << endl; break; case GL_INVALID_VALUE: cout << "ERROR: invalid value" << endl; break; case GL_INVALID_OPERATION: cout << "ERROR: invalid operation" << endl; break; case GL_STACK_OVERFLOW: cout << "ERROR: stack overflow" << endl; break; case GL_STACK_UNDERFLOW: cout << "ERROR: stack underflow" << endl; break; case GL_OUT_OF_MEMORY: cout << "ERROR: out of memory" << endl; break; default: cout << "No Error" << endl; break; } }
583d7f6e0fd02162720bf02185260a047778735f
bebf05455518256d3b977876502d56b7d0277098
/Component.h
8320a59c5d67bec73dc4935517ea9edcf492188e
[]
no_license
LeBertrand/event-scheduler
18b462c4e5887be40dcdb1c8b6d3121ea14661c5
d5c26052d536dd12737ce6ecb366b8fc51ce2584
refs/heads/master
2021-05-04T15:25:50.361777
2018-02-11T23:39:04
2018-02-11T23:39:04
120,227,667
0
0
null
null
null
null
UTF-8
C++
false
false
2,501
h
Component.h
#include "LinkedListQueue.h" /* * Programmer - Shmuel Jacobs * Date - February 6 * Operating Systems and Sytems Programming * Component class models a computer component in a system managed by a * scheduler. Class relies on scheduler, to avoid redundant bookkeeping. * Class can't do its own bookkeeping. */ #ifndef COMPONENT_H #define COMPONENT_H class Component { public: /** Default constructor */ Component(); /** Default destructor */ ~Component(); /** Assignment operator * \param other Object to assign from * \return A reference to this */ Component& operator=(const Component& other); /** * \return The current value of idle */ bool Getidle() { return idle; } /** * \return The number of jobs currently in queue. */ int Getjobs_waiting() { return qu.Getlength(); } /* * Add job to wait queue. Only use if not idle. If idle, don't handle job at all. Scheduler should immediately put its completion in the heap and increase the wait time. */ void pushJob(int serial); /* * Move head job out of queue and begin working. */ int nextJob(); /* * Allow scheduler to schedule new job. Scheduler generates random * number of ticks for job length, and sends it back to this method. */ void increaseTime(int ticks); /* * Acknowledge time. Decrease wait_time by number of ticks input. */ void advanceTime(int ticks); // Mark component idle. For call by scheduler. inline void Setidle(bool); inline int getTime() { return current_wait; } protected: private: // TODO: Isn't queue now totally unnecessary? The serial is retrieved from the event queue. When I pop, I don't event keep anything. // Integer Queue storing serial numbers of waiting jobs LinkedListQueue qu; // Flag indicating whether component is in use. bool idle; // Number of jobs in queue is supplied by queue's method get_length. // Number of ticks until finishing current job and queued jobs. unsigned int current_wait; }; #endif // COMPONENT_H
aab79b31f11c192cc263c1d0dc59f6b7d7be5f2e
3159d77c2fc0828025bd0fb6f5d95c91fcbf4cd5
/cpp/hw_rendering/vulkan/Application.cpp
bbfac25fd6e198d8aa43b2e1bacceb564ff8e305
[]
no_license
jcmana/playground
50384f4489a23c3a3bb6083bc619e95bd20b17ea
8cf9b9402d38184f1767c4683c6954ae63d818b8
refs/heads/master
2023-09-01T11:26:07.231711
2023-08-21T16:30:16
2023-08-21T16:30:16
152,144,627
1
0
null
2023-08-21T16:21:29
2018-10-08T20:47:39
C++
UTF-8
C++
false
false
26,676
cpp
Application.cpp
#include <cmath> #include <fstream> #include <vector> #include <limits> #include <algorithm> #include "Application.h" static constexpr char MAINWINDOW_TITLE[] = "Vulkan Tutorial - Hello triangle!"; static constexpr int MAINWINDOW_SIZE_W = 800; static constexpr int MAINWINDOW_SIZE_H = 600; static constexpr char SHADER_FILE_VERTEX[] = "Shader.vert.spv"; static constexpr char SHADER_FILE_FRAGMENT[] = "Shader.frag.spv"; Application::Application() { initialize(); } Application::~Application() { deinitialize(); } void Application::run() { while (glfwWindowShouldClose(m_window_ptr) == false) { glfwPollEvents(); drawFrame(); } } void Application::initialize() { // GLFW initialization: glfwInit(); glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // Create GLFM main window m_window_ptr = glfwCreateWindow(MAINWINDOW_SIZE_W, MAINWINDOW_SIZE_H, MAINWINDOW_TITLE, nullptr, nullptr); // Vulkan initialization: uint32_t glfwExtensionCount = 0; const char ** glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount); VkApplicationInfo appInfo = {}; appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; appInfo.pApplicationName = "Hello Triangle"; appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0); appInfo.pEngineName = "The Absofuckulently Best Engine"; appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0); appInfo.apiVersion = VK_API_VERSION_1_0; VkInstanceCreateInfo createInfo = {}; createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; createInfo.pApplicationInfo = &appInfo; createInfo.enabledExtensionCount = glfwExtensionCount; createInfo.ppEnabledExtensionNames = glfwExtensions; if (vkCreateInstance(&createInfo, nullptr, &m_instance) != VK_SUCCESS) { throw std::exception("vkCreateInstance() failed."); } // Create presentation surface in GLFW window if (glfwCreateWindowSurface(m_instance, m_window_ptr, nullptr, &m_surface) != VK_SUCCESS) { throw std::exception("glfwCreateWindowSurface() failed."); } VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; uint32_t deviceCount = 0; vkEnumeratePhysicalDevices(m_instance, &deviceCount, nullptr); if (deviceCount == 0) { throw std::exception("vkEnumeratePhysicalDevices() returned 0 devices."); } std::vector<VkPhysicalDevice> physicalDevices(deviceCount); // Enumerate physical devices vkEnumeratePhysicalDevices(m_instance, &deviceCount, physicalDevices.data()); // Select first device (cos I don't give a shit) physicalDevice = physicalDevices[0]; uint32_t queueFamilyCount = 0; vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamilyCount, nullptr); std::vector<VkQueueFamilyProperties> queueFamilies(queueFamilyCount); // Enumerate physical device's queue families vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamilyCount, queueFamilies.data()); uint32_t graphicsQueueFamilyIndex = -1; for (uint32_t index = 0; index < queueFamilyCount; ++index) { if (queueFamilies[index].queueCount < 0) { continue; } if ((queueFamilies[index].queueFlags & VK_QUEUE_GRAPHICS_BIT) == 0x0) { continue; } VkBool32 presentSupport = false; vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice, index, m_surface, &presentSupport); if (presentSupport == false) { continue; } // Remember graphics queue family graphicsQueueFamilyIndex = index; } if (graphicsQueueFamilyIndex == -1) { throw std::runtime_error("graphics+presentation queue not found."); } float queuePriority = 1.0f; VkDeviceQueueCreateInfo queueCreateInfo = {}; queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; queueCreateInfo.queueFamilyIndex = graphicsQueueFamilyIndex; queueCreateInfo.queueCount = 1; queueCreateInfo.pQueuePriorities = &queuePriority; std::vector<VkDeviceQueueCreateInfo> queueCreateInfos = {queueCreateInfo}; VkPhysicalDeviceFeatures deviceFeatures = {}; std::vector<const char *> deviceExtensions = { VK_KHR_SWAPCHAIN_EXTENSION_NAME }; VkDeviceCreateInfo deviceCreateInfo = {}; deviceCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; deviceCreateInfo.pQueueCreateInfos = &queueCreateInfo; deviceCreateInfo.queueCreateInfoCount = 1; deviceCreateInfo.pEnabledFeatures = &deviceFeatures; deviceCreateInfo.enabledExtensionCount = uint32_t(deviceExtensions.size()); deviceCreateInfo.ppEnabledExtensionNames = deviceExtensions.data(); deviceCreateInfo.enabledLayerCount = 0; // Create logical device if (vkCreateDevice(physicalDevice, &deviceCreateInfo, nullptr, &m_device) != VK_SUCCESS) { throw std::exception("vkCreateDevice() failed."); } // Fetch logical device command queue vkGetDeviceQueue(m_device, graphicsQueueFamilyIndex, 0, &m_graphicsQueue); vkGetDeviceQueue(m_device, graphicsQueueFamilyIndex, 0, &m_presentationQueue); // Fetch surface capabilities VkSurfaceCapabilitiesKHR surfaceCapabilities; vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, m_surface, &surfaceCapabilities); // Fetch device's supported surface formats uint32_t surfaceFormatCount = 0; vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, m_surface, &surfaceFormatCount, nullptr); if (surfaceFormatCount == 0) { throw std::exception("vkGetPhysicalDeviceSurfaceFormatsKHR() returned 0 surface formats."); } std::vector<VkSurfaceFormatKHR> surfaceFormats(surfaceFormatCount); vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, m_surface, &surfaceFormatCount, surfaceFormats.data()); m_surfaceFormat = surfaceFormats[0]; // Fetch device's surface supported presentation modes uint32_t surfacePresentModeCount = 0; vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, m_surface, &surfacePresentModeCount, nullptr); if (surfacePresentModeCount == 0) { throw std::exception("vkGetPhysicalDeviceSurfacePresentModesKHR() returned 0 presentation modes."); } std::vector<VkPresentModeKHR> surfacePresentModes(surfacePresentModeCount); vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, m_surface, &surfacePresentModeCount, surfacePresentModes.data()); VkPresentModeKHR surfacePresentMode = surfacePresentModes[0]; // Setup surface extent m_surfaceExtent = surfaceCapabilities.currentExtent; if (surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max()) { m_surfaceExtent.width = MAINWINDOW_SIZE_W; } if (surfaceCapabilities.currentExtent.height == std::numeric_limits<uint32_t>::max()) { m_surfaceExtent.height = MAINWINDOW_SIZE_H; } // Find surface dimensions capabilities and size intersection m_surfaceExtent.width = std::max(surfaceCapabilities.minImageExtent.width, std::min(surfaceCapabilities.maxImageExtent.width, m_surfaceExtent.width)); m_surfaceExtent.height = std::max(surfaceCapabilities.minImageExtent.height, std::min(surfaceCapabilities.maxImageExtent.height, m_surfaceExtent.height)); // Swapchain image count uint32_t swapchainImageCountRequest = surfaceCapabilities.minImageCount + 1; if (swapchainImageCountRequest > surfaceCapabilities.maxImageCount) { swapchainImageCountRequest = surfaceCapabilities.maxImageCount; } // Swapchain queues uint32_t queueFamilyIndices[] = {graphicsQueueFamilyIndex}; // Create swapchain VkSwapchainCreateInfoKHR swapchainCreateInfo = {}; swapchainCreateInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; swapchainCreateInfo.surface = m_surface; swapchainCreateInfo.minImageCount = swapchainImageCountRequest; swapchainCreateInfo.imageFormat = m_surfaceFormat.format; swapchainCreateInfo.imageColorSpace = m_surfaceFormat.colorSpace; swapchainCreateInfo.imageExtent = m_surfaceExtent; swapchainCreateInfo.imageArrayLayers = 1; swapchainCreateInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; swapchainCreateInfo.queueFamilyIndexCount = sizeof(queueFamilyIndices); swapchainCreateInfo.pQueueFamilyIndices = queueFamilyIndices; swapchainCreateInfo.preTransform = surfaceCapabilities.currentTransform; swapchainCreateInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; swapchainCreateInfo.presentMode = surfacePresentMode; swapchainCreateInfo.clipped = VK_TRUE; swapchainCreateInfo.oldSwapchain = VK_NULL_HANDLE; if (vkCreateSwapchainKHR(m_device, &swapchainCreateInfo, nullptr, &m_swapchain) != VK_SUCCESS) { throw std::exception("vkCreateSwapchainKHR() failed."); } // Swapchain images uint32_t swapchainImageCount = 0; vkGetSwapchainImagesKHR(m_device, m_swapchain, &swapchainImageCount, nullptr); if (swapchainImageCount != swapchainImageCountRequest) { throw std::exception("vkGetSwapchainImagesKHR() returned different image count than requested."); } m_swapchainImages.resize(swapchainImageCount); vkGetSwapchainImagesKHR(m_device, m_swapchain, &swapchainImageCount, m_swapchainImages.data()); // Swapchain images view m_swapchainImagesViews.resize(swapchainImageCount); for (std::size_t index = 0; index < m_swapchainImages.size(); ++index) { VkImageViewCreateInfo imageViewCreateInfo = {}; imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; imageViewCreateInfo.image = m_swapchainImages[index]; imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; imageViewCreateInfo.format = m_surfaceFormat.format; imageViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; imageViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; imageViewCreateInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; imageViewCreateInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; imageViewCreateInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; imageViewCreateInfo.subresourceRange.baseMipLevel = 0; imageViewCreateInfo.subresourceRange.levelCount = 1; imageViewCreateInfo.subresourceRange.baseArrayLayer = 0; imageViewCreateInfo.subresourceRange.layerCount = 1; if (vkCreateImageView(m_device, &imageViewCreateInfo, nullptr, &m_swapchainImagesViews[index]) != VK_SUCCESS) { throw std::exception("vkCreateImageView() failed."); } } // Load compiled vertex shader: auto vertexShaderBytecode = readSharedFile(SHADER_FILE_VERTEX); VkShaderModuleCreateInfo vertexShaderCreateInfo = {}; vertexShaderCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; vertexShaderCreateInfo.codeSize = vertexShaderBytecode.size(); vertexShaderCreateInfo.pCode = reinterpret_cast<const uint32_t *>(vertexShaderBytecode.data()); if (vkCreateShaderModule(m_device, &vertexShaderCreateInfo, nullptr, &m_vertexShader) != VK_SUCCESS) { throw std::exception("vkCreateShaderModule() failed for vertex shader module."); } // Load compiled fragment shader: auto fragmentShaderBytecode = readSharedFile(SHADER_FILE_FRAGMENT); VkShaderModuleCreateInfo fragmentShaderCreateInfo = {}; fragmentShaderCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; fragmentShaderCreateInfo.codeSize = fragmentShaderBytecode.size(); fragmentShaderCreateInfo.pCode = reinterpret_cast<const uint32_t *>(fragmentShaderBytecode.data()); if (vkCreateShaderModule(m_device, &fragmentShaderCreateInfo, nullptr, &m_fragmentShader) != VK_SUCCESS) { throw std::exception("vkCreateShaderModule() failed for fragment shader module."); } // Vertex shader stage: VkPipelineShaderStageCreateInfo vertexShaderStageInfo = {}; vertexShaderStageInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; vertexShaderStageInfo.stage = VK_SHADER_STAGE_VERTEX_BIT; vertexShaderStageInfo.module = m_vertexShader; vertexShaderStageInfo.pName = "main"; // Fragment shader stage: VkPipelineShaderStageCreateInfo fragmentShaderStageInfo = {}; fragmentShaderStageInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; fragmentShaderStageInfo.stage = VK_SHADER_STAGE_FRAGMENT_BIT; fragmentShaderStageInfo.module = m_fragmentShader; fragmentShaderStageInfo.pName = "main"; VkPipelineShaderStageCreateInfo shaderStages[] = { vertexShaderStageInfo, fragmentShaderStageInfo }; // Vertex input: VkPipelineVertexInputStateCreateInfo vertexInputInfo = {}; vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; vertexInputInfo.vertexBindingDescriptionCount = 0; vertexInputInfo.pVertexBindingDescriptions = nullptr; vertexInputInfo.vertexAttributeDescriptionCount = 0; vertexInputInfo.pVertexAttributeDescriptions = nullptr; // Input assembly: VkPipelineInputAssemblyStateCreateInfo inputAssembly{}; inputAssembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; inputAssembly.primitiveRestartEnable = VK_FALSE; // Rendering viewport and scrissor: VkViewport viewport = {}; viewport.x = 0.0f; viewport.y = 0.0f; viewport.width = float(m_surfaceExtent.width); viewport.height = float(m_surfaceExtent.height); viewport.minDepth = 0.0f; viewport.maxDepth = 1.0f; VkRect2D scissor = {}; scissor.offset = {0, 0}; scissor.extent = m_surfaceExtent; VkPipelineViewportStateCreateInfo viewportState = {}; viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; viewportState.viewportCount = 1; viewportState.pViewports = &viewport; viewportState.scissorCount = 1; viewportState.pScissors = &scissor; // Rasterizer: VkPipelineRasterizationStateCreateInfo rasterizer = {}; rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rasterizer.depthClampEnable = VK_FALSE; rasterizer.rasterizerDiscardEnable = VK_FALSE; rasterizer.polygonMode = VK_POLYGON_MODE_FILL; rasterizer.lineWidth = 1.0f; rasterizer.cullMode = VK_CULL_MODE_BACK_BIT; rasterizer.frontFace = VK_FRONT_FACE_CLOCKWISE; rasterizer.depthBiasConstantFactor = 0.0f; rasterizer.depthBiasClamp = 0.0f; rasterizer.depthBiasSlopeFactor = 0.0f; // Multisampling: VkPipelineMultisampleStateCreateInfo multisampling= {}; multisampling.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; multisampling.sampleShadingEnable = VK_FALSE; multisampling.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; multisampling.minSampleShading = 1.0f; multisampling.pSampleMask = nullptr; multisampling.alphaToCoverageEnable = VK_FALSE; multisampling.alphaToOneEnable = VK_FALSE; // Color blending: VkPipelineColorBlendAttachmentState colorBlendAttachment = {}; colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT; colorBlendAttachment.blendEnable = VK_FALSE; colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE; colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO; colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD; colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE; colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO; colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD; VkPipelineColorBlendStateCreateInfo colorBlending = {}; colorBlending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; colorBlending.logicOpEnable = VK_FALSE; colorBlending.logicOp = VK_LOGIC_OP_COPY; colorBlending.attachmentCount = 1; colorBlending.pAttachments = &colorBlendAttachment; colorBlending.blendConstants[0] = 0.0f; colorBlending.blendConstants[1] = 0.0f; colorBlending.blendConstants[2] = 0.0f; colorBlending.blendConstants[3] = 0.0f; // Dynamic state: VkDynamicState dynamicStates[] = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_LINE_WIDTH, }; VkPipelineDynamicStateCreateInfo dynamicState = {}; dynamicState.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; dynamicState.dynamicStateCount = 2; dynamicState.pDynamicStates = dynamicStates; // Pipeline layout: VkPipelineLayoutCreateInfo pipelineLayoutInfo = {}; pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; pipelineLayoutInfo.setLayoutCount = 0; // Optional pipelineLayoutInfo.pSetLayouts = nullptr; // Optional pipelineLayoutInfo.pushConstantRangeCount = 0; // Optional pipelineLayoutInfo.pPushConstantRanges = nullptr; // Optional if (vkCreatePipelineLayout(m_device, &pipelineLayoutInfo, nullptr, &m_pipelineLayout) != VK_SUCCESS) { throw std::runtime_error("vkCreatePipelineLayout() failed."); } // Attachments: VkAttachmentDescription colorAttachment = {}; colorAttachment.format = m_surfaceFormat.format; colorAttachment.samples = VK_SAMPLE_COUNT_1_BIT; colorAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE; colorAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; colorAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; colorAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; colorAttachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; VkAttachmentReference colorAttachmentRef = {}; colorAttachmentRef.attachment = 0; colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; VkSubpassDescription subpass = {}; subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; subpass.colorAttachmentCount = 1; subpass.pColorAttachments = &colorAttachmentRef; // Subpass dependency: VkSubpassDependency dependency = {}; dependency.srcSubpass = VK_SUBPASS_EXTERNAL; dependency.dstSubpass = 0; dependency.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; dependency.srcAccessMask = 0; dependency.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; dependency.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; // Render pass: VkRenderPassCreateInfo renderPassInfo = {}; renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; renderPassInfo.attachmentCount = 1; renderPassInfo.pAttachments = &colorAttachment; renderPassInfo.subpassCount = 1; renderPassInfo.pSubpasses = &subpass; renderPassInfo.dependencyCount = 1; renderPassInfo.pDependencies = &dependency; if (vkCreateRenderPass(m_device, &renderPassInfo, nullptr, &m_renderPass) != VK_SUCCESS) { throw std::runtime_error("vkCreateRenderPass() failed."); } // Pipeline: VkGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; pipelineInfo.stageCount = 2; pipelineInfo.pStages = shaderStages; pipelineInfo.pVertexInputState = &vertexInputInfo; pipelineInfo.pInputAssemblyState = &inputAssembly; pipelineInfo.pViewportState = &viewportState; pipelineInfo.pRasterizationState = &rasterizer; pipelineInfo.pMultisampleState = &multisampling; pipelineInfo.pDepthStencilState = nullptr; pipelineInfo.pColorBlendState = &colorBlending; pipelineInfo.pDynamicState = nullptr; pipelineInfo.layout = m_pipelineLayout; pipelineInfo.renderPass = m_renderPass; pipelineInfo.subpass = 0; pipelineInfo.basePipelineHandle = VK_NULL_HANDLE; pipelineInfo.basePipelineIndex = -1; if (auto result = vkCreateGraphicsPipelines(m_device, VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, &m_pipeline); result != VK_SUCCESS) { throw std::runtime_error("vkCreateGraphicsPipelines() failed."); } // Swapchain framebuffers: m_framebuffers.resize(m_swapchainImagesViews.size()); for (size_t i = 0; i < m_swapchainImagesViews.size(); i++) { VkImageView attachments[] = { m_swapchainImagesViews[i] }; VkFramebufferCreateInfo framebufferInfo = {}; framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; framebufferInfo.renderPass = m_renderPass; framebufferInfo.attachmentCount = 1; framebufferInfo.pAttachments = attachments; framebufferInfo.width = m_surfaceExtent.width; framebufferInfo.height = m_surfaceExtent.height; framebufferInfo.layers = 1; if (vkCreateFramebuffer(m_device, &framebufferInfo, nullptr, &m_framebuffers[i]) != VK_SUCCESS) { throw std::runtime_error("vkCreateFramebuffer() failed."); } } // Command pool: VkCommandPoolCreateInfo poolInfo = {}; poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; poolInfo.queueFamilyIndex = 0; poolInfo.flags = 0; if (vkCreateCommandPool(m_device, &poolInfo, nullptr, &m_commandPool) != VK_SUCCESS) { throw std::runtime_error("vkCreateCommandPool() failed."); } // Command buffer: m_commandBuffers.resize(m_framebuffers.size()); VkCommandBufferAllocateInfo allocInfo = {}; allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; allocInfo.commandPool = m_commandPool; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; allocInfo.commandBufferCount = uint32_t(m_commandBuffers.size()); if (vkAllocateCommandBuffers(m_device, &allocInfo, m_commandBuffers.data()) != VK_SUCCESS) { throw std::runtime_error("vkAllocateCommandBuffers() failed."); } // Record the command buffer: for (size_t i = 0; i < m_commandBuffers.size(); i++) { VkCommandBufferBeginInfo beginInfo = {}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.flags = 0; beginInfo.pInheritanceInfo = nullptr; if (vkBeginCommandBuffer(m_commandBuffers[i], &beginInfo) != VK_SUCCESS) { throw std::runtime_error("vkBeginCommandBuffer() failed."); } VkRenderPassBeginInfo renderPassInfo = {}; renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; renderPassInfo.renderPass = m_renderPass; renderPassInfo.framebuffer = m_framebuffers[i]; renderPassInfo.renderArea.offset = {0, 0}; renderPassInfo.renderArea.extent = m_surfaceExtent; VkClearValue clearColor = {0.0f, 0.0f, 0.0f, 1.0f}; renderPassInfo.clearValueCount = 1; renderPassInfo.pClearValues = &clearColor; vkCmdBeginRenderPass(m_commandBuffers[i], &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE); vkCmdBindPipeline(m_commandBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipeline); vkCmdDraw(m_commandBuffers[i], 3, 1, 0, 0); vkCmdEndRenderPass(m_commandBuffers[i]); if (vkEndCommandBuffer(m_commandBuffers[i]) != VK_SUCCESS) { throw std::runtime_error("vkEndCommandBuffer() failed."); } } // Semaphores: VkSemaphoreCreateInfo semaphoreInfo = {}; semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; if (vkCreateSemaphore(m_device, &semaphoreInfo, nullptr, &m_imageAvailableSemaphore) != VK_SUCCESS) { throw std::runtime_error("vkCreateSemaphore() failed for image available semaphore."); } if (vkCreateSemaphore(m_device, &semaphoreInfo, nullptr, &m_renderFinishedSemaphore) != VK_SUCCESS) { throw std::runtime_error("vkCreateSemaphore() failed for render finished semaphore."); } } void Application::deinitialize() { vkDestroySemaphore(m_device, m_renderFinishedSemaphore, nullptr); vkDestroySemaphore(m_device, m_imageAvailableSemaphore, nullptr); vkDestroyCommandPool(m_device, m_commandPool, nullptr); for (auto framebuffer : m_framebuffers) { vkDestroyFramebuffer(m_device, framebuffer, nullptr); } vkDestroyPipeline(m_device, m_pipeline, nullptr); vkDestroyRenderPass(m_device, m_renderPass, nullptr); vkDestroyPipelineLayout(m_device, m_pipelineLayout, nullptr); vkDestroyShaderModule(m_device, m_fragmentShader, nullptr); vkDestroyShaderModule(m_device, m_vertexShader, nullptr); for (auto imageView : m_swapchainImagesViews) { vkDestroyImageView(m_device, imageView, nullptr); } vkDestroySwapchainKHR(m_device, m_swapchain, nullptr); vkDestroySurfaceKHR(m_instance, m_surface, nullptr); vkDestroyDevice(m_device, nullptr); vkDestroyInstance(m_instance, nullptr); if (m_window_ptr != nullptr) { glfwDestroyWindow(m_window_ptr); } glfwTerminate(); } void Application::drawFrame() { uint32_t imageIndex; if (vkAcquireNextImageKHR(m_device, m_swapchain, UINT64_MAX, m_imageAvailableSemaphore, VK_NULL_HANDLE, &imageIndex) != VK_SUCCESS) { throw std::runtime_error("vkAcquireNextImageKHR() failed."); } VkSubmitInfo submitInfo = {}; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; VkSemaphore waitSemaphores[] = {m_imageAvailableSemaphore}; VkPipelineStageFlags waitStages[] = {VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT}; submitInfo.waitSemaphoreCount = 1; submitInfo.pWaitSemaphores = waitSemaphores; submitInfo.pWaitDstStageMask = waitStages; submitInfo.commandBufferCount = 1; submitInfo.pCommandBuffers = &m_commandBuffers[imageIndex]; VkSemaphore signalSemaphores[] = {m_renderFinishedSemaphore}; submitInfo.signalSemaphoreCount = 1; submitInfo.pSignalSemaphores = signalSemaphores; if (vkQueueSubmit(m_graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE) != VK_SUCCESS) { throw std::runtime_error("vkQueueSubmit() failed."); } VkPresentInfoKHR presentInfo = {}; presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; presentInfo.waitSemaphoreCount = 1; presentInfo.pWaitSemaphores = signalSemaphores; VkSwapchainKHR swapChains[] = {m_swapchain}; presentInfo.swapchainCount = 1; presentInfo.pSwapchains = swapChains; presentInfo.pImageIndices = &imageIndex; presentInfo.pResults = nullptr; if (vkQueuePresentKHR(m_presentationQueue, &presentInfo) != VK_SUCCESS) { throw std::runtime_error("vkQueuePresentKHR() failed."); } } std::vector<char> Application::readSharedFile(const std::string & filename) const { std::ifstream file(filename, std::ios::ate | std::ios::binary); if (file.is_open() == false) { throw std::exception("std::ifstream() failed (couldn't open the file)."); } std::size_t size = std::size_t(file.tellg()); std::vector<char> bytecode(size); file.seekg(0); for (std::size_t n = 0; n < size; ++n) { char streamchar; file.get(streamchar); bytecode[n] = streamchar; } file.close(); return bytecode; }
6d29b5736405c33345ea31d414526babaeb4cfa5
7a82c1d888ea6b47f72d0e4d270d319500254fe8
/SMO/smosynth/smosynth/smosynth.prj/solution3/syn/systemc/synth_top.h
38e380aa7bda115a357d82522358b2d6157914eb
[]
no_license
yiranlc/SVM
cfd27dfedca0cdf54dfe721b2d72f435fbe9e683
b66adcc21c440d99c491f9361136b0b292ff423e
refs/heads/master
2021-01-22T22:44:38.621572
2015-06-01T00:25:30
2015-06-01T00:25:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
14,096
h
synth_top.h
// ============================================================== // RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2015.1 // Copyright (C) 2015 Xilinx Inc. All rights reserved. // // =========================================================== #ifndef _synth_top_HH_ #define _synth_top_HH_ #include "systemc.h" #include "AESL_pkg.h" #include "synth_top_writeResult.h" #include "synth_top_smo_io_s_axi.h" namespace ap_rtl { template<unsigned int C_S_AXI_SMO_IO_ADDR_WIDTH = 17, unsigned int C_S_AXI_SMO_IO_DATA_WIDTH = 32> struct synth_top : public sc_module { // Port declarations 20 sc_in< sc_logic > s_axi_smo_io_AWVALID; sc_out< sc_logic > s_axi_smo_io_AWREADY; sc_in< sc_uint<C_S_AXI_SMO_IO_ADDR_WIDTH> > s_axi_smo_io_AWADDR; sc_in< sc_logic > s_axi_smo_io_WVALID; sc_out< sc_logic > s_axi_smo_io_WREADY; sc_in< sc_uint<C_S_AXI_SMO_IO_DATA_WIDTH> > s_axi_smo_io_WDATA; sc_in< sc_uint<C_S_AXI_SMO_IO_DATA_WIDTH/8> > s_axi_smo_io_WSTRB; sc_in< sc_logic > s_axi_smo_io_ARVALID; sc_out< sc_logic > s_axi_smo_io_ARREADY; sc_in< sc_uint<C_S_AXI_SMO_IO_ADDR_WIDTH> > s_axi_smo_io_ARADDR; sc_out< sc_logic > s_axi_smo_io_RVALID; sc_in< sc_logic > s_axi_smo_io_RREADY; sc_out< sc_uint<C_S_AXI_SMO_IO_DATA_WIDTH> > s_axi_smo_io_RDATA; sc_out< sc_lv<2> > s_axi_smo_io_RRESP; sc_out< sc_logic > s_axi_smo_io_BVALID; sc_in< sc_logic > s_axi_smo_io_BREADY; sc_out< sc_lv<2> > s_axi_smo_io_BRESP; sc_in_clk ap_clk; sc_in< sc_logic > ap_rst_n; sc_out< sc_logic > interrupt; // Module declarations synth_top(sc_module_name name); SC_HAS_PROCESS(synth_top); ~synth_top(); sc_trace_file* mVcdFile; ofstream mHdltvinHandle; ofstream mHdltvoutHandle; synth_top_smo_io_s_axi<C_S_AXI_SMO_IO_ADDR_WIDTH,C_S_AXI_SMO_IO_DATA_WIDTH>* synth_top_smo_io_s_axi_U; synth_top_writeResult* synth_top_writeResult_U0; sc_signal< sc_logic > ap_rst_n_inv; sc_signal< sc_logic > synth_top_smo_io_s_axi_U_ap_dummy_ce; sc_signal< sc_logic > ap_start; sc_signal< sc_logic > ap_ready; sc_signal< sc_logic > ap_done; sc_signal< sc_logic > ap_idle; sc_signal< sc_lv<32> > ap_return; sc_signal< sc_lv<10> > example_0_id_address0; sc_signal< sc_logic > example_0_id_ce0; sc_signal< sc_lv<32> > example_0_id_q0; sc_signal< sc_lv<10> > example_1_id_address0; sc_signal< sc_logic > example_1_id_ce0; sc_signal< sc_lv<32> > example_1_id_q0; sc_signal< sc_lv<10> > example_2_id_address0; sc_signal< sc_logic > example_2_id_ce0; sc_signal< sc_lv<32> > example_2_id_q0; sc_signal< sc_lv<10> > example_3_id_address0; sc_signal< sc_logic > example_3_id_ce0; sc_signal< sc_lv<32> > example_3_id_q0; sc_signal< sc_lv<10> > example_0_value_address0; sc_signal< sc_logic > example_0_value_ce0; sc_signal< sc_lv<64> > example_0_value_q0; sc_signal< sc_lv<10> > example_1_value_address0; sc_signal< sc_logic > example_1_value_ce0; sc_signal< sc_lv<64> > example_1_value_q0; sc_signal< sc_lv<10> > example_2_value_address0; sc_signal< sc_logic > example_2_value_ce0; sc_signal< sc_lv<64> > example_2_value_q0; sc_signal< sc_lv<10> > example_3_value_address0; sc_signal< sc_logic > example_3_value_ce0; sc_signal< sc_lv<64> > example_3_value_q0; sc_signal< sc_lv<8> > sv_0_id_address0; sc_signal< sc_logic > sv_0_id_ce0; sc_signal< sc_lv<32> > sv_0_id_q0; sc_signal< sc_lv<8> > sv_1_id_address0; sc_signal< sc_logic > sv_1_id_ce0; sc_signal< sc_lv<32> > sv_1_id_q0; sc_signal< sc_lv<8> > sv_2_id_address0; sc_signal< sc_logic > sv_2_id_ce0; sc_signal< sc_lv<32> > sv_2_id_q0; sc_signal< sc_lv<8> > sv_3_id_address0; sc_signal< sc_logic > sv_3_id_ce0; sc_signal< sc_lv<32> > sv_3_id_q0; sc_signal< sc_lv<8> > sv_0_value_address0; sc_signal< sc_logic > sv_0_value_ce0; sc_signal< sc_lv<64> > sv_0_value_q0; sc_signal< sc_lv<8> > sv_1_value_address0; sc_signal< sc_logic > sv_1_value_ce0; sc_signal< sc_lv<64> > sv_1_value_q0; sc_signal< sc_lv<8> > sv_2_value_address0; sc_signal< sc_logic > sv_2_value_ce0; sc_signal< sc_lv<64> > sv_2_value_q0; sc_signal< sc_lv<8> > sv_3_value_address0; sc_signal< sc_logic > sv_3_value_ce0; sc_signal< sc_lv<64> > sv_3_value_q0; sc_signal< sc_lv<5> > lambda_address0; sc_signal< sc_logic > lambda_ce0; sc_signal< sc_lv<64> > lambda_q0; sc_signal< sc_lv<5> > svNonZeroFeature_address0; sc_signal< sc_logic > svNonZeroFeature_ce0; sc_signal< sc_lv<32> > svNonZeroFeature_q0; sc_signal< sc_lv<6> > nonZeroFeature_address0; sc_signal< sc_logic > nonZeroFeature_ce0; sc_signal< sc_lv<32> > nonZeroFeature_q0; sc_signal< sc_lv<6> > weight_address0; sc_signal< sc_logic > weight_ce0; sc_signal< sc_lv<64> > weight_q0; sc_signal< sc_lv<6> > output_r_address0; sc_signal< sc_logic > output_r_ce0; sc_signal< sc_logic > output_r_we0; sc_signal< sc_lv<64> > output_r_d0; sc_signal< sc_lv<64> > output_r_q0; sc_signal< sc_lv<32> > kernelType; sc_signal< sc_logic > synth_top_writeResult_U0_ap_start; sc_signal< sc_logic > synth_top_writeResult_U0_ap_done; sc_signal< sc_logic > synth_top_writeResult_U0_ap_continue; sc_signal< sc_logic > synth_top_writeResult_U0_ap_idle; sc_signal< sc_logic > synth_top_writeResult_U0_ap_ready; sc_signal< sc_lv<10> > synth_top_writeResult_U0_example_0_id_address0; sc_signal< sc_logic > synth_top_writeResult_U0_example_0_id_ce0; sc_signal< sc_lv<32> > synth_top_writeResult_U0_example_0_id_q0; sc_signal< sc_lv<10> > synth_top_writeResult_U0_example_1_id_address0; sc_signal< sc_logic > synth_top_writeResult_U0_example_1_id_ce0; sc_signal< sc_lv<32> > synth_top_writeResult_U0_example_1_id_q0; sc_signal< sc_lv<10> > synth_top_writeResult_U0_example_2_id_address0; sc_signal< sc_logic > synth_top_writeResult_U0_example_2_id_ce0; sc_signal< sc_lv<32> > synth_top_writeResult_U0_example_2_id_q0; sc_signal< sc_lv<10> > synth_top_writeResult_U0_example_3_id_address0; sc_signal< sc_logic > synth_top_writeResult_U0_example_3_id_ce0; sc_signal< sc_lv<32> > synth_top_writeResult_U0_example_3_id_q0; sc_signal< sc_lv<10> > synth_top_writeResult_U0_example_0_value_address0; sc_signal< sc_logic > synth_top_writeResult_U0_example_0_value_ce0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_example_0_value_q0; sc_signal< sc_lv<10> > synth_top_writeResult_U0_example_1_value_address0; sc_signal< sc_logic > synth_top_writeResult_U0_example_1_value_ce0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_example_1_value_q0; sc_signal< sc_lv<10> > synth_top_writeResult_U0_example_2_value_address0; sc_signal< sc_logic > synth_top_writeResult_U0_example_2_value_ce0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_example_2_value_q0; sc_signal< sc_lv<10> > synth_top_writeResult_U0_example_3_value_address0; sc_signal< sc_logic > synth_top_writeResult_U0_example_3_value_ce0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_example_3_value_q0; sc_signal< sc_lv<8> > synth_top_writeResult_U0_sv_0_id_address0; sc_signal< sc_logic > synth_top_writeResult_U0_sv_0_id_ce0; sc_signal< sc_lv<32> > synth_top_writeResult_U0_sv_0_id_q0; sc_signal< sc_lv<8> > synth_top_writeResult_U0_sv_1_id_address0; sc_signal< sc_logic > synth_top_writeResult_U0_sv_1_id_ce0; sc_signal< sc_lv<32> > synth_top_writeResult_U0_sv_1_id_q0; sc_signal< sc_lv<8> > synth_top_writeResult_U0_sv_2_id_address0; sc_signal< sc_logic > synth_top_writeResult_U0_sv_2_id_ce0; sc_signal< sc_lv<32> > synth_top_writeResult_U0_sv_2_id_q0; sc_signal< sc_lv<8> > synth_top_writeResult_U0_sv_3_id_address0; sc_signal< sc_logic > synth_top_writeResult_U0_sv_3_id_ce0; sc_signal< sc_lv<32> > synth_top_writeResult_U0_sv_3_id_q0; sc_signal< sc_lv<8> > synth_top_writeResult_U0_sv_0_value_address0; sc_signal< sc_logic > synth_top_writeResult_U0_sv_0_value_ce0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_sv_0_value_q0; sc_signal< sc_lv<8> > synth_top_writeResult_U0_sv_1_value_address0; sc_signal< sc_logic > synth_top_writeResult_U0_sv_1_value_ce0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_sv_1_value_q0; sc_signal< sc_lv<8> > synth_top_writeResult_U0_sv_2_value_address0; sc_signal< sc_logic > synth_top_writeResult_U0_sv_2_value_ce0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_sv_2_value_q0; sc_signal< sc_lv<8> > synth_top_writeResult_U0_sv_3_value_address0; sc_signal< sc_logic > synth_top_writeResult_U0_sv_3_value_ce0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_sv_3_value_q0; sc_signal< sc_lv<5> > synth_top_writeResult_U0_lambda_address0; sc_signal< sc_logic > synth_top_writeResult_U0_lambda_ce0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_lambda_q0; sc_signal< sc_lv<5> > synth_top_writeResult_U0_svNonZeroFeature_address0; sc_signal< sc_logic > synth_top_writeResult_U0_svNonZeroFeature_ce0; sc_signal< sc_lv<32> > synth_top_writeResult_U0_svNonZeroFeature_q0; sc_signal< sc_lv<6> > synth_top_writeResult_U0_nonZeroFeature_address0; sc_signal< sc_logic > synth_top_writeResult_U0_nonZeroFeature_ce0; sc_signal< sc_lv<32> > synth_top_writeResult_U0_nonZeroFeature_q0; sc_signal< sc_lv<6> > synth_top_writeResult_U0_weight_address0; sc_signal< sc_logic > synth_top_writeResult_U0_weight_ce0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_weight_q0; sc_signal< sc_lv<6> > synth_top_writeResult_U0_output_r_address0; sc_signal< sc_logic > synth_top_writeResult_U0_output_r_ce0; sc_signal< sc_logic > synth_top_writeResult_U0_output_r_we0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_output_r_d0; sc_signal< sc_lv<64> > synth_top_writeResult_U0_output_r_q0; sc_signal< sc_lv<32> > synth_top_writeResult_U0_kernelType; sc_signal< sc_logic > ap_reg_procdone_synth_top_writeResult_U0; sc_signal< sc_logic > ap_sig_hs_done; sc_signal< sc_logic > ap_CS; sc_signal< sc_logic > ap_sig_top_allready; sc_signal< sc_logic > ap_sig_hs_continue; static const int C_S_AXI_DATA_WIDTH; static const int C_S_AXI_WSTRB_WIDTH; static const int C_S_AXI_ADDR_WIDTH; static const sc_logic ap_const_logic_1; static const bool ap_true; static const sc_logic ap_const_logic_0; static const sc_lv<32> ap_const_lv32_0; static const sc_lv<32> ap_const_lv32_1; // Thread declarations void thread_ap_clk_no_reset_(); void thread_ap_done(); void thread_ap_idle(); void thread_ap_ready(); void thread_ap_return(); void thread_ap_rst_n_inv(); void thread_ap_sig_hs_continue(); void thread_ap_sig_hs_done(); void thread_ap_sig_top_allready(); void thread_example_0_id_address0(); void thread_example_0_id_ce0(); void thread_example_0_value_address0(); void thread_example_0_value_ce0(); void thread_example_1_id_address0(); void thread_example_1_id_ce0(); void thread_example_1_value_address0(); void thread_example_1_value_ce0(); void thread_example_2_id_address0(); void thread_example_2_id_ce0(); void thread_example_2_value_address0(); void thread_example_2_value_ce0(); void thread_example_3_id_address0(); void thread_example_3_id_ce0(); void thread_example_3_value_address0(); void thread_example_3_value_ce0(); void thread_lambda_address0(); void thread_lambda_ce0(); void thread_nonZeroFeature_address0(); void thread_nonZeroFeature_ce0(); void thread_output_r_address0(); void thread_output_r_ce0(); void thread_output_r_d0(); void thread_output_r_we0(); void thread_svNonZeroFeature_address0(); void thread_svNonZeroFeature_ce0(); void thread_sv_0_id_address0(); void thread_sv_0_id_ce0(); void thread_sv_0_value_address0(); void thread_sv_0_value_ce0(); void thread_sv_1_id_address0(); void thread_sv_1_id_ce0(); void thread_sv_1_value_address0(); void thread_sv_1_value_ce0(); void thread_sv_2_id_address0(); void thread_sv_2_id_ce0(); void thread_sv_2_value_address0(); void thread_sv_2_value_ce0(); void thread_sv_3_id_address0(); void thread_sv_3_id_ce0(); void thread_sv_3_value_address0(); void thread_sv_3_value_ce0(); void thread_synth_top_smo_io_s_axi_U_ap_dummy_ce(); void thread_synth_top_writeResult_U0_ap_continue(); void thread_synth_top_writeResult_U0_ap_start(); void thread_synth_top_writeResult_U0_example_0_id_q0(); void thread_synth_top_writeResult_U0_example_0_value_q0(); void thread_synth_top_writeResult_U0_example_1_id_q0(); void thread_synth_top_writeResult_U0_example_1_value_q0(); void thread_synth_top_writeResult_U0_example_2_id_q0(); void thread_synth_top_writeResult_U0_example_2_value_q0(); void thread_synth_top_writeResult_U0_example_3_id_q0(); void thread_synth_top_writeResult_U0_example_3_value_q0(); void thread_synth_top_writeResult_U0_kernelType(); void thread_synth_top_writeResult_U0_lambda_q0(); void thread_synth_top_writeResult_U0_nonZeroFeature_q0(); void thread_synth_top_writeResult_U0_output_r_q0(); void thread_synth_top_writeResult_U0_svNonZeroFeature_q0(); void thread_synth_top_writeResult_U0_sv_0_id_q0(); void thread_synth_top_writeResult_U0_sv_0_value_q0(); void thread_synth_top_writeResult_U0_sv_1_id_q0(); void thread_synth_top_writeResult_U0_sv_1_value_q0(); void thread_synth_top_writeResult_U0_sv_2_id_q0(); void thread_synth_top_writeResult_U0_sv_2_value_q0(); void thread_synth_top_writeResult_U0_sv_3_id_q0(); void thread_synth_top_writeResult_U0_sv_3_value_q0(); void thread_synth_top_writeResult_U0_weight_q0(); void thread_weight_address0(); void thread_weight_ce0(); void thread_hdltv_gen(); }; } using namespace ap_rtl; #endif
00edce55032093ac355779d56f5af97604f291a4
4d22354225daba8e7fb83f27e3c0e4ac38ca4132
/app/src/main/cpp/vscode/Win32/WindowsHelper.hpp
83b18093be0761dc9cce413766629815efc5de5a
[ "Zlib" ]
permissive
Is-Daouda/is-Engine
609ad87ca64c26c1de01c589576fc6190dad93bd
9609263bafcc52ea7c60fa880ef95f64851b36ee
refs/heads/master
2023-08-08T18:16:57.959281
2023-07-18T22:00:05
2023-07-18T22:00:05
163,519,422
205
25
Zlib
2021-05-07T13:20:35
2018-12-29T15:01:27
C
UTF-8
C++
false
false
355
hpp
WindowsHelper.hpp
#ifndef WINDOWS_HELPER_HPP #define WINDOWS_HELPER_HPP class WindowsHelper { public: WindowsHelper(); void setIcon(const HWND& inHandle); private: PBYTE getIconDirectory(const int& inResourceId); HICON getIconFromIconDirectory(const PBYTE& inIconDirectory, const uint& inSize); HICON m_hIcon32; HICON m_hIcon16; }; #endif // WINDOWS_HELPER_HPP
0451988435e70abe719fd2fe505cb6ca15cc30f8
cc4dd28b347007ee4489be0d49849c96db1dea77
/src/infra/raft/RaftInterface.h
65af5f17bd2aa14f671efc3368d3d1eef7f15c7d
[ "Apache-2.0", "OpenSSL", "MIT", "BSD-3-Clause", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
eBay/Gringofts
b4237920e684e5f1b0ac0fd2dfb1178599fc083f
8370d441051338279ed4f473e281bfbbac3c115f
refs/heads/master
2023-08-30T11:34:00.723132
2023-08-30T07:26:33
2023-08-30T07:26:33
247,857,064
104
28
Apache-2.0
2023-09-06T05:59:42
2020-03-17T02:01:55
C++
UTF-8
C++
false
false
5,359
h
RaftInterface.h
/************************************************************************ Copyright 2019-2020 eBay Inc. 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 https://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. **************************************************************************/ #ifndef SRC_INFRA_RAFT_RAFTINTERFACE_H_ #define SRC_INFRA_RAFT_RAFTINTERFACE_H_ #include <list> #include <mutex> #include <optional> #include <spdlog/spdlog.h> #include "generated/raft.pb.h" #include "../grpc/RequestHandle.h" namespace gringofts { namespace raft { using MemberId = uint64_t; /// 0 should not be used as mId constexpr MemberId kBadID = 0; struct MemberInfo { MemberId mId = kBadID; /// host:port std::string mAddress; std::string toString() const { return std::to_string(mId) + "@" + mAddress; } bool operator < (const MemberInfo &other) const { return mId < other.mId; } }; struct MemberOffsetInfo { MemberId mId = kBadID; /// host:port std::string mAddress; uint64_t mOffset; MemberOffsetInfo() = default; MemberOffsetInfo(MemberId id, std::string addr, uint64_t offset) : mId(id), mAddress(std::move(addr)), mOffset(offset) {} std::string toString() const { return std::to_string(mId) + "@" + mAddress; } }; //////////////////////////// Client Request //////////////////////////// struct ClientRequest { /// <index, term> is filled with <mLogStoreIndex, mLogStoreTerm> /// raft verifies the write to WAL by checking index and term LogEntry mEntry; /// Async Callback of Client RequestHandle *mRequestHandle = nullptr; }; using ClientRequests = std::vector<ClientRequest>; struct SyncFinishMeta { /// the begin index this cluster to process uint64_t mBeginIndex; }; struct SyncRequest { /// <index, term> is filled with <mLogStoreIndex, mLogStoreTerm> /// raft verifies the write to WAL by checking index and term std::vector<raft::LogEntry> mEntries; uint64_t mStartIndex; uint64_t mEndIndex; /// meta indicate finish sync mode std::optional<SyncFinishMeta> mFinishMeta; }; //////////////////////////// Raft Interface //////////////////////////// enum class RaftRole { Leader = 0, Follower = 1, Candidate = 2, Syncer = 3, Learner = 4 }; class RaftInterface { public: RaftInterface() = default; /// forbidden copy/move RaftInterface(const RaftInterface &) = delete; RaftInterface &operator=(const RaftInterface &) = delete; virtual ~RaftInterface() = default; /// kinds of getters virtual RaftRole getRaftRole() const = 0; virtual uint64_t getCommitIndex() const = 0; virtual uint64_t getCurrentTerm() const = 0; virtual uint64_t getFirstLogIndex() const = 0; /// for split, if cluster = 0, it return 0 /// otherwise, it return the first index this cluster start process virtual uint64_t getBeginLogIndex() const = 0; virtual uint64_t getLastLogIndex() const = 0; virtual std::optional<uint64_t> getLeaderHint() const = 0; virtual std::vector<MemberInfo> getClusterMembers() const = 0; /// return leader commit index /// Using commit index instead of majority index as leader offset is due to one edge /// case for getting in-sync replica (ISR). /// Say we have a 5-member raft cluster, and use (majority index - match index) as /// each peer's lag for detecting slow followers. If two followers are in-sync for /// some time, and the other two are slow. Once the two in-sync followers crash, /// the majority index will turn much smaller. In that case, the two slower followers /// will start serve read requests before they catch up with the leader. virtual uint64_t getMemberOffsets(std::vector<MemberOffsetInfo> *) const = 0; /// used by StateMachine to read committed entry at index /// return true if succeed, return false if the entry is truncated. /// Attention that, index should be less than or equal to commitIndex. virtual bool getEntry(uint64_t index, LogEntry *entry) const = 0; /// used by StateMachine to read committed entries between /// [startIndex, startIndex + size - 1]. if everything is fine, /// return number of fetched entries. otherwise, return 0. virtual uint64_t getEntries(uint64_t startIndex, uint64_t size, std::vector<LogEntry> *entries) const = 0; /// used by RaftLogStore to send a batch of client requests virtual void enqueueClientRequests(ClientRequests clientRequests) = 0; /// using it to sync logs with others virtual void enqueueSyncRequest(SyncRequest syncRequest) {} /// used by NetAdminServer to do log retention. /// truncate log prefix from [firstIndex, lastIndex] to [firstIndexKept, lastIndex] /// Attention that, firstIndexKept should be less than or equal to commitIndex virtual void truncatePrefix(uint64_t firstIndexKept) = 0; }; } /// namespace raft } /// namespace gringofts #endif // SRC_INFRA_RAFT_RAFTINTERFACE_H_
17bce82615bb0b8ce853d9bfa5ce4d1acf45ea0b
6070f5fe6b72ead9c04d2d90a79fb48555290a45
/Library/history.h
e512d04fe5d79f2fa09ec283f2fda233ca51a85c
[]
no_license
elocj/DataStructures-Algorithms
b452b2094485b82bdfe3777c5b52737764162bf1
6cfb8fb5e4f89a5db6f2769fcd493a3ae3067828
refs/heads/master
2020-11-28T03:34:36.779198
2019-12-23T06:51:23
2019-12-23T06:51:23
229,694,071
0
0
null
null
null
null
UTF-8
C++
false
false
1,018
h
history.h
// file history.h // header file for class History #ifndef HISTORY_H #define HISTORY_H #include "command.h" class History: public Command { public: // Constructors History(); // Constructor virtual ~History(); // Destructor History(const History&); // Copy constructor // Functions // Sets the data of History such as its NodeData item as well as its // command type. virtual void setData(int id, istream&, BinTree db[], Patron patrons[]); // Creates and returns History command for the factory to use. virtual Command* create(); // Display History command information as requested by the patron history virtual void display() const; // Returns 'valid' which is false in all cases where an error is detected // while inputting data into the History command. virtual bool getBool() const; // Performs the primary function of the History command at hand. virtual void run(int id, Patron patrons[]); }; //#include "history.cpp" #endif //HISTORY_H
d16aec3a2e10f9bdf38f4c3c5f37ec66c4b717e3
db505586d69634c319352b52485177f389bd4dcb
/winscreen.hpp
888aad6c88bba1366d080aba395a01af59aa76bb
[]
no_license
Gooeybots/TicTacToe
971c11f80a55725b311fc8a4b5a009d6d03ff412
b188a46489863805d69e103abbaa7229baacd15d
refs/heads/master
2021-01-10T22:11:39.929962
2015-08-07T16:36:27
2015-08-07T16:36:27
40,269,086
0
0
null
null
null
null
UTF-8
C++
false
false
628
hpp
winscreen.hpp
#ifndef WINSCREEN_HPP #define WINSCREEN_HPP #include <map> #include <glm/glm.hpp> #include "gameenums.hpp" /* shows a screen with game result until a button is pressed or * mouse button clicked */ bool ShowWinScreen(const std::map<Game, unsigned int> &GameGLObjectMap, const glm::mat4 &viewArea, const float playAreaSquare, int player = 0); /* Asks if you want another game and either restarts game or * closes the game */ bool PlayAgain(const std::map<Game, unsigned int> &GameGLObjectMap, const glm::mat4 &viewArea, const float playAreaSquare); #endif // WINSCREEN_HPP
5bd6db0951ea8b72cd14a4faaad63bec49ff5df9
b3ff4c9a1ef9b314831d2049ce1e240d19033b8c
/Views/Login/userloginview.cpp
ef88746082a58474ea04ecf74249d1817ecab8c3
[]
no_license
Betrove/school_project
0884c08b460ecd1bfb1c5d26ef2f3f8245845451
b9afc1e4d14dbebafe0849ab0ea5fde221531387
refs/heads/master
2021-08-24T07:15:45.802900
2017-12-08T15:48:20
2017-12-08T15:48:20
112,995,724
0
0
null
null
null
null
UTF-8
C++
false
false
840
cpp
userloginview.cpp
#include "userloginview.h" #include "ui_userloginview.h" #include "qmessagebox.h" UserLoginView::UserLoginView(const ServiceManager &serviceManager): QWidget(NULL),ui(new Ui::UserLoginView),serviceManager(serviceManager) { ui->setupUi(this); connect(ui->dialogWidget,SIGNAL(tryLogin(UserCredential)),this,SLOT(attemptLogin(UserCredential))); connect(this->serviceManager.getLoginService(),SIGNAL(loginFailed(QString)),this,SLOT(onLoginFailed(QString))); } UserLoginView::~UserLoginView() { delete ui; } void UserLoginView::attemptLogin(UserCredential credential) { this->serviceManager.getLoginService()->attemptLogin(credential); } void UserLoginView::onLoginFailed(QString message) { QMessageBox::warning(this, tr("Login Failed"), tr(message.toStdString().c_str())); }
4996bc6cfd51f496485e45bce00a5a4c7674023e
a0216efe53c1eb33716d4b6b39b94de26696caa4
/Stack.h
d15446175621b26cde23ed21d4bb273e77b09e98
[]
no_license
tylerkimbell12/CSCI_2275_Final
c5161d728dec09f99c9c3de04cbb4c5c0d27c18a
7dfd8a868e6b8dd939f00dbf585d45d8edc95ac5
refs/heads/main
2023-01-27T13:50:05.709778
2020-12-07T22:47:13
2020-12-07T22:47:13
316,043,717
0
0
null
null
null
null
UTF-8
C++
false
false
456
h
Stack.h
#include <iostream> #include <string> using namespace std; struct Node { string data; Node *prev; Node(string toQ) { data = toQ; prev = NULL; } }; class Stack { private: Node *top; public: Stack() { top = NULL; } bool isEmpty(); void push(string val); Node *peek(); Node *pop(); void printStack(); void clearStack(); };
cc2cb96140869bd7b0b29a0015e75f10be34457a
0ef4f71c8ff2f233945ee4effdba893fed3b8fad
/misc_microsoft_gamedev_source_code/misc_microsoft_gamedev_source_code/extlib/wwise/source/SoundEngine/AkAudiolib/Common/AkModifiers.h
c627400ab4fa6fe41093d02e50e7b6cab4125ff8
[]
no_license
sgzwiz/misc_microsoft_gamedev_source_code
1f482b2259f413241392832effcbc64c4c3d79ca
39c200a1642102b484736b51892033cc575b341a
refs/heads/master
2022-12-22T11:03:53.930024
2020-09-28T20:39:56
2020-09-28T20:39:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,363
h
AkModifiers.h
/*********************************************************************** The content of this file includes source code for the sound engine portion of the AUDIOKINETIC Wwise Technology and constitutes "Level Two Source Code" as defined in the Source Code Addendum attached with this file. Any use of the Level Two Source Code shall be subject to the terms and conditions outlined in the Source Code Addendum and the End User License Agreement for Wwise(R). Version: v2008.2.1 Build: 2821 Copyright (c) 2006-2008 Audiokinetic Inc. ***********************************************************************/ ////////////////////////////////////////////////////////////////////// // // AkModifiers.h // ////////////////////////////////////////////////////////////////////// #ifndef _MODIFIERS_H_ #define _MODIFIERS_H_ #include "AkRandom.h" #include "AkParameters.h" // Range modifier storage class class RandomizerModifier { public: template <class T_Type> static T_Type GetMod( RANGED_MODIFIERS<T_Type>& in_rModifier ) { T_Type result = 0; T_Type mod = in_rModifier.m_max - in_rModifier.m_min; if( mod ) { AkReal64 fZeroOneRandom = (AkReal64)AKRANDOM::AkRandom() / AKRANDOM::AK_RANDOM_MAX; result = (T_Type)( ( fZeroOneRandom * mod ) + 0.5 ); //+0.5 to round } return result + in_rModifier.m_min; } static AkReal32 GetMod( RANGED_MODIFIERS<AkReal32>& in_rModifier ) { AkReal32 result = 0; AkReal32 mod = in_rModifier.m_max - in_rModifier.m_min; if( mod ) { AkReal64 fZeroOneRandom = (AkReal64)AKRANDOM::AkRandom() / AKRANDOM::AK_RANDOM_MAX; result = (AkReal32)( ( fZeroOneRandom * mod )); } return result + in_rModifier.m_min; } template <class T_Type> static inline T_Type GetModValue( RANGED_PARAMETER<T_Type>& in_rModifier ) { return in_rModifier.m_base + GetMod( in_rModifier.m_mod ); } template <class T_Type> static inline T_Type GetBaseValue( RANGED_PARAMETER<T_Type>& in_rModifier ) { return in_rModifier.m_base; } template <class T_Type> static inline void SetModValue( RANGED_PARAMETER<T_Type>& in_rModifier, T_Type in_MidValue, T_Type in_min = 0, T_Type in_max = 0 ) { in_rModifier.m_base = in_MidValue; in_rModifier.m_mod.m_min = in_min; in_rModifier.m_mod.m_max = in_max; } }; #endif
be92592a938153c325082baac4326db01065b279
1742cd526f243de44a84769c07266c473648ecd6
/cdf/102428i.cpp
84b1306619273e0d4677e4aa6fa0e920a8271768
[]
no_license
filipeabelha/gym-solutions
0d555f124fdb32508f6406f269a67eed5044d9c6
4eb8ad60643d7923780124cba3d002c5383a66a4
refs/heads/master
2021-01-23T05:09:38.962238
2020-11-29T07:14:31
2020-11-29T07:14:31
86,275,942
2
0
null
null
null
null
UTF-8
C++
false
false
999
cpp
102428i.cpp
#include <bits/stdc++.h> using namespace std; #define pb push_back typedef vector <int> vi; typedef long long ll; const int N = 1e5+5; const int MOD = 1e9+7; int n, l, k, x, vis[N]; ll memo[N]; vi adj[N], adjr[N]; ll dp (int v) { if (v == 1) return memo[v] = 1; if (memo[v] != -1) return memo[v]; ll ans = 0; for (auto u : adjr[v]) { ans += dp(u); ans %= MOD; } return memo[v] = ans; } void dfs (int v) { if (vis[v]) return; vis[v] = 1; for (auto u : adj[v]) dfs(u); } int main () { scanf("%d%d", &n, &l); for (int i = 1; i <= l; i++) { scanf("%d", &k); while (k--) { scanf("%d", &x); adj[i].pb(x); adjr[x].pb(i); } } for (int i = 0; i < N; i++) memo[i] = -1; ll ans1 = 0; ll ans2 = 0; dfs(1); for (int i = l+1; i <= n; i++) { ans1 += dp(i); ans1 %= MOD; ans2 += vis[i]; } printf("%lld %lld\n", ans1, ans2); }
b6a8c03a2220da835a0b8f6b855eb690062530c2
5d83739af703fb400857cecc69aadaf02e07f8d1
/Archive2/22/e51fa2d716f89d/main.cpp
b914c7508dbd0161254a656083032d702eab0093
[]
no_license
WhiZTiM/coliru
3a6c4c0bdac566d1aa1c21818118ba70479b0f40
2c72c048846c082f943e6c7f9fa8d94aee76979f
refs/heads/master
2021-01-01T05:10:33.812560
2015-08-24T19:09:22
2015-08-24T19:09:22
56,789,706
3
0
null
null
null
null
UTF-8
C++
false
false
1,686
cpp
main.cpp
#include <utility> #include <type_traits> struct foobar { foobar(int) { } // implicit conversion foobar(const foobar&) = delete; }; namespace bah { using std::forward; using std::move; struct Piecewise_construct_t {}; template <class T1, class T2> struct Pair { typedef T1 first_type; typedef T2 second_type; T1 first; T2 second; //Pair(const Pair&) = default; //Pair(Pair&&) = default; /*constexpr*/ Pair(): first(), second() {} Pair(const T1& x, const T2& y) : first( x ), second( y ) {} template<class U, class V, class = typename std::enable_if<std::is_constructible<first_type, U&&>::value && std::is_constructible<second_type, V&&>::value>::type> Pair(U&& x, V&& y) : first( forward<U>( x ) ), second( forward<V>( y ) ) {} template<class U, class V> Pair(const Pair<U, V>& p) : first( p.first ), second( p.second ) {} template<class U, class V> Pair(Pair<U, V>&& p) : first( move( p.first ) ), second( move( p.second ) ) {} //template <class... Args1, class... Args2> //Pair(Piecewise_construct_t, //tuple<Args1...> first_args, tuple<Args2...> second_args); // //Pair& operator=(const Pair& p); //template<class U, class V> Pair& operator=(const Pair<U, V>& p); //Pair& operator=(Pair&& p) noexcept(see below); //template<class U, class V> Pair& operator=(Pair<U, V>&& p); //void swap(Pair& p) noexcept(see below); }; } auto main() -> int { bah::Pair<int, foobar> p{1, 2}; }
2cf4fc831fb097980c0ca9106e2a1d68900f047b
6730e217faa36488f706f6ff4a997de550180b29
/Client/ActCommand.h
847e6ef9e52d377e412b7cf3dec54ab12f456e83
[]
no_license
gameMedia/DirectX9_2D-Dungreed
338ab671c341ce499b694f8e7b152c07ce4eca7f
fdfb3c5bebe0f7d269ea6787c03293443425e5c3
refs/heads/master
2023-08-21T12:37:00.079679
2021-10-10T09:40:30
2021-10-10T09:40:30
415,541,860
0
0
null
null
null
null
UTF-8
C++
false
false
246
h
ActCommand.h
#pragma once #include "ICommandActor.h" class ICommandActor; class CActCommand { public: ENUM_STATE; ENUM_DIR; public: virtual ~CActCommand() {}; public: virtual void Initialize() = 0; virtual void Execute(ICommandActor* _pPlayer) = 0; };
dbe49e4759d8906571e759ac15fdd46768db2082
c97f852dc33dfedf6ff21a547c8a9c6ee71be5be
/app/src/main/cpp/native-lib.cpp
3c6bcb0e44b6e000d46e8b9d3bcccdd0c7a7f7fc
[]
no_license
Vision-Hongik/Android_Camera-opencv-_demo
1694b94b4d398003dd286ee2102a1c70aa40351e
3bf447f7ce1c2b59ce46a2c856303098885b52c1
refs/heads/master
2022-11-08T04:22:17.776948
2020-06-30T12:38:50
2020-06-30T12:38:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
900
cpp
native-lib.cpp
#include <jni.h> #include <string> #include <opencv2/opencv.hpp> using namespace cv; extern "C" JNIEXPORT void JNICALL Java_com_example_vision_CameraActivity_ConvertRGBtoGray(JNIEnv *env, jobject thiz, jlong mat_addr_input, jlong mat_addr_result) { // TODO: implement ConvertRGBtoGray() Mat &matInput = *(Mat *)mat_addr_input; Mat &matResult = *(Mat *)mat_addr_result; cvtColor(matInput, matResult, COLOR_RGBA2GRAY); } extern "C" JNIEXPORT void JNICALL Java_com_example_vision_CameraActivity_converToArray(JNIEnv *env, jobject thiz, jlong mat_addr, jbyteArray array) { // TODO: implement converToArray() Mat &mat = *(Mat *)mat_addr; env->SetByteArrayRegion(array,0,mat.total(),(const jbyte *)mat.data); }
ccbd1bb767803f4513cc30ae3868dafa8cf50a6e
a972e2a5215d39aa39de0e9a8f3229d7636438e4
/HttpRequest.cc
e5add4953b2a9d4a12e5d48b88a7172e6966dfa6
[]
no_license
Smilezbc/WebServer
e7a4a62640d7d1f8699c291263a239e703454742
a363532422996a6fcd23f37716e660eda8f7e535
refs/heads/master
2021-02-25T01:17:49.662368
2020-03-23T01:02:48
2020-03-23T01:02:48
245,445,425
0
0
null
null
null
null
UTF-8
C++
false
false
1,129
cc
HttpRequest.cc
#include "HttpRequest.h" using namespace webServer; HttpRequest::HttpRequest() { } HttpRequest::~HttpRequest() { } bool HttpRequest::setMothed(const char* beg,const char*end) { string method(beg,end); if(method=="GET") { method_=kGet; } else if(method_=="POST") { method_=kPost; } else if(method_=="PUSH") { method_=kPush; } else if(method_=="DELETE") { method_=kDelete; } else if(method_=="HEAD") { method_=kHead; } else { method_=kInvalid; } return method_!=kInvalid; } void HttpRequest::addHead(const char* beg,const char* colon,const char* end) { string field(beg,colon); ++colon; while(colon<end && *colon==' ') ++colon; string value(colon,end); while(!value.empty() && value[value.size()-1]==' ') { value.resize(value.size()-1); } } string HttpRequest::getHead(const string& field) const { string value; std::map<string,string>::iterator it=heads_.find(field); if(it!=heads_.end()) { value=it->second; } return value; }
2c2ebbf23c44985aeee0711e09c2661631c8bf59
fa04d2f56c8d4ebfb931968392811a127a4cb46c
/trunk/Cities3D/src/NetworkRules/NetworkRestartListCtrl.h
cc7742f571621ef7d2f23be5e185d88fc4f391c0
[]
no_license
andrewlangemann/Cities3D
9ea8b04eb8ec43d05145e0b91d1c542fa3163ab3
58c6510f609a0c8ef801c77f5be9ea622e338f9a
refs/heads/master
2022-10-04T10:44:51.565770
2020-06-03T23:44:07
2020-06-03T23:44:07
268,979,591
0
0
null
2020-06-03T03:25:54
2020-06-03T03:25:53
null
UTF-8
C++
false
false
3,711
h
NetworkRestartListCtrl.h
/* * Cities3D - Copyright (C) 2001-2009 Jason Fugate (saladyears@gmail.com) * * 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. */ #pragma once #include "style.h" //READ THIS BEFORE MAKING ANY CHANGES TO THIS FILE!!! //---------------------------- SYSTEM INCLUDES -----------------------------// //---------------------------- USER INCLUDES -----------------------------// #include "BaseListCtrl.h" //---------------------------- DEFINES -----------------------------// //---------------------------- TYPEDEFS -----------------------------// class DataObject; //---------------------------- CLASSES -----------------------------// //---------------------------------------------------------------------------// // Class: wxNetworkRestartListCtrl // // Displays all the players currently in the game (or not) when waiting for a // network game to restart. // // Derived From: // <wxBaseListCtrl> // // Project: // <Cities3D> // // Include: // NetworkRestartListCtrl.h // class wxNetworkRestartListCtrl : public wxBaseListCtrl { //-----------------------------------------------------------------------// // Section: Public // public: //-----------------------------------------------------------------------// // Group: Constructors // //-----------------------------------------------------------------------// // Constructor: wxNetworkRestartListCtrl // // The wxNetworkRestartListCtrl constructor. // // Parameters: // parent - The parent window. // id - The message handling ID. Should be a unique (to the parent // window) ID, if the parent window wants to receive messages from // the control. // pos - The list control position in window coordinates. // size - The list control size. // wxNetworkRestartListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); //-----------------------------------------------------------------------// // Group: Destructor // //-----------------------------------------------------------------------// // Destructor: ~wxNetworkRestartListCtrl // // The wxNetworkRestartListCtrl destructor. // ~wxNetworkRestartListCtrl(); //-----------------------------------------------------------------------// // Section: Private // private: //-----------------------------------------------------------------------// // Group: Game Event Functions // //-----------------------------------------------------------------------// // Function: OnUpdatePlayers // // Sets player names for all <Players> in the <Game> at the selection with // their color. Triggered by the eventNetworkRestartPlayer <Event>. // // Parameters: // game - The current <Game>. // void OnUpdatePlayers(const GamePtr &game); //-----------------------------------------------------------------------// // Function: OnCountdownTime // // Updates the countdown time reamining for the given color. // // Parameters: // object - The <DataObject> containing the color and time remaining. // void OnCountdownTime(const DataObject &object); }; //---------------------------- PROTOTYPES -----------------------------//
457a794c6935be25195fb1f368bc5a2cfbbb8e0a
37c03cd062dba1ee2edc3de51014613fb6adc392
/ProfileLogHandler.h
00523699e7b40f13d3da83ceb08e58e93ed014b2
[]
no_license
quamilek/PutNukem3D
5423917fb2adea654d2362cdce66a63b29bb527f
be24ffe5e2e2f9bd45854bf5916ae1295e92b58e
refs/heads/master
2020-06-04T02:34:53.558337
2013-01-18T22:00:37
2013-01-18T22:00:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
741
h
ProfileLogHandler.h
// ProfileLogHandler.h: interface for the CProfileLogHandler class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_PROFILELOGHANDLER_H__CAD57C2F_2BF7_492C_8ED3_EFE606EF3EAC__INCLUDED_) #define AFX_PROFILELOGHANDLER_H__CAD57C2F_2BF7_492C_8ED3_EFE606EF3EAC__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "profiler.h" class CProfileLogHandler : public IProfilerOutputHandler { public: void BeginOutput(float tTime); void EndOutput(); void Sample(/*float rootTime,*/float fMin, float fAvg, float fMax, float tAvg, int callCount, std::string name, int parentCount); }; #endif // !defined(AFX_PROFILELOGHANDLER_H__CAD57C2F_2BF7_492C_8ED3_EFE606EF3EAC__INCLUDED_)
ced993d642e859de3ea8c0c202e367202042cf30
0b8fb930dc626ffb7f099001437ffda0edc67bce
/Composite/include/CompositeRowColumn.h
9a66f612b36d945282abca0f7cbddf386c466bc1
[]
no_license
mollicap16/Design-Patterns
d29a38934b4d2890d7fd93ec92edf7e394a3d66d
ebd4bbe94a0dec562cc010ca1916b31254aca1f9
refs/heads/master
2020-04-16T00:03:54.082985
2019-01-31T19:52:27
2019-01-31T19:52:27
165,123,472
0
0
null
null
null
null
UTF-8
C++
false
false
766
h
CompositeRowColumn.h
#ifndef COMPOSITEROWCOLUMN_H #define COMPOSITEROWCOLUMN_H // NOTE: This example is from https://sourcemaking.com/design_patterns/composite/cpp/1 #include <iostream> #include <vector> class Component { public: virtual void Traverse()=0; }; class Primitive : public Component { public: Primitive(int32_t value); void Traverse(); private: int32_t value_; }; class Composite : public Component { public: Composite(int32_t value); void Add(Component* element); void Traverse(); private: std::vector<Component*> children_; int32_t value_; }; class Row : public Composite { public: Row(int32_t value); void Traverse(); }; class Column : public Composite { public: Column(int32_t value); void Traverse(); }; #endif //COMPOSITEROWCOLUMN_H
c856692cd1441d3e42c1d7af32bd0ebbf71474c4
0aa57d60e92c6f2bcc402ec7bcbfe1984c654bd9
/mcu/ATSAM_V2/src/hwcan_atsam_v2.h
771a6ecdc88479a428cda754890f43f2a1f40ffb
[ "Zlib", "BSD-3-Clause" ]
permissive
nvitya/nvcm
bf00d31e3fd459b78c9345c9821bad252f9d5ab0
80b5fb2736b400a10edeecdaf24eb998dfab9759
refs/heads/master
2021-12-27T03:01:39.114790
2021-10-26T08:10:32
2021-10-26T08:10:32
121,033,719
15
3
null
null
null
null
UTF-8
C++
false
false
2,766
h
hwcan_atsam_v2.h
/* ----------------------------------------------------------------------------- * This file is a part of the NVCM project: https://github.com/nvitya/nvcm * Copyright (c) 2018 Viktor Nagy, nvitya * * This software is provided 'as-is', without any express or implied warranty. * In no event will the authors be held liable for any damages arising from * the use of this software. Permission is granted to anyone to use this * software for any purpose, including commercial applications, and to alter * it and redistribute it freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software in * a product, an acknowledgment in the product documentation would be * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source distribution. * --------------------------------------------------------------------------- */ /* * file: hwcan_atsam_v2.h * brief: ATSAM_V2 CAN * version: 1.00 * date: 2019-01-13 * authors: nvitya */ #ifndef HWCAN_ATSAM_H_ #define HWCAN_ATSAM_H_ #include "platform.h" #if defined(CAN0) #define HWCAN_PRE_ONLY #include "hwcan.h" #define HW_CAN_REGS Can #define HWCAN_MAX_FILTERS 32 #define HWCAN_RX_FIFO_SIZE 8 #define HWCAN_TX_FIFO_SIZE 8 typedef struct hwcan_rx_fifo_t { __IO uint32_t ID; // ID __IO uint32_t DLCTS; // Length Code + TimeStamp __IO uint32_t DATAL; // DATA __IO uint32_t DATAH; // } hwcan_rx_fifo_t; typedef struct hwcan_tx_fifo_t { __IO uint32_t IDFL; // ID + Flags __IO uint32_t DLC; // Length code __IO uint32_t DATAL; // data low __IO uint32_t DATAH; // data high // } hwcan_tx_fifo_t; class THwCan_atsam_v2 : public THwCan_pre { public: // mandatory bool HwInit(int adevnum); void Enable(); void Disable(); bool Enabled(); void HandleTx(); void HandleRx(); void AcceptListClear(); void AcceptAdd(uint16_t cobid, uint16_t amask); void SetSpeed(uint32_t aspeed); bool IsBusOff(); bool IsWarning(); public: HW_CAN_REGS * regs = nullptr; uint8_t filtercnt = 0; public: // CAN Message Memory // you might need to align the THwCan instance to 256 Bytes in order to ensure these data // within the same 64k Address Range, because on ATSAME70 they share the upper 16 Address bits __IO uint32_t stdfilters[HWCAN_MAX_FILTERS]; hwcan_rx_fifo_t rxfifo[HWCAN_RX_FIFO_SIZE]; hwcan_tx_fifo_t txfifo[HWCAN_RX_FIFO_SIZE]; }; #define HWCAN_IMPL THwCan_atsam_v2 #endif #endif /* HWCAN_ATSAM_H_ */
16e3c1b1db5551896ee4ec751fbc137ba0a8a5e9
5b947316624979a5a0f4cca3e9db13bc87e5a92a
/yac/functions.cpp
e3ae055cd648ff6ce881a6b3755d70253144da3c
[]
no_license
trexinc/evil-programmers
c23cc0e0d100f5b6083a3d2ca718f9b353872788
3fe7a0d97e41cdb57eb10639bb399dfca7dd3dab
refs/heads/master
2023-07-19T01:19:14.691343
2023-07-05T19:17:08
2023-07-05T19:17:08
32,504,532
66
36
null
2022-04-27T19:12:21
2015-03-19T06:22:19
C++
WINDOWS-1251
C++
false
false
6,059
cpp
functions.cpp
#include "functions.hpp" #include "registry.hpp" inline bool IsSlash(wchar_t x) { return x==L'\\'||x==L'/'; } inline bool IsSpace(wchar_t x) { return x==L' '||x==L'\t'; } inline bool IsEol(wchar_t x) { return x==L'\r'||x==L'\n'; } const wchar_t* GetFileName(const wchar_t* fullpath) { const wchar_t* Ptr=fullpath; while(*Ptr) Ptr++; while(Ptr>fullpath && !IsSlash(Ptr[-1])) Ptr--; return Ptr; } bool CmdSeparator(const wchar_t c) { return (/*IsSlash(c)||*/IsSpace(c)||c==L'<'||c==L'>'||c==L'|'/*||c==L':'||c==L'*'||c==L'"'*/); } BOOL AddEndSlash(wchar_t* Path, wchar_t TypeSlash) { BOOL Result=FALSE; if(Path) { wchar_t* end; int Slash=0, BackSlash=0; if(!TypeSlash) { end=Path; while(*end) { Slash+=(*end==L'\\'); BackSlash+=(*end==L'/'); end++; } } else { end=Path+StrLength(Path); if(TypeSlash == L'\\')Slash=1; else BackSlash=1; } size_t Length=end-Path; wchar_t c=(Slash<BackSlash)?L'/':L'\\'; Result=TRUE; if(!Length) { end[0]=c; end[1]=0; } else { end--; if (!IsSlash(*end)) { end[1]=c; end[2]=0; } else *end=c; } } return Result; } BOOL AddEndSlash(string &strPath,wchar_t TypeSlash) { wchar_t* lpwszPath=strPath.GetBuffer(strPath.GetLength()+2); BOOL Result=AddEndSlash(lpwszPath, TypeSlash); strPath.ReleaseBuffer(); return Result; } BOOL WINAPI AddEndSlash(wchar_t* Path) { return AddEndSlash(Path,L'\\'); } BOOL AddEndSlash(string &strPath) { return AddEndSlash(strPath,L'\\'); } wchar_t* RemoveLeadingSpaces(wchar_t* Str) { if(Str) { wchar_t* ChPtr=Str; for(;IsSpace(*ChPtr);ChPtr++); if(ChPtr!=Str) { memmove(Str,ChPtr,(StrLength(ChPtr)+1)*sizeof(wchar_t)); } } return Str; } string& RemoveLeadingSpaces(string &strStr) { wchar_t* ChPtr=strStr.GetBuffer(); wchar_t* Str=ChPtr; for(;IsSpace(*ChPtr);ChPtr++); if(ChPtr!=Str) { memmove(Str,ChPtr,(StrLength(ChPtr)+1)*sizeof(wchar_t)); } strStr.ReleaseBuffer(); return strStr; } wchar_t* RemoveTrailingSpaces(wchar_t* Str) { if(Str && *Str) { size_t I; for(wchar_t* ChPtr=Str+(I=StrLength(Str))-1;I>0;I--,ChPtr--) { if(IsSpace(*ChPtr)||IsEol(*ChPtr)) { *ChPtr=0; } else { break; } } } return Str; } string& RemoveTrailingSpaces(string &strStr) { if(!strStr.Empty()) { RemoveTrailingSpaces(strStr.GetBuffer()); strStr.ReleaseBuffer (); } return strStr; } wchar_t* WINAPI RemoveExternalSpaces(wchar_t* Str) { return RemoveTrailingSpaces(RemoveLeadingSpaces(Str)); } string& WINAPI RemoveExternalSpaces(string &strStr) { return RemoveTrailingSpaces(RemoveLeadingSpaces(strStr)); } bool CheckQuotedSymbols(const wchar_t* Str) { string symbols; string ExpStr; apiExpandEnvironmentStrings(Str,ExpStr); DWORD type; string root=GetRegRootString(); string newroot=root; newroot.SetLength(newroot.GetLength()-wcslen(L"\\plugins")); SetRegRootString(newroot); GetRegKey(L"System",L"QuotedSymbols",symbols,L" &()[]{}^=;!'+,`",&type); SetRegRootString(root); symbols+=L"\t"; for(int i=0;symbols.At(i);i++) { if(wcschr(ExpStr,symbols.At(i))) { return true; } } return false; } bool IsQuotedSymbol(wchar_t c) { if(c==L'"') return false; wchar_t Str[]={c,0}; return CheckQuotedSymbols(Str); } DWORD apiExpandEnvironmentStrings(const wchar_t* src,string &strDest) { string strSrc=src; DWORD length = ExpandEnvironmentStringsW(strSrc,NULL,0); if(length) { wchar_t* lpwszDest=strDest.GetBuffer(length); ExpandEnvironmentStringsW(strSrc,lpwszDest,length); strDest.ReleaseBuffer(); length=(DWORD)strDest.GetLength(); } return length; } /* // Заменить в строке Str Count вхождений подстроки FindStr на подстроку ReplStr // Если Count < 0 - заменять "до полной победы" // Return - количество замен int ReplaceStrings(string &strStr,const wchar_t* FindStr,const wchar_t* ReplStr,UINT Count,bool IgnoreCase) { int I=0, J=0, Res; int LenReplStr=StrLength(ReplStr); int LenFindStr=StrLength(FindStr); int L=(int)strStr.GetLength(); wchar_t* Str=strStr.GetBuffer(10240); //BUGBUG!!! while(I<=L-LenFindStr) { Res=IgnoreCase?strcmpin(Str+I,FindStr,LenFindStr):strcmpn(Str+I,FindStr,LenFindStr); if(!Res) { if(LenReplStr>LenFindStr) memmove(Str+I+(LenReplStr-LenFindStr),Str+I,(StrLength(Str+I)+1)*sizeof(wchar_t)); // >> else if(LenReplStr<LenFindStr) memmove(Str+I,Str+I+(LenFindStr-LenReplStr),(StrLength(Str+I+(LenFindStr-LenReplStr))+1)*sizeof(wchar_t)); //?? memcpy(Str+I,ReplStr,LenReplStr*sizeof(wchar_t)); I+=LenReplStr; if(++J==Count&&Count>0) break; } else I++; L=StrLength(Str); } strStr.ReleaseBuffer(); return J; } */ void Unquote(wchar_t* Str) { wchar_t *pStr; int i=0; for(pStr=Str;*pStr;pStr++) if(*pStr!=L'"') { Str[i]=*pStr; i++; } Str[i]=0; } void Unquote(string &Str) { wchar_t* lpwszStr=Str.GetBuffer(); Unquote(lpwszStr); Str.ReleaseBuffer(); } bool TokenVirtualRoot(const wchar_t* str,string& out) { const wchar_t* ptr=str; while(*ptr) ptr++; while((ptr > str) && !IsSlash(*ptr) && (*ptr!=L':')) ptr--; size_t len=ptr-str; if(!len&&!IsSlash(*str)) return false; len++; out=str; out.SetLength(len); return true; } bool apiGetModuleFileName(__in_opt HMODULE hModule,__out string &strFilename) { wchar_t* buffer=NULL; DWORD Size = MAX_PATH; buffer=(wchar_t*)malloc(Size*sizeof(wchar_t)); SetLastError(ERROR_SUCCESS); GetModuleFileNameW(hModule,buffer,Size); while(GetLastError()==ERROR_INSUFFICIENT_BUFFER) { Size<<=1; buffer=(wchar_t*)realloc(buffer,Size*sizeof(wchar_t)); GetModuleFileNameW(hModule,buffer,Size); } strFilename=buffer; free(buffer); return true; }
52d5549183bdcf47f2b44e5922aaa5a126f96868
7bfafe96d7a4113018d11abef9a2230317f650b4
/2nd Semester/algorithm/HW#4/solution.h
84ad96cab319bc7fa927e3dbd8de768e174400d0
[]
no_license
ayeonee/3rdGrade
ab8a398acac58aa740b018d81fb11b410a432dec
ff73c50f8b10455f8ad89b385fdf03c2d495ddad
refs/heads/main
2023-02-05T21:22:55.986326
2020-12-20T08:31:58
2020-12-20T08:31:58
322,534,738
0
0
null
null
null
null
UTF-8
C++
false
false
148
h
solution.h
#ifndef SOLUTION_H #define SOLUTION_H #include <iostream> class Solution { public: unsigned long long int pathCases (int m, int n); }; #endif
2f569aff0512d90ed8edcba521e0e774d1db43c5
29a8bd0313113e6edba69cb90c91dfed613bc6a1
/dalvikInsight/jni/vm/mterp/c/OP_SUB_FLOAT.cpp
9cd296804241223e0c69c20344e0df2ab9b770f7
[]
no_license
freemanZYQ/JNI
0995cb199aff48b7b6cb349f2deca6d9e0134090
2f4a4e03e53448ee724bf39dac9d55c75fcf3954
refs/heads/master
2020-10-01T20:27:44.682632
2018-10-11T06:07:13
2018-10-11T06:07:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
71
cpp
OP_SUB_FLOAT.cpp
#include "opcommon.h" HANDLE_OP_X_FLOAT(OP_SUB_FLOAT, "sub", -) OP_END
514c84c119f7a903cb57cd8c8b7b97a42dc6f8ff
109aa64a8c0299de6336e3c5f79c8d027b0369f9
/ampp/etl/string_util.h
3edb8c78c3ebe6bb8e1333534508797f4c076c5c
[ "MIT" ]
permissive
kodokse/ampp
7242b6e0bb1f4e26be8a10be50283340c9db924f
d97e11564a2974c2aa123fadafcb0280a4cdae2d
refs/heads/master
2021-01-20T08:41:31.765944
2017-11-24T14:53:16
2017-11-24T14:53:16
90,180,768
1
0
null
null
null
null
UTF-8
C++
false
false
3,297
h
string_util.h
#pragma once namespace etl { template <class CharT> std::vector<std::basic_string<CharT>> Split(const CharT *&s, const CharT *end, CharT ch); template <class CharT> std::vector<std::basic_string<CharT>> Split(const CharT *&s, const CharT *end, const CharT *match); template <class CharT> std::vector<std::basic_string<CharT>> Split(const std::basic_string<CharT> &s, CharT ch); template <class CharT> std::vector<std::basic_string<CharT>> Split(const std::basic_string<CharT> &s, const CharT *match); template <class CharT> bool IsWhite(CharT c) { return c == ' ' || c == '\t' || c == '\r' || c == '\n'; } template <class CharT, class TraitsT> std::basic_string<CharT, TraitsT> &TrimR(std::basic_string<CharT, TraitsT> &s) { auto l = s.length(); while (l > 0 && IsWhite(s[l - 1])) { --l; } if (l < s.length()) { s.resize(l); } return s; } void Skip(const wchar_t *&fmtLine, const wchar_t *endFmtLine, wchar_t ch); void SkipUntil(const wchar_t *&fmtLine, const wchar_t *endFmtLine, wchar_t ch); template <class CIterT> std::wstring CopyUntil(CIterT &fmtLine, const CIterT &endFmtLine, wchar_t ch) { std::wstring rv; while(fmtLine != endFmtLine && *fmtLine != ch) { rv += *fmtLine++; } return rv; } template <class CIterT, class PredT> std::wstring CopyWhile(CIterT &fmtLine, const CIterT &endFmtLine, PredT p) { std::wstring rv; while (fmtLine != endFmtLine && p(*fmtLine)) { rv += *fmtLine++; } return rv; } template <class CharT, class IntT> struct IntTraits { private: static const int MaxNumRadix = 10; static bool IsNumDigit(CharT v, int radix) { return v >= CharT('0') && v < CharT('0') + __min(radix, MaxNumRadix); } public: static bool IsDigit(CharT v, int radix) { if(IsNumDigit(v, radix)) { return true; } auto lv = tolower(v); return radix > 10 && lv >= CharT('a') && lv < CharT('a') + (radix - MaxNumRadix); } static int Value(CharT v, int radix) { return IsNumDigit(v, radix) ? v - CharT('0') : MaxNumRadix + (v - CharT('a')); } }; template <class CIterT, class IntT, std::enable_if_t<std::is_signed_v<IntT>>> bool ParseInt(CIterT &cur, const CIterT &end, IntT &val, int radix, int maxDigits = -1) { using Traits = IntTraits<typename CIterT::value_type, IntT>; bool negate = false; auto tmp = cur; if(*cur == '-') { ++cur; negate = true; } if(!Traits::IsDigit(*cur, radix)) { cur = tmp; return false; } int digitCount = 0; val = 0; while(cur != end && Traits::IsDigit(*cur, radix) && (maxDigits > 0 ? digitCount < maxDigits : true)) { val *= radix; val += Traits::Value(*cur, radix); ++cur; ++digitCount; } if(negate) { val = -val; } return true; } template <class CIterT, class IntT> bool ParseInt(CIterT &cur, const CIterT &end, IntT &val, int radix, int maxDigits = -1) { using Traits = IntTraits<typename CIterT::value_type, IntT>; if(!Traits::IsDigit(*cur, radix)) { return false; } int digitCount = 0; val = 0; while(cur != end && Traits::IsDigit(*cur, radix) && (maxDigits > 0 ? digitCount < maxDigits : true)) { val *= radix; val += Traits::Value(*cur, radix); ++cur; ++digitCount; } return true; } } // namespace etl
3089eb95636c90be50d4e2a2e69e5f325ac8c240
7fbd1b93b9b333cd7787dadd28dc3b45d44de4a6
/src/config_handler.cpp
e224a03260376cdd60ca7a1b442c02d022744e59
[]
no_license
mrcacaomame/tello
b02ac4423ad7f125bc354aa7e34658699d562901
8e4398361fdb9d4f29094c3d6e80103e88a8b96e
refs/heads/master
2023-03-16T11:29:14.574262
2020-09-26T19:53:46
2020-09-27T13:01:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,056
cpp
config_handler.cpp
#ifdef USE_CONFIG #include <map> #include <yaml-cpp/yaml.h> #include "config_handler.hpp" #include "utils.hpp" #include "tello.hpp" std::map<std::string, std::unique_ptr<Tello>> handleConfig( const std::string& config_file, asio::io_service& io_service, std::condition_variable& cv_run ){ utils_log::LogInfo() << "Loading config file."; std::map<std::string, std::unique_ptr<Tello>> m; YAML::Node config = YAML::LoadFile(config_file); const int n_groups = config["groups"].as<int>(); if(n_groups == 0){ utils_log::LogErr() << "No groups defined. Please check config file. Exiting"; exit(0); } const std::string group = "group"; const std::string type = "type"; for(auto group_n = 0; group_n < n_groups; group_n++){ const std::string group_number = group + std::to_string(group_n); if(!config[group_number]){ utils_log::LogWarn() << "Group " << group_n << " not defined. Please check config file. Proceeding."; continue; } const int n_types = config[group_number]["types"].as<int>(); for(auto n_type = 0; n_type < n_types; n_type++){ const std::string type_number = type + std::to_string(n_type); if(!config[group_number][type_number]){ utils_log::LogWarn() << "Type " << n_type << " not defined. Please check config file. Proceeding."; continue; } std::string type_id = config[group_number][type_number]["type_id"].as<std::string>(); int n_members = config[group_number][type_number]["members"].as<int>(); for(auto member_n = 0; member_n < n_members; member_n++){ std::string identifier = std::to_string(group_n) + "." + type_id + "." + std::to_string(member_n); auto a = std::make_unique<Tello>(io_service, cv_run, config[type_id]["drone_ip"].as<std::string>(), config[type_id]["drone_port"].as<std::string>(), config[type_id]["video_port"].as<std::string>(), config[type_id]["state_port"].as<std::string>(), config[type_id]["camera_config_file"].as<std::string>(), config[type_id]["vocabulary_file"].as<std::string>(), config[type_id]["retries"].as<int>(), config[type_id]["timeout"].as<int>(), config[type_id]["load_map_db_path"].as<std::string>(), config[type_id]["save_map_db_path"].as<std::string>(), config[type_id]["mask_img_path"].as<std::string>(), config[type_id]["load_map"].as<bool>(), config[type_id]["continue_mapping"].as<bool>(), config[type_id]["scale"].as<double>(), // NOTE: double to float implicit conversion config[type_id]["sequence_file"].as<std::string>() // TODO: Config object? ); m.insert( std::pair<std::string, std::unique_ptr<Tello>>( identifier, std::move(a) ) ); } } } utils_log::LogInfo() << "Config file loaded and parsed."; return m; } struct ID{ int group_n, member_n; std::string type_id; }; #endif // USE_CONFIG
a30567ed2c728bef73ecc55de89c5764da5a5f5e
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/components/sessions/core/command_storage_backend.h
249b5674689d1d0427170cf4199e1bc215f7049f
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
11,866
h
command_storage_backend.h
// Copyright 2011 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_SESSIONS_CORE_COMMAND_STORAGE_BACKEND_H_ #define COMPONENTS_SESSIONS_CORE_COMMAND_STORAGE_BACKEND_H_ #include <stddef.h> #include <memory> #include <set> #include <vector> #include "base/files/file_path.h" #include "base/functional/callback_forward.h" #include "base/memory/ref_counted_delete_on_sequence.h" #include "base/task/sequenced_task_runner.h" #include "base/time/time.h" #include "components/sessions/core/command_storage_manager.h" #include "components/sessions/core/session_command.h" #include "components/sessions/core/sessions_export.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace base { class Clock; class File; } namespace crypto { class Aead; } namespace sessions { // CommandStorageBackend is the backend used by CommandStorageManager. It writes // SessionCommands to disk with the ability to read back at a later date. // CommandStorageBackend (mostly) does not interpret the commands in any way, it // simply reads/writes them. // // CommandStorageBackend writes to a file with a suffix that indicates the // time the file was opened. The time stamp allows this code to determine the // most recently written file. When AppendCommands() is supplied a value of true // for `truncate`, the current file is closed and a new file is created (with // a newly generated timestamp). When AppendCommands() successfully writes the // commands to the file an internal command (whose id is // `kInitialStateMarkerCommandId`) is written. During startup, the most recent // file that has the internal command written is used. This ensures restore does // not attempt to use a file that did not have the complete state written // (this would happen if chrome crashed while writing the commands, or there // was a file system error part way through writing). // // AppendCommands() takes a callback that is called if there is an error in // writing to the file. The expectation is if there is an error, the consuming // code must call AppendCommands() again with `truncate` set to true. If there // was an error in writing to the file, calls to AppendCommands() with a value // of false for `truncate` are ignored. This is done to ensure the consuming // code correctly supplies the initial state. class SESSIONS_EXPORT CommandStorageBackend : public base::RefCountedDeleteOnSequence<CommandStorageBackend> { public: struct SESSIONS_EXPORT ReadCommandsResult { ReadCommandsResult(); ReadCommandsResult(ReadCommandsResult&& other); ReadCommandsResult& operator=(ReadCommandsResult&& other); ReadCommandsResult(const ReadCommandsResult&) = delete; ReadCommandsResult& operator=(const ReadCommandsResult&) = delete; ~ReadCommandsResult(); std::vector<std::unique_ptr<sessions::SessionCommand>> commands; bool error_reading = false; }; using id_type = SessionCommand::id_type; using size_type = SessionCommand::size_type; // Initial size of the buffer used in reading the file. This is exposed // for testing. static const int kFileReadBufferSize; // Number of bytes encryption adds. static const size_type kEncryptionOverheadInBytes; // Represents data for a session. Public for tests. // Creates a CommandStorageBackend. This method is invoked on the MAIN thread, // and does no IO. The real work is done from Init, which is invoked on // a background task runer. // // See `CommandStorageManager` for details on `type` and `path`. CommandStorageBackend( scoped_refptr<base::SequencedTaskRunner> owning_task_runner, const base::FilePath& path, CommandStorageManager::SessionType type, const std::vector<uint8_t>& decryption_key = {}, base::Clock* clock = nullptr); CommandStorageBackend(const CommandStorageBackend&) = delete; CommandStorageBackend& operator=(const CommandStorageBackend&) = delete; // Returns true if the file at |path| was generated by this class. static bool IsValidFile(const base::FilePath& path); // Returns the path the files are being written to. const base::FilePath current_path() const { return open_file_ ? open_file_->path : base::FilePath(); } bool IsFileOpen() const { return open_file_.get() != nullptr; } base::SequencedTaskRunner* owning_task_runner() { return base::RefCountedDeleteOnSequence< CommandStorageBackend>::owning_task_runner(); } // Appends the specified commands to the current file. If |truncate| is true // the file is truncated. If |truncate| is true and |crypto_key| is non-empty, // then all commands are encrypted using the supplied key. If there is an // error writing the commands, `error_callback` is run. void AppendCommands( std::vector<std::unique_ptr<sessions::SessionCommand>> commands, bool truncate, base::OnceClosure error_callback, const std::vector<uint8_t>& crypto_key = std::vector<uint8_t>()); bool inited() const { return inited_; } // Parses out the timestamp from a path pointing to a session file. static bool TimestampFromPath(const base::FilePath& path, base::Time& result); // Returns the set of possible session files. The returned paths are not // necessarily valid session files, rather they match the naming criteria // for session files. static std::set<base::FilePath> GetSessionFilePaths( const base::FilePath& path, CommandStorageManager::SessionType type); // Returns the commands from the last session file. ReadCommandsResult ReadLastSessionCommands(); // Deletes the file containing the commands for the last session. void DeleteLastSession(); // Moves the current session file to the last session file. This is typically // called during startup or if the user launches the app and no tabbed // browsers are running. After calling this, set_pending_reset() must be // called. void MoveCurrentSessionToLastSession(); // Used in testing to emulate an error in writing to the file. The value is // automatically reset after the failure. void ForceAppendCommandsToFailForTesting(); private: friend class base::RefCountedDeleteOnSequence<CommandStorageBackend>; friend class base::DeleteHelper<CommandStorageBackend>; friend class CommandStorageBackendTest; struct SessionInfo { base::FilePath path; base::Time timestamp; }; struct OpenFile { OpenFile(); ~OpenFile(); base::FilePath path; std::unique_ptr<base::File> file; // Set to true once `kInitialStateMarkerCommandId` is written. bool did_write_marker = false; }; ~CommandStorageBackend(); // Performs initialization on the background task run, calling DoInit() if // necessary. void InitIfNecessary(); // Generates the path to a session file with the given timestamp. static base::FilePath FilePathFromTime( CommandStorageManager::SessionType type, const base::FilePath& path, base::Time time); // Reads the commands from the specified file. If |crypto_key| is non-empty, // it is used to decrypt the file. static ReadCommandsResult ReadCommandsFromFile( const base::FilePath& path, const std::vector<uint8_t>& crypto_key); // Closes the file. The next time AppendCommands() is called the file will // implicitly be reopened. void CloseFile(); // If current_session_file_ is open, it is truncated so that it is essentially // empty (only contains the header). If current_session_file_ isn't open, it // is is opened and the header is written to it. After this // current_session_file_ contains no commands. // NOTE: current_session_file_ may be null if the file couldn't be opened or // the header couldn't be written. void TruncateOrOpenFile(); // Opens the current file and writes the header. On success a handle to // the file is returned. std::unique_ptr<base::File> OpenAndWriteHeader( const base::FilePath& path) const; // Appends the specified commands to the specified file. bool AppendCommandsToFile( base::File* file, const std::vector<std::unique_ptr<sessions::SessionCommand>>& commands); // Writes |command| to |file|. Returns true on success. bool AppendCommandToFile(base::File* file, const sessions::SessionCommand& command); // Encrypts |command| and writes it to |file|. Returns true on success. // The contents of the command and id are encrypted together. This is // preceded by the length of the command. bool AppendEncryptedCommandToFile(base::File* file, const sessions::SessionCommand& command); // Returns true if commands are encrypted. bool IsEncrypted() const { return !crypto_key_.empty(); } // Gets data for the last session file. absl::optional<SessionInfo> FindLastSessionFile() const; // Attempt to delete all sessions besides the current and last. This is a // best effort operation. void DeleteLastSessionFiles() const; // Gets all sessions files. std::vector<SessionInfo> GetSessionFilesSortedByReverseTimestamp() const { return GetSessionFilesSortedByReverseTimestamp(supplied_path_, type_); } static std::vector<SessionInfo> GetSessionFilesSortedByReverseTimestamp( const base::FilePath& path, CommandStorageManager::SessionType type); static bool CompareSessionInfoTimestamps(const SessionInfo& a, const SessionInfo& b) { return b.timestamp < a.timestamp; } // Returns true if `path` can be used for the last session. bool CanUseFileForLastSession(const base::FilePath& path) const; const CommandStorageManager::SessionType type_; // This is the path supplied to the constructor. See CommandStorageManager // constructor for details. const base::FilePath supplied_path_; // Used to decode the initial last session file. // TODO(sky): this is currently required because InitIfNecessary() determines // the last file. If that can be delayed, then this can be supplied to // GetLastSessionCommands(). const std::vector<uint8_t> initial_decryption_key_; // TaskRunner that the callback is added to. scoped_refptr<base::SequencedTaskRunner> callback_task_runner_; raw_ptr<base::Clock> clock_; // File and path commands are being written. std::unique_ptr<OpenFile> open_file_; // Whether DoInit() was called. DoInit() is called on the background task // runner. bool inited_ = false; std::vector<uint8_t> crypto_key_; std::unique_ptr<crypto::Aead> aead_; // Incremented every time a command is written. int commands_written_ = 0; // Timestamp when this session was started. base::Time timestamp_; // Data for the last session. If unset, fallback to legacy session data. absl::optional<SessionInfo> last_session_info_; // Paths of the two most recently written files with a valid marker (the // first of which may be the currently open file). When a new file is // successfully opened and the initial set of commands is written, // `last_or_current_path_with_valid_marker_` is set to the path. At this // point the previous file (initial value of // `last_or_current_path_with_valid_marker_`) is no longer needed, and can be // deleted. As there is no guarantee the commands have actually been written // to disk, we keep one additional file around. // `second_to_last_path_with_valid_marker_` maintains the previous valid file // with a marker. absl::optional<base::FilePath> last_or_current_path_with_valid_marker_; absl::optional<base::FilePath> second_to_last_path_with_valid_marker_; bool force_append_commands_to_fail_for_testing_ = false; }; } // namespace sessions #endif // COMPONENTS_SESSIONS_CORE_COMMAND_STORAGE_BACKEND_H_
709ed68ac2a404f6ead5cb6b8cb4c4ec9746c7c6
a0c4ed3070ddff4503acf0593e4722140ea68026
/source/UTILS/UOFS/OFS/DNBKT.CXX
234759a2d965274569de1c76ecf7d984bb6ca178
[]
no_license
cjacker/windows.xp.whistler
a88e464c820fbfafa64fbc66c7f359bbc43038d7
9f43e5fef59b44e47ba1da8c2b4197f8be4d4bc8
refs/heads/master
2022-12-10T06:47:33.086704
2020-09-19T15:06:48
2020-09-19T15:06:48
299,932,617
0
1
null
2020-09-30T13:43:42
2020-09-30T13:43:41
null
UTF-8
C++
false
false
26,436
cxx
DNBKT.CXX
//+---------------------------------------------------------------------------- // // File: dnbkt.cxx // // Contents: Implementation of class DNB (static methods for DSKNODEBKT). // // Classes: DNB // // Functions: Methods of the above classes. // // History: 06-Nov-92 RobDu Created. // //----------------------------------------------------------------------------- #include <pch.cxx> #pragma hdrstop #include "dnbkt.hxx" #include "donode.hxx" #include "sys.hxx" static STR * FileName = "dnbkt.cxx"; //+-------------------------------------------------------------------------- // // Function: AddDskFileName // // Synopsis: Add a DSKFILENAME to an existing onode in the node bucket array. // // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT containing onode for the strm. // [idOnode] -- Id of onode that will contain strm. // [pdfn] -- Ptr to new DSKFILENAME. // // Returns: TRUE on success; FALSE otherwise. The only valid reason for // failure is a lack of free space in the disk node bucket. Other // possible failure conditions are assertion checked. // // Notes: It is an assertion-checked error to attempt to add a DSKFILENAME // to an onode that already has one. // //--------------------------------------------------------------------------- BOOLEAN DNB::AddDskFileName( IN DSKNODEBKT * pdnb, IN WORKID idOnode, IN DSKFILENAME * pdfn ) { USHORT cbDfn = DON::GetCbDskFileName(pdfn); USHORT cbDskStrmDescs; DSKONODE * pdon; DSKSTRMDESC * pdsd; if ((pdon = GrowOnode(pdnb, idOnode, cbDfn)) == NULL) return FALSE; // Note - GrowOnode() does both a ShrinkOnode() and a Compress(), which // guarantees a certain level of data structure integrity. We // can thus be a bit more cavalier about checks in this routine. DbgAssert(!FlagOn(pdon->Flags, DONFLG_HASDSKFILENAME)); pdsd = DON::GetFirstDskStrmDesc(pdon); cbDskStrmDescs = pdon->cbNode - cbDfn - (USHORT)((BYTE *)pdsd - (BYTE *)pdon); if (cbDskStrmDescs > 0) memmove((BYTE *)pdsd + cbDfn, pdsd, cbDskStrmDescs); memcpy(pdsd, pdfn, DON::GetCbDskFileName(pdfn)); SetFlag(pdon->Flags, DONFLG_HASDSKFILENAME); return TRUE; } //+-------------------------------------------------------------------------- // // Function: AddDskStrmDesc // // Synopsis: Add a disk stream descriptor to an existing onode in the node // bucket array. // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT containing onode for the strm. // [idOnode] -- Id of onode that will contain strm. // [pdsd] -- Ptr to new DSKSTRMDESC. // // Returns: TRUE on success; FALSE otherwise. The only valid reason for // failure is a lack of free space in the disk node bucket. Other // possible failure conditions are assertion checked. // //--------------------------------------------------------------------------- BOOLEAN DNB::AddDskStrmDesc( IN DSKNODEBKT * pdnb, IN WORKID idOnode, IN DSKSTRMDESC * pdsd ) { USHORT cbDesc = pdsd->cbDesc; STRMID id = pdsd->id; DSKONODE * pdon; DSKSTRMDESC * pdsdInv; DSKSTRMDESC * pdsdNxt; // Find the target onode and grow it if there is room. if ((pdon = GrowOnode(pdnb, idOnode, cbDesc)) == NULL) return FALSE; // Note - GrowOnode() does both a ShrinkOnode() and a Compress(), which // guarantees a certain level of data structure integrity. We // can thus be a bit more cavalier about checks in this routine. // Stream descriptors are ordered by ascending stream id. Find the // insertion point for the new stream descriptor. pdsdNxt = DON::GetFirstDskStrmDesc(pdon); pdsdInv = (DSKSTRMDESC *)((BYTE *) pdon + pdon->cbNode - cbDesc); while (pdsdNxt < pdsdInv) { DbgAssert(pdsdNxt->id != id); DbgAssert((BYTE *) pdsdNxt + pdsdNxt->cbDesc > (BYTE *) pdsdNxt); if (pdsdNxt->id > id) break; // Found streams that need to be moved back pdsdNxt = (DSKSTRMDESC *)((BYTE *) pdsdNxt + pdsdNxt->cbDesc); } // Move any following streams to the end of the onode. if (pdsdNxt < pdsdInv) { memmove((BYTE *)pdsdNxt + cbDesc, pdsdNxt, (UINT)((BYTE *)pdsdInv - (BYTE *)pdsdNxt)); } // Copy the new strm descriptor into the onode. memcpy(pdsdNxt, pdsd, cbDesc); return TRUE; } //+-------------------------------------------------------------------------- // // Function: AddNonVariantOnode // // Synopsis: Add a new onode to a node bucket. It is the caller's // responsibility to insure that the onode does not already exist. // The onode added is ASSUMED to not need any variant fields. // An assertion check is done for violations. // // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT onode is being added to. // [idOnode] -- Id for the new onode. // // Returns: TRUE on success; FALSE otherwise. The only valid reason for // failure is a lack of free space in the disk node bucket. Other // possible failure conditions are assertion checked. // //--------------------------------------------------------------------------- BOOLEAN DNB::AddNonVariantOnode( IN DSKNODEBKT * pdnb, IN WORKID idOnode ) { DSKONODE * pdon; Compress(pdnb); DbgAssert(GetOnode(pdnb, idOnode) == NULL); if (pdnb->cFreeBytes < CB_DSKONODE) return FALSE; pdon = &pdnb->adn[0]; while (!IsDskOnodeFree(pdon)) pdon = (DSKONODE *)((BYTE *) pdon + pdon->cbNode); pdon->cbNode = CB_DSKONODE; pdon->id = idOnode; pdon->Flags = 0; pdnb->cFreeBytes -= CB_DSKONODE; if (pdnb->cFreeBytes > 0) { pdon = (DSKONODE *)((BYTE *) pdon + pdon->cbNode); SetDskOnodeFree(pdon, pdnb->cFreeBytes); } return TRUE; } //+-------------------------------------------------------------------------- // // Function: AddVariantOnode // // Synopsis: Add a new onode to a node bucket. It is the caller's // responsibility to insure that the onode does not already exist. // // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT onode is being added to. // [idOnode] -- Id for the new onode. // [psdid] -- Ptr to SDID for new onode, or NULL if none. // [psidid] -- Ptr to SIDID for new onode, or NULL if none. // [pobjid] -- Ptr to OBJECTID for new onode, or NULL if none. // [pusn] -- Ptr to USN for new onode, or NULL if none. // [pdfn] -- Ptr to DSKFILENAME for new onode, or NULL if none. // // Returns: TRUE on success; FALSE otherwise. The only valid reason for // failure is a lack of free space in the disk node bucket. Other // possible failure conditions are assertion checked. // //--------------------------------------------------------------------------- BOOLEAN DNB::AddVariantOnode( IN DSKNODEBKT * pdnb, IN WORKID idOnode, IN SDID * psdid, IN SIDID * psidid, IN OBJECTID * pobjid, IN USN * pusn, IN DSKFILENAME * pdfn ) { OFSDSKPAGE odp; DSKONODE * pdon; DSKONODE * pdonNew; Compress(pdnb); DbgAssert(GetOnode(pdnb, idOnode) == NULL); pdonNew = odp.dnb.adn; pdonNew->Flags = 0; pdonNew->cbNode = CB_DSKONODE; pdonNew->id = idOnode; if (psdid != NULL) { pdonNew->Flags |= DONFLG_HASSDID; pdonNew->cbNode += CB_SDID; DON::SetSDID(pdonNew, psdid); } if (psidid != NULL) { pdonNew->Flags |= DONFLG_HASSIDID; pdonNew->cbNode += CB_SIDID; DON::SetSIDID(pdonNew, psidid); } if (pobjid != NULL) { pdonNew->Flags |= DONFLG_HASOBJECTID; pdonNew->cbNode += CB_OBJECTID; DON::SetObjectId(pdonNew, pobjid); } if (pusn != NULL) { pdonNew->Flags |= DONFLG_HASUSN; pdonNew->cbNode += CB_USN; DON::SetUSN(pdonNew, pusn); } if (pdfn != NULL) { USHORT cbdfn = DON::GetCbDskFileName(pdfn); DSKFILENAME * pdfnNew; pdonNew->Flags |= DONFLG_HASDSKFILENAME; pdonNew->cbNode += cbdfn; pdfnNew = DON::GetDskFileName(pdonNew); memset(pdfnNew, 0, cbdfn); memcpy(pdfnNew, pdfn, cbdfn); } if (pdnb->cFreeBytes < pdonNew->cbNode) return FALSE; pdon = &pdnb->adn[0]; while (!IsDskOnodeFree(pdon)) pdon = (DSKONODE *)((BYTE *) pdon + pdon->cbNode); memcpy(pdon, pdonNew, pdonNew->cbNode); pdnb->cFreeBytes -= pdonNew->cbNode; if (pdnb->cFreeBytes > 0) { pdon = (DSKONODE *)((BYTE *) pdon + pdon->cbNode); SetDskOnodeFree(pdon, pdnb->cFreeBytes); } return TRUE; } //+-------------------------------------------------------------------------- // // Function: Compress // // Synopsis: Compress the disk node bucket, placing all free bytes found in // free or logically deleted onodes at the end of the disk node // bucket. Update the free byte count. // // Arguments: [pdnb] -- Ptr to disk node bucket to compress. // // Returns: Nothing. // // Notes: If an onode with a clearly invalid cbNode (< CB_DSKONODE) is // encountered, that onode and all following it are converted to // a free onode, since we no longer have any idea what the reading // frame is. However, we DON't insure correctness of the onode // by looking at the onode variant bits; we let cbNode determine // the reading frame as long as it is >= CB_DSKONODE. // //--------------------------------------------------------------------------- VOID DNB::Compress( IN DSKNODEBKT * pdnb ) { USHORT cbFree; USHORT cbNode; BOOLEAN OnodeMoved = FALSE; DSKONODE * pdonDest; DSKONODE * pdonInv; DSKONODE * pdonSrc; pdonSrc = pdonDest = &pdnb->adn[0]; pdonInv = (DSKONODE *)((BYTE *) pdnb + NODEBKT_PGSIZE); while (pdonSrc < pdonInv) { cbNode = pdonSrc->cbNode; if ((BYTE *) pdonSrc + cbNode <= (BYTE *) pdonSrc || (BYTE *) pdonSrc + cbNode > (BYTE *) pdonInv || !IsDwordAligned(cbNode)) { break; } if (!IsDskOnodeFree(pdonSrc) && !IsDskOnodeDeleted(pdonSrc)) { if (cbNode < CB_DSKONODE) break; if (pdonSrc != pdonDest) { memmove(pdonDest, pdonSrc, cbNode); OnodeMoved = TRUE; } pdonDest = (DSKONODE *)((BYTE *) pdonDest + cbNode); } pdonSrc = (DSKONODE *)((BYTE *) pdonSrc + cbNode); } cbFree = (USHORT)((BYTE *) pdonInv - (BYTE *) pdonDest); if (cbFree > 0) { if (OnodeMoved) memset(pdonDest, 0, cbFree); SetDskOnodeFree(pdonDest, cbFree); } pdnb->cFreeBytes = cbFree; return; } //+-------------------------------------------------------------------------- // // Function: CopyOnode // // Synopsis: Copy an existing onode to a node bucket. This is intended for // use in moving onodes from one node bkt to another. // // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT onode is being copied to. // [pdon] -- Ptr to the onode to copy. // // Returns: Nothing. // // Notes: It is ASSUMED that the node bkt has been checked for adequate // space, and we assert if there is insufficient space for the // onode in the bkt. //--------------------------------------------------------------------------- VOID DNB::CopyOnode( IN DSKNODEBKT * pdnb, IN DSKONODE * pdon ) { DSKONODE * pdonFree; Compress(pdnb); DbgAssert(pdon->cbNode <= pdnb->cFreeBytes); pdonFree = &pdnb->adn[0]; while (!IsDskOnodeFree(pdonFree)) pdonFree = (DSKONODE *)((BYTE *) pdonFree + pdonFree->cbNode); memcpy(pdonFree, pdon, pdon->cbNode); pdnb->cFreeBytes -= pdon->cbNode; if (pdnb->cFreeBytes > 0) { pdonFree = (DSKONODE *)((BYTE *) pdonFree + pdonFree->cbNode); SetDskOnodeFree(pdonFree, pdnb->cFreeBytes); } return; } //+-------------------------------------------------------------------------- // // Function: DelDskFileName // // Synopsis: Delete a DSKFILENAME in an existing onode in the node // bucket array. It is the caller's responsibility to insure that // the onode exists. Assertion checks are done. // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT containing onode for the strm. // [idOnode] -- Id of onode that contains DSKFILENAME. // // Returns: Nothing. // // Notes: If there is no DSKFILENAME, we just return. // //--------------------------------------------------------------------------- VOID DNB::DelDskFileName( IN DSKNODEBKT * pdnb, IN WORKID idOnode ) { USHORT cbDfn; USHORT cbDskStrmDescs; DSKONODE * pdon; DSKFILENAME * pdfn; DSKSTRMDESC * pdsd; // Find the target onode. pdon = GetOnode(pdnb, idOnode); DbgAssert(pdon != NULL); if (!FlagOn(pdon->Flags, DONFLG_HASDSKFILENAME)) { DbgPrintf(("DNB: DelDskFileName() " "called for onode without filename.\n")); return; } pdfn = DON::GetDskFileName(pdon); cbDfn = DON::GetCbDskFileName(pdfn); pdsd = DON::GetFirstDskStrmDesc(pdon); cbDskStrmDescs = pdon->cbNode - (USHORT)((BYTE *)pdsd - (BYTE *)pdon); ClearFlag(pdon->Flags, DONFLG_HASDSKFILENAME); // Move up any stream descriptors. if (cbDskStrmDescs > 0) memmove(pdfn, pdsd, cbDskStrmDescs); // Clear space and mark it as free. memset((BYTE *)pdon + pdon->cbNode - cbDfn, 0, cbDfn); SetFreeMarker(pdon, pdon->cbNode - cbDfn); // Now shrink the onode and then compress the node bucket. ShrinkOnode(pdnb, idOnode); Compress(pdnb); return; } //+-------------------------------------------------------------------------- // // Function: DelDskStrmDesc // // Synopsis: Delete a disk stream descriptor in an existing onode in the node // bucket array. It is the caller's responsibility to insure that // the onode and stream descriptor exist. Assertion checks are // done. // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT containing onode for the strm. // [idOnode] -- Id of onode that contains strm. // [id] -- Id of the stream. // // Returns: Nothing. // //--------------------------------------------------------------------------- VOID DNB::DelDskStrmDesc( IN DSKNODEBKT * pdnb, IN WORKID idOnode, IN STRMID id ) { USHORT cbDesc; DSKONODE * pdon; DSKSTRMDESC * pdsd; // Find the target onode. pdon = GetOnode(pdnb, idOnode); DbgAssert(pdon != NULL); // Find the target stream descriptor. pdsd = DON::GetDskStrmDesc(pdon, id); DbgAssert(pdsd != NULL); cbDesc = pdsd->cbDesc; // Move up any following stream descriptors. if ((BYTE *) pdon + pdon->cbNode > (BYTE *) pdsd + cbDesc) { memmove(pdsd, (BYTE *)pdsd + cbDesc, (UINT)((BYTE *)pdon + pdon->cbNode - (BYTE *)pdsd - cbDesc)); } // Clear space and mark it as free. memset((BYTE *)pdon + pdon->cbNode - cbDesc, 0, cbDesc); SetFreeMarker(pdon, pdon->cbNode - cbDesc); // Now shrink the onode and then compress the node bucket. ShrinkOnode(pdnb, idOnode); Compress(pdnb); return; } //+-------------------------------------------------------------------------- // // Function: DelOnode // // Synopsis: Delete an onode from a node bucket. The bucket is compressed // following deletion. It is the caller's responsibility to insure // that the onode exists. Assertion checks are done. // // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT onode is being deleted from. // [idOnode] -- Id for the deleted onode. // // Returns: Nothing. // //--------------------------------------------------------------------------- VOID DNB::DelOnode( IN DSKNODEBKT * pdnb, IN WORKID idOnode ) { DSKONODE * pdon; pdon = GetOnode(pdnb, idOnode); DbgAssert(pdon != NULL); pdon->Flags |= DONFLG_FREEBIT; Compress(pdnb); return; } //+-------------------------------------------------------------------------- // // Member: GetOnode // // Synopsis: Find the onode with the given work id in the given disk node // bucket. // // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT to search. // [idOnode] -- Work id of requested onode. // // Returns: Ptr to DSKONODE on success; NULL otherwise. // // Notes: This is bombproofed against a corrupt node bucket strm. Also, // we check that the onode is contained in the node bucket, and // that the onode is at least minimally internally consistent // (ie., variants don't extent past cbNode). // //--------------------------------------------------------------------------- DSKONODE * DNB::GetOnode( IN DSKNODEBKT * pdnb, IN WORKID idOnode ) { USHORT cbNode; DSKONODE * pdon; DSKONODE * pdonInv; // First invalid value for pdon (off end) pdon = &pdnb->adn[0]; pdonInv = (DSKONODE *)((BYTE *) pdnb + NODEBKT_PGSIZE); // Search for the onode. while (pdon < pdonInv) { cbNode = pdon->cbNode; if ((BYTE *) pdon + cbNode <= (BYTE *) pdon || (BYTE *) pdon + cbNode > (BYTE *) pdonInv || !IsDwordAligned(cbNode)) { return NULL; } if (!IsDskOnodeFree(pdon)) { if (cbNode < CB_DSKONODE) return NULL; if (pdon->id == idOnode && !IsDskOnodeDeleted(pdon)) { if (!OnodeExaminable(pdnb, pdon)) pdon = NULL; return pdon; } } pdon = (DSKONODE *)((BYTE *) pdon + pdon->cbNode); } return NULL; } //+-------------------------------------------------------------------------- // // Function: GrowOnode // // Synopsis: Increase the length of an onode in a disk node bucket in // preparation for adding a new stream or growing a stream. // // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT containing the onode. // [idOnode] -- Work id of onode being grown. // [cbGrow] -- Number of bytes by which the onode length should be // increased. This MUST be a dword-aligned non-0 value. // // Returns: A ptr to the grown onode on success; NULL otherwise. The only // valid reason for failure is a lack of space in the disk node // bucket. Other possible failure conditions are assertion checked. // // Notes: When the onode is grown, the new space made available is at the // end of the onode, and it is originally marked as a free // DSKSTRMDESC (only Flags valid). The routine is bombproofed by // virtue of the call to Compress(). Also note that we do a // ShrinkOnode() call to insure that if there is already free space // at the end of the onode, it will be properly accounted for. // //--------------------------------------------------------------------------- DSKONODE * DNB::GrowOnode( IN DSKNODEBKT * pdnb, IN WORKID idOnode, IN USHORT cbGrow ) { DSKONODE * pdonFree; DSKONODE * pdonGrow; DSKONODE * pdonNxt; DbgAssert(IsDwordAligned(cbGrow) && cbGrow != 0); ShrinkOnode(pdnb, idOnode); // Releases any free stream descriptors. Compress(pdnb); if (pdnb->cFreeBytes < cbGrow) return NULL; pdonGrow = GetOnode(pdnb, idOnode); DbgAssert(pdonGrow != NULL); pdonNxt = (DSKONODE *)((BYTE *) pdonGrow + pdonGrow->cbNode); pdonFree = pdonNxt; while (!IsDskOnodeFree(pdonFree)) pdonFree = (DSKONODE *)((BYTE *) pdonFree + pdonFree->cbNode); // If you need to, move the intervening block of bytes by cbGrow. if (pdonFree != pdonNxt) memmove((BYTE *)pdonNxt + cbGrow, (BYTE *)pdonNxt, (BYTE *)pdonFree - (BYTE *)pdonNxt); // Zero fill the new space and set up a free DSKSTRMDESC. memset(pdonNxt, 0, (UINT)cbGrow); ((DSKSTRMDESC *) pdonNxt)->Flags |= STRMDESCFLG_FREE; // Correct the various byte counts. pdonGrow->cbNode += cbGrow; pdnb->cFreeBytes -= cbGrow; // If there is still free space, add a new free onode. if (pdnb->cFreeBytes > 0) { pdonFree = (DSKONODE *)((BYTE *) pdonFree + cbGrow); SetDskOnodeFree(pdonFree, pdnb->cFreeBytes); } return pdonGrow; } //+-------------------------------------------------------------------------- // // Member: Init // // Synopsis: Initialize one or more disk node bucket headers, and place all // the non-header bytes in a free onode. // // Arguments: [pdnb] -- Ptr to space for DSKNODEBKT. // [CatType] -- Type of catalog the bucket is in. // [VolumeId] -- Volume id; used by ChkDsk in disk groveling. // [id] -- Node bkt id of first bucket. // [cBkts] -- Count of buckets to initialize. // // Returns: Nothing. // //--------------------------------------------------------------------------- VOID DNB::Init( IN DSKNODEBKT * pdnb, IN SDSSIG sig, IN VOLID VolumeId, IN NODEBKTID id, IN ULONG cBkts ) { ULONG i; // Initialize disk node bucket header. memset(pdnb, 0, NODEBKT_PGSIZE * cBkts); for (i = 0; i < cBkts; i++) { pdnb->lsn.LowPart = 0; pdnb->lsn.HighPart = 0; pdnb->VolumeId = VolumeId; pdnb->id = id + i; pdnb->sig = sig; pdnb->cFreeBytes = NODEBKT_PGSIZE - CB_DSKNODEBKT; // If this is the catalog onode replica node bkt, make it an exact // replicate of the catalog onode node bkt. if (pdnb->id == NODEBKTID_CATONODEREP) pdnb->id = NODEBKTID_CATONODE; // Initialize the first onode in the bucket as a free onode containing // all bytes. It dword aligns automatically. SetDskOnodeFree(&pdnb->adn[0], pdnb->cFreeBytes); pdnb = (DSKNODEBKT *)((BYTE *) pdnb + NODEBKT_PGSIZE); } } //+-------------------------------------------------------------------------- // // Member: OnodeExaminable // // Synopsis: Range check the onode to insure it is in the disk node bucket, // AND has a valid value for cbNode. // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT to search. // [pdon] -- Ptr to location within DSKNODEBKT where search should begin. // // Returns: TRUE if onode is okay; FALSE otherwise. // //--------------------------------------------------------------------------- BOOLEAN DNB::OnodeExaminable( IN DSKNODEBKT * pdnb, IN DSKONODE * pdon ) { USHORT cbNode; DSKONODE * pdonLastValid; pdonLastValid = (DSKONODE *)((BYTE *)pdnb + NODEBKT_PGSIZE - ((unsigned)(&((DSKONODE *) 0)->id))); if (pdon > pdonLastValid) return FALSE; cbNode = pdon->cbNode; if ((BYTE *)pdon + cbNode <= (BYTE *)pdon || (BYTE *)pdon + cbNode > (BYTE *)pdnb + NODEBKT_PGSIZE || !IsDwordAligned(cbNode) || (!IsDskOnodeFree(pdon) && cbNode < (BYTE *)DON::GetFirstDskStrmDesc(pdon) - (BYTE *)pdon)) return FALSE; return TRUE; } //+-------------------------------------------------------------------------- // // Function: ShrinkOnode // // Synopsis: If an onode ends in a free stream descriptor, or the stream // descriptor reading frame is incorrect, release the appropriate // amount of space at the end of the onode. If the onode itself // is malformed, it will be blown away when Compress() is called, // so we just return. // // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT containing onode to be shrunk. // [idOnode] -- Work id of onode to be shrunk. // // Returns: Nothing. // //--------------------------------------------------------------------------- VOID DNB::ShrinkOnode( IN DSKNODEBKT * pdnb, IN WORKID idOnode ) { USHORT cbNodeLeft; DSKONODE * pdon; DSKSTRMDESC * pdsdInv; DSKSTRMDESC * pdsdNxt; pdon = GetOnode(pdnb, idOnode); DbgAssert(pdon != NULL); if (!IsDwordAligned(pdon->cbNode)) return; pdsdNxt = DON::GetFirstDskStrmDesc(pdon); cbNodeLeft = (BYTE *)pdsdNxt - (BYTE *)pdon; pdsdInv = (DSKSTRMDESC *)((BYTE *)pdon + pdon->cbNode - CB_DSKSTRMDESC); while (pdsdNxt < pdsdInv) { if (IsFreeMarker(pdsdNxt) || !IsDwordAligned(pdsdNxt->cbDesc) || (BYTE *) pdsdNxt + pdsdNxt->cbDesc <= (BYTE *) pdsdNxt) { break; } cbNodeLeft += pdsdNxt->cbDesc; pdsdNxt = (DSKSTRMDESC *)((BYTE *) pdsdNxt + pdsdNxt->cbDesc); } if (cbNodeLeft < pdon->cbNode) { SetDskOnodeFree((DSKONODE *) pdsdNxt, pdon->cbNode - cbNodeLeft); pdon->cbNode = cbNodeLeft; } return; } //+-------------------------------------------------------------------------- // // Function: UpdateDskStrmDesc // // Synopsis: Update a disk stream descriptor in an existing onode in the node // bucket array. // // Arguments: // // [pdnb] -- Ptr to DSKNODEBKT containing onode for the strm. // [idOnode] -- Id of onode that contains strm. // [pdsd] -- Ptr to updated DSKSTRMDESC. // // Returns: TRUE on success; FALSE otherwise. The only valid reason for // failure is a lack of free space in the disk node bucket. Other // possible failure conditions are assertion checked. // //--------------------------------------------------------------------------- BOOLEAN DNB::UpdateDskStrmDesc( IN DSKNODEBKT * pdnb, IN WORKID idOnode, IN DSKSTRMDESC * pdsd ) { DSKONODE * pdon; DSKSTRMDESC * pdsdOld; // Get the node bucket ready for any operations. Compress(pdnb); // Find the target onode. pdon = GetOnode(pdnb, idOnode); DbgAssert(pdon != NULL); // Find the target stream descriptor. pdsdOld = DON::GetDskStrmDesc(pdon, pdsd->id); DbgAssert(pdsdOld != NULL); // Confirm that there is room in the disk node bucket for the update. if (pdsd->cbDesc > pdsdOld->cbDesc) { if (pdnb->cFreeBytes < pdsd->cbDesc - pdsdOld->cbDesc) return FALSE; } // Delete the old stream descriptor. DelDskStrmDesc(pdnb, idOnode, pdsd->id); // Add back the updated stream descriptor. #if !defined(_AUTOCHECK_) && OFSDBG==1 assert(AddDskStrmDesc(pdnb, idOnode, pdsd)); #else AddDskStrmDesc(pdnb, idOnode, pdsd); #endif return TRUE; } //+-------------------------------------------------------------------------- // // Member: VerifyHdr // // Synopsis: Verify that all DSKNODEBKT fields contain expected values. // // Arguments: [pdnb] -- Ptr to DSKNODEBKT to check. // [VolumeId] -- Volume id. // [id] -- Node bkt id. // // Returns: Count of errors found. // //--------------------------------------------------------------------------- ULONG DNB::VerifyHdr( IN DSKNODEBKT * pdnb, IN VOLID VolumeId, IN NODEBKTID id ) { ULONG cErrs = 0; if (pdnb->VolumeId != VolumeId) cErrs++; if (pdnb->id != id) cErrs++; if (pdnb->sig != SIG_DNBCONTIG && pdnb->sig != SIG_DNBFRAG) cErrs++; return cErrs; }
8d2cb45435e91e3785f2c91bb4f66f3451044939
8f50c262f89d3dc4f15f2f67eb76e686b8f808f5
/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_FSIFibreMask.cxx
b16d678153db65551d6521858719b5747fb740fa
[ "Apache-2.0" ]
permissive
strigazi/athena
2d099e6aab4a94ab8b636ae681736da4e13ac5c9
354f92551294f7be678aebcd7b9d67d2c4448176
refs/heads/master
2022-12-09T02:05:30.632208
2020-09-03T14:03:18
2020-09-03T14:03:18
292,587,480
0
1
null
null
null
null
UTF-8
C++
false
false
1,688
cxx
SCT_FSIFibreMask.cxx
/* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "SCT_GeoModel/SCT_FSIFibreMask.h" #include "SCT_GeoModel/SCT_MaterialManager.h" #include "SCT_GeoModel/SCT_GeometryManager.h" #include "SCT_GeoModel/SCT_BarrelParameters.h" #include "GeoModelKernel/GeoTube.h" #include "GeoModelKernel/GeoLogVol.h" #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/Units.h" SCT_FSIFibreMask::SCT_FSIFibreMask(const std::string & name, int iLayer, double length, InDetDD::SCT_DetectorManager* detectorManager, const SCT_GeometryManager* geometryManager, SCT_MaterialManager* materials) : SCT_SharedComponentFactory(name, detectorManager, geometryManager, materials), m_iLayer(iLayer), m_length(length) { getParameters(); m_physVolume = build(); } void SCT_FSIFibreMask::getParameters() { const SCT_BarrelParameters * parameters = m_geometryManager->barrelParameters(); m_materialName = parameters->fsiFibreMaskMaterial(); m_outerRadius = parameters->supportCylInnerRadius(m_iLayer); m_innerRadius = m_outerRadius - parameters->fsiFibreMaskDeltaR(); } GeoVPhysVol * SCT_FSIFibreMask::build() { // Make the support cyliner. A simple tube. const GeoTube * fibreMaskShape = new GeoTube(m_innerRadius, m_outerRadius, 0.5 * m_length); m_material = m_materials->getMaterialForVolume(m_materialName+intToString(m_iLayer), fibreMaskShape->volume()); const GeoLogVol * fibreMaskLog = new GeoLogVol(getName(), fibreMaskShape, m_material); GeoPhysVol * fibreMask = new GeoPhysVol(fibreMaskLog); return fibreMask; }
9abb3c83143f312140526a270334d2a79539f728
5642ca3d0eba16ca4ecd24dba5249658dd6916d3
/jam6.cpp
f8fbef6ede8fb89f8b1c419820b38542e5cff64a
[]
no_license
Suuareezz/DSA_Codes
0d4615550db861453293cdac0387c9cbb318e12d
ad33ee7f03db4258e8b0bdbfae9ce2b63b6ecda3
refs/heads/master
2023-01-03T15:46:13.334343
2020-10-21T14:43:16
2020-10-21T14:43:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
283
cpp
jam6.cpp
#include <stdio.h> #include<cstring> void f(char**); int main() { char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl" }; f(argv); return 0; } void f(char **p) { char *t; t = (p += sizeof(int))[-1]; char *utah="jk"; strcpy(t,utah); printf("%sn", t); }
ddd69b7abeb9752370bcaa351a2a7f3c61b11068
f816c668c0a43c702884558867300db94651269d
/StoreFrontEnd/Views/CollectionEditor/CELIOption.cpp
675ec6517f20e1403cd96437a3f209a944c47d27
[]
no_license
MRobertEvers/Card-Collection-Manager
a77de7df7d80e712d1318b2a8abed1a6492454f7
8ff77956c70bbbaa803f88061208e681a4533917
refs/heads/master
2021-07-11T23:43:26.051644
2018-12-09T01:17:56
2018-12-09T01:17:56
114,420,990
2
1
null
null
null
null
UTF-8
C++
false
false
724
cpp
CELIOption.cpp
#include "CELIOption.h" #include "../StoreFrontEnd/StoreFrontEnd.h" using namespace std; vector<CELIOption> CELIOption::ParseCollectionItemsList( const vector<string>& avecItems ) { StoreFront* ptSF = StoreFrontEnd::Server(); vector<CELIOption> vecRetVal; for( auto& id : avecItems ) { unsigned int Count; string ParentGroupName; vector<pair<string, string>> Identifiers; vector<pair<string, string>> MetaTags; StringInterface::ParseCardLine( id, Count, ParentGroupName, Identifiers, MetaTags ); CELIOption option; option.Display = ptSF->CollapseCardLine( id, false ); option.IDs = MetaTags; vecRetVal.push_back( option ); } return vecRetVal; }
f73ba0cd6273e52e40ea503e52f7ac45e9871a2f
713ff744e14bbb2553f5a4c1bda48b929e56e39a
/1004 - Monkey Banana Problem.cpp
78d55d22560b8ace3ebc76c63c3d49afeaa627bd
[]
no_license
Subangkar/LightOJ-Solved-Problems
6f77edf9d8d2666d25cb7c7f5f198ec7edf57656
d4d8115fdb2e3baf75915d19b2a5b8dfe5081076
refs/heads/master
2020-04-08T15:37:05.229363
2019-12-09T09:37:26
2019-12-09T09:45:08
159,485,724
0
0
null
null
null
null
UTF-8
C++
false
false
1,421
cpp
1004 - Monkey Banana Problem.cpp
// // Created by Subangkar on 30-Nov-19. // #include<bits/stdc++.h> using namespace std; #define N_MAX 200 uint64_t dp[N_MAX][N_MAX]; //double dp_value(int T, int D) { // if (T & 1) return 0.00; // for (int d = 0; d <= D; ++d) { // dp[0][d] = 1.00; // } // for (int t = 2; t <= T; t += 2) { // for (int d = 0; d <= D; ++d) { // int i = (t / 2) % 2, i_1 = !i; // dp[i][d] = (dp[i_1][d] * prob(TT, t, d) + // (d > 0 ? dp[i][d - 1] * prob(TD, t, d) + dp[i][d - 1] * prob(MD, t, d) : 0)) / // (1 - prob(DD, t, d)); // } // } // // return dp[(T / 2) % 2][D]; //} int main() { #ifdef OJ freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif int t, tc; // cin >> tc; scanf("%d", &tc); for (t = 1; t <= tc; t++) { int N; // cin >> N >> k >> D; scanf("%d", &N); for (int i = 1; i <= N; ++i) { for (int j = 1; j <= i; ++j) { scanf("%lld", &dp[i][j]); } } for (int i = N + 1; i < 2 * N; ++i) { for (int j = 1; j <= (N - (i % (N))); ++j) { scanf("%lld", &dp[i][j]); } } for (int i = 1; i <= N; ++i) { for (int j = 1; j <= i; ++j) { dp[i][j] = dp[i][j] + max(dp[i - 1][j - 1], dp[i - 1][j]); } } for (int i = N + 1; i < 2 * N; ++i) { for (int j = 1; j <= (N - (i % (N))); ++j) { dp[i][j] = dp[i][j] + max(dp[i - 1][j + 1], dp[i - 1][j]); } } printf("Case %d: %llu\n", t, dp[2 * N - 1][1]); } return 0; }
cac58b03e087f8c92d6699aeb8a4c3e1b1960368
7b2a83366f57f7344d27d8ada013a5e2c5fd3ca3
/Headers/Enum.h
68b7b6c7dccc6de851b677d4789ae22a43ee6911
[]
no_license
jw96118/Super-Meat-Boy
4aad03b433f4971d6a7ca0fbc55e5bac2f894cc5
7f6b18f9c83be380f71203c74e82865323ce328d
refs/heads/main
2023-07-10T22:39:37.618941
2021-08-14T14:39:27
2021-08-14T14:39:27
396,022,363
0
0
null
null
null
null
UTF-8
C++
false
false
871
h
Enum.h
#pragma once enum DISPLAY_MODE { MODE_FULL, MODE_WIN }; enum TEXTURE_TYPE { TEXTURE_SINGLE, TEXTURE_MULTI }; enum OBJECT_TYPE { OBJECT_TERRAIN, OBJECT_PLAYER, OBJECT_BANDAGE, OBJECT_EFFECT, OBJECT_UI, OBJECT_END }; enum SCENE_TYPE { SCENE_LOGO, SCENE_STAGE_SELECT, SCENE_STAGE, SCENE_END }; enum TILE_COL { NO = -1, LEFT = 0, RIGHT , TOP , BOTTOM, UPBOTTOM, BOTTOMUP, COL_END }; enum KILLOBJ_TYPE { NO_OBJ = -1, SAW=0, SAW_MOVE, SAW_MOVE_ANGLE }; enum PLAYER_STATE { IDLE = 0, MOVE_LEFT, MOVE_RIGHT, RUN_LEFT, RUN_RIGHT, JUMP, DOWN, DEAD, END }; enum EFFECT_TYPE { PLAYER_WALK, PLAYER_DASH, PLAYER_JUMP, PLAYER_START, PLAYER_DEAD , PLAYER_JUMP_WALL, PLAYER_LAND }; enum STAGE_INFO { STAGE_1, STAGE_2, STAGE_3, STAGE_END }; namespace SOUNDMGR { enum CHANNEL_ID { BGM, PLAYER, TITLE, EFFECT, SCENE, MAX_CHANNEL }; }
7f67c30fd5971d6c146f3717a963012f33e27133
5072ccd720f8a0bc73ed1883a360d5d2d18ad9c8
/src/DIDL/container.cpp
2c6f6943214793500758246f9871e82d66f15f47
[]
no_license
rouming/TvHolic
09ab14dedcb93e55199eb19af0b5f963c7796f8b
a6ae47ab8b0a020c63f89e7363e86a60948f880b
refs/heads/master
2020-12-24T18:12:35.308236
2013-05-13T10:34:24
2013-05-13T10:45:14
9,367,557
1
0
null
null
null
null
UTF-8
C++
false
false
1,434
cpp
container.cpp
#include "container.h" #include <QDebug> Container::Container(QString id, QString parentId, QString title, bool restricted, QString creator, QString writeStatus, bool searchable, QList<SearchClass *> searchClasses, QList<CreateClass *> createClasses) : DidlObject(id, parentId, title, restricted, creator, writeStatus) { this->elementName = "container"; this->upnpClass = DidlObject::getUpnpClass() + ".container"; this->createClasses = createClasses; this->searchClasses = searchClasses; this->searchable = searchable; this->childrenCnt = 0; } Container::~Container() { qDeleteAll(this->children); } void Container::addChild(DidlObject *c) { if (!this->children.contains(c)) { this->children.append(c); c->setParentId(this->id); } } int Container::getChildCount() { return this->children.size() ? this->children.size() : childrenCnt; } void Container::setChildCount(int cnt) { if (this->children.size()) return; this->childrenCnt = cnt; } QDomElement Container::toDidlElement(QDomDocument& doc) { QDomElement root = DidlObject::toDidlElement(doc); root.setAttribute("childCount", QString::number(getChildCount())); foreach (SearchClass *s, this->searchClasses) { root.appendChild(s->getElement()); } foreach(CreateClass *c, this->createClasses) { root.appendChild(c->getElement()); } root.setAttribute("searchable", this->searchable ? "true" : "false"); return root; }
5889684e8a7ac6f190a2a329a1340baed945aa91
1c42e1ae10997cf477aff771c156f074b49f97c3
/flame/trafgen.h
ddf88e32b464fa8826b388602a7c1ade25cd10f7
[ "Apache-2.0" ]
permissive
DNS-OARC/flamethrower
ad7d8ebc6626fb0c7cc3324a897920b821ae4f7a
122d80f5f306131441c43b859699c637b602262c
refs/heads/master
2023-05-25T03:47:01.714253
2022-12-07T16:16:54
2022-12-07T16:16:54
164,416,885
301
38
Apache-2.0
2023-05-19T21:18:56
2019-01-07T10:34:55
C++
UTF-8
C++
false
false
2,546
h
trafgen.h
// Copyright 2017 NSONE, Inc #pragma once #include <memory> #include <unordered_map> #include <vector> #include "config.h" #ifdef DOH_ENABLE #include "http.h" #include "httpssession.h" #endif #include "metrics.h" #include "query.h" #include "target.h" #include "tcpsession.h" #include "tokenbucket.h" #include <uvw.hpp> enum class Protocol { UDP, TCP, #ifdef DOH_ENABLE DOH, #endif DOT, }; struct TrafGenConfig { std::vector<Target> target_list; unsigned int _current_target{0}; int family{0}; std::string bind_ip; unsigned int port{53}; int r_timeout{3}; long s_delay{1}; long batch_count{10}; Protocol protocol{Protocol::UDP}; #ifdef DOH_ENABLE HTTPMethod method{HTTPMethod::POST}; #endif const Target& next_target() { const Target& next = target_list[_current_target]; _current_target++; if (_current_target >= target_list.size()) _current_target = 0; return next; } }; class TrafGen { std::shared_ptr<uvw::Loop> _loop; std::shared_ptr<Metrics> _metrics; std::shared_ptr<Config> _config; std::shared_ptr<TrafGenConfig> _traf_config; std::shared_ptr<QueryGenerator> _qgen; std::shared_ptr<TokenBucket> _rate_limit; std::shared_ptr<uvw::UDPHandle> _udp_handle; std::shared_ptr<uvw::TCPHandle> _tcp_handle; std::shared_ptr<TCPSession> _tcp_session; std::shared_ptr<uvw::TimerHandle> _sender_timer; std::shared_ptr<uvw::TimerHandle> _timeout_timer; std::shared_ptr<uvw::TimerHandle> _shutdown_timer; std::shared_ptr<uvw::TimerHandle> _finish_session_timer; // a hash of in flight queries, keyed by query id std::unordered_map<uint16_t, Query> _in_flight; // a randomized list of query ids that are not currently in flight std::vector<uint16_t> _free_id_list; bool _started_sending; bool _stopping; void handle_timeouts(bool force_reset = false); void process_wire(const char data[], size_t len); void start_udp(); void udp_send(); void connect_tcp_events(); void start_tcp_session(); void start_wait_timer_for_tcp_finish(); public: TrafGen(std::shared_ptr<uvw::Loop> l, std::shared_ptr<Metrics> s, std::shared_ptr<Config> c, std::shared_ptr<TrafGenConfig> tgc, std::shared_ptr<QueryGenerator> q, std::shared_ptr<TokenBucket> r); void start(); void stop(); std::vector<uint16_t>::size_type in_flight_cnt() { return _in_flight.size(); } };
a085fe2c17763294d52887ec5b50b902b51d5bcd
53f134bc79450dd425d80eb839f6275ff06569bd
/Button.ino
a2e572e114c557d82682fee3c604af3ee2101fe0
[]
no_license
bryanxander/Coop
c55c605c7e8286a4d34ccf0fccddcc5dc7465dbd
5759b86d823e926751f173c7ee008c8d2f50468e
refs/heads/master
2021-01-10T14:24:04.267896
2016-04-01T13:10:11
2016-04-01T13:10:11
55,230,650
0
0
null
2016-04-01T13:10:12
2016-04-01T12:23:49
Arduino
UTF-8
C++
false
false
1,222
ino
Button.ino
#define buttonLightPulsation 0.004 #define debounceDelay 250 volatile bool debouncing = false; volatile uint32_t lastPushDate = 0; //////////////////////////////////////////////////////////////////////////////// // setup void setupButton() { // set led as fully bright analogWrite(oButtonLight, 255); // set ISR interrupts(); attachInterrupt(4, onButtonPush, RISING); } // loop void loopButton() { // compute and set light level float buttonLightLevel = 128 * ( 1 + sin( buttonLightPulsation * millis() ) ); analogWrite(oButtonLight, buttonLightLevel); // re-attach ISR after debounce delay if (debouncing && millis() > lastPushDate + debounceDelay) { // end debounce debouncing = false; // re-ttach ISR interrupts(); //attachInterrupt(4, onButtonPush, RISING); } } //////////////////////////////////////////////////////////////////////////////// // button ISR void onButtonPush() { if (!digitalRead(iButton)) { return; } // detach ISR noInterrupts(); //detachInterrupt(4); // store push date debouncing = true; lastPushDate = millis(); // play tune playTune(1047, 1047); // toggle door toggleDoor(true); }
f26e6ad4eed021be3be1ccd23bc7955cdb1e1b1c
d613e6a8270b796928c093edc7ecdb405231e8d7
/Project2_code/Parameter.cpp
51bb6bd90dec6b6a1d4a98666bd355e6ed026e39
[]
no_license
jaydooroo/Project2
be7026ee3bf3c867a057c07f7d9b06161fc97b89
5fb98417843a5ad62ac75f2034c86d4f19f2c81d
refs/heads/master
2023-08-04T09:45:28.751682
2021-09-28T06:16:03
2021-09-28T06:16:03
411,134,159
0
0
null
null
null
null
UTF-8
C++
false
false
448
cpp
Parameter.cpp
// // Created by ejh61 on 2021-09-25. // #include "Parameter.h" Parameter:: Parameter(std::string tempChoice, std::string tempString): choice(tempChoice) { if (choice == "STRING") { STRING = tempString; } else { ID = tempString; } } std::string Parameter::toString() { std::ostringstream oss; if (choice == "STRING") { oss << STRING; } else { oss << ID; } return oss.str(); }
3e12177a064fb5967c42912dd285310f2705f2d9
74dbf92796bc4fa8ea7d8cc5d93ac0224ad7c5ce
/ManageGuard/Error.h
338ff349e12b4b0023c10f4d0b2090ebb0994864
[]
no_license
draxteam/manageGuard
ca864e34718420f36836f3225c8014269871455d
150b2add969dbcf3e83f6dba8bf583f008933201
refs/heads/master
2021-01-23T06:54:12.024225
2013-03-31T14:38:05
2013-03-31T14:38:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
466
h
Error.h
#ifndef ERROR_H #define ERROR_H #include <QObject> #include <QtGui> class Error : public QDialog { public: Error(); private: QString m_readError(int errorNbr); //Lit les erreurs envoyés à la fonction void m_displayDialError(QString returnError); //Affiche l'erreur à l'écran QPushButton *w_pbOk; QHBoxLayout *w_hlButtonOk; QLabel *w_lError; QVBoxLayout *w_vlError; }; #endif // ERROR_H
bd617772f1f85d6f9e48437ba86401d4ee4ee2c4
be4665ef9c3afb80daeed5977a2032b31892db7d
/src/config_type.h
892de3cb4cacad4cb7a1aaa5c69a9f4d74baf48c
[ "BSD-3-Clause" ]
permissive
smartlee/kvrocks
0498face27350cde72125383fc00912d819c6ea2
faabb8ad9688b819d3fc3e630d962361f068e57c
refs/heads/master
2021-07-31T16:39:10.464356
2021-07-22T10:40:08
2021-07-22T10:40:08
249,922,148
0
0
BSD-3-Clause
2021-07-22T10:40:08
2020-03-25T08:14:54
C++
UTF-8
C++
false
false
4,055
h
config_type.h
#pragma once #include <string> #include <utility> #include "util.h" #include "status.h" // forward declaration class Server; typedef std::function<Status(const std::string&, const std::string&)> validate_fn; typedef std::function<Status(Server *srv, const std::string&, const std::string&)> callback_fn; typedef struct configEnum { const char *name; const int val; } configEnum; int configEnumGetValue(configEnum *ce, const char *name); const char *configEnumGetName(configEnum *ce, int val); class ConfigField { public: ConfigField() = default; virtual ~ConfigField() = 0; virtual std::string ToString() = 0; virtual Status Set(const std::string &v) = 0; virtual Status ToNumber(int64_t *n) { return Status(Status::NotOK, "not supported"); } virtual Status ToBool(bool *b) { return Status(Status::NotOK, "not supported"); } public: bool readonly = true; validate_fn validate = nullptr; callback_fn callback = nullptr; }; class StringField: public ConfigField { public: StringField(std::string *receiver, std::string s): receiver_(receiver) { *receiver_ = std::move(s); } ~StringField() override = default; std::string ToString() override { return *receiver_; } Status Set(const std::string &v) override { *receiver_ = v; return Status::OK(); } private: std::string *receiver_; }; class IntField : public ConfigField { public: IntField(int *receiver, int n, int min, int max) : receiver_(receiver), min_(min), max_(max) { *receiver_ = n; } ~IntField() override = default; std::string ToString() override { return std::to_string(*receiver_); } Status ToNumber(int64_t *n) override { *n = *receiver_; return Status::OK(); } Status Set(const std::string &v) override { int64_t n; auto s = Util::StringToNum(v, &n, min_, max_); if (!s.IsOK()) return s; *receiver_ = static_cast<int>(n); return Status::OK(); } private: int *receiver_; int min_ = INT_MIN; int max_ = INT_MAX; }; class Int64Field : public ConfigField { public: Int64Field(int64_t *receiver, int64_t n, int64_t min, int64_t max) : receiver_(receiver), min_(min), max_(max) { *receiver_ = n; } ~Int64Field() override = default; std::string ToString() override { return std::to_string(*receiver_); } Status ToNumber(int64_t *n) override { *n = *receiver_; return Status::OK(); } Status Set(const std::string &v) override { int64_t n; auto s = Util::StringToNum(v, &n, min_, max_); if (!s.IsOK()) return s; *receiver_ = n; return Status::OK(); } private: int64_t *receiver_; int64_t min_ = INT64_MIN; int64_t max_ = INT64_MAX; }; class YesNoField : public ConfigField { public: YesNoField(bool *receiver, bool b) : receiver_(receiver) { *receiver_ = b; } ~YesNoField() override = default; std::string ToString() override { return *receiver_ ? "yes":"no"; } Status ToBool(bool *b) override { *b = *receiver_; return Status::OK(); } Status Set(const std::string &v) override { if (strcasecmp(v.data(), "yes") == 0) { *receiver_ = true; } else if (strcasecmp(v.data(), "no") == 0) { *receiver_ = false; } else { return Status(Status::NotOK, "argument must be 'yes' or 'no'"); } return Status::OK(); } private: bool *receiver_; }; class EnumField : public ConfigField { public: EnumField(int *receiver, configEnum *enums, int e) : receiver_(receiver), enums_(enums) { *receiver_ = e; } ~EnumField() override = default; std::string ToString() override { return configEnumGetName(enums_, *receiver_); } Status ToNumber(int64_t *n) override { *n = *receiver_; return Status::OK(); } Status Set(const std::string &v) override { int e = configEnumGetValue(enums_, v.c_str()); if (e == INT_MIN) { return Status(Status::NotOK, "invaild enum option"); } *receiver_ = e; return Status::OK(); } private: int *receiver_; configEnum *enums_ = nullptr; };
88099a9778a43582ab0470637fe680d7db9843c6
fc79fe29914d224d9f3a1e494aff6b8937be723f
/Libraries/Rim Framework/include/rim/util/rimStaticArrayList.h
a4410d138ee74385212ca4aa9e4a111c76be7ff6
[]
no_license
niti1987/Quadcopter
e078d23dd1e736fda19b516a5cd5e4aca5aa3c50
6ca26b1224395c51369442f202d1b4c4b7188351
refs/heads/master
2021-01-01T18:55:55.210906
2014-12-09T23:37:09
2014-12-09T23:37:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
37,522
h
rimStaticArrayList.h
/* * rimStaticArrayList.h * Rim Framework * * Created by Carl Schissler on 2/18/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_STATIC_ARRAY_LIST_H #define INCLUDE_RIM_STATIC_ARRAY_LIST_H #include "rimUtilitiesConfig.h" //########################################################################################## //*************************** Start Rim Utilities Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An array-based list class with a static element capacity. /** * The StaticArrayList class allows basic list operations: add(), remove(), * insert(), clear() and getSize(). Once the static capacity of the list is * reached, no more elements can be added to the list. */ template < typename T, Size capacity > class StaticArrayList { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty static array list. RIM_INLINE StaticArrayList() : numElements( 0 ), array( (T*)data ) { } /// Create a new static array list with its internal array initialized with element from an external array. /** * The initial size of the static array list is set to the number of * elements that are to be copied from the given array. If the number of * elements to be copied is larger than the static capacity of the list, * the maximum possible number of elements are copied. * * @param elements - an array of contiguous element objects from which to initialize this static array list. * @param newNumElements - the number of elements to copy from the element array. */ RIM_INLINE StaticArrayList( const T* elements, Size newNumElements ) : numElements( newNumElements < capacity ? newNumElements : capacity ), array( (T*)data ) { copyObjects( array, elements, numElements ); } /// Create a copy of another static array list, performing a deep copy. RIM_INLINE StaticArrayList( const StaticArrayList& other ) : numElements( other.numElements ), array( (T*)data ) { copyObjects( array, other.array, other.numElements ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this static array list, releasing all internal state. RIM_INLINE ~StaticArrayList() { // Call the destructors of all objects that were constructed. callDestructors( array, numElements ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents from another static array list to this one. RIM_INLINE StaticArrayList& operator = ( const StaticArrayList& other ) { if ( this != &other ) { // Call the destructors of all objects that were constructed. callDestructors( array, numElements ); // Copy the objects from the other array. numElements = other.numElements; copyObjects( array, other.array, other.numElements ); } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Operators /// Return whether or not whether every entry in this list is equal to another list's entries. RIM_INLINE Bool operator == ( const StaticArrayList<T,capacity>& other ) const { // If the arraylists point to the same data, they are equal. if ( array == other.array ) return true; else if ( numElements != other.numElements ) return false; // Do an element-wise comparison otherwise. const T* a = array; const T* b = other.array; const T* const aEnd = a + numElements; while ( a != aEnd ) { if ( !(*a == *b) ) return false; a++; b++; } return true; } /// Return whether or not whether any entry in this list is not equal to another list's entries. RIM_INLINE Bool operator != ( const StaticArrayList<T,capacity>& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Add Methods /// Add an element to the end of the static list. /** * If the capacity of the static array list is not great enough to hold * the new element, then FALSE is returned and the static array list is * unaffected. Otherwise, the element is successfully added and TRUE * is returned. * * @param newElement - the new element to add to the end of the static array list. * @return whether or not the element was successfully added. */ RIM_INLINE Bool add( const T& newElement ) { if ( numElements != capacity ) { new (array + numElements) T( newElement ); numElements++; return true; } else return false; } /// Add the contents of one static array list to another. /** * This method has the effect of adding each element of * the given list to the end of this array list in order. * * @param list - the list to be added to the end of this list */ template < Size otherCapacity > void addAll( const StaticArrayList<T,otherCapacity>& list ) { if ( numElements + list.numElements <= capacity ) { StaticArrayList::copyObjects( array + numElements, list.array, list.numElements ); numElements += list.numElements; return true; } else return false; } /// Insert an element at the specified index of the static array list. /** * The method returns TRUE if the element was successfully inserted * into the static array list. If the index is outside of the bounds of the * static array list, then FALSE is returned, indicating that the element * was not inserted. FALSE will also be returned if there is no * more room in the static array list. This method has an average case * time complexity of O(n/2) because all subsequent elements in * the static array list have to be moved towards the end of the array by one * index. * * @param newElement - the new element to insert into the static array list. * @param index - the index at which to insert the new element. * @return whether or not the element was successfully inserted into the static array list. */ RIM_INLINE Bool insert( Index index, const T& newElement ) { if ( index >= 0 && index <= numElements && numElements != capacity ) { T* destination = array + numElements; const T* source = array + numElements - 1; const T* const sourceEnd = array + index - 1; while ( source != sourceEnd ) { new (destination) T(*source); source->~T(); source--; destination--; } new (array + index) T( newElement ); numElements++; return true; } else return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Set Method /// Set an element at the specified index of the static array list to a new value. /** * This method returns TRUE if the specified index is within the bounds * of the static array list, indicating that the element was successfully set * at that position in the static array list. Otherwise, FALSE is returned, * indicating that the index was out of bounds of the static array list. This * method has worst-case time complexity of O(1). * * @param newElement - the new element to set in the static array list. * @param index - the index at which to set the new element. * @return whether or not the element was successfully set to the new value. */ RIM_INLINE Bool set( Index index, const T& newElement ) { if ( index < numElements ) { // destroy the old element. array[index].~T(); // replace it with the new element. new (array + index) T(newElement); return true; } else return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remove Methods /// Remove the element at the specified index, ordered version. /** * If the index is within the bounds of the static array list ( >= 0 && < getSize() ), * then the static array list element at that index is removed and TRUE is returned, * indicating that the remove operation was successful. * Otherwise, FALSE is returned and the static array list * is unaffected. The order of the static array list is unaffected, meaning that * all of the elements after the removed element must be copied one * index towards the beginning of the static array list. This gives the method * an average case performance of O(n/2) where n is the number of * elements in the static array list. * * @param index - the index of the static array list element to remove. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool removeAtIndex( Index index ) { if ( index < numElements ) { // shift all elements forward in the array one index. numElements--; // Destroy the element to be removed. array[index].~T(); // Move the objects to fill the hole in the array. StaticArrayList::moveObjects( array + index, array + index + 1, numElements - index ); return true; } else return false; } /// Remove the element at the specified index, unordered version. /** * If the index is within the bounds of the static array list ( >= 0 && < getSize() ), * then the static array list element at that index is removed and TRUE is returned, * indicating that the remove operation was successful. * Otherwise, FALSE is returned and the static array list is unaffected. * The order of the static array list is affected when this method * successfully removes the element. It works by replacing the element * at the index to be removed with the last element in the static array list. This * gives the method a worst case time complexity of O(1), which is * much faster than the ordered remove methods. * * @param index - the index of the static array list element to remove. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool removeAtIndexUnordered( Index index ) { if ( index < numElements ) { numElements--; // Destroy the element to be removed. T* destination = array + index; destination->~T(); // Replace it with the last element if necessary. if ( index != numElements ) { T* source = array + numElements; new (destination) T(*source); source->~T(); } return true; } else return false; } /// Remove the first element equal to the parameter object, ordered version. /** * If this element is found, then it is removed and TRUE is returned. * Otherwise, FALSE is returned and the static array list is unaffected. * The order of the static array list is unaffected, meaning that all of the elements after * the removed element must be copied one index towards the beginning * of the static array list. This gives the method an average case performance * of O(n) where n is the number of elements in the static array list. This * method's complexity is worse than the ordered index remove method * because it must search through the static array list for the element and then * copy all subsequent elements one position nearer to the start of the * list. * * @param element - the element to remove the first instance of. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool remove( const T& object ) { const T* const end = array + numElements; for ( T* element = array; element != end; element++ ) { if ( *element == object ) { numElements--; // Destroy the element to be removed. element->~T(); // Move the objects to fill the hole in the array. StaticArrayList::moveObjects( element, element + 1, end - element - 1 ); return true; } } return false; } /// Remove the first element equal to the parameter object, unordered version. /** * If this element is found, then it is removed and TRUE is returned. * Otherwise, FALSE is returned and the static array list is unaffected. * The order of the static array list is affected when this method * successfully removes the element. It works by replacing the element * at the index to be removed with the last element in the static array list. This * gives the method a worst case time complexity of O(1), which is * much faster than the ordered remove methods. * * @param object - the static array list element to remove the first instance of. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool removeUnordered( const T& object ) { const T* const end = array + numElements; for ( T* element = array; element != end; element++ ) { if ( *element == object ) { numElements--; // Destroy the element to be removed. element->~T(); const T* last = array + numElements; // Replace it with the last element if possible. if ( element != last ) { new (element) T(*last); last->~T(); } return true; } } return false; } /// Remove the last element in the static array list. /** * If the static array list has elements remaining in it, then * the last element in the array list is removed and TRUE is returned. * If the static array list has no remaining elements, then FALSE is returned, * indicating that the static array list was unaffected. This method has worst * case O(1) time complexity. * * @return whether or not the last element was successfully removed. */ RIM_INLINE Bool removeLast() { if ( numElements != Size(0) ) { numElements--; // destroy the last element. array[numElements].~T(); return true; } else return false; } /// Remove the last N elements from the static array list. /** * If the static array list has at least N elements remaining in it, then * the last N elements in the array list are removed and N is returned. * If the array list has less than N elements, then the list will be * completely cleared, resulting in an empty list. The method returns the * number of elements successfully removed. * * @return the number of elements removed from the end of the list. */ RIM_INLINE Size removeLast( Size number ) { number = numElements > number ? number : numElements; numElements -= number; // destroy the elements that were removed. ArrayList<T>::callDestructors( array + numElements, number ); return number; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Method /// Clear the contents of this static array list. /** * This method calls the destructors of all elements in the static * array and sets the number of elements to zero while maintaining the * array's capacity. */ RIM_INLINE void clear() { StaticArrayList::callDestructors( array, numElements ); numElements = Size(0); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Contains Method /// Return whether or not the specified element is in this static array list. /** * The method has average case O(n/2) time complexity, where * n is the number of elements in the static array list. This method * is here for convenience. It just calls the static array list's * getIndex() method, and tests to see if the return value is * not equal to -1. It is recommended that if one wants the * index of the element as well as whether or not it is contained * in the static array list, they should use the getIndex() method exclusively, * and check the return value to make sure that the element is in the * static array list. This avoids the double O(n/2) lookup that would be performed * one naively called this method and then that method. * * @param element - the element to check to see if it is contained in the static array list. * @return whether or not the specified element is in the static array list. */ RIM_INLINE Bool contains( const T& anElement ) const { T* element = array; const T* const end = array + numElements; while ( element != end ) { if ( *element == anElement ) return true; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Find Method /// Return the index of the element equal to the parameter element. /** * If the specified element is not found within the static array list, * then -1 is returned. Otherwise, the index of the element * equal to the parameter is returned. * * @param element - the element to find in the static array list. * @return the index of the element which was found, or -1 if it was not found. */ RIM_INLINE Bool getIndex( const T& object, Index& index ) const { T* element = array; const T* const end = array + numElements; while ( element != end ) { if ( *element == object ) { index = element - array; return true; } } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the static array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the const version * of the get() method, disallowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE const T& get( Index index ) const { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the static array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the non-const version * of the get() method, allowing modification of the element via the * returned non-const reference. * * @param index - the index of the desired element. * @return a reference to the element at the index specified by the parameter. */ RIM_INLINE T& get( Index index ) { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Return a reference to the first element in the static array list. RIM_INLINE T& getFirst() { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *array; } /// Return a const reference to the first element in the static array list. RIM_INLINE const T& getFirst() const { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *array; } /// Return a reference to the last element in the static array list. RIM_INLINE T& getLast() { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *(array + numElements - 1); } /// Return a const reference to the last element in the static array list. RIM_INLINE const T& getLast() const { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *(array + numElements - 1); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Operators /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the static array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the const version * of the operator (), disallowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE const T& operator () ( Index index ) const { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the static array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the non-const version * of the operator (), allowing modification of the element via the * returned non-const reference. * * @param index - the index of the desired element. * @return a reference to the element at the index specified by the parameter. */ RIM_INLINE T& operator () ( Index index ) { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Get a const pointer to the first element in the static array list. RIM_INLINE operator const T* () const { return array; } /// Get a pointer to the first element in the static array list. RIM_INLINE operator T* () { return array; } /// Return a const pointer to the beginning of the internal array. RIM_INLINE const T* getPointer() const { return array; } /// Return a pointer to the beginning of the internal array. RIM_INLINE T* getPointer() { return array; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return whether or not the static array list has any elements. /** * This method returns TRUE if the size of the static array list * is greater than zero, and FALSE otherwise. * This method is here for convenience. * * @return whether or not the static array list has any elements. */ RIM_INLINE Bool isEmpty() const { return numElements == 0; } /// Get the number of elements in the static array list. /** * @return the number of elements in the static array list. */ RIM_INLINE Size getSize() const { return numElements; } /// Get the capacity of the static array list. /** * The capacity is the maximum number of elements that the * static array list can hold. This value does not change during * the lifetime of the static array list, hence the name. * * @return the current capacity of the static array list. */ RIM_INLINE Size getCapacity() const { return capacity; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Class /// Iterator class for an static array list. /** * The purpose of this class is to iterate through all * or some of the elements in the static array list, making changes as * necessary to the elements. */ class Iterator { public: //******************************************** // Constructor /// Create a new static array list iterator from a reference to a list. RIM_INLINE Iterator( StaticArrayList<T,capacity>& newList ) : list( newList ), current( newList.array ), end( newList.array + newList.numElements ) { } //******************************************** // Public Methods /// Prefix increment operator. RIM_INLINE void operator ++ () { current++; } /// Postfix increment operator. RIM_INLINE void operator ++ ( int ) { current++; } /// Return whether or not the iterator is at the end of the list. /** * If the iterator is at the end of the list, return FALSE. * Otherwise, return TRUE, indicating that there are more * elements to iterate over. * * @return FALSE if at the end of list, otherwise TRUE. */ RIM_INLINE operator Bool () const { return current < end; } /// Return a reference to the current iterator element. RIM_INLINE T& operator * () { return *current; } /// Access the current iterator element. RIM_INLINE T* operator -> () { return current; } /// Remove the current element from the list. /** * This method calls the removeAtIndex() method of the * iterated static array list, and therefore has an average * time complexity of O(n/2) where n is the size of the * array list. */ RIM_INLINE void remove() { list.removeAtIndex( getIndex() ); current = current == list.array ? current : current - 1; end--; } /// Remove the current element from the list. /** * This method calls the removeAtIndexUnordered() method of the * iterated static array list, and therefore has an average * time complexity of O(1). */ RIM_INLINE void removeUnordered() { list.removeAtIndexUnordered( getIndex() ); current = current == list.array ? current : current - 1; end--; } /// Reset the iterator to the beginning of the list. RIM_INLINE void reset() { current = list.array; end = current + list.numElements; } /// Get the index of the next element to be iterated over. RIM_INLINE Index getIndex() { return current - list.array; } private: //******************************************** // Private Data Members /// The current position of the iterator T* current; /// A pointer to one element past the end of the list. const T* end; /// The list that is being iterated over. StaticArrayList<T,capacity>& list; /// Make the const iterator class a friend. friend class StaticArrayList<T,capacity>::ConstIterator; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** ConstIterator Class /// An iterator class for a static array list which can't modify it. /** * The purpose of this class is to iterate through all * or some of the elements in the static array list. */ class ConstIterator { public: //******************************************** // Constructor /// Create a new static array list iterator from a reference to a list. RIM_INLINE ConstIterator( const StaticArrayList<T,capacity>& newList ) : list( newList ), current( newList.array ), end( newList.array + newList.numElements ) { } /// Create a new const static array list iterator from a non-const iterator. RIM_INLINE ConstIterator( const Iterator& iterator ) : list( iterator.list ), current( iterator.current ), end( iterator.end ) { } //******************************************** // Public Methods /// Prefix increment operator. RIM_INLINE void operator ++ () { current++; } /// Postfix increment operator. RIM_INLINE void operator ++ ( int ) { current++; } /// Return whether or not the iterator is at the end of the list. /** * If the iterator is at the end of the list, return FALSE. * Otherwise, return TRUE, indicating that there are more * elements to iterate over. * * @return FALSE if at the end of list, otherwise TRUE. */ RIM_INLINE operator Bool () const { return current < end; } /// Return a const-reference to the current iterator element. RIM_INLINE const T& operator * () const { return *current; } /// Access the current iterator element. RIM_INLINE const T* operator -> () const { return current; } /// Reset the iterator to the beginning of the list. RIM_INLINE void reset() { current = list.array; end = current + list.numElements; } /// Get the index of the next element to be iterated over. RIM_INLINE Index getIndex() const { return current - list.array; } private: //******************************************** // Private Data Members /// The current position of the iterator const T* current; /// A pointer to one element past the end of the list. const T* end; /// The list that is being iterated over. const StaticArrayList<T,capacity>& list; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Creation Methods /// Return an iterator for the static array list. /** * The iterator serves to provide a way to efficiently iterate * over the elements of the static array list. It is more useful for * a linked list type of data structure, but it is provided for * uniformity among data structures. * * @return an iterator for the static array list. */ RIM_INLINE Iterator getIterator() { return Iterator(*this); } /// Return a const iterator for the static array list. /** * The iterator serves to provide a way to efficiently iterate * over the elements of the static array list. It is more useful for * a linked list type of data structure, but it is provided for * uniformity among data structures. * * @return an iterator for the static array list. */ RIM_INLINE ConstIterator getIterator() const { return ConstIterator(*this); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods RIM_INLINE static void callDestructors( T* array, Size number ) { const T* const arrayEnd = array + number; while ( array != arrayEnd ) { array->~T(); array++; } } RIM_INLINE static void copyObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { new (destination) T(*source); destination++; source++; } } RIM_INLINE static void moveObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { // copy the object from the source to destination new (destination) T(*source); // call the destructors on the source source->~T(); destination++; source++; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The array holding all elements in this static array list. T* array; /// The number of elements in the static array list. Size numElements; /// The array of bytes used to allocate memory for the array. UByte data[capacity*sizeof(T)]; }; //########################################################################################## //*************************** End Rim Utilities Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_STATIC_ARRAY_LIST_H
9b6a6726fd60c514b4d0f6e8f2da231f4217d984
0eff74b05b60098333ad66cf801bdd93becc9ea4
/second/download/git/gumtree/git_patch_hunk_146.cpp
3c68e07ed63c0ac369c3ec2b2b0c503df595e43d
[]
no_license
niuxu18/logTracker-old
97543445ea7e414ed40bdc681239365d33418975
f2b060f13a0295387fe02187543db124916eb446
refs/heads/master
2021-09-13T21:39:37.686481
2017-12-11T03:36:34
2017-12-11T03:36:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
800
cpp
git_patch_hunk_146.cpp
return git_config_string(&pager_program, var, value); if (!strcmp(var, "core.editor")) return git_config_string(&editor_program, var, value); if (!strcmp(var, "core.commentchar")) { - const char *comment; - int ret = git_config_string(&comment, var, value); - if (!ret) - comment_line_char = comment[0]; - return ret; + if (!value) + return config_error_nonbool(var); + else if (!strcasecmp(value, "auto")) + auto_comment_line_char = 1; + else if (value[0] && !value[1]) { + comment_line_char = value[0]; + auto_comment_line_char = 0; + } else + return error("core.commentChar should only be one character"); + return 0; } if (!strcmp(var, "core.askpass")) return git_config_string(&askpass_program, var, value); if (!strcmp(var, "core.excludesfile"))
f6653e3e5fa2ceb8fe79aff34e46534a4f591c86
363687005f5b1d145336bf29d47f3c5c7b867b5b
/atcoder/abc182/d/Main.cpp
5b8599a8ad82bba211af3ba9a64f991dd5799f8b
[]
no_license
gky360/contests
0668de0e973c0bbbcb0ccde921330810265a986c
b0bb7e33143a549334a1c5d84d5bd8774c6b06a0
refs/heads/master
2022-07-24T07:12:05.650017
2022-01-17T14:01:33
2022-07-10T14:01:33
113,739,612
1
0
null
null
null
null
UTF-8
C++
false
false
749
cpp
Main.cpp
/* [abc182] D - Wandering */ #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double DD; typedef pair<int, int> pii; typedef pair<ll, int> pli; typedef pair<ll, ll> pll; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(c) (c).begin(), (c).end() const int MAX_N = 200000; int N; ll A[MAX_N]; ll solve() { ll s[MAX_N + 1], ms[MAX_N + 1]; s[0] = ms[0] = 0; REP(i, N) { s[i + 1] = s[i] + A[i]; ms[i + 1] = max(ms[i], s[i + 1]); } ll ans = 0; ll x = 0; REP(i, N) { ans = max(ans, x + ms[i + 1]); x += s[i + 1]; } return ans; } int main() { cin >> N; REP(i, N) cin >> A[i]; cout << solve() << endl; return 0; }
df49067d75db881e926123f89b5cd061539ac208
05f637fa14ac28031cb1ea92086a0f4eb23ff2b1
/src/library/printer.h
67c225d32e92fca4798c109fc64a609c2475ddbd
[ "Apache-2.0" ]
permissive
codyroux/lean0.1
1ce92751d664aacff0529e139083304a7bbc8a71
0dc6fb974aa85ed6f305a2f4b10a53a44ee5f0ef
refs/heads/master
2021-01-16T20:55:35.062666
2014-06-07T14:14:40
2014-06-07T14:14:40
19,588,851
2
0
null
null
null
null
UTF-8
C++
false
false
1,012
h
printer.h
/* Copyright (c) 2013 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura */ #pragma once #include <iostream> #include <utility> #include "kernel/expr.h" #include "kernel/context.h" #include "kernel/formatter.h" namespace lean { class ro_environment; std::ostream & operator<<(std::ostream & out, context const & ctx); std::ostream & operator<<(std::ostream & out, expr const & e); std::ostream & operator<<(std::ostream & out, std::pair<expr const &, context const &> const & p); class object; std::ostream & operator<<(std::ostream & out, object const & obj); std::ostream & operator<<(std::ostream & out, ro_environment const & env); /** \brief Create a simple formatter object based on \c print function. */ formatter mk_simple_formatter(); } void print(lean::expr const & a); void print(lean::expr const & a, lean::context const & c); void print(lean::context const & c); void print(lean::ro_environment const & e);
bfdbfd691a0642da18c7d634695a993e737bf612
a6e474bc7f48955c360bb894d43d9c1297a33cc1
/벽돌깨기3/벽돌깨기3/cBlock.h
2876b88df9b7f31be2dbb95e8b9aa44fd1f3d2da
[]
no_license
zkem4wkd/C--Practice
38a6f1263782577c48e766c97a390c40bcfaea71
9d19e1ef962bf2281ccf1de87f938b598bdbed5e
refs/heads/master
2022-12-15T06:56:29.040390
2020-09-17T01:48:31
2020-09-17T01:48:31
293,418,761
0
0
null
null
null
null
UTF-8
C++
false
false
271
h
cBlock.h
#pragma once #include "define.h" class cBlock { private: BLOCK tBlock[50]; public: int Search(int nEnd, int nX, int nY); void setBlock(int nBlockCount); public: void Initialize(); void Progress(); void Render(); void Release(); public: cBlock(); ~cBlock(); };
6222f3af3840116a85403b5a07578f7b7398bf67
b72d4e8ddb2bcf043126730dc471ab2800072c15
/Taiko trainer/TaikoTrainerWindow.cpp
d87e4ffbeb7b3168f883178c23edd8d1e093bb3f
[]
no_license
hakerg/Taiko-trainer
981d5cc7bc73becf6519dd93063ac7aa4add3f86
e9fd5407f83d38cbe83fd8d0c63448be917c02d3
refs/heads/master
2020-04-15T00:03:01.366142
2019-01-05T15:19:34
2019-01-05T15:19:34
164,226,525
1
0
null
null
null
null
WINDOWS-1250
C++
false
false
5,735
cpp
TaikoTrainerWindow.cpp
#include "TaikoTrainerWindow.h" #include <allegro5\allegro_ttf.h> #include "AnimationHalfCosine.h" #include "contants.h" TaikoTrainerWindow::TaikoTrainerWindow() : AllegroWindow(SCREEN_SIZE, SUB_FRAME_BUFFER_SIZE), hits(MAX_REGISTERED_HITS), keys_overlay_animations { { current_frame.katsu_left_intensity, KEYS_OVERLAY_DAMPING, 0.0 }, { current_frame.don_left_intensity, KEYS_OVERLAY_DAMPING, 0.0 }, { current_frame.don_right_intensity, KEYS_OVERLAY_DAMPING, 0.0 }, { current_frame.katsu_right_intensity, KEYS_OVERLAY_DAMPING, 0.0 } } { next_circle_time = std::chrono::high_resolution_clock::now() + READY_TIME; don_hit_sound = BASS_StreamCreateFile(false, L"resources//taiko-normal-hitnormal.wav", 0, 0, NULL); katsu_hit_sound = BASS_StreamCreateFile(false, L"resources//taiko-normal-hitclap.wav", 0, 0, NULL); miss_sound = BASS_StreamCreateFile(false, L"resources//count1s.wav", 0, 0, NULL); wrong_sound = BASS_StreamCreateFile(false, L"resources//combobreak.wav", 0, 0, NULL); current_frame.font = al_load_ttf_font("resources//consola.ttf", FONT_SIZE, NULL); } // Odziedziczono za pośrednictwem elementu AllegroWindow bool TaikoTrainerWindow::add_time(std::chrono::duration<double> delta_time) { std::shared_ptr<CircleHit> hit_pointer; while (hit_pointer = hits.try_pop_ptr()) { //auto circle_iterator = closest_circle(hit.time); auto circle_iterator = current_frame.circles.begin(); if (circle_iterator == current_frame.circles.end()) { if (hit_pointer->katsu) current_frame.message = "katsu"; else current_frame.message = "don"; } else { std::chrono::milliseconds hit_delay = std::chrono::duration_cast<std::chrono::milliseconds>(hit_pointer->time - circle_iterator->hit_time); if (circle_iterator->katsu) { if (hit_pointer->katsu) { BASS_ChannelPlay(katsu_hit_sound, true); current_frame.message = "katsu, delay: " + std::to_string(hit_delay.count()) + "ms"; } else { BASS_ChannelPlay(wrong_sound, true); current_frame.message = "katsu, you hit don"; } } else { if (hit_pointer->katsu) { BASS_ChannelPlay(wrong_sound, true); current_frame.message = "don , you hit katsu"; } else { BASS_ChannelPlay(don_hit_sound, true); current_frame.message = "don , delay: " + std::to_string(hit_delay.count()) + "ms"; } } current_frame.circles.erase(circle_iterator); } } value_changers.add_time(delta_time); for (unsigned n = 0; n < 4; n++) { keys_overlay_animations[n].add_time(delta_time); } if (std::chrono::high_resolution_clock::now() + CIRCLE_APPEAR_TIME >= next_circle_time) { current_frame.circles.emplace_back(next_circle_time, scrolling_speed, rand() & 1, false); next_circle_time += std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::duration<double>(15.0 / current_frame.bpm)); } while (current_frame.circles.size()) { if (std::chrono::high_resolution_clock::now() >= current_frame.circles.front().hit_time + CIRCLE_DISAPPEAR_TIME) { BASS_ChannelPlay(miss_sound, true); current_frame.circles.pop_front(); current_frame.message = "miss"; } else break; } return true; } bool TaikoTrainerWindow::_handle_event(const ALLEGRO_EVENT & event) { if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) return false; else if (event.type == ALLEGRO_EVENT_KEY_DOWN) { if (event.keyboard.keycode == ALLEGRO_KEY_Z) { hits.try_push(CircleHit(std::chrono::high_resolution_clock::now(), true)); current_frame.katsu_left_intensity = 1.0; } else if (event.keyboard.keycode == ALLEGRO_KEY_X) { hits.try_push(CircleHit(std::chrono::high_resolution_clock::now(), false)); current_frame.don_left_intensity = 1.0; } else if (event.keyboard.keycode == ALLEGRO_KEY_FULLSTOP) { hits.try_push(CircleHit(std::chrono::high_resolution_clock::now(), false)); current_frame.don_right_intensity = 1.0; } else if (event.keyboard.keycode == ALLEGRO_KEY_SLASH) { hits.try_push(CircleHit(std::chrono::high_resolution_clock::now(), true)); current_frame.katsu_right_intensity = 1.0; } else if (event.keyboard.keycode == ALLEGRO_KEY_UP) { current_frame.bpm += BPM_STEP; current_frame.message = "bpm increased to " + std::to_string(current_frame.bpm); } else if (event.keyboard.keycode == ALLEGRO_KEY_DOWN) { current_frame.bpm -= BPM_STEP; current_frame.message = "bpm decreased to " + std::to_string(current_frame.bpm); } else if (event.keyboard.keycode == ALLEGRO_KEY_LEFT) { target_scrolling_speed += SROLLING_SPEED_STEP; value_changers.push_back(std::make_shared<uc::AnimationHalfCosine>(scrolling_speed, target_scrolling_speed - scrolling_speed, std::chrono::seconds(1))); current_frame.message = "scrolling speed increased"; } else if (event.keyboard.keycode == ALLEGRO_KEY_RIGHT) { target_scrolling_speed -= SROLLING_SPEED_STEP; value_changers.push_back(std::make_shared<uc::AnimationHalfCosine>(scrolling_speed, target_scrolling_speed - scrolling_speed, std::chrono::seconds(1))); current_frame.message = "scrolling speed decreased"; } return true; } else return true; } void TaikoTrainerWindow::draw(const WindowDrawData & source) { source.draw(); } TaikoTrainerWindow::~TaikoTrainerWindow() { } typename std::list<TaikoCircle>::iterator TaikoTrainerWindow::closest_circle(std::chrono::high_resolution_clock::time_point time) { auto closest_iterator = current_frame.circles.begin(); for (auto iterator = current_frame.circles.begin(); iterator != current_frame.circles.end(); iterator++) { if (abs(iterator->hit_time - time) < abs(closest_iterator->hit_time - time)) closest_iterator = iterator; } return closest_iterator; }
22818dea5681d5ca56f39713f3f894db031e1608
989662f985f3f66e4ba0eb8acc45b0c637c91037
/tetris/debug/qrc_trtrisarea.cpp
5a11fd105c5eba8a28d43990c4b82f32bf324fc5
[]
no_license
guzhoudiaoke/qt_games
5caa56ee39df7cfdcd7a7310974c79156d2c773b
603b22d3f3d1cadbf81e54659278abde50cf97a9
refs/heads/master
2021-01-20T22:09:51.429313
2016-07-20T11:53:19
2016-07-20T11:53:19
63,777,476
0
0
null
null
null
null
UTF-8
C++
false
false
52,081
cpp
qrc_trtrisarea.cpp
/**************************************************************************** ** Resource object code ** ** Created: Wed Aug 31 16:03:52 2011 ** by: The Resource Compiler for Qt version 4.7.0 ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include <QtCore/qglobal.h> static const unsigned char qt_resource_data[] = { // D:/tetris/images/rect.png 0x0,0x0,0x25,0xd9, 0x89, 0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0, 0x0,0x0,0xfa,0x0,0x0,0x0,0x32,0x8,0x2,0x0,0x0,0x0,0xfa,0x35,0x51,0xb3, 0x0,0x0,0x0,0x1,0x73,0x52,0x47,0x42,0x0,0xae,0xce,0x1c,0xe9,0x0,0x0,0x0, 0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x12,0x0,0x0,0xb,0x12,0x1,0xd2,0xdd, 0x7e,0xfc,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xdb,0x8,0x4,0x5,0x8, 0x2c,0xf7,0xf5,0xbe,0xda,0x0,0x0,0x20,0x0,0x49,0x44,0x41,0x54,0x78,0xda,0xed, 0x7d,0x59,0x73,0x5c,0x59,0x72,0x5e,0xe6,0xb9,0xb7,0xaa,0x80,0xc2,0x4a,0x0,0x4, 0x89,0x8d,0x5b,0x37,0x7b,0xd8,0x3d,0x9b,0x46,0x31,0xb6,0x1f,0xe4,0x50,0x84,0xc2, 0x11,0xa,0x3d,0x5a,0xff,0x40,0xbf,0xc7,0x7f,0xc1,0x4f,0x7e,0x1b,0x3d,0x49,0x2f, 0x7a,0x90,0x22,0x1c,0xf6,0xd8,0xe,0x4b,0xb2,0x96,0x51,0x4b,0xad,0x5e,0xb8,0x34, 0x37,0xec,0xa8,0xf5,0x6e,0x67,0xcd,0x4c,0x3f,0x9c,0x5b,0xb,0x40,0x90,0xd,0x82, 0xe0,0x68,0x7a,0x82,0xb7,0x11,0xec,0x73,0x80,0x42,0xa1,0xaa,0x6e,0x9e,0x3c,0x5f, 0x7e,0x99,0xe7,0x4b,0xfc,0xe6,0xef,0xbf,0xd9,0xb8,0xb7,0x31,0x3c,0x19,0x3e,0xff, 0xfc,0xf9,0xfe,0xd7,0xfb,0x83,0xa3,0x81,0x2e,0xb4,0x37,0x9e,0x88,0x84,0x44,0x58, 0x0,0x40,0x40,0xe0,0x3d,0x5c,0x2,0x22,0x2c,0xc1,0x7,0xe7,0x9d,0xb1,0xa6,0x34, 0x65,0x61,0x8a,0x42,0x17,0xbd,0x6e,0xef,0xcf,0x5f,0xfc,0x79,0x43,0x35,0xb4,0xd6, 0x45,0x56,0x3c,0x39,0x79,0xf2,0xb8,0xf3,0x78,0xb5,0xb1,0x7a,0xa3,0x75,0x63,0xb7, 0xd8,0xdd,0x2f,0xf7,0x37,0xda,0x1b,0x5b,0x73,0x5b,0x7b,0xe5,0xde,0x7e,0xb5,0xbf, 0xd9,0xde,0xbc,0x92,0xf1,0x56,0x7b,0x6b,0xa3,0xbd,0xb1,0x5f,0xed,0xef,0x97,0xfb, 0x37,0x67,0x6e,0xae,0xb7,0xd6,0x9f,0xf,0x9e,0x3f,0xeb,0x3e,0x9b,0xe7,0xf9,0x59, 0x3f,0xfb,0xe8,0xe0,0xd1,0x17,0xcf,0xff,0xe5,0xbf,0xfe,0x97,0xff,0x76,0xfd,0xda, 0xb5,0xe3,0x7e,0xf7,0x7f,0xfc,0xcb,0xdf,0xfe,0xea,0xc9,0x57,0xc1,0xb9,0xfd,0xfe, 0xc9,0x62,0xab,0x7d,0x92,0xf7,0x41,0x60,0x75,0x6e,0xa9,0x57,0x65,0x2b,0xed,0x85, 0x4e,0x39,0x4,0x80,0xb5,0xb9,0xe5,0x5e,0x35,0x5c,0x69,0x2f,0x75,0xca,0xc1,0x3b, 0x4e,0x57,0xe7,0x96,0xfa,0x55,0xb6,0x3c,0xb3,0xd0,0xc9,0xfa,0x44,0xb4,0x98,0xce, 0x76,0xfa,0xbd,0x19,0x51,0x9d,0x41,0x7f,0x7f,0x7f,0xff,0x5f,0xff,0xec,0x7f,0xcd, 0x2f,0x2d,0x76,0xba,0xfd,0x2f,0xbe,0x79,0xfc,0xed,0xf3,0x17,0xfd,0xc1,0xc0,0x68, 0x4b,0x81,0x18,0x18,0x44,0xe2,0x7,0xd,0x38,0xf9,0xd0,0x19,0x40,0x10,0x0,0x0, 0x5,0x30,0xfe,0x64,0xfc,0x53,0x8c,0x77,0x5,0xe4,0xcc,0x63,0xf0,0x75,0xb7,0x50, 0x98,0x85,0x98,0x28,0x4,0xef,0x8c,0x35,0x46,0x1b,0x6d,0xaa,0xea,0xff,0xfc,0xcf, 0xff,0xfe,0xf,0x9f,0x7f,0xb5,0xba,0x3c,0x77,0xd4,0x19,0xfc,0xdd,0x17,0x4f,0xbe, 0x78,0xbc,0x7b,0xd2,0x1b,0x6a,0xe3,0x88,0x2,0x33,0x3,0xd4,0xaf,0xeb,0xbd,0xd8, 0x54,0xfd,0xba,0x84,0x29,0x50,0x8,0xde,0x1b,0x67,0x4c,0x55,0x16,0x45,0x9e,0x65, 0x59,0x9e,0x6e,0xdc,0xdb,0x98,0x5f,0x9e,0x4f,0x1a,0x49,0xd5,0xab,0xaa,0x6e,0x15, 0x6c,0x0,0x4,0x95,0xaa,0xe0,0x2,0x13,0x33,0x73,0xb4,0xf8,0x2b,0xbe,0xe2,0xc7, 0xca,0x12,0x28,0x88,0x8,0x5,0xb2,0x6c,0xcb,0x50,0xe6,0x2e,0xcf,0x5d,0x9e,0xd9, 0x6c,0x65,0x61,0x45,0x44,0x1a,0x49,0x3,0x5,0x55,0xa6,0x34,0x6a,0x52,0x94,0xa6, 0xa9,0x13,0x97,0xf9,0x6c,0x95,0x57,0x11,0xd1,0xb1,0xcb,0x5c,0xb6,0x36,0xb3,0x76, 0x85,0x63,0x4b,0x76,0xe8,0x86,0x4b,0xe9,0x12,0xa5,0x54,0xea,0xb2,0x97,0xf7,0xbc, 0xf7,0x95,0xa9,0x8e,0x8f,0x8e,0xf,0x5e,0x1c,0xde,0xdd,0xbe,0xd5,0x4a,0x1a,0xcd, 0xb4,0xd9,0x9e,0x6b,0x1f,0x9b,0x41,0x83,0xd5,0xd3,0xde,0xc1,0xdd,0x95,0x8d,0x27, 0x9d,0x3d,0x10,0x48,0xd3,0xf4,0x59,0x77,0x3f,0x51,0x3b,0xdf,0x76,0xf6,0x0,0xa0, 0x91,0x34,0x9e,0x75,0xf,0x13,0x95,0xbe,0xf3,0x14,0x1b,0x49,0xfa,0xb4,0xb3,0x7f, 0x6f,0x75,0xeb,0xc9,0xc9,0x9e,0x84,0x70,0x67,0xe1,0xc6,0xee,0xf1,0xfe,0x5a,0x63, 0xe1,0xc9,0xb7,0xdf,0x86,0xe3,0x93,0x9b,0x1b,0x1b,0x69,0x23,0x55,0x8d,0x99,0x25, 0x37,0x93,0xa6,0x1b,0x6a,0x50,0x28,0x63,0x82,0xf7,0x42,0x84,0x20,0x22,0x20,0x20, 0x8,0xa0,0x10,0x58,0x80,0x5,0x82,0x0,0x9,0x0,0x40,0x82,0x90,0x20,0x28,0x84, 0xf8,0xd3,0x68,0xd2,0x34,0x7a,0x40,0xb4,0x48,0x44,0x48,0x71,0xf2,0x53,0x0,0x48, 0x14,0x20,0x82,0x8,0x30,0x3,0xb,0x33,0x11,0x7b,0x1f,0x9c,0xf6,0x65,0xe1,0x8a, 0x81,0xcd,0xfa,0xb9,0xeb,0xe5,0xc3,0xc1,0xdd,0x5b,0x37,0x13,0x90,0x34,0x51,0xcf, 0xf,0x7a,0xe9,0x8b,0x13,0x12,0xe5,0x49,0x2,0x9,0x53,0x5c,0x84,0xf2,0x3e,0x8d, 0x9d,0x99,0x85,0x29,0x4,0x6f,0xbd,0xd1,0xba,0xca,0xf3,0x6c,0x98,0xd,0xfb,0xba, 0xc8,0xd3,0xe1,0xc9,0x30,0x69,0x24,0x2a,0x51,0x4b,0xd7,0x97,0x16,0xae,0x2d,0xe4, 0xc7,0x79,0x5,0x15,0x30,0x48,0x10,0xf2,0xc4,0xcc,0xf1,0x3,0xbb,0x72,0x73,0x17, 0x11,0x26,0xf6,0xc1,0x5b,0x67,0x4b,0x5d,0xe6,0x65,0x3e,0x28,0x7,0xbd,0xaa,0x57, 0xda,0x72,0x68,0x87,0x95,0xab,0x84,0x24,0x4d,0xd2,0x76,0xbb,0x3d,0x37,0x37,0x27, 0xd,0x81,0x4,0x94,0x52,0x24,0xa4,0x49,0x7b,0xf6,0x0,0x10,0x38,0x18,0x32,0x81, 0xc3,0x15,0x8c,0x83,0x9,0x1c,0x44,0xc4,0xb3,0xaf,0x5c,0x65,0x1b,0xd6,0xa2,0xcd, 0xcb,0xbc,0xdf,0xef,0x5b,0x63,0xd3,0x32,0xed,0x1c,0x75,0xb2,0xe3,0xe1,0x51,0xbf, 0x73,0xad,0xbd,0xa8,0x12,0xf5,0xf1,0xc6,0x9d,0x7b,0x1b,0xb7,0xe,0x4e,0x8e,0x17, 0xe7,0xe7,0x3d,0xd3,0xe2,0xcc,0x9c,0x88,0x78,0xa,0x73,0xad,0xb6,0x27,0xbf,0x30, 0x33,0x7,0x0,0x9e,0xfc,0x5c,0x6b,0xe6,0xdd,0xa7,0x22,0xe2,0x42,0x98,0x6b,0xcc, 0x5a,0xe7,0xe6,0x92,0x26,0x91,0x2a,0x8b,0x42,0x59,0x2e,0x8a,0x6c,0x46,0x43,0x99, 0xb4,0xf,0x8e,0x8e,0x17,0x57,0x56,0x1b,0x89,0xba,0x79,0x6d,0xf1,0x45,0x89,0xbd, 0xd0,0x24,0x28,0x45,0x59,0x9,0x1e,0x84,0x59,0x84,0x5,0x10,0x81,0x1,0x0,0x80, 0xa3,0xa5,0x9,0x88,0x80,0x7,0xe0,0x68,0xf1,0xaa,0xfe,0x69,0x7c,0x80,0x8c,0x9c, 0x7a,0xb4,0x78,0x42,0x0,0x55,0x9b,0xbb,0x2,0x40,0x5,0x4a,0x81,0xb0,0x30,0xb, 0x13,0x93,0x78,0xf,0x64,0x3c,0x6b,0xad,0xcb,0x2c,0x2b,0x7,0xbd,0x32,0xeb,0x3, 0xc0,0xc1,0x71,0x7f,0x69,0xae,0x99,0x24,0xc9,0xcd,0xeb,0x2b,0xcb,0x8b,0x8b,0x2f, 0x8e,0x6,0x3a,0x88,0x33,0x3e,0x7a,0x50,0x1c,0xf9,0xf7,0x2b,0x77,0xf3,0x28,0xc2, 0xc2,0xc2,0x44,0xde,0x5,0xab,0x6d,0x95,0x97,0xf9,0xa0,0x18,0xf6,0x74,0x31,0x60, 0x67,0xd3,0xe7,0x9f,0x3f,0x2f,0x7b,0xe5,0xf2,0xda,0x72,0x73,0xa6,0xb9,0xb6,0xbd, 0x96,0xef,0xe7,0xf9,0x51,0x2e,0x5a,0x82,0x9,0xc1,0x7,0xa,0x24,0x2c,0x22,0x2, 0x78,0xc5,0x6b,0x90,0x85,0x89,0xc8,0x7a,0x5b,0xd9,0x2a,0xd3,0x59,0xaf,0xea,0x75, 0xab,0xee,0xc0,0xe,0x8c,0x37,0x5,0x17,0x87,0xdd,0xc3,0x9e,0xee,0x6d,0x5f,0xdb, 0xbe,0xd6,0xbe,0xb6,0xbe,0xbc,0x7e,0x63,0xf9,0x46,0x9b,0xda,0x8d,0xb4,0x91,0x24, 0x9,0x22,0x22,0xa2,0x5c,0xed,0xe7,0x14,0xdd,0x20,0x0,0x33,0x33,0xb1,0xf7,0xbe, 0xa,0x55,0x31,0x2c,0xb2,0x5e,0x56,0xe5,0x15,0x14,0xd0,0xef,0xf4,0x6d,0x61,0x7f, 0xf9,0xc5,0xff,0x43,0x84,0x3b,0x37,0x76,0x92,0x54,0xdd,0x5a,0xdf,0x1c,0x94,0xd9, 0xe3,0xee,0xde,0x9d,0xa5,0x9b,0x5f,0xee,0x7e,0xd,0x2c,0xb0,0xf3,0xe0,0xab,0xbd, 0xc7,0x9f,0x6e,0x7d,0xfc,0xd5,0x8b,0xaf,0x1,0x0,0x6e,0x5d,0xd1,0x54,0x4,0x76, 0x1e,0x7c,0xfd,0xf2,0xd1,0xfd,0xf5,0xdb,0x8f,0x5f,0x3c,0x4,0xcb,0x5b,0x73,0xeb, 0x7,0x7b,0xbb,0x8b,0xc9,0x5c,0x31,0xec,0x83,0x75,0xff,0xf8,0xf9,0xbf,0x2c,0xdc, 0xfb,0xc9,0xd6,0xea,0x52,0xbb,0x95,0xde,0x5b,0x9b,0x2b,0x2d,0x13,0xb1,0x11,0xa, 0xc2,0x42,0x22,0x22,0x2,0xa2,0x4,0x23,0x20,0xc1,0xd1,0x97,0x8c,0xfe,0x3d,0x83, 0x56,0x11,0x0,0xa4,0x46,0x2f,0xf1,0xa7,0x88,0x0,0xe3,0xfb,0x1f,0x3f,0x28,0x6, 0x11,0x61,0x61,0xa6,0x10,0xbc,0xb3,0xba,0xaa,0xb2,0x41,0xde,0x3d,0xc9,0x3b,0x7, 0xe5,0xa0,0x63,0xca,0xc,0x0,0xfe,0xef,0xe7,0x8f,0x16,0x66,0x9b,0x1b,0xeb,0x2b, 0x73,0xb3,0x33,0x9f,0xde,0xdb,0xdc,0xef,0xe,0xbb,0x83,0xca,0x4,0xf1,0xde,0x33, 0x33,0x0,0xc7,0xf,0x1c,0xaf,0xd6,0xbb,0x4b,0x8d,0x63,0x88,0x2,0x59,0xed,0x4c, 0x61,0x8a,0x41,0x95,0xf5,0x6c,0xde,0xb,0xb6,0x14,0xe6,0x74,0xef,0xab,0xbd,0xb2, 0x53,0xf6,0xaf,0xf5,0xd7,0x76,0xd6,0x96,0x36,0x96,0xee,0xfc,0xfc,0x8e,0xc9,0x4d, 0xd5,0xaf,0xd8,0x70,0x30,0x21,0x50,0x10,0xba,0x7a,0xf7,0xce,0xc2,0xcc,0xec,0xc9, 0x6b,0xaf,0xb,0x5b,0xf4,0x75,0xbf,0xa7,0x7b,0x7d,0xd3,0x2f,0x7c,0xe1,0xd8,0x19, 0x30,0x9d,0x41,0xe7,0x61,0xff,0x21,0x31,0xcd,0xa5,0x73,0x2b,0xed,0x95,0x9f,0x6e, 0xfd,0xb4,0xc8,0x8a,0x59,0x9a,0x4d,0xd3,0x54,0xa9,0x7a,0x6b,0x8d,0x9f,0x97,0x88, 0xd4,0x5b,0xd0,0xbb,0x8d,0xa3,0xad,0xb,0x9,0x5,0xb2,0xda,0xe,0xfd,0x70,0xd0, 0x1b,0xc,0x3b,0x43,0x19,0x8,0x97,0x9c,0x67,0x79,0xf0,0xe1,0x57,0x4f,0xbe,0xdc, 0x1d,0x1c,0x6f,0x5d,0xbf,0x79,0x6b,0x7d,0xf3,0xdf,0x7f,0xf4,0xe3,0x7b,0x6b,0x5b, 0x7,0x83,0x8e,0xab,0xc,0x34,0x9b,0xe0,0x82,0x52,0x6a,0x1a,0xe5,0xe2,0xd4,0xbf, 0xef,0x36,0x45,0x10,0x1,0x11,0xf2,0x4,0x8e,0xc1,0x92,0x67,0xd,0x3a,0x10,0x1a, 0xf0,0x2,0xc,0x5f,0x7c,0xfd,0x30,0xf0,0xf6,0x8d,0xa1,0xfa,0xf4,0xe6,0xdc,0xdd, 0xe5,0xe6,0x42,0x63,0xe1,0x57,0x9,0xbd,0x38,0xa1,0x82,0x59,0x13,0x3b,0x66,0x14, 0x48,0x12,0x6e,0x2a,0x10,0x0,0xc7,0x10,0xd1,0x44,0x34,0xe5,0x44,0x40,0x0,0xe8, 0xb4,0x97,0xc5,0x11,0xdc,0x97,0xda,0x31,0x1,0xc1,0x4,0xe5,0x2b,0x44,0x10,0x21, 0x66,0x22,0xa,0xce,0x3b,0xad,0xab,0x6c,0x98,0xf7,0x4e,0x86,0x27,0x7,0xd9,0xc9, 0x81,0xc9,0xfb,0xde,0x19,0x0,0xf8,0xfc,0x9b,0x17,0x44,0x7c,0x6d,0x69,0xf1,0xb3, 0x8f,0xb6,0x3e,0xda,0x5e,0x43,0xfc,0xd4,0x7b,0xfe,0xf2,0x89,0xd5,0xc6,0xfb,0x31, 0x6a,0xb8,0xfa,0xa8,0x90,0x99,0x45,0xc8,0x93,0xb7,0xc1,0x94,0xae,0x1a,0xda,0xa2, 0xeb,0x8a,0xbe,0xd7,0x39,0x7,0x7,0x0,0xe9,0xe0,0x78,0x10,0x6c,0xc8,0x8f,0xf3, 0xec,0x20,0xbb,0xfb,0xf3,0xbb,0x5b,0x3f,0xdd,0x9a,0x59,0x9e,0x91,0x3f,0x13,0xf7, 0x4f,0xce,0x55,0x8e,0x1d,0x13,0xd1,0x15,0xe2,0x99,0xf8,0x44,0xcc,0xec,0xd9,0x5b, 0x6f,0x4b,0x5f,0xe,0xec,0xa0,0x6f,0xfa,0x7d,0xd3,0xcf,0x7c,0x66,0xc8,0x30,0xb0, 0x7,0x5f,0x56,0x65,0x67,0xd0,0x59,0x6e,0x2c,0xe7,0xed,0x1c,0x67,0xf0,0xde,0xca, 0x3d,0x33,0x67,0xf2,0x7e,0xde,0x9e,0x6d,0xb7,0xd2,0x96,0x52,0xea,0x34,0x58,0xbb, 0x82,0xb1,0xb0,0x30,0xb3,0xf7,0xde,0x59,0x57,0xe8,0xc2,0xe5,0xae,0x73,0xd4,0xc9, 0x4e,0x32,0xca,0x88,0xd,0x1b,0x6d,0x24,0x88,0xb5,0xae,0xc9,0x78,0x70,0x72,0x3c, 0x28,0xb3,0x7b,0x6b,0x5b,0xff,0xe9,0x87,0xff,0xe1,0xfe,0x8d,0x5b,0x7f,0xf1,0x77, 0xbf,0x9c,0x49,0x5b,0xbd,0x61,0x7f,0xa1,0x39,0xdb,0x50,0xe9,0xb5,0xf6,0x42,0x72, 0xe7,0x87,0x31,0xdc,0x6c,0xdc,0x4a,0x57,0xda,0x4b,0xef,0x30,0x5d,0x54,0xb7,0x3e, 0x63,0xe6,0x95,0x99,0x85,0x1f,0x5c,0xbf,0xdb,0x86,0x74,0x7b,0x71,0xc3,0x49,0xa5, 0x4a,0x3f,0xf,0x2d,0x70,0xdc,0x50,0xd,0x4a,0xf1,0xa4,0xd3,0x75,0xeb,0x79,0x5, 0xcd,0xc0,0xbc,0xd8,0x58,0xf8,0x64,0xad,0xb5,0xd0,0x58,0xfe,0x5b,0xa4,0x27,0x1c, 0x88,0xc8,0x13,0x21,0x88,0x2,0x50,0x0,0x12,0xd1,0x8,0x80,0x20,0xa8,0x11,0x34, 0x4f,0x70,0xe4,0xc2,0x5f,0xdd,0xf3,0xf0,0xb4,0xd7,0x8f,0xbf,0xcb,0xc,0x22,0x4c, 0x1c,0xbc,0xf3,0x56,0x9b,0x62,0x58,0xe,0x4e,0xb2,0x93,0x83,0x61,0xe7,0xa0,0xec, 0x9f,0x38,0x5d,0x8,0x11,0x0,0x1c,0x75,0x86,0xda,0x9a,0x17,0x47,0x83,0x83,0x5e, 0xa6,0xd4,0xa7,0xff,0xf1,0x27,0xf7,0x36,0x57,0x17,0xfe,0xf4,0xaf,0xd2,0x5f,0x7d, 0xf5,0xb4,0x9f,0xe5,0xce,0x3a,0x8a,0x16,0x8f,0x57,0xe8,0xda,0x85,0x99,0x99,0x2, 0x79,0x1b,0x6c,0xe5,0x75,0xe6,0xca,0x81,0x2b,0x87,0xde,0xe4,0xe4,0xc,0x8,0x1, 0xaa,0x54,0x67,0x1a,0x4,0x34,0xe8,0xe2,0xa8,0xb0,0xb9,0x9d,0x59,0x9e,0xd9,0xf8, 0x74,0x43,0x58,0xac,0xb1,0xee,0x73,0xe7,0xbd,0x97,0x20,0xc4,0x74,0x65,0xe6,0x2e, 0xc2,0xcc,0x81,0x83,0x75,0xb6,0xf2,0x55,0xee,0xf3,0x81,0x1b,0xc,0xec,0x20,0xf, 0xb9,0x21,0xe3,0xc5,0x8b,0x8,0x3,0x3b,0xe7,0x2a,0x53,0xe5,0x45,0x9e,0x65,0x59, 0x3f,0xeb,0x6f,0xac,0x6d,0x6c,0x2f,0x6f,0x37,0xb0,0xb1,0x3a,0x58,0x9d,0x9f,0x99, 0x57,0xa8,0xe2,0xa,0x44,0x41,0x61,0x9,0x21,0x30,0x31,0xa,0x32,0xf1,0xe5,0xc6, 0xc0,0x40,0x44,0xd6,0x5a,0x6b,0xac,0x2e,0xf4,0x40,0xf,0xa4,0x2f,0xdd,0xe3,0x6e, 0xd1,0x2f,0xa8,0x24,0x8,0xe0,0x9d,0x67,0xe6,0xc3,0xfe,0xf1,0xe3,0xa3,0x97,0x8d, 0x66,0xe3,0x71,0x77,0xef,0x60,0xd0,0xb9,0x7f,0xe3,0xd6,0x27,0x9b,0x77,0xe0,0xe7, 0xf0,0xcf,0x2f,0xbf,0x79,0x78,0xf0,0x34,0x45,0xf5,0xed,0xc9,0xee,0x27,0xd7,0x77, 0x1e,0x1e,0x3e,0x7,0x80,0xe6,0x46,0xfa,0xe4,0xe8,0x65,0x7a,0x23,0xb9,0xf4,0x34, 0xb9,0x71,0xfb,0x9b,0x83,0xa7,0x21,0xd0,0x83,0xb5,0x9d,0x6f,0x76,0xbf,0xdd,0x6e, 0xad,0xec,0xee,0x3e,0x87,0x32,0xcc,0x73,0xab,0xc8,0xf2,0xa6,0x4a,0xbd,0xb3,0xc0, 0x64,0x8d,0x9,0xd6,0x54,0x55,0x79,0x8c,0xfc,0xcf,0x29,0x5d,0x6b,0x2d,0xdf,0x59, 0x99,0x6d,0xe0,0xa,0x5,0x6f,0xac,0xb3,0xde,0x73,0x10,0x66,0xe6,0x18,0xb0,0x8a, 0xa4,0x0,0xc4,0x0,0x31,0x42,0x85,0x11,0x50,0x91,0xfa,0x3b,0x72,0xda,0x1d,0x8, 0x4c,0xa1,0x1a,0xa8,0x1,0x3d,0xc7,0xf,0xce,0x68,0x5b,0xc,0xf5,0xb0,0xab,0x7b, 0x47,0x65,0xef,0x48,0xf,0x3a,0xae,0x1c,0x6,0x67,0xe3,0xaf,0x68,0x6b,0xaa,0xca, 0xd8,0xa0,0x7,0x79,0x15,0x2,0x6f,0xae,0x2e,0xfc,0xe4,0xfe,0xb6,0x42,0x44,0xe0, 0xcf,0xbf,0x7e,0xd6,0xcf,0x72,0xe7,0x60,0x7a,0x6b,0x7d,0x67,0xb3,0x2,0x16,0x1, 0x21,0xa,0x8e,0x9c,0xe,0xa6,0xf0,0x3a,0xf7,0x3a,0xb,0xa6,0x60,0x67,0x84,0x9c, 0x0,0x28,0x5,0xa9,0xb7,0x1e,0x53,0x44,0x42,0xb1,0x52,0xf5,0x2b,0x16,0xfe,0xd9, 0x7f,0xfe,0xd9,0x8d,0x8f,0x6f,0xfc,0xe8,0xf,0x7f,0x94,0xf5,0x32,0x5d,0x69,0xeb, 0x2c,0x11,0xb1,0xf0,0x59,0x4a,0xeb,0xb2,0x30,0x86,0x88,0x7c,0xf0,0xda,0xeb,0xc2, 0x17,0x99,0xcf,0x32,0x9f,0x15,0xa1,0x30,0x64,0x3c,0x7b,0x12,0x2,0x0,0x6,0xe, 0x21,0x4,0x1f,0xac,0xb5,0x45,0x51,0x1c,0xb9,0xa3,0xbd,0x62,0xaf,0x75,0xaf,0xb5, 0xbe,0xb4,0x7e,0xfb,0xe6,0xed,0x27,0xdd,0x27,0x89,0x49,0xbc,0xf7,0xde,0xf9,0xe0, 0x83,0x77,0xde,0x7b,0x1f,0x7c,0x8,0x2e,0x4,0x1f,0x2e,0x31,0xf6,0xce,0x7b,0xeb, 0x4d,0x62,0x4a,0x2e,0x8b,0xac,0x28,0xfb,0xa5,0x2f,0xbc,0xeb,0xb8,0x41,0x7f,0x60, 0xa,0xc3,0x96,0x95,0xa8,0xb8,0xc5,0xcd,0xb7,0xda,0xb7,0x97,0x6f,0x14,0xce,0xdc, 0x59,0xba,0xe9,0x2a,0xf3,0x17,0x7f,0xf7,0x4b,0xf8,0x39,0xdc,0xbb,0xb9,0xf3,0x27, 0x7f,0xf0,0xc7,0xb3,0xd8,0xec,0xf6,0x7a,0xe1,0x86,0x9f,0x6f,0xce,0x3e,0xb8,0x7e, 0x1b,0x40,0x96,0x5a,0xed,0xfb,0x6b,0x3b,0x4b,0xad,0xb9,0x7,0xd7,0x6f,0x1,0xc0, 0x52,0x6b,0xee,0xe2,0xd3,0xc5,0xd6,0xdc,0xc7,0x6b,0x3b,0x8b,0xcd,0xf6,0x27,0xab, 0x3b,0xc1,0xfb,0x59,0x69,0xec,0xcc,0xae,0x36,0xac,0x2c,0xab,0x79,0xf,0x1a,0x5c, 0x68,0x40,0x82,0xc,0x9,0x26,0x94,0x28,0x4f,0x41,0x82,0xf,0xd6,0x96,0x40,0xfb, 0x1d,0xfa,0xc7,0x84,0x12,0x5c,0xb9,0xb9,0x3c,0xf7,0x93,0x9d,0xd5,0x93,0xa1,0xce, 0x2b,0x1d,0xc8,0x7b,0x26,0x46,0x49,0x10,0x58,0x20,0x30,0xc8,0x8,0xbd,0x4c,0x58, 0x48,0x81,0xf1,0x96,0xc9,0x3c,0xc2,0xee,0x53,0x6b,0x40,0x60,0xc,0xf3,0x99,0x88, 0x9c,0xb5,0xa6,0xcc,0xcb,0x61,0xb7,0xec,0x1d,0x65,0xdd,0xa3,0x72,0xd8,0x35,0x45, 0xe6,0xac,0xe6,0x40,0xa8,0x10,0x0,0x42,0x8,0x21,0x78,0xeb,0xc8,0x5,0xf3,0xe5, 0x93,0x17,0x7f,0xfa,0x57,0xa9,0x42,0xbc,0x7f,0xfb,0xe6,0x1f,0xfd,0xde,0x8f,0x7, 0x59,0x6e,0xb4,0x9,0xce,0x11,0x93,0x8,0xbf,0xab,0x59,0xc9,0x88,0x11,0x25,0xa, 0xde,0x7,0xab,0x83,0x29,0x83,0xce,0x43,0x95,0x91,0x29,0xd8,0x1b,0xa6,0x20,0xc2, 0x20,0x20,0x88,0x29,0x5,0x22,0x47,0x42,0x12,0x74,0x30,0xce,0x3c,0xfb,0xfc,0x99, 0xb3,0xee,0x47,0x7f,0xf8,0xa3,0x7,0xbf,0xff,0xc0,0x39,0x67,0x7f,0x61,0xed,0x23, 0x6b,0x83,0x25,0x7e,0x57,0x48,0x23,0x20,0xb5,0x6b,0xa7,0x60,0x83,0xad,0x42,0x55, 0x84,0xa2,0xf0,0x45,0x15,0x2a,0xcb,0xd6,0xb3,0x67,0x60,0x46,0x46,0xc1,0xc9,0x23, 0x7d,0x70,0xce,0xe5,0x65,0x7e,0xd8,0x3f,0x5c,0x4b,0xd7,0x5a,0xb7,0x5a,0x77,0x6e, 0xdc,0xf9,0xb9,0xf9,0xf9,0xb3,0xa7,0xcf,0xc4,0x4a,0x8,0x21,0xb8,0xe0,0xac,0xd3, 0x5a,0x5b,0x6b,0xbd,0xf3,0xd6,0xda,0xcb,0x8c,0x8d,0xb5,0xda,0x56,0x52,0xd,0xf4, 0x20,0x1b,0x64,0xc5,0xa0,0xc0,0x21,0xba,0xbe,0xab,0x8a,0xca,0x3b,0x2f,0x41,0x12, 0x48,0xe2,0x7b,0xef,0xe6,0x83,0x87,0x7,0xcf,0x1a,0x49,0xfa,0xe5,0xee,0xd7,0xd0, 0x6c,0xce,0xa4,0xad,0x7f,0x7e,0xf9,0xcd,0x9f,0xfc,0xc1,0x1f,0xff,0xfe,0x8f,0xfe, 0xdd,0xc9,0xb0,0xf7,0x97,0x7f,0xf3,0xcb,0xbf,0x7e,0x78,0xb8,0x31,0xbf,0xf2,0xc5, 0xcb,0x47,0xc2,0xf2,0xd9,0xe6,0xbd,0x87,0x87,0xcf,0x3e,0xb9,0x79,0xe7,0xcb,0xfd, 0x27,0x0,0xf0,0xd9,0xe6,0x47,0xf,0xf,0x9f,0x7f,0x72,0xf3,0xf6,0x77,0x4e,0x5, 0xe0,0x87,0x9b,0xf7,0xbe,0x39,0x78,0xfe,0xf1,0xfa,0xf6,0x57,0x2f,0x1f,0x81,0xa3, 0x5b,0x4b,0x9b,0x2f,0xf7,0x5e,0x5c,0x4b,0xe6,0x6,0xdd,0xe,0x58,0x6a,0x4a,0xc3, 0x7b,0x97,0xaa,0x94,0x28,0x0,0x33,0x30,0x2b,0x60,0x21,0x1f,0x1c,0xe7,0x5,0x3f, 0xe4,0x50,0x1a,0xff,0xe3,0x9d,0xd5,0x9f,0xde,0xba,0x46,0xc1,0xff,0x95,0xd5,0xcf, 0x4d,0x65,0x9c,0x63,0x62,0x44,0x69,0xa0,0x28,0x5,0x2,0x20,0x5c,0xd3,0x91,0xd1, 0xd4,0x14,0xd6,0x44,0x7b,0x24,0x2b,0x23,0x92,0x51,0x53,0x21,0x60,0xb4,0x78,0x8e, 0x84,0xb6,0xf3,0x4e,0x97,0xba,0x18,0xea,0x41,0xa7,0x1a,0x74,0x4c,0xd6,0x77,0x65, 0x1e,0x9c,0xe1,0x10,0x84,0x19,0x20,0x1,0xa8,0xc1,0x21,0x13,0x5,0x1f,0x2a,0xe3, 0x7e,0xf5,0xd5,0x53,0x4,0xfe,0xa3,0xdf,0xfb,0xf1,0xef,0xff,0xee,0x3,0x67,0xdd, 0x2f,0xac,0x7d,0xf4,0xd4,0x86,0x60,0x99,0xea,0x68,0xfa,0xdd,0x5c,0xbb,0xc4,0x3f, 0x15,0xac,0xd,0xae,0xa,0xa6,0xf0,0xa6,0x8,0xb6,0x24,0x6f,0x99,0x82,0x44,0xd3, 0x5,0x40,0x81,0x54,0x22,0x9d,0x14,0x28,0xf8,0x40,0x86,0x6c,0x65,0xdd,0x3f,0xb9, 0xac,0x97,0x39,0xe7,0xee,0xfc,0xce,0x9d,0xfe,0x51,0x5f,0x3b,0xed,0x9f,0x79,0x5d, 0x6a,0xe,0x3c,0x4a,0x41,0x5c,0x82,0xf9,0x40,0x11,0x89,0x7f,0xc7,0x79,0x67,0x82, 0x29,0x43,0x59,0x86,0xb2,0xa2,0xca,0xb2,0xd,0x1c,0x18,0x98,0x85,0x27,0xcb,0x5c, 0xea,0xd8,0x3f,0x84,0xe0,0x9d,0xcf,0x8b,0xfc,0xa8,0x77,0xb4,0xab,0x76,0x73,0x93, 0xdf,0xb9,0x7e,0x7,0xc,0xf4,0xe,0x7a,0xa,0x14,0x10,0x78,0xe7,0x9d,0x73,0xde, 0xfa,0xe0,0x82,0xb7,0xde,0x35,0xdf,0x6e,0x6c,0x1b,0x36,0x9a,0x7b,0x19,0xca,0xa6, 0x34,0x87,0xfd,0x61,0x39,0x28,0x21,0x7,0x57,0x38,0x67,0x1d,0x7,0x6,0x6,0xc1, 0xfa,0x86,0xf0,0x28,0xc0,0x5,0x16,0x70,0xa1,0x37,0xec,0x3f,0x3c,0x78,0x3a,0x8b, 0xcd,0x93,0x61,0xef,0xf7,0x3e,0xfd,0x5d,0xab,0xcd,0xd3,0xa3,0x97,0x62,0xc2,0x4c, 0xd2,0xf0,0x12,0x14,0x43,0x2,0xa,0x59,0x12,0x50,0x0,0x80,0x2c,0x9,0xe0,0x5, 0xa7,0x40,0x2,0xcc,0xc1,0x7a,0xb0,0x1,0x3c,0x5,0x6d,0xc1,0x32,0xa1,0x8f,0x94, 0xb8,0x80,0xc4,0xcf,0x67,0x82,0x37,0x98,0x41,0x98,0x82,0x18,0x64,0x61,0x32,0xd6, 0xf5,0xb,0xcd,0xe4,0xef,0xdd,0x58,0xfa,0xe9,0xed,0x35,0x5d,0x55,0x7,0x4e,0x6b, 0xe7,0x81,0x9,0x15,0x24,0x58,0xff,0x85,0xf1,0xbd,0x44,0x0,0x6,0x50,0x38,0x21, 0x22,0xe3,0x37,0x9,0x0,0x47,0x8c,0xbb,0x88,0xb0,0x0,0x31,0x7b,0xef,0xbc,0x35, 0xb6,0x2c,0xaa,0xbc,0x5f,0xe,0x7b,0x55,0x36,0x30,0x55,0xe1,0x9d,0xe1,0x98,0x42, 0x12,0x89,0x9c,0xa7,0xd4,0x9c,0x10,0x13,0x51,0xf0,0xdc,0xcf,0xf2,0xcf,0xbf,0x7e, 0x36,0xc8,0x72,0x67,0xdd,0xef,0x3c,0xb8,0x73,0xd4,0xed,0x3b,0xab,0x9f,0xed,0xfa, 0xb2,0xd2,0x81,0x78,0xbc,0x7f,0xbc,0xbd,0xa9,0xe3,0xe8,0x6f,0x4,0xef,0x5d,0x88, 0x96,0x65,0x4a,0xb2,0x15,0x7,0x2b,0xe4,0x85,0x9,0x44,0x50,0x44,0x10,0x1,0x20, 0x8d,0x51,0x9a,0x90,0xd4,0x40,0xd6,0xb3,0xf7,0x5e,0x6b,0x6d,0x7f,0x61,0xfb,0x47, 0x7d,0x4c,0x70,0x6e,0x65,0x2e,0x39,0x4a,0x44,0x4b,0x80,0x70,0xe9,0x65,0x38,0x5a, 0x7f,0xe4,0xbc,0xb3,0xc1,0x1a,0x32,0xf1,0xcb,0xb1,0xb,0x1c,0x8,0x28,0x46,0x2d, 0xe3,0xe7,0x1f,0xdf,0xc9,0x18,0x7b,0x38,0xef,0xaa,0xaa,0x1a,0xc,0x6,0x4f,0xbb, 0x4f,0x97,0x56,0x96,0x96,0x9a,0x4b,0x49,0x92,0xa0,0xa0,0x4,0xf1,0xce,0x1b,0x63, 0x9c,0x75,0xe4,0xc8,0x59,0x67,0x1a,0x6f,0x37,0xd6,0x89,0xd6,0x5a,0x9b,0xca,0x94, 0xaa,0x4c,0x38,0x29,0xf3,0xd2,0x94,0x6,0x2a,0x8,0x2e,0x84,0x10,0x58,0xea,0xdd, 0x26,0xbe,0xaa,0x95,0xb9,0xa5,0xfb,0xeb,0xb7,0xa,0x5b,0xc1,0xce,0x3,0xa5,0xd4, 0x42,0x73,0x36,0x45,0xd5,0xed,0xf5,0xfe,0xf2,0x6f,0x7e,0x69,0xb5,0x59,0x68,0xb5, 0x7f,0x76,0xeb,0xc1,0xde,0xe1,0xfe,0x67,0xeb,0x77,0x5d,0x70,0xb,0xcd,0xf6,0xfd, 0xd5,0xed,0x85,0x46,0xfb,0x7,0x6b,0xb7,0x0,0x60,0xb1,0x71,0xf1,0xa9,0x2c,0xa6, 0xb3,0x1f,0x2d,0x6f,0xce,0xaa,0xe6,0xce,0xf2,0x26,0x5b,0xdf,0x22,0xb5,0x3a,0xb3, 0x88,0x96,0xda,0x8d,0x59,0x62,0xf,0x81,0x53,0x95,0x22,0x2,0x24,0x9,0x81,0x12, 0x11,0x62,0x54,0x2c,0x8c,0xe2,0x2,0x7b,0xa2,0xd2,0xfa,0x7e,0xa1,0x8b,0x4a,0xff, 0xec,0xce,0x9a,0x2,0x5e,0x68,0x25,0x27,0xc0,0x12,0x5c,0x4,0xa5,0x89,0x1a,0x11, 0xf0,0xaf,0xc3,0x6,0x58,0xaf,0x84,0xc8,0xb2,0x27,0xf5,0x4a,0x10,0x22,0x71,0x3e, 0x38,0xe7,0x9c,0xa9,0x6c,0x99,0xdb,0x7c,0x68,0xcb,0xdc,0xea,0xd2,0x3b,0x47,0x44, 0xd1,0xd6,0x4f,0x93,0x2d,0x22,0x2c,0x2,0xc2,0x4c,0xce,0x4a,0x3f,0xcb,0x8d,0x36, 0xbf,0xb0,0xf6,0xa8,0xdb,0x4f,0x14,0xae,0x2c,0xce,0x1d,0x35,0x13,0x5d,0x9,0x70, 0x10,0xbe,0x24,0x70,0x10,0x90,0x3a,0x3a,0xd,0x2e,0x38,0x4b,0xce,0x90,0x33,0xe4, 0xd,0x7,0x27,0x14,0xa2,0xad,0x4f,0xd1,0xa8,0x90,0x4e,0x60,0x46,0xbd,0xf9,0x90, 0x4,0xb1,0xce,0xda,0x47,0x56,0x3b,0x3d,0xb7,0x32,0xd7,0x3d,0xec,0x56,0x65,0x55, 0xd9,0x2a,0xf8,0xf0,0x2e,0xb1,0x45,0x4d,0x69,0x93,0xb7,0x6c,0xe3,0x97,0x17,0x1f, 0xa4,0xb6,0xf5,0xe8,0x6b,0x70,0x1a,0xc2,0xc9,0xe8,0x95,0xc5,0x6d,0x21,0x4,0xad, 0xf5,0x51,0x7e,0xf4,0xb8,0xf3,0xf8,0xce,0xd2,0x9d,0xa6,0x6d,0x96,0x65,0x59,0xe9, 0x4a,0x93,0xae,0xa0,0xaa,0x2f,0xac,0x4a,0x2c,0xdf,0x6e,0x2c,0xa5,0xae,0xb4,0xad, 0xac,0x56,0x5a,0x5,0xa5,0x2b,0xed,0xad,0x7,0xf,0xc1,0x7,0x79,0x65,0x97,0x1d, 0xe8,0xfc,0xe9,0xc9,0x9e,0x52,0xea,0xab,0xbd,0xc7,0x0,0xd8,0x50,0xe9,0xb7,0x27, 0xbb,0xe1,0x86,0xff,0xeb,0x87,0x87,0x4f,0x8f,0x5e,0xfe,0xec,0xd6,0x83,0x7f,0x78, 0xfc,0xaf,0x62,0xc3,0x57,0xbb,0x4f,0x9c,0xf7,0x77,0xd7,0x36,0x9f,0x75,0xf6,0x6f, 0xaf,0x6e,0x3c,0x39,0xd9,0x5,0x80,0x8f,0xae,0x6f,0x3f,0xef,0x1e,0x5c,0x70,0x7a, 0x77,0x75,0xf3,0xdb,0xe3,0xdd,0xed,0x85,0xeb,0x2f,0xf,0x5f,0x42,0xe0,0xf5,0xd6, 0x72,0x77,0xd8,0x9f,0x87,0x46,0xa5,0x2b,0x8,0xd2,0x0,0x15,0x28,0x24,0x49,0x42, 0x4c,0x20,0x23,0x57,0xa,0xc0,0x20,0x40,0x20,0x31,0xd1,0x42,0x7e,0xdf,0x56,0x64, 0xaa,0x85,0x56,0xd2,0x1b,0xc,0xab,0xaa,0xd2,0x55,0x45,0x14,0x14,0x48,0x32,0xc6, 0xe1,0x78,0x5e,0x4e,0x32,0x26,0xbc,0x47,0xcc,0xbc,0x82,0x3a,0xf3,0xca,0x2,0x81, 0xd8,0x5,0xf2,0xce,0x7a,0x5d,0x59,0x5d,0x58,0x5d,0x7a,0xab,0x83,0x77,0x4c,0x5e, 0x98,0xc7,0xcf,0x7a,0x3a,0x79,0x5e,0xbf,0x3a,0x62,0x72,0xe,0x82,0x73,0x8f,0x9e, 0x5a,0x67,0xf5,0xca,0xe2,0xdc,0xe1,0x71,0xb7,0x2c,0x2b,0x6b,0x2a,0xef,0x3,0xcb, 0x3b,0xd9,0x15,0x11,0x53,0xf0,0xec,0x2d,0x7,0x5b,0x3b,0x75,0xa,0xe3,0x97,0x14, 0xd7,0x6f,0x7c,0x31,0xe9,0x78,0x59,0xd5,0x64,0x36,0x8,0x31,0x11,0x91,0xd,0xd6, 0x3f,0xf3,0xc9,0x51,0x52,0x95,0x55,0x36,0xc8,0x8c,0x31,0xc4,0x74,0xe9,0x82,0x2, 0x19,0xbd,0x67,0x12,0xf2,0xec,0x3d,0xfb,0x20,0x21,0x62,0x98,0x37,0xaf,0xeb,0x3a, 0xa3,0x24,0x40,0x44,0x44,0xa4,0x8d,0x3e,0x2a,0x8e,0x9a,0xba,0xb9,0x8c,0xcb,0x45, 0x51,0xe8,0x4a,0x6b,0xd2,0x1a,0xb5,0x35,0xd6,0x19,0x67,0x13,0x6b,0x12,0x73,0xf1, 0xb1,0x51,0x46,0x83,0xb6,0xda,0x7a,0xeb,0xad,0xb2,0x69,0x48,0xbd,0xf5,0xc1,0x7, 0xc,0x38,0xda,0x8b,0x4f,0x85,0x51,0xcb,0xb3,0xb,0x77,0xd7,0x36,0xb,0x5b,0x7d, 0xba,0xf5,0x31,0x2,0x5c,0x6b,0x2f,0x7c,0x72,0x7d,0x67,0xbe,0x39,0xbb,0x31,0xbf, 0x22,0x26,0xec,0x1d,0xee,0x8b,0xd,0x6c,0xc3,0x8d,0xb9,0x6b,0x44,0xd4,0x82,0x74, 0x63,0x7e,0x75,0x6,0xd3,0xed,0x85,0x35,0x0,0x98,0xc1,0x74,0x63,0xee,0x42,0x53, 0x1,0x98,0xc5,0xc6,0xd6,0xc2,0x5a,0x3b,0x6d,0xde,0x5c,0x5c,0x23,0xeb,0x9b,0x94, 0x2c,0xb5,0xe6,0xd0,0xf3,0x4c,0x73,0x86,0x21,0x0,0x4b,0x92,0x24,0xa,0x11,0x54, 0xf4,0xee,0xe3,0x54,0x11,0x12,0x30,0x30,0x20,0xb0,0x62,0x22,0x76,0xbd,0x81,0x1e, 0x2,0xe7,0x45,0x55,0x15,0x85,0x35,0x36,0x9a,0xbb,0x3a,0x53,0xca,0xf1,0x8a,0x79, 0x9e,0xc2,0xa0,0x8,0x2a,0x26,0x65,0x27,0x5c,0xbb,0xb,0xce,0x4,0x6b,0xc9,0x3b, 0xf2,0x4e,0xa2,0x55,0xbc,0xae,0x2e,0x0,0xeb,0xe2,0x9b,0x7a,0x7b,0x67,0xa,0xc1, 0x3e,0xdb,0xf5,0x47,0xcd,0xa4,0x2c,0xab,0xc1,0x30,0x33,0xd6,0x30,0x11,0x8b,0x0, 0x5c,0xe,0xce,0x44,0xe0,0x4e,0x42,0xc4,0xe4,0x99,0xbc,0x70,0x60,0xa,0x20,0x2c, 0xc0,0x82,0x67,0x63,0xe0,0xf4,0x9c,0xbd,0x4c,0x20,0xe2,0x79,0x5d,0x6a,0xd1,0x52, 0xd9,0xca,0x18,0xe3,0x83,0x27,0xa6,0xcb,0xc7,0xaa,0x52,0x53,0xdb,0x41,0x2,0x9, 0xc5,0xaf,0x88,0x41,0x2f,0xf2,0x94,0xb5,0xfb,0x17,0x21,0x22,0x6d,0x75,0x9,0x65, 0x13,0x9b,0xc6,0x1a,0xef,0xbc,0x57,0xde,0x39,0xe7,0x9c,0xf3,0xce,0xbb,0x86,0xb3, 0xa9,0xbd,0xf8,0xd8,0x37,0xbc,0x4f,0xbd,0xf7,0x3e,0x84,0x10,0x30,0xf8,0xe0,0x63, 0xd,0x4f,0x8d,0x8c,0x5f,0xb9,0xfa,0xd5,0xf0,0xd1,0xf1,0xcb,0x34,0x49,0x62,0xee, 0x33,0xb9,0xf3,0xc3,0x87,0x87,0xcf,0x1f,0x5c,0xbf,0xfd,0xc5,0xcb,0x47,0x33,0x49, 0xe3,0xb3,0xf5,0xbb,0x5f,0xed,0x3e,0xb9,0x31,0x77,0xed,0xc9,0xee,0xb7,0x20,0xb2, 0xbd,0xb6,0xbd,0xdb,0xdd,0xdf,0x59,0xdd,0x78,0x79,0xb2,0x7,0x0,0x3b,0xd7,0xb7, 0x5e,0x76,0xf,0x2e,0x36,0x95,0xed,0xb5,0xad,0xdd,0x93,0x83,0x8d,0xa5,0xeb,0x87, 0x9d,0x3,0xf0,0xbc,0x32,0xb3,0x3c,0x2c,0xb3,0x36,0x36,0x8d,0xad,0x80,0x24,0x85, 0x94,0x88,0x20,0x49,0x88,0x8,0x80,0x6b,0x78,0x8d,0x93,0x1b,0xa8,0x62,0x76,0x91, 0xd8,0x7a,0xcf,0xc1,0x55,0xba,0x72,0xce,0x92,0xb7,0xcc,0x2c,0x23,0xa7,0xf7,0x6a, 0xee,0xe1,0x5c,0x5b,0x85,0x31,0x7c,0x17,0xa0,0xba,0xee,0xca,0x93,0x77,0x14,0x3c, 0x91,0x17,0x19,0x65,0x8b,0xbe,0x93,0x3c,0xc1,0xb8,0x51,0x33,0x13,0x95,0x95,0xd6, 0x95,0x58,0x53,0x19,0x6b,0x82,0xf7,0x5c,0x43,0x8e,0xcb,0xb2,0x32,0x35,0x34,0x9, 0xc2,0x24,0x44,0xc2,0xa3,0xa4,0xd9,0x79,0x4f,0x99,0xbe,0x9,0x6d,0x7,0xe,0x10, 0x82,0xf,0xc4,0x44,0x5c,0x73,0x91,0x97,0x87,0xef,0x20,0x1c,0x23,0xfb,0xe8,0xd1, 0x65,0x5c,0x7b,0x7,0x67,0x61,0xcc,0x1b,0xed,0x3e,0xf2,0x98,0x1,0x3,0x5,0x1a, 0x5f,0x7c,0xb9,0x2b,0x86,0x2b,0xcc,0x42,0xc2,0xc8,0x11,0xaa,0x9,0x5f,0xf4,0xc5, 0x4c,0x23,0x54,0x2f,0xc1,0x5,0xe7,0xbc,0x27,0x22,0x88,0xb1,0x6c,0x4c,0xc7,0xb0, 0x44,0xbc,0xc1,0x2c,0x17,0x9d,0xa,0x44,0x7f,0x39,0xd9,0x5e,0xe2,0xe0,0xdc,0x54, 0x90,0x0,0x2,0xa4,0xaa,0xce,0x1f,0xc5,0x88,0x53,0x1,0x30,0x0,0xb1,0x38,0x4f, 0xe4,0xc9,0xf9,0x0,0x1c,0x12,0x60,0x94,0x0,0x52,0xe3,0x64,0x9c,0x7a,0xe2,0xd3, 0x94,0x42,0x6d,0xe6,0xf8,0x8a,0xc1,0x48,0xac,0x19,0xa4,0x40,0xc2,0xe3,0x77,0xf7, 0xb6,0xf6,0x20,0x22,0x81,0x18,0x38,0x78,0x1f,0x98,0x88,0x99,0x24,0xd6,0x48,0x5e, 0x16,0xbc,0xc7,0x8,0x2f,0x86,0xc5,0xb5,0x79,0x8a,0xbc,0x8e,0xdb,0x4c,0x5f,0xfb, 0x2c,0x32,0xa1,0xe,0x63,0xc0,0x11,0x19,0x71,0x44,0xbc,0x8c,0x67,0x7,0xa8,0xa3, 0x16,0xe0,0x51,0x14,0xfa,0x96,0x56,0x25,0xa7,0xa2,0x5e,0x51,0x72,0xea,0x62,0x1, 0x86,0x58,0xde,0x73,0xc1,0x71,0xfc,0xaa,0x29,0x33,0xe0,0x31,0x7a,0x79,0xc3,0x1b, 0xbc,0xd6,0x5e,0xba,0xbf,0xbe,0x53,0xd8,0xa,0x6e,0x3d,0x40,0x80,0xb5,0xb9,0xe5, 0xe6,0x46,0xba,0xd4,0x6a,0x7f,0xb6,0x79,0x4f,0x31,0x2c,0x34,0xdb,0x77,0xd7,0x36, 0x5b,0x90,0x6e,0xaf,0x6d,0x3,0xf3,0x42,0x6b,0x6e,0x7b,0x65,0x73,0x61,0xa6,0xd, 0xab,0x5b,0x0,0xb0,0x38,0x33,0x87,0x17,0x9d,0xe2,0x42,0xab,0xbd,0xb5,0xb2,0xd1, 0x4e,0x9b,0xb2,0xbc,0x4e,0x2e,0x34,0x59,0x2d,0xb6,0x17,0x54,0x10,0x6e,0xce,0xb2, 0xf,0xc0,0x50,0x83,0x99,0x18,0xaa,0x8e,0x73,0xa5,0xa7,0xd3,0x2e,0x41,0x84,0x4, 0x42,0x74,0x54,0x2c,0x20,0x8c,0x75,0xe8,0x38,0xd9,0x53,0x25,0xd6,0x3,0xcb,0xc4, 0x9d,0x23,0x2,0xca,0xa9,0x7c,0x6a,0x6d,0x38,0x22,0x22,0x31,0x31,0x14,0x57,0x49, 0x5d,0x33,0x89,0xaf,0xb9,0x4d,0xaf,0x35,0x2b,0xa9,0x1d,0x4,0xb,0xf3,0xe8,0x49, 0x40,0x18,0x5,0x2f,0x67,0xec,0x5c,0x1b,0x2b,0x4f,0x32,0x3,0xaf,0xb7,0xab,0xf4, 0xd,0xdb,0x98,0x8c,0xf6,0x8a,0xf1,0x47,0x78,0x9,0x5b,0x8f,0x2e,0x83,0x85,0xa1, 0xae,0x34,0xc2,0x57,0xff,0xc4,0x65,0x16,0xcf,0x69,0xb4,0x37,0x26,0x76,0x78,0x94, 0x9a,0xfe,0xce,0x31,0x22,0x46,0x86,0x51,0x40,0x50,0xb0,0xde,0x6d,0xdf,0xf8,0x7a, 0x6,0x3a,0x7f,0xda,0xd9,0x57,0xa,0xbf,0xda,0x7b,0xc,0x0,0x8d,0x5b,0xe9,0x93, 0xa3,0x97,0xf7,0xd7,0x76,0x1e,0x1e,0x3e,0x4b,0x40,0xdd,0x5f,0xdd,0x7e,0xd6,0xd9, 0xdf,0x98,0x5f,0xdd,0xed,0xee,0x83,0xc8,0xf6,0xca,0xe6,0x6e,0xff,0x68,0x7b,0xf9, 0xc6,0x5e,0xef,0x10,0x0,0x70,0x65,0x73,0x77,0x70,0xc1,0xa9,0x6c,0xaf,0x6c,0xee, 0xd,0x8e,0x36,0xe6,0xd7,0x8e,0x86,0x1d,0xf0,0xbc,0xda,0x5a,0xcc,0x74,0x31,0x87, 0x4d,0xe3,0xd,0x4,0x69,0x40,0x52,0x83,0x99,0x51,0xa8,0xca,0x53,0x37,0x39,0xda, 0x3d,0xc9,0xa4,0x20,0xac,0xe6,0x10,0xe3,0x7a,0x17,0x88,0x15,0xe7,0x63,0x5a,0x1d, 0x47,0x16,0x3f,0x4d,0xb7,0x8f,0xab,0x82,0xa7,0xdc,0x7c,0x2c,0xcb,0x13,0x44,0x51, 0x0,0x88,0x72,0xc6,0xbc,0xe5,0xdc,0xf0,0xf7,0x3c,0x74,0x34,0x76,0xa5,0xe3,0x9, 0xbe,0xed,0x86,0x3a,0x2e,0x7f,0x4,0x1e,0x11,0x67,0x78,0xf6,0x4f,0xc0,0xdb,0x80, 0x99,0xef,0xe3,0x85,0xa3,0xeb,0x82,0xe3,0xe9,0x18,0xfd,0x22,0xd7,0x99,0x50,0x75, 0xa5,0xbd,0x94,0xde,0x48,0x96,0x5a,0x73,0x9f,0xdc,0xbc,0x83,0x2c,0xb,0x8d,0xf6, 0xed,0xd5,0x8d,0x19,0x4c,0x77,0x56,0x37,0x98,0x65,0x61,0xa6,0xbd,0xbd,0x7c,0x63, 0x61,0xa6,0xbd,0xb5,0x72,0x13,0x0,0xde,0x6a,0x3a,0xdf,0x9a,0xdd,0x5a,0x5e,0x6f, 0x27,0xad,0xf5,0xa5,0x35,0x8e,0xde,0x7d,0x76,0x5e,0x79,0x19,0x85,0xaa,0x70,0x2a, 0x54,0x3d,0x5d,0xe0,0x35,0x5d,0xe5,0x52,0x1b,0x2e,0x4e,0x1c,0x39,0x33,0xb0,0x0, 0x22,0xe2,0xab,0x55,0x3,0x63,0x68,0x0,0x75,0x35,0xfc,0xab,0x96,0xaa,0x10,0x61, 0xea,0x39,0xcf,0x1,0xfa,0x97,0xa9,0x4f,0xff,0xf5,0x5d,0xbf,0x55,0xe6,0xfe,0xbe, 0xaf,0xd7,0x84,0xaa,0xb7,0xbe,0xdc,0x7f,0x92,0x80,0xfa,0xc1,0xda,0xad,0x27,0x27, 0xbb,0xdb,0xb,0x6b,0x2f,0x4f,0xf6,0x40,0x18,0x56,0xb7,0xf6,0x7a,0x87,0x5b,0x2b, 0x37,0xf7,0x3a,0x7b,0x0,0x0,0x6b,0x6f,0x31,0xdd,0x5c,0xdd,0xdc,0xef,0x1d,0xde, 0x5c,0xb8,0x7e,0xdc,0x3f,0x2,0x2f,0x2b,0xb3,0x4b,0x59,0x95,0xb7,0xb1,0x65,0xac, 0x7e,0x35,0x54,0x15,0x81,0x20,0xd0,0x90,0x49,0x4a,0x8,0x1,0x12,0x4,0x41,0xa0, 0x31,0xbb,0x88,0x75,0x75,0x40,0x10,0x60,0x1,0x14,0x48,0xb1,0x7e,0xbc,0xc2,0xe8, 0x24,0x1,0x11,0x62,0x18,0xcb,0x10,0x97,0x44,0x8d,0x6a,0xa6,0x2d,0x3a,0x11,0x50, 0xa,0x18,0xeb,0x87,0x8d,0x2b,0x11,0xe2,0x6e,0x80,0xbf,0xf1,0x77,0x50,0x7d,0x30, 0xe2,0xdf,0x82,0x2b,0xe6,0x2c,0xce,0x8b,0xbf,0x80,0x65,0xa,0x9a,0x4f,0x67,0x35, 0xf0,0xd4,0xf7,0x11,0xeb,0x74,0xd2,0x78,0xd,0x88,0x4c,0x97,0x20,0x4f,0x32,0x48, 0x3c,0xc6,0xed,0xf2,0x1a,0xfa,0xf2,0x37,0xf8,0xfa,0xe0,0xdd,0xdf,0xe2,0x7a,0x4d, 0xa8,0x3a,0xf7,0xd9,0xe6,0x47,0xc8,0xb2,0xd8,0x68,0x7f,0x74,0x7d,0x7b,0x6,0xd3, 0x9d,0xeb,0x5b,0xcc,0x32,0x89,0x3e,0xd7,0x62,0x30,0x3a,0x7f,0xf1,0xe9,0x42,0xab, 0x8d,0x2b,0x37,0xdb,0x49,0x8b,0xaf,0xdd,0xe0,0x71,0xa8,0xea,0x85,0x5b,0xb3,0xec, 0xce,0x86,0xaa,0xa7,0x23,0xca,0xc9,0x6c,0xcc,0xc0,0xc4,0xf5,0x10,0x8d,0x38,0xc1, 0x9,0xce,0x99,0xb6,0xfe,0x4,0x62,0x2d,0xfb,0x24,0xd8,0x1b,0x1f,0x51,0x1d,0xaf, 0xa,0x6,0x20,0x6,0x66,0x70,0x54,0xef,0x12,0xf5,0x12,0x1a,0x3d,0x18,0xff,0xd, 0xe0,0xc9,0x7,0x73,0x7f,0x6f,0xd7,0xeb,0x43,0xd5,0xe7,0x9,0xe0,0xfd,0xd5,0xed, 0xe7,0xdd,0x83,0x8d,0xb9,0xd5,0x97,0xdd,0x3,0x10,0x79,0x9b,0xd8,0xf4,0xdc,0x50, 0xf5,0x78,0x63,0x7e,0xed,0xf8,0x4c,0xa8,0xea,0xce,0x9,0x55,0x71,0xb4,0x47,0xe3, 0x69,0x0,0x1d,0xbf,0x9f,0x9c,0x3e,0x69,0x3a,0x4e,0x1b,0x45,0xbe,0x52,0xce,0x92, 0xe3,0x93,0x2d,0x5f,0x9d,0x41,0xd7,0x38,0xce,0xc9,0xc0,0x74,0xb4,0x80,0xf2,0x7d, 0xba,0x83,0x1f,0xcc,0xfd,0x2d,0xae,0xd7,0x87,0xaa,0xb7,0xff,0xd,0x43,0x55,0x85, 0xd0,0x4e,0x21,0x49,0x60,0x42,0xeb,0x1,0xa0,0x40,0x82,0x80,0x9,0xa4,0x9,0x90, 0x2,0xaf,0x20,0x4c,0x39,0xf5,0x54,0x41,0x43,0xc5,0x5c,0x29,0x8c,0x33,0xdb,0x38, 0x65,0xd3,0x80,0x40,0x23,0x3c,0x34,0x3e,0xf5,0x17,0xff,0xc7,0x32,0x95,0x9,0xc7, 0xb7,0x89,0xf4,0x3f,0x98,0xfb,0x87,0x50,0xf5,0x5d,0x43,0x55,0x61,0x44,0x48,0x14, 0x28,0x4,0x9a,0x46,0x2f,0x38,0xe1,0xd1,0x95,0x82,0x33,0x3c,0x14,0x8e,0x30,0xfa, 0x58,0xa1,0x60,0x7a,0x53,0xa8,0x33,0x36,0x0,0x82,0xa7,0x6c,0x1d,0x5f,0x43,0xab, 0xc8,0xb9,0x19,0xab,0xf,0xa1,0xea,0x87,0xeb,0xbd,0xc5,0xaa,0x40,0x53,0x6a,0x19, 0xd3,0x1,0x28,0x8c,0xcc,0x1a,0x47,0x95,0xd5,0xe3,0x43,0x49,0x54,0x73,0x8b,0x35, 0x64,0xe7,0x98,0xa0,0x8d,0xf8,0x1e,0x6b,0xe2,0x5,0xa7,0x68,0xc7,0xf8,0x84,0xa, 0x27,0xc6,0x2e,0x2,0x24,0x70,0xaa,0x2e,0xfc,0x37,0xdb,0xe4,0x3f,0x78,0xf7,0xef, 0x7d,0xa8,0x2a,0x2,0x5e,0x0,0x19,0x44,0xce,0xd2,0xe1,0xaf,0x96,0x8e,0x20,0x4e, 0x9d,0xca,0x93,0x53,0x5a,0x3,0x32,0x8a,0x56,0x1,0x40,0x9,0xf0,0x28,0x18,0x88, 0x25,0x9,0xaf,0x25,0x61,0xce,0xd4,0x3d,0xe1,0x7,0x73,0xff,0x10,0xaa,0xbe,0xcf, 0x50,0x95,0x1,0x6c,0x80,0x24,0x1,0x85,0xe3,0xda,0x74,0xc0,0xc8,0x9c,0xf0,0x9b, 0xde,0xe,0xcb,0x24,0x75,0xa,0xf5,0x21,0x54,0x80,0xa4,0xf6,0xf7,0x38,0x95,0xb6, 0xc6,0xa9,0x1,0x8e,0xd8,0x18,0x38,0x4f,0xb7,0xe3,0x3,0x76,0xff,0x10,0xaa,0xbe, 0xdf,0x50,0x75,0xda,0xbf,0x8e,0xed,0x52,0x70,0x82,0x2e,0xde,0x50,0x63,0x8d,0x78, 0x2a,0xed,0x3e,0x86,0x34,0x32,0x62,0x1e,0xf1,0x55,0x46,0xff,0x55,0x82,0xff,0xfb, 0x13,0xad,0x7e,0x30,0xf7,0xdf,0x86,0x50,0x35,0x45,0x68,0x28,0x48,0x4e,0xa7,0x36, 0xa3,0x77,0x67,0x6,0xcf,0xa7,0x93,0x4d,0xa3,0x7,0x24,0x58,0x57,0xc8,0xc4,0x60, 0x57,0x18,0x44,0x20,0x70,0x1d,0xbc,0x4a,0x64,0xd9,0x11,0x80,0x27,0xa7,0xb6,0xcf, 0x45,0x2b,0xdf,0x23,0x2e,0xf2,0x43,0xa8,0xfa,0xbd,0xbf,0x70,0x14,0x6e,0xe2,0x69, 0x8a,0x3d,0xba,0xe7,0x48,0xd7,0xf0,0xf9,0xf1,0xed,0x84,0xab,0x49,0xa6,0x88,0xf6, 0x91,0x9e,0xdd,0x44,0x4b,0xc,0xe4,0xb7,0xe4,0xb3,0xfa,0xe0,0xdd,0xbf,0xf7,0xa1, 0x2a,0x20,0x34,0x15,0x28,0x35,0x11,0xc2,0xc3,0xd3,0x36,0x5d,0x1f,0x7d,0x9e,0x5a, 0x1f,0x2,0x10,0xb8,0x76,0xf0,0xa0,0x40,0x1,0x24,0xaa,0x46,0x32,0x63,0xe,0x3e, 0x51,0xb5,0xf4,0x52,0x5c,0x48,0x32,0x29,0x3e,0x3d,0xcb,0xc0,0x8,0x7c,0xc0,0xee, 0x1f,0x42,0xd5,0x5f,0x63,0x56,0x75,0xc,0xb7,0x6b,0x72,0xe6,0x3b,0x4f,0x17,0x4d, 0x1,0x7a,0x35,0x62,0x24,0x5f,0xdd,0x34,0x22,0xb2,0x9f,0x4e,0xaf,0x7e,0xdf,0xbd, 0xfc,0x7,0x73,0xff,0xde,0x87,0xaa,0xf2,0xa,0xed,0xf8,0x6a,0xd2,0x67,0xda,0x1, 0x47,0x1c,0x1f,0x41,0x4e,0x0,0xf0,0x5c,0x17,0x84,0x4d,0x72,0x4d,0x8,0x20,0x35, 0x63,0x93,0x0,0xe0,0x28,0x81,0x75,0x96,0xd4,0xff,0x5e,0x15,0x87,0x5d,0xc6,0xdc, 0xe5,0x52,0x51,0xf8,0x6f,0x26,0x4f,0x75,0x89,0x57,0xf5,0x1b,0x1a,0xaa,0xca,0xf9, 0xa5,0x2f,0xd3,0xec,0xe1,0xb4,0xd1,0xd7,0x27,0x98,0xa6,0xaa,0xdb,0x19,0x4e,0x81, 0xf5,0xe8,0xd7,0x65,0x2c,0x93,0x3d,0x55,0x9b,0x30,0xfd,0xfc,0x80,0x57,0x78,0x5f, 0x2f,0xa7,0x23,0x26,0x57,0x69,0xee,0x58,0x1f,0x60,0xa9,0xf,0x96,0x8e,0x7c,0x3, 0x5f,0x2a,0x9c,0xba,0x32,0x89,0x6a,0x3c,0x73,0x60,0x65,0x74,0x2e,0x66,0x2c,0xde, 0x10,0x4f,0xea,0x7e,0xe7,0x78,0x4a,0x96,0x48,0xde,0xfd,0x5e,0x9d,0x75,0xaf,0x2, 0xe7,0x9e,0xf6,0xbc,0xd8,0x54,0xde,0xca,0x94,0x4,0x47,0x87,0xe9,0xa6,0xf8,0x87, 0x51,0xbe,0x69,0x2c,0x1e,0x32,0x7a,0x5d,0x2c,0x2c,0xc8,0x23,0x9d,0x19,0x99,0xf2, 0xfc,0x91,0x6b,0x57,0x53,0x55,0x90,0xf5,0x69,0x4b,0x4,0x11,0x50,0x20,0x38,0x55, 0x85,0x16,0x7f,0x11,0x2f,0x57,0xec,0x3e,0x91,0xee,0x91,0xa9,0x8f,0x8c,0x2f,0x67, 0xe,0x6f,0x25,0x6e,0x97,0xbe,0xc1,0xf9,0xd5,0x92,0xaa,0xf5,0xf9,0x5b,0x89,0xbd, 0x65,0x2e,0xb7,0x81,0x89,0x88,0x8c,0x4e,0x4a,0x4e,0x9d,0x3a,0xbe,0xd4,0xf3,0x44, 0x41,0x1c,0x8c,0x47,0x68,0x6b,0xb,0x1e,0xcb,0x7,0x8c,0xfb,0x2f,0x5c,0x70,0x2c, 0xa3,0x5f,0xbe,0xc8,0x6a,0x3c,0x37,0x54,0x5d,0x6c,0xcd,0xfd,0x70,0xf3,0x1e,0x90, 0x2c,0xa6,0xb3,0x77,0x57,0x37,0x67,0xb1,0xb1,0xbd,0xb6,0x25,0x2c,0xb,0xad,0xf6, 0xf6,0xca,0xe6,0x7c,0x6b,0x76,0x73,0x75,0x33,0x46,0x9f,0x17,0x9e,0xe2,0x62,0xc, 0x55,0xd3,0x26,0x5f,0xbb,0xc1,0xd6,0x37,0x25,0x79,0x53,0xa8,0x3a,0x5,0x60,0xc6, 0x50,0x7b,0xdc,0xb3,0x20,0xde,0xc5,0x28,0xdb,0xb,0x42,0xa3,0x4f,0xb1,0x3e,0xb3, 0x37,0xd,0x4e,0xa2,0x3b,0x97,0x29,0xca,0x52,0xc6,0xb9,0xa7,0xfa,0xd0,0xb7,0x40, 0xec,0x44,0x20,0x13,0x7,0x88,0xf8,0x36,0x9e,0x56,0x46,0x8b,0x68,0x64,0x57,0xb1, 0x70,0x9e,0x41,0x2e,0xc7,0x66,0x8a,0x8,0xc6,0xd3,0xec,0x13,0x5d,0x35,0xb9,0x94, 0xb9,0x4b,0x2d,0x38,0xc3,0xf1,0x3f,0xe1,0xb1,0x82,0xc0,0x25,0x5d,0x60,0x3c,0x9a, 0x5d,0x8b,0x92,0x8,0x2,0xbe,0xed,0x73,0xd5,0x12,0x4b,0x42,0x81,0x2,0x21,0x51, 0x20,0xa6,0x5a,0x4d,0x20,0x8a,0x11,0x4c,0xb,0x13,0x7c,0xf7,0x98,0xa2,0xd6,0xda, 0xa8,0x27,0xf,0x4e,0xd6,0xcc,0xeb,0x8e,0x9,0x9f,0x1b,0xaa,0x7e,0xbc,0xb6,0xf3, 0xcd,0xc1,0x73,0x60,0xfe,0x68,0x79,0xf3,0xdb,0xe3,0xdd,0xad,0x85,0xb5,0xdd,0x93, 0x3,0x10,0xd9,0x5a,0xd9,0xd8,0x1b,0x1c,0x6d,0x2d,0xaf,0xef,0xd7,0xc1,0xe8,0xcd, 0xbd,0xc1,0xf1,0x85,0xa6,0x2,0xb8,0x72,0x73,0xaf,0x7f,0xb4,0xb1,0xb0,0x76,0x3c, 0xe8,0x80,0xa7,0x95,0x99,0xa5,0x37,0x84,0xaa,0x10,0x69,0x16,0x1,0x25,0x75,0x39, 0xfb,0xe8,0xac,0xb2,0x10,0x33,0x85,0x40,0x44,0x51,0x31,0x43,0x88,0x51,0x38,0x41, 0x41,0xc1,0x30,0x32,0x8c,0x3a,0x24,0x65,0x40,0x4,0xc6,0x89,0xf3,0x46,0x98,0x40, 0xfc,0x91,0xfc,0x2f,0xa3,0x30,0xa,0x23,0x30,0x82,0xa8,0x57,0x78,0xcf,0x8b,0x19, 0x7b,0xdd,0x6d,0x20,0xde,0xd,0x89,0xa2,0x6,0xef,0xa0,0xbc,0xc1,0x23,0xcf,0x3c, 0x25,0x40,0x20,0x17,0x35,0xf7,0x69,0x45,0xb1,0xa8,0xe7,0xe8,0xc9,0x93,0x50,0x90, 0x10,0x35,0x33,0x2e,0x9d,0x41,0x8b,0xb6,0x4e,0x42,0x63,0x38,0x71,0x41,0x13,0x1f, 0xdf,0x81,0x68,0xac,0x21,0xea,0xa3,0xa1,0x8d,0x42,0xbe,0x5e,0x79,0x9f,0xf8,0xe0, 0x3,0x39,0xa,0x49,0x70,0xa9,0xb,0xee,0x62,0x63,0x4f,0xc1,0x5,0x9f,0xf8,0x10, 0x2,0x5,0x62,0xc5,0x93,0xce,0x3c,0x78,0xc1,0x50,0x75,0x31,0xb9,0x71,0x7b,0xb1, 0xd9,0xfe,0x78,0x7d,0x3b,0x58,0x3f,0xab,0x9a,0xdb,0xb,0xd7,0xdb,0x69,0x73,0x63, 0xe9,0xba,0x88,0xb4,0xd3,0xe6,0xc6,0xfc,0x5a,0x3b,0x69,0xdd,0x5c,0xb8,0xe,0x0, 0xed,0xa4,0xf5,0x16,0xd3,0xb4,0xb9,0xb1,0xb0,0xd6,0x4e,0x9b,0xd7,0x17,0x56,0xd8, 0xd3,0x45,0xce,0xaa,0x62,0x2d,0x65,0x82,0x88,0xd1,0x0,0x98,0x99,0x82,0x77,0xce, 0xb9,0xe0,0x6c,0x70,0x2e,0x4,0x2f,0x14,0x10,0x20,0x1,0x89,0x60,0x26,0x7a,0x7c, 0x54,0x51,0xa5,0xf2,0x2c,0xe2,0x1f,0x7,0xb5,0x3c,0x9,0x0,0x24,0x1,0x16,0xa, 0xc8,0x84,0x12,0x4f,0xf0,0xc9,0xdb,0x78,0x2b,0x18,0x29,0xb0,0x7,0x1f,0x1c,0x5, 0x2f,0x44,0xc2,0x61,0xa4,0x99,0x71,0xe9,0xb8,0x37,0x1a,0x2c,0xbd,0x41,0x20,0xe8, 0x15,0x73,0x97,0x9,0x9c,0xad,0xad,0x8a,0x42,0xd4,0x73,0x8c,0xf2,0xbc,0x24,0x34, 0xd6,0xcc,0xb8,0xb4,0xb9,0xc7,0x3f,0x12,0x95,0x95,0x46,0xf0,0x16,0xbf,0xdb,0xd3, 0xcb,0x64,0xab,0x89,0xed,0x6,0x8c,0x98,0xa,0x2a,0xa3,0x8d,0x33,0xce,0xb0,0xa9, 0xa4,0x32,0xda,0x38,0xeb,0xc,0x1a,0x8d,0x3a,0x4a,0x46,0x5e,0x74,0xc,0xda,0x1a, 0x4b,0x8e,0x7c,0xe2,0xe3,0x92,0x7e,0x3,0xeb,0x76,0x26,0x54,0x55,0xb7,0x3e,0xfb, 0xe6,0xe0,0xe9,0x27,0xab,0x3b,0x5f,0xbd,0x7c,0x4,0x36,0xec,0x2c,0x6f,0xbe,0x3c, 0x7c,0x79,0x73,0x71,0xed,0xb0,0x73,0x0,0x2,0xb2,0xbc,0x7e,0x34,0xec,0xac,0x2f, 0xad,0x1d,0xf7,0x8f,0x0,0x80,0xaf,0xdd,0x38,0x7e,0xab,0xe9,0xa0,0x73,0x7d,0x61, 0xe5,0xa4,0x77,0xc,0xc4,0xd7,0x66,0x97,0xb3,0x32,0x6b,0xab,0xd7,0x84,0xaa,0x50, 0x17,0xcc,0xe0,0x58,0x4e,0x81,0x89,0x2,0x91,0xf7,0xde,0x1a,0x67,0x2a,0x67,0x2a, 0x67,0x4d,0xf0,0x8e,0x89,0x15,0xca,0x58,0xe9,0x37,0xaa,0x15,0x28,0x0,0x1e,0x1d, 0x57,0x9d,0xbc,0x69,0x39,0x45,0xef,0x8c,0xc4,0x80,0x4,0x90,0x91,0x29,0x61,0x9f, 0x4a,0x8,0x75,0x8b,0xa5,0x33,0x9a,0x10,0xe7,0xdb,0x79,0x94,0x8b,0x64,0x22,0xa2, 0xa8,0x5d,0x6a,0xd9,0x5b,0xae,0x25,0x4b,0xf9,0x1d,0x5,0x80,0x6b,0xdb,0xe5,0x20, 0x42,0xaf,0x4,0x4e,0xf2,0x8a,0xb9,0xcb,0x8,0x2a,0x40,0x2d,0x48,0xed,0x83,0xb7, 0xc1,0x9a,0x60,0xc,0x99,0xb1,0xb9,0xbf,0x63,0x48,0x37,0xc6,0xeb,0x51,0xe0,0x2c, 0xb6,0xb2,0x1a,0xdb,0x3a,0x9e,0x23,0x58,0x32,0x91,0x7f,0x89,0x88,0xc5,0x8a,0x35, 0x95,0x31,0xa5,0x29,0xb9,0x54,0xac,0xca,0xbc,0x34,0x85,0xa9,0x9a,0x55,0x11,0x8a, 0x4a,0x57,0xd6,0xda,0x8a,0xaa,0x3c,0xe4,0x95,0xad,0xac,0xb9,0xd8,0x38,0x54,0x45, 0x28,0xb4,0xd6,0xce,0x38,0x97,0xb8,0x6,0x36,0x26,0x32,0xa8,0xaf,0x75,0x12,0xa3, 0x40,0x6,0x90,0x99,0x43,0xa0,0xe0,0x3d,0x38,0x2,0x4f,0x6c,0x3d,0x4,0x26,0xeb, 0xc1,0x33,0x8,0x90,0xb,0xe0,0x99,0x5d,0x0,0x2f,0x0,0xc0,0x6f,0x35,0xb5,0x1e, 0x3c,0xb1,0x27,0x20,0x86,0x91,0x1e,0xce,0x1b,0x38,0xc,0x4,0x49,0x70,0x7c,0x3, 0x99,0x43,0xf0,0xce,0x1a,0x5d,0x9a,0xb2,0xd0,0x65,0xee,0x74,0xe1,0xad,0xd,0xde, 0x47,0xa9,0x19,0x52,0x2,0x30,0x75,0xfa,0xe,0xce,0xa1,0xea,0xe5,0x34,0x77,0x29, 0xa3,0x85,0x41,0x28,0x9,0xb2,0x84,0x30,0xd2,0x1c,0x15,0x90,0x53,0x61,0xb5,0x9c, 0xb3,0x3b,0x43,0xec,0x85,0x7,0x12,0xf5,0xd7,0x6d,0x70,0x86,0x9c,0xe1,0x60,0x99, 0xbc,0x10,0xbd,0x23,0x59,0x20,0x13,0x51,0x24,0x62,0x22,0xe1,0x28,0x27,0x24,0xe7, 0x82,0x9a,0x74,0x6c,0xeb,0x2c,0xcc,0x54,0xf7,0x90,0xd1,0x5e,0x57,0xa1,0x2a,0x43, 0x19,0xcd,0x3d,0xfa,0xe3,0x9a,0xa0,0xc1,0xcb,0xbf,0xac,0xc8,0xcf,0x4c,0x50,0xcd, 0x99,0x98,0xf5,0x55,0xc1,0x11,0x9e,0x0,0x18,0x3,0x26,0x97,0x3c,0xcf,0xf2,0x72, 0x58,0x62,0xc0,0xc0,0x21,0xcf,0x72,0x5d,0xe9,0xb2,0x59,0xa6,0x36,0x2d,0x5d,0xa9, 0x9d,0x2e,0x7d,0xd9,0xb0,0x8d,0x8b,0x8e,0xad,0x2e,0x7d,0xd9,0x70,0x8d,0xca,0x56, 0xc6,0x9a,0x66,0xa3,0x99,0xa8,0x84,0x7c,0x44,0x5b,0xf2,0x9a,0x50,0x75,0xf1,0xfe, 0xfa,0xad,0xdc,0x54,0xb0,0xf3,0x0,0x44,0x56,0x66,0x16,0x1e,0xac,0xed,0xcc,0x4a, 0xe3,0xd6,0xd2,0x66,0xd0,0xb6,0x45,0x6a,0xbd,0xb5,0xdc,0xa4,0x64,0x65,0x66,0x19, 0x44,0x9a,0xac,0x56,0x5b,0x8b,0x4d,0x56,0x2b,0xb3,0x4b,0x0,0xf0,0x76,0x53,0x49, 0x56,0x66,0x96,0x9a,0xac,0xae,0xcd,0x2e,0xb,0x4b,0x13,0x93,0x85,0xd6,0xbc,0x62, 0x99,0x69,0xcc,0x9e,0xd2,0x88,0x1c,0xc9,0x2a,0x21,0x8c,0x24,0xe9,0x98,0x38,0x38, 0xaf,0xb5,0x29,0x73,0x53,0xc,0xab,0xac,0x6f,0xcb,0xa1,0xd5,0x25,0x39,0xc7,0xe4, 0x41,0x44,0x61,0x74,0x80,0x40,0x3c,0x29,0xf1,0x9d,0x24,0x96,0x5e,0xc9,0x95,0xaa, 0xd1,0x62,0x88,0x90,0x86,0x0,0x92,0x5a,0x62,0x3a,0x50,0xf0,0xb1,0x53,0xc0,0xd8, 0xbd,0xcb,0xb4,0x40,0xf6,0xd8,0xd6,0x23,0x34,0xa6,0x40,0xc1,0x5,0xab,0x83,0xab, 0x82,0x29,0xa3,0xb9,0xd7,0x4a,0x77,0x2,0x0,0x82,0xef,0x62,0xf0,0x23,0xd,0x9c, 0xd8,0xd,0x10,0xc6,0xdc,0xca,0xab,0x60,0xa6,0x96,0xc,0x8e,0x50,0x81,0xbc,0xf5, 0xb6,0xf2,0x55,0xe1,0x8b,0x22,0x14,0xd1,0xdc,0xbd,0xf8,0xc0,0xe1,0x1c,0x85,0xde, 0x77,0xa0,0xba,0xa3,0x5f,0x9f,0x48,0xa2,0xbe,0x12,0x2,0xcb,0xe8,0xee,0x45,0x7d, 0x77,0x6b,0x6c,0xae,0x73,0x70,0x30,0xe8,0xe,0xf2,0x5e,0x1e,0x42,0x30,0x6c,0xf2, 0x32,0xd7,0x56,0xa7,0x69,0x8a,0xd,0x2c,0x7d,0x69,0xbc,0x29,0x1b,0xa5,0x6a,0xa8, 0xb7,0x18,0xbb,0xd1,0xd8,0x9a,0xb4,0x91,0xaa,0x54,0x59,0x63,0x83,0xf,0x40,0x50, 0x3b,0xf8,0xd3,0x6f,0x77,0x50,0xe5,0xdf,0x9e,0xec,0x29,0xc0,0xaf,0x5f,0x3e,0x2, 0x91,0x1f,0x5c,0xbf,0xfb,0xcd,0xee,0xb7,0x3b,0xb3,0xab,0x2f,0xf7,0x5e,0x80,0xe5, 0xd5,0x99,0xc5,0xee,0xb0,0xbf,0xd4,0x9a,0x1b,0x96,0x19,0x8,0x2c,0xb6,0x17,0x32, 0x5d,0x2c,0xce,0xce,0x67,0x55,0xe,0x70,0xd9,0x69,0x99,0x1,0xc0,0x42,0x6b,0x3e, 0xaf,0xf2,0xd9,0xa4,0x65,0xbc,0x81,0xc0,0xd,0x4c,0xcf,0x84,0xaa,0x23,0xf9,0xe6, 0x40,0xe4,0xbd,0xd1,0xa6,0x18,0x56,0xc3,0x6e,0xd5,0xef,0x54,0xc3,0x9e,0x2d,0x73, 0x6f,0x35,0x7,0xc7,0x5c,0xf7,0xf,0xc6,0x51,0xe5,0x23,0xc3,0x29,0xd4,0x5e,0xb, 0xff,0xf2,0xe9,0x63,0xaa,0x78,0xaa,0x96,0x46,0x21,0x24,0x58,0x73,0x6c,0x21,0x44, 0x8b,0x1f,0xf5,0x23,0x10,0x99,0x56,0x36,0xc2,0x31,0xef,0x35,0xea,0x97,0x44,0x4e, 0x7,0x53,0x6,0x53,0x4,0x53,0x92,0x37,0x42,0x9e,0x29,0x8c,0x58,0xfd,0x77,0x4c, 0x58,0x8d,0xe9,0xdf,0xd8,0xeb,0x35,0x8c,0xd8,0x9a,0xb3,0x16,0x9f,0x32,0x33,0x10, 0x84,0x10,0x9c,0x77,0xda,0xeb,0xd2,0x95,0xb9,0xcf,0x33,0x9f,0x15,0xbe,0xa8,0xa8, 0x72,0xec,0x82,0x44,0x4d,0x7f,0x90,0x2b,0xaa,0x6d,0x8e,0xe8,0x25,0x6,0xbe,0x35, 0x8d,0xf8,0x8a,0x58,0xe4,0x58,0xc0,0xd1,0x5a,0xab,0x4b,0x5d,0x65,0x55,0xdf,0xf6, 0x8b,0xb2,0x38,0x39,0x3a,0xc9,0xba,0x99,0x9,0xa6,0x25,0xad,0xdc,0xe4,0xc6,0x1b, 0x4c,0x51,0x52,0x29,0x43,0x59,0xf9,0xa,0x1b,0x97,0x1c,0xeb,0xa0,0x55,0xaa,0x20, 0x1,0xed,0xb4,0x77,0x1e,0x19,0x91,0x50,0xe4,0x2c,0x17,0xbc,0x3c,0x33,0x7f,0x67, 0x65,0x23,0xab,0x8a,0xfb,0xeb,0xb7,0xc9,0x53,0x1b,0xd2,0xed,0xd6,0x4a,0xc3,0xca, 0xb5,0x64,0x8e,0xd0,0xa3,0xa5,0x79,0x68,0xa0,0xe7,0x36,0x36,0x1,0x51,0x5,0x99, 0xc3,0xa6,0xf2,0xd2,0xc6,0x16,0x0,0x28,0x7f,0xa9,0xa9,0x6a,0x1,0x80,0x62,0x99, 0x4d,0x5a,0x9,0x60,0x33,0x69,0xa,0x90,0x3a,0x13,0xaa,0x32,0x3,0x11,0xa1,0x8f, 0x9d,0x44,0x4d,0x39,0x2c,0x7,0xdd,0xa2,0x7b,0x54,0xc,0x3a,0x26,0x1f,0x78,0x5d, 0xd6,0x3a,0xbd,0x53,0xfa,0xdd,0xe3,0x16,0xc1,0xd3,0x1d,0xb1,0xe5,0x74,0xbb,0xc9, 0x9,0x8b,0x3f,0x3a,0xc4,0x2d,0xa3,0x22,0x5,0x4,0x1,0x1,0x1a,0xed,0xbc,0x42, 0x75,0xcf,0x99,0x53,0xfd,0xfa,0xb8,0x66,0xd1,0x38,0x78,0xf6,0x36,0xd8,0x2a,0x98, 0x22,0xe8,0xdc,0x9b,0x82,0x6c,0x15,0xb1,0xd0,0x8,0xb5,0x5f,0x55,0x81,0x2,0x8e, 0xe0,0x42,0x14,0xe4,0xe3,0xe9,0x95,0x10,0x17,0x54,0x1a,0x42,0x0,0x2,0x63,0x4d, 0x65,0xab,0xdc,0xe6,0x43,0x3b,0x1c,0xb8,0x41,0xe6,0xb3,0xd8,0x43,0xa6,0xee,0x35, 0x70,0xa5,0x89,0xd1,0x31,0x5e,0x1f,0x47,0xae,0x3c,0xea,0xf7,0x30,0xec,0x3b,0x1f, 0xac,0x0,0x0,0x5,0x5f,0x49,0x44,0x41,0x54,0x56,0xd2,0x8b,0x0,0xc6,0x8a,0xcd, 0x43,0x3e,0x1c,0xc,0x87,0x27,0x43,0x5d,0x68,0xc9,0xa4,0x73,0xdc,0xc9,0x87,0x79, 0x83,0x1b,0xd,0x69,0xe8,0xa0,0x75,0xd0,0x92,0x8,0x27,0x6c,0xc8,0x38,0x72,0x98, 0xe0,0xbb,0x8c,0x49,0x91,0x21,0xe3,0x83,0x7,0x0,0xc5,0x8a,0x99,0x4f,0x6d,0x68, 0x8,0x27,0x79,0xff,0xf1,0xe1,0x73,0x45,0xf2,0xf8,0xc5,0x43,0x70,0xbc,0xbd,0xb8, 0xb1,0xbb,0xfb,0x7c,0x59,0xcd,0xf,0xba,0x1d,0x8,0xd2,0x6e,0xcc,0x56,0xba,0x9a, 0x69,0xce,0x18,0x5b,0x1,0x0,0x37,0x67,0x8d,0x37,0x33,0xcd,0x19,0x63,0x35,0x0, 0x70,0x6b,0xd6,0xb8,0x4b,0x4e,0x67,0x1a,0xb3,0xc6,0x9b,0x66,0xd2,0x74,0xce,0x0, 0x43,0x8a,0x9,0x51,0x80,0x24,0x8d,0xb2,0x4a,0xcc,0xc,0xc1,0x9,0x91,0x33,0x95, 0x29,0x86,0x65,0xff,0x24,0xef,0x1e,0xe5,0xdd,0x23,0x9d,0xf5,0xad,0x2e,0xc8,0x39, 0x21,0x3f,0xea,0x38,0x7a,0x2a,0x7f,0x85,0x72,0xa,0x7b,0x9c,0xef,0x64,0x4f,0x3f, 0x66,0xca,0x7d,0x47,0xc9,0x48,0x61,0x26,0xe,0x7e,0xd4,0x10,0x66,0xf2,0x14,0x35, 0x62,0x8,0x2e,0x38,0xe3,0x6d,0xe9,0xab,0xcc,0xeb,0x3c,0x54,0x59,0xb0,0x25,0x7, 0x1b,0xf5,0xd7,0xa5,0x26,0x3f,0xf0,0xca,0x2c,0xb,0xa7,0x3,0x63,0x82,0x31,0xb9, 0x32,0x36,0x77,0x67,0x1d,0x21,0x55,0xba,0x1a,0x9a,0xe1,0x40,0xf,0x7a,0xb6,0x37, 0xb4,0xc3,0x22,0x14,0x13,0x5b,0x3f,0xd3,0x51,0xe3,0x2a,0xd2,0xa2,0x53,0xf9,0xcc, 0x89,0x8f,0x9f,0x7c,0x8a,0x0,0xce,0x3a,0x67,0x5c,0x9,0x65,0x97,0xba,0xdd,0xa3, 0x6e,0xff,0xb0,0xf,0x43,0xa0,0x82,0x7a,0xfd,0x5e,0xa5,0xab,0x54,0xd2,0x6,0x36, 0x2c,0x59,0xc7,0xe,0x14,0xb0,0x62,0xc7,0xce,0xb1,0x13,0x25,0x97,0x1c,0x93,0x13, 0x25,0xa4,0xa8,0x1e,0xa3,0x28,0x51,0x4c,0xa3,0x5d,0x6d,0xf4,0xba,0xd9,0x93,0xf8, 0x40,0x41,0xc0,0x32,0x58,0x72,0x52,0x41,0x19,0x3c,0x68,0xb0,0x4,0x24,0xc4,0x1e, 0x82,0x30,0x84,0x48,0x79,0xb0,0xf,0xa7,0xa6,0xee,0xb2,0x53,0x1,0x86,0x0,0x81, 0x5,0xa8,0x16,0xf8,0x52,0xa7,0x6e,0x45,0x8,0x41,0xac,0x61,0x62,0x53,0xc,0x8a, 0xfe,0x49,0xde,0x39,0xc8,0xbb,0x47,0xe5,0xa0,0x6b,0xab,0x3c,0x58,0x43,0x44,0xc2, 0x91,0x34,0x3c,0xaf,0x36,0xe6,0x34,0xc3,0xf1,0xda,0x5b,0x86,0x67,0x2c,0x60,0x6a, 0x97,0x88,0x81,0x18,0xf3,0x58,0x94,0x34,0xde,0x48,0xa,0x3e,0x38,0xeb,0xac,0x76, 0x3a,0xf7,0xb1,0xe1,0xa3,0xce,0xc8,0x14,0xe4,0xc7,0x3d,0x64,0x2e,0x9b,0x5b,0xfa, 0xce,0xfc,0x76,0xfd,0x4e,0x6a,0x29,0x5f,0x9c,0xba,0x83,0xa9,0x71,0xc6,0xb1,0x1b, 0x56,0xc3,0x7e,0xd9,0xef,0xea,0x6e,0xdf,0xf4,0x63,0x1f,0xbc,0xb1,0xad,0x9f,0xe9, 0x77,0x70,0x85,0xde,0x1d,0xa6,0xf4,0x4d,0x59,0xb8,0x7e,0xf3,0x8,0x28,0xa8,0x2b, 0xad,0xb,0xd,0xe,0xac,0xb6,0x47,0xfb,0x47,0xfd,0xc3,0x3e,0xe5,0x44,0x15,0x95, 0xba,0x74,0xd6,0x11,0x10,0x29,0xf2,0xe4,0x3d,0xfb,0x68,0xee,0x71,0xcb,0xbc,0x92, 0x71,0x90,0x0,0x0,0x9,0x26,0x75,0x6b,0x17,0x4c,0x20,0x2a,0x4b,0x2,0xce,0x27, 0xad,0x9d,0xf9,0xeb,0xfd,0x41,0x7f,0x6b,0x6e,0xdd,0xb3,0x56,0xa5,0x9f,0xe7,0x16, 0xb8,0xd0,0x94,0x86,0x80,0x40,0xe0,0x6,0x28,0x60,0x49,0x23,0xdf,0xc5,0xd0,0x80, 0x4,0x18,0xde,0x75,0x8a,0x0,0x2c,0xd,0x4c,0x15,0x43,0x8a,0x9,0x28,0x41,0xc0, 0x24,0x49,0x14,0x2a,0x48,0x52,0x56,0xe2,0x9d,0xa3,0x2a,0x77,0xc6,0x94,0xfd,0x93, 0xec,0xe4,0x20,0xeb,0x1e,0x54,0x83,0x8e,0x2d,0x32,0x6f,0xd,0x53,0xa8,0x3b,0x5e, 0x81,0xe0,0xd4,0x79,0x3c,0x7c,0x63,0x91,0xca,0xc4,0xe1,0xca,0xa4,0xbf,0xe4,0xe4, 0xfb,0x53,0x95,0xc0,0x38,0x6e,0x7b,0x7,0xa3,0x14,0xa9,0xc2,0xba,0xf3,0x9e,0xb3, 0xce,0x6a,0x5b,0xe5,0xa6,0x18,0xda,0xbc,0xe7,0xaa,0x61,0x18,0xf7,0xc1,0x1b,0xf7, 0x90,0xb9,0xea,0xa6,0xd9,0xd3,0xaf,0x6c,0x2c,0x61,0x3d,0xdd,0xd3,0x20,0x2d,0x4d, 0x59,0x85,0xaa,0x5f,0xf6,0x3b,0xba,0x33,0x30,0x83,0xd8,0xcb,0xd7,0xb3,0x9f,0xf4, 0x4b,0xba,0xda,0x2,0x2f,0x39,0x3f,0x91,0x14,0x6d,0x3d,0x72,0x33,0x8,0x58,0x14, 0x45,0x39,0x2c,0x4d,0x65,0x60,0x8,0x9d,0xa3,0x4e,0xde,0xcb,0x59,0x33,0x5b,0x76, 0xce,0x85,0x10,0x4,0x45,0x50,0x2,0x7,0x8e,0x1a,0xf4,0xa,0xae,0x76,0x4c,0x48, 0x11,0x7,0xa2,0x20,0x2a,0x54,0x4a,0x89,0x88,0x52,0xaa,0xd3,0xef,0xbd,0xd8,0x7f, 0xe9,0x4b,0x73,0xb0,0xb7,0xb,0x3a,0xcc,0x43,0xab,0xc8,0xf2,0x6,0x24,0xde,0x3b, 0x10,0x48,0x55,0x5a,0xf7,0x90,0x21,0x2,0x80,0x38,0xb8,0xea,0x69,0x0,0x81,0x24, 0x49,0x88,0x19,0x51,0xc5,0x50,0xd5,0x59,0x1b,0x8a,0x81,0x29,0xf2,0xbc,0x73,0x90, 0x77,0xf,0xaa,0xfe,0x89,0x29,0x86,0xc1,0x6a,0xa,0x61,0x24,0xc0,0x2e,0x67,0xec, 0x7b,0x7c,0x36,0xef,0x4d,0xad,0x3b,0x2e,0x50,0x87,0x35,0x1d,0xa,0xc4,0x76,0x5f, 0x88,0x2a,0xca,0xcd,0x5a,0x53,0xea,0x32,0xab,0xf2,0x41,0x35,0xec,0xba,0xb2,0xef, 0x75,0x1e,0xc3,0x53,0x19,0xb5,0x70,0x7a,0x5f,0x65,0x83,0x93,0xbc,0xaa,0xe0,0xa4, 0x65,0x2c,0x22,0x20,0x20,0xa6,0x85,0x2e,0x72,0x97,0xf7,0xab,0xfe,0xd0,0xc,0xc7, 0xbd,0x7c,0x49,0x88,0xb1,0x4e,0x31,0x5e,0x22,0xdb,0xff,0x9d,0x68,0xe6,0x94,0xa7, 0x47,0x3c,0x55,0xe0,0x84,0x80,0x82,0xd9,0x30,0xcb,0xb3,0x1c,0x86,0x10,0x6,0x21, 0x1b,0x64,0xb6,0xb2,0xe0,0x0,0x8,0x22,0x9e,0xfe,0x35,0x94,0x58,0x62,0x54,0x38, 0x57,0xa0,0x94,0x4a,0x92,0x4,0x0,0x30,0x60,0x93,0xd5,0x4a,0x3a,0xd7,0xf7,0x76, 0x31,0x99,0x23,0x34,0xe0,0xb8,0xa9,0x52,0x64,0x48,0x55,0x1a,0x5b,0xbb,0x8d,0xf9, 0x41,0x88,0x62,0xb9,0x57,0x3f,0x4d,0x1,0x40,0xa1,0x42,0x54,0x49,0x9a,0xa0,0x42, 0x49,0xd0,0x98,0xca,0xf,0xfb,0x65,0xd6,0x2f,0xfb,0x9d,0x2a,0xeb,0xdb,0xaa,0x20, 0x67,0x6b,0x6,0x7a,0x24,0xe5,0x78,0x11,0x91,0x82,0xf3,0x4d,0xfe,0xbb,0xfa,0x7b, 0xe0,0x8,0xeb,0xd4,0x9e,0x21,0x49,0x54,0xd2,0x0,0x80,0xb2,0x28,0xca,0x6c,0x58, 0xc,0x7a,0xae,0xec,0x79,0x5d,0x90,0xd3,0x32,0xea,0xf9,0x88,0xb1,0x1,0x34,0xbc, 0xb7,0xf2,0x79,0x3e,0xfd,0x8e,0x10,0x65,0x64,0xef,0x69,0x61,0x8b,0xcc,0x64,0x85, 0x2d,0x74,0xd0,0xb1,0xb9,0xe9,0xa8,0x9,0xe5,0x74,0x90,0xf6,0xbe,0xa,0x9b,0x23, 0x13,0x8f,0x11,0x2c,0xd4,0x15,0x4e,0x4a,0x81,0xea,0xf,0xfa,0xc3,0xee,0xd0,0xf7, 0xbc,0x1f,0xfa,0x32,0x2f,0xbd,0xf5,0x48,0xa8,0xa4,0xe6,0xcd,0x10,0xde,0x4e,0xd8, 0xfa,0xd2,0x63,0x84,0xe8,0xad,0x50,0x48,0x0,0xa0,0xd3,0xeb,0x3e,0x7a,0xfa,0x28, 0x29,0xa9,0x18,0xc,0xc0,0x73,0x3,0x1b,0xde,0xd9,0x4,0x53,0x22,0xf,0x2,0x35, 0x33,0xa8,0x6a,0x97,0xfc,0x1e,0xa7,0x69,0x4a,0x44,0x98,0xa0,0xf7,0x1e,0x10,0xac, 0xd1,0x2e,0xef,0xd9,0x7c,0xe0,0xaa,0x8c,0xac,0x8e,0x3d,0xda,0x1,0x11,0x95,0xc2, 0x29,0x8a,0x17,0x4f,0x57,0x74,0xc1,0x48,0x5a,0xe3,0xd,0x4e,0x49,0x2e,0xe2,0xb8, 0xc6,0x4d,0xcb,0x10,0x11,0x13,0x95,0xa6,0x49,0xa3,0x89,0x88,0x79,0x36,0xcc,0x6, 0x3d,0x5b,0xe,0x82,0xa9,0x24,0x58,0x19,0x71,0xa6,0x75,0xb7,0x26,0x79,0xe3,0x86, 0x72,0x95,0xfe,0x14,0x31,0x3a,0x2f,0x40,0x40,0x95,0x1a,0x63,0x9c,0x77,0x44,0x84, 0x82,0xa,0x54,0xa,0x29,0x2a,0xe4,0x4b,0x77,0xfe,0x7b,0xfb,0x54,0xeb,0xa9,0xe3, 0xb2,0x2,0x89,0x4a,0x12,0x49,0xa2,0xb9,0xdb,0x9e,0xd,0x45,0x30,0xc6,0x30,0x71, 0x6d,0xeb,0x71,0x91,0x2a,0x54,0x4a,0x21,0x20,0x32,0xbe,0xdf,0xb1,0xa0,0x8a,0xbb, 0x33,0x42,0xa3,0xd5,0xec,0xf,0xfa,0x3a,0x2f,0x17,0xd4,0x6c,0x2c,0x34,0x49,0x92, 0xc4,0x53,0xa2,0x92,0x84,0x80,0x0,0x40,0xa5,0x29,0x11,0xa8,0x24,0x25,0x94,0xf7, 0x38,0x45,0x48,0xd2,0x94,0x14,0xa8,0x66,0x3,0x12,0x81,0x4,0xff,0xe9,0x1f,0xfe, 0xbe,0xd0,0xff,0x5b,0xb8,0xee,0xd9,0x12,0x15,0xfe,0xcf,0x45,0xb,0xf8,0x8e,0xd5, 0xe2,0xdf,0x61,0x5a,0x75,0x93,0x83,0xe8,0xc2,0xb2,0x6c,0x68,0xaa,0x9c,0xbc,0x15, 0x26,0x1,0xc0,0xba,0x34,0x47,0x7e,0x9d,0xe7,0xb8,0x47,0x69,0x32,0x14,0x44,0x44, 0x54,0x2a,0xf9,0xff,0x72,0x70,0xb9,0xa4,0x63,0xb4,0x16,0x50,0x0,0x0,0x0,0x0, 0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82, }; static const unsigned char qt_resource_name[] = { // images 0x0,0x6, 0x7,0x3,0x7d,0xc3, 0x0,0x69, 0x0,0x6d,0x0,0x61,0x0,0x67,0x0,0x65,0x0,0x73, // rect.png 0x0,0x8, 0xb,0xa7,0x58,0x47, 0x0,0x72, 0x0,0x65,0x0,0x63,0x0,0x74,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67, }; static const unsigned char qt_resource_struct[] = { // : 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1, // :/images 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x2, // :/images/rect.png 0x0,0x0,0x0,0x12,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, }; QT_BEGIN_NAMESPACE extern Q_CORE_EXPORT bool qRegisterResourceData (int, const unsigned char *, const unsigned char *, const unsigned char *); extern Q_CORE_EXPORT bool qUnregisterResourceData (int, const unsigned char *, const unsigned char *, const unsigned char *); QT_END_NAMESPACE int QT_MANGLE_NAMESPACE(qInitResources_trtrisarea)() { QT_PREPEND_NAMESPACE(qRegisterResourceData) (0x01, qt_resource_struct, qt_resource_name, qt_resource_data); return 1; } Q_CONSTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qInitResources_trtrisarea)) int QT_MANGLE_NAMESPACE(qCleanupResources_trtrisarea)() { QT_PREPEND_NAMESPACE(qUnregisterResourceData) (0x01, qt_resource_struct, qt_resource_name, qt_resource_data); return 1; } Q_DESTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qCleanupResources_trtrisarea))
2c6f18c573af5a4aa5e1d6d3d58d170c3863ef10
f3c27fa8d094cc5d3fad81a1e2e32891d1f1d931
/proj-rt/proj-rt-files/reflective_shader.cpp
30347e00b0f2ef97d1150940642c0f0d97600c51
[]
no_license
ahernandez25/CS130
301a5ca10b63e2692c10db95ac62f9b5c488f2c3
bd44d13410678a99f484b1d12ed2c2e78dcd2e7b
refs/heads/master
2020-12-10T23:00:22.241132
2020-02-11T03:47:36
2020-02-11T03:47:36
233,735,952
0
0
null
null
null
null
UTF-8
C++
false
false
771
cpp
reflective_shader.cpp
#include "reflective_shader.h" #include "ray.h" #include "render_world.h" vec3 Reflective_Shader:: Shade_Surface(const Ray& ray,const vec3& intersection_point, const vec3& normal,int recursion_depth) const { vec3 color; Ray reflected_ray; vec3 r; vec3 color_reflected; vec3 color_intersect; vec3 v = -ray.direction; r = (-v) + (2 * dot(v,normal) * normal); reflected_ray.endpoint = intersection_point; reflected_ray.direction = r.normalized(); color_reflected = reflectivity * world.Cast_Ray(reflected_ray, recursion_depth + 1 ); color_intersect = (1 - reflectivity) * shader->Shade_Surface(ray, intersection_point, normal, recursion_depth++); color = color_reflected + color_intersect; return color; }
78e575032ddb18ddf0073338affcfd0952f59e0f
20a5125d13c99a0505a14f7af3fcbda26cd56f1f
/AREAPERI.CPP
6f54c2030654b8f77960ba0c7bf4666a6a2f8daa
[]
no_license
mayuresh1730/hello-world
dc47027ffb4630672086f6eb29b9e48c506ac0a0
6233ab481b5aae28ff6890656ece04f5faa07835
refs/heads/master
2021-01-12T06:32:39.236858
2017-01-10T14:02:49
2017-01-10T14:02:49
77,379,156
0
0
null
2016-12-26T11:25:32
2016-12-26T11:19:34
null
UTF-8
C++
false
false
684
cpp
AREAPERI.CPP
/* perimeter as well as area of rectangle and circle*/ #include<stdio.h> #include<conio.h> int main() { clrscr(); float leng,bre,area,peri,circum,areac,rad; printf("\nlength and breadth of rectangle are respectively"); scanf("%f%f",&leng,&bre); /* formula for area of rectangle*/ area=leng*bre; /*perimeter of rectangle*/ peri=2*(leng+bre); printf("\narea of rectangle is %f and its perimeter is %f",area,peri); printf("\nradius of circle is"); scanf("%f",&rad); /* area of circle*/ areac=3.14159*rad*rad; /* circumference*/ circum=2*3.14159*rad; printf("\narea of circle and its circumference are respectively %f,%f",areac,circum); getch(); return 0; }
a4cc339ad000279e478a5aab06c44826e65b3324
37e0b5df87a990d5217d6b81747c068df1883212
/LevelEditor/GameObject.h
44b606e84b7e68a9befd21438743f58ef6f86df6
[]
no_license
thekevinbutler/sfmlbox2d
130cf0b3579d2665d9ce6420d4b1f4d5d031f417
78f30a33277c920bd33d33a9e9c7a4ad6ec33911
refs/heads/master
2021-05-01T23:52:19.112390
2017-01-04T15:01:59
2017-01-04T15:01:59
78,023,988
0
0
null
null
null
null
UTF-8
C++
false
false
336
h
GameObject.h
#ifndef GAMEOBJECT_H #define GAMEOBJECT_H #include "SFML\Graphics.hpp" class GameObject : public sf::Transformable { public: enum EObjType { OBJ_TYPE_DEFAULT, OBJ_TYPE_PHYS, OBJ_TYPE_PLAYERSTART, OBJ_INTERACT }; GameObject(); void setObjType(EObjType pType); EObjType getObjType(); private: EObjType type; }; #endif
c456870d4257a7603cf1e494dd07e66b231c56b0
37f447063c5c34baae7193ea659fd3081bbe623c
/source/main.cc
e9cfd921fdd54230d8dfc7784b43f349818892b7
[]
no_license
watchog/compress
b046a5b57e258f7a5bba6ebc8f8b0b9511ddec1f
acb5ef1f6d9628e1dcea66a95f9c642e989db1b0
refs/heads/master
2020-03-07T13:25:16.587843
2018-04-22T08:23:52
2018-04-22T08:23:52
127,500,029
2
0
null
null
null
null
UTF-8
C++
false
false
622
cc
main.cc
#include"head.h" #include"rwfile.h" #include"bit_operation.h" #include"build_tree.h" #include"encode.h" #include"decode.h" #include"compress.h" #include"extract.h" #include"compress_extract.h" int main(int argc,char **argv) { if(argc < 3){ std::cerr << argv[0] << " opt(1-压缩 or 2-解压缩) " << "文件名"; std::cerr << std::endl; return 0; } int option = std::stoi(argv[1]); switch(option){ case 1: RjfCompress::compress(argv[2]); std::cout<<"压缩完成"<<std::endl; break; case 2: RjfCompress::extract(argv[2]); std::cout<<"解压缩完成"<<std::endl; break; } return 0; }
3c013d51177136336a150ccdfd47383eac82440c
7b79b6f0a96554ac41aba7b739b9bd93b3f57c45
/A1014.cpp
5910bc02fefce8d78e46a8198e2ca4add586ab5d
[]
no_license
lrscy/PAT
f80ff57995821b493e8b98c72de56cdf13ab8994
831bb1f462aad5a6d4ab622bc04c4393832df868
refs/heads/master
2021-01-10T07:38:08.739617
2016-02-24T15:23:21
2016-02-24T15:23:21
52,203,012
0
0
null
null
null
null
UTF-8
C++
false
false
939
cpp
A1014.cpp
#include <iostream> #include <cstring> #include <cstdio> #include <queue> using namespace std; const int INF = 0x3F3F3F3F; const int MAXN = 1000 + 10; int t[MAXN], st[MAXN], win[25]; queue<int> que[25]; int n, m, k, q; int main() { int i; memset( win, 0, sizeof( win ) ); scanf( "%d%d%d%d", &n, &m, &k, &q ); for( i = 0; i < k; ++i ) scanf( "%d", t + i ); for( i = 0; i < min( k, n * m ); ++i ) { st[i] = win[i % n]; que[i % n].push( i ); win[i % n] += t[i]; } for( ; i < k; ++i ) { int nmin = INF, pos; for( int j = 0; j < n; ++j ) { int tmp = que[j].front(); if( st[tmp] + t[tmp] < nmin ) { nmin = st[tmp] + t[tmp]; pos = j; } } que[pos].pop(); que[pos].push( i ); st[i] = win[pos]; win[pos] += t[i]; } while( q-- ) { scanf( "%d", &n ); --n; if( st[n] >= 540 ) { puts( "Sorry" ); continue; } printf( "%02d:%02d\n", ( st[n] + t[n] ) / 60 + 8, ( st[n] + t[n] ) % 60 ); } return 0; }
031d891182173967ce547621ccdd67062b1c4aae
8cd433650402dacace74ef1875004ac0208317f1
/SciEngine/SciMath/SciMatrix4x4.cpp
66d99446bd77e70e944b34c2545a0c60b8122241
[]
no_license
ScienceDiscoverer/SciEngine
7685002a91918ef588813b6201364d2037c94f76
f23f3a9e9fac2839c89b35142752ca15e187d772
refs/heads/master
2020-03-17T07:13:39.604454
2018-05-14T16:19:42
2018-05-14T16:19:42
133,389,113
0
0
null
null
null
null
UTF-8
C++
false
false
8,343
cpp
SciMatrix4x4.cpp
#include <cassert> #include <cstring> #include "SciMatrix4x4.h" // Constants const size_t msize = sizeof(SciMatrix4x4); const SciMatrix4x4 identity; // Constructors // Load Identity matrix SciMatrix4x4::SciMatrix4x4() { Identity(); } // Construct from vectors (column-space) for post-mult. on column vector SciMatrix4x4::SciMatrix4x4(const SciVector4& vec1, const SciVector4& vec2, const SciVector4& vec3, const SciVector4& vec4) { SetColumns(vec1, vec2, vec3, vec4); } // Construct from 3x3 matrix SciMatrix4x4::SciMatrix4x4(const SciMatrix3x3& matrix) { SetZero(); SetRotation(matrix); data[15] = 1.0f; } // Construct affine transformation matrix from 3x3 rotation, and 3D translation vector SciMatrix4x4::SciMatrix4x4(const SciMatrix3x3& rot, const SciVector3& trans) { SetRotation(rot); SetTranslation(trans); data[3] = 0.0f; data[7] = 0.0f; data[11] = 0.0f; } // End of Constructors // Rule of 5 SciMatrix4x4::SciMatrix4x4(const SciMatrix4x4& other) { memcpy(this, &other, msize); } SciMatrix4x4::SciMatrix4x4(SciMatrix4x4&& other) { memcpy(this, &other, msize); } SciMatrix4x4& SciMatrix4x4::operator=(const SciMatrix4x4& other) { memcpy(this, &other, msize); return *this; } SciMatrix4x4& SciMatrix4x4::operator=(SciMatrix4x4&& other) { memcpy(this, &other, msize); return *this; } // End of Rule of 5 // Accsess functions float& SciMatrix4x4::operator()(int row, int column) { assert((row >= 0 && row < 4) && (column >= 0 && column < 4)); return data[4*column + row]; // Column-major storage } const float& SciMatrix4x4::operator()(int row, int column) const { assert((row >= 0 && row < 4) && (column >= 0 && column < 4)); return data[4*column + row]; } SciMatrix4x4& SciMatrix4x4::SetRows(const SciVector4& vec1, const SciVector4& vec2, const SciVector4& vec3, const SciVector4& vec4) { SciVector4 vecs[4] = { vec1, vec2, vec3, vec4 }; for(int i = 0; i < 4; ++i) { data[i] = vecs[i].x; data[i+4] = vecs[i].y; data[i+8] = vecs[i].z; data[i+12] = vecs[i].w; } return *this; } SciMatrix4x4& SciMatrix4x4::SetColumns(const SciVector4& vec1, const SciVector4& vec2, const SciVector4& vec3, const SciVector4& vec4) { SciVector4 vecs[4] = { vec1, vec2, vec3, vec4 }; for(int i = 0; i < 4; ++i) { data[i*4] = vecs[i].x; data[i*4+1] = vecs[i].y; data[i*4+2] = vecs[i].z; data[i*4+3] = vecs[i].w; } return *this; } // Set top left rotation block-matrix to matrix SciMatrix4x4& SciMatrix4x4::SetRotation(const SciMatrix3x3& matrix) { data[0] = matrix(0, 0); data[1] = matrix(1, 0); data[2] = matrix(2, 0); data[4] = matrix(0, 1); data[5] = matrix(1, 1); data[6] = matrix(2, 1); data[8] = matrix(0, 2); data[9] = matrix(1, 2); data[10] = matrix(2, 2); return *this; } // Set translation vector in affine matrix SciMatrix4x4& SciMatrix4x4::SetTranslation(const SciVector3& vector) { data[12] = vector.x; data[13] = vector.y; data[14] = vector.z; data[15] = 1.0f; return *this; } // Get top left rotation block-matrix from affine matrix SciMatrix3x3 SciMatrix4x4::GetRotation() const { SciVector3 x(data[0], data[1], data[2]); SciVector3 y(data[4], data[5], data[6]); SciVector3 z(data[8], data[9], data[10]); return SciMatrix3x3(x, y, z); } // Get translation vector from affine matrix SciVector3 SciMatrix4x4::GetTranslation() const { return SciVector3(data[12], data[13], data[14]); } SciVector4 SciMatrix4x4::GetRow(int row) const { assert(row >= 0 && row < 4); switch(row) { case 0: return SciVector4(data[0], data[4], data[8], data[12]); case 1: return SciVector4(data[1], data[5], data[9], data[13]); case 2: return SciVector4(data[2], data[6], data[10], data[14]); case 3: return SciVector4(data[3], data[7], data[11], data[15]); default: return zero_vec4; } } SciVector4 SciMatrix4x4::GetColumn(int col) const { assert(col >= 0 && col < 4); switch(col) { case 0: return SciVector4(data[0], data[1], data[2], data[3]); case 1: return SciVector4(data[4], data[5], data[6], data[7]); case 2: return SciVector4(data[8], data[9], data[10], data[11]); case 3: return SciVector4(data[12], data[13], data[14], data[15]); default: return zero_vec4; } } // End of Accsess functions // Arithmetic operators SciMatrix4x4 SciMatrix4x4::operator+(const SciMatrix4x4& other) const { SciMatrix4x4 tmp; for(int i = 0; i < 16; ++i) { tmp.data[i] = data[i] + other.data[i]; } return tmp; } SciMatrix4x4& SciMatrix4x4::operator+=(const SciMatrix4x4& other) { for(int i = 0; i < 16; ++i) { data[i] += other.data[i]; } return *this; } SciMatrix4x4 SciMatrix4x4::operator-(const SciMatrix4x4& other) const { SciMatrix4x4 tmp; for(int i = 0; i < 16; ++i) { tmp.data[i] = data[i] - other.data[i]; } return tmp; } SciMatrix4x4& SciMatrix4x4::operator-=(const SciMatrix4x4& other) { for(int i = 0; i < 16; ++i) { data[i] -= other.data[i]; } return *this; } SciMatrix4x4 SciMatrix4x4::operator*(const SciMatrix4x4& other) const { SciMatrix4x4 tmp; for(int i = 0; i < 4; ++i) { const int c2 = i + 4; // Columns const int c3 = i + 8; const int c4 = i + 12; tmp.data[i] = data[i]*other.data[0] + data[c2]*other.data[1] + data[c3]*other.data[2] + data[c4]*other.data[3]; tmp.data[c2] = data[i]*other.data[4] + data[c2]*other.data[5] + data[c3]*other.data[6] + data[c4]*other.data[7]; tmp.data[c3] = data[i]*other.data[8] + data[c2]*other.data[9] + data[c3]*other.data[10] + data[c4]*other.data[11]; tmp.data[c4] = data[i]*other.data[12] + data[c2]*other.data[13] + data[c3]*other.data[14] + data[c4]*other.data[15]; } return tmp; } SciMatrix4x4& SciMatrix4x4::operator*=(const SciMatrix4x4& other) { SciMatrix4x4 tmp = *this * other; *this = tmp; // Does this copy an array? It should. return *this; } SciMatrix4x4 SciMatrix4x4::operator*(const float& scalar) const { SciMatrix4x4 tmp; for(int i = 0; i < 16; ++i) { tmp.data[i] = data[i] * scalar; } return tmp; } SciMatrix4x4& SciMatrix4x4::operator*=(const float& scalar) { for(int i = 0; i < 16; ++i) { data[i] *= scalar; } return *this; } // Post multiplication by column 3D vector SciVector4 SciMatrix4x4::operator*(const SciVector4& vector) const { SciVector4 tmp; tmp.x = data[0]*vector.x + data[4]*vector.y + data[8]*vector.z + data[12]*vector.w; tmp.y = data[1]*vector.x + data[5]*vector.y + data[9]*vector.z + data[13]*vector.w; tmp.z = data[2]*vector.x + data[6]*vector.y + data[10]*vector.z + data[14]*vector.w; tmp.w = data[3]*vector.x + data[7]*vector.y + data[11]*vector.z + data[15]*vector.w; return tmp; } SciMatrix4x4 SciMatrix4x4::operator/(const float& scalar) const { float recip = 1.0f / scalar; return *this * recip; } SciMatrix4x4& SciMatrix4x4::operator/=(const float& scalar) { float recip = 1.0f / scalar; return *this *= recip; } // End of Arithmetic Operators // Relationsl operators bool SciMatrix4x4::operator==(const SciMatrix4x4& other) const { return !(bool)memcmp(this, &other, msize); } bool SciMatrix4x4::operator!=(const SciMatrix4x4& other) const { return !(*this == other); } // End of Relationsl operators // Core operations // Inverse affine transformation matrix SciMatrix4x4& SciMatrix4x4::AffineInverse() { SciVector3 i(data[0], data[1], data[2]); SciVector3 j(data[4], data[5], data[6]); SciVector3 k(data[8], data[9], data[10]); SciMatrix3x3 rot(i, j, k); // Rotation SciVector3 trans(data[12], data[13], data[14]); // Translation // Rotate negated vector by inversed rotation matrix trans = -trans * rot.Transpose(); SetRotation(rot); SetTranslation(trans); return *this; } // Reset matrix to Identity matrix SciMatrix4x4& SciMatrix4x4::Identity() { SetZero(); data[0] = 1.0f; data[5] = 1.0f; data[10] = 1.0f; data[15] = 1.0f; return *this; } bool SciMatrix4x4::IsIdentity() { return !(bool)memcmp(this, &identity, msize); } // End of Core operations // Private functions // Set matrix to zero matrix void SciMatrix4x4::SetZero() { for(int i = 0; i < 16; ++i) { data[i] = 0.0f; } } // End of Private functions // Operator functions SciMatrix4x4 operator*(const float& scalar, const SciMatrix4x4& matrix) { return matrix * scalar; } // Its still post multiplication by column 3D vector SciVector4 operator*(const SciVector4& vector, const SciMatrix4x4& matrix) { return matrix * vector; } // End of Operator functions
d09f050578c01f7cc04c0b2a618ce9ec8979dba3
2ee347b2afa1f25ef96cba3de0a1c9a42caff298
/GameDev_tv_course/ToonTanks_Source/ToonTanks/PawnBase.h
59f424752732668495e93130837340abfddedbfc
[]
no_license
Resnog/Games_UE4
933b2bc9dd3bf0cc7a7b26606cbb5e25f0dc38b5
81628b9c348bb526d9b5548e6ab2f4cd3d48f252
refs/heads/main
2023-01-21T09:53:14.769462
2020-11-28T17:02:02
2020-11-28T17:02:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,318
h
PawnBase.h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "Components/CapsuleComponent.h" #include "GameFramework/Pawn.h" #include "ToonTanks/ProyectileBase.h" #include "PawnBase.generated.h" class UHealthComponent; class USoundBase; class UCameraShake; UCLASS() class TOONTANKS_API APawnBase : public APawn { GENERATED_BODY() //Line 1 //Line 2 private: // COMPONENTS UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* BaseMesh; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* TurretMesh; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true")) UCapsuleComponent* CapsuleComp; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true")) USceneComponent* ProjectileSpawnPoint; UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true")) UHealthComponent* HealthComponent; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Proyectile Type", meta = (AllowPrivateAccess = "true")) TSubclassOf<AProyectileBase> ProjectileClass; // EFFECTS UPROPERTY(EditAnywhere, Category = "Effects", meta = (AllowPrivateAccess = "true")) UParticleSystem* DeathParticle; UPROPERTY(EditAnywhere, Category = "Effects", meta = (AllowPrivateAccess = "true")) USoundBase* DeathSound; UPROPERTY(EditAnywhere, Category = "Effects", meta = (AllowPrivateAccess = "true")) TSubclassOf<UCameraShake> DeathShake; public: // Sets default values for this pawn's properties APawnBase(); // Called every frame virtual void Tick(float DeltaTime) override; // Called to bind functionality to input virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; // Called when the game starts or when spawned virtual void BeginPlay() override; // Destruction virtual void HandleDestruction(); protected: // Rotate firing turret to aim void RotateTurret(FVector LookAtTarget); // Fire cannon void Fire(); };
94e444a7b280aac88b716aca346ee72ed1b646f9
b4a537160bc8aee055534280b8564992d05d4245
/02000/02018.cpp
0d6ff3dd2159a0943a40172682c8379550f940a3
[]
no_license
kadragon/acmicpc
c90d8658969d9bcbecd7ac45a188ac1ad4ad1dd3
b76bb7b545256631212ea0a2010d2c485dbd3e40
refs/heads/master
2021-07-13T01:45:03.963267
2021-04-18T07:33:08
2021-04-18T07:33:08
244,813,052
0
0
null
null
null
null
UTF-8
C++
false
false
351
cpp
02018.cpp
// // Created by kangdonguk on 2020/06/04. // // https://www.acmicpc.net/problem/2018 // 수들의 합 5 #include <stdio.h> int main() { int n, a = 1, t; scanf("%d", &n); for (int i = 1;; i++) { t = (n - ((i + 1) * i) / 2); if (t <= 0) break; if (t % (i + 1) == 0) a++; } printf("%d", a); }
c6b1fab9c7d92e1cbf02b81c90eb19f2841ad0da
fbe3446166131953d656b153f1ce89005d5f8738
/Tercas/calendar/activity.bak/entactivity/entactivityQt/src/AbbrColorWidget.cpp
b2cc31868359eb526231729bf3fd7e1dd4af4e6b
[]
no_license
odira/src
97389b28a460ab531da0f361d5688f5ab00ded49
96eefa25d1d1b3fc4b8c76ad5a9df54d5b977858
refs/heads/main
2022-02-06T05:22:58.136570
2022-02-01T12:08:01
2022-02-01T12:08:01
79,330,489
0
0
null
2019-10-31T22:41:09
2017-01-18T10:43:21
Python
UTF-8
C++
false
false
2,963
cpp
AbbrColorWidget.cpp
#include <QtWidgets> #include <QtSql> #include "AbbrColorWidget.h" AbbrColorWidget::AbbrColorWidget(QWidget *parent) : QWidget(parent), m_abbr(QString()), m_color(QColor()) { m_lineEdit = new QLineEdit; m_lineEdit->setFixedWidth(38); m_lineEdit->setFixedHeight(30); m_lineEdit->setAlignment(Qt::AlignCenter); m_button = new QPushButton("..."); QGroupBox *abbrGroupBox = new QGroupBox(trUtf8("Отображение")); QHBoxLayout *hLayout = new QHBoxLayout(abbrGroupBox); hLayout->setSpacing(5); hLayout->addWidget(m_lineEdit); hLayout->addWidget(m_button); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->setMargin(0); mainLayout->addWidget(abbrGroupBox); mainLayout->addStretch(1); setLayout(mainLayout); connect(m_lineEdit, SIGNAL(textEdited(QString)), this, SLOT(abbrChanged(QString))); connect(m_button, SIGNAL(clicked(bool)), this, SLOT(showColorDialog())); } //int AbbrColorWidget::pid() const //{ // return m_pid; //} //void AbbrColorWidget::setPid(const int &pid) //{ // if (pid != m_pid) // { // m_pid = pid; //// emit pidChanged(m_pid); // QString queryString = QString("SELECT abbr,color FROM shedule.vw_activity WHERE pid = %1") // .arg(m_pid); // QSqlQuery query(queryString); // while (query.next()) { // QString abbr = query.value(0).toString(); // QString colorString = query.value(1).toString(); // m_abbr = abbr; // m_color = QColor(colorString); // m_lineEdit->setText(abbr); // m_lineEdit->setStyleSheet(QString("background-color:'%1'").arg(colorString)); // } // } //} QString AbbrColorWidget::abbr() const { return m_abbr; } void AbbrColorWidget::setAbbr(const QString &abbr) { if (abbr != m_abbr) { m_abbr = abbr; m_lineEdit->setText(m_abbr); } } QColor AbbrColorWidget::color() const { return m_color; } void AbbrColorWidget::setColor(const QColor &color) { if (color != m_color) { m_color = color; m_lineEdit->setStyleSheet(QString("background-color:'%1'").arg(m_color.name())); } } void AbbrColorWidget::setEnabled(bool enabled) { m_lineEdit->setReadOnly(!enabled); m_button->setEnabled(enabled); } void AbbrColorWidget::showColorDialog() { m_colorDialog = new QColorDialog(this); connect(m_colorDialog, SIGNAL(colorSelected(QColor)), this, SLOT(colorChanged(QColor))); m_colorDialog->exec(); } void AbbrColorWidget::abbrChanged(const QString &abbr) { m_abbr = abbr; } void AbbrColorWidget::colorChanged(const QColor &color) { // QString colorString = color.name(); // QString queryString = QString("UPDATE shedule.activity SET color='%1' WHERE pid=%2").arg(colorString).arg(m_pid); // QSqlQuery query(queryString); // query.exec(); m_color = color; }
8353ab22134f449cf693818e18f383407edd66a3
050feba8fddacdb88d5d45751c0424a2ef220268
/src/Scene/Transform.cpp
7202053e8eb70eb5901b1ed558ddade348b60925
[]
no_license
ascn/kiwi
6b8d1aa127ea9d65bcce5cbd4ff6e76b1e8d6b08
de920a75d3b6682436560b6718963861750efcf5
refs/heads/master
2020-03-27T19:02:02.934932
2019-05-13T03:16:32
2019-05-13T03:16:32
146,961,423
2
0
null
null
null
null
UTF-8
C++
false
false
2,604
cpp
Transform.cpp
#include "Scene/Transform.h" namespace Kiwi { K_COMPONENT_S(Transform) Vector3 Transform::worldUp(0.f, 1.f, 0.f); Vector3 Transform::worldRight(1.f, 0.f, 0.f); Vector3 Transform::worldForward(0.f, 0.f, 1.f); Transform::Transform() : position(0.0, 0.0, 0.0), scale(1.0, 1.0, 1.0), rotation(), eulerAngles(0.0, 0.0, 0.0), transMat(1.f), up(Vector3(0.f, 1.f, 0.f)), right(Vector3(1.f, 0.f, 0.f)), forward(Vector3(0.f, 0.f, 1.f)) { updateRotationMatrix(); updateLocal(); } Vector3 Transform::GetPosition() const { return position; } Vector3 Transform::GetRotation() const { return eulerAngles; } Vector3 Transform::GetScale() const { return scale; } void Transform::SetPosition(Vector3 position) { this->position = position; updateLocal(); } void Transform::SetRotation(Vector3 rotation) { this->eulerAngles = rotation; updateRotationMatrix(); updateLocal(); } void Transform::SetScale(Vector3 scale) { this->scale = scale; updateLocal(); } Matrix4 Transform::GetViewMatrix() const { return transMat; } Vector3 Transform::TransformDirection(Vector3 direction) const { Vector4 transDir = transMat * Vector4(direction, 0); return Vector3(transDir.x, transDir.y, transDir.z); } Vector3 Transform::TransformPoint(Vector3 point) const { Vector4 transPt = transMat * Vector4(point, 1); return Vector3(transPt.x, transPt.y, transPt.z); } Vector3 Transform::InverseTransformDirection(Vector3 direction) const { return Vector3(); } Vector3 Transform::InverseTransformPoint(Vector3 point) const { return Vector3(); } void Transform::LookAt(Vector3 target, Vector3 worldUp) { forward = glm::normalize(target - position); right = glm::abs(forward[1]) == 1 ? worldRight : glm::cross(worldUp, forward); up = glm::cross(forward, right); updateLocal(); } void Transform::LookAt(Transform target, Vector3 worldUp) { LookAt(target.position, worldUp); } void Transform::updateLocal() { rotateMat = glm::lookAt(position, position + forward, up); transMat = glm::lookAt(position, position + forward, up); } void Transform::updateRotationMatrix() { rotateMat = glm::toMat4(rotation); } void Transform::updateEulerFromQuat() { eulerAngles = glm::eulerAngles(rotation); } void Transform::updateQuatFromEuler() { rotation = Quaternion(eulerAngles); } void Transform::Rotate(Vector3 eulerAngles) { } void Transform::RotateAround(Vector3 point, Vector3 axis, float angle) { } void Transform::Translate(Vector3 translation) { position += translation; updateLocal(); } }
1330ceeb719fb226dbfd43afd78039cde4905528
077248999b997bf8b4968b8dce1b41115f2333fd
/src/AutoCar/JoyStick.cpp
404f21789466dc7e48f6606a7b6702a0ff09cd52
[]
no_license
xtruong91/autocar
66f7fb4fb608f7ff7f4a19b9ea6aac4038237249
010341323ffe8a4cf6acd79e50b16dd2dfea6b89
refs/heads/master
2022-05-06T02:11:36.013684
2019-07-07T23:35:09
2019-07-07T23:35:09
190,846,775
0
0
null
null
null
null
UTF-8
C++
false
false
717
cpp
JoyStick.cpp
/* * File: JoyStick.cpp * File Created: Saturday, 8th June 2019 * Author: truongtx (truongtx91@gmail.com) * ----- * Description: * Version: 0.1 * Tool: CMake * ----- * Copyright TruongTX */ #include "JoyStick.h" JoyStick::JoyStick(const JoyStickPinConfig& config) : m_config(config) { } RetVal JoyStick::init() { pinMode (m_config.VRxPin, INPUT) ; pinMode (m_config.VRyPin, INPUT) ; pinMode (m_config.SWPin, INPUT) ; } RetVal JoyStick::read(JStickData* data) { if(data == NULL) return RET_FAIL; data->axisX = analogRead (m_config.VRxPin) ; // data->axisY = analogRead (m_config.VRyPin) ; data->sw = analogRead(m_config.SWPin); return RET_SUCCESS; }
9b639f1333909a951304f6f99c09aaf8e3e74931
cbdaac38d2ba16d34152e7c82186856239b2c9e5
/player.cpp
3a33cb482c3befc3cc8572ed962a7fa43dd4e510
[]
no_license
TGrovesy/Games-Computing
93ab35bbb1031eb86c7edc2d376ebf129b6c88c9
569514d2b3fd7c3437d479d462482ad630df18df
refs/heads/main
2023-02-16T19:44:47.814778
2021-01-17T17:12:40
2021-01-17T17:12:40
323,744,871
0
0
null
null
null
null
UTF-8
C++
false
false
1,644
cpp
player.cpp
#include "player.h" Player::Player(dWorldID w, dSpaceID s) : GameObject(w, s), horizontalAngle(0.0f), verticalAngle(0.0f), angularSpeed(2.5f) { SetupCamera(); } Player::~Player(){ } void Player::SetupCamera(){ // Set up the OpenFrameworks camera camera.setGlobalPosition(position.x, position.y, position.z); camera.lookAt(ofVec3f(0,1,0)); camera.setFov(90); camera.setNearClip(0.01f); camera.setFarClip(51000); } void Player::Update(float deltaTime){ //GameObject::Update(deltaTime);//SUPER //Update Camera Pos const dReal* pos = dBodyGetPosition(body); position = ofVec3f(pos[0], pos[1], pos[2]); const dReal newRot[4] = {1, 0, 0, 0}; dBodySetQuaternion(body, newRot);//keep player upright camera.setPosition(position.x, position.y, position.z + (scale.z)); } void Player::SetRotation(ofQuaternion rotation){ GameObject::SetRotation(rotation); camera.setOrientation(rotation); } /* * Rotate Object by amount on axis */ void Player::Rotate(ofVec3f rotationAxis, float amount){ rotation *= glm::angleAxis(glm::radians(amount), glm::vec3(rotationAxis)); //TODO CLAMP VERTICAL AXIS camera.setGlobalOrientation(rotation); } void Player::Draw(){ GameObject::Draw(); } void Player::SetPosition(ofVec3f position){ GameObject::SetPosition(position); camera.setPosition(position.x, position.y, position.z + (scale.z)); } void Player::FrameBegin(){ //background colour ofBackground(20); camera.begin(); ofEnableDepthTest(); ofPushMatrix(); } void Player::FrameEnd(){ ofDisableDepthTest(); camera.end(); ofPopMatrix(); }
dc92da659049c51017faf8229c248bdf9f745e7b
cfeac52f970e8901871bd02d9acb7de66b9fb6b4
/generated/src/aws-cpp-sdk-kinesis/include/aws/kinesis/model/StreamSummary.h
17288d57adbc91a904ecb1946613a7241edd912c
[ "Apache-2.0", "MIT", "JSON" ]
permissive
aws/aws-sdk-cpp
aff116ddf9ca2b41e45c47dba1c2b7754935c585
9a7606a6c98e13c759032c2e920c7c64a6a35264
refs/heads/main
2023-08-25T11:16:55.982089
2023-08-24T18:14:53
2023-08-24T18:14:53
35,440,404
1,681
1,133
Apache-2.0
2023-09-12T15:59:33
2015-05-11T17:57:32
null
UTF-8
C++
false
false
7,055
h
StreamSummary.h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/kinesis/Kinesis_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/kinesis/model/StreamStatus.h> #include <aws/kinesis/model/StreamModeDetails.h> #include <aws/core/utils/DateTime.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace Kinesis { namespace Model { /** * <p>The summary of a stream.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/StreamSummary">AWS * API Reference</a></p> */ class StreamSummary { public: AWS_KINESIS_API StreamSummary(); AWS_KINESIS_API StreamSummary(Aws::Utils::Json::JsonView jsonValue); AWS_KINESIS_API StreamSummary& operator=(Aws::Utils::Json::JsonView jsonValue); AWS_KINESIS_API Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>The name of a stream.</p> */ inline const Aws::String& GetStreamName() const{ return m_streamName; } /** * <p>The name of a stream.</p> */ inline bool StreamNameHasBeenSet() const { return m_streamNameHasBeenSet; } /** * <p>The name of a stream.</p> */ inline void SetStreamName(const Aws::String& value) { m_streamNameHasBeenSet = true; m_streamName = value; } /** * <p>The name of a stream.</p> */ inline void SetStreamName(Aws::String&& value) { m_streamNameHasBeenSet = true; m_streamName = std::move(value); } /** * <p>The name of a stream.</p> */ inline void SetStreamName(const char* value) { m_streamNameHasBeenSet = true; m_streamName.assign(value); } /** * <p>The name of a stream.</p> */ inline StreamSummary& WithStreamName(const Aws::String& value) { SetStreamName(value); return *this;} /** * <p>The name of a stream.</p> */ inline StreamSummary& WithStreamName(Aws::String&& value) { SetStreamName(std::move(value)); return *this;} /** * <p>The name of a stream.</p> */ inline StreamSummary& WithStreamName(const char* value) { SetStreamName(value); return *this;} /** * <p>The ARN of the stream.</p> */ inline const Aws::String& GetStreamARN() const{ return m_streamARN; } /** * <p>The ARN of the stream.</p> */ inline bool StreamARNHasBeenSet() const { return m_streamARNHasBeenSet; } /** * <p>The ARN of the stream.</p> */ inline void SetStreamARN(const Aws::String& value) { m_streamARNHasBeenSet = true; m_streamARN = value; } /** * <p>The ARN of the stream.</p> */ inline void SetStreamARN(Aws::String&& value) { m_streamARNHasBeenSet = true; m_streamARN = std::move(value); } /** * <p>The ARN of the stream.</p> */ inline void SetStreamARN(const char* value) { m_streamARNHasBeenSet = true; m_streamARN.assign(value); } /** * <p>The ARN of the stream.</p> */ inline StreamSummary& WithStreamARN(const Aws::String& value) { SetStreamARN(value); return *this;} /** * <p>The ARN of the stream.</p> */ inline StreamSummary& WithStreamARN(Aws::String&& value) { SetStreamARN(std::move(value)); return *this;} /** * <p>The ARN of the stream.</p> */ inline StreamSummary& WithStreamARN(const char* value) { SetStreamARN(value); return *this;} /** * <p>The status of the stream.</p> */ inline const StreamStatus& GetStreamStatus() const{ return m_streamStatus; } /** * <p>The status of the stream.</p> */ inline bool StreamStatusHasBeenSet() const { return m_streamStatusHasBeenSet; } /** * <p>The status of the stream.</p> */ inline void SetStreamStatus(const StreamStatus& value) { m_streamStatusHasBeenSet = true; m_streamStatus = value; } /** * <p>The status of the stream.</p> */ inline void SetStreamStatus(StreamStatus&& value) { m_streamStatusHasBeenSet = true; m_streamStatus = std::move(value); } /** * <p>The status of the stream.</p> */ inline StreamSummary& WithStreamStatus(const StreamStatus& value) { SetStreamStatus(value); return *this;} /** * <p>The status of the stream.</p> */ inline StreamSummary& WithStreamStatus(StreamStatus&& value) { SetStreamStatus(std::move(value)); return *this;} inline const StreamModeDetails& GetStreamModeDetails() const{ return m_streamModeDetails; } inline bool StreamModeDetailsHasBeenSet() const { return m_streamModeDetailsHasBeenSet; } inline void SetStreamModeDetails(const StreamModeDetails& value) { m_streamModeDetailsHasBeenSet = true; m_streamModeDetails = value; } inline void SetStreamModeDetails(StreamModeDetails&& value) { m_streamModeDetailsHasBeenSet = true; m_streamModeDetails = std::move(value); } inline StreamSummary& WithStreamModeDetails(const StreamModeDetails& value) { SetStreamModeDetails(value); return *this;} inline StreamSummary& WithStreamModeDetails(StreamModeDetails&& value) { SetStreamModeDetails(std::move(value)); return *this;} /** * <p>The timestamp at which the stream was created.</p> */ inline const Aws::Utils::DateTime& GetStreamCreationTimestamp() const{ return m_streamCreationTimestamp; } /** * <p>The timestamp at which the stream was created.</p> */ inline bool StreamCreationTimestampHasBeenSet() const { return m_streamCreationTimestampHasBeenSet; } /** * <p>The timestamp at which the stream was created.</p> */ inline void SetStreamCreationTimestamp(const Aws::Utils::DateTime& value) { m_streamCreationTimestampHasBeenSet = true; m_streamCreationTimestamp = value; } /** * <p>The timestamp at which the stream was created.</p> */ inline void SetStreamCreationTimestamp(Aws::Utils::DateTime&& value) { m_streamCreationTimestampHasBeenSet = true; m_streamCreationTimestamp = std::move(value); } /** * <p>The timestamp at which the stream was created.</p> */ inline StreamSummary& WithStreamCreationTimestamp(const Aws::Utils::DateTime& value) { SetStreamCreationTimestamp(value); return *this;} /** * <p>The timestamp at which the stream was created.</p> */ inline StreamSummary& WithStreamCreationTimestamp(Aws::Utils::DateTime&& value) { SetStreamCreationTimestamp(std::move(value)); return *this;} private: Aws::String m_streamName; bool m_streamNameHasBeenSet = false; Aws::String m_streamARN; bool m_streamARNHasBeenSet = false; StreamStatus m_streamStatus; bool m_streamStatusHasBeenSet = false; StreamModeDetails m_streamModeDetails; bool m_streamModeDetailsHasBeenSet = false; Aws::Utils::DateTime m_streamCreationTimestamp; bool m_streamCreationTimestampHasBeenSet = false; }; } // namespace Model } // namespace Kinesis } // namespace Aws
98cb599d60c65fdd716752b0a04936470b343de7
20997effd7b2ef823c8bbe8233d32e05efe72aa7
/GameMode.cpp
20b890211ba1e734f7d04ffbd211c656df9ff42e
[]
no_license
CalLavicka/portals
1579b3bfec5a83b063f9e04d3fb57894fe69188f
41c273818beabef38c8f6d0fbe70cd7eafb42f31
refs/heads/master
2020-03-31T22:46:36.003527
2018-12-07T00:59:56
2018-12-07T00:59:56
152,630,999
0
1
null
null
null
null
UTF-8
C++
false
false
33,970
cpp
GameMode.cpp
#include "GameMode.hpp" #include "MenuMode.hpp" #include "Load.hpp" #include "MeshBuffer.hpp" #include "Save.hpp" #include "Scene.hpp" #include "gl_errors.hpp" //helper for dumpping OpenGL error messages #include "check_fb.hpp" //helper for checking currently bound OpenGL framebuffer #include "read_chunk.hpp" //helper for reading a vector of structures from a file #include "data_path.hpp" //helper to get paths relative to executable #include "compile_program.hpp" //helper to compile opengl shader programs #include "draw_text.hpp" //helper to... um.. draw text #include "load_save_png.hpp" #include "texture_program.hpp" #include "depth_program.hpp" #include "BasicLevel.hpp" #include "GarnishLevel.hpp" #include "OvenLevel.hpp" #include "MenuLevel.hpp" #include <glm/gtc/type_ptr.hpp> #include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective #include <iostream> #include <fstream> #include <map> #include <cstddef> #include <random> #define NUM_CLIPPING_VERTS 20 using namespace glm; Load< MeshBuffer > meshes(LoadTagDefault, [](){ return new MeshBuffer(data_path("vignette.pnct")); }); Load< GLuint > meshes_for_texture_program(LoadTagDefault, [](){ return new GLuint(meshes->make_vao_for_program(texture_program->program)); }); Load< GLuint > meshes_for_depth_program(LoadTagDefault, [](){ return new GLuint(meshes->make_vao_for_program(depth_program->program)); }); Load< MeshBuffer > vegetable_meshes(LoadTagDefault, [](){ return new MeshBuffer(data_path("vegetables.pnct")); }); Load< GLuint > vegetable_meshes_for_texture_program(LoadTagDefault, [](){ return new GLuint(vegetable_meshes->make_vao_for_program(texture_program->program)); }); Load< GLuint > vegetable_meshes_for_depth_program(LoadTagDefault, [](){ return new GLuint(vegetable_meshes->make_vao_for_program(depth_program->program)); }); //used for fullscreen passes: Load< GLuint > empty_vao(LoadTagDefault, [](){ GLuint vao = 0; glGenVertexArrays(1, &vao); glBindVertexArray(vao); glBindVertexArray(0); return new GLuint(vao); }); Load< GLuint > blur_program(LoadTagDefault, [](){ GLuint program = compile_program( //this draws a triangle that covers the entire screen: "#version 330\n" "void main() {\n" " gl_Position = vec4(4 * (gl_VertexID & 1) - 1, 2 * (gl_VertexID & 2) - 1, 0.0, 1.0);\n" "}\n" , //NOTE on reading screen texture: //texelFetch() gives direct pixel access with integer coordinates, but accessing out-of-bounds pixel is undefined: // vec4 color = texelFetch(tex, ivec2(gl_FragCoord.xy), 0); //texture() requires using [0,1] coordinates, but handles out-of-bounds more gracefully (using wrap settings of underlying texture): // vec4 color = texture(tex, gl_FragCoord.xy / textureSize(tex,0)); "#version 330\n" "uniform sampler2D color_tex;\n" "uniform sampler2D bloom_tex;\n" "out vec4 fragColor;\n" "void main() {\n" " vec2 at = (gl_FragCoord.xy - 0.5 * textureSize(bloom_tex, 0)) / textureSize(bloom_tex, 0).y;\n" //make blur amount more near the edges and less in the middle: " float amt = 10;\n"//(0.01 * textureSize(bloom_tex,0).y) * max(0.0,(length(at) - 0.3)/0.2);\n" //pick a vector to move in for blur using function inspired by: //https://stackoverflow.com/questions/12964279/whats-the-origin-of-this-glsl-rand-one-liner " vec2 ofs = amt * normalize(vec2(\n" " fract(dot(gl_FragCoord.xy ,vec2(12.9898,78.233))),\n" " fract(dot(gl_FragCoord.xy ,vec2(96.3869,-27.5796)))\n" " ));\n" //do a four-pixel average to blur: " vec4 blur =\n" " + 0.25 * texture(bloom_tex, (gl_FragCoord.xy + vec2(ofs.x,ofs.y)) / textureSize(bloom_tex, 0))\n" " + 0.25 * texture(bloom_tex, (gl_FragCoord.xy + vec2(-ofs.y,ofs.x)) / textureSize(bloom_tex, 0))\n" " + 0.25 * texture(bloom_tex, (gl_FragCoord.xy + vec2(-ofs.x,-ofs.y)) / textureSize(bloom_tex, 0))\n" " + 0.25 * texture(bloom_tex, (gl_FragCoord.xy + vec2(ofs.y,-ofs.x)) / textureSize(bloom_tex, 0))\n" " ;\n" " vec4 fragColor1 = texture(color_tex, (gl_FragCoord.xy) / textureSize(color_tex, 0));\n" " fragColor = fragColor1 + 0.7f*vec4(blur.rgb, 1.0);\n" //blur;\n" // " fragColor = texelFetch(bloom_tex, ivec2(gl_FragCoord.xy), 0);\n" "}\n" ); glUseProgram(program); glUniform1i(glGetUniformLocation(program, "color_tex"), 0); glUniform1i(glGetUniformLocation(program, "bloom_tex"), 1); glUseProgram(0); return new GLuint(program); }); Load< GLuint > portal_depth_program(LoadTagDefault, [](){ GLuint program = compile_program( //this draws a triangle that covers the entire screen: "#version 330\n" "uniform vec2 portalNorm;\n" "uniform mat4 mv;\n" "uniform mat4 cam_scale;\n" "void main() {\n" //" gl_Position = vec4(4 * (gl_VertexID & 1) - 1, 2 * (gl_VertexID & 2) - 1, -1.0, 1.0);\n" " if (gl_VertexID < 4) {\n" // Clipping plane 1 (through portal) " vec4 pt = vec4(100000 * (2 * (gl_VertexID & 1) - 1), 0.0, 100000 * ((gl_VertexID & 2) - 1), 1.0);\n" " gl_Position = cam_scale * mv * pt;\n" " } else {\n" " int idx = gl_VertexID - 4;\n" " vec2 pt = vec2(mv * vec4(0.0, 0.0, 0.0, 1.0)) - portalNorm * 2.5;\n" " vec2 par = vec2(-portalNorm.y, portalNorm.x) * 1000.0;\n" " vec2 norm = portalNorm * 1000.0;\n" " pt = pt - norm * (idx & 1) + par * ((idx & 2) - 1);\n" " gl_Position = cam_scale * vec4(pt, -1.0, 1.0);\n" " gl_Position.z = -1.0;\n" " }\n" "}\n" , "#version 330\n" "out vec4 fragColor;\n" "void main() {\n" " fragColor = vec4(0.0, 1.0, 0.0, 0.0);\n" "}\n" ); return new GLuint(program); }); GLuint load_texture(std::string const &filename) { glm::uvec2 size; std::vector< glm::u8vec4 > data; load_png(filename, &size, &data, LowerLeftOrigin); GLuint tex = 0; glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size.x, size.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, data.data()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glGenerateMipmap(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, 0); GL_ERRORS(); return tex; } Load< GLuint > wood_tex(LoadTagDefault, [](){ return new GLuint(load_texture(data_path("textures/wood.png"))); }); Load< GLuint > marble_tex(LoadTagDefault, [](){ return new GLuint(load_texture(data_path("textures/marble.png"))); }); Load< GLuint > kitchen_tex(LoadTagDefault, [](){ return new GLuint(load_texture(data_path("textures/kitchen.png"))); }); Load< GLuint > darkkitchen_tex(LoadTagDefault, [](){ return new GLuint(load_texture(data_path("textures/darkkitchen.png"))); }); Load< GLuint > white_tex(LoadTagDefault, [](){ GLuint tex = 0; glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glm::u8vec4 white(0xff, 0xff, 0xff, 0xff); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, glm::value_ptr(white)); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBindTexture(GL_TEXTURE_2D, 0); return new GLuint(tex); }); Scene::Transform *p0_trans = nullptr; Scene::Transform *p1_trans = nullptr; void GameMode::load_scene() { { // Initialize random gen std::random_device r; std::seed_seq seed{r(), r(), r(), r(), r(), r(), r(), r()}; std::mt19937 rnd{seed}; random_gen = rnd; } if (scene != nullptr) { delete scene; foods.clear(); pots.clear(); } Scene *ret = new Scene(); //pre-build some program info (material) blocks to assign to each object: Scene::Object::ProgramInfo texture_program_info; texture_program_info.program = texture_program->program; texture_program_info.vao = *meshes_for_texture_program; texture_program_info.mvp_mat4 = texture_program->object_to_clip_mat4; texture_program_info.mv_mat4x3 = texture_program->object_to_light_mat4x3; texture_program_info.itmv_mat3 = texture_program->normal_to_light_mat3; texture_program_info.set_uniforms = [](){ glUniform1f(texture_program->glow_amt_float, 0.0f); }; texture_program_info.textures[0] = *white_tex; Scene::Object::ProgramInfo portal_program_info = texture_program_info; portal_program_info.set_uniforms = [](){ glUniform1f(texture_program->glow_amt_float, 1.0f); }; Scene::Object::ProgramInfo depth_program_info; depth_program_info.program = depth_program->program; depth_program_info.vao = *meshes_for_depth_program; depth_program_info.mvp_mat4 = depth_program->object_to_clip_mat4; // Adjust for veges texture_program_info.vao = *vegetable_meshes_for_texture_program; portal_program_info.vao = *vegetable_meshes_for_texture_program; depth_program_info.vao = *vegetable_meshes_for_depth_program; // Add in portal p0_trans = ret->new_transform(); p1_trans = ret->new_transform(); { // Portal 1 Scene::Object *obj = ret->new_object(p0_trans); obj->programs[Scene::Object::ProgramTypeDefault] = portal_program_info; obj->programs[Scene::Object::ProgramTypeShadow] = depth_program_info; MeshBuffer::Mesh const &mesh = vegetable_meshes->lookup("Portal1"); obj->programs[Scene::Object::ProgramTypeDefault].start = mesh.start; obj->programs[Scene::Object::ProgramTypeDefault].count = mesh.count; obj->programs[Scene::Object::ProgramTypeShadow].start = mesh.start; obj->programs[Scene::Object::ProgramTypeShadow].count = mesh.count; } { // Portal 2 Scene::Object *obj = ret->new_object(p1_trans); obj->programs[Scene::Object::ProgramTypeDefault] = portal_program_info; obj->programs[Scene::Object::ProgramTypeShadow] = depth_program_info; MeshBuffer::Mesh const &mesh = vegetable_meshes->lookup("Portal2"); obj->programs[Scene::Object::ProgramTypeDefault].start = mesh.start; obj->programs[Scene::Object::ProgramTypeDefault].count = mesh.count; obj->programs[Scene::Object::ProgramTypeShadow].start = mesh.start; obj->programs[Scene::Object::ProgramTypeShadow].count = mesh.count; } players[0].portal_transform = p0_trans; players[1].portal_transform = p1_trans; players[0].move_to(vec2(-10,0)); players[1].move_to(vec2(10,0)); players[0].rotate_to(vec2(0,1)); players[1].rotate_to(vec2(0,1)); Scene::Transform *cam_trans = ret->new_transform(); camera = ret->new_camera(cam_trans); camera->is_perspective = false; camera->ortho_scale = 50.f; camera->near = 1.f; cam_trans->position = glm::vec3(0,0,25); cam_trans->rotation = glm::angleAxis(glm::radians(0.f), glm::vec3(1.0f, 0.0f, 0.0f)); scene = ret; switch(level) { case 0: // current_level = new BasicLevel(this, texture_program_info, depth_program_info); current_level = std::make_shared< BasicLevel >(this, texture_program_info, depth_program_info); scores[0] = 50; break; case 1: // current_level = new OvenLevel(this, texture_program_info, depth_program_info); current_level = std::make_shared< OvenLevel >(this, texture_program_info, depth_program_info); scores[1] = 0; break; case 2: // current_level = new GarnishLevel(this, texture_program_info, // depth_program_info); current_level = std::make_shared< GarnishLevel>(this, texture_program_info, depth_program_info); scores[2] = 100; break; default: // current_level = new MenuLevel(this, texture_program_info, depth_program_info); current_level = std::make_shared< MenuLevel >(this, texture_program_info, depth_program_info); show_level_select(); break; } paused = false; } GameMode::GameMode() { //load_scene(); //SDL_SetRelativeMouseMode(SDL_TRUE); SaveData res = LoadSave(1); if(res.personalBests.size() >= 3) { high_scores = res.personalBests; } } GameMode::~GameMode() { } bool GameMode::handle_event(SDL_Event const &evt, glm::uvec2 const &window_size) { //ignore any keys that are the result of automatic key repeat: if (evt.type == SDL_KEYDOWN && evt.key.repeat) { return false; } if(evt.type == SDL_KEYDOWN){ //TODO add specification for which save state if(evt.key.keysym.scancode == SDL_SCANCODE_SPACE){ show_pause_menu(); }else if(evt.key.keysym.scancode == SDL_SCANCODE_ESCAPE){ SDL_SetRelativeMouseMode(SDL_FALSE); } else if (evt.key.keysym.scancode == SDL_SCANCODE_P) { SDL_SetRelativeMouseMode(SDL_TRUE); } } return false; } bool GameMode::handle_mouse_event(ManyMouseEvent const &event, glm::uvec2 const &window_size) { if (event.device >= 2) { return false; } // printf("TYPE: %d, VALUE: %d, ITEM: %d, DEVICE: %d\n", event.type, event.value, event.item, event.device); Portal &portal = players[event.device]; float &rot_speed = rot_speeds[event.device]; float sensitivity = sensitivities[event.device]; if (event.type == MANYMOUSE_EVENT_RELMOTION) { if (event.item == 0) { portal.move(glm::vec2(sensitivity * event.value / window_size.x, 0)); return true; } else if (event.item == 1) { portal.move(glm::vec2(0, -sensitivity * event.value / window_size.y)); return true; } }else if (event.type == MANYMOUSE_EVENT_BUTTON) { if (event.value == 0) { rot_speed = 0; return true; } else if (event.item == 0) { rot_speed = 3; return true; } else if (event.item == 1) { rot_speed = -3; return true; } } return false; } void GameMode::update(float elapsed) { if (paused) return; { // Update portals players[0].update(elapsed); players[1].update(elapsed); } current_level->update(elapsed); players[0].rotate(elapsed * rot_speeds[0]); players[1].rotate(elapsed * rot_speeds[1]); auto update_vicinity = [](Scene::Object *obj, Portal &p, Portal &op) { if (obj->portal_in == &op) { obj->portal_in->vicinity.erase(obj); } obj->portal_in = &p; p.vicinity.insert(obj); }; for(auto iter = foods.begin(); iter != foods.end();) { Scene::Transform *food_transform = (*iter)->transform; { // teleport / see if in a portal float threshold = std::max(players[0].boundingbox->width, players[0].boundingbox->thickness) + std::max(food_transform->boundingbox->width, food_transform->boundingbox->thickness); bool updated = false; if (glm::distance(players[0].portal_transform->position, food_transform->position) < threshold) { if (players[0].should_teleport(*iter)) { teleport(food_transform, 1); // GameMode::teleport(object, destination_portal) update_vicinity(*iter, players[1], players[0]); updated = true; } else if (players[0].should_bounce(*iter)) { food_transform->speed -= 1.8f*glm::dot(food_transform->speed, players[0].normal)*players[0].normal; food_transform->position -= vec3(glm::dot(vec2(food_transform->position) - players[0].position, players[0].normal)*players[0].normal,0); }else if (players[0].is_in_vicinity(food_transform)) { update_vicinity(*iter, players[0], players[1]); updated = true; } } if (!updated && glm::distance(players[1].portal_transform->position, food_transform->position) < threshold) { if (players[1].should_teleport(*iter)) { teleport(food_transform, 0); // GameMode::teleport(object, destination_portal) update_vicinity(*iter, players[0], players[1]); updated = true; } else if (players[1].should_bounce(*iter)) { //credit to this for how to physics //https://gamedev.stackexchange.com/questions/23672/determine-resulting-angle-of-wall-collision/23674 food_transform->speed -= 1.8f*glm::dot(food_transform->speed, players[1].normal)*players[1].normal; food_transform->position -= vec3(glm::dot(vec2(food_transform->position) - players[1].position, players[1].normal)*players[1].normal,0); } else if (players[1].is_in_vicinity(food_transform)) { update_vicinity(*iter, players[1], players[0]); updated = true; } } if (!updated) { if((*iter)->portal_in != nullptr) { (*iter)->portal_in->vicinity.erase(*iter); (*iter)->portal_in = nullptr; } } } { // update vegetbale speed, position, and boundingbox float g = -9.81f; food_transform->speed.y += g * elapsed; food_transform->speed.y = std::max(-200.0f, food_transform->speed.y); // speed limit on cube food_transform->position.x += food_transform->speed.x * elapsed; food_transform->position.y += food_transform->speed.y * elapsed; food_transform->boundingbox->update_origin(food_transform->position); if (food_transform->position.y >= 50.f && food_transform->speed.y > 0.f) { food_transform->speed.x /= 10.f; food_transform->speed.y /= -10.f; } if (food_transform->position.x >= 70.f && food_transform->speed.x > 0.f) { food_transform->speed.x = -food_transform->speed.x / 2.f; } else if (food_transform->position.x <= -70.f && food_transform->speed.x < 0.f) { food_transform->speed.x = -food_transform->speed.x / 2.f; } } bool collided = false; for(Scene::Object * pot : pots) { // TODO: Check for collision with pot with bounding boxes if(food_transform->position.y < -38.f && food_transform->position.x > pot->transform->position.x - 10.f && food_transform->position.x < pot->transform->position.x + 10.f) { collided = current_level->collision(*iter, pot); if (collided) break; } } if(collided) { scene->delete_transform(food_transform); scene->delete_object(*iter); auto temp = iter; ++iter; foods.erase(temp); continue; } if (food_transform->position.y < -60.f) { // OFF THE TABLE printf("Food fell off...\n"); current_level->fall_off(*iter); scene->delete_transform(food_transform); scene->delete_object(*iter); auto temp = iter; ++iter; foods.erase(temp); continue; } ++iter; } } //GameMode will render to some offscreen framebuffer(s). //This code allocates and resizes them as needed: struct Framebuffers { glm::uvec2 size = glm::uvec2(0,0); //remember the size of the framebuffer //This framebuffer is used for fullscreen effects: GLuint color_tex = 0; GLuint depth_rb = 0; GLuint fb = 0; //This framebuffer is used for bloom effects: GLuint bloom_color_tex = 0; GLuint bloom_fb = 0; //This framebuffer is used for shadow maps: glm::uvec2 shadow_size = glm::uvec2(0,0); GLuint shadow_color_tex = 0; //DEBUG GLuint shadow_depth_tex = 0; GLuint shadow_fb = 0; void allocate(glm::uvec2 const &new_size, glm::uvec2 const &new_shadow_size) { //allocate full-screen framebuffer: if (size != new_size) { size = new_size; if (color_tex == 0) glGenTextures(1, &color_tex); glBindTexture(GL_TEXTURE_2D, color_tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size.x, size.y, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBindTexture(GL_TEXTURE_2D, 0); if (bloom_color_tex == 0) glGenTextures(1, &bloom_color_tex); glBindTexture(GL_TEXTURE_2D, bloom_color_tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size.x, size.y, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBindTexture(GL_TEXTURE_2D, 0); if (depth_rb == 0) glGenRenderbuffers(1, &depth_rb); glBindRenderbuffer(GL_RENDERBUFFER, depth_rb); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, size.x, size.y); glBindRenderbuffer(GL_RENDERBUFFER, 0); if (fb == 0) glGenFramebuffers(1, &fb); glBindFramebuffer(GL_FRAMEBUFFER, fb); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_tex, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, bloom_color_tex, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth_rb); GLenum bufs[2] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1}; glDrawBuffers(2, bufs); check_fb(); glBindFramebuffer(GL_FRAMEBUFFER, 0); if (bloom_fb == 0) glGenFramebuffers(1, &bloom_fb); glBindFramebuffer(GL_FRAMEBUFFER, bloom_fb); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, bloom_color_tex, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth_rb); check_fb(); glBindFramebuffer(GL_FRAMEBUFFER, 0); GL_ERRORS(); } //allocate shadow map framebuffer: if (shadow_size != new_shadow_size) { shadow_size = new_shadow_size; if (shadow_color_tex == 0) glGenTextures(1, &shadow_color_tex); glBindTexture(GL_TEXTURE_2D, shadow_color_tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, shadow_size.x, shadow_size.y, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBindTexture(GL_TEXTURE_2D, 0); if (shadow_depth_tex == 0) glGenTextures(1, &shadow_depth_tex); glBindTexture(GL_TEXTURE_2D, shadow_depth_tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, shadow_size.x, shadow_size.y, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBindTexture(GL_TEXTURE_2D, 0); if (shadow_fb == 0) glGenFramebuffers(1, &shadow_fb); glBindFramebuffer(GL_FRAMEBUFFER, shadow_fb); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, shadow_color_tex, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadow_depth_tex, 0); check_fb(); glBindFramebuffer(GL_FRAMEBUFFER, 0); GL_ERRORS(); } } } fbs; void GameMode::draw(glm::uvec2 const &drawable_size) { fbs.allocate(drawable_size, glm::uvec2(512, 512)); camera->aspect = drawable_size.x / float(drawable_size.y); glViewport(0,0,drawable_size.x, drawable_size.y); glBindFramebuffer(GL_FRAMEBUFFER, fbs.fb); GLfloat black[4] = {0.0f, 0.0f, 0.0f, 0.0f}; glClearBufferfv(GL_COLOR, 0, black); glClearBufferfv(GL_COLOR, 1, black); glClear(GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Draw once for ambient light glUseProgram(texture_program->program); //don't use distant directional light at all (color == 0): glUniform3fv(texture_program->sun_color_vec3, 1, glm::value_ptr(glm::vec3(0.0f, 0.0f, 0.0f))); glUniform3fv(texture_program->sun_direction_vec3, 1, glm::value_ptr(glm::normalize(glm::vec3(0.0f, 0.0f,-1.0f)))); //little bit of ambient light: glUniform3fv(texture_program->sky_color_vec3, 1, glm::value_ptr(glm::vec3(1.f,1.f,1.f))); glUniform3fv(texture_program->sky_direction_vec3, 1, glm::value_ptr(glm::vec3(0.0f, 0.0f, 1.0f))); glUniform3fv(texture_program->spot_color_vec3, 1, glm::value_ptr(glm::vec3(0.0f, 0.0f, 0.0f))); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, 0); glActiveTexture(GL_TEXTURE0); // Draw non-portalled things scene->draw(camera, Scene::Object::ProgramTypeDefault, nullptr); auto draw_portal = [this](Portal &p) { glUseProgram(*portal_depth_program); glBindVertexArray(*empty_vao); //glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); glClear(GL_DEPTH_BUFFER_BIT); static GLuint portal_norm = glGetUniformLocation(*portal_depth_program, "portalNorm"); static GLuint mv_mat4 = glGetUniformLocation(*portal_depth_program, "mv"); static GLuint cam_scale_mat4 = glGetUniformLocation(*portal_depth_program, "cam_scale"); glm::mat4 mv = p.portal_transform->make_local_to_world(); glm::mat4 cam_scale = camera->make_projection() * camera->transform->make_world_to_local(); //glm::vec2 pt = glm::vec2(mvp * glm::vec4(players[0].position, 0, 1)); glUniformMatrix4fv(mv_mat4, 1, GL_FALSE, glm::value_ptr(mv)); glUniformMatrix4fv(cam_scale_mat4, 1, GL_FALSE, glm::value_ptr(cam_scale)); glUniform2f(portal_norm, p.normal.x, p.normal.y); //printf("%f, %f\n", p.normal.x, p.normal.y); // Draw portal blocker glDrawArrays(GL_TRIANGLE_STRIP, 4, 4); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); // Draw portalled things scene->draw(camera, Scene::Object::ProgramTypeDefault, &p); }; { // Move everthing from portal 1 to portal 0, then render from portal 0 for(Scene::Object * obj : players[1].vicinity) { teleport(obj->transform, 0, false); obj->portal_in = &players[0]; } draw_portal(players[0]); } { // Move everything to portal 1 now and draw from there, then move to og for(Scene::Object * obj : players[0].vicinity) { teleport(obj->transform, 1, false); obj->portal_in = &players[1]; } for(Scene::Object * obj : players[1].vicinity) { teleport(obj->transform, 1, false); obj->portal_in = &players[1]; } draw_portal(players[1]); for(Scene::Object * obj : players[0].vicinity) { teleport(obj->transform, 0, false); obj->portal_in = &players[0]; } } // extra rendering from level? glUseProgram(texture_program->program); current_level->render_pass(); if (level < 3) { glDisable(GL_DEPTH_TEST); { // draw score std::string message = "SCORE "+std::to_string(scores[level]); float height = 0.05f; float width = text_width(message, height); draw_text(message, glm::vec2( 1.4f - width, 0.85f), height, glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)); } { // draw high score std::string message = "HIGH SCORE "+std::to_string(high_scores[level]); float height = 0.05f; //float width = text_width(message, height); draw_text(message, glm::vec2( -1.4f, 0.85f), height, glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)); } glEnable(GL_DEPTH_TEST); } GL_ERRORS(); //Copy scene from color buffer to screen, performing post-processing effects: glDisable(GL_DEPTH_TEST); glDisable(GL_BLEND); glBindFramebuffer(GL_FRAMEBUFFER, 0); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, fbs.color_tex); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, fbs.bloom_color_tex); glBindVertexArray(*empty_vao); glUseProgram(*blur_program); glDrawArrays(GL_TRIANGLES, 0, 3); glUseProgram(0); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, 0); } void GameMode::teleport(Scene::Transform *object_transform, const uint32_t to_portal_id, bool update_speed) { const Portal &from_portal = players[!to_portal_id]; const Portal & to_portal = players[ to_portal_id]; { // compute new position and speed // find angle between from_portal_normal and to_portal_normal (phi) // from_portal_normal and -object_speed (theta) const glm::vec2 &from_normal = from_portal.normal; const glm::vec2 & to_normal = to_portal.normal; //object_transform->speed *= -1.0f; // reverse speed /* auto angle_between = [=] (glm::vec2 from, glm::vec2 to) -> float { from = glm::normalize(from); to = glm::normalize(to); float sign = (from.x*to.y - from.y*to.x > 0.0f) ? 1.0f : -1.0f; return sign * std::acos(glm::dot(from, to)); }; float phi = angle_between(from_normal, to_normal); float theta = angle_between(from_normal, object_transform->speed); */ // rotate position by phi /* glm::mat4 pos_rotation = glm::rotate(glm::mat4(1.f), phi, glm::vec3(0.0f, 0.0f, 1.0f)); auto pos_diff = glm::vec2(object_transform->position) - from_portal.position; auto rotated_pos_diff = glm::vec2(pos_rotation * glm::vec4(pos_diff, 0.0f, 1.0f)); object_transform->position = glm::vec3(to_portal.position + rotated_pos_diff, 0.0f); */ // Instead, compute position along normal/parallel vec2 from_par = vec2(-from_normal.y, from_normal.x); vec2 to_par = vec2(-to_normal.y, to_normal.x); vec2 pos_diff = glm::vec2(object_transform->position) - from_portal.position; float norm_diff = glm::dot(pos_diff, from_normal); float par_diff = glm::dot(pos_diff, from_par); // new position along new normal and parallel, in opposite direction vec2 rotated_pos_diff = -norm_diff * to_normal - par_diff * to_par; object_transform->position = glm::vec3(to_portal.position + rotated_pos_diff, 0.0f); // Rotate object to opposite new normal float angle = atan2(-from_normal.x * to_normal.y + from_normal.y * to_normal.x, glm::dot(-to_normal, from_normal)); object_transform->rotation = angleAxis(angle, vec3(0,0,1)) * object_transform->rotation; if (update_speed) { // rotate speed by phi - 2*theta /* glm::mat4 speed_rotation = glm::rotate(glm::mat4(1.f), phi - 2.0f*theta, glm::vec3(0.0f, 0.0f, 1.0f)); auto new_speed = glm::vec2(speed_rotation * glm::vec4(object_transform->speed, 0.0f, 1.0f)); // boost if new_speed is too slow float speed_lowerbound = 5.0f; object_transform->speed = (glm::length(new_speed) < speed_lowerbound) ? speed_lowerbound * glm::normalize(object_transform->speed) : new_speed; */ // Instead, compute speed along normal/parallel vec2 old_speed = object_transform->speed - from_portal.speed; float norm_spd = glm::dot(old_speed, from_normal);// - glm::dot(from_portal.speed, from_normal); float par_spd = glm::dot(old_speed, from_par);// - glm::dot(from_portal.speed, from_par); // If too slow along normal, give boost //if(norm_spd > -3.f) norm_spd = -3.f; // new speed along new normal and parallel, in opposite direction vec2 new_speed = -norm_spd * to_normal - par_spd * to_par; object_transform->speed = new_speed + to_portal.speed; } } // update bbx object_transform->boundingbox->update_origin(object_transform->position); } void GameMode::show_pause_menu() { std::shared_ptr< MenuMode > menu = std::make_shared< MenuMode >(); std::shared_ptr< Mode > game = shared_from_this(); //menu->background = game; menu->choices.emplace_back("PAUSED"); menu->choices.emplace_back("SAVE STATE 1", [game, this](){ save(1,level, scores); Mode::set_current(game); }); menu->choices.emplace_back("SAVE STATE 2", [game, this](){ save(2,level, scores); Mode::set_current(game); }); menu->choices.emplace_back("SAVE STATE 3", [game, this](){ save(3,level, scores); Mode::set_current(game); }); menu->choices.emplace_back("LOAD STATE 1", [game, this](){ SaveData res = LoadSave(1); level = res.currentLevel; scores = res.personalBests; Mode::set_current(game); }); menu->choices.emplace_back("LOAD STATE 2", [game, this](){ SaveData res = LoadSave(2); level = res.currentLevel; scores = res.personalBests; Mode::set_current(game); }); menu->choices.emplace_back("LOAD STATE 3", [game, this](){ SaveData res = LoadSave(3); level = res.currentLevel; scores = res.personalBests; Mode::set_current(game); }); menu->choices.emplace_back("QUIT", [](){ Mode::set_current(nullptr); }); menu->selected = 1; Mode::set_current(menu); } void GameMode::save_game() { if (scores[level] > high_scores[level]) { high_scores[level] = scores[level]; } save(1, level, high_scores); } void GameMode::show_lose() { save_game(); std::shared_ptr< MenuMode > menu = std::make_shared< MenuMode >(); std::shared_ptr< Mode > game = shared_from_this(); menu->background = game; menu->choices.emplace_back("GAME OVER"); menu->choices.emplace_back("RESTAURANT BANKRUPT"); menu->choices.emplace_back("RETRY", [this, game]() { this->load_scene(); Mode::set_current(game); }); menu->choices.emplace_back("QUIT", [](){ Mode::set_current(nullptr); }); menu->selected = 2; paused = true; Mode::set_current(menu); } void GameMode::show_win() { save_game(); std::shared_ptr< MenuMode > menu = std::make_shared< MenuMode >(); std::shared_ptr< Mode > game = shared_from_this(); menu->background = game; menu->choices.emplace_back("LEVEL PASSED"); menu->choices.emplace_back("CONTINUE", [this, game](){ level++; this->load_scene(); Mode::set_current(game); }); menu->selected = 1; paused = true; Mode::set_current(menu); } void GameMode::show_level_select() { save_game(); std::shared_ptr< MenuMode > menu = std::make_shared< MenuMode >(); std::shared_ptr< Mode > game = shared_from_this(); menu->background = game; menu->choices.emplace_back("SELECT LEVEL"); menu->choices.emplace_back("VEGETABLES", [this, game](){ SDL_SetRelativeMouseMode(SDL_TRUE); level = 0; this->load_scene(); Mode::set_current(game); }); menu->choices.emplace_back("OVEN", [this, game](){ SDL_SetRelativeMouseMode(SDL_TRUE); level = 1; this->load_scene(); Mode::set_current(game); }); menu->choices.emplace_back("SPICEY", [this, game](){ SDL_SetRelativeMouseMode(SDL_TRUE); level = 2; this->load_scene(); Mode::set_current(game); }); menu->selected = 1; paused = true; Mode::set_current(menu); }
fa83a7ce090b2ac0458dbd56b3a7e5803c097eb4
41499f73e807ac9fee5e2ff96a8894d08d967293
/FORKS/C++/OpenPGP/tree/Packets/Tag6.cpp
7ec358870661d463dc3b29bc2d3f71f9a108fcd2
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "WTFPL", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
lordnynex/CLEANUP
c9f3058ec96674696339e7e936170a8645ddc09b
77e8e3cad25ce740fefb42859d9945cc482e009a
refs/heads/master
2021-01-10T07:35:08.071207
2016-04-10T22:02:57
2016-04-10T22:02:57
55,870,021
5
1
WTFPL
2023-03-20T11:55:51
2016-04-09T22:36:23
C++
UTF-8
C++
false
false
390
cpp
Tag6.cpp
#include "Tag6.h" Tag6::Tag6(uint8_t tag): Key(tag) {} Tag6::Tag6(): Tag6(6) {} Tag6::Tag6(const Tag6 & copy): Key(copy) {} Tag6::Tag6(std::string & data): Tag6(6) { read(data); } Tag6::~Tag6(){} Packet::Ptr Tag6::clone() const{ return std::make_shared <Tag6> (*this); } Tag6 & Tag6::operator=(const Tag6 & copy){ Key::operator=(copy); return *this; }
f8e3204748c7ff9ed13b7dadae40b46a6ff8c972
c8dfc743c17411d30bbde1309505dd33baaddf7f
/fabrik/src/fabrik_math.cpp
4ae48c87e835cf9f57b8f814fd9eeaf51ea36133
[]
no_license
OneManMonkeySquad/AWE
2ba8d51c4a85f2bf868c895dc5898e980b13ff65
e8b67f608e46956323a483d04de88de7e27047ff
refs/heads/master
2021-12-23T16:23:24.826779
2021-10-30T13:19:35
2021-10-30T13:19:35
237,494,665
2
2
null
null
null
null
UTF-8
C++
false
false
773
cpp
fabrik_math.cpp
#include "pch.h" #include "fabrik_math.h" namespace math { vector2 vector2::normalised() const { return *this / magnitude(); } vector2 operator+(vector2 l, vector2 r) { return { l.x + r.x, l.y + r.y }; } vector2 operator-(vector2 l, vector2 r) { return { l.x - r.x, l.y - r.y }; } vector2 operator*(vector2 l, float r) { return { l.x * r, l.y * r }; } vector2 operator*(float l, vector2 r) { return { l * r.x, l * r.y }; } vector2 operator/(vector2 l, float r) { return { l.x / r, l.y / r }; } vector2& operator+=(vector2& l, vector2 r) { l.x += r.x; l.y += r.y; return l; } color color::red{ 255, 0, 0, 255 }; color color::white{ 255, 255, 255, 255 }; color color::green{ 0, 255, 0, 255 }; color color::blue{ 0, 0, 255, 255 }; }