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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dc045a2b411939d60ad2fcbc7b5cac6bafb2bbd2
|
057ad60d054d1b0a69c2a664611955f7670018e0
|
/C++ and Data Structures (PSU)/Semester 1 (Intro to C++)/3) TicTacToe/TicTacToe.cpp
|
f0726f2cfbca820d92c4a05167a34f7038cc9e34
|
[] |
no_license
|
Tpanda03/Data-Structures
|
e10ca0c2aec756bbf1b7ca482a44e9b6e8f1d4e4
|
643bc69e514d75ce2735ce89cbbbba3a77d938ac
|
refs/heads/master
| 2022-10-02T09:07:40.476083
| 2020-06-01T18:55:57
| 2020-06-01T18:55:57
| 255,786,461
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,248
|
cpp
|
TicTacToe.cpp
|
#include <iostream>
#include <string.h>
using namespace std;
void clear(char* Ptr[3][3]);//method to clear the board
void draw(char* Ptr[3][3]);//method to draw the board
bool win(char* Ptr[3][3], char player);//method to check for a win condition
bool tie(char* Ptr[3][3]);//method to check if the game ended in a tie
int xDubs = 0;
int oDubs = 0;
int main()
{
char board[3][3];
char* boardPtr[3][3];
char input[2];
char player = 'o';//player piece
char playAgain = 'y';//play again
bool attempts = true;
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
boardPtr[x][y] = &board[x][y];
}
}
while(playAgain == 'y') {//run the game through once
cout << "Score X wins: " << xDubs << endl;
cout << "Score O wins: " << oDubs << endl;
//start with a empty board
clear(boardPtr);
draw(boardPtr);
player = 'o';
while(!win(boardPtr, player) && !tie(boardPtr)){
if(player == 'x') {
player = 'o';
}
else {
player = 'x';
}
do {
if (attempts == true){
cout << "place your piece on the board." << endl;
}
cin.get(input, 3);
cin.clear();
cin.ignore(1000000, '\n');
attempts = false;
}while (!(input[0] == '1' || input[0] == '2' || input[0] == '3')
|| !(input[1] == 'a' || input[1] == 'b' || input[1] == 'c')
|| !(board[(int)input[1] - 'a'][(int)input[0] - '1'] == ' '));//while piece is placed in a valid spot
attempts = true;
board[(int)input[1] - 'a'][(int)input[0] - '1'] = player;
draw(boardPtr);
}
if(tie(boardPtr)){//in the case tie is an event
cout << "This match ends in a tie" << endl;
}
else {
cout << "Congrats " << player << " on winning this match of tic tac toe!" << endl;//when someone wins
if(player == 'x') {
xDubs++;
}
else{
oDubs++;
}
}
cout << "Do you want to play again?" << endl;//i never want to do tic tac toe again.
cin >> playAgain;
cin.clear();
cin.ignore(1000000, '\n');
}
}
void clear(char* Ptr[3][3]){//the method for clearing the board
for(int x = 0; x < 3; x++) {
for(int y = 0; y < 3; y++) {
*Ptr[x][y] = ' ';
}
}
}
void draw(char* Ptr[3][3]) {//method to draw the board
cout << " 1 2 3" << endl;
cout << 'a';
for( int i = 0; i < 3; i++) {
cout << ' ' << *Ptr[0][i];
}
cout << endl;
cout << 'b';
for(int i = 0; i < 3; i++) {
cout << ' ' << *Ptr[1][i];
}
cout << endl;
cout << 'c';
for(int i = 0; i < 3; i++) {
cout << ' ' << *Ptr[2][i];
}
cout << endl;
}
bool tie(char* Ptr[3][3]){//check tie
for(int x = 0; x < 3; x++){
for(int y = 0; y < 3; y++){
if(*Ptr[x][y] == ' '){
return false;
}
}
}
return true;
}
bool win(char* Ptr[3][3], char player){//check win
for(int i = 0; i < 3; i++){
if(*Ptr[0][i] == player && *Ptr[1][i] == player && *Ptr[2][i] == player){
return true;
}
if(*Ptr[i][0] == player && *Ptr[i][1] == player && *Ptr[1][2] == player){
return true;
}
}
if(*Ptr[0][0] == player && *Ptr[1][1] == player && *Ptr[2][2] == player){
return true;
}
if(*Ptr[2][0] == player && *Ptr[1][1] == player && *Ptr[0][2] == player){
return true;
}
return false;
}
|
dee049022ab65cf4fd9f5521d1488b0006c11516
|
06e54a023d88f0aaf996546d345934d5dd7ef323
|
/PANEL_DE_CONTROL__PANTALLA_/PANEL_DE_CONTROL__PANTALLA_.ino
|
ad0e89cb3175602e5db58513d3083a3422e6a40f
|
[] |
no_license
|
jonamenabar/ALARMA
|
4bac3afe1ba2d6b697708a8f429cf438466cdcc4
|
c7d64c442a7bf9d8d52d7adeec03e6f33200684c
|
refs/heads/master
| 2021-01-10T10:00:15.251395
| 2016-04-18T23:40:21
| 2016-04-18T23:40:21
| 51,414,993
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,368
|
ino
|
PANEL_DE_CONTROL__PANTALLA_.ino
|
// include the library code:
#include <LiquidCrystal.h>
#include <Keypad.h>
#include <SoftwareSerial.h>
//###################################### VARIABLES GLOBALES ##########################################################
char DATO = 'a'; //creo la variable donde voy a guardar lo que me llegue del AP el estado inicial es sin coneccion
char ENVIAR = '0'; //creo la variable donde voy a cargar los datos a enviar
char CODIGO [4] = {0, 0, 0, 0}; //es la variable donde guardo el codigo ingresado por teclado, despues lo uso para tomar acciones, enviar o cambiar mensajes de la pantalla
char CONTRASENA [4] = {'1', '5', '3', '4'}; //es la variable que uso para activar o desacivar la alarma
int ESTADO_ACTUAL = 0000; // es la variable que uso para definir el estado actual de la alarma
int FLAG_TRANSMICION = 1; // creo una bandera para transmitir cuando este en 1 puedo transmitir, cuando este en 0 puedo recivir
int DESACTIVAR = 2828; // es el codigo para desactivar la alarma
int DELAY_ACTIVANDO_ALARMA = 9; //el tiempo que espera para activar la alarma despues de introducir el codigo correcto
//--------------------------LCD-------------------------------------
/* The circuit:
* LCD RS pin to digital pin 27
* LCD Enable pin to digital pin 26
* LCD D4 pin to digital pin 25
* LCD D5 pin to digital pin 24
* LCD D6 pin to digital pin 23
* LCD D7 pin to digital pin 22
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 220 resistencia:
* va entre el pin 3 y la masa
* wiper to LCD VO pin (pin 3)
initialize the library with the numbers of the interface pins*/
LiquidCrystal lcd(27, 26, 25, 24, 23, 22);
//--------------------------TECLADO---------------------------------
const byte Filas = 4; //Cuatro filas
const byte Cols = 4; //Cuatro columnas
byte Pins_Filas[] = {13, 12, 11, 10}; //Pines Arduino a los que contamos las filas.
byte Pins_Cols[] = { 9, 8, 7, 6}; // Pines Arduino a los que contamos las columnas.
char Teclas [ Filas ][ Cols ] =
{
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
Keypad Teclado1 = Keypad(makeKeymap(Teclas), Pins_Filas, Pins_Cols, Filas, Cols);
//------------------------WIFI MODULO---------------------------------
SoftwareSerial WIFI_1(53, 52); // RX | TX
//######################################SETUP##########################################################
void setup() {
//---------CONFIGURACION PUERTO SERIE--------------------------
Serial.begin(19200); //Se inicia la comunicación serial
//----------CONFIGURACION PUERTO SERIE PARA WIFI----------------
WIFI_1.begin(19200);
//---------CONFIGURACION LCD-----------------------------------
// configuro la cantidad de columnas y de filas de la pantalla LCD:
lcd.begin(16, 2);
//---------CONFIGURACION BUFFER-----------------------------------
pinMode(30, OUTPUT);
//--------CREO LA CONECCION---------
CREA_CONECCION();
//CHEK_CONECCION ();
}
//#######################################LOOP#########################################################
void loop() {
PANTALLA(DATO);
TECLADO();
// WIFI(); // WIFI ES UNA FUNCION QUE REPLICA LO QUE VE EL MODULO WIFI, solo lo uso para debugear
RECIVIR_DATO();
IDENTIFICADOR_CODIGOS();
}
|
5904c6d4715cf76ed8b836f779694407b46f7170
|
f4941250eae3d19bba36538e2d0509ff6a6fb8e6
|
/code/simulation.cpp
|
cc2c395a16d9b332d1db6ea026e10343cf48b689
|
[
"MIT"
] |
permissive
|
TinyConstruct/Torch
|
c8dc6b25417b4832c5e55d93812485b7b18c5eac
|
31b42a4b39671a93bed7d148acc50f9f2347e3b8
|
refs/heads/master
| 2021-04-29T11:58:03.005006
| 2018-03-26T18:25:16
| 2018-03-26T18:25:16
| 121,719,665
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 11,391
|
cpp
|
simulation.cpp
|
#include "simulation.h"
void createEntity(EntityGroup* entityGroup, RenderGroup* renderGroup, int entityType, int x, int y) {
assert(entityGroup->count + 1 < entityGroup->max);
Entity* e = entityGroup->base + entityGroup->count;
e->type = entityType;
e->centerX = x + TILE_SPACE_CENTER_OFFSET;
e->centerY = y + TILE_SPACE_CENTER_OFFSET;
e->origin = V2(e->centerX, e->centerY);
e->destination = V2(e->centerX, e->centerY);
v2 uv = entityTypeToUpperUV(entityType);
e->uvX = uv.x;
e->uvY = uv.y;
e->tileX = x;
e->tileY = y;
e->facing = FACING_DOWN;
e->state = ES_DEFENDING;
entityGroup->count++;
addQuadToRenderGroup(renderGroup, e->centerX, e->centerY, 0.5f, e->uvX, e->uvY);
}
void initializeMobs() {
createEntity(&mobEntities, &mobSprites, GOBLIN_SWORD, 5,5);
//createEntity(&mobEntities, &mobSprites, GOBLIN_SWORD, 5,6);
}
bool monsterAttackCheck(Entity* mob, Tile** t) {
Tile* temp = getTile(gameState.tiles, mob->tileX-1, mob->tileY);
if(!tileIsEmpty(temp) && (temp->entityHere)->type == E_PLAYER) {
*t = temp;
return true;
}
temp = getTile(gameState.tiles, mob->tileX+1, mob->tileY);
if(!tileIsEmpty(temp) && (temp->entityHere)->type == E_PLAYER) {
*t = temp;
return true;
}
temp = getTile(gameState.tiles, mob->tileX, mob->tileY-1);
if(!tileIsEmpty(temp) && (temp->entityHere)->type == E_PLAYER) {
*t = temp;
return true;
}
temp = getTile(gameState.tiles, mob->tileX, mob->tileY+1);
if(!tileIsEmpty(temp) && (temp->entityHere)->type == E_PLAYER) {
*t = temp;
return true;
}
return false;
}
v2i dirToUnitVec(int dir) {
switch(dir) {
case DIR_UP:
return V2i(0,1); break;
case DIR_DOWN:
return V2i(0,-1); break;
case DIR_LEFT:
return V2i(-1,0); break;
case DIR_RIGHT:
return V2i(1,0); break;
default:
return V2i(0,0); break;
}
}
inline void aStarListCheck(Tile* neighbor, int parentCost, int xTarget, int yTarget, int dir) {
int neighborCrossCost = getTileCrossingCost(neighbor);
int neighborH = manhattanCostToTile(neighbor->x, neighbor->y, xTarget, yTarget);
if(neighborCrossCost>=0 && neighbor->navListNum!=(gameState.currentAStarNum+1)){
neighborCrossCost += parentCost;
if(neighbor->navListNum!=gameState.currentAStarNum) {
insertTileMinHeap(simMinHeap, neighborH, neighborCrossCost, neighbor, dir);
neighbor->navListNum = gameState.currentAStarNum;
}
else {
//Is in open list, check if this is a shorter path
TileMinHeapNode* currentNode = simMinHeap->head + 1;
for(int i = 1; i <= simMinHeap->count; i++) {
TileMinHeapNode* currentNode = simMinHeap->head + i;
if(currentNode->tile == neighbor) {
if((currentNode->costFromStart + currentNode->hCost) > (neighborCrossCost + neighborH)) {
//update node to more efficient path
currentNode->costFromStart = neighborCrossCost;
currentNode->hCost = neighborH;
currentNode->dir = dir;
}
return; //quit if we find the node
}
}
}
}
}
v2i AStarToTile(Entity* start, int xTarget, int yTarget) {
//Assumption: the max tile dimension is always a wall, and therefore assumed blocked.
simMinHeap->count = 0;
Tile* targetTile = getTile(gameState.tiles, xTarget, yTarget);
Tile* startTile = getTile(gameState.tiles, start->tileX, start->tileY);
startTile->navListNum = gameState.currentAStarNum + 1; //add to closed list
Tile* neighbor = getTile(gameState.tiles, start->tileX - 1, start->tileY);
int neighborCrossCost = getTileCrossingCost(neighbor);
int neighborH = manhattanCostToTile(neighbor->x, neighbor->y, xTarget, yTarget);
if(neighborCrossCost>=0){
insertTileMinHeap(simMinHeap, neighborH, neighborCrossCost, neighbor, DIR_LEFT);
neighbor->navListNum = gameState.currentAStarNum;
}
neighbor = getTile(gameState.tiles, start->tileX+1, start->tileY);
neighborCrossCost = getTileCrossingCost(neighbor);
neighborH = manhattanCostToTile(neighbor->x, neighbor->y, xTarget, yTarget);
if(neighborCrossCost>=0){
insertTileMinHeap(simMinHeap, neighborH, neighborCrossCost, neighbor, DIR_RIGHT);
neighbor->navListNum = gameState.currentAStarNum;
}
neighbor = getTile(gameState.tiles, start->tileX, start->tileY+1);
neighborCrossCost = getTileCrossingCost(neighbor);
neighborH = manhattanCostToTile(neighbor->x, neighbor->y, xTarget, yTarget);
if(neighborCrossCost>=0){
insertTileMinHeap(simMinHeap, neighborH, neighborCrossCost, neighbor, DIR_UP);
neighbor->navListNum = gameState.currentAStarNum;
}
neighbor = getTile(gameState.tiles, start->tileX, start->tileY-1);
neighborCrossCost = getTileCrossingCost(neighbor);
neighborH = manhattanCostToTile(neighbor->x, neighbor->y, xTarget, yTarget);
if(neighborCrossCost>=0){
insertTileMinHeap(simMinHeap, neighborH, neighborCrossCost, neighbor, DIR_DOWN);
neighbor->navListNum = gameState.currentAStarNum;
}
while(simMinHeap->count > 0) {
TileMinHeapNode* least = popTileMinHeap(simMinHeap);
least->tile->navListNum++;
int parentCost = least->costFromStart;
Tile* current = &(*least->tile);
if(least->tile == targetTile) {
gameState.currentAStarNum += 2;
return dirToUnitVec(least->dir);
}
int leastDir = least->dir;
least->hCost = -1;
least->costFromStart = -1;
neighbor = getTile(gameState.tiles, current->x-1, current->y);
aStarListCheck(neighbor, parentCost, xTarget, yTarget, leastDir);
neighbor = getTile(gameState.tiles, current->x+1, current->y);
aStarListCheck(neighbor, parentCost, xTarget, yTarget, leastDir);
neighbor = getTile(gameState.tiles, current->x, current->y-1);
aStarListCheck(neighbor, parentCost, xTarget, yTarget, leastDir);
neighbor = getTile(gameState.tiles, current->x, current->y+1);
aStarListCheck(neighbor, parentCost, xTarget, yTarget, leastDir);
}
gameState.currentAStarNum += 2;
return V2i(0,0);
}
v2i naiveMove(Entity* start, int xTarget, int yTarget) {
//Assumption: the max tile dimension is always a wall, and therefore assumed blocked.
//int start = getTileInt(start->x, start->y);
//int end = getTileInt(target->x, target->y);
int yDir = yTarget - start->tileY;
int xDir = xTarget - start->tileX;
if(abs(yDir) > abs(xDir)){
yDir = clamp(yDir, -1, 1);
Tile* t = getTile(gameState.tiles, start->tileX, start->tileY+yDir);
v2i result = V2i(0, 0);
if(t->type==TILE_FLOOR && t->entityHere == NULL) {
result.y = yDir;
return result;
}
xDir = clamp(xDir, -1, 1);
t = getTile(gameState.tiles, start->tileX + xDir, start->tileY);
if(t->type==TILE_FLOOR && t->entityHere == NULL) {
result.x = xDir;
return result;
}
return result;
}
else {
xDir = clamp(xDir, -1, 1);
Tile* t = getTile(gameState.tiles, start->tileX + xDir, start->tileY);
v2i result = V2i(0, 0);
if(t->type==TILE_FLOOR && t->entityHere == NULL) {
result.x = xDir;
return result;
}
yDir = clamp(yDir, -1, 1);
t = getTile(gameState.tiles, start->tileX, start->tileY+yDir);
if(t->type==TILE_FLOOR && t->entityHere == NULL) {
result.y = yDir;
return result;
}
return result;
}
}
void setMobFacingByDir(Entity* ent, int x, int y) {
switch(x) {
case 1:
ent->facing = FACING_RIGHT;
return;
break;
case -1:
ent->facing = FACING_LEFT;
return;
break;
}
switch(y) {
case 1:
ent->facing = FACING_UP;
return;
break;
case -1:
ent->facing = FACING_DOWN;
return;
break;
}
}
void setMobFacingByDir(Entity* ent, v2i dir) {
switch(dir.x) {
case 1:
ent->facing = FACING_RIGHT;
return;
break;
case -1:
ent->facing = FACING_LEFT;
return;
break;
}
switch(dir.y) {
case 1:
ent->facing = FACING_UP;
return;
break;
case -1:
ent->facing = FACING_DOWN;
return;
break;
}
}
void attackPlayer(Entity* entPtr, Player* palyerPtr) {
entPtr->state = ES_WAITING;
}
void mobUpdate(EntityGroup* mobEntities, Player* playerPtr, float dt) {
if(gameState.turn == MONSTER_TURN) {
bool mobsAllDone = true;
Entity* mob;
for(int i = 0; i < mobEntities->count; i++) {
mob = mobEntities->base + i;
Tile* tempTilePtr = NULL;
switch(mob->state) {
case ES_DEFENDING: //ES_DEFENDING should only last for first frame of monster turn
mobsAllDone = false;
if(monsterAttackCheck(mob, &tempTilePtr)) {
//attack!
v2i dir;
dir.x = tempTilePtr->x - mob->tileX;
dir.y = tempTilePtr->y - mob->tileY;
setMobFacingByDir(mob, dir);
attackPlayer(mob, playerPtr);
}
else{
//set move destination
//if path is only 1-cost per tile from monster to player
v2i playerXY = V2i(player.tileX, player.tileY);
v2i monsterXY = V2i(mob->tileX, mob->tileY);
v2i dir;
if(tileRectIsClear(mob, playerXY, monsterXY)) {
dir = naiveMove(mob, playerXY.x, playerXY.y);
}
else{
dir = AStarToTile(mob, playerPtr->tileX, playerPtr->tileY);
}
setMobFacingByDir(mob, dir.x, dir.y);
setMobDestination(mob, mob->tileX + dir.x, mob->tileY + dir.y);
updateMobMovement(mob, dt);
//char strTime[40];
//sprintf_s(strTime, 40, "dir:%i %i\n", dir.x, dir.y);
//OutputDebugString(strTime);
//sprintf_s(strTime, 40, "monster tile:%i %i\n", mob->tileX, mob->tileY);
//OutputDebugString(strTime);
//sprintf_s(strTime, 40, "player tile:%i %i\n", playerPtr->tileX, playerPtr->tileY);
//OutputDebugString(strTime);
}
break;
case ES_MOVING:
mobsAllDone = false;
updateMobMovement(mob, dt);
break;
case ES_HUNTING:
mobsAllDone = false;
break;
default:
break;
}
//TODO: if mob can see player, set last seen
//TODO: regardless of whether can see player, set dest to lastSeen if it's not negative
//TODO: run A* to find tile that is next step toward player
}
if(mobsAllDone) {
for(int i = 0; i < mobEntities->count; i++) {
mob = mobEntities->base + i;
mob->state = ES_DEFENDING;
}
gameState.turn = PLAYER_TURN;
playerPtr->playerState = PS_WAITING;
}
}
else { //Still the player's turn
//do nothing
}
}
bool tileIsWalkable(Tile* t) {
switch(t->type) {
case TILE_FLOOR:
return true; break;
default:
return false; break;
}
}
void handlePlayerMove(Player* playerPtr, int x, int y) {
Tile* targetTile = getTile(gameState.tiles, x, y);
if(tileIsEmpty(targetTile) && tileIsWalkable(targetTile)) {
setPlayerDestination(&player, x, y);
}
}
void initializeSim() {
simulationSwapSpace.space = VirtualAlloc(0, megabyte(5),
MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
simulationSwapSpace.sizeInBytes = megabyte(5);
assert(simulationSwapSpace.space != NULL);
gameState.maxMinHeapNodes = gameState.maxTilesX*gameState.maxTilesY;
gameState.currentAStarNum = 1;
}
|
89c14cb7954be5b9c4e9514b31480d8b01152d92
|
cb4e40043a362288616fdcf784c284147a06086e
|
/小米oj/4.cpp
|
c2fab4d17c356a5c07c35fd0c73928c79c798e2f
|
[] |
no_license
|
stArl23/onlineJudgeExam
|
aaab6c47ab0cae3eb52dd940e89c08b3301565d0
|
c8b7d1f38b0f6463fbd56be08a212084cd96cdde
|
refs/heads/master
| 2021-10-22T11:12:45.783087
| 2019-03-10T05:24:04
| 2019-03-10T05:24:04
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 603
|
cpp
|
4.cpp
|
#include<iostream>
#include<sstream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
string s;
while(getline(cin,s)) {
if(s=="")break;
vector<int> nums;
vector<bool> dp;
size_t pos=0;
while((pos=s.find(","))&&pos!=string::npos) {
s.replace(pos,1," ");
}
istringstream iss(s);
int i;
while(iss>>i) {
nums.push_back(i);
}
int t=1;
int ans=1;
sort(nums.begin(),nums.end());
for(int i=1; i<nums.size(); i++) {
if(nums[i]==nums[i-1]+1) {
t++;
} else {
t=1;
}
if(t>ans) {
ans=t;
}
}
cout<<ans<<endl;
}
return 0;
}
|
1a40322450e9a612d9accc7c0937d4c31c94de62
|
ec3b8fcf4cafe11a7fed25dd9de1304a8e22a6a9
|
/src/xrt/auxiliary/android/android_custom_surface.cpp
|
829f01fd4e3489a13bed46d8f26acc9b151f4763
|
[
"CC-BY-4.0",
"BSL-1.0"
] |
permissive
|
mateosss/monado
|
acfcdf105545535c122fe4a720f0e740b028ab75
|
a6da40de505b58c28f50dc578d36b7b2f0887ad7
|
refs/heads/master
| 2023-04-13T22:25:42.732317
| 2021-03-09T17:45:45
| 2021-03-09T18:16:01
| 339,816,160
| 12
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,550
|
cpp
|
android_custom_surface.cpp
|
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Implementation of native code for Android custom surface.
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
* @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
* @ingroup aux_android
*/
#include "android_custom_surface.h"
#include "android_load_class.hpp"
#include "xrt/xrt_config_android.h"
#include "util/u_logging.h"
#include "wrap/android.app.h"
#include "wrap/android.view.h"
#include "org.freedesktop.monado.auxiliary.hpp"
#include <android/native_window_jni.h>
using wrap::android::app::Activity;
using wrap::android::view::SurfaceHolder;
using wrap::org::freedesktop::monado::auxiliary::MonadoView;
struct android_custom_surface
{
explicit android_custom_surface(jobject act);
~android_custom_surface();
Activity activity{};
MonadoView monadoView{};
jni::Class monadoViewClass{};
};
android_custom_surface::android_custom_surface(jobject act) : activity(act) {}
android_custom_surface::~android_custom_surface()
{
// Tell Java that native code is done with this.
try {
if (!monadoView.isNull()) {
monadoView.markAsDiscardedByNative();
}
} catch (std::exception const &e) {
// Must catch and ignore any exceptions in the destructor!
U_LOG_E("Failure while marking MonadoView as discarded: %s", e.what());
}
}
constexpr auto FULLY_QUALIFIED_CLASSNAME = "org.freedesktop.monado.auxiliary.MonadoView";
struct android_custom_surface *
android_custom_surface_async_start(struct _JavaVM *vm, void *activity)
{
jni::init(vm);
try {
auto info = getAppInfo(XRT_ANDROID_PACKAGE, (jobject)activity);
if (info.isNull()) {
U_LOG_E("Could not get application info for package '%s'",
"org.freedesktop.monado.openxr_runtime");
return nullptr;
}
auto clazz = loadClassFromPackage(info, (jobject)activity, FULLY_QUALIFIED_CLASSNAME);
if (clazz.isNull()) {
U_LOG_E("Could not load class '%s' from package '%s'", FULLY_QUALIFIED_CLASSNAME,
XRT_ANDROID_PACKAGE);
return nullptr;
}
// Teach the wrapper our class before we start to use it.
MonadoView::staticInitClass((jclass)clazz.object().getHandle());
std::unique_ptr<android_custom_surface> ret =
std::make_unique<android_custom_surface>((jobject)activity);
// the 0 is to avoid this being considered "temporary" and to
// create a global ref.
ret->monadoViewClass = jni::Class((jclass)clazz.object().getHandle(), 0);
if (ret->monadoViewClass.isNull()) {
U_LOG_E("monadoViewClass was null");
return nullptr;
}
std::string clazz_name = ret->monadoViewClass.getName();
if (clazz_name != FULLY_QUALIFIED_CLASSNAME) {
U_LOG_E("Unexpected class name: %s", clazz_name.c_str());
return nullptr;
}
ret->monadoView = MonadoView::attachToActivity(ret->activity, ret.get());
return ret.release();
} catch (std::exception const &e) {
U_LOG_E(
"Could not start attaching our custom surface to activity: "
"%s",
e.what());
return nullptr;
}
}
void
android_custom_surface_destroy(struct android_custom_surface **ptr_custom_surface)
{
if (ptr_custom_surface == NULL) {
return;
}
struct android_custom_surface *custom_surface = *ptr_custom_surface;
if (custom_surface == NULL) {
return;
}
delete custom_surface;
*ptr_custom_surface = NULL;
}
ANativeWindow *
android_custom_surface_wait_get_surface(struct android_custom_surface *custom_surface, uint64_t timeout_ms)
{
SurfaceHolder surfaceHolder{};
try {
surfaceHolder = custom_surface->monadoView.waitGetSurfaceHolder(timeout_ms);
} catch (std::exception const &e) {
// do nothing right now.
U_LOG_E(
"Could not wait for our custom surface: "
"%s",
e.what());
return nullptr;
}
if (surfaceHolder.isNull()) {
return nullptr;
}
auto surf = surfaceHolder.getSurface();
if (surf.isNull()) {
return nullptr;
}
return ANativeWindow_fromSurface(jni::env(), surf.object().makeLocalReference());
}
bool
android_custom_surface_get_display_metrics(struct _JavaVM *vm,
void *activity,
struct xrt_android_display_metrics *out_metrics)
{
jni::init(vm);
try {
auto info = getAppInfo(XRT_ANDROID_PACKAGE, (jobject)activity);
if (info.isNull()) {
U_LOG_E("Could not get application info for package '%s'",
"org.freedesktop.monado.openxr_runtime");
return false;
}
auto clazz = loadClassFromPackage(info, (jobject)activity, FULLY_QUALIFIED_CLASSNAME);
if (clazz.isNull()) {
U_LOG_E("Could not load class '%s' from package '%s'", FULLY_QUALIFIED_CLASSNAME,
XRT_ANDROID_PACKAGE);
return false;
}
// Teach the wrapper our class before we start to use it.
MonadoView::staticInitClass((jclass)clazz.object().getHandle());
jni::Object displayMetrics = MonadoView::getDisplayMetrics(Activity((jobject)activity));
*out_metrics = {.width_pixels = displayMetrics.get<int>("widthPixels"),
.height_pixels = displayMetrics.get<int>("heightPixels"),
.density_dpi = displayMetrics.get<int>("densityDpi"),
.density = displayMetrics.get<float>("xdpi"),
.scaled_density = displayMetrics.get<float>("ydpi"),
.xdpi = displayMetrics.get<float>("density"),
.ydpi = displayMetrics.get<float>("scaledDensity")};
return true;
} catch (std::exception const &e) {
U_LOG_E("Could not get display metrics: %s", e.what());
return false;
}
}
|
662a075c81bc30f71317c795456e3cf42c82f8a2
|
7af554ff51603fd9f01903577be9836aba03e3f1
|
/inc/WASABI.hh
|
0d812872ce234aace5f9df6c6174e8ea2a109e25
|
[] |
no_license
|
wimmer-k/Salvador
|
eaf042ab918eb5f958cad496273e535d84f028c7
|
9241b66b298c6231a95d8787a75567afee32094f
|
refs/heads/master
| 2021-12-15T00:50:48.146849
| 2021-12-13T16:46:23
| 2021-12-13T16:46:23
| 51,063,680
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 17,061
|
hh
|
WASABI.hh
|
#ifndef __WASABI_HH
#define __WASABI_HH
#include <iostream>
#include <vector>
#include <cstdlib>
#include <math.h>
#include <algorithm>
#include "TObject.h"
#include "WASABIdefs.h"
using namespace std;
class WASABIHitComparer;
/*!
Container for the WASABI Raw ADC information
*/
class WASABIRawADC : public TObject {
public:
//! default constructor
WASABIRawADC(){
Clear();
}
//! useful constructor
WASABIRawADC(short adc, short ch, short val){
fadc = adc;
fch = ch;
fval = val;
}
//! Clear the ADC information
void Clear(Option_t *option = ""){
fadc = sqrt(-1.);
fch = sqrt(-1.);
fval = sqrt(-1.);
}
//! Set the ADC number
void SetADC(short adc){ fadc = adc;}
//! Set the ADC channel
void SetChan(short ch){ fch = ch;}
//! Set the ADC value
void SetVal(short val){ fval = val;}
//! Get the ADC number
short GetADC(){ return fadc;}
//! Get the ADC channel
short GetChan(){ return fch;}
//! Get the ADC value
short GetVal(){ return fval;}
//! Printing information
void Print(Option_t *option = "") const {
cout << "adc " << fadc;
cout << "\tch " << fch;
cout << "\tval " << fval << endl;
return;
}
protected:
//! adc number
short fadc;
//! adc channel
short fch;
//! adc value
short fval;
/// \cond CLASSIMP
ClassDef(WASABIRawADC,1);
/// \endcond
};
/*!
Container for the WASABI Raw TDC information
*/
class WASABIRawTDC : public TObject {
public:
//! default constructor
WASABIRawTDC(){
Clear();
}
//! useful constructor
WASABIRawTDC(short tdc, short ch, short val){
ftdc = tdc;
fch = ch;
fval.push_back(val);
}
//! add time to a channel
void AddRawTDC(short val){
fval.push_back(val);
}
//! Clear the TDC information
void Clear(Option_t *option = ""){
ftdc = sqrt(-1.);
fch = sqrt(-1.);
fval.clear();
}
//! Printing information
void Print(Option_t *option = "") const {
cout << "tdc " << ftdc;
cout << "\tch " << fch;
cout << "\tval " << fval.size();
for(unsigned short i=0; i<fval.size();i++){
cout << ", " << fval.at(i);
}
cout << endl;
return;
}
//! Get the TDC number
short GetTDC(){ return ftdc;}
//! Get the TDC channel
short GetChan(){ return fch;}
//! Get the TDC values
vector<short> GetVal(){ return fval;}
//! Get a TDC value
short GetVal(short n){ return fval.at(n);}
protected:
//! tdc number
short ftdc;
//! tdc channel
short fch;
//! tdc value
vector<short> fval;
/// \cond CLASSIMP
ClassDef(WASABIRawTDC,1);
/// \endcond
};
/*!
Container for the WASABIRaw information
*/
class WASABIRaw : public TObject {
public:
//! default constructor
WASABIRaw(){
Clear();
}
//! Clear the WASABI raw information
void Clear(Option_t *option = ""){
fADCmult = 0;
for(vector<WASABIRawADC*>::iterator adc=fadcs.begin(); adc!=fadcs.end(); adc++){
delete *adc;
}
fadcs.clear();
fTDCmult = 0;
for(vector<WASABIRawTDC*>::iterator tdc=ftdcs.begin(); tdc!=ftdcs.end(); tdc++){
delete *tdc;
}
ftdcs.clear();
}
//! Add an adc
void AddADC(WASABIRawADC* adc){
fadcs.push_back(adc);
fADCmult++;
}
//! Add a tdc
void AddTDC(WASABIRawTDC* tdc){
for(vector<WASABIRawTDC*>::iterator stored=ftdcs.begin(); stored!=ftdcs.end(); stored++){
if(tdc->GetTDC() == (*stored)->GetTDC() && tdc->GetChan() == (*stored)->GetChan()){
(*stored)->AddRawTDC(tdc->GetVal(0));
return;
}
}
ftdcs.push_back(tdc);
fTDCmult++;
}
//! Set all adcs
void SetADCs(vector<WASABIRawADC*> adcs){
fADCmult = adcs.size();
fadcs = adcs;
}
//! Returns the ADCmultiplicity of the event
unsigned short GetADCmult(){return fADCmult;}
//! Returns the whole vector of adcs
vector<WASABIRawADC*> GetADCs(){return fadcs;}
//! Returns the adc number n
WASABIRawADC* GetADC(unsigned short n){return fadcs.at(n);}
//! Set all tdcs
void SetTDCs(vector<WASABIRawTDC*> tdcs){
fTDCmult = tdcs.size();
ftdcs = tdcs;
}
//! Returns the TDCmultiplicity of the event
unsigned short GetTDCmult(){return fTDCmult;}
//! Returns the whole vector of tdcs
vector<WASABIRawTDC*> GetTDCs(){return ftdcs;}
//! Returns the tdc number n
// param n the number of the TDC hit
WASABIRawTDC* GetTDC(unsigned short n){return ftdcs.at(n);}
//! Returns the hit in TDC module tdc and channel ch
WASABIRawTDC* GetTDC(short tdc, short ch){
for(vector<WASABIRawTDC*>::iterator stored=ftdcs.begin(); stored!=ftdcs.end(); stored++){
if(tdc == (*stored)->GetTDC() && ch == (*stored)->GetChan()){
return (*stored);
}
}
cout << "warning TDC " << tdc << " channel " << ch << " not found!" << endl;
return new WASABIRawTDC();
}
//! Printing information
void Print(Option_t *option = "") const {
cout << "ADC multiplicity " << fADCmult << " event" << endl;
for(unsigned short i=0;i<fadcs.size();i++)
fadcs.at(i)->Print();
cout << "TDC multiplicity " << fTDCmult << " event" << endl;
for(unsigned short i=0;i<ftdcs.size();i++)
ftdcs.at(i)->Print();
}
protected:
//! ADCmultiplicity
unsigned short fADCmult;
//! vector with the adcs
vector<WASABIRawADC*> fadcs;
//! TDCmultiplicity
unsigned short fTDCmult;
//! vector with the tdcs
vector<WASABIRawTDC*> ftdcs;
/// \cond CLASSIMP
ClassDef(WASABIRaw,1);
/// \endcond
};
/*!
Container for the WASABI Hit information
*/
class WASABIHit : public TObject {
public:
//! default constructor
WASABIHit(){
Clear();
}
//! useful constructor
WASABIHit(short strip, double en, bool iscal){
fstrip = strip;
fen = en;
fiscal = iscal;
ftime.clear();
fhitsadded = 1;
}
//! Clear the ADC information
void Clear(Option_t *option = ""){
fstrip = sqrt(-1.);
fen = sqrt(-1.);
ftime.clear();
fiscal = false;
fhitsadded = 0;
}
//! Set the energy
void SetEn(double en){ fen = en;}
//! Set the time
void SetTime(double timeval){ ftime.push_back(timeval);}
//! Get the strip number
short GetStrip(){ return fstrip;}
//! Get the energy
double GetEn(){ return fen;}
//! Get the time values
vector<double> GetTime(){ return ftime;}
//! Get the first time value
double GetTime0(){
if(ftime.size()>0)
return ftime.at(0);
return sqrt(-1);
}
//! Get the number of hits that were added back to create one hit
unsigned short GetHitsAdded(){return fhitsadded;}
//! Is is calibrated
bool IsCal(){return fiscal;}
//! Printing information
//! Addback a hit
void AddBackHit(WASABIHit* hit){
if(fen<hit->GetEn()){
cout << " error hits not sorted by energy" << endl;
return;
}
fen+=hit->GetEn();
fhitsadded+=hit->GetHitsAdded();
}
void Print(Option_t *option = "") const {
cout << "strip = " << fstrip;
cout << "\ten = " << fen;
if(fiscal)
cout << " (calibrated) ";
else
cout << " (raw) ";
cout << "\ttime " << ftime.size() << " values, first one = " << ftime.at(0);
if(fhitsadded>1)
cout << "\thits added " << fhitsadded << endl;
else
cout << endl;
return;
}
protected:
//! position, strip number
short fstrip;
//! energy, calibrated
double fen;
//! timing
vector<double> ftime;
//! is it calibrated
bool fiscal;
//! how many hits were added back to create one hit
unsigned short fhitsadded;
/// \cond CLASSIMP
ClassDef(WASABIHit,1);
/// \endcond
};
/*!
Container for the WASABI DSSSD information
*/
class DSSSD : public TObject {
public:
//! default constructor
DSSSD(){
fdsssd = -1;
Clear();
}
//! constructor
DSSSD(short dsssdnr){
fdsssd = dsssdnr;
Clear();
}
//! Clear the DSSSD information
void Clear(Option_t *option = ""){
fmultX = 0;
fvetoX = false;
for(vector<WASABIHit*>::iterator hit=fhitsX.begin(); hit!=fhitsX.end(); hit++){
delete *hit;
}
fhitsX.clear();
fimplantX = -1;
fmultY = 0;
fvetoY = false;
for(vector<WASABIHit*>::iterator hit=fhitsY.begin(); hit!=fhitsY.end(); hit++){
delete *hit;
}
fhitsY.clear();
fimplantY = -1;
fmultABX = 0;
for(vector<WASABIHit*>::iterator hit=fhitsABX.begin(); hit!=fhitsABX.end(); hit++){
delete *hit;
}
fhitsABX.clear();
fmultABY = 0;
for(vector<WASABIHit*>::iterator hit=fhitsABY.begin(); hit!=fhitsABY.end(); hit++){
delete *hit;
}
fhitsABY.clear();
}
//! Clear the addback information
void ClearAddback(Option_t *option = ""){
fmultABX = 0;
for(vector<WASABIHit*>::iterator hit=fhitsABX.begin(); hit!=fhitsABX.end(); hit++){
delete *hit;
}
fhitsABX.clear();
fmultABY = 0;
for(vector<WASABIHit*>::iterator hit=fhitsABY.begin(); hit!=fhitsABY.end(); hit++){
delete *hit;
}
fhitsABY.clear();
}
//! setting the dsssd number
void SetDSSSD(short dsssd){fdsssd = dsssd;}
//! Add a hit in X
void AddHitX(WASABIHit* hit){
fhitsX.push_back(hit);
fmultX++;
}
//! Add a hit in Y
void AddHitY(WASABIHit* hit){
fhitsY.push_back(hit);
fmultY++;
}
//! Set hits in X
void SetHitsX(vector<WASABIHit*> hits){
fhitsX = hits;
fmultX = hits.size();
}
//! Set hits in Y
void SetHitsY(vector<WASABIHit*> hits){
fhitsY = hits;
fmultY = hits.size();
}
//! Set a veto on X
void SetVetoX(){fvetoX = true;}
//! Set a veto on Y
void SetVetoY(){fvetoY = true;}
//! Set implantation point X
void SetImplantX(int strip){fimplantX = strip;}
//! Set implantation point Y
void SetImplantY(int strip){fimplantY = strip;}
//! Add an addback hit in X
void AddABHitX(WASABIHit* hit){
fhitsABX.push_back(hit);
fmultABX++;
}
//! Add an addback hit in Y
void AddABHitY(WASABIHit* hit){
fhitsABY.push_back(hit);
fmultABY++;
}
//! Returns the DSSSD number
short GetDSSSD(){return fdsssd;}
//! Returns the X multiplicity of the event
unsigned short GetMultX(){return fmultX;}
//! Returns the whole vector of hits in X
vector<WASABIHit*> GetHitsX(){return fhitsX;}
//! Returns the X hit number n
WASABIHit* GetHitX(unsigned short n){return fhitsX.at(n);}
//! Returns the hit at strip number
WASABIHit* GetStripHitX(short s){
if(s<0 || s > NXSTRIPS){
cout << "looking for X strip number " << s <<", not found!" << endl;
return new WASABIHit();
}
for(vector<WASABIHit*>::iterator hit=fhitsX.begin(); hit!=fhitsX.end(); hit++){
if((*hit)->GetStrip() ==s)
return (*hit);
}
cout << "looking for X strip number " << s <<", not found!" << endl;
return new WASABIHit();
}
//! Add the timing information to strip s
void SetStripTimeX(short s, double timeval){
if(s<0 || s > NXSTRIPS){
cout << "looking for X strip number " << s <<", not found!" << endl;
return;
}
for(vector<WASABIHit*>::iterator hit=fhitsX.begin(); hit!=fhitsX.end(); hit++){
if((*hit)->GetStrip() ==s)
(*hit)->SetTime(timeval);
}
//cout << "looking for X strip number " << s <<", not found!" << endl;
return;
}
//! Returns the X multiplicity of the event after addback
unsigned short GetMultABX(){return fmultABX;}
//! Returns the whole vector of addback hits in X
vector<WASABIHit*> GetHitsABX(){return fhitsABX;}
//! Returns the addback X hit number n
WASABIHit* GetHitABX(unsigned short n){return fhitsABX.at(n);}
//! Returns the addback hit at strip number
WASABIHit* GetStripHitABX(short s){
if(s<0 || s > NXSTRIPS){
cout << "looking for addback X strip number " << s <<", not found!" << endl;
return new WASABIHit();
}
for(vector<WASABIHit*>::iterator hit=fhitsABX.begin(); hit!=fhitsABX.end(); hit++){
if((*hit)->GetStrip() ==s)
return (*hit);
}
cout << "looking for addback X strip number " << s <<", not found!" << endl;
return new WASABIHit();
}
//! Returns the Y multiplicity of the event
unsigned short GetMultY(){return fmultY;}
//! Returns the whole vector of hits in Y
vector<WASABIHit*> GetHitsY(){return fhitsY;}
//! Returns the Y hit number n
WASABIHit* GetHitY(unsigned short n){return fhitsY.at(n);}
//! Returns the hit at strip number
WASABIHit* GetStripHitY(short s){
if(s<0 || s > NYSTRIPS){
cout << "looking for Y strip number " << s <<", not found!" << endl;
return new WASABIHit();
}
for(vector<WASABIHit*>::iterator hit=fhitsY.begin(); hit!=fhitsY.end(); hit++){
if((*hit)->GetStrip() ==s)
return (*hit);
}
cout << "looking for Y strip number " << s <<", not found!" << endl;
return new WASABIHit();
}
//! Add the timing information to strip s
void SetStripTimeY(short s, double timeval){
if(s<0 || s > NYSTRIPS){
cout << "looking for Y strip number " << s <<", not found!" << endl;
return;
}
for(vector<WASABIHit*>::iterator hit=fhitsY.begin(); hit!=fhitsY.end(); hit++){
if((*hit)->GetStrip() ==s)
(*hit)->SetTime(timeval);
}
//cout << "looking for Y strip number " << s <<", not found!" << endl;
return;
}
//! Returns the Y multiplicity of the event after addback
unsigned short GetMultABY(){return fmultABY;}
//! Returns the whole vector of addback hits in Y
vector<WASABIHit*> GetHitsABY(){return fhitsABY;}
//! Returns the addback Y hit number n
WASABIHit* GetHitABY(unsigned short n){return fhitsABY.at(n);}
//! Returns the addback hit at strip number
WASABIHit* GetStripHitABY(short s){
if(s<0 || s > NYSTRIPS){
cout << "looking for addback Y strip number " << s <<", not found!" << endl;
return new WASABIHit();
}
for(vector<WASABIHit*>::iterator hit=fhitsABY.begin(); hit!=fhitsABY.end(); hit++){
if((*hit)->GetStrip() ==s)
return (*hit);
}
cout << "looking for addback Y strip number " << s <<", not found!" << endl;
return new WASABIHit();
}
//! sort the hits by energy, high to low
vector<WASABIHit*> Sort(vector<WASABIHit*> hits);
//! sort the hits by energy, low to high
vector<WASABIHit*> Revert(vector<WASABIHit*> hits);
//! addback
void Addback();
//! check if addback
bool Addback(WASABIHit* hit0, WASABIHit* hit1);
//! Is vetoed in X
bool IsVetoX(){return fvetoX;}
//! Is vetoed in Y
bool IsVetoY(){return fvetoY;}
//! Implantation X
int ImplantX(){return fimplantX;}
//! Implantation Y
int ImplantY(){return fimplantY;}
//! Printing information
void Print(Option_t *option = "") const {
cout << "DSSSD number " << fdsssd << endl;
if(fvetoX)
cout << "veto on X strips " << endl;
if(fvetoY)
cout << "veto on Y strips " << endl;
cout << "X multiplicity " << fmultX << " event" << endl;
for(unsigned short i=0;i<fhitsX.size();i++)
fhitsX.at(i)->Print();
cout << "X AB multiplicity " << fmultABX << " event" << endl;
for(unsigned short i=0;i<fhitsABX.size();i++)
fhitsABX.at(i)->Print();
cout << "Y multiplicity " << fmultY << " event" << endl;
for(unsigned short i=0;i<fhitsY.size();i++)
fhitsY.at(i)->Print();
cout << "Y AB multiplicity " << fmultABY << " event" << endl;
for(unsigned short i=0;i<fhitsABY.size();i++)
fhitsABY.at(i)->Print();
}
protected:
//! DSSSD number
short fdsssd;
//! HIT multiplicity in X
unsigned short fmultX;
//! vector with the X hits
vector<WASABIHit*> fhitsX;
//! HIT multiplicity in Y
unsigned short fmultY;
//! vector with the Y hits
vector<WASABIHit*> fhitsY;
//! HIT multiplicity after addback in X
unsigned short fmultABX;
//! vector with the addback X hits
vector<WASABIHit*> fhitsABX;
//! HIT multiplicity after addback in Y
unsigned short fmultABY;
//! vector with the addback Y hits
vector<WASABIHit*> fhitsABY;
//! veto in X
bool fvetoX;
//! veto in Y
bool fvetoY;
//! implantation point X
int fimplantX;
//! implantation point Y
int fimplantY;
/// \cond CLASSIMP
ClassDef(DSSSD,1);
/// \endcond
};
/*!
Container for the WASABI information
*/
class WASABI : public TObject {
public:
//! default constructor
WASABI(){
for(int i=0; i<NDSSSD; i++)
fdsssd[i] = new DSSSD(i);
//Clear();
}
//! Clear the wasabi information
void Clear(Option_t *option = ""){
for(int i=0; i<NDSSSD; i++){
fdsssd[i]->Clear();
fdsssd[i]->SetDSSSD(i);
}
}
//! return the DSSSD information
DSSSD* GetDSSSD(int i){return fdsssd[i];}
//! printing information
void Print(Option_t *option = "") const {
for(int i=0; i<NDSSSD; i++)
fdsssd[i]->Print();
}
protected:
//! sub DSSSD
DSSSD* fdsssd[NDSSSD];
/// \cond CLASSIMP
ClassDef(WASABI,1);
/// \endcond
};
/*!
Compare two hits by their energies
*/
class WASABIHitComparer {
public:
//! compares energies of the hits
bool operator() ( WASABIHit *lhs, WASABIHit *rhs) {
return (*lhs).GetEn() > (*rhs).GetEn();
}
};
#endif
|
649c47e950c4e5d4e2868ee4c83204ce3ac080a7
|
fae75dec669599ea65477ba9cc20e43cd70fdef8
|
/module00/ex01/Contact.class.hpp
|
64e36ac40a8260ee8143d3243ee80f8780abad74
|
[] |
no_license
|
poringdol/CPP_module
|
64851acf86e1edde3cbfd019dfe7bf39962f410b
|
8903d8a4dcbf63509bdf805e70584f0682eba6e8
|
refs/heads/master
| 2023-01-20T15:05:47.800022
| 2020-12-06T01:55:24
| 2020-12-06T01:55:24
| 308,949,414
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 694
|
hpp
|
Contact.class.hpp
|
#ifndef CONTACT_H
#define CONTACT_H
#include <string>
class Contact {
private:
int not_empty;
std::string first_name;
std::string last_name;
std::string nickname;
std::string login;
std::string postal_address;
std::string email_address;
std::string phone_number;
std::string birthday_date;
std::string favorite_meal;
std::string underwear_color;
std::string darkest_secret;
public:
Contact(void);
~Contact(void);
int get_not_empty() const;
std::string get_first_name() const;
std::string get_last_name() const;
std::string get_nickname() const;
void clear(void);
void input(void);
void print(void) const;
void print_width_10(const std::string &str) const;
};
#endif
|
f340f2b9a85e72146983821d8f79966af8459f9a
|
d1120d6a0db57fb3252be42dc5ece3a2dbbc07f2
|
/Myprojects/sCoreLib/TObjectMgr.cpp
|
ab7d4ecbe73c02e3fefa746d3feab21b3430431d
|
[] |
no_license
|
shjii/Map-Tool
|
c8da9b53017ad162e11c498b66313c9c5710f8a4
|
597b5f8c541094f1090b003175cc1955b64ebbe4
|
refs/heads/master
| 2023-05-09T06:59:32.359465
| 2021-05-26T07:05:22
| 2021-05-26T07:05:22
| 315,503,404
| 0
| 0
| null | null | null | null |
UHC
|
C++
| false
| false
| 12,941
|
cpp
|
TObjectMgr.cpp
|
#include "TObjectMgr.h"
#include "TInput.h"
TObject* TObjectComposite::Clone()
{
TObjectComposite* pComposite = new TObjectComposite(*this);
auto pSource = pComposite->m_Components.begin();
for (auto obj : m_Components)
{
TObject* pNewObj = obj->Clone();
*pSource = pNewObj;
pSource++;
}
return pComposite;
}
TObject* TObjectManager::Clone(wstring szName)
{
TObject* pNewObj = GetPtr(szName);
if (pNewObj != nullptr)
{
return pNewObj->Clone();
}
return pNewObj;
}
void TObjectManager::GetBitmapLoad(FILE* fp, wstring& ret)
{
TCHAR szBuffer[256] = { 0, };
TCHAR szTemp[256] = { 0, };
// nullptr,
_fgetts(szBuffer, _countof(szBuffer), fp);
_stscanf_s(szBuffer, _T("%s"), szTemp, (unsigned)_countof(szTemp));
wstring maskbmp = szTemp;
if (maskbmp != L"nullptr")
{
ret = maskbmp;
}
}
void TObjectManager::CreateEffect(std::vector<TSpriteInfo>& list)
{
for (int iEffect = 0; iEffect < list.size(); iEffect++)
{
TEffect* pEffect = new TEffect;
pEffect->Init();
pEffect->m_szName = list[iEffect].szName;
pEffect->Load(list[iEffect].colorbitmap.c_str(), list[iEffect].maskbitmap.c_str());
TPoint p = { 0,0 };
pEffect->Set(p, list[iEffect].rtArray[0]);
pEffect->SetSprite(list[iEffect].rtArray);
Add(pEffect);
}
}
void TObjectManager::CreateObject(std::vector<TObjAttribute>& list)
{
//for (TObjAttribute& info : list)
//{
// TObject* pObj = new TObject;
// pObj->m_szName = info.szName;
// pObj->m_Attribute = info;
// pObj->Init();
// if (info.bColorKey == false)
// {
// pObj->Load(info.colorbitmap.c_str(),
// info.maskbitmap.c_str());
// }
// else
// {
// pObj->Load(info.colorbitmap.c_str(),
// nullptr,
// info.dwColor);
// }
// // state
// pObj->m_StateBitmap.resize(4);
// pObj->m_StateBitmap[DEFAULT] =
// pObj->m_pColorBmp;
// if (!info.pushbitmap.empty())
// {
// pObj->m_StateBitmap[PUSH] =
// g_BitmapMgr.Load(info.pushbitmap.c_str());
// }
// if (!info.selectbitmap.empty())
// {
// pObj->m_StateBitmap[SELECT] =
// g_BitmapMgr.Load(info.selectbitmap.c_str());
// }
// if (!info.disbitmap.empty())
// {
// pObj->m_StateBitmap[DISABLE] =
// g_BitmapMgr.Load(info.disbitmap.c_str());
// }
// pObj->Set(info.pos, info.rtSrc);
// Add(pObj);
//}
}
bool TObjectManager::LoadEffectFile(T_STR szFileName, std::vector<TSpriteInfo>& list)
{
FILE* fp = nullptr;
_wfopen_s(&fp, szFileName.c_str(), L"rt");
if (fp == nullptr) return false;
TCHAR szBuffer[256] = { 0, };
TCHAR szTemp[256] = { 0, };
TCHAR szTempParent[256] = { 0, };
if (fp != nullptr)
{
TObjAttribute objinfo;
int iMaxCount = 0;
_fgetts(szBuffer, _countof(szBuffer), fp);
_stscanf_s(szBuffer, _T("%s %s %d"), szTemp, (unsigned)_countof(szTemp), szTempParent, (unsigned)_countof(szTempParent), &iMaxCount);
objinfo.szName = szTemp;
objinfo.szParentName = szTempParent;
while (1)
{
TSpriteInfo tSprite;
int iNumFrame = 0;
_fgetts(szBuffer, _countof(szBuffer), fp);
_stscanf_s(szBuffer, _T("%s %s %d"), szTemp, (unsigned)_countof(szTemp), szTempParent, (unsigned)_countof(szTempParent), &iNumFrame);
//list[iCnt].resize(iNumFrame);
tSprite.szName = szTemp;
tSprite.szParentName = szTempParent;
if (tSprite.szName == L"END")
{
break;
}
_fgetts(szBuffer, _countof(szBuffer), fp);
_stscanf_s(szBuffer, _T("%s"), szTemp, (unsigned)_countof(szTemp));
tSprite.colorbitmap = szTemp;
_fgetts(szBuffer, _countof(szBuffer), fp);
_stscanf_s(szBuffer, _T("%s"), szTemp, (unsigned)_countof(szTemp));
tSprite.maskbitmap = szTemp;
RECT rt;
for (int iFrame = 0; iFrame < iNumFrame; iFrame++)
{
_fgetts(szBuffer, _countof(szBuffer), fp);
_stscanf_s(szBuffer, _T("%s %d %d %d %d"), szTemp, (unsigned)_countof(szTemp),
&rt.left, &rt.top, &rt.right, &rt.bottom);
tSprite.rtArray.push_back(rt);
}
list.push_back(tSprite);
}
}
fclose(fp);
return true;
}
bool TObjectManager::LoadObjectFile(T_STR szFileName, std::vector<TObjAttribute>& list)
{
FILE* fp = nullptr;
_wfopen_s(&fp, szFileName.c_str(), L"rt");
if (fp == nullptr) return false;
TCHAR szBuffer[256] = { 0, };
TCHAR szTemp[256] = { 0, };
TCHAR szTempParent[256] = { 0, };
if (fp != nullptr)
{
TObjAttribute objhead;
int iMaxCount = 0;
_fgetts(szBuffer, _countof(szBuffer), fp);
_stscanf_s(szBuffer, _T("%s %s %d"), szTemp, (unsigned)_countof(szTemp), szTempParent, (unsigned)_countof(szTempParent), &iMaxCount);
objhead.szName = szTemp;
objhead.szParentName = szTempParent;
while (1)
{
TObjAttribute objinfo;
_fgetts(szBuffer, _countof(szBuffer), fp);
if (_tcscmp(szBuffer, L"\n")) // 한줄 공란이 없을 경우
{
_stscanf_s(szBuffer, _T("%d"), &objinfo.iObjType);
if (objinfo.iObjType <= -1)
{
break;
}
_stscanf_s(szBuffer, _T("%d %s %s %d %d"), &objinfo.iObjType,
szTemp, (unsigned)_countof(szTemp),
szTempParent, (unsigned)_countof(szTempParent),
&objinfo.iVisible,
&objinfo.iEnable);
}
else
{
//0 //BACKGROUND
_fgetts(szBuffer, _countof(szBuffer), fp);
_stscanf_s(szBuffer, _T("%d %s %s %d %d"), &objinfo.iObjType,
szTemp, (unsigned)_countof(szTemp),
szTempParent, (unsigned)_countof(szTempParent),
&objinfo.iVisible,
&objinfo.iEnable);
}
if (objinfo.iObjType <= -1)
{
break;
}
objinfo.szName = szTemp;
objinfo.szParentName = szTempParent;
GetBitmapLoad(fp, objinfo.colorbitmap);
GetBitmapLoad(fp, objinfo.pushbitmap);
GetBitmapLoad(fp, objinfo.selectbitmap);
GetBitmapLoad(fp, objinfo.disbitmap);
GetBitmapLoad(fp, objinfo.maskbitmap);
// 0, 0,
_fgetts(szBuffer, sizeof(TCHAR) * 256, fp);
_stscanf_s(szBuffer, _T("%d%d%d%d"), &objinfo.rtDesk.left,
&objinfo.rtDesk.top,
&objinfo.rtDesk.right,
&objinfo.rtDesk.bottom);
// -1, -1, -1, -1,
_fgetts(szBuffer, sizeof(TCHAR) * 256, fp);
_stscanf_s(szBuffer, _T("%d%d%d%d"), &objinfo.rtSrc.left,
&objinfo.rtSrc.top,
&objinfo.rtSrc.right,
&objinfo.rtSrc.bottom);
objinfo.pos.x = objinfo.rtDesk.left;
objinfo.pos.y = objinfo.rtDesk.top;
// 0,255, 0, 255
int mask = 0;
int r = 0;
int g = 0;
int b = 0;
_fgetts(szBuffer, sizeof(TCHAR) * 256, fp);
_stscanf_s(szBuffer, _T("%d%d%d%d"), &mask, &r, &g, &b);
if (mask == 0)
objinfo.bColorKey = false;
else
objinfo.bColorKey = true;
objinfo.dwColor = RGB(r, g, b);
list.push_back(objinfo);
}
}
fclose(fp);
return true;
}
void TObjectManager::AddCollisionExecute(TObject* ownder, CollisionFunction func)
{
ownder->m_iCollisionObjectID = m_iExecuteCollisionID++;
m_CollisionObjectList.insert(make_pair(ownder->m_iCollisionObjectID, ownder));
g_ObjectMgr.m_fnCollisionExecute.insert(make_pair(ownder->m_iCollisionObjectID, func));
}
void TObjectManager::AddSelectExecute(TObject* ownder, SelectFunction func)
{
ownder->m_iSelectObjectID = m_iExecuteSelectID++;
m_SelectObjectList.insert(make_pair(ownder->m_iSelectObjectID, ownder));
g_ObjectMgr.m_fnSelectExecute.insert(make_pair(ownder->m_iSelectObjectID, func));
}
TObject* TObjectManager::Add(TObject* pAddObject)
{
if (pAddObject == nullptr) return nullptr;
TObject* pData = GetPtr(pAddObject->m_szName);
if (pData != nullptr)
{
return pData;
}
m_List.insert(make_pair(pAddObject->m_szName, pAddObject));
return nullptr;
}
bool TObjectManager::Load(const TCHAR* filename)
{
TCHAR drive[MAX_PATH] = { 0, };
TCHAR dir[MAX_PATH] = { 0, };
TCHAR name[MAX_PATH] = { 0, };
TCHAR ext[MAX_PATH] = { 0, };
_wsplitpath_s(filename, drive, dir, name, ext);
std::wstring key = name;
key = name;
key += ext;
FILE* fp = nullptr;
_wfopen_s(&fp, filename, L"rt");
TCHAR szBuffer[256] = { 0, };
TCHAR szTemp[256] = { 0, };
TCHAR szTempParent[256] = { 0, };
T_STR szObjType;
if (fp != nullptr)
{
TObjAttribute objinfo;
int iMaxCount = 0;
_fgetts(szBuffer, _countof(szBuffer), fp);
_stscanf_s(szBuffer, _T("%s %s %d"), szTemp, (unsigned)_countof(szTemp), szTempParent, (unsigned)_countof(szTempParent), &iMaxCount);
objinfo.szName = szTemp;
objinfo.szParentName = szTempParent;
szObjType = szTemp;
}
fclose(fp);
if (szObjType == L"#OBJECT")
{
LoadObjectFile(filename, m_ObjAttribute);
CreateObject(m_ObjAttribute);
return true;
}
if (szObjType == L"#SPRITE")
{
LoadEffectFile(filename, m_rtSpriteList);
CreateEffect(m_rtSpriteList);
return true;
}
return false;
}
TObject* TObjectManager::GetPtr(wstring filename)
{
m_iter = m_List.find(filename);
if (m_iter == m_List.end())
{
return nullptr;
}
return (*m_iter).second;
}
bool TObjectManager::Init()
{
return true;
}
bool TObjectManager::Frame()
{
for (auto src : m_SelectObjectList)
{
TObject* pSrcObj = (TObject*)src.second;
POINT ptMouse = g_Input.GetPos();
if (pSrcObj->m_Attribute.iEnable < 0) continue;
pSrcObj->m_bSelect = false;
pSrcObj->m_iImageState = 0;
pSrcObj->m_dwSelectState = TSelectState::T_DEFAULT;
if (TCollision::RectInPt(pSrcObj->m_rtCollide, ptMouse))
{
pSrcObj->m_iImageState = 1;
DWORD dwKeyState = g_Input.GetKey(VK_LBUTTON);
//pSrcObj->m_dwSelectState |= TSelectState::T_HOVER;
pSrcObj->m_dwSelectState = TSelectState::T_HOVER;
if (dwKeyState == KEY_PUSH)
{
pSrcObj->m_dwSelectState = TSelectState::T_ACTIVE;
pSrcObj->m_iImageState = 2;
}
if (dwKeyState == KEY_HOLD)
{
pSrcObj->m_dwSelectState = TSelectState::T_FOCUS;
pSrcObj->m_iImageState = 2;
}
if (dwKeyState == KEY_UP)
{
pSrcObj->m_dwSelectState = TSelectState::T_SELECTED;
pSrcObj->m_bSelect = true;
}
SelectFuncIterator calliter = m_fnSelectExecute.find(pSrcObj->m_iCollisionObjectID);
if (calliter != m_fnSelectExecute.end())
{
SelectFunction call = calliter->second;
call(ptMouse, pSrcObj->m_dwSelectState);
}
}
/*else
{
pSrcObj->m_dwSelectState &= ~TSelectState::T_HOVER;
pSrcObj->m_dwSelectState &= ~TSelectState::T_ACTIVE;
pSrcObj->m_dwSelectState &= ~TSelectState::T_FOCUS;
pSrcObj->m_dwSelectState &= ~TSelectState::T_SELECTED;
}*/
}
TOverlapState dwOverlap = TOverlapState::OVERLAP_NONE;
for (auto src : m_CollisionObjectList)
{
TObject* pSrcObj = (TObject*)src.second;
if (pSrcObj->m_bCollisionEnabled == false) continue;
if (pSrcObj->m_Attribute.iEnable < 0) continue;
for (auto desk : m_CollisionObjectList)
{
TObject* pDeskObj = (TObject*)desk.second;
if (pSrcObj == pDeskObj) continue;
if (pDeskObj->m_bCollisionEnabled == false) continue;
if (pDeskObj->m_Attribute.iEnable < 0) continue;
if (TCollision::Rect2Rect(pSrcObj->m_rtCollide, pDeskObj->m_rtCollide))
{
if (pSrcObj->m_dwOverlapState == TOverlapState::OVERLAP_BEGIN ||
pSrcObj->m_dwOverlapState == TOverlapState::OVERLAP_STAY)
{
dwOverlap = TOverlapState::OVERLAP_STAY;
pSrcObj->m_dwOverlapState = TOverlapState::OVERLAP_STAY;
}
if (pSrcObj->m_dwOverlapState == TOverlapState::OVERLAP_NONE)
{
dwOverlap = TOverlapState::OVERLAP_BEGIN;
pSrcObj->m_dwOverlapState = TOverlapState::OVERLAP_BEGIN;
}
CollisionFuncIterator calliter = m_fnCollisionExecute.find(pSrcObj->m_iCollisionObjectID);
if (calliter != m_fnCollisionExecute.end())
{
CollisionFunction call = calliter->second;
call(pDeskObj, dwOverlap);
}
/*calliter = m_fnCollisionExecute.find(pDeskObj->m_iCollisionObjectID);
if (calliter != m_fnCollisionExecute.end())
{
CollisionFunction call = calliter->second;
call(pSrcObj, dwOverlap);
}*/
}
else
{
if (pSrcObj->m_dwOverlapState == TOverlapState::OVERLAP_BEGIN ||
pSrcObj->m_dwOverlapState == TOverlapState::OVERLAP_STAY)
{
dwOverlap = TOverlapState::OVERLAP_END;
pSrcObj->m_dwOverlapState = TOverlapState::OVERLAP_END;
CollisionFuncIterator calliter = m_fnCollisionExecute.find(pSrcObj->m_iCollisionObjectID);
if (calliter != m_fnCollisionExecute.end())
{
CollisionFunction call = calliter->second;
call(nullptr, dwOverlap);
}
}
else
{
pSrcObj->m_dwOverlapState = TOverlapState::OVERLAP_NONE;
}
}
}
}
return true;
}
bool TObjectManager::Render()
{
return true;
}
bool TObjectManager::Release()
{
for (m_iter = m_List.begin();
m_iter != m_List.end();
m_iter++)
{
(*m_iter).second->Release();
delete (*m_iter).second;
}
m_List.clear();
return true;
}
void TObjectManager::DeleteExecute(TObject* owner)
{
auto obj = m_SelectObjectList.find(owner->m_iSelectObjectID);
if (obj != m_SelectObjectList.end())
{
m_SelectObjectList.erase(obj);
}
obj = m_CollisionObjectList.find(owner->m_iCollisionObjectID);
if (obj != m_CollisionObjectList.end())
{
m_CollisionObjectList.erase(obj);
}
}
TObjectManager::TObjectManager()
{
m_szDefaultPath = L"../../data/bitmap/";
m_iExecuteSelectID = 0;
m_iExecuteCollisionID = 0;
}
TObjectManager::~TObjectManager()
{
Release();
}
|
0829133baa887921b24aaaca6ba854f3d66e965d
|
dadaf21ce416a3de15f87e5a32bd0693cb7716e8
|
/Classes/Entities/EntityTypes.h
|
7b66e6b877885d241b571c34f57194221b571f24
|
[] |
no_license
|
Crasader/Cheetah
|
59d57994ed7ca88caa986164e782847e0638afa6
|
e944c150c4dbd00eccb8c222e8c68b0fb1c6ce38
|
refs/heads/master
| 2020-12-04T17:33:17.299151
| 2015-12-25T12:08:37
| 2015-12-25T12:08:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 732
|
h
|
EntityTypes.h
|
//
// EntityTypes.h
// Cheetah
//
// Created by Plus Pingya Avalable on 2/19/2557 BE.
//
//
#ifndef __Cheetah__EntityTypes__
#define __Cheetah__EntityTypes__
#include <iostream>
enum EntityType {
ET_UNKNOWN,
ET_UNWANTED_TREE,
ET_DECORATION_REMOVABLE,
ET_BUILDING_HQ,
ET_BUILDING_UNCLE_HOUSE,
ET_BUILDING_TICKETBOOTH,
ET_BUILDING_COIN_STORAGE,
ET_BUILDING_HABITAT,
ET_BUILDING_ANIMAL,
ET_BUILDING_MARKET,
ET_BUILDING_INVENTORY,
ET_BUILDING_ASSOCIATION,
ET_BUILDING_PRODUCER,
ET_BUILDING_FOOD_STORAGE,
ET_BUILDING_TRAINING,
ET_BUILDING_EXPLORER,
ET_BUILDING_LIBRARY,
};
EntityType getEntityType(void *entity_);
#endif /* defined(__Cheetah__EntityTypes__) */
|
fe1afb51bc873d06b4d2e9046a40ffd9fec35a9a
|
48b0f94b3bf19ee00e28d691a9c65b6cbb66f1d5
|
/RawToDigi/plugins/HGCalTBTextSource.cc
|
b6e3cb46df080b2317bf2168d69e3d0510e37d04
|
[] |
no_license
|
sixie/TestBeam
|
476ce9137bf3567b8ec57f39d67e5071e74aaa20
|
cf395440830442c480195fb478a6f4a6eb131253
|
refs/heads/master
| 2021-01-17T12:35:23.604689
| 2016-03-27T05:32:00
| 2016-03-27T05:32:00
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,167
|
cc
|
HGCalTBTextSource.cc
|
#include "HGCal/RawToDigi/plugins/HGCalTBTextSource.h"
//#define DEBUG
#ifdef DEBUG
#include <iostream>
#endif
bool HGCalTBTextSource::readLines()
{
m_lines.clear();
char buffer[1024];
unsigned int length, bcid;
if(feof(m_file)) return false;
// read the first line
buffer[0] = 0;
fgets(buffer, 1000, m_file);
if( sscanf(buffer, "**** Trig=%d RunId=%u", &m_event, &m_run) != 2) return false;
// read the second line
fgets(buffer, 1000, m_file);
sscanf(buffer, "*** Trig=%d ChipId=%d Len=%u BCID=%u RunId=%u", &m_event, &m_sourceId, &length, &bcid, &m_run);
fgets(buffer, 1000, m_file);
assert(strstr(buffer, "START")!=NULL);
while (!feof(m_file)) {
buffer[0] = 0;
fgets(buffer, 1000, m_file);
if (strstr(buffer, "END") || strstr(buffer,"***")!=NULL ) break; // done with this event!
assert(buffer[1]=='x');
#ifdef DEBUG
std::cout << m_event << "\t" << buffer; // buffer has a \n
#endif
m_lines.push_back(buffer);
}
return !m_lines.empty();
}
void HGCalTBTextSource::produce(edm::Event & e)
{
std::auto_ptr<FEDRawDataCollection> bare_product(new FEDRawDataCollection());
// here we parse the data
std::vector<uint16_t> skiwords;
// make sure there are an even number of 32-bit-words (a round number of 64 bit words...
if (m_lines.size() % 2) {
skiwords.push_back(0);
skiwords.push_back(0);
}
for (std::vector<std::string>::const_iterator i = m_lines.begin(); i != m_lines.end(); i++) {
uint32_t a, b;
sscanf(i->c_str(), "%x %x", &a, &b);
skiwords.push_back(uint16_t(b >> 16));
skiwords.push_back(uint16_t(b));
}
FEDRawData& fed = bare_product->FEDData(m_sourceId);
size_t len = sizeof(uint16_t) * skiwords.size();
fed.resize(len);
memcpy(fed.data(), &(skiwords[0]), len);
e.put(bare_product);
}
void HGCalTBTextSource::fillDescriptions(edm::ConfigurationDescriptions& descriptions)
{
edm::ParameterSetDescription desc;
desc.setComment("TEST");
desc.addUntracked<int>("run", 101);
desc.addUntracked<std::vector<std::string> >("fileNames");
descriptions.add("source", desc);
}
#include "FWCore/Framework/interface/InputSourceMacros.h"
DEFINE_FWK_INPUT_SOURCE(HGCalTBTextSource);
|
fca6e7b25d8f9f4d3db36d1007d21c931e53bbbd
|
68bb54411fb561cea0ae5bb398a3d901f04f0548
|
/cir_in_cir.cpp
|
a3662366468a224410b1bcd16cb9fdaa1b0bd299
|
[] |
no_license
|
AkanshA0/Computer-Graphics
|
cad6f2ca45058573cb7e17daef8dbd6c0a3e79e4
|
e0f437da061a61cb3a6c2ade24277ec7128eac22
|
refs/heads/master
| 2023-01-20T04:39:57.751111
| 2020-11-30T18:14:43
| 2020-11-30T18:14:43
| 294,007,728
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,794
|
cpp
|
cir_in_cir.cpp
|
#include<GL/glut.h>
#include<GL/gl.h>
#include<cmath>
void draw(void){
glClear(GL_COLOR_BUFFER_BIT);
float t1,t2,t3,t4,t5,t6;
//glPointSize(2);
glBegin(GL_POLYGON);
glColor3f(0,1,0);
for(int i=0;i<360;i++)
{
glVertex3f(200+150*cos(3.14159*i/180),200+150*sin(3.14159*i/180),0);
}
glEnd();
//glPointSize(2);
glBegin(GL_POLYGON);
glColor3f(0,0,1);
for(int i=0;i<360;i++)
{
glVertex3f(200+130*cos(3.14159*i/180),200+130*sin(3.14159*i/180),0);
}
glEnd();
//glPointSize(2);
glBegin(GL_POLYGON);
glColor3f(0,1,1);
for(int i=0;i<360;i++)
{
glVertex3f(200+110*cos(3.14159*i/180),200+110*sin(3.14159*i/180),0);
}
glEnd();
glBegin(GL_POLYGON);
glColor3f(1,1,0);
for(int i=0;i<360;i++)
{
glVertex3f(200+90*cos(3.14159*i/180),200+90*sin(3.14159*i/180),0);
}
glEnd();
glBegin(GL_POLYGON);
glColor3f(1,0,1);
for(int i=0;i<360;i++)
{
glVertex3f(200+70*cos(3.14159*i/180),200+70*sin(3.14159*i/180),0);
}
glEnd();
glBegin(GL_POLYGON);
glColor3f(0,1,1);
for(int i=0;i<360;i++)
{
glVertex3f(200+50*cos(3.14159*i/180),200+50*sin(3.14159*i/180),0);
}
glEnd();
glBegin(GL_POLYGON);
glColor3f(1,1,0);
for(int i=0;i<360;i++)
{
glVertex3f(200+30*cos(3.14159*i/180),200+30*sin(3.14159*i/180),0);
}
glEnd();
//glPointSize(2);
glBegin(GL_POLYGON);
glColor3f(1,0,1);
for(int i=0;i<360;i++)
{
glVertex3f(200+90*cos(3.14159*i/180),200+90*sin(3.14159*i/180),0);
}
glEnd();
glFlush();
}
int main(int argc,char** argv){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(500,500);
glutCreateWindow("Triangle in circle");
//init();
//glClearColor(0,0,0,1);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,500,0,500);
glutDisplayFunc(draw);
glutMainLoop();
return 0;
}
|
1dd52debb62aec7cd97a7d645196988633b0312a
|
3d6f999526ac252f5d68d564c553391c1c219825
|
/srcs/client_src/SpeedTreeLib/SpeedGrassRT.cpp
|
b52c1a5c1344345a0e6733ccb4028e190d28887d
|
[
"Unlicense"
] |
permissive
|
kdoggdev/cncn_m2
|
e77354257de654f6507bcd14f0589311318bcbc0
|
149087e114be2b35c3e1548f4d37d6618ae27442
|
refs/heads/main
| 2023-02-02T09:56:37.306125
| 2020-12-23T09:52:14
| 2020-12-23T09:52:14
| 337,634,606
| 0
| 1
|
Unlicense
| 2021-02-10T06:13:27
| 2021-02-10T06:13:27
| null |
UTF-8
|
C++
| false
| false
| 26,069
|
cpp
|
SpeedGrassRT.cpp
|
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT Class
//
// (c) 2003 IDV, Inc.
//
// *** INTERACTIVE DATA VISUALIZATION (IDV) PROPRIETARY INFORMATION ***
//
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Interactive Data Visualization and may
// not be copied or disclosed except in accordance with the terms of
// that agreement.
//
// Copyright (c) 2001-2003 IDV, Inc.
// All Rights Reserved.
//
// IDV, Inc.
// 1233 Washington St. Suite 610
// Columbia, SC 29201
// Voice: (803) 799-1699
// Fax: (803) 931-0320
// Web: http://www.idvinc.com
#include "StdAfx.h"
#include "BoundaryShapeManager.h"
#ifdef USE_SPEEDGRASS
inline float VecInterpolate(float fStart, float fEnd, float fPercent)
{
return fStart + (fEnd - fStart) * fPercent;
}
#define VectorSinD(x) sinf((x) / 57.29578f)
#define VectorCosD(x) cosf((x) / 57.29578f)
using namespace std;
// macros
#ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
// static variables
float CSpeedGrassRT::m_fLodFarDistance = 100.0f;
float CSpeedGrassRT::m_fLodTransitionLength = 37.5f;
float CSpeedGrassRT::m_afUnitBillboard[12] = { 0.0f };
float CSpeedGrassRT::m_afWindDir[4] = { 1.0f, 0.3f, 0.0f, 0.0f };
// camera
float CSpeedGrassRT::m_afCameraOut[3] = { 0.0f, 1.0f, 0.0f };
float CSpeedGrassRT::m_afCameraUp[3] = { 0.0f, 0.0f, 1.0f };
float CSpeedGrassRT::m_afCameraRight[3] = { 1.0f, 0.0f, 0.0f };
float CSpeedGrassRT::m_afCameraPos[3] = { 0.0f, 0.0f, 0.0f };
float CSpeedGrassRT::m_fFieldOfView = D3DXToRadian(40.0f);
float CSpeedGrassRT::m_fAspectRatio = 4.0f / 3.0f;
// culling
float CSpeedGrassRT::m_afFrustumBox[6] = { 0.0f };
float CSpeedGrassRT::m_afFrustumMin[2] = { FLT_MAX, FLT_MAX };
float CSpeedGrassRT::m_afFrustumMax[2] = { -FLT_MAX, -FLT_MAX };
float CSpeedGrassRT::m_afFrustumPlanes[5][4] = { 0.0f };
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::SBlade::SBlade
CSpeedGrassRT::SBlade::SBlade( ) :
m_fSize(1.0f),
m_fNoise(0.0f),
m_fThrow(0.0f),
m_ucWhichTexture(0)
{
m_afBottomColor[0] = m_afBottomColor[1] = m_afBottomColor[2] = 1.0f;
m_afTopColor[0] = m_afTopColor[1] = m_afTopColor[2] = 1.0f;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::SRegion::SRegion
CSpeedGrassRT::SRegion::SRegion( ) :
m_bCulled(false),
m_fCullingRadius(1.0f)
{
m_afCenter[0] = m_afCenter[1] = m_afCenter[2] = 0.5f;
m_afMin[0] = m_afMin[1] = m_afMin[2] = 0.0f;
m_afMax[0] = m_afMax[1] = m_afMax[2] = 1.0f;
m_VertexBuffer.Destroy();
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::CSpeedGrassRT
CSpeedGrassRT::CSpeedGrassRT( ) :
m_nNumRegions(0),
m_nNumRegionCols(0),
m_nNumRegionRows(0),
m_pRegions(NULL),
m_bAllRegionsCulled(false)
{
m_afBoundingBox[0] = m_afBoundingBox[1] = m_afBoundingBox[2] = 0.0f;
m_afBoundingBox[3] = m_afBoundingBox[4] = m_afBoundingBox[5] = 1.0f;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::~CSpeedGrassRT
CSpeedGrassRT::~CSpeedGrassRT( )
{
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::DeleteRegions
void CSpeedGrassRT::DeleteRegions(void)
{
delete[] m_pRegions;
m_pRegions = NULL;
m_nNumRegions = 0;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::GetRegions
const CSpeedGrassRT::SRegion* CSpeedGrassRT::GetRegions(unsigned int& uiNumRegions)
{
uiNumRegions = m_nNumRegions;
return m_pRegions;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::ParseBsfFile
bool CSpeedGrassRT::ParseBsfFile(const char* pFilename, unsigned int nNumBlades, unsigned int uiRows, unsigned int uiCols, float fCollisionDistance)
{
bool bSuccess = false;
// copy region settings
m_nNumRegionCols = int(uiCols);
m_nNumRegionRows = int(uiRows);
// initialize bounding box
m_afBoundingBox[0] = m_afBoundingBox[1] = m_afBoundingBox[2] = FLT_MAX;
m_afBoundingBox[3] = m_afBoundingBox[4] = m_afBoundingBox[5] = -FLT_MAX;
CBoundaryShapeManager cManager;
vector<SBlade> vSceneBlades;
if (cManager.LoadBsfFile(pFilename))
{
for (unsigned int i = 0; i < nNumBlades; ++i)
{
SBlade sBlade;
// try to place a blade
if (cManager.RandomPoint(sBlade.m_afPos[0], sBlade.m_afPos[1]))
{
sBlade.m_afPos[2] = Height(sBlade.m_afPos[0], sBlade.m_afPos[1], sBlade.m_afNormal);
// CVec3 cNormal(sBlade.m_afNormal[0], sBlade.m_afNormal[1], sBlade.m_afNormal[2]);
// cNormal.Normalize( );
// cNormal[2] = -cNormal[2];
// memcpy(sBlade.m_afNormal, cNormal, 3 * sizeof(float));
D3DXVECTOR3 v3Normal(sBlade.m_afNormal[0], sBlade.m_afNormal[1], sBlade.m_afNormal[2]);
D3DXVec3Normalize(&v3Normal, &v3Normal);
v3Normal.z = -v3Normal.z;
sBlade.m_afNormal[0] = v3Normal.x;
sBlade.m_afNormal[1] = v3Normal.y;
sBlade.m_afNormal[2] = v3Normal.z;
// check against overall scene bounding box
for (int nAxis = 0; nAxis < 3; ++nAxis)
{
m_afBoundingBox[nAxis] = min(m_afBoundingBox[nAxis], sBlade.m_afPos[nAxis]);
m_afBoundingBox[nAxis + 3] = max(m_afBoundingBox[nAxis + 3], sBlade.m_afPos[nAxis]);
}
// set bottom and top color
float fHeightPercent = Color(sBlade.m_afPos[0], sBlade.m_afPos[1], sBlade.m_afNormal, sBlade.m_afTopColor, sBlade.m_afBottomColor);
sBlade.m_fSize = VecInterpolate(c_fMinBladeSize, c_fMaxBladeSize, fHeightPercent);
// assign which blade texture map
sBlade.m_ucWhichTexture = GetRandom(0, c_nNumBladeMaps - 1);
// compute wind effects
sBlade.m_fNoise = GetRandom(c_fMinBladeNoise, c_fMaxBladeNoise);
sBlade.m_fThrow = GetRandom(c_fMinBladeThrow, c_fMaxBladeThrow);
// store all blades together
vSceneBlades.push_back(sBlade);
}
}
bSuccess = true;
}
else
fprintf(stderr, "%s\n", cManager.GetCurrentError( ).c_str( ));
if (bSuccess)
CreateRegions(vSceneBlades, fCollisionDistance);
return bSuccess;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::CustomPlacement
//
// Use this function to perform custom grass blade placement. Feel free
// to add parameters as necessary but be sure to call CreateRegions( )
// at the end of the function to set up the SpeedGrass region system.
bool CSpeedGrassRT::CustomPlacement(unsigned int uiRows, unsigned int uiCols)
{
// copy region settings (do not remove)
m_nNumRegionCols = int(uiCols);
m_nNumRegionRows = int(uiRows);
// initialize bounding box (do not remove)
m_afBoundingBox[0] = m_afBoundingBox[1] = m_afBoundingBox[2] = FLT_MAX;
m_afBoundingBox[3] = m_afBoundingBox[4] = m_afBoundingBox[5] = -FLT_MAX;
// place one blade as an example
vector<SBlade> vSceneBlades;
SBlade sBlade;
sBlade.m_afPos[0] = 0.0f;
sBlade.m_afPos[1] = 0.0f;
sBlade.m_afPos[2] = 0.0f;
sBlade.m_afNormal[0] = 0.0f;
sBlade.m_afNormal[1] = 0.0f;
sBlade.m_afNormal[2] = 1.0f;
// check against overall scene bounding box (always do this)
for (int nAxis = 0; nAxis < 3; ++nAxis)
{
m_afBoundingBox[nAxis] = min(m_afBoundingBox[nAxis], sBlade.m_afPos[nAxis]);
m_afBoundingBox[nAxis + 3] = max(m_afBoundingBox[nAxis + 3], sBlade.m_afPos[nAxis]);
}
// set bottom and top color
memcpy(sBlade.m_afBottomColor, sBlade.m_afNormal, 12);
memcpy(sBlade.m_afTopColor, sBlade.m_afNormal, 12);
// assign which blade texture map
sBlade.m_ucWhichTexture = GetRandom(0, c_nNumBladeMaps - 1);
// compute wind effects
sBlade.m_fNoise = GetRandom(c_fMinBladeNoise, c_fMaxBladeNoise);
sBlade.m_fThrow = GetRandom(c_fMinBladeThrow, c_fMaxBladeThrow);
// compute dimensions
sBlade.m_fSize = GetRandom(c_fMinBladeSize, c_fMaxBladeSize);
// store all blades together
vSceneBlades.push_back(sBlade);
// create regions based on blades (do not remove)
CreateRegions(vSceneBlades);
// true = success, false = error
return true;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::GetLodParams
void CSpeedGrassRT::GetLodParams(float& fFarDistance, float& fTransitionLength)
{
fFarDistance = m_fLodFarDistance;
fTransitionLength = m_fLodTransitionLength;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::SetLodParams
void CSpeedGrassRT::SetLodParams(float fFarDistance, float fTransitionLength)
{
m_fLodFarDistance = fFarDistance;
m_fLodTransitionLength = fTransitionLength;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::Cull
//
// Using a two-dimensional projection, determine which regions
// intersect with the view frustum (+Z is assumed to be up)
void CSpeedGrassRT::Cull(void)
{
// convert raw frustum min and max values into min and max region cell indices
int anFrustumCellsMin[2], anFrustumCellsMax[2];
ConvertCoordsToCell(m_afFrustumMin, anFrustumCellsMin);
ConvertCoordsToCell(m_afFrustumMax, anFrustumCellsMax);
// set all regions to culled, modify later
for (int i = 0; i < m_nNumRegions; ++i)
m_pRegions[i].m_bCulled = true;
int nRegionsDrawn = 0;
// is the entire set of regions culled?
if ((anFrustumCellsMin[0] < 0 && anFrustumCellsMax[0] < 0) ||
(anFrustumCellsMin[0] >= m_nNumRegionCols && anFrustumCellsMax[0] >= m_nNumRegionCols) ||
(anFrustumCellsMin[1] < 0 && anFrustumCellsMax[1] < 0) ||
(anFrustumCellsMin[1] >= m_nNumRegionRows && anFrustumCellsMax[1] >= m_nNumRegionRows))
m_bAllRegionsCulled = true;
else
{
// clip cell values
anFrustumCellsMin[0] = max(anFrustumCellsMin[0], 0);
anFrustumCellsMin[1] = max(anFrustumCellsMin[1], 0);
anFrustumCellsMax[0] = min(anFrustumCellsMax[0], m_nNumRegionCols - 1);
anFrustumCellsMax[1] = min(anFrustumCellsMax[1], m_nNumRegionRows - 1);
for (i = anFrustumCellsMin[0]; i <= anFrustumCellsMax[0]; ++i)
for (int j = anFrustumCellsMin[1]; j <= anFrustumCellsMax[1]; ++j)
{
SRegion* pRegion = m_pRegions + GetRegionIndex(j, i);
pRegion->m_bCulled = OutsideFrustum(pRegion);
}
m_bAllRegionsCulled = false;
}
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::SetWindDirection
void CSpeedGrassRT::SetWindDirection(const float* pWindDir)
{
memcpy(m_afWindDir, pWindDir, 3 * sizeof(float));
m_afWindDir[3] = 0.0f;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::GetWindDirection
const float* CSpeedGrassRT::GetWindDirection(void)
{
return m_afWindDir;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::GetCameraPos
const float* CSpeedGrassRT::GetCameraPos(void)
{
return m_afCameraPos;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::SetCamera
void CSpeedGrassRT::SetCamera(const float* pPosition, const double* pModelviewMatrix)
{
memcpy(m_afCameraPos, pPosition, 3 * sizeof(float));
// "right" vector
m_afCameraRight[0] = pModelviewMatrix[0];
m_afCameraRight[1] = pModelviewMatrix[4];
m_afCameraRight[2] = pModelviewMatrix[8];
// "up" vector
m_afCameraUp[0] = pModelviewMatrix[1];
m_afCameraUp[1] = pModelviewMatrix[5];
m_afCameraUp[2] = pModelviewMatrix[9];
// "out of screen" vector
m_afCameraOut[0] = pModelviewMatrix[2];
m_afCameraOut[1] = pModelviewMatrix[6];
m_afCameraOut[2] = pModelviewMatrix[10];
// with direction changed, billboard turns
ComputeUnitBillboard( );
// compute new frustum box
ComputeFrustum( );
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::SetPerspective
void CSpeedGrassRT::SetPerspective(float fAspectRatio, float fFieldOfView)
{
m_fAspectRatio = fAspectRatio;
m_fFieldOfView = D3DXToRadian(fAspectRatio * fFieldOfView);
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::CreateRegions
void CSpeedGrassRT::CreateRegions(const vector<SBlade>& vSceneBlades, float fCollisionDistance)
{
// create regions based on overall extents
DeleteRegions( );
m_nNumRegions = int(m_nNumRegionRows * m_nNumRegionCols);
m_pRegions = new SRegion[m_nNumRegions];
// run through all regions, computing extents for each
float fCellWidth = (m_afBoundingBox[3] - m_afBoundingBox[0]) / m_nNumRegionCols;
float fCellHeight = (m_afBoundingBox[4] - m_afBoundingBox[1]) / m_nNumRegionRows;
float fY = m_afBoundingBox[1];
for (int nRow = 0; nRow < m_nNumRegionRows; ++nRow)
{
float fX = m_afBoundingBox[0];
for (int nCol = 0; nCol < m_nNumRegionCols; ++nCol)
{
SRegion* pRegion = m_pRegions + GetRegionIndex(nRow, nCol);
// compute extents
pRegion->m_afMin[0] = fX;
pRegion->m_afMax[0] = fX + fCellWidth;
pRegion->m_afMin[1] = fY;
pRegion->m_afMax[1] = fY + fCellHeight;
// compute center
pRegion->m_afCenter[0] = 0.5f * (pRegion->m_afMin[0] + pRegion->m_afMax[0]);
pRegion->m_afCenter[1] = 0.5f * (pRegion->m_afMin[1] + pRegion->m_afMax[1]);
// compute culling radius
pRegion->m_fCullingRadius = 1.1f * sqrt(
((pRegion->m_afMax[0] - pRegion->m_afCenter[0]) * (pRegion->m_afMax[0] - pRegion->m_afCenter[0])) +
((pRegion->m_afMax[1] - pRegion->m_afCenter[1]) * (pRegion->m_afMax[1] - pRegion->m_afCenter[1]))
);
fX += fCellWidth;
}
fY += fCellHeight;
}
// assign each blade of grass to its particular region
for (vector<SBlade>::const_iterator iBlade = vSceneBlades.begin( ); iBlade != vSceneBlades.end( ); ++iBlade)
{
// convert position to row/col index
float fPercentAlongX = (iBlade->m_afPos[0] - m_afBoundingBox[0]) / (m_afBoundingBox[3] - m_afBoundingBox[0]);
float fPercentAlongY = (iBlade->m_afPos[1] - m_afBoundingBox[1]) / (m_afBoundingBox[4] - m_afBoundingBox[1]);
// clip values
unsigned int uiCol = min(fPercentAlongX * m_nNumRegionCols, m_nNumRegionCols - 1);
unsigned int uiRow = min(fPercentAlongY * m_nNumRegionRows, m_nNumRegionRows - 1);
m_pRegions[GetRegionIndex(uiRow, uiCol)].m_vBlades.push_back(*iBlade);
}
// compute z extents (now that the blades are in)
for (int i = 0; i < m_nNumRegions; ++i)
{
SRegion* pRegion = m_pRegions + i;
pRegion->m_afMin[2] = FLT_MAX;
pRegion->m_afMax[2] = -FLT_MAX;
for (vector<SBlade>::iterator iBlade = pRegion->m_vBlades.begin( ); iBlade != pRegion->m_vBlades.end( ); ++iBlade)
{
pRegion->m_afMin[2] = min(pRegion->m_afMin[2], iBlade->m_afPos[2]);
pRegion->m_afMax[2] = max(pRegion->m_afMax[2], iBlade->m_afPos[2] + iBlade->m_fSize);
}
pRegion->m_afCenter[0] = 0.5f * (pRegion->m_afMin[0] + pRegion->m_afMax[0]);
pRegion->m_afCenter[1] = 0.5f * (pRegion->m_afMin[1] + pRegion->m_afMax[1]);
pRegion->m_afCenter[2] = 0.5f * (pRegion->m_afMin[2] + pRegion->m_afMax[2]);
// compute culling radius
pRegion->m_fCullingRadius = 1.1f * sqrt(
((pRegion->m_afMax[0] - pRegion->m_afCenter[0]) * (pRegion->m_afMax[0] - pRegion->m_afCenter[0])) +
((pRegion->m_afMax[1] - pRegion->m_afCenter[1]) * (pRegion->m_afMax[1] - pRegion->m_afCenter[1])) +
((pRegion->m_afMax[2] - pRegion->m_afCenter[2]) * (pRegion->m_afMax[2] - pRegion->m_afCenter[2]))
);
}
// collision detection
if (fCollisionDistance > 0.0f)
{
fCollisionDistance *= fCollisionDistance;
for (int nRow = 0; nRow < m_nNumRegionRows; ++nRow)
{
float fX = m_afBoundingBox[0];
for (int nCol = 0; nCol < m_nNumRegionCols; ++nCol)
{
SRegion* pRegion = m_pRegions + GetRegionIndex(nRow, nCol);
// check each blade against all other blades in the region
for (DWORD i = 0; i < pRegion->m_vBlades.size( ); ++i)
{
float fX = pRegion->m_vBlades[i].m_afPos[0];
float fY = pRegion->m_vBlades[i].m_afPos[1];
bool bCollision = false;
for (DWORD j = 0; j < pRegion->m_vBlades.size( ) && !bCollision; ++j)
{
if (i != j)
{
float fDistance = (fX - pRegion->m_vBlades[j].m_afPos[0]) * (fX - pRegion->m_vBlades[j].m_afPos[0]) + (fY - pRegion->m_vBlades[j].m_afPos[1]) * (fY - pRegion->m_vBlades[j].m_afPos[1]);
if (fDistance < fCollisionDistance)
bCollision = true;
}
}
// delete the blade if necessary and adjust the main loop counter to compensate
if (bCollision)
pRegion->m_vBlades.erase(pRegion->m_vBlades.begin( ) + i--);
}
}
}
}
}
//////////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::RotateAxisFromIdentity
__forceinline void CSpeedGrassRT::RotateAxisFromIdentity(D3DXMATRIX * pMat, const float & c_fAngle, const D3DXVECTOR3 & c_rv3Axis)
{
float s = VectorSinD(c_fAngle);
float c = VectorCosD(c_fAngle);
float t = 1.0 - c;
float x = c_rv3Axis.x;
float y = c_rv3Axis.y;
float z = c_rv3Axis.z;
pMat->_11 = t * x * x + c;
pMat->_12 = t * x * y + s * z;
pMat->_13 = t * x * z - s * y;
pMat->_21 = t * x * y - s * z;
pMat->_22 = t * y * y + c;
pMat->_23 = t * y * z + s * x;
pMat->_31 = t * x * z + s * y;
pMat->_32 = t * y * z - s * x;
pMat->_33 = t * z * z + c;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::ComputeFrustum
void CSpeedGrassRT::ComputeFrustum(void)
{
// setup useful vectors
// CVec3 cCameraIn(-m_afCameraOut[0], -m_afCameraOut[1], -m_afCameraOut[2]);
// CVec3 cCameraUp(m_afCameraUp[0], m_afCameraUp[1], m_afCameraUp[2]);
// CVec3 cCameraRight(m_afCameraRight[0], m_afCameraRight[1], m_afCameraRight[2]);
// CVec3 cCameraPos(m_afCameraPos[0], m_afCameraPos[1], m_afCameraPos[2]);
// CVec3 cFarPoint = cCameraPos + cCameraIn * (m_fLodFarDistance + m_fLodTransitionLength);
D3DXVECTOR3 cCameraIn(-m_afCameraOut[0], -m_afCameraOut[1], -m_afCameraOut[2]);
D3DXVECTOR3 cCameraUp(m_afCameraUp[0], m_afCameraUp[1], m_afCameraUp[2]);
D3DXVECTOR3 cCameraRight(m_afCameraRight[0], m_afCameraRight[1], m_afCameraRight[2]);
D3DXVECTOR3 cCameraPos(m_afCameraPos[0], m_afCameraPos[1], m_afCameraPos[2]);
D3DXVECTOR3 cFarPoint = cCameraPos + cCameraIn * (m_fLodFarDistance + m_fLodTransitionLength);
// far plane
// memcpy(m_afFrustumPlanes[0], cCameraIn, 3 * sizeof(float));
// m_afFrustumPlanes[0][3] = -(cCameraIn ^ cFarPoint); // operator^ is dot product
m_afFrustumPlanes[0][0] = cCameraIn.x;
m_afFrustumPlanes[0][1] = cCameraIn.y;
m_afFrustumPlanes[0][2] = cCameraIn.z;
m_afFrustumPlanes[0][3] = -D3DXVec3Dot(&cCameraIn, &cFarPoint); // operator^ is dot product
// CRotTransform cRotate(true);
D3DXMATRIX cRotate;
D3DXMatrixIdentity(&cRotate);
D3DXVECTOR3 cNormal;
// upper plane
// cRotate.RotateAxisFromIdentity(VecRad2Deg(0.5f * m_fFieldOfView * m_fAspectRatio + c_fHalfPi) , cCameraRight);
// CVec3 cNormal = cCameraIn * cRotate;
// cNormal.Normalize( );
// memcpy(m_afFrustumPlanes[1], cNormal, 3 * sizeof(float));
// m_afFrustumPlanes[1][3] = -(cNormal ^ cCameraPos);
// left plane
// cRotate.RotateAxisFromIdentity(VecRad2Deg(0.5f * m_fFieldOfView + c_fHalfPi) , cCameraUp);
// cNormal = cCameraIn * cRotate;
// cNormal.Normalize( );
// memcpy(m_afFrustumPlanes[2], cNormal, 3 * sizeof(float));
// m_afFrustumPlanes[2][3] = -(cNormal ^ cCameraPos);
// lower plane
// cRotate.RotateAxisFromIdentity(-VecRad2Deg(0.5f * m_fFieldOfView * m_fAspectRatio + c_fHalfPi) , cCameraRight);
// cNormal = cCameraIn * cRotate;
// cNormal.Normalize( );
// memcpy(m_afFrustumPlanes[3], cNormal, 3 * sizeof(float));
// m_afFrustumPlanes[3][3] = -(cNormal ^ cCameraPos);
// right plane
// cRotate.RotateAxisFromIdentity(-VecRad2Deg(0.5f * m_fFieldOfView + c_fHalfPi) , cCameraUp);
// cNormal = cCameraIn * cRotate;
// cNormal.Normalize( );
// memcpy(m_afFrustumPlanes[4], cNormal, 3 * sizeof(float));
// m_afFrustumPlanes[4][3] = -(cNormal ^ cCameraPos);
RotateAxisFromIdentity(&cRotate, D3DXToDegree(0.5f * m_fFieldOfView * m_fAspectRatio + c_fHalfPi), cCameraRight);
D3DXVec3TransformCoord(&cNormal, &cCameraIn, &cRotate);
D3DXVec3Normalize(&cNormal, &cNormal);
m_afFrustumPlanes[1][0] = cNormal.x;
m_afFrustumPlanes[1][1] = cNormal.y;
m_afFrustumPlanes[1][2] = cNormal.z;
m_afFrustumPlanes[1][3] = -D3DXVec3Dot(&cNormal, &cCameraPos); // operator^ is dot product
RotateAxisFromIdentity(&cRotate, D3DXToDegree(0.5f * m_fFieldOfView + c_fHalfPi), cCameraUp);
D3DXVec3TransformCoord(&cNormal, &cCameraIn, &cRotate);
D3DXVec3Normalize(&cNormal, &cNormal);
m_afFrustumPlanes[2][0] = cNormal.x;
m_afFrustumPlanes[2][1] = cNormal.y;
m_afFrustumPlanes[2][2] = cNormal.z;
m_afFrustumPlanes[2][3] = -D3DXVec3Dot(&cNormal, &cCameraPos); // operator^ is dot product
RotateAxisFromIdentity(&cRotate, -D3DXToDegree(0.5f * m_fFieldOfView * m_fAspectRatio + c_fHalfPi), cCameraRight);
D3DXVec3TransformCoord(&cNormal, &cCameraIn, &cRotate);
D3DXVec3Normalize(&cNormal, &cNormal);
m_afFrustumPlanes[3][0] = cNormal.x;
m_afFrustumPlanes[3][1] = cNormal.y;
m_afFrustumPlanes[3][2] = cNormal.z;
m_afFrustumPlanes[3][3] = -D3DXVec3Dot(&cNormal, &cCameraPos); // operator^ is dot product
RotateAxisFromIdentity(&cRotate, -D3DXToDegree(0.5f * m_fFieldOfView + c_fHalfPi), cCameraUp);
D3DXVec3TransformCoord(&cNormal, &cCameraIn, &cRotate);
D3DXVec3Normalize(&cNormal, &cNormal);
m_afFrustumPlanes[4][0] = cNormal.x;
m_afFrustumPlanes[4][1] = cNormal.y;
m_afFrustumPlanes[4][2] = cNormal.z;
m_afFrustumPlanes[4][3] = -D3DXVec3Dot(&cNormal, &cCameraPos); // operator^ is dot product
// frustum points
float fFrustumHeight = (m_fLodFarDistance + m_fLodTransitionLength) * tanf(0.5f * m_fFieldOfView);
float fFrustumWidth = (m_fLodFarDistance + m_fLodTransitionLength) * tanf(0.5f * m_fFieldOfView * m_fAspectRatio);
// CVec3 acFrustum[5];
D3DXVECTOR3 acFrustum[5];
acFrustum[0] = cCameraPos;
acFrustum[1] = cFarPoint + cCameraRight * fFrustumWidth + cCameraUp * fFrustumHeight;
acFrustum[2] = cFarPoint - cCameraRight * fFrustumWidth + cCameraUp * fFrustumHeight;
acFrustum[3] = cFarPoint - cCameraRight * fFrustumWidth - cCameraUp * fFrustumHeight;
acFrustum[4] = cFarPoint + cCameraRight * fFrustumWidth - cCameraUp * fFrustumHeight;
// find min/max (x,y) coordinates
m_afFrustumMin[0] = m_afFrustumMin[1] = FLT_MAX;
m_afFrustumMax[0] = m_afFrustumMax[1] = -FLT_MAX;
for (int i = 0; i < 5; ++i)
{
m_afFrustumMin[0] = min(m_afFrustumMin[0], acFrustum[i][0]);
m_afFrustumMax[0] = max(m_afFrustumMax[0], acFrustum[i][0]);
m_afFrustumMin[1] = min(m_afFrustumMin[1], acFrustum[i][1]);
m_afFrustumMax[1] = max(m_afFrustumMax[1], acFrustum[i][1]);
}
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::ComputeUnitBillboard
void CSpeedGrassRT::ComputeUnitBillboard(void)
{
// float fAzimuth = D3DXToDegree(atan2(-m_afCameraOut[1], -m_afCameraOut[0]));
float fAzimuth = atan2(-m_afCameraOut[1], -m_afCameraOut[0]);
// CRotTransform cTrans;
// cTrans.RotateZ(fAzimuth);
//
// static CVec3 afCorner1(0.0f, 0.5f, 1.0f);
// static CVec3 afCorner2(0.0f, -0.5f, 1.0f);
// static CVec3 afCorner3(0.0f, -0.5f, 0.0f);
// static CVec3 afCorner4(0.0f, 0.5f, 0.0f);
//
// CVec3 afNewCorner1 = afCorner1 * cTrans;
// CVec3 afNewCorner2 = afCorner2 * cTrans;
// CVec3 afNewCorner3 = afCorner3 * cTrans;
// CVec3 afNewCorner4 = afCorner4 * cTrans;
//
// memcpy(m_afUnitBillboard + 0, afNewCorner1.m_afData, 3 * sizeof(float));
// memcpy(m_afUnitBillboard + 3, afNewCorner2.m_afData, 3 * sizeof(float));
// memcpy(m_afUnitBillboard + 6, afNewCorner3.m_afData, 3 * sizeof(float));
// memcpy(m_afUnitBillboard + 9, afNewCorner4.m_afData, 3 * sizeof(float));
D3DXMATRIX cTrans;
D3DXMatrixRotationZ(&cTrans, fAzimuth);
static D3DXVECTOR3 afCorner1(0.0f, 0.5f, 1.0f);
static D3DXVECTOR3 afCorner2(0.0f, -0.5f, 1.0f);
static D3DXVECTOR3 afCorner3(0.0f, -0.5f, 0.0f);
static D3DXVECTOR3 afCorner4(0.0f, 0.5f, 0.0f);
D3DXVECTOR3 afNewCorner1;
D3DXVECTOR3 afNewCorner2;
D3DXVECTOR3 afNewCorner3;
D3DXVECTOR3 afNewCorner4;
D3DXVec3TransformCoord(&afNewCorner1, &afCorner1, &cTrans);
D3DXVec3TransformCoord(&afNewCorner2, &afCorner2, &cTrans);
D3DXVec3TransformCoord(&afNewCorner3, &afCorner3, &cTrans);
D3DXVec3TransformCoord(&afNewCorner4, &afCorner4, &cTrans);
m_afUnitBillboard[0] = afNewCorner1.x;
m_afUnitBillboard[1] = afNewCorner1.y;
m_afUnitBillboard[2] = afNewCorner1.z;
m_afUnitBillboard[3] = afNewCorner2.x;
m_afUnitBillboard[4] = afNewCorner2.y;
m_afUnitBillboard[5] = afNewCorner2.z;
m_afUnitBillboard[6] = afNewCorner3.x;
m_afUnitBillboard[7] = afNewCorner3.y;
m_afUnitBillboard[8] = afNewCorner3.z;
m_afUnitBillboard[9] = afNewCorner4.x;
m_afUnitBillboard[10] = afNewCorner4.y;
m_afUnitBillboard[11] = afNewCorner4.z;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::ConvertCoordsToCell
void CSpeedGrassRT::ConvertCoordsToCell(const float* pCoords, int* pGridCoords) const
{
float fPercentAlongX = (pCoords[0] - m_afBoundingBox[0]) / (m_afBoundingBox[3] - m_afBoundingBox[0]);
float fPercentAlongY = (pCoords[1] - m_afBoundingBox[1]) / (m_afBoundingBox[4] - m_afBoundingBox[1]);
if (fPercentAlongX < 0.0f)
pGridCoords[0] = -1;
else if (fPercentAlongX > 1.0f)
pGridCoords[0] = m_nNumRegionCols;
else
pGridCoords[0] = fPercentAlongX * m_nNumRegionCols;
if (fPercentAlongY < 0.0f)
pGridCoords[1] = -1;
else if (fPercentAlongY > 1.0f)
pGridCoords[1] = m_nNumRegionRows;
else
pGridCoords[1] = fPercentAlongY * m_nNumRegionRows;
}
///////////////////////////////////////////////////////////////////////
// CSpeedGrassRT::OutsideFrustum
__forceinline bool CSpeedGrassRT::OutsideFrustum(CSpeedGrassRT::SRegion* pRegion)
{
bool bOutside = false;
for (int i = 0; i < 5 && !bOutside; ++i)
if (m_afFrustumPlanes[i][0] * pRegion->m_afCenter[0] +
m_afFrustumPlanes[i][1] * pRegion->m_afCenter[1] +
m_afFrustumPlanes[i][2] * pRegion->m_afCenter[2] +
m_afFrustumPlanes[i][3] > pRegion->m_fCullingRadius)
bOutside = true;
return bOutside;
}
#endif // USE_SPEEDGRASS
|
6326d5ff09749f2f3d981928af00bacb636c2a25
|
e45ef0115d58ab472f156f4dfdcb2c89c6d3d728
|
/079.cpp
|
7a2d6ba577ef56cbb64aa430cf1f7c11bbfdcfaa
|
[] |
no_license
|
plenilune3/cpp_for_beginners_200
|
e0267c3dcda93ff2eba8ed0752eecb77ec038c46
|
ba1a480d8f8d7a965195e18decdd278a93a6916a
|
refs/heads/master
| 2020-06-14T03:07:20.944080
| 2019-12-19T14:18:30
| 2019-12-19T14:18:30
| 194,876,853
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 412
|
cpp
|
079.cpp
|
#include <iostream>
using namespace std;
enum Status
{
normal = 0,
abnormal,
disconnect = 100,
close
};
int main()
{
Status number = close;
if (number == Status::normal)
cout << "Status : normal" << endl;
else if (number == abnormal)
cout << "Status : abnormal" << endl;
else if (number == 100)
cout << "Status : disconnect" << endl;
else
cout << "Status : close" << endl;
return 0;
}
|
b33ecd84d9566b236a4d9bd05369cf41005b8e9a
|
1adb643675f0b144641d608d8f21d5a288c520e3
|
/express.cpp
|
b3fa721376180e215852d150bea0bdc53d103731
|
[] |
no_license
|
jianglin332/codes
|
5c965fdfca589fbbca5b651b92e4fdf64b09fd7a
|
a8a095d6da3df14b1d4fd0b12f7b58e9b366ed78
|
refs/heads/master
| 2021-05-04T12:57:19.770343
| 2018-02-05T12:50:53
| 2018-02-05T12:50:53
| 120,303,772
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 783
|
cpp
|
express.cpp
|
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
struct ed
{
int nx, to;
}es[1010101];
int hd[10101], ne;
int ans;
bool can[10101][10101];
int dfs(int t, int a)
{
can[t][a] = 1;
for (int i = hd[a]; i != -1; i = es[i].nx)
if (!can[t][es[i].to])
dfs(t, es[i].to);
}
int main(int argc, char ** argv)
{
freopen(argv[1], "r", stdin);
freopen(argv[2], "w", stdout);
memset(hd, -1, sizeof(hd));
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < m; i++)
{
int a, b;
scanf("%d%d", &a, &b);
es[ne].to = b;
es[ne].nx = hd[a];
hd[a] = ne++;
}
for (int i = 1; i <= n; i++)
{
dfs(i, i);
}
for (int i = 1; i <= n; i++)
for (int j = i + 1; j <= n; j++)
if (can[i][j] && can[j][i])
ans++;
printf("%d\n", ans);
fclose(stdout);
}
|
052f1471a07c77ac9b5a2f5eb0be9d19075c1bfa
|
9edc18e16fcd31b55dce3b979ead2e3900f6c14b
|
/cpp/123.cpp
|
859587d90752beb7540d732f291929020f4fc38f
|
[] |
no_license
|
Miloas/leetcode
|
5213421490da3418dcfd234eba66b060511ccec2
|
64c35e16763d16c905dd35d51965319dc1e71f92
|
refs/heads/master
| 2020-01-23T22:05:31.677468
| 2017-01-12T20:22:44
| 2017-01-12T20:22:44
| 74,613,994
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 392
|
cpp
|
123.cpp
|
class Solution {
public:
int maxProfit(vector<int> &prices) {
int n=prices.size();
if(!n) return 0;
int hold1=INT_MIN,hold2=INT_MIN,sale1=0,sale2=0;
for(auto x:prices){
hold1=max(hold1,-x);
sale1=max(sale1,x+hold1);
hold2=max(hold2,sale1-x);
sale2=max(sale2,hold2+x);
}
return sale2;
}
};
|
54b389dc56c5a8909eb6a1013010454897dda44f
|
c5b29a8b03ea9c961a1534065121663bd0e3faa1
|
/src/components/pins/pincomponent.h
|
7b6c5e6468aab6768558b6d38ef8fbf80fb23387
|
[] |
no_license
|
calstar/SIL
|
13aa7d92de42d69a6dfe93fbcd841f51d1a67402
|
45d0e5864aaa450ae0f34dd7b7f166dea341943d
|
refs/heads/master
| 2022-11-02T18:59:58.508965
| 2022-10-11T21:56:17
| 2022-10-11T21:56:17
| 175,512,228
| 5
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 291
|
h
|
pincomponent.h
|
#pragma once
#include "common.h"
class PinComponent {
protected:
bool isActivated;
public:
string name;
PinComponent(string name);
virtual void activate(int64_t time) = 0;
virtual void deactivate(int64_t time);
bool activated();
};
|
ee928cd3db73ba88b5b4496db3e9e7c60a35aa9a
|
1db4336089819f7734b5a59864219721cd352398
|
/src/LAppTextureDesc.cpp
|
5a4703b9531a982bb169fa9e13caa6368e2110cb
|
[] |
no_license
|
Ikari2015/Live2D
|
3f45e9e1a2ed6761791f63c3148bfbaa2f5a247c
|
650fd2ebce2b84839bcc23eb82f0325daac9a925
|
refs/heads/master
| 2021-01-15T11:41:06.757021
| 2015-08-06T09:28:24
| 2015-08-06T09:28:24
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 288
|
cpp
|
LAppTextureDesc.cpp
|
/*
* 搭载 AZUSA 使用的 Live2D 整合界面
*
* 界面基于 Live2D SDK for DirectX 2.0.06
*
* LAppTextureDesc.cpp
*/
#include "LAppTextureDesc.h"
LAppTextureDesc::LAppTextureDesc(LPDIRECT3DTEXTURE9 tex)
{
data=tex;
}
LAppTextureDesc::~LAppTextureDesc()
{
data->Release();
}
|
26bb5d5b48bf464400c909a34cef2f7c8f70f287
|
0bab4267636e3b06cb0e73fe9d31b0edd76260c2
|
/freewar-alpha/src/Graphics/update_anim.cpp
|
8721fd0001869745b0955555080a84a8f5f5e84a
|
[] |
no_license
|
BackupTheBerlios/freewar-svn
|
15fafedeed3ea1d374500d3430ff16b412b2f223
|
aa1a28f19610dbce12be463d5ccd98f712631bc3
|
refs/heads/master
| 2021-01-10T19:54:11.599797
| 2006-12-10T21:45:11
| 2006-12-10T21:45:11
| 40,725,388
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 789
|
cpp
|
update_anim.cpp
|
/*
** update_anim.c for freewar in /u/ept2/huot_j
**
** Made by jonathan huot
** Login <huot_j@epita.fr>
**
** Started on Fri Jun 11 12:06:09 2004 jonathan huot
// Last update Mon Jun 14 16:13:23 2004 stephane petitcolas
*/
#include "freewar.h"
extern t_gfx *gfx;
int update_anim(int id, int row, int dir, int newsprite)
{
if (id < 0 || id > MAXENTITY || gfx->entity[id].id_sprite == -1)
return (-1);
if (newsprite > MAXSPRITE)
return (-1);
if (newsprite != -1)
gfx->entity[id].id_sprite = newsprite;
if (dir < gfx->spk[gfx->entity[id].id_sprite].col && dir >= 0)
gfx->entity[id].col = dir;
if (row >= 1)
if (++gfx->entity[id].row >= gfx->spk[gfx->entity[id].id_sprite].row)
gfx->entity[id].row = 0;
return (0);
}
|
690f9f57b97c9bfe08249e88a9f8312a2c9eda71
|
3d711597d2d8b533f53cc023ad146f16e167e877
|
/src/fgs_main.cpp
|
eb6b71e071ac2f2de9c41523e3678c065795a232
|
[] |
no_license
|
huanglei0809/MRFGS
|
a8b2d71c2f3679b0a647e71e648e94a9c447a0e2
|
b8d754de08b68476515c6d4ef30d045379fa68dd
|
refs/heads/main
| 2023-04-11T13:03:58.300930
| 2021-04-27T14:13:55
| 2021-04-27T14:13:55
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 32,853
|
cpp
|
fgs_main.cpp
|
/*
* FANET Ground Station
*
*
*/
#include <sys/fcntl.h>
#include <syslog.h>
#include <unistd.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/pointer.h>
#include <iostream>
#include <string>
#include <list>
#include <map>
#include "../include/TDequeConcurrent.h"
#include "AprsOgnManager.h"
#include "Configuration.h"
#include "Vehicle.h"
#include "WeatherMeasure.h"
#include "WeatherStation.h"
#include "WeatherStationManager.h"
#include "FanetWeatherStation.h"
#include "Packet.h"
#include "Track.h"
#include "EntityName.h"
#include "Landmark.h"
#include "GroundStation.h"
#include "Message.h"
#include <chrono>
#include "../include/httplib.h"
#include <curl/curl.h>
#include "loguru.hpp"
extern "C" {
#include "fanet_GS/fanet_struct.h"
#include "fanet_GS/fanet_radio.h"
#include "fanet_GS/fanet_mac.h"
#include "fanet_GS/fanet_terminal.h"
#include "fanet_GS/fanet_t0_ack.h"
#include "fanet_GS/fanet_t1_tracking.h"
#include "fanet_GS/fanet_t2_name.h"
#include "fanet_GS/fanet_t3_messenger.h"
#include "fanet_GS/fanet_t4_service.h"
#include "fanet_GS/fanet_t5_landmark.h"
#include "fanet_GS/fanet_t7_tracking.h"
#include "fanet_GS/fanet_t8_hwinfo.h"
#include "fanet_GS/fanet_t9_thermal.h"
}
#include <CLI/CLI.hpp>
using namespace fanet;
using namespace rapidjson;
using namespace httplib;
bool finished = false;
//bool doLandmarkPush = false;
//---------------------------------------------------------------------
void receiveFanetWeather(
sRadioData radiodata,
sFanetMAC fanet_mac,
sWeather rx_weather_data) {
LOG_SCOPE_FUNCTION(5);
LOG_F(1, "Received Weather %02X%04X - Wind: %f %f %f",
fanet_mac.s_manufactur_id,
fanet_mac.s_unique_id,
rx_weather_data.wind_heading,
rx_weather_data.wind_speed,
rx_weather_data.wind_gusts);
WeatherMeasure *weatherMeasure = new WeatherMeasure();
char wsId[15];
sprintf(wsId, "%02X%04X", fanet_mac.s_manufactur_id, fanet_mac.s_unique_id);
weatherMeasure->weatherStationId = wsId;
weatherMeasure->timestamp = rx_weather_data.time;
weatherMeasure->manufacturerId = fanet_mac.s_manufactur_id;
weatherMeasure->uniqueId = fanet_mac.s_unique_id;
weatherMeasure->hasWindDir = true;
weatherMeasure->windDir = rx_weather_data.wind_heading;
weatherMeasure->hasWindSpeed = true;
weatherMeasure->windSpeed = rx_weather_data.wind_speed;
weatherMeasure->windGusts = rx_weather_data.wind_gusts;
if (weatherMeasure->windGusts > 0.0) {
weatherMeasure->hasWindGusts = true;
}
weatherMeasure->temperature = rx_weather_data.temperature;
if (weatherMeasure->temperature > 0.0) {
weatherMeasure->hasTemperature = true;
}
weatherMeasure->humidity = rx_weather_data.humidity;
if (weatherMeasure->humidity > 0.0) {
weatherMeasure->hasHumidity = true;
}
WeatherStationManager::getInstance()->fanetWeatherQueue.emplace_back(weatherMeasure);
LOG_F(2, "WeatherMeasure: %s", weatherMeasure->toString().c_str());
}
void sendWeather(WeatherStation *ws) {
LOG_SCOPE_FUNCTION(5);
std::mutex *_mutexRadio = &GroundStation::getInstance()->radioMutex;
if (ws->lastMeasure) {
std::unique_lock<std::mutex> lock{*_mutexRadio};
sRadioData _radiodata;
sFanetMAC _fanet_mac;
sWeather _tx_weather_data;
sRawMessage _tx_message;
_tx_weather_data.e_header = false;
strcpy(_tx_weather_data.id_station, ws->id.c_str());
strcpy(_tx_weather_data.name, ws->name.c_str());
strcpy(_tx_weather_data.short_name, ws->shortName.c_str());
_tx_weather_data.time = ws->lastMeasure->timestamp;
_tx_weather_data.longitude = ws->longitude;
_tx_weather_data.latitude = ws->latitude;
_tx_weather_data.altitude = ws->altitude;
_tx_weather_data.wind = true;
_tx_weather_data.wind_heading = ws->lastMeasure->windDir;
_tx_weather_data.wind_speed = ws->lastMeasure->windSpeed;
_tx_weather_data.wind_gusts = ws->lastMeasure->windGusts;
_tx_weather_data.temp = true;
_tx_weather_data.temperature = ws->lastMeasure->temperature;
_tx_weather_data.humid = false;
_tx_weather_data.humidity = 0.0;
_tx_weather_data.barom = false;
_tx_weather_data.barometric = 0.0;
_tx_message.m_length = 0;
type_4_service_coder(&_tx_message, &_tx_weather_data);
_fanet_mac.type = 4;
_fanet_mac.s_manufactur_id = ws->manufacturerId;
_fanet_mac.s_unique_id = ws->uniqueId;
_fanet_mac.e_header = 0;
_fanet_mac.forward = 0;
_fanet_mac.ack = 0;
_fanet_mac.cast = 0;
_fanet_mac.signature_bit = 0;
fanet_mac_coder(&_radiodata, &_fanet_mac, &_tx_message);
write_tx_data(&_radiodata, &_tx_message);
sRawMessage _rx_payload;
fanet_mac_decoder(&_fanet_mac, &_tx_message, &_rx_payload);
sWeather _rx_weather_data;
type_4_service_decoder(&_rx_payload, &_rx_weather_data);
terminal_message_4(true, false, &_radiodata, &_fanet_mac, &_rx_weather_data);
lock.unlock();
} else {
cerr << "-- no WeatherMeasure for WS: " << ws->id << "/" << ws->name << endl;
}
}
void receivepacket(bool requireValidBit, bool requireValidCRC) {
sFanetMAC _fanet_mac;
sRawMessage _rx_radio;
sRawMessage _rx_payload;
sRadioData _radiodata;
TDequeConcurrent<Track*> *trackQueuePtr = &GroundStation::getInstance()->trackQueue;
TDequeConcurrent<EntityName*> *nameQueuePtr = &GroundStation::getInstance()->nameQueue;
std::mutex *_mutexRadio = &GroundStation::getInstance()->radioMutex;
std::unique_lock<std::mutex> lock{*_mutexRadio};
bool radioRxData = read_rx_data(&_rx_radio, &_radiodata); // receive packet
if (radioRxData) { //read_rx_data(&_rx_radio, &_radiodata)) {
_fanet_mac.valid_bit = 1;
if (_radiodata.crc_err)
terminal_message_crc_err(0, 0, &_radiodata, &_fanet_mac);
fanet_mac_decoder(&_fanet_mac, &_rx_radio, &_rx_payload);
if (!_fanet_mac.valid_bit) {
terminal_message_mac_err(0, 0, &_radiodata, &_fanet_mac);
}
terminal_message_raw(0, 0, &_radiodata, &_fanet_mac, &_rx_radio);
if (_fanet_mac.type == 9) {
}
Packet *packet = new Packet();
packet->radioData = _radiodata;
packet->rawMessage = _rx_radio;
packet->fanetMAC = _fanet_mac;
LOG_F(2, "RAW: %s", packet->toString().c_str());
GroundStation::getInstance()->packetQueue.emplace_back(packet);
if (_fanet_mac.ack) {
LOG_F(1, "send - ACK: %02X:%04X->%02X:%04X",
_fanet_mac.s_manufactur_id, _fanet_mac.s_unique_id,
_fanet_mac.d_manufactur_id, _fanet_mac.d_unique_id);
send_ack(&_fanet_mac);
}
lock.unlock();
if (requireValidBit && (_fanet_mac.valid_bit == 0)) {
LOG_F(2, "invalid packet ignored - valid_bit");
return;
}
if (requireValidCRC && (_radiodata.crc_err == 1)) {
LOG_F(2, "invalid packet ignored - CRC_ERR");
return;
}
// Dispatch activities
switch (_fanet_mac.type) {
case 0:
type_0_ack_receiver(&_radiodata, &_fanet_mac, &_rx_payload);
LOG_F(2, "receive - ACK: %02X:%04X->%02X:%04X",
_fanet_mac.s_manufactur_id, _fanet_mac.s_unique_id,
_fanet_mac.d_manufactur_id, _fanet_mac.d_unique_id);
break;
case 1: {
AirTrack *airTrack = new AirTrack();
sAirTracking _rx_tracking;
type_1_tracking_decoder(&_rx_payload, &_fanet_mac, &_rx_tracking);
terminal_message_1(0, 0, &_radiodata, &_fanet_mac, &_rx_tracking);
airTrack->initFromFanetPacket(&_rx_tracking);
trackQueuePtr->emplace_back(airTrack);
LOG_F(1, "recv - %s", airTrack->toString().c_str());
break;
}
case 2: {
type_2_name_receiver(&_radiodata, &_fanet_mac, &_rx_payload);
char nameStr[256];
memset(nameStr, 0, 256);
strncpy(nameStr, _rx_payload.message, _rx_payload.m_length);
char idStr[10];
sprintf(idStr, "%02X%04X", _fanet_mac.s_manufactur_id, _fanet_mac.s_unique_id);
LOG_F(1, "recv - Id: '%s' - Name: '%s'", idStr, nameStr);
EntityName *nameEntity = new EntityName(idStr, nameStr, nameStr, _fanet_mac.s_manufactur_id, _fanet_mac.s_unique_id);
nameQueuePtr->emplace_back(nameEntity);
break;
}
case 3: {
type_3_message_receiver(&_radiodata, &_fanet_mac, &_rx_payload);
sMessage _rx_message;
type_3_message_decoder(&_rx_payload, &_rx_message);
char msgStr[256];
memset(msgStr, 0, 256);
strncpy(msgStr, _rx_payload.message+1, _rx_payload.m_length-1);
char idStr[20];
sprintf(idStr, "%02X:%04X->%02X:%04X",
_fanet_mac.s_manufactur_id, _fanet_mac.s_unique_id,
_fanet_mac.d_manufactur_id, _fanet_mac.d_unique_id);
LOG_F(1, "recv - Message: '%s' '%s'", idStr, msgStr);
break;
}
case 4:
type_4_service_receiver(&_radiodata, &_fanet_mac, &_rx_payload);
LOG_F(2, "recv - Service");
// decode FANET weather and handle as SkyTraxx weather measurement
sWeather _rx_weather_data;
type_4_service_decoder(&_rx_payload, &_rx_weather_data);
_rx_weather_data.time = time(0); // TBD
if (!_rx_weather_data.gateway)
receiveFanetWeather(_radiodata, _fanet_mac, _rx_weather_data);
break;
case 5:
LOG_F(2, "recv - Landmark");
type_5_landmark_receiver(&_radiodata, &_fanet_mac, &_rx_payload);
break;
case 7: {
GroundTrack *groundTrack = new GroundTrack();
sGroundTracking _rx_ground_tracking;
type_7_tracking_decoder(&_rx_payload, &_fanet_mac, &_rx_ground_tracking);
terminal_message_7(0, 0, &_radiodata, &_fanet_mac, &_rx_ground_tracking);
groundTrack->initFromFanetPacket(&_rx_ground_tracking);
trackQueuePtr->emplace_back(groundTrack);
LOG_F(1, "recv - %s", groundTrack->toString().c_str());
break;
}
case 8: {
LOG_F(1, "recv - HW-Info");
sHardwareInfo _hwinfo;
type_8_hwinfo_decoder(&_rx_payload, &_fanet_mac, &_hwinfo);
terminal_message_8(false, true, &_radiodata, &_fanet_mac, &_hwinfo);
break;
}
case 9: {
LOG_F(INFO, "recv - Thermal-Info");
sThermalInfo _thermalinfo;
type_9_thermal_decoder(&_rx_payload, &_fanet_mac, &_thermalinfo);
terminal_message_9(false, true, &_radiodata, &_fanet_mac, &_thermalinfo);
break;
}
default: {
LOG_F(INFO, "recv - UNKNOWN");
terminal_message_raw(false, true, &_radiodata, &_fanet_mac, &_rx_payload);
}
}
//}
memset(&_rx_payload.message, 0, sizeof(_rx_payload.message));
_rx_payload.m_length = 0;
_rx_payload.m_pointer = 0;
}
}
void trackProducer() {
loguru::set_thread_name("Radio-Receiver");
int pauseMilliSecs = Configuration::getInstance()->getValue("/configuration/features/fanetRadio/interval", 10);
LOG_F(INFO, "TrackProducer/Radio-Receiver - RUN - interval: %d", pauseMilliSecs);
bool requireValidBit = Configuration::getInstance()->getValue("/configuration/features/fanetRadio/requireValidBit", true);
bool requireValidCRC = Configuration::getInstance()->getValue("/configuration/features/fanetRadio/requireValidCRC", true);
LOG_IF_F(INFO, requireValidBit, "Radio-Receiver - require valid bit");
LOG_IF_F(INFO, !requireValidBit, "Radio-Receiver - ignore valid bit");
LOG_IF_F(INFO, requireValidCRC, "Radio-Receiver - require valid CRC");
LOG_IF_F(INFO, !requireValidCRC, "Radio-Receiver - ignore CRC");
finished = false;
while (!finished) {
receivepacket(requireValidBit, requireValidCRC);
if (pauseMilliSecs >= 0) {
std::this_thread::sleep_for(chrono::milliseconds(pauseMilliSecs));
}
}
LOG_F(INFO, "TrackProducer - END");
}
void forwardTracksToInternet(bool doTrackPush, bool pushToAprs, bool pushToKtrax, bool pushToTelegram) {
VLOG_SCOPE_F(1, "TrackConsumer - trying to consume...");
TDequeConcurrent<Track*> *trackQueuePtr = &GroundStation::getInstance()->trackQueue;
list<Track*> trackList;
if (!trackQueuePtr->empty()) {
LOG_SCOPE_FUNCTION(1);
while (!trackQueuePtr->empty()) {
auto tr = trackQueuePtr->pop_front();
LOG_F(INFO, "APRS - consuming (%lu) : %s", trackQueuePtr->size(), tr->toString().c_str());
GroundStation::getInstance()->addTrack(tr);
trackList.emplace_back(tr);
}
if (doTrackPush && pushToAprs) {
LOG_F(INFO, "TrackConsumer - push to APRS");
AprsOgnManager::getInstance()->sendTrackList(trackList);
} else {
LOG_F(INFO, "TrackConsumer - APRS - NOT sending");
}
} else {
LOG_F(INFO, "TrackConsumer - Nothing to send");
}
}
void sendFanetWeatherToInternet() {
VLOG_SCOPE_F(1, "sendFanetWeatherToInternet - trying to consume...");
TDequeConcurrent<WeatherMeasure*> *fanetWeatherQueuePtr = &WeatherStationManager::getInstance()->fanetWeatherQueue;
TDequeConcurrent<Track*> *trackQueuePtr = &GroundStation::getInstance()->trackQueue;
if (!fanetWeatherQueuePtr->empty()) {
LOG_SCOPE_FUNCTION(INFO);
while (!fanetWeatherQueuePtr->empty()) {
auto wm = fanetWeatherQueuePtr->pop_front();
LOG_F(1, "FanetWeather - consuming (%lu) : %s", trackQueuePtr->size(), wm->toString().c_str());
FanetWeatherStation *fanetWeatherStation = WeatherStationManager::getInstance()->getByFanetId(wm->manufacturerId, wm->uniqueId);
if (!fanetWeatherStation) {
char wsId[15];
sprintf(wsId, "%02X%04X", wm->manufacturerId, wm->uniqueId);
fanetWeatherStation = new FanetWeatherStation(wsId, wsId, wsId, wm->manufacturerId, wm->uniqueId, 0.0, 0.0, 0);
WeatherStationManager::getInstance()->addFanetWeatherStation(fanetWeatherStation);
}
if (fanetWeatherStation) {
fanetWeatherStation->lastMeasure = wm;
fanetWeatherStation->update();
}
}
} else {
LOG_F(1, "sendFanetWeatherToInternet - Nothing to send");
}
}
void sendWeatherToFanet(int pauseSecsBetweenStations, int maxAgeSeconds) {
LOG_SCOPE_FUNCTION(1);
map<string, WeatherStation *> * wsMap = WeatherStationManager::getInstance()->weatherStations;
for (map<string, WeatherStation *>::iterator iter = wsMap->begin(); iter != wsMap->end(); iter++) {
WeatherStation *ws = iter->second;
WeatherMeasure *wm = ws->lastMeasure;
if (wm) {
time_t now = time(0);
int ageSeconds = difftime(now, wm->timestamp);
if (ageSeconds <= maxAgeSeconds) {
LOG_F(1, "WeatherMeasure: %s - age: %d [sec]", wm->toString().c_str(), ageSeconds);
sendWeather(iter->second);
} else {
LOG_F(5, "WeatherMeasure: %s - age: %d [sec] - outdated - NOT sending", wm->toString().c_str(),
ageSeconds);
}
} else {
LOG_F(1, "no measure for station %s", iter->first.c_str());
}
LOG_F(7, "WeatherMeasureConsumer - going to sleep for %d [sec]", pauseSecsBetweenStations);
std::this_thread::sleep_for(chrono::seconds(pauseSecsBetweenStations));
}
}
void sendHwInfo(
u_int8_t manufacturerId, u_int16_t uniqueId, uint8_t device_type,
uint16_t fw_build_year, uint8_t fw_build_month, uint8_t fw_build_day, bool experimantal,
uint8_t fw_add1, uint8_t fw_add2) {
LOG_SCOPE_FUNCTION(5);
LOG_F(1, "sendHwInfo: %02X:%04X : %02d - %04d-%02d-%02d : %02X %02X",
manufacturerId, uniqueId, device_type, fw_build_year, fw_build_month, fw_build_day, fw_add1, fw_add2);
std::mutex *_mutexRadio = &GroundStation::getInstance()->radioMutex;
std::unique_lock<std::mutex> lock{*_mutexRadio};
sRadioData _radiodata;
sFanetMAC _fanet_mac;
sRawMessage _tx_rawMessage;
sHardwareInfo _tx_hwinfo;
_tx_rawMessage.m_length = 0;
_fanet_mac.type = 8;
_fanet_mac.s_manufactur_id = manufacturerId;
_fanet_mac.s_unique_id = uniqueId;
_fanet_mac.e_header = 0;
_fanet_mac.forward = 0;
_fanet_mac.cast = 0;
_fanet_mac.ack = 0;
_fanet_mac.signature_bit = 0;
memset((void*)&_tx_hwinfo, 0, sizeof(_tx_hwinfo));
_tx_hwinfo.s_address_manufactur_id = manufacturerId;
_tx_hwinfo.s_address_unique_id = uniqueId;
_tx_hwinfo.device_type = device_type;
_tx_hwinfo.experimental = experimantal;
_tx_hwinfo.fw_build_year = fw_build_year;
_tx_hwinfo.fw_build_month = fw_build_month;
_tx_hwinfo.fw_build_day = fw_build_day;
_tx_hwinfo.add1 = fw_add1;
_tx_hwinfo.add2 = fw_add2;
type_8_hwinfo_coder(&_tx_rawMessage, &_tx_hwinfo);
fanet_mac_coder(&_radiodata, &_fanet_mac, &_tx_rawMessage);
write_tx_data(&_radiodata, &_tx_rawMessage);
lock.unlock();
}
void sendMessage(bool unicast, u_int8_t s_manufacturerId, u_int16_t s_uniqueId, u_int8_t d_manufacturerId, u_int16_t d_uniqueId, string message) {
LOG_SCOPE_FUNCTION(5);
LOG_F(1, "sendMessage: %02X:%04X -> %02X:%04X : '%s'",
s_manufacturerId, s_uniqueId,
d_manufacturerId, d_uniqueId,
message.c_str());
std::mutex *_mutexRadio = &GroundStation::getInstance()->radioMutex;
std::unique_lock<std::mutex> lock{*_mutexRadio};
sRadioData _radiodata;
sFanetMAC _fanet_mac;
sRawMessage _tx_rawMessage;
sMessage _t3_message;
_tx_rawMessage.m_length = 0;
_fanet_mac.type = 3;
_fanet_mac.s_manufactur_id = s_manufacturerId;
_fanet_mac.s_unique_id = s_uniqueId;
if (unicast) {
_fanet_mac.d_manufactur_id = d_manufacturerId;
_fanet_mac.d_unique_id = d_uniqueId;
_fanet_mac.e_header = true;
_fanet_mac.forward = true;
_fanet_mac.cast = true;
_fanet_mac.ack = true;
} else {
_fanet_mac.d_manufactur_id = 0x00;
_fanet_mac.d_unique_id = 0x0000;
_fanet_mac.e_header = false;
_fanet_mac.forward = true;
_fanet_mac.cast = false;
_fanet_mac.ack = false;
}
_fanet_mac.signature_bit = false;
memset((void*)&_t3_message, 0, sizeof(_t3_message));
strcpy(_t3_message.message, message.c_str());
_t3_message.m_length = strlen(_t3_message.message);
type_3_message_coder(&_tx_rawMessage, &_t3_message);
fanet_mac_coder(&_radiodata, &_fanet_mac, &_tx_rawMessage);
write_tx_data(&_radiodata, &_tx_rawMessage);
lock.unlock();
}
void sendMessageToDevice(u_int8_t s_manufacturerId, u_int16_t s_uniqueId, u_int8_t d_manufacturerId, u_int16_t d_uniqueId, string message) {
LOG_F(1, "sendMessageToDevice: %02X:%04X -> %02X:%04X : '%s'",
s_manufacturerId, s_uniqueId,
d_manufacturerId, d_uniqueId,
message.c_str());
sendMessage(true, s_manufacturerId, s_uniqueId, d_manufacturerId, d_uniqueId, message);
}
void sendMessageToAll(u_int8_t s_manufacturerId, u_int16_t s_uniqueId, string message) {
LOG_F(1, "sendMessageToAll: %02X:%04X -> XX:XXXX : '%s'",
s_manufacturerId, s_uniqueId,
message.c_str());
sendMessage(false, s_manufacturerId, s_uniqueId, 0x00, 0x0000, message);
}
void queuesConsumer() {
LOG_F(INFO, "queuesConsumer - Start");
loguru::set_thread_name("Queue-Cons");
bool doTrackPush = Configuration::getInstance()->getValue("/configuration/features/trackPushing/active", false);
LOG_IF_F(INFO, doTrackPush, "Feature: Push Tracks");
bool doTrackPushAprs = Configuration::getInstance()->getValue("/configuration/APRS/active", false);
LOG_IF_F(INFO, doTrackPushAprs, "Feature: Push Tracks to APRS");
bool doTrackPushKtrax = Configuration::getInstance()->getValue("/configuration/KTRAX/active", false);
LOG_IF_F(INFO, doTrackPushKtrax, "Feature: Push Tracks to KTRAX");
bool doTrackPushTelegram = Configuration::getInstance()->getValue("/configuration/Telegram/active", false);
LOG_IF_F(INFO, doTrackPushTelegram, "Feature: Push Tracks to Telegram");
int intervalTrackPush = Configuration::getInstance()->getValue("/configuration/features/trackPushing/interval", 5000);
bool doWeatherPush = Configuration::getInstance()->getValue("/configuration/features/weatherPushing/active", false);
int weatherPushInterval = Configuration::getInstance()->getValue("/configuration/features/weatherPushing/interval", 120);
int pauseSecsBetweenStations = Configuration::getInstance()->getValue("/configuration/features/weatherPushing/pause", 5);
int maxAgeSeconds = Configuration::getInstance()->getValue("/configuration/features/weatherPushing/maxAge", 300);
TDequeConcurrent<Packet*>* packetQueuePtr = &GroundStation::getInstance()->packetQueue;
TDequeConcurrent<EntityName*> *nameQueuePtr = &GroundStation::getInstance()->nameQueue;
LOG_F(INFO, "WeatherMeasureConsumer - RUN - interval %d / %d [sec]", weatherPushInterval, pauseSecsBetweenStations);
while (!finished) {
LOG_F(1, "Pushing Packets to Inet/DB server");
if (!packetQueuePtr->empty()) {
while (!packetQueuePtr->empty()) {
auto packet = packetQueuePtr->pop_front();
LOG_F(1, "Packet - consuming (%lu) : %s", packetQueuePtr->size(), packet->toString().c_str());
GroundStation::getInstance()->sendPacketToDfDb(packet);
}
}
LOG_F(1, "Pushing Names to DB");
if (!nameQueuePtr->empty()) {
while (!nameQueuePtr->empty()) {
auto nameEntity = nameQueuePtr->pop_front();
LOG_F(1, "Name - consuming (%lu) : %s", nameQueuePtr->size(), nameEntity->toString().c_str());
Device *device = new Device(nameEntity->id);
device->name = nameEntity->name;
device->manufacturerId = nameEntity->manufacturerId;
device->uniqueId = nameEntity->uniqueId;
device->timestamp = time(0);
GroundStation::getInstance()->sendDeviceToDfDb(device);
}
}
LOG_F(1, "Pushing FANET track data to Inet");
forwardTracksToInternet(doTrackPush, doTrackPushAprs, doTrackPushKtrax, doTrackPushTelegram);
LOG_F(1, "Pushing FANET weather data to Inet");
sendFanetWeatherToInternet();
LOG_F(1, "Pushing weather data to FANET");
sendWeatherToFanet(pauseSecsBetweenStations, maxAgeSeconds);
LOG_F(7, "TrackConsumer - going to sleep for %d [msec]", intervalTrackPush);
std::this_thread::sleep_for(chrono::milliseconds(intervalTrackPush));
if (GroundStation::getInstance()->sendHwInfo) {
FirmwareInfo *fwInfo = &GroundStation::getInstance()->fwInfo;
sendHwInfo(GroundStation::getInstance()->manufacturerId, GroundStation::getInstance()->uniqueId,
0x42, fwInfo->year, fwInfo->month, fwInfo->day, fwInfo->experimental, fwInfo->add1, fwInfo->add2);
}
} // while
LOG_F(INFO, "queuesConsumer - END");
}
void queuesConsumer2() {
LOG_F(INFO, "queuesConsumer - 2 - Start");
loguru::set_thread_name("Queue2-Cons");
int intervalMessagePush = Configuration::getInstance()->getValue("/configuration/features/messagePushing/interval", 3000);
TDequeConcurrent<Message*> *messageQueuePtr = &GroundStation::getInstance()->messageToFanetQueue;
while (!finished) {
LOG_F(6, "Pushing Messages to FANET");
if (!messageQueuePtr->empty()) {
while (!messageQueuePtr->empty()) {
auto message = messageQueuePtr->pop_front();
LOG_F(1, "Message - consuming (%lu) : %s", messageQueuePtr->size(), message->toString().c_str());
sendMessage(message->unicast,
message->s_manufacturerId, message->s_uniqueId,
message->d_manufacturerId, message->d_uniqueId,
message->message);
std::this_thread::sleep_for(chrono::milliseconds(333));
}
}
std::this_thread::sleep_for(chrono::milliseconds(intervalMessagePush));
} // while
LOG_F(INFO, "queuesConsumer - 2 - END");
}
void weatherStationManagerRunner (int pauseSecs) {
loguru::set_thread_name("Weather-get");
LOG_F(INFO, "WeatherStationManager - RUN");
WeatherStationManager::getInstance()->run();
LOG_F(INFO, "WeatherStationManager - END");
};
void sendName(u_int8_t manufacturerId, u_int16_t uniqueId, string name) {
LOG_SCOPE_FUNCTION(5);
LOG_F(5, "sendName: %s", name.c_str());
std::mutex *_mutexRadio = &GroundStation::getInstance()->radioMutex;
std::unique_lock<std::mutex> lock{*_mutexRadio};
sRadioData _radiodata;
sFanetMAC _fanet_mac;
sRawMessage _tx_message;
sName _tx_name;
_tx_message.m_length = 0;
_fanet_mac.type = 2;
_fanet_mac.s_manufactur_id = manufacturerId;
_fanet_mac.s_unique_id = uniqueId;
_fanet_mac.e_header = false;
_fanet_mac.forward = true;
_fanet_mac.ack = false;
_fanet_mac.cast = false;
_fanet_mac.signature_bit = false;
strcpy(_tx_name.name, name.c_str());
_tx_name.n_length = strlen(_tx_name.name);
type_2_name_coder(&_tx_message, &_tx_name);
fanet_mac_coder(&_radiodata, &_fanet_mac, &_tx_message);
write_tx_data(&_radiodata, &_tx_message);
lock.unlock();
}
void nameHandler(int pauseSecs, int pauseSecsBetweenNames) {
loguru::set_thread_name("Name-push");
LOG_SCOPE_FUNCTION(INFO);
LOG_F(INFO, "EntityNameHandler - RUN - interval %d / %d [sec]", pauseSecs, pauseSecsBetweenNames);
while (!finished) {
VLOG_SCOPE_F(5, "EntityName - sending names");
list<fanet::EntityName>::iterator iter;// = EntityNameManager::getInstance()->nameList;
for (iter = EntityNameManager::getInstance()->nameList.begin(); iter != EntityNameManager::getInstance()->nameList.end(); iter++) {
LOG_F(1, "EntityName: %s", iter->toString().c_str());
sendName(iter->manufacturerId, iter->uniqueId, iter->shortName);
LOG_F(7, "EntityNameHandler - going to sleep for %d [sec]", pauseSecsBetweenNames);
std::this_thread::sleep_for(chrono::seconds(pauseSecsBetweenNames));
}
LOG_F(7, "EntityNameHandler - going to sleep for %d [sec]", pauseSecs);
std::this_thread::sleep_for(chrono::seconds(pauseSecs));
}
LOG_F(INFO, "EntityNameHandler - END");
}
void groundStationManagerRunner(int pauseSecs) {
loguru::set_thread_name("GS-RUN");
LOG_F(INFO, "GroundStationManager - RUN");
GroundStation::getInstance()->run();
LOG_F(INFO, "GroundStationManager - END");
};
void landmarkManagerRunner() {
loguru::set_thread_name("MmMgr");
LOG_F(INFO, "LandmarkManager - RUN");
bool doLandmarkPush = Configuration::getInstance()->getValue("/configuration/features/landmarkPushing/active", false);
LOG_IF_F(INFO, doLandmarkPush, "Feature: Push Landmarks");
if (doLandmarkPush) {
LandmarkManager::getInstance()->init();
LandmarkManager::getInstance()->run();
}
LOG_F(INFO, "LandmarkManager - END");
};
void vehiclePositionHandler(int pauseSecs, int pauseSecsBetweenNames) {
LOG_SCOPE_FUNCTION(INFO);
loguru::set_thread_name("Veh-Recv");
sleep(2);
LOG_F(INFO, "VehiclePositionHandler - RUN - interval %d / %d [sec]", pauseSecs, pauseSecsBetweenNames);
while (!finished) {
VLOG_SCOPE_F(5, "VehiclePositionHandler - sending vehicle positions");
for (map<string, Vehicle *>::iterator iter = GroundStation::getInstance()->vehicleMap.begin();
iter != GroundStation::getInstance()->vehicleMap.end(); iter++) {
Vehicle *vehicle = iter->second;
LOG_F(5, "updating Vehicle: %s", iter->first.c_str());
vehicle->update();
if (vehicle->lastPosition != NULL) {
LOG_F(5, "Vehicle: %s - %s", iter->first.c_str(), vehicle->lastPosition->toString().c_str());
time_t now = time(0);
if ((now - vehicle->maxAgeSeconds) <= vehicle->lastPosition->timestamp) {
GroundStation::getInstance()->addTrack(iter->second->lastPosition);
} else {
LOG_F(7, "Vehicle - last position too old");
}
}
std::this_thread::sleep_for(chrono::seconds(pauseSecsBetweenNames));
}
LOG_F(7, "VehiclePositionHandler - going to sleep for %d [sec]", pauseSecs);
std::this_thread::sleep_for(chrono::seconds(pauseSecs));
}
LOG_F(INFO, "VehiclePositionHandler - END");
}
const int sll[] = { LOG_NOTICE, LOG_NOTICE, LOG_NOTICE, LOG_INFO, LOG_INFO, LOG_DEBUG, LOG_DEBUG, LOG_DEBUG, LOG_DEBUG, LOG_DEBUG, LOG_DEBUG };
void log_to_rsyslog(void*, const loguru::Message& message)
{
int syslog_level = sll[message.verbosity];
syslog (syslog_level, "%s - %d - %s", message.filename, message.line, message.message);
}
int main(int argc, char *argv[]) {
CLI::App app("FANET Groundstation");
// add version output
app.set_version_flag("--version", string("0.0.1"));
string configFile = "./config/MRFGS.json";
CLI::Option *send_opt = app.add_option("-c,--config", configFile, "Configuration file - default: './config/MRFGS.json'");
CLI11_PARSE(app, argc, argv);
cout << "-- FANET Groundstation --" << endl;
loguru::g_stderr_verbosity = 3;
loguru::init(argc, argv);
loguru::add_callback("rsyslog", log_to_rsyslog, nullptr, loguru::Verbosity_MAX);
loguru::add_file("./log/everything.log", loguru::Truncate, 7);
char log_path[PATH_MAX];
loguru::suggest_log_path("./log/", log_path, sizeof(log_path));
loguru::add_file(log_path, loguru::Truncate, loguru::Verbosity_INFO);
LOG_F(2, "FANET Groundstation");
//---------- Locking process run
int lock_fd = open("./MRFGS.lock", O_RDWR);
if (lock_fd == -1) {
LOG_F(ERROR, "FANET GS mutex NOT created!");
perror("open");
exit(1);
}
struct flock lock_fl = {};
lock_fl.l_type = F_WRLCK;
lock_fl.l_whence = SEEK_SET;
lock_fl.l_start = 0;
lock_fl.l_len = 0;
if (fcntl(lock_fd, F_SETLK, &lock_fl) == -1) {
LOG_F(ERROR, "FANET GS mutex NOT LOCKED!");
perror("fcntl");
exit(1);
}
Configuration *config = Configuration::getInstance();
config->init(configFile);
LOG_F(INFO, "FANET Groundstation: %s", Configuration::getInstance()->getStringValue("/configuration/stationName").c_str());
int power = Configuration::getInstance()->getValue("/configuration/features/fanetRadio/power", 15);
// Initialize FANET base mechanisms
string fanetLogFileName = config->getValue("/configuration/features/fanetRadio/logfile", "./fanet_packets.txt");
FILE *fanetLogFile = fopen(fanetLogFileName.c_str(), "a");
terminal_set_file(fanetLogFile);
init_fanet_radio(1000, true, power);
Message startMsg;
startMsg.initFromText(Configuration::getInstance()->getStringValue("/configuration/stationId"),
"FFFFFF", false,
"FANET-GS " + Configuration::getInstance()->getStringValue("/configuration/stationName") + " - Start");
sendMessageToAll(startMsg.s_manufacturerId, startMsg.s_uniqueId, string(startMsg.message));
AprsOgnManager::getInstance()->connect();
std::thread threadRadioListener(trackProducer);
WeatherStationManager::getInstance()->init();
std::thread threadWeatherStationManager(weatherStationManagerRunner, 60);
std::thread threadQueuesConsumer1(queuesConsumer);
std::thread threadQueuesConsumer2(queuesConsumer2);
EntityNameManager::getInstance()->init();
std::thread threadNameHandler(nameHandler, 300, 5);
std::thread groundStationManagerThread(groundStationManagerRunner, 300);
std::thread landmarkManagerThread(landmarkManagerRunner);
std::thread threadVehiclePositionHandler(vehiclePositionHandler, 30, 2);
threadRadioListener.join();
std::cout << "finished!" << std::endl;
return 0;
}
|
7156765b15e41b76348cd2118042ea3276ba71e0
|
1c42215c5558211f02557ef1edd711d067ec78b6
|
/src/Union_MarvinHelper/Workspace/Console/CShowAnictrlCommand.h
|
9a6c93fbcad37b7872aebcba4bb763bee7a2fe64
|
[] |
no_license
|
UnresolvedExternal/Union_AlterDamage
|
fd5891c3a62896a3e2049e9fea2b3da9721c57c9
|
88b1ae773ea8e5c3762d2a5fd23b3ca7fae5c3b2
|
refs/heads/master
| 2023-07-26T13:52:00.230498
| 2023-07-11T17:49:13
| 2023-07-11T17:49:13
| 200,260,609
| 5
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 34,971
|
h
|
CShowAnictrlCommand.h
|
#include <iomanip>
namespace NAMESPACE
{
class CShowAnictrlCommand : public CConsoleCommand
{
protected:
CSubscription onLoop;
bool enabled;
struct AniInfo
{
std::string name;
int value;
AniInfo(const std::string& name, int value) :
name{ name },
value{ value }
{
for (char& ch : this->name)
switch (ch)
{
case '[':
ch = '(';
break;
case ']':
ch = ')';
break;
default:
break;
}
}
AniInfo(const AniInfo&) = default;
AniInfo(AniInfo&&) = default;
AniInfo& operator=(const AniInfo&) = default;
AniInfo& operator=(AniInfo&&) = default;
bool IsActive(oCNpc* npc) const
{
return npc->GetModel()->IsAniActive(npc->GetModel()->GetAniFromAniID(value));
}
bool IsStatic() const
{
return name.find('(') == std::string::npos;
}
std::string ToString(oCNpc* npc) const
{
zCModelAni* const ani = npc->GetModel()->GetAniFromAniID(value);
zCModelAniActive* const activeAni = npc->GetModel()->GetActiveAni(ani);
std::ostringstream out;
out << (IsActive(npc) ? "+" : "-");
out << name << " N=" << value;
if (ani)
out << " " << ani->aniName;
if (activeAni)
out << " " << std::fixed << std::setprecision(1) << activeAni->actFrame << " / " << ani->numFrames;
return out.str();
}
};
std::vector<AniInfo> GetAnis(oCNpc* npc)
{
oCAniCtrl_Human* const controller = npc->GetAnictrl();
const int wmode = npc->fmode;
std::vector<AniInfo> anis;
anis.reserve(64u);
anis.push_back({ "s_dead1", controller->s_dead1 }); // sizeof 04h offset 2C8h
anis.push_back({ "s_dead2", controller->s_dead2 }); // sizeof 04h offset 2CCh
anis.push_back({ "s_hang", controller->s_hang }); // sizeof 04h offset 2D0h
anis.push_back({ "t_hang_2_stand", controller->t_hang_2_stand }); // sizeof 04h offset 2D4h
anis.push_back({ "s_run[wmode]", controller->s_run[wmode] }); // sizeof 28h offset 2D8h
anis.push_back({ "t_run_2_runl[wmode]", controller->t_run_2_runl[wmode] }); // sizeof 28h offset 300h
anis.push_back({ "t_runl_2_run[wmode]", controller->t_runl_2_run[wmode] }); // sizeof 28h offset 328h
anis.push_back({ "s_runl[wmode]", controller->s_runl[wmode] }); // sizeof 28h offset 350h
anis.push_back({ "t_runl_2_runr[wmode]", controller->t_runl_2_runr[wmode] }); // sizeof 28h offset 378h
anis.push_back({ "t_runr_2_runl[wmode]", controller->t_runr_2_runl[wmode] }); // sizeof 28h offset 3A0h
anis.push_back({ "s_runr[wmode]", controller->s_runr[wmode] }); // sizeof 28h offset 3C8h
anis.push_back({ "t_runr_2_run[wmode]", controller->t_runr_2_run[wmode] }); // sizeof 28h offset 3F0h
anis.push_back({ "t_runturnl[wmode]", controller->t_runturnl[wmode] }); // sizeof 28h offset 418h
anis.push_back({ "t_runturnr[wmode]", controller->t_runturnr[wmode] }); // sizeof 28h offset 440h
anis.push_back({ "t_runstrafel[wmode]", controller->t_runstrafel[wmode] }); // sizeof 28h offset 468h
anis.push_back({ "t_runstrafer[wmode]", controller->t_runstrafer[wmode] }); // sizeof 28h offset 490h
anis.push_back({ "t_run_2_runbl[wmode]", controller->t_run_2_runbl[wmode] }); // sizeof 28h offset 4B8h
anis.push_back({ "t_runbl_2_run[wmode]", controller->t_runbl_2_run[wmode] }); // sizeof 28h offset 4E0h
anis.push_back({ "s_runbl[wmode]", controller->s_runbl[wmode] }); // sizeof 28h offset 508h
anis.push_back({ "t_runbl_2_runbr[wmode]", controller->t_runbl_2_runbr[wmode] }); // sizeof 28h offset 530h
anis.push_back({ "t_runbr_2_runbl[wmode]", controller->t_runbr_2_runbl[wmode] }); // sizeof 28h offset 558h
anis.push_back({ "s_runbr[wmode]", controller->s_runbr[wmode] }); // sizeof 28h offset 580h
anis.push_back({ "t_runbr_2_run[wmode]", controller->t_runbr_2_run[wmode] }); // sizeof 28h offset 5A8h
anis.push_back({ "t_jumpb[wmode]", controller->t_jumpb[wmode] }); // sizeof 28h offset 5D0h
anis.push_back({ "t_run_2_walk[wmode]", controller->t_run_2_walk[wmode] }); // sizeof 28h offset 5F8h
anis.push_back({ "t_walk_2_run[wmode]", controller->t_walk_2_run[wmode] }); // sizeof 28h offset 620h
anis.push_back({ "t_run_2_sneak[wmode]", controller->t_run_2_sneak[wmode] }); // sizeof 28h offset 648h
anis.push_back({ "t_sneak_2_run[wmode]", controller->t_sneak_2_run[wmode] }); // sizeof 28h offset 670h
anis.push_back({ "s_walk[wmode]", controller->s_walk[wmode] }); // sizeof 28h offset 698h
anis.push_back({ "t_walk_2_walkl[wmode]", controller->t_walk_2_walkl[wmode] }); // sizeof 28h offset 6C0h
anis.push_back({ "t_walkl_2_walk[wmode]", controller->t_walkl_2_walk[wmode] }); // sizeof 28h offset 6E8h
anis.push_back({ "s_walkl[wmode]", controller->s_walkl[wmode] }); // sizeof 28h offset 710h
anis.push_back({ "t_walkl_2_walkr[wmode]", controller->t_walkl_2_walkr[wmode] }); // sizeof 28h offset 738h
anis.push_back({ "t_walkr_2_walkl[wmode]", controller->t_walkr_2_walkl[wmode] }); // sizeof 28h offset 760h
anis.push_back({ "s_walkr[wmode]", controller->s_walkr[wmode] }); // sizeof 28h offset 788h
anis.push_back({ "t_walkr_2_walk[wmode]", controller->t_walkr_2_walk[wmode] }); // sizeof 28h offset 7B0h
anis.push_back({ "t_walkturnl[wmode]", controller->t_walkturnl[wmode] }); // sizeof 28h offset 7D8h
anis.push_back({ "t_walkturnr[wmode]", controller->t_walkturnr[wmode] }); // sizeof 28h offset 800h
anis.push_back({ "t_walkstrafel[wmode]", controller->t_walkstrafel[wmode] }); // sizeof 28h offset 828h
anis.push_back({ "t_walkstrafer[wmode]", controller->t_walkstrafer[wmode] }); // sizeof 28h offset 850h
anis.push_back({ "t_walk_2_walkbl[wmode]", controller->t_walk_2_walkbl[wmode] }); // sizeof 28h offset 878h
anis.push_back({ "t_walkbl_2_walk[wmode]", controller->t_walkbl_2_walk[wmode] }); // sizeof 28h offset 8A0h
anis.push_back({ "s_walkbl[wmode]", controller->s_walkbl[wmode] }); // sizeof 28h offset 8C8h
anis.push_back({ "t_walkbl_2_walkbr[wmode]", controller->t_walkbl_2_walkbr[wmode] }); // sizeof 28h offset 8F0h
anis.push_back({ "t_walkbr_2_walkbl[wmode]", controller->t_walkbr_2_walkbl[wmode] }); // sizeof 28h offset 918h
anis.push_back({ "s_walkbr[wmode]", controller->s_walkbr[wmode] }); // sizeof 28h offset 940h
anis.push_back({ "t_walkbr_2_walk[wmode]", controller->t_walkbr_2_walk[wmode] }); // sizeof 28h offset 968h
anis.push_back({ "t_runl_2_jump[wmode]", controller->t_runl_2_jump[wmode] }); // sizeof 28h offset 990h
anis.push_back({ "t_runr_2_jump[wmode]", controller->t_runr_2_jump[wmode] }); // sizeof 28h offset 9B8h
anis.push_back({ "t_jump_2_runl[wmode]", controller->t_jump_2_runl[wmode] }); // sizeof 28h offset 9E0h
anis.push_back({ "t_stand_2_jumpuplow", controller->t_stand_2_jumpuplow }); // sizeof 04h offset A08h
anis.push_back({ "s_jumpuplow", controller->s_jumpuplow }); // sizeof 04h offset A0Ch
anis.push_back({ "t_jumpuplow_2_stand", controller->t_jumpuplow_2_stand }); // sizeof 04h offset A10h
anis.push_back({ "t_stand_2_jumpupmid", controller->t_stand_2_jumpupmid }); // sizeof 04h offset A14h
anis.push_back({ "s_jumpupmid", controller->s_jumpupmid }); // sizeof 04h offset A18h
anis.push_back({ "t_jumpupmid_2_stand", controller->t_jumpupmid_2_stand }); // sizeof 04h offset A1Ch
anis.push_back({ "s_sneak[wmode]", controller->s_sneak[wmode] }); // sizeof 28h offset A20h
anis.push_back({ "t_sneak_2_sneakl[wmode]", controller->t_sneak_2_sneakl[wmode] }); // sizeof 28h offset A48h
anis.push_back({ "t_sneakl_2_sneak[wmode]", controller->t_sneakl_2_sneak[wmode] }); // sizeof 28h offset A70h
anis.push_back({ "s_sneakl[wmode]", controller->s_sneakl[wmode] }); // sizeof 28h offset A98h
anis.push_back({ "t_sneakl_2_sneakr[wmode]", controller->t_sneakl_2_sneakr[wmode] }); // sizeof 28h offset AC0h
anis.push_back({ "t_sneakr_2_sneakl[wmode]", controller->t_sneakr_2_sneakl[wmode] }); // sizeof 28h offset AE8h
anis.push_back({ "s_sneakr[wmode]", controller->s_sneakr[wmode] }); // sizeof 28h offset B10h
anis.push_back({ "t_sneakr_2_sneak[wmode]", controller->t_sneakr_2_sneak[wmode] }); // sizeof 28h offset B38h
anis.push_back({ "t_sneakturnl[wmode]", controller->t_sneakturnl[wmode] }); // sizeof 28h offset B60h
anis.push_back({ "t_sneakturnr[wmode]", controller->t_sneakturnr[wmode] }); // sizeof 28h offset B88h
anis.push_back({ "t_sneakstrafel[wmode]", controller->t_sneakstrafel[wmode] }); // sizeof 28h offset BB0h
anis.push_back({ "t_sneakstrafer[wmode]", controller->t_sneakstrafer[wmode] }); // sizeof 28h offset BD8h
anis.push_back({ "t_sneak_2_sneakbl[wmode]", controller->t_sneak_2_sneakbl[wmode] }); // sizeof 28h offset C00h
anis.push_back({ "t_sneakbl_2_sneak[wmode]", controller->t_sneakbl_2_sneak[wmode] }); // sizeof 28h offset C28h
anis.push_back({ "s_sneakbl[wmode]", controller->s_sneakbl[wmode] }); // sizeof 28h offset C50h
anis.push_back({ "t_sneakbl_2_sneakbr[wmode]", controller->t_sneakbl_2_sneakbr[wmode] }); // sizeof 28h offset C78h
anis.push_back({ "t_sneakbr_2_sneakbl[wmode]", controller->t_sneakbr_2_sneakbl[wmode] }); // sizeof 28h offset CA0h
anis.push_back({ "s_sneakbr[wmode]", controller->s_sneakbr[wmode] }); // sizeof 28h offset CC8h
anis.push_back({ "t_sneakbr_2_sneak[wmode]", controller->t_sneakbr_2_sneak[wmode] }); // sizeof 28h offset CF0h
anis.push_back({ "t_walkl_2_aim[wmode]", controller->t_walkl_2_aim[wmode] }); // sizeof 28h offset D18h
anis.push_back({ "t_walkr_2_aim[wmode]", controller->t_walkr_2_aim[wmode] }); // sizeof 28h offset D40h
anis.push_back({ "t_walk_2_aim[wmode]", controller->t_walk_2_aim[wmode] }); // sizeof 28h offset D68h
anis.push_back({ "s_aim[wmode]", controller->s_aim[wmode] }); // sizeof 28h offset D90h
anis.push_back({ "t_aim_2_walk[wmode]", controller->t_aim_2_walk[wmode] }); // sizeof 28h offset DB8h
anis.push_back({ "t_hitl[wmode]", controller->t_hitl[wmode] }); // sizeof 28h offset DE0h
anis.push_back({ "t_hitr[wmode]", controller->t_hitr[wmode] }); // sizeof 28h offset E08h
anis.push_back({ "t_hitback[wmode]", controller->t_hitback[wmode] }); // sizeof 28h offset E30h
anis.push_back({ "t_hitf[wmode]", controller->t_hitf[wmode] }); // sizeof 28h offset E58h
anis.push_back({ "s_hitf[wmode]", controller->s_hitf[wmode] }); // sizeof 28h offset E80h
anis.push_back({ "t_aim_2_defend[wmode]", controller->t_aim_2_defend[wmode] }); // sizeof 28h offset EA8h
anis.push_back({ "s_defend[wmode]", controller->s_defend[wmode] }); // sizeof 28h offset ED0h
anis.push_back({ "t_defend_2_aim[wmode]", controller->t_defend_2_aim[wmode] }); // sizeof 28h offset EF8h
anis.push_back({ "t_paradeL[wmode]", controller->t_paradeL[wmode] }); // sizeof 28h offset F20h
anis.push_back({ "t_paradeM[wmode]", controller->t_paradeM[wmode] }); // sizeof 28h offset F48h
anis.push_back({ "t_paradeS[wmode]", controller->t_paradeS[wmode] }); // sizeof 28h offset F70h
anis.push_back({ "t_hitfrun[wmode]", controller->t_hitfrun[wmode] }); // sizeof 28h offset F98h
anis.push_back({ "t_stumble", controller->t_stumble }); // sizeof 04h offset FC0h
anis.push_back({ "t_stumbleb", controller->t_stumbleb }); // sizeof 04h offset FC4h
anis.push_back({ "t_fallen_2_stand", controller->t_fallen_2_stand }); // sizeof 04h offset FC8h
anis.push_back({ "t_fallenb_2_stand", controller->t_fallenb_2_stand }); // sizeof 04h offset FCCh
anis.push_back({ "t_walk_2_walkwl", controller->t_walk_2_walkwl }); // sizeof 04h offset FD0h
anis.push_back({ "t_walkwl_2_walk", controller->t_walkwl_2_walk }); // sizeof 04h offset FD4h
anis.push_back({ "s_walkwl", controller->s_walkwl }); // sizeof 04h offset FD8h
anis.push_back({ "t_walkwl_2_walkwr", controller->t_walkwl_2_walkwr }); // sizeof 04h offset FDCh
anis.push_back({ "t_walkwr_2_walkwl", controller->t_walkwr_2_walkwl }); // sizeof 04h offset FE0h
anis.push_back({ "s_walkwr", controller->s_walkwr }); // sizeof 04h offset FE4h
anis.push_back({ "t_walkwr_2_walk", controller->t_walkwr_2_walk }); // sizeof 04h offset FE8h
anis.push_back({ "t_walk_2_walkwbl", controller->t_walk_2_walkwbl }); // sizeof 04h offset FECh
anis.push_back({ "t_walkwbl_2_walk", controller->t_walkwbl_2_walk }); // sizeof 04h offset FF0h
anis.push_back({ "s_walkwbl", controller->s_walkwbl }); // sizeof 04h offset FF4h
anis.push_back({ "t_walkwbl_2_walkwbr", controller->t_walkwbl_2_walkwbr }); // sizeof 04h offset FF8h
anis.push_back({ "t_walkwbr_2_walkwbl", controller->t_walkwbr_2_walkwbl }); // sizeof 04h offset FFCh
anis.push_back({ "s_walkwbr", controller->s_walkwbr }); // sizeof 04h offset 1000h
anis.push_back({ "t_walkwbr_2_walk", controller->t_walkwbr_2_walk }); // sizeof 04h offset 1004h
anis.push_back({ "_s_walk", controller->_s_walk }); // sizeof 04h offset 1008h
anis.push_back({ "_t_walk_2_walkl", controller->_t_walk_2_walkl }); // sizeof 04h offset 100Ch
anis.push_back({ "_t_walkl_2_walk", controller->_t_walkl_2_walk }); // sizeof 04h offset 1010h
anis.push_back({ "_s_walkl", controller->_s_walkl }); // sizeof 04h offset 1014h
anis.push_back({ "_t_walkl_2_walkr", controller->_t_walkl_2_walkr }); // sizeof 04h offset 1018h
anis.push_back({ "_t_walkr_2_walkl", controller->_t_walkr_2_walkl }); // sizeof 04h offset 101Ch
anis.push_back({ "_s_walkr", controller->_s_walkr }); // sizeof 04h offset 1020h
anis.push_back({ "_t_walkr_2_walk", controller->_t_walkr_2_walk }); // sizeof 04h offset 1024h
anis.push_back({ "_t_turnl", controller->_t_turnl }); // sizeof 04h offset 1028h
anis.push_back({ "_t_turnr", controller->_t_turnr }); // sizeof 04h offset 102Ch
anis.push_back({ "_t_strafel", controller->_t_strafel }); // sizeof 04h offset 1030h
anis.push_back({ "_t_strafer", controller->_t_strafer }); // sizeof 04h offset 1034h
anis.push_back({ "_t_walk_2_walkbl", controller->_t_walk_2_walkbl }); // sizeof 04h offset 1038h
anis.push_back({ "_t_walkbl_2_walk", controller->_t_walkbl_2_walk }); // sizeof 04h offset 103Ch
anis.push_back({ "_s_walkbl", controller->_s_walkbl }); // sizeof 04h offset 1040h
anis.push_back({ "_t_walkbl_2_walkbr", controller->_t_walkbl_2_walkbr }); // sizeof 04h offset 1044h
anis.push_back({ "_t_walkbr_2_walkbl", controller->_t_walkbr_2_walkbl }); // sizeof 04h offset 1048h
anis.push_back({ "_s_walkbr", controller->_s_walkbr }); // sizeof 04h offset 104Ch
anis.push_back({ "_t_walkbr_2_walk", controller->_t_walkbr_2_walk }); // sizeof 04h offset 1050h
anis.push_back({ "s_jumpstand", controller->s_jumpstand }); // sizeof 04h offset 1054h
anis.push_back({ "t_stand_2_jumpstand", controller->t_stand_2_jumpstand }); // sizeof 04h offset 1058h
anis.push_back({ "t_jumpstand_2_stand", controller->t_jumpstand_2_stand }); // sizeof 04h offset 105Ch
anis.push_back({ "_t_jumpb", controller->_t_jumpb }); // sizeof 04h offset 1060h
anis.push_back({ "_t_stand_2_jump", controller->_t_stand_2_jump }); // sizeof 04h offset 1064h
anis.push_back({ "_s_jump", controller->_s_jump }); // sizeof 04h offset 1068h
anis.push_back({ "t_jump_2_stand", controller->t_jump_2_stand }); // sizeof 04h offset 106Ch
anis.push_back({ "_t_stand_2_jumpup", controller->_t_stand_2_jumpup }); // sizeof 04h offset 1070h
anis.push_back({ "_s_jumpup", controller->_s_jumpup }); // sizeof 04h offset 1074h
anis.push_back({ "_t_jumpup_2_falldn", controller->_t_jumpup_2_falldn }); // sizeof 04h offset 1078h
anis.push_back({ "_t_jump_2_falldn", controller->_t_jump_2_falldn }); // sizeof 04h offset 107Ch
anis.push_back({ "t_walkwl_2_swimf", controller->t_walkwl_2_swimf }); // sizeof 04h offset 1080h
anis.push_back({ "s_swimf", controller->s_swimf }); // sizeof 04h offset 1084h
anis.push_back({ "t_swimf_2_walkwl", controller->t_swimf_2_walkwl }); // sizeof 04h offset 1088h
anis.push_back({ "t_walkwbl_2_swimb", controller->t_walkwbl_2_swimb }); // sizeof 04h offset 108Ch
anis.push_back({ "s_swimb", controller->s_swimb }); // sizeof 04h offset 1090h
anis.push_back({ "t_swimb_2_walkwbl", controller->t_swimb_2_walkwbl }); // sizeof 04h offset 1094h
anis.push_back({ "t_swimf_2_swim", controller->t_swimf_2_swim }); // sizeof 04h offset 1098h
anis.push_back({ "s_swim", controller->s_swim }); // sizeof 04h offset 109Ch
anis.push_back({ "t_swim_2_swimf", controller->t_swim_2_swimf }); // sizeof 04h offset 10A0h
anis.push_back({ "t_swim_2_swimb", controller->t_swim_2_swimb }); // sizeof 04h offset 10A4h
anis.push_back({ "t_swimb_2_swim", controller->t_swimb_2_swim }); // sizeof 04h offset 10A8h
anis.push_back({ "t_warn", controller->t_warn }); // sizeof 04h offset 10ACh
anis.push_back({ "t_swim_2_dive", controller->t_swim_2_dive }); // sizeof 04h offset 10B0h
anis.push_back({ "s_dive", controller->s_dive }); // sizeof 04h offset 10B4h
anis.push_back({ "t_divef_2_swim", controller->t_divef_2_swim }); // sizeof 04h offset 10B8h
anis.push_back({ "t_dive_2_divef", controller->t_dive_2_divef }); // sizeof 04h offset 10BCh
anis.push_back({ "s_divef", controller->s_divef }); // sizeof 04h offset 10C0h
anis.push_back({ "t_divef_2_dive", controller->t_divef_2_dive }); // sizeof 04h offset 10C4h
anis.push_back({ "t_dive_2_drowned", controller->t_dive_2_drowned }); // sizeof 04h offset 10C8h
anis.push_back({ "s_drowned", controller->s_drowned }); // sizeof 04h offset 10CCh
anis.push_back({ "t_swimturnl", controller->t_swimturnl }); // sizeof 04h offset 10D0h
anis.push_back({ "t_swimturnr", controller->t_swimturnr }); // sizeof 04h offset 10D4h
anis.push_back({ "t_diveturnl", controller->t_diveturnl }); // sizeof 04h offset 10D8h
anis.push_back({ "t_diveturnr", controller->t_diveturnr }); // sizeof 04h offset 10DCh
anis.push_back({ "_t_walkl_2_aim", controller->_t_walkl_2_aim }); // sizeof 04h offset 10E0h
anis.push_back({ "_t_walkr_2_aim", controller->_t_walkr_2_aim }); // sizeof 04h offset 10E4h
anis.push_back({ "_t_walk_2_aim", controller->_t_walk_2_aim }); // sizeof 04h offset 10E8h
anis.push_back({ "_s_aim", controller->_s_aim }); // sizeof 04h offset 10ECh
anis.push_back({ "_t_aim_2_walk", controller->_t_aim_2_walk }); // sizeof 04h offset 10F0h
anis.push_back({ "_t_hitl", controller->_t_hitl }); // sizeof 04h offset 10F4h
anis.push_back({ "_t_hitr", controller->_t_hitr }); // sizeof 04h offset 10F8h
anis.push_back({ "_t_hitback", controller->_t_hitback }); // sizeof 04h offset 10FCh
anis.push_back({ "_t_hitf", controller->_t_hitf }); // sizeof 04h offset 1100h
anis.push_back({ "_t_hitfstep", controller->_t_hitfstep }); // sizeof 04h offset 1104h
anis.push_back({ "_s_hitf", controller->_s_hitf }); // sizeof 04h offset 1108h
anis.push_back({ "_t_aim_2_defend", controller->_t_aim_2_defend }); // sizeof 04h offset 110Ch
anis.push_back({ "_s_defend", controller->_s_defend }); // sizeof 04h offset 1110h
anis.push_back({ "_t_defend_2_aim", controller->_t_defend_2_aim }); // sizeof 04h offset 1114h
anis.push_back({ "_t_paradeL", controller->_t_paradeL }); // sizeof 04h offset 1118h
anis.push_back({ "_t_paradeM", controller->_t_paradeM }); // sizeof 04h offset 111Ch
anis.push_back({ "_t_paradeS", controller->_t_paradeS }); // sizeof 04h offset 1120h
anis.push_back({ "_t_hitfrun", controller->_t_hitfrun }); // sizeof 04h offset 1124h
anis.push_back({ "t_stand_2_iaim", controller->t_stand_2_iaim }); // sizeof 04h offset 1128h
anis.push_back({ "s_iaim", controller->s_iaim }); // sizeof 04h offset 112Ch
anis.push_back({ "t_iaim_2_stand", controller->t_iaim_2_stand }); // sizeof 04h offset 1130h
anis.push_back({ "t_iaim_2_idrop", controller->t_iaim_2_idrop }); // sizeof 04h offset 1134h
anis.push_back({ "s_idrop", controller->s_idrop }); // sizeof 04h offset 1138h
anis.push_back({ "t_idrop_2_stand", controller->t_idrop_2_stand }); // sizeof 04h offset 113Ch
anis.push_back({ "t_iaim_2_ithrow", controller->t_iaim_2_ithrow }); // sizeof 04h offset 1140h
anis.push_back({ "s_ithrow", controller->s_ithrow }); // sizeof 04h offset 1144h
anis.push_back({ "t_ithrow_2_stand", controller->t_ithrow_2_stand }); // sizeof 04h offset 1148h
anis.push_back({ "t_stand_2_iget", controller->t_stand_2_iget }); // sizeof 04h offset 114Ch
anis.push_back({ "s_iget", controller->s_iget }); // sizeof 04h offset 1150h
anis.push_back({ "t_iget_2_stand", controller->t_iget_2_stand }); // sizeof 04h offset 1154h
anis.push_back({ "s_oget", controller->s_oget }); // sizeof 04h offset 1158h
anis.push_back({ "_t_stand_2_torch", controller->_t_stand_2_torch }); // sizeof 04h offset 115Ch
anis.push_back({ "_s_torch", controller->_s_torch }); // sizeof 04h offset 1160h
anis.push_back({ "_t_torch_2_stand", controller->_t_torch_2_stand }); // sizeof 04h offset 1164h
anis.push_back({ "hitani", controller->hitani }); // sizeof 04h offset 1168h
anis.push_back({ "help", controller->help }); // sizeof 04h offset 116Ch
anis.push_back({ "help1", controller->help1 }); // sizeof 04h offset 1170h
anis.push_back({ "help2", controller->help2 }); // sizeof 04h offset 1174h
anis.push_back({ "s_fall", controller->s_fall }); // sizeof 04h offset 1178h
anis.push_back({ "s_fallb", controller->s_fallb }); // sizeof 04h offset 117Ch
anis.push_back({ "s_fallen", controller->s_fallen }); // sizeof 04h offset 1180h
anis.push_back({ "s_fallenb", controller->s_fallenb }); // sizeof 04h offset 1184h
anis.push_back({ "s_falldn", controller->s_falldn }); // sizeof 04h offset 1188h
anis.push_back({ "_t_runl_2_jump", controller->_t_runl_2_jump }); // sizeof 04h offset 118Ch
anis.push_back({ "_t_runr_2_jump", controller->_t_runr_2_jump }); // sizeof 04h offset 1190h
anis.push_back({ "_t_jump_2_runl", controller->_t_jump_2_runl }); // sizeof 04h offset 1194h
anis.push_back({ "s_look", controller->s_look }); // sizeof 04h offset 1198h
anis.push_back({ "s_point", controller->s_point }); // sizeof 04h offset 119Ch
anis.push_back({ "dummy1", controller->dummy1 }); // sizeof 04h offset 11A0h
anis.push_back({ "dummy2", controller->dummy2 }); // sizeof 04h offset 11A4h
anis.push_back({ "dummy3", controller->dummy3 }); // sizeof 04h offset 11A8h
anis.push_back({ "dummy4", controller->dummy4 }); // sizeof 04h offset 11ACh
anis.push_back({ "s_weapon[wmode]", controller->s_weapon[wmode] }); // sizeof 28h offset 11B0h
anis.push_back({ "togglewalk", controller->togglewalk }); // sizeof 04h offset 11D8h
anis.push_back({ "t_stand_2_cast", controller->t_stand_2_cast }); // sizeof 04h offset 11DCh
anis.push_back({ "s_cast", controller->s_cast }); // sizeof 04h offset 11E0h
anis.push_back({ "t_cast_2_shoot", controller->t_cast_2_shoot }); // sizeof 04h offset 11E4h
anis.push_back({ "t_cast_2_stand", controller->t_cast_2_stand }); // sizeof 04h offset 11E8h
anis.push_back({ "s_shoot", controller->s_shoot }); // sizeof 04h offset 11ECh
anis.push_back({ "t_shoot_2_stand", controller->t_shoot_2_stand }); // sizeof 04h offset 11F0
return anis;
}
std::string GetWeightString(zCModelAniActive* ani)
{
if (!ani->protoAni)
return "";
float minWeight = +1e9f;
float maxWeight = -1e9f;
for (int index : ani->protoAni->nodeIndexList)
{
zCModelNodeInst* const node = player->GetModel()->nodeList[index];
for (int i = 0; i < node->numNodeAnis; i++)
if (node->nodeAniList[i].modelAni == ani)
{
minWeight = std::min(minWeight, node->nodeAniList[i].weight);
maxWeight = std::max(maxWeight, node->nodeAniList[i].weight);
}
}
minWeight *= 100.0f;
maxWeight *= 100.0f;
if (minWeight > 0.0f && minWeight < 1.0f)
minWeight = 1.0f;
if (maxWeight < 100.0f && maxWeight > 99.0f)
maxWeight = 99.0f;
std::ostringstream out;
out << std::fixed << std::setprecision(0) << minWeight << "% / " << maxWeight << "%";
return out.str();
}
void DrawTable(const std::vector<std::vector<std::string>>& table, int startX, int startY)
{
if (table.empty())
return;
static std::vector<int> sizes;
sizes.resize(table.front().size());
for (size_t x = 0; x < sizes.size(); x++)
for (size_t y = 0; y < table.size(); y++)
{
zSTRING text{ table[y][x].c_str() };
sizes[x] = std::max(sizes[x], screen->FontSize(text) + 100);
}
for (size_t x = 0; x < sizes.size(); x++)
{
for (size_t y = 0; y < table.size(); y++)
screen->Print(startX, startY + y * screen->FontY(), table[y][x].c_str());
startX += sizes[x];
}
}
std::string GetType(zCModelAni* ani)
{
std::unordered_map<int, std::string> names;
names[zMDL_ANI_TYPE_NORMAL] = "NORMAL";
names[zMDL_ANI_TYPE_BLEND] = "BLEND";
names[zMDL_ANI_TYPE_SYNC] = "SYNC";
names[zMDL_ANI_TYPE_ALIAS] = "ALIAS";
names[zMDL_ANI_TYPE_BATCH] = "BATCH";
names[zMDL_ANI_TYPE_COMB] = "COMB";
names[zMDL_ANI_TYPE_DISABLED] = "DISABLED";
return names[ani->aniType];
}
float GetBlendInValue(float blendIn)
{
return (blendIn == zMDL_ANI_BLEND_IN_ZERO) ? 0.0f : (1.0f / blendIn);
}
float GetBlendOutValue(float blendOut)
{
return (blendOut == zMDL_ANI_BLEND_OUT_ZERO) ? 0.0f : -(1.0f / blendOut);
}
void OnLoop()
{
if (!player)
return;
std::vector<AniInfo> anis = GetAnis(player);
std::vector<std::vector<std::string>> table;
table.emplace_back();
auto& row = table.back();
row.emplace_back("L");
row.emplace_back("ID");
row.emplace_back("Field");
row.emplace_back("AniName");
row.emplace_back("Frame");
row.emplace_back("BlendIn");
row.emplace_back("BlendOut");
row.emplace_back("Type");
row.emplace_back("NextAni");
row.emplace_back("Weight");
std::unordered_set<zCModelAniActive*> visitedAnis;
for (int wmode = 0; wmode <= 0; wmode++)
{
for (const AniInfo& info : anis)
if (info.IsActive(player) && info.IsStatic() != static_cast<bool>(wmode))
{
zCModelAni* const ani = player->GetModel()->GetAniFromAniID(info.value);
zCModelAniActive* const activeAni = player->GetModel()->GetActiveAni(ani);
visitedAnis.insert(activeAni);
table.emplace_back();
auto& row = table.back();
row.emplace_back(A ani->layer);
row.emplace_back(A info.value);
row.emplace_back(info.name);
row.emplace_back(A ani->aniName);
if (activeAni->isFadingOut)
row.back() += " (F)";
row.emplace_back((
std::ostringstream{} <<
std::fixed << std::setw(4) << std::setprecision(1) << activeAni->actFrame <<
" / " << ani->numFrames
).str()
);
std::ostringstream out;
out << std::setprecision(2) << GetBlendInValue(activeAni->blendInOverride) << " / " << (ani ? GetBlendInValue(ani->blendInSpeed) : 0.0f);
row.emplace_back(out.str());
out = {};
out << std::setprecision(2) << GetBlendOutValue(activeAni->blendOutOverride) << " / " << (ani ? GetBlendOutValue(ani->blendOutSpeed) : 0.0f);
row.emplace_back(out.str());
row.emplace_back(GetType(ani));
if (activeAni->nextAniOverride)
row.emplace_back(activeAni->nextAniOverride->aniName);
else
row.emplace_back(activeAni->nextAni ? activeAni->nextAni->aniName : "");
row.emplace_back(GetWeightString(activeAni));
}
}
table.push_back(std::vector<std::string>(table.front().size()));
for (int i = 0; i < player->GetModel()->numActiveAnis; i++)
if (zCModelAniActive* const activeAni = player->GetModel()->aniChannels[i])
if (activeAni && activeAni->protoAni && visitedAnis.find(activeAni) == visitedAnis.end())
{
zCModelAni* const ani = activeAni->protoAni;
table.emplace_back();
auto& row = table.back();
row.emplace_back(A activeAni->protoAni->layer);
row.emplace_back(A ani->aniID);
row.emplace_back("");
row.emplace_back(ani->aniName);
if (activeAni->isFadingOut)
row.back() += " (F)";
row.emplace_back((
std::ostringstream{} <<
std::fixed << std::setw(4) << std::setprecision(1) << activeAni->actFrame <<
" / " << ani->numFrames
).str()
);
std::ostringstream out;
out << std::setprecision(2) << GetBlendInValue(activeAni->blendInOverride) << " / " << (ani ? GetBlendInValue(ani->blendInSpeed) : 0.0f);
row.emplace_back(out.str());
out = {};
out << std::setprecision(2) << GetBlendOutValue(activeAni->blendOutOverride) << " / " << (ani ? GetBlendOutValue(ani->blendOutSpeed) : 0.0f);
row.emplace_back(out.str());
row.emplace_back(GetType(ani));
if (activeAni->nextAniOverride)
row.emplace_back(activeAni->nextAniOverride->aniName);
else
row.emplace_back(activeAni->nextAni ? activeAni->nextAni->aniName : "");
row.emplace_back(GetWeightString(activeAni));
}
DrawTable(table, 64, 4000);
}
virtual string Execute() override
{
enabled = !enabled;
if (enabled)
onLoop.Reset(TGameEvent::Loop, std::bind(&CShowAnictrlCommand::OnLoop, this));
else
onLoop.Reset();
return enabled ? "Show!" : "Hide!";
}
public:
CShowAnictrlCommand() :
CConsoleCommand("show anictrl", "Shows the player's active animations listed in the animation controller fields"),
enabled{ false }
{
}
};
}
|
c25ee9499ced6556e4b511cb93600ff74e0a6b4a
|
4d0300263d28fb461f285cc2c3dfd7c51621cb4d
|
/librtt/Input/Rtt_PlatformInputDeviceManager.cpp
|
d48684aee3023c2e8f148e372be77c2f59e4a4b9
|
[
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown"
] |
permissive
|
coronalabs/corona
|
6a108e8bfc8026e8c85e6768cdd8590b5a83bdc2
|
5e853b590f6857f43f4d1eb98ee2b842f67eef0d
|
refs/heads/master
| 2023-08-30T14:29:19.542726
| 2023-08-22T15:18:29
| 2023-08-22T15:18:29
| 163,527,358
| 2,487
| 326
|
MIT
| 2023-09-02T16:46:40
| 2018-12-29T17:05:15
|
C++
|
UTF-8
|
C++
| false
| false
| 4,730
|
cpp
|
Rtt_PlatformInputDeviceManager.cpp
|
//////////////////////////////////////////////////////////////////////////////
//
// This file is part of the Corona game engine.
// For overview and more information on licensing please refer to README.md
// Home page: https://github.com/coronalabs/corona
// Contact: support@coronalabs.com
//
//////////////////////////////////////////////////////////////////////////////
#include "Rtt_PlatformInputDeviceManager.h"
#include "Core/Rtt_Build.h"
#include "Rtt_InputDeviceType.h"
#include "Rtt_PlatformInputDevice.h"
namespace Rtt
{
// ----------------------------------------------------------------------------
// Constructors/Destructors
// ----------------------------------------------------------------------------
/// Creates a new input device manager.
/// @param allocatorPointer Allocator needed to create input device objects.
PlatformInputDeviceManager::PlatformInputDeviceManager(Rtt_Allocator *allocatorPointer)
: fDeviceCollection(allocatorPointer),
fReadOnlyDeviceCollection(&fDeviceCollection)
{
}
/// Destroys this device manager and the input devices it manages.
PlatformInputDeviceManager::~PlatformInputDeviceManager()
{
PlatformInputDevice *devicePointer;
// Delete all device objects in the main collection.
for (int index = fDeviceCollection.GetCount() - 1; index >= 0; index--)
{
devicePointer = fDeviceCollection.GetByIndex(index);
Destroy(devicePointer);
}
}
// ----------------------------------------------------------------------------
// Public Member Functions
// ----------------------------------------------------------------------------
/// Adds a new input device to the manager and assigns it a unique ID and descriptor.
/// @param type The type of input device to add such as a keyboard, mouse, gamepad, etc.
/// @return Returns a pointer to a new input device object for the given type.
PlatformInputDevice* PlatformInputDeviceManager::Add(InputDeviceType type)
{
PlatformInputDevice *devicePointer;
// Count the number of devices matching the given type.
// This counts the disconnected devices too, in case they come back later.
int deviceTypeCount = 0;
for (int index = 0; index < fDeviceCollection.GetCount(); index++)
{
devicePointer = fDeviceCollection.GetByIndex(index);
if (devicePointer && devicePointer->GetDescriptor().GetDeviceType().Equals(type))
{
deviceTypeCount++;
}
}
// Create a new device object with a unique descriptor and add it to the main collection.
// The descriptor assigns the device a unique number for its type, such as "Joystick 1".
InputDeviceDescriptor descriptor(GetAllocator(), type, deviceTypeCount + 1);
devicePointer = CreateUsing(descriptor);
fDeviceCollection.Add(devicePointer);
// Return the new device object.
return devicePointer;
}
/// Gets the allocator that this manager uses when adding new input device objects.
/// @return Returns a pointer to the allocator this manager uses.
Rtt_Allocator* PlatformInputDeviceManager::GetAllocator() const
{
return fDeviceCollection.GetAllocator();
}
/// Fetches a collection of all input devices that have ever connected to the machine.
/// @return Returns a read-only collection of all input devices.
const ReadOnlyInputDeviceCollection& PlatformInputDeviceManager::GetDevices() const
{
return fReadOnlyDeviceCollection;
}
// ----------------------------------------------------------------------------
// Protected Member Functions
// ----------------------------------------------------------------------------
/// Called when this device manager needs a new input device object to be created.
/// <br>
/// Can be overriden by a derived class to create a platform specific input device object.
/// @param descriptor Unique descriptor used to identify the new input device.
/// @return Returns a pointer to the newly created input device object.
PlatformInputDevice* PlatformInputDeviceManager::CreateUsing(const InputDeviceDescriptor &descriptor)
{
return Rtt_NEW(GetAllocator(), PlatformInputDevice(descriptor));
}
/// Called when this device manager needs to destroy the given input device object.
/// <br>
/// Can be overriden by a derived class to delete a platform specific input device object
/// in the same module/library it was created in. This is important on platforms such as
/// Windows where each module has their own heap and you must delete an object from the
/// same module that it was created in, or else a heap error would cause a crash.
/// @param devicePointer Pointer to the input device object to be deleted.
void PlatformInputDeviceManager::Destroy(PlatformInputDevice* devicePointer)
{
Rtt_DELETE(devicePointer);
}
// ----------------------------------------------------------------------------
} // namespace Rtt
|
91c066bdd514dc1a58db150268191c869a595c72
|
851d12adffa6dcdc85816c2ee6f6af129c5542b6
|
/TDEngine2/plugins/WindowsInputContext/source/CMouse.cpp
|
7d4cdf3f8c3bf767f58842625085ca7736067623
|
[
"Apache-2.0"
] |
permissive
|
bnoazx005/TDEngine2
|
775c018e1aebfe4a42f727e132780e52a80f6a96
|
ecc1683aac5df5b1581a56b6d240893f5c79161b
|
refs/heads/master
| 2023-08-31T08:07:19.288783
| 2022-05-12T16:41:06
| 2022-05-12T16:45:02
| 149,013,665
| 6
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,742
|
cpp
|
CMouse.cpp
|
#include "./../include/CMouse.h"
#include <core/IInputContext.h>
#include <math/MathUtils.h>
#include <cstring>
#if defined (TDE2_USE_WINPLATFORM)
namespace TDEngine2
{
CMouse::CMouse() :
CBaseInputDevice()
{
}
E_RESULT_CODE CMouse::_createInternalHandlers(const TInternalInputData& params)
{
IDirectInput8* pInput = params.mpInput;
if (FAILED(pInput->CreateDevice(GUID_SysMouse, &mpInputDevice, nullptr)))
{
return RC_FAIL;
}
/// \todo Replace DISCL_EXCLUSIVE | DISCL_FOREGROUND with a proper set up
if (FAILED(mpInputDevice->SetCooperativeLevel(params.mWindowHandler, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND)))
{
return RC_FAIL;
}
if (FAILED(mpInputDevice->SetDataFormat(&c_dfDIMouse2)))
{
return RC_FAIL;
}
memset(&mCurrMouseState, 0, sizeof(DIMOUSESTATE2));
return RC_OK;
}
E_RESULT_CODE CMouse::Update()
{
if (!mIsInitialized)
{
return RC_FAIL;
}
memcpy(&mPrevMouseState, &mCurrMouseState, sizeof(DIMOUSESTATE2));
HRESULT internalResult = S_OK;
if (FAILED(internalResult = mpInputDevice->GetDeviceState(sizeof(DIMOUSESTATE2), &mCurrMouseState)))
{
if (internalResult == DIERR_INPUTLOST || internalResult == DIERR_NOTACQUIRED)
{
return _acquireDevice(); /// reacquire the device if an access to it has been lost
}
return RC_FAIL;
}
return RC_OK;
}
bool CMouse::IsButtonPressed(U8 button)
{
if (button >= 8) /// \note the mice with more than 8 buttons are not supported
{
return false;
}
return !(mPrevMouseState.rgbButtons[button] & 0x80) && (mCurrMouseState.rgbButtons[button] & 0x80);
}
bool CMouse::IsButton(U8 button)
{
if (button >= 8) /// \note the mice with more than 8 buttons are not supported
{
return false;
}
return mCurrMouseState.rgbButtons[button] & 0x80;
}
bool CMouse::IsButtonUnpressed(U8 button)
{
if (button >= 8) /// \note the mice with more than 8 buttons are not supported
{
return false;
}
return (mPrevMouseState.rgbButtons[button] & 0x80) && !(mCurrMouseState.rgbButtons[button] & 0x80);
}
TVector3 CMouse::GetMousePosition() const
{
POINT cursorPos;
GetCursorPos(&cursorPos);
HWND hwnd = mpWinInputContext->GetInternalHandler().mWindowHandler;
ScreenToClient(hwnd, &cursorPos); /// convert screen coordinates into client area's ones
RECT windowBounds;
GetClientRect(hwnd, &windowBounds);
F32 x = static_cast<F32>(cursorPos.x);
/// convert from space where the origin is placed at left top corner to a space with the origin at left bottom corner
F32 y = static_cast<F32>(windowBounds.bottom - cursorPos.y);
return { x, y, 0.0f };
}
TVector2 CMouse::GetNormalizedMousePosition() const
{
TVector3 pos = GetMousePosition();
RECT windowBounds;
HWND hwnd = mpWinInputContext->GetInternalHandler().mWindowHandler;
GetClientRect(hwnd, &windowBounds);
F32 width = static_cast<F32>(windowBounds.right);
F32 height = static_cast<F32>(windowBounds.bottom);
return { CMathUtils::Clamp(-1.0f, 1.0f, 2.0f * pos.x / width - 1.0f), CMathUtils::Clamp(-1.0f, 1.0f, 2.0f * pos.y / height - 1.0f) };
}
TVector3 CMouse::GetMouseShiftVec() const
{
return { static_cast<F32>(mCurrMouseState.lX), static_cast<F32>(mCurrMouseState.lY), static_cast<F32>(mCurrMouseState.lZ) };
}
TDE2_API IInputDevice* CreateMouseDevice(IInputContext* pInputContext, E_RESULT_CODE& result)
{
CMouse* pMouseInstance = new (std::nothrow) CMouse();
if (!pMouseInstance)
{
result = RC_OUT_OF_MEMORY;
return nullptr;
}
result = pMouseInstance->Init(pInputContext);
if (result != RC_OK)
{
delete pMouseInstance;
pMouseInstance = nullptr;
}
return dynamic_cast<IInputDevice*>(pMouseInstance);
}
}
#endif
|
b947e359784f2cb1bd6428c8734add2f41892b89
|
18ed40859a4ec5135d66ec496f389e49fba9170c
|
/include/ugdk/graphic.h
|
64bb549f6565bc764f89099921f620302ce0f679
|
[] |
no_license
|
uspgamedev/horus_eye
|
9c9469858a02962cb96548ebc7738c5ff059f691
|
44f35d11bdec75e23d3101e5390ce6b0845f18f2
|
refs/heads/master
| 2021-06-24T08:48:08.259535
| 2013-01-15T16:45:15
| 2013-01-15T16:45:15
| 2,212,663
| 3
| 3
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 496
|
h
|
graphic.h
|
#ifndef UGDK_GRAPHIC_H_
#define UGDK_GRAPHIC_H_
namespace ugdk {
namespace graphic {
// Drawables
class Drawable;
class Shape;
class Text;
class Sprite;
class SolidRectangle;
class TexturedRectangle;
// Spritesheets
class Spritesheet;
class FlexibleSpritesheet;
// Extra
class Font;
class Image;
class Light;
class Modifier;
class Node;
class Texture;
// Managers
class TextManager;
class VideoManager;
} // namespace graphic
} // namespace ugdk
#endif
|
e15f7943449a22fd8986fedc18b63a7e69d610b8
|
d5e88858c50a03c2e152966f5ebfeb5837d8f422
|
/src/mem.cpp
|
5b3e766f654daa55373095ccc7134b0925226d53
|
[] |
no_license
|
Plasmarobo/GAPP
|
6fccbf46bf4f000479d33a0928d57695d3abb5f8
|
bd36bc25b37c6178febfdc651bb80125ea548cad
|
refs/heads/master
| 2021-07-23T19:08:28.941745
| 2020-05-13T18:29:54
| 2020-05-13T18:29:54
| 40,744,895
| 3
| 0
| null | 2020-05-13T18:29:55
| 2015-08-15T03:13:34
|
Assembly
|
UTF-8
|
C++
| false
| false
| 17,131
|
cpp
|
mem.cpp
|
#include "mem.h"
#include "cpu.h"
#include "clk.h"
#include "utils.h"
#include <string.h>
#include <fstream>
#define AddrIn(addr,x,y) ((addr>=x)&&(addr<y))
Cart::Cart()
{
m_rom = NULL;
m_ram = NULL;
m_rom_size = 0;
m_ram_size = 0;
m_rom_bank = 0;
m_ram_bank = 0;
}
Cart::Cart(unsigned char *rom, unsigned int rom_size, unsigned int ram_size)
{
m_rom = rom;
m_rom_size = rom_size;
m_rom_bank = 0;
m_ram_bank = 0;
if (ram_size > 0)
{
m_ram = new unsigned char[ram_size];
m_ram_size = ram_size;
} else {
m_ram = NULL;
m_ram_size = 0;
}
}
Cart::~Cart()
{
if (m_rom != NULL)
{
delete [] m_rom;
m_rom = NULL;
}
if (m_ram != NULL)
{
delete [] m_ram;
m_ram = NULL;
}
}
void Cart::WriteMemory(unsigned short addr, unsigned char data)
{
if (m_rom != NULL)
{
//The cart has no ram, drop the write
if (addr >= 0x2000 && addr < CART_BANK_X) {
m_rom_bank = data;
} else if (m_ram != NULL) {
if (addr >= RAM_BANK_X && addr < INTERNAL_RAM_0) {
unsigned int bank_addr = (INTERNAL_RAM_0 - RAM_BANK_X) * m_ram_bank;
m_ram[(addr - RAM_BANK_X) + bank_addr] = data;
} else {
Logger::RaiseError("Cart", "Ram Address out of range");
}
}
}
else
{
Logger::RaiseError("Cart", "Cart data is NULL");
}
}
unsigned char Cart::ReadMemory(unsigned short addr)
{
unsigned char val;
if (m_rom != NULL)
{
if (addr < CART_BANK_X)
{
val = m_rom[addr];
}
else if (addr < VRAM) {
unsigned int bank_addr = (VRAM - CART_BANK_X) * m_rom_bank;
val = m_rom[(addr - CART_BANK_X) + bank_addr];
} else if (addr >= RAM_BANK_X && addr < INTERNAL_RAM_0) {
unsigned int bank_addr = (INTERNAL_RAM_0 - RAM_BANK_X) * m_ram_bank;
val = m_ram[(addr - RAM_BANK_X) + bank_addr];
} else {
Logger::RaiseError("Cart", "Address out of bounds");
}
}
else
{
Logger::RaiseError("Cart", "Cart data is NULL");
}
return val;
}
void Cart::SaveRamState(std::string file) {}
void Cart::LoadRamState(std::string file) {}
MBC1Cart::MBC1Cart() : Cart()
{
}
MBC1Cart::MBC1Cart(unsigned char *rom, unsigned int rom_size, unsigned int ram_size) : Cart(rom, rom_size, ram_size)
{
}
MBC1Cart::~MBC1Cart()
{
}
MBC3Cart::MBC3Cart() : MBC1Cart()
{
}
MBC3Cart::MBC3Cart(unsigned char *rom, unsigned int rom_size, unsigned int ram_size) : MBC1Cart(rom, rom_size, ram_size)
{
m_utc_timestamp = GetUtc();
m_counter = 0;
m_counter_latch = 0;
m_write_enable = false;
}
void MBC3Cart::WriteMemory(unsigned short addr, unsigned char data)
{
if (m_rom != NULL)
{
if (addr >= 0 && addr < 0x2000)
{
if ((data & 0xF) == 0x0A)
{
m_write_enable = true;
}
else
{
m_write_enable = false;
}
} else if (addr < 0x4000 && data <= 0x7F) {
m_rom_bank = data == 0 ? 1 : data;
}
else if (addr < 0x6000) {
switch (data)
{
case 0x00:
m_ram_status = BANK_0;
m_ram_bank = 0;
break;
case 0x01:
m_ram_status = BANK_1;
m_ram_bank = 1;
break;
case 0x02:
m_ram_status = BANK_2;
m_ram_bank = 2;
break;
case 0x03:
m_ram_status = BANK_3;
m_ram_bank = 3;
break;
case 0x08:
m_ram_status = SECONDS;
break;
case 0x09:
m_ram_status = MINUTES;
break;
case 0x0A:
m_ram_status = HOURS;
break;
case 0x0B:
m_ram_status = DAY_L;
break;
case 0x0C:
m_ram_status = DAY_U;
break;
default:
Logger::RaiseError("MBC3", "Unknown Ram Bank selection");
break;
}
} else if (addr < VRAM) {
//Finite State Machine
if (m_rtc.latch == LatchState::UNLATCHED && data == 0)
{
m_rtc.latch = LatchState::LATCHING;
}
else if (m_rtc.latch == LatchState::LATCHING && data == 1)
{
m_rtc.latch = LatchState::LATCHED;
m_counter_latch = m_counter;
}
else if (m_rtc.latch == LatchState::LATCHED && data == 0)
{
m_rtc.latch = LatchState::UNLATCHING;
}
else if (m_rtc.latch == LatchState::UNLATCHING && data == 1)
{
//This could go wrong if we "power down" while processing
//However this is a Don't Care Condition, since a reload will resync to UTC anyway
//We aren't worried about slight differences in rtc
m_rtc.latch = LatchState::UNLATCHED;
unsigned long missed = (m_counter - m_counter_latch) % mbc3_rtc_cycles;
while (missed > 0)
{
--missed;
UpdateTime();
}
}
}
else if (addr >= RAM_BANK_X && addr < INTERNAL_RAM_0 && m_write_enable)
{
switch (m_ram_status)
{
case BANK_0:
case BANK_1:
case BANK_2:
case BANK_3:
{
int internal_addr = (INTERNAL_RAM_0 - RAM_BANK_X) * m_ram_bank;
m_ram[(addr - RAM_BANK_X) + internal_addr] = data;
}
break;
case SECONDS:
m_rtc.seconds = data;
break;
case MINUTES:
m_rtc.minutes = data;
break;
case HOURS:
m_rtc.hours = data;
break;
case DAY_L:
m_rtc.day_l = data;
break;
case DAY_U:
m_rtc.day_h.value = data;
break;
default:
break;
}
} else {
Logger::RaiseError("Cart", "Ram Address out of range");
}
}
else
{
Logger::RaiseError("Cart", "Cart data is NULL");
}
}
unsigned char MBC3Cart::ReadMemory(unsigned short addr)
{
unsigned char val;
if (addr >= CART_BANK_0 && addr < CART_BANK_X)
{
val = m_rom[addr];
}
else if (addr >= CART_BANK_X && addr < VRAM)
{
int internal_address = (VRAM - CART_BANK_0) * m_rom_bank;
val = m_rom[(addr - CART_BANK_X) + internal_address];
}
else if (addr >= RAM_BANK_X && addr < INTERNAL_RAM_0)
{
switch (m_ram_status)
{
case BANK_0:
case BANK_1:
case BANK_2:
case BANK_3:
{
int internal_address = (INTERNAL_RAM_0 - RAM_BANK_X) * m_ram_bank;
val = m_ram[(addr - RAM_BANK_X) + internal_address];
}
break;
case SECONDS:
val = m_rtc.seconds;
break;
case MINUTES:
val = m_rtc.minutes;
break;
case HOURS:
val = m_rtc.hours;
break;
case DAY_L:
val = m_rtc.day_l;
break;
case DAY_U:
val = m_rtc.day_h.value;
break;
default:
break;
}
}
return val;
}
void MBC3Cart::Step()
{
//Nop
m_counter++;
if (m_counter % mbc3_rtc_cycles == 0)
{
//One second has advanced
if(m_rtc.latch == LatchState::UNLATCHED)
{
UpdateTime();
}
}
}
void MBC3Cart::UpdateTime()
{
//32 machine steps
if(m_rtc.seconds == 59)
{
m_rtc.seconds = 0;
if(m_rtc.minutes == 59)
{
m_rtc.minutes = 0;
if(m_rtc.hours == 23)
{
m_rtc.hours = 0;
if(m_rtc.day_l == 255)
{
m_rtc.day_l = 0;
if(m_rtc.day_h.bits.day == 1)
{
m_rtc.day_h.bits.carry = 1;
}
m_rtc.day_h.bits.day = ~m_rtc.day_h.bits.day;
}
else
{
m_rtc.day_l++;
}
}
else
{
m_rtc.hours++;
}
}
else
{
m_rtc.minutes++;
}
}
else
{
m_rtc.seconds++;
}
}
Memory::Memory(bool use_bios)
{
m_cart = NULL;
if (use_bios) {
std::ifstream file("dmg-01.bin", std::ios::binary);
if (file.is_open())
{
file.read((char*)&(m_bootstrap[0]), 0x100);
file.close();
}
else {
Logger::RaiseError("Memory", "Could not load bootstrap file: dmg-01.bin");
}
} else {
DisableBootstrap();
}
}
Memory::~Memory()
{
if (m_cart != NULL)
{
delete m_cart;
}
}
void Memory::SetCartFromBytes(unsigned char *image, unsigned int size)
{
unsigned char title[15];
memcpy(&(title[0]), &(image[0x134]), 15);
unsigned char color_setting = image[0x143];
unsigned short new_licensee;
memcpy(&new_licensee, &(image[0x144]), 2);
unsigned char sgb = image[0x146];
unsigned char type = image[0x147];
unsigned int rom_size = image[0x148];
unsigned int ram_size = image[0x149];
unsigned char country = image[0x14A];
unsigned char licensee = image[0x14B];
unsigned char header_check = image[0x14C];
unsigned char global_check = image[0x14D];
switch (rom_size)
{
case 0x00:
rom_size = 32000;
break;
case 0x01:
rom_size = 64000;
break;
case 0x02:
rom_size = 128000;
break;
case 0x03:
rom_size = 256000;
break;
case 0x04:
rom_size = 512000;
break;
case 0x05:
rom_size = 1024000;
break;
case 0x06:
rom_size = 2048000;
break;
case 0x07:
rom_size = 4096000;
break;
default:
Logger::RaiseError("MEMORY", "Invalid ROM size");
rom_size = 32000;
break;
}
unsigned char *cart_rom = new unsigned char[rom_size];
for (unsigned int i = 0; i < rom_size; ++i)
{
if (i < size) {
cart_rom[i] = image[i];
}
else {
cart_rom[i] = 0x00;
}
}
switch (ram_size)
{
case 0x00:
ram_size = 0;
break;
case 0x01:
ram_size = 2000;
break;
case 0x02:
ram_size = 8000;
break;
case 0x03:
ram_size = 32000;
break;
default:
Logger::RaiseError("MEMORY", "Invalid RAM size");
ram_size = 0;
break;
}
switch (type)
{
case 0x00: //ROM
case 0x08: //ROM+RAM
case 0x09: //ROM+RAM+BAT
m_cart = new Cart(cart_rom, rom_size, ram_size);
break;
case 0x01: //MBC1
case 0x02: //MBC1 + RAM
case 0x03: //MBC1+RAM+BAT
m_cart = new MBC1Cart(cart_rom, rom_size, ram_size);
break;
case 0x05: //MBC2
case 0x06: //MBC2+BAT
break;
case 0x0B: //MMM01
case 0x0C: //MMM01+RAM
case 0x0D: //MMM01+RAM+BAT
break;
case 0x0F: //MBC3+TIMER+BAT
case 0x10: //MBC3+RAM+BAT
case 0x11: //MBC3
case 0x12: //MBC3+RAM
case 0x13: //MBC3+RAM+BAT
m_cart = new MBC3Cart(cart_rom, rom_size, ram_size);
break;
case 0x15:
case 0x16:
case 0x17:
case 0x19:
case 0x1A:
case 0x1B:
case 0x1C:
case 0x1D:
case 0x1E:
case 0xFC:
case 0xFD:
case 0xFE:
case 0xFF:
default:
m_cart = new Cart(cart_rom, rom_size, ram_size);
Logger::RaiseError("MEMORY", "Unknown Cart Type");
break;
}
}
void Memory::LoadCartFromFile(std::string rom_file)
{
unsigned char *image;
std::streamoff size;
std::ifstream file;
file.open(rom_file, std::ios::in | std::ios::binary | std::ios::ate);
if (file.is_open())
{
size = file.tellg();
file.seekg(0);
image = new unsigned char[size];
file.read((char*)image, size);
file.close();
//CHECK Memory controller
Logger::PrintInfo("MEMORY", "Loaded " + rom_file);
SetCartFromBytes(image, size);
delete [] image;
}
else
{
Logger::RaiseError("MEMORY", "Cannot open gb file: " + rom_file);
}
}
void Memory::Inc(unsigned short addr)
{
unsigned char val = Read(addr);
Write(addr, val + 1);
}
unsigned char Memory::Read(unsigned short addr)
{
unsigned char val;
if (m_bootstrap_en && AddrIn(addr, MemoryMap::BOOSTRAP_START, MemoryMap::BOOTSTRAP_END)) {
val = m_bootstrap[addr];
} else if (AddrIn(addr, MemoryMap::CART, MemoryMap::VRAM) ||
AddrIn(addr, MemoryMap::RAM_BANK_X, MemoryMap::INTERNAL_RAM_0))
{
if (m_cart != NULL)
{
val = m_cart->ReadMemory(addr);
}
else
{
Logger::RaiseError("MEMORY", "No cart");
}
}
else if (AddrIn(addr,MemoryMap::VRAM,MemoryMap::RAM_BANK_X))
{
val = m_internal_memory.sections.ram_video[addr - MemoryMap::VRAM];
}
else if (AddrIn(addr, MemoryMap::INTERNAL_RAM_0, MemoryMap::SPRITE_ATTRIB))
{
if (addr >= MemoryMap::INTERNAL_RAM_ECHO)
{
addr = addr - MemoryMap::INTERNAL_RAM_ECHO;
}
else
{
addr = addr - MemoryMap::INTERNAL_RAM_0;
}
val = m_internal_memory.sections.ram_internal[addr];
}
else if (AddrIn(addr, MemoryMap::SPRITE_ATTRIB, MemoryMap::UNUSED_0))
{
val = m_internal_memory.sections.sprite_attrib_mem[addr - MemoryMap::SPRITE_ATTRIB];
}
else if (AddrIn(addr, MemoryMap::UNUSED_0, MemoryMap::IO))
{
val = m_internal_memory.sections.io_empty[addr - MemoryMap::UNUSED_0];
}
else if (AddrIn(addr, MemoryMap::IO, MemoryMap::UNUSED_1))
{
val = m_internal_memory.sections.io_ports[addr - MemoryMap::IO];
}
else if (AddrIn(addr, MemoryMap::UNUSED_1, MemoryMap::INTERNAL_RAM_1))
{
val = m_internal_memory.sections.io_empty_1[addr - MemoryMap::UNUSED_1];
}
else if (AddrIn(addr, MemoryMap::INTERNAL_RAM_1, MemoryMap::INTERRUPT_ENABLE_REG))
{
val = m_internal_memory.sections.ram_internal_1[addr - MemoryMap::INTERNAL_RAM_1];
}
else if (addr == MemoryMap::INTERRUPT_ENABLE_REG)
{
val = m_internal_memory.sections.interrupt_enable;
}
return val;
}
void Memory::Write(unsigned short addr, unsigned char byte)
{
if (m_bootstrap_en && addr == MemoryMap::BOOTSTRAP_TOGGLE) {
if (byte == 1) DisableBootstrap();
} else if (AddrIn(addr, MemoryMap::CART, MemoryMap::VRAM) ||
AddrIn(addr, MemoryMap::RAM_BANK_X, MemoryMap::INTERNAL_RAM_0))
{
if (m_cart != NULL)
{
m_cart->WriteMemory(addr,byte);
}
else
{
Logger::RaiseError("MEMORY", "No cart");
}
}
else if (AddrIn(addr, MemoryMap::VRAM, MemoryMap::RAM_BANK_X))
{
m_internal_memory.sections.ram_video[addr - MemoryMap::VRAM] = byte;
}
else if (AddrIn(addr, MemoryMap::INTERNAL_RAM_0, MemoryMap::SPRITE_ATTRIB))
{
if (addr >= MemoryMap::INTERNAL_RAM_ECHO)
{
addr = addr - MemoryMap::INTERNAL_RAM_ECHO;
}
else
{
addr = addr - MemoryMap::INTERNAL_RAM_0;
}
m_internal_memory.sections.ram_internal[addr] = byte;
}
else if (AddrIn(addr, MemoryMap::SPRITE_ATTRIB, MemoryMap::UNUSED_0))
{
m_internal_memory.sections.sprite_attrib_mem[addr - MemoryMap::SPRITE_ATTRIB] = byte;
}
else if (AddrIn(addr, MemoryMap::UNUSED_0, MemoryMap::IO))
{
m_internal_memory.sections.io_empty[addr - MemoryMap::UNUSED_0] = byte;
}
else if (AddrIn(addr, MemoryMap::IO, MemoryMap::UNUSED_1))
{
switch (addr)
{
case SR_SC:
m_internal_memory.sections.io_ports[0x01] = byte;
if (byte & 0x80) {
m_serial_transfer_request = true;
} else {
m_serial_transfer_request = false;
}
break;
case SR_DIV:
m_internal_memory.sections.io_ports[0x04] = 0;
break;
//case SR_TIMA: //Not required, writes normally
//case SR_TMA: // Not required, writes normally
//case SR_TAC: // Not required, writes normalls
/*case SR_NR10:
case SR_NR11:
case SR_NR12:
case SR_NR14:
case SR_NR21:
case SR_NR22:
case SR_NR24:
case SR_NR30:
case SR_NR31:
case SR_NR32:
case SR_NR33:
case SR_NR41:
case SR_NR42:
case SR_NR43:
case SR_NR44:
case SR_NR50:
case SR_NR51:
case SR_NR52:*/
/*case SR_LCDC:
case SR_SCY:
case SR_SCX:
case SR_LY:
case SR_LYC:*/
case SR_DMA:
//160 microsecond DMA transfer
{
unsigned short src_addr = byte << 8;
unsigned short dst_addr = 0xFE00;
while (dst_addr < 0xFEA0)
{
Write(dst_addr++, Read(src_addr++));
}
}
break;
/*case SR_BGP:
case SR_OBP0:
case SR_OBP1:
case SR_WY:
case SR_WX:*/
default:
m_internal_memory.sections.io_ports[addr - MemoryMap::IO] = byte;
break;
}
}
else if (AddrIn(addr, MemoryMap::UNUSED_1, MemoryMap::INTERNAL_RAM_1))
{
m_internal_memory.sections.io_empty_1[addr - MemoryMap::UNUSED_1] = byte;
}
else if (AddrIn(addr, MemoryMap::INTERNAL_RAM_1, MemoryMap::INTERRUPT_ENABLE_REG))
{
m_internal_memory.sections.ram_internal_1[addr - MemoryMap::INTERNAL_RAM_1] = byte;
}
else if (addr == 0xFFFF)
{
m_internal_memory.sections.interrupt_enable = byte;
}
}
void Memory::LoadState(std::string filename)
{
//Unimplemented
//Handle RTC/unix timestamp
}
void Memory::SaveState(std::string filename)
{
//Unimplemented
//Write RTC/unix timestamp
}
void Memory::StepDiv()
{
//Update DIV
//Set frequency
m_div_counter++;
if(m_div_counter % div_cycles)
{
Inc(0xFF04);
}
}
void Memory::StepTimer()
{
m_timer_counter++;
unsigned char timer = Read(SR_TAC);
if ((timer >> 2) & 0x01)
{
timer &= 0x3;
unsigned int timer_mod;
switch (timer)
{
case 0x00:
case 0x01:
case 0x02:
case 0x03:
timer_mod = timer_cycle_intervals[timer];
break;
default:
Logger::RaiseError("Timer", "Unknown frequency");
break;
}
if (m_timer_counter % (timer_mod ))
{
Inc(SR_TIMA);
if (Read(SR_TIMA) == 0)
{
//Interrupt and load TMA
//Obscura: This should be delayed one cycle
//It is not currently, TODO: Fix
Write(SR_TIMA, Read(SR_TMA));
m_interrupt_target->Int(Interrupt::TIME_INT);
}
}
}
}
unsigned char Memory::SerialTransfer(unsigned char in, unsigned long hz) {
m_external_serial_buffer = in;
m_steps_per_serial_bit = machine_frequency / hz;
m_bits_left = 8;
return SB();
}
bool Memory::SerialTransferRequested() {
return m_serial_transfer_request;
}
void Memory::StepSerial() {
++m_serial_counter;
if ((m_serial_counter >= m_steps_per_serial_bit) && (m_bits_left > 0)) {
m_serial_counter = 0;
// 16 bit buffer rotation
unsigned char serial_buffer = SB();
SB((serial_buffer >> 1) | ((m_external_serial_buffer & 0x01) << 7));
m_external_serial_buffer = (m_external_serial_buffer >> 1) | ((serial_buffer & 0x01) << 7);
--m_bits_left;
if (m_bits_left == 0) {
m_interrupt_target->Int(Interrupt::SERIAL_INT);
SC(SC() & 0x7F); // Reset transfer bit
m_serial_transfer_request = false;
}
}
}
void Memory::Step()
{
if (m_cart != NULL)
{
m_cart->Step();
}
//Update TIMER
StepTimer();
//Update DIV
StepDiv();
//Update SB (serial buffer)
StepSerial();
}
void Memory::SetKeyStates(unsigned char bits)
{
//Translate input into memory map
if (!P15())
{
P1((bits >> 4) | 0x10);
}
else if (!P14())
{
P1((bits & 0x0F) | 0x20);
}
else
{
P1(0);
}
}
void Memory::EnableBootstrap() {
m_bootstrap_en = true;
}
void Memory::DisableBootstrap() {
m_bootstrap_en = false;
}
|
6aadfb9db121072d7bd111cbb1daf3c2001572c8
|
38a7e4e155a4fa4b208f29bd24f76a8d426ee90d
|
/#466/940E.cpp
|
f9bbb8b16f4447c6bab3dff427b85b5478b8d1ab
|
[] |
no_license
|
updown2/CodeForces
|
c7d24dac596160f8feb057265f7db264765658d8
|
89846b4a79ed862877bcce0b95765f7f6d99312b
|
refs/heads/master
| 2020-03-22T00:51:33.686976
| 2019-07-25T16:08:19
| 2019-07-25T16:08:19
| 137,614,755
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 876
|
cpp
|
940E.cpp
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, a, b) for(int i=a; i<b; i++)
#define ffi For(i, 0, N)
#define ffj For(j, 0, C)
#define ffa ffi ffj
#define s <<" "<<
#define c <<" : "<<
#define w cout
#define e endl//"\n"
#define pb push_back
#define mp make_pair
#define a first
#define b second
#define int ll
//500,000,000 operations
const int MAXN = 100000, INF = 1000000000;
//Global Variables
int N, C, inp[MAXN], dp[MAXN], sum;
multiset<int> have;
main() {
//ifstream cin("test.in");
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> N >> C;
ffi {cin >> inp[i]; sum += inp[i];}
ffj have.insert(inp[j]);
dp[C-1] = *(have.begin());
For (i, C, N) {
have.insert(inp[i]);
have.erase(have.find(inp[i-C]));
dp[i] = max(dp[i-1], dp[i-C] + *(have.begin()));
}
w<< sum - dp[N-1]<<e;
}
|
392a74f91926d0f42e164adb541a7f125782b507
|
0f7bf276fa86f23329345d444405887158bbd3d2
|
/src/vsphere.cpp
|
9e88897345989455818f6858c7267fa9e64e66f9
|
[] |
no_license
|
happydpc/DrawSpace
|
f718ff7d522f9a1dde00fcb89904284c9bbd9874
|
69e2e0f12b0b82b00d76476dfeef8aaf4e3cc284
|
refs/heads/master
| 2022-11-13T03:43:00.325383
| 2014-06-02T17:52:37
| 2014-06-02T17:52:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,708
|
cpp
|
vsphere.cpp
|
/*
*
* DrawSpace Rendering engine
* Emmanuel Chaumont Copyright (c) 2013-2014
*
* This file is part of DrawSpace.
*
* DrawSpace is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DrawSpace is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DrawSpace. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "vsphere.h"
using namespace DrawSpace::Core;
using namespace DrawSpace::Utils;
VSphere::VSphere( const dsstring& p_name ) : m_name( p_name ), m_ray( 1.0 )
{
}
VSphere::VSphere( const dsstring& p_name, const Vector& p_point, dsreal p_ray ) : m_name( p_name ), m_ray( p_ray ), m_point( p_point )
{
}
VSphere::~VSphere( void )
{
}
void VSphere::Transform( Matrix& p_mat )
{
m_mutex.WaitInfinite();
p_mat.Transform( &m_point, &m_transformed_point );
m_mutex.Release();
}
bool VSphere::Collide( const Vector& p_testpoint )
{
Vector delta;
m_mutex.WaitInfinite();
delta[0] = p_testpoint[0] - m_transformed_point[0];
delta[1] = p_testpoint[1] - m_transformed_point[1];
delta[2] = p_testpoint[2] - m_transformed_point[2];
m_mutex.Release();
delta[3] = 1.0;
if( delta.Length() < m_ray )
{
return true;
}
return false;
}
void VSphere::SetRay( dsreal p_ray )
{
m_ray = p_ray;
}
dsreal VSphere::GetRay( void )
{
return m_ray;
}
void VSphere::SetPoint( const Vector& p_point )
{
m_point = p_point;
}
void VSphere::GetTransformedPoint( Vector& p_point )
{
p_point = m_transformed_point;
}
|
2bfebf7a5e1f32c161eb07a0208a4413b8300dd1
|
dc2a6107b4869178ea64c08e1c4e3d075fe957df
|
/Solucio.h
|
ccec3293ae200371f5dfabf2325a9586c3ecef7b
|
[] |
no_license
|
MARCGRAUUdG/EDA_S9
|
8517e7e3eccb39a4d457651c78734020f182fcaa
|
255f2d3b719fe77769db26fb0ef7783bedd85e56
|
refs/heads/master
| 2021-10-08T16:35:21.955952
| 2018-12-14T18:51:20
| 2018-12-14T18:51:20
| 161,309,896
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,590
|
h
|
Solucio.h
|
//
// Created by Marc Grau on 09/12/2018.
//
#ifndef EDA_S9_SOLUCIO_H
#define EDA_S9_SOLUCIO_H
#include <vector>
#include "Candidats.h"
#include <list>
#include <map>
typedef float etiqueta;
//typedef string etiqueta;
const float etiqNula = -1;
//const string etiqNula ="";
class Solucio {
public:
Solucio();
//Pre: --
//Post: Inicialitza la mida i el nivell de la solucio a 0
Solucio(const char *nomFitxer);
//Pre:--
//Post: Inicialitza la solucio amb les dades del fitxer de nom "nomFitxer"
Candidats inicialitzarCandidats() const;
// Pre: --
// Post: Retorna els candidats del nivell actual
bool Acceptable(Candidats & iCan) const;
// Pre: --
// Post: Retorna cert si el candidat es pot afegir a la solució
void anotarCandidat(Candidats & iCan);
// Pre: iCan és acceptable
// Post: Afegeix iCan a la solucio
void desAnotarCandidat(Candidats &iCan);
// Pre: iCan és el darrer candidat anotat
// Pos: Es treu iCan de la solucio (darrer candidat anotat)
bool esCompleta();
// Pre: --
// Post: Retorna cert si la solució ja és completa
void mostrarSolucio()const;
//Pre: --
//Post: Mostra la solucio per pantalla
int nVertexs() const;
bool esDirigit() const;
void AfegirAresta(int v1, int v2, etiqueta e);
bool ExisteixAresta(int v1, int v2) const;
private:
int _mida;
float _cost;
int _midaGraf;
std::vector<int> _agafats;
std::vector< std::map<int, etiqueta> > _arestes;
bool esValid(int v) const;
};
#endif //EDA_S9_SOLUCIO_H
|
53a3df8be574a38cfc02580eab12f341f008618f
|
1447861e661b5ba2e208db33726366b7e471cf5e
|
/runtime/windows/include/log4tango/LayoutAppender.hh
|
5ac68fa23a5908c747ce3b001d9a8e11f3c0b051
|
[
"BSD-3-Clause"
] |
permissive
|
tango-controls/igorpro-binding
|
f8725d2e8e953442d517c22b97b4319d287b892b
|
d242bb3102fface2c526b786bceb6c88bb056f1c
|
refs/heads/master
| 2021-06-19T03:47:31.052114
| 2020-11-23T07:33:15
| 2020-11-23T07:33:15
| 75,382,824
| 0
| 1
|
BSD-3-Clause
| 2019-03-15T12:56:19
| 2016-12-02T09:49:10
|
C++
|
UTF-8
|
C++
| false
| false
| 1,910
|
hh
|
LayoutAppender.hh
|
//
// LayoutAppender.hh
//
// Copyright (C) : 2000 - 2002
// LifeLine Networks BV (www.lifeline.nl). All rights reserved.
// Bastiaan Bakker. All rights reserved.
//
// 2004,2005,2006,2007,2008,2009,2010,2011,2012
// Synchrotron SOLEIL
// L'Orme des Merisiers
// Saint-Aubin - BP 48 - France
//
// This file is part of log4tango.
//
// Log4ango is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Log4tango is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Log4Tango. If not, see <http://www.gnu.org/licenses/>.
#ifndef _LOG4TANGO_LAYOUTAPPENDER_H
#define _LOG4TANGO_LAYOUTAPPENDER_H
#include <log4tango/Portability.hh>
#include <string>
#include <log4tango/Appender.hh>
#include <log4tango/PatternLayout.hh>
namespace log4tango {
//-----------------------------------------------------------------------------
// class : LayoutAppender (superclass for appenders that require a Layout)
//-----------------------------------------------------------------------------
class LOG4TANGO_EXPORT LayoutAppender : public Appender
{
public:
typedef Layout DefaultLayoutType;
LayoutAppender(const std::string& name);
virtual ~LayoutAppender();
virtual bool requires_layout() const;
virtual void set_layout (Layout* layout = 0);
protected:
Layout& get_layout();
private:
Layout* _layout;
};
} // namespace log4tango
#endif // _LOG4TANGO_LAYOUTAPPENDER_H
|
af116ccaa2fc7c7f5fc99fc3f86d1302c354b611
|
834a4092e183a9af6fbf0e295f48a0fd2b4ba499
|
/cmmdc.cpp
|
7fcc4079d8b688b35cb8a85a8432b742c0250eb1
|
[] |
no_license
|
lk-2009/algoritmi-elementari
|
019cea1b1723214efadadcc4c99630674558cb86
|
aa29e1909c08979179d1f5d59715982040ec8e85
|
refs/heads/master
| 2023-08-30T12:02:12.388584
| 2021-11-05T15:30:12
| 2021-11-05T15:30:12
| 424,995,762
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 275
|
cpp
|
cmmdc.cpp
|
#include <iostream>
using namespace std;
int a, b, rest;
int main()
{
cout << " a= ";
cin >> a;
cout << " b= ";
cin >> b;
rest = a % b;
while (rest > 0)
{
a = b;
b=rest;
rest = a % b;
}
cout<<b << " este cmmdc";
}
|
19c865db7b7fad18e5872b48da4321e9bc6ebcff
|
b8653cf62d26b082b160904a28df75bebf08d28d
|
/[통합]155_카메라오염알람추가,defect알람조건추가/ModelDlg.h
|
6d51871756847b1e8a8fbd0f27a0760c4e92f381
|
[] |
no_license
|
dreamplayer-zhang/glim
|
765daae7ffd3981b0e2c5cca07718682a36f619c
|
a72af47ae2990ce88d4ddd287cb4da07a260bcdb
|
refs/heads/master
| 2023-01-09T22:03:02.718632
| 2020-11-02T08:32:46
| 2020-11-02T08:32:46
| null | 0
| 0
| null | null | null | null |
UHC
|
C++
| false
| false
| 1,322
|
h
|
ModelDlg.h
|
#pragma once
#include "afxwin.h"
#include "Label1.h"
#include "afxcmn.h"
// CModelDlg 대화 상자입니다.
class CModelDlg : public CDialog
{
DECLARE_DYNAMIC(CModelDlg)
public:
CModelDlg(CWnd* pParent = NULL); // 표준 생성자입니다.
CWnd* m_pParent;
int CModelDlg::DirFileCount(char *pDirName);
CString m_strModelNo;
CString m_strProductPLC;
CString m_strModelName;
// CString m_strSelectProduct;
virtual ~CModelDlg();
void UpdateDataManual(BOOL bSave);
// 대화 상자 데이터입니다.
enum { IDD = IDD_DIALOG_MODEL };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원입니다.
DECLARE_MESSAGE_MAP()
public:
CListCtrl m_pList;
CString m_strSelectProduct;
afx_msg void OnBnClickedButtonRefresh();
afx_msg void OnBnClickedButtonSelectTab1();
afx_msg void OnBnClickedButtonDeleteTab1();
CString m_strProductName;
CString m_strProductName2;
afx_msg void OnBnClickedButtonProdcutTab1();
virtual BOOL OnInitDialog();
afx_msg void OnBnClickedButton1();
// afx_msg void OnNMThemeChangedStaticProduct01Tab1(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMDblclkListProductTab1(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnEnSetfocusEditProductName();
afx_msg void OnEnChangeEditProductName();
afx_msg void OnEnSetfocusEditProductName2();
};
|
4c3332034771f1a49a11e4420b81f37c6f0eeae3
|
abfd99772caedc3e948d46fd1c8a653ad222f4a4
|
/editor/se_catch_all.cc
|
edad5e387a9d4e549c2086ec44f0398f3b7ae717
|
[
"BSD-3-Clause"
] |
permissive
|
NCAR/lrose-solo3
|
cc15bf5afd2ed21afff572cbaaf488c6f485aa1d
|
a6cddbe0b5919a8e24d9a74fff55ccec0333db85
|
refs/heads/master
| 2023-05-13T21:29:05.426032
| 2023-05-05T20:44:23
| 2023-05-05T20:44:23
| 69,918,956
| 10
| 8
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 9,822
|
cc
|
se_catch_all.cc
|
/* $Id$ */
#include <glib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <DateTime.hh>
#include "se_bnd.hh"
#include "se_catch_all.hh"
#include "se_proc_data.hh"
#include "se_utils.hh"
#include "SeBoundaryList.hh"
#include <seds.h>
#include <solo_editor_structs.h>
#include <solo_list_widget_ids.h>
#include <solo_window_structs.h>
extern GString *gs_complaints;
/* c------------------------------------------------------------------------ */
#ifdef USE_RADX
#else
int se_once_only(const std::vector< UiCommandToken > &cmd_tokens)
{
/*
* #a-speckle#
* #ac-sidelobe-ring#
* #first-good-gate#
* #freckle-average#
* #freckle-threshold#
* #min-bad-count#
* #min-notch-shear#
* #notch-max#
* #offset-for-radial-shear#
* #ew-wind#
* #ns-wind#
* #vert-wind#
* #optimal-beamwidth#
* #omit-source-file-info#
* #surface-shift#
* #surface-gate-shift#
* #deglitch-radius#
* #deglitch-threshold#
* #deglitch-min-gates#
* ##
* ##
* ##
*/
struct solo_edit_stuff *seds = return_sed_stuff();
if (cmd_tokens[0].getCommandText().compare(0, 7, "a-speckle", 0, 7) == 0)
{
seds->a_speckle = cmd_tokens[1].getIntParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 7, "ac-sidelobe-ring",
0, 7) == 0)
{
seds->sidelobe_ring_gate_count = cmd_tokens[1].getIntParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 11, "first-good-gate",
0, 11) == 0)
{
seds->first_good_gate = cmd_tokens[1].getIntParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 9, "freckle-average",
0, 9) == 0)
{
seds->freckle_avg_count = cmd_tokens[1].getIntParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 11, "deglitch-radius",
0, 11) == 0)
{
seds->deglitch_radius = cmd_tokens[1].getIntParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 11, "deglitch-min_gates",
0, 11) == 0)
{
seds->deglitch_min_bins = cmd_tokens[1].getIntParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 9, "freckle-threshold",
0, 9) == 0)
{
seds->freckle_threshold = cmd_tokens[1].getFloatParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 11, "deglitch-threshold",
0, 11) == 0)
{
seds->deglitch_threshold = cmd_tokens[1].getFloatParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 7, "gates-shifted",
0, 7) == 0)
{
seds->gates_of_shift = cmd_tokens[1].getIntParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 7, "min-bad-count",
0, 7) == 0)
{
seds->min_bad_count = cmd_tokens[1].getIntParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 9, "min-notch-shear",
0, 9) == 0)
{
seds->notch_shear = cmd_tokens[1].getFloatParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 9, "notch-max",
0, 9) == 0)
{
seds->notch_max = cmd_tokens[1].getFloatParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 9,
"offset-for-radial-shear", 0, 9) == 0)
{
seds->gate_diff_interval = cmd_tokens[1].getIntParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 5, "ew-wind",
0, 5) == 0)
{
seds->ew_wind = cmd_tokens[1].getFloatParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 5, "ns-wind",
0, 5) == 0)
{
seds->ns_wind = cmd_tokens[1].getFloatParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 7, "vert-wind",
0, 7) == 0)
{
seds->ud_wind = cmd_tokens[1].getFloatParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 11, "optimal-beamwidth",
0, 11) == 0)
{
seds->optimal_beamwidth = cmd_tokens[1].getFloatParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 7, "omit-source-file-info", 0, 7) == 0)
{
struct sed_command_files *scf = se_return_cmd_files_struct();
scf->omit_source_file_info = !scf->omit_source_file_info;
g_string_sprintfa(gs_complaints, "Source file info will be %s\n",
scf->omit_source_file_info ? "IGNORED" : "USED");
}
else if (cmd_tokens[0].getCommandText().compare(0, 11, "surface-shift",
0, 11) == 0)
{
seds->surface_shift = cmd_tokens[1].getFloatParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 11, "surface-gate-shift",
0, 11) == 0)
{
seds->surface_gate_shift = cmd_tokens[1].getIntParam();
}
else if (cmd_tokens[0].getCommandText().compare(0, 6, "radar-", 0, 6) == 0)
{
struct one_boundary *ob = SeBoundaryList::getInstance()->currentBoundary;
if (cmd_tokens[0].getCommandText().find("inside") != std::string::npos)
{
ob->bh->force_inside_outside = BND_FIX_RADAR_INSIDE;
}
else if (cmd_tokens[0].getCommandText().find("outside") !=
std::string::npos)
{
ob->bh->force_inside_outside = BND_FIX_RADAR_OUTSIDE;
}
else if (cmd_tokens[0].getCommandText().find("unforced") !=
std::string::npos)
{
ob->bh->force_inside_outside = 0;
}
}
return 1;
}
#endif
/* c------------------------------------------------------------------------ */
/* This routine will process all commands associated with the setup-input */
/* procedure. It also updates the sfic texts. */
#ifdef USE_RADX
#else
int se_dir(const std::vector< UiCommandToken > &cmd_tokens)
{
// Get a pointer to the command arguments. These will be pulled out
// below based on the actual command
int token_num = 1;
// Get the editor information
struct solo_edit_stuff *seds = return_sed_stuff();
// Process the command
if (cmd_tokens[0].getCommandText().compare(0, 7, "sweep-dir", 0, 7) == 0)
{
std::string command;
command = (cmd_tokens[token_num].getCommandText());
if (command.compare(0, 8, "dorade-directory") == 0)
{
char *a;
if ((a = getenv("DD_DIR")) || (a = getenv("DORADE_DIR")))
{
seds->sfic->directory = a;
if (seds->sfic->directory[seds->sfic->directory.size()-1] != '/')
seds->sfic->directory += "/";
}
else
{
g_string_sprintfa(gs_complaints, "DORADE_DIR undefined\n");
std::string cmd_text = cmd_tokens[token_num].getCommandText();
if (cmd_text[cmd_text.size()-1] != '/')
cmd_text += "/";
seds->sfic->directory = cmd_text;
}
}
else
{
seds->sfic->directory = command;
}
seds->sfic->directory_text = seds->sfic->directory;
}
else if (cmd_tokens[0].getCommandText().compare(0, 7,
"radar-names", 0, 7) == 0)
{
seds->num_radars = 0;
seds->radar_stack.clear();
seds->sfic->radar_names_text[0] = '\0';
for (int ii = 0;
cmd_tokens[token_num].getTokenType() != UiCommandToken::UTT_END;
token_num++,ii++)
{
seds->radar_stack.push_back(cmd_tokens[token_num].getCommandText());
seds->num_radars++;
if (ii != 0)
seds->sfic->radar_names_text += " ";
seds->sfic->radar_names_text += cmd_tokens[token_num].getCommandText();
}
}
else if (cmd_tokens[0].getCommandText().compare(0, 7, "first-sweep", 0, 7) == 0)
{
if (cmd_tokens[token_num].getCommandText().compare("first") == 0)
{
seds->sfic->start_time = DAY_ZERO;
seds->sfic->first_sweep_text = "first";
}
else if (cmd_tokens[token_num].getCommandText().compare("last") == 0)
{
seds->sfic->start_time = ETERNITY;
seds->sfic->first_sweep_text = "last";
}
else
{
// Try to interpret this as a date of the form mm/dd/yy:hh:mm:ss.ms
DateTime data_time;
seds->sfic->first_sweep_text = cmd_tokens[token_num].getCommandText();
data_time.parse(cmd_tokens[token_num].getCommandText());
seds->sfic->start_time = data_time.getTimeStamp();
}
}
else if (cmd_tokens[0].getCommandText().compare(0, 7, "last-sweep", 0, 7) == 0)
{
if (cmd_tokens[token_num].getCommandText().compare("first") == 0)
{
seds->sfic->stop_time = DAY_ZERO;
seds->sfic->last_sweep_text = "first";
}
else if (cmd_tokens[token_num].getCommandText().compare("last") == 0)
{
seds->sfic->stop_time = ETERNITY;
seds->sfic->last_sweep_text = "last";
}
else
{
// Try to interpret this as a number
DateTime data_time;
seds->sfic->last_sweep_text = cmd_tokens[token_num].getCommandText();
data_time.parse2(cmd_tokens[token_num].getCommandText());
seds->sfic->stop_time = data_time.getTimeStamp();
}
}
else if (cmd_tokens[0].getCommandText().compare(0, 4, "version", 0, 4) == 0)
{
if (cmd_tokens[token_num].getCommandText().compare("first") == 0)
{
seds->sfic->version = -1;
seds->sfic->version_text = "first";
}
else if (cmd_tokens[token_num].getCommandText().compare("last") == 0)
{
seds->sfic->version = 99999;
seds->sfic->version_text = "last";
}
else
{
// Try to interpret this as a number
seds->sfic->version = 99999;
int nn;
if ((nn = sscanf(cmd_tokens[token_num].getCommandText().c_str(), "%d",
&seds->sfic->version)) == 0)
{
// Not a number
g_string_sprintfa(gs_complaints,
"\nCould not interpret version number: %s Using: %d\n",
cmd_tokens[token_num].getCommandText().c_str(),
seds->sfic->version);
}
char version_text[80];
sprintf(version_text, "%d", seds->sfic->version);
seds->sfic->version_text = version_text;
}
}
else if (cmd_tokens[0].getCommandText().compare(0, 7, "new-version", 0, 7) == 0)
{
seds->sfic->new_version_flag = YES;
}
else if (cmd_tokens[0].getCommandText().compare(0, 9, "no-new-version", 0, 9) == 0)
{
seds->sfic->new_version_flag = NO;
}
return 1;
}
#endif
|
813143a37739c54a457f38c4f543df8259bc1271
|
0ee6d96dd836a5302c7fd58baa24055f296c3204
|
/catkin_ws/src/vision/obj_reco_dishwasher/src/ModelDishwasher.cpp
|
447b886d50e2c3edd31713b60275f080b62a4c3d
|
[] |
no_license
|
RobotJustina/JUSTINA
|
42876b3734c981fad6d002d549b3f8f05807938b
|
c2b4de807d5f3a18b317b9b01fdeb0cec3f7327e
|
refs/heads/master
| 2021-12-14T08:08:22.408310
| 2018-08-27T18:13:07
| 2018-08-27T18:13:07
| 58,512,410
| 7
| 13
| null | 2018-08-27T18:13:08
| 2016-05-11T03:46:07
|
C
|
UTF-8
|
C++
| false
| false
| 2,295
|
cpp
|
ModelDishwasher.cpp
|
/*
* <one line to give the program's name and a brief idea of what it does.>
* Copyright (C) 2018 <copyright holder> <email>
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "obj_reco_dishwasher/ModelDishwasher.h"
using namespace std;
ModelDishwasher::ModelDishwasher(){
}
bool ModelDishwasher::setObject(string name, string nameMethodSegmentation,Scalar minScalarSegmentation,Scalar maxScalarSegmentation, float averageAreaPixels ){
names.push_back(name);
namesMethodsSegmentation.push_back(nameMethodSegmentation);
vector <Scalar> scalars;
scalars.push_back(minScalarSegmentation);
scalars.push_back(maxScalarSegmentation);
min_maxScalarsSegmentation.push_back(scalars);
averagesAreasPixels.push_back(averageAreaPixels);
if(nameMethodSegmentation=="HSV"){
methodsSegmentation.push_back(SegmenterDishwasher::colorSegmentHSV);
}
else if(nameMethodSegmentation=="HLS"){
methodsSegmentation.push_back(SegmenterDishwasher::colorSegmentHLS);
}
else if(nameMethodSegmentation=="BGR"){
methodsSegmentation.push_back(SegmenterDishwasher::colorSegmentBGR);
}
else{
methodsSegmentation.push_back(SegmenterDishwasher::colorSegmentHSV);
}
}
bool ModelDishwasher::loadKnowledgeBase(string path_file){
loadKnowledgeBase();
}
bool ModelDishwasher::loadKnowledgeBase(){
Scalar minScalar;
Scalar maxScalar;
//dishwasher
minScalar = Scalar(13, 18, 46);
maxScalar = Scalar(174, 62, 77);
setObject("dishwasher", "HSV", minScalar,maxScalar);
//sink
// minScalar = Scalar(17, 34, 9);
// maxScalar = Scalar(174, 232, 68);
// setObject("sink", "HSV", minScalar,maxScalar);
}
int ModelDishwasher::size(){
return names.size();
}
|
424511c63b7348e28c9b7f53ea34250ab730eaa9
|
d0fca69885591e3eefa9ed95c289b246186cb956
|
/node_aware_mapper.cpp
|
de548d7232b20d5ac7114ca6c0861cd10108eaed
|
[] |
no_license
|
cwpearson/node-legion
|
f0c53a3b112a00227320bbd9ea9b4379c3b2f67c
|
105eff00148c785f3aead1058f38ded8a7c82ef8
|
refs/heads/master
| 2022-11-23T02:24:37.366623
| 2020-07-21T22:50:04
| 2020-07-21T22:50:04
| 250,629,111
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 30,662
|
cpp
|
node_aware_mapper.cpp
|
#include "node_aware_mapper.hpp"
#define NAM_USE_NVTX
using namespace Legion;
using namespace Legion::Mapping;
Logger log_nam("node_aware_mapper");
NodeAwareMustEpochMapper::NodeAwareMustEpochMapper(MapperRuntime *rt,
Machine machine,
Processor local,
const char *mapper_name)
: DefaultMapper(rt, machine, local, mapper_name) {
gpuFBs = get_gpu_fbs();
}
void NodeAwareMustEpochMapper::mapper_registration(
Machine machine, Runtime *rt, const std::set<Processor> &local_procs) {
printf("NodeAwareMustEpochMapper::%s(): [entry]\n", __FUNCTION__);
for (std::set<Processor>::const_iterator it = local_procs.begin();
it != local_procs.end(); it++) {
rt->replace_default_mapper(
new NodeAwareMustEpochMapper(rt->get_mapper_runtime(), machine, *it,
"NodeAwareMustEpochMapper"),
*it);
}
printf("NodeAwareMustEpochMapper::%s(): [exit]\n", __FUNCTION__);
}
/* generate a weight matrix from the slice
*/
template <unsigned DIM>
void NodeAwareMustEpochMapper::index_task_create_weight_matrix(
solve::Mat2D<int64_t> &weight, MapperContext ctx, const Domain &inputDomain,
const Task &task) {
assert(inputDomain.dim == DIM);
{
log_nam.spew("point space numbering:");
int i = 0;
for (PointInDomainIterator<DIM> pir(inputDomain); pir(); ++pir, ++i) {
log_nam.spew() << i << " p=" << *pir;
for (int r = 0; r < task.regions.size(); ++r) {
// is this a DomainPoint or a color
LogicalRegion li = runtime->get_logical_subregion_by_color(
ctx, task.regions[r].partition, DomainPoint(*pir));
log_nam.spew() << " " << r << " "
<< runtime->get_index_space_domain(ctx,
li.get_index_space());
}
}
}
int i = 0;
for (PointInDomainIterator<DIM> pi(inputDomain); pi(); ++pi, ++i) {
int j = 0;
for (PointInDomainIterator<DIM> pj(inputDomain); pj(); ++pj, ++j) {
int64_t bytes = 0;
for (int ri = 0; ri < task.regions.size(); ++ri) {
LogicalRegion li = runtime->get_logical_subregion_by_color(
ctx, task.regions[ri].partition, DomainPoint(*pi));
// TODO: is this sketchy
// create fake region requirements that move the partition to the
// region so we can reuse the region distance code
RegionRequirement rra = task.regions[ri];
rra.partition = LogicalPartition::NO_PART;
rra.region = li;
for (int rj = 0; rj < task.regions.size(); ++rj) {
LogicalRegion lj = runtime->get_logical_subregion_by_color(
ctx, task.regions[rj].partition, DomainPoint(*pj));
// TODO this feels sketchy
RegionRequirement rrb = task.regions[rj];
rrb.partition = LogicalPartition::NO_PART;
rrb.region = lj;
int64_t newBytes = get_region_requirement_overlap(ctx, rra, rrb);
// std::cerr << i << " " << j << " " << ri << " " << rj << " bytes="
// << newBytes << "\n";
bytes += newBytes;
}
}
// std::cerr << "slice " << *pi << " " << *pj << " bytes=" << bytes <<
// "\n";
weight.at(i, j) = bytes;
}
}
}
/*
struct SliceTaskInput {
IndexSpace domain_is;
Domain domain;
};
struct SliceTaskOutput {
std::vector<TaskSlice> slices;
bool verify_correctness; // = false
};
TaskSlice slice;
slice.domain = slice_subregion;
slice.proc = targets[target_proc_index];
slice.recurse = false;
slice.stealable = true;
slices.push_back(slice);
We do similar to the default mapper here:
Use default_select_num_blocks to split along prime factors
Instead of group
*/
void NodeAwareMustEpochMapper::slice_task(MapperContext ctx, const Task &task,
const SliceTaskInput &input,
SliceTaskOutput &output) {
log_nam.spew("[entry] %s()", __FUNCTION__);
#ifdef NAM_USE_NVTX
nvtxRangePush("slice_task");
#endif
log_nam.spew() << __FUNCTION__ << "(): input.domain_is = " << input.domain_is;
log_nam.spew() << __FUNCTION__ << "(): input.domain = " << input.domain;
/* Build the GPU distance matrix
*/
{
log_nam.spew("GPU numbering:");
int i = 0;
for (auto p : gpuFBs) {
log_nam.spew() << i << " gpu=" << p.first << " fb=" << p.second;
}
}
#ifdef NAM_USE_NVTX
nvtxRangePush("get_gpu_distance_matrix");
#endif
solve::Mat2D<double> distance = get_gpu_distance_matrix(gpuFBs);
#ifdef NAM_USE_NVTX
nvtxRangePop();
#endif
printf("NodeAwareMustEpochMapper::%s(): distance matrix\n", __FUNCTION__);
for (size_t i = 0; i < distance.shape()[1]; ++i) {
printf("NodeAwareMustEpochMapper::%s():", __FUNCTION__);
for (size_t j = 0; j < distance.shape()[0]; ++j) {
printf(" %.2e", distance.at(i, j));
}
printf("\n");
}
/* Compute the point task domain overlap for all pairs of point tasks.
This is the weight matrix in our assignment problem.
*/
solve::Mat2D<int64_t> weight(input.domain.get_volume(),
input.domain.get_volume(), 0);
// assert(input.domain.dim == 2 && "TODO: only implemented for dim=2");
#ifdef NAM_USE_NVTX
nvtxRangePush("index_task_create_weight_matrix");
#endif
switch (input.domain.dim) {
case 1:
index_task_create_weight_matrix<1>(weight, ctx, input.domain, task);
break;
case 2:
index_task_create_weight_matrix<2>(weight, ctx, input.domain, task);
break;
case 3:
index_task_create_weight_matrix<3>(weight, ctx, input.domain, task);
break;
default:
log_nam.fatal() << "unhandled dimensionality in slice_task";
}
#ifdef NAM_USE_NVTX
nvtxRangePop();
#endif
printf("NodeAwareMustEpochMapper::%s(): weight matrix\n", __FUNCTION__);
for (size_t i = 0; i < weight.shape()[1]; ++i) {
printf("NodeAwareMustEpochMapper::%s():", __FUNCTION__);
for (size_t j = 0; j < weight.shape()[0]; ++j) {
printf(" %6ld", weight.at(i, j));
}
printf("\n");
}
#ifdef NAM_USE_NVTX
nvtxRangePush("solve_ap");
#endif
double cost;
std::vector<size_t> f = solve::ap_sum_brute_force(&cost, weight, distance);
assert(f.size() == weight.shape()[0]);
#ifdef NAM_USE_NVTX
nvtxRangePop();
#endif
{
std::stringstream ss;
for (auto &e : f) {
ss << e << " ";
}
log_nam.info() << "assignment: " << ss.str();
log_nam.info() << "cost: " << cost;
}
/* create the slices based on the assignments
TODO: template function?
*/
switch (input.domain.dim) {
case 2: {
size_t i = 0;
for (PointInDomainIterator<2> pir(input.domain); pir(); ++pir, ++i) {
TaskSlice slice;
// slice subdomain is a single point
slice.domain = Rect<2>(*pir, *pir);
slice.proc = gpuFBs[f[i]].first;
log_nam.spew() << "assign slice domain " << slice.domain << " to proc "
<< slice.proc;
slice.recurse = false;
slice.stealable = true;
output.slices.push_back(slice);
}
break;
}
case 3: {
size_t i = 0;
for (PointInDomainIterator<3> pir(input.domain); pir(); ++pir, ++i) {
TaskSlice slice;
// slice subdomain is a single point
slice.domain = Rect<3>(*pir, *pir);
slice.proc = gpuFBs[f[i]].first;
log_nam.spew() << "assign slice domain " << slice.domain << " to proc "
<< slice.proc;
slice.recurse = false;
slice.stealable = true;
output.slices.push_back(slice);
}
break;
}
}
#ifdef NAM_USE_NVTX
nvtxRangePop(); // slice_task
#endif
log_nam.spew("[exit] %s()", __FUNCTION__);
}
// inspired by DefaultMapper::have_proc_kind_variant
bool NodeAwareMustEpochMapper::has_gpu_variant(const MapperContext ctx,
TaskID id) {
std::vector<VariantID> variants;
runtime->find_valid_variants(ctx, id, variants);
for (unsigned i = 0; i < variants.size(); i++) {
const ExecutionConstraintSet exset =
runtime->find_execution_constraints(ctx, id, variants[i]);
if (exset.processor_constraint.can_use(Processor::TOC_PROC))
return true;
}
return false;
}
/*
This method can copy tasks to the map_tasks list to indicate the task should
be mapped by this mapper. The method can copy tasks to the relocate_tasks list
to indicate the task should be mapped by a mapper for a different processor.
If it does neither the task stays in the ready list.
*/
void NodeAwareMustEpochMapper::select_tasks_to_map(
const MapperContext ctx, const SelectMappingInput &input,
SelectMappingOutput &output) {
log_nam.spew("[entry] %s()", __FUNCTION__);
#ifdef NAM_USE_NVTX
nvtxRangePush("NAM::select_tasks_to_map()");
#endif
for (const Task *task : input.ready_tasks) {
log_nam.spew("task %u", task->task_id);
}
// just take all tasks
log_nam.debug("%s(): selecting all %lu tasks", __FUNCTION__,
input.ready_tasks.size());
for (const Task *task : input.ready_tasks) {
output.map_tasks.insert(task);
}
#ifdef NAM_USE_NVTX
nvtxRangePop();
#endif
log_nam.spew("[exit] %s()", __FUNCTION__);
}
void NodeAwareMustEpochMapper::map_task(const MapperContext ctx,
const Task &task,
const MapTaskInput &input,
MapTaskOutput &output) {
log_nam.spew("[entry] map_task()");
#ifdef NAM_USE_NVTX
nvtxRangePush("NAM::map_task");
#endif
log_nam.spew("%lu task.regions:", task.regions.size());
for (auto &rr : task.regions) {
log_nam.spew() << rr.region;
}
if (task.target_proc.kind() == Processor::TOC_PROC) {
log_nam.spew("task %u (parent_task=%u)", task.task_id,
task.parent_task->task_id);
/* some regions may already be mapped
*/
std::vector<bool> premapped(task.regions.size(), false);
for (unsigned idx = 0; idx < input.premapped_regions.size(); idx++) {
unsigned index = input.premapped_regions[idx];
output.chosen_instances[index] = input.valid_instances[index];
premapped[index] = true;
printf("region %u is premapped\n", index);
}
}
log_nam.spew("map_task() defer to DefaultMapper::map_task");
DefaultMapper::map_task(ctx, task, input, output);
// get the runtime to call `postmap_task` when the task finishes running
// TODO: causes a crash by itself
output.postmap_task = false;
log_nam.spew("target_procs.size()=%lu", output.target_procs.size());
for (auto &proc : output.target_procs) {
log_nam.spew() << proc;
}
log_nam.spew("[exit] map_task()");
#ifdef NAM_USE_NVTX
nvtxRangePop();
#endif
}
void NodeAwareMustEpochMapper::map_must_epoch(const MapperContext ctx,
const MapMustEpochInput &input,
MapMustEpochOutput &output) {
#ifdef NAM_USE_NVTX
nvtxRangePush("NodeAwareMustEpochMapper::map_must_epoch");
#endif
log_nam.debug("%s(): [entry]", __FUNCTION__);
for (const auto &task : input.tasks) {
log_nam.spew("task %u", task->task_id);
}
// ensure all tasks can run on GPU
for (const auto &task : input.tasks) {
bool ok = has_gpu_variant(ctx, task->task_id);
if (!ok) {
log_nam.error("NodeAwareMustEpochMapper error: a task without a "
"TOC_PROC variant cannot be mapped.");
assert(false);
}
}
/* MappingConstraint says that certain logical regions must be in the same
physical instance. If two tasks have a logical region in the same mapping
constraint, they are in the same group
*/
typedef std::set<const Task *> TaskGroup;
auto make_intersection = [](TaskGroup &a, TaskGroup &b) {
TaskGroup ret;
for (auto &e : a) {
if (b.count(e)) {
ret.insert(e);
}
}
return ret;
};
auto make_union = [](TaskGroup &a, TaskGroup &b) {
TaskGroup ret(a.begin(), a.end());
for (auto &e : b) {
ret.insert(e);
}
return ret;
};
std::vector<TaskGroup> groups;
// put each task in its own group in case it's not in the constraints
for (auto task : input.tasks) {
TaskGroup group = {task};
groups.push_back(group);
}
log_nam.debug("%s(): %lu task groups after tasks", __FUNCTION__, groups.size());
// which logical region in each task must be mapped to the same physical
// instance
for (auto constraint : input.constraints) {
TaskGroup group;
for (unsigned ti = 0; ti < constraint.constrained_tasks.size(); ++ti) {
const Task *task = constraint.constrained_tasks[ti];
const unsigned ri = constraint.requirement_indexes[ti];
// If the task does not access the region, we can ignore it
if (!task->regions[ri].is_no_access()) {
group.insert(task);
}
}
groups.push_back(group);
}
log_nam.debug("%s(): %lu task groups after constraints", __FUNCTION__,
groups.size());
// iteratively merge any groups that have the same task
bool changed = true;
while (changed) {
std::vector<TaskGroup>::iterator srci, dsti;
for (srci = groups.begin(); srci != groups.end(); ++srci) {
for (dsti = groups.begin(); dsti != groups.end(); ++dsti) {
if (srci != dsti) {
// merge src into dst if they overlap
if (!make_intersection(*srci, *dsti).empty()) {
for (auto &task : *srci) {
dsti->insert(task);
}
changed = true;
goto erase_src;
}
}
}
}
changed = false;
erase_src:
if (changed) {
groups.erase(srci);
}
}
log_nam.debug("%s(): %lu task groups after merge", __FUNCTION__, groups.size());
for (size_t gi = 0; gi < groups.size(); ++gi) {
}
assert(groups.size() <= input.tasks.size() && "at worst, one task per group");
/* print some info about domains
*/
for (auto &group : groups) {
for (auto &task : group) {
// https://legion.stanford.edu/doxygen/class_legion_1_1_domain.html
std::cerr << "index_domain:\n";
Domain domain = task->index_domain;
std::cerr << " lo:" << domain.lo() << "-hi:" << domain.hi() << "\n";
std::cerr << " point:" << task->index_point << "\n";
switch (domain.get_dim()) {
case 0: {
break;
}
case 1: {
Rect<1> rect = domain;
std::cerr << rect.lo << " " << rect.hi << "\n";
for (PointInRectIterator<1> pir(rect); pir(); pir++) {
Rect<1> slice(*pir, *pir);
}
break;
}
case 2: {
assert(false);
}
case 3: {
assert(false);
}
default:
assert(false);
}
/* print some stats about all the task's regions
*/
std::cerr << "regions:\n";
for (unsigned idx = 0; idx < task->regions.size(); idx++) {
// https://legion.stanford.edu/doxygen/struct_legion_1_1_region_requirement.html
std::cerr << " " << idx << "\n";
RegionRequirement req = task->regions[idx];
Domain domain =
runtime->get_index_space_domain(ctx, req.region.get_index_space());
switch (domain.get_dim()) {
case 0: {
break;
}
case 1: {
Rect<1> rect = domain;
std::cerr << " domain: " << rect.lo << "-" << rect.hi << "\n";
break;
}
case 2: {
Rect<2> rect = domain;
std::cerr << " domain: " << rect.lo << "-" << rect.hi << "\n";
break;
}
case 3: {
Rect<3> rect = domain;
std::cerr << " domain: " << rect.lo << "-" << rect.hi << "\n";
break;
}
default:
assert(false);
}
std::cerr << " region: " << req.region << "\n";
std::cerr << " partition: " << req.partition << "\n";
std::cerr << " parent: " << req.parent << "\n";
LogicalRegion region = req.region;
LogicalPartition partition = req.partition;
}
}
}
/* Build task-group communication matrix.
overlap[gi][gi] = B, where gi is the group index in groups
B is the size in bytes of the index space overlap between the two
communication groups
*/
std::map<size_t, std::map<size_t, int64_t>> overlap;
/* return the implicit overlap of two RegionRequirements.
some discussion on non-interference of RegionRequirements
https://legion.stanford.edu/tutorial/privileges.html
*/
auto region_requirement_overlap = [&](const RegionRequirement &a,
const RegionRequirement &b) -> int64_t {
// if the two regions are not rooted by the same LogicalRegion, they can't
if (a.region.get_tree_id() != b.region.get_tree_id()) {
return 0;
}
// if both are read-only they don't overlap
if (a.privilege == READ_ONLY && b.privilege == READ_ONLY) {
return 0;
}
// if a does not write then 0
if ((a.privilege != WRITE_DISCARD) && (a.privilege != READ_WRITE)) {
return 0;
}
// which fields overlap between RegionRequirements a and b
std::set<FieldID> fieldOverlap;
for (auto &field : b.instance_fields) {
auto it =
std::find(a.instance_fields.begin(), a.instance_fields.end(), field);
if (it != a.instance_fields.end()) {
fieldOverlap.insert(field);
}
}
if (fieldOverlap.empty()) {
return 0;
}
Domain aDom =
runtime->get_index_space_domain(ctx, a.region.get_index_space());
Domain bDom =
runtime->get_index_space_domain(ctx, b.region.get_index_space());
Domain intersection = aDom.intersection(bDom);
size_t totalFieldSize = 0;
for (auto &field : fieldOverlap) {
totalFieldSize +=
runtime->get_field_size(ctx, a.region.get_field_space(), field);
}
return intersection.get_volume() * totalFieldSize;
};
/* return the data size modified by Task `a` and accessed by Task `b`
*/
auto get_task_overlap = [&](const Task *a, const Task *b) -> int64_t {
int64_t bytes = 0;
for (auto ra : a->regions) {
for (auto rb : b->regions) {
bytes += region_requirement_overlap(ra, rb);
}
}
return bytes;
};
/* return the data size modified by TaskGroup `a` and accessed by TaskGroup
* `b`
*/
auto get_overlap = [&](TaskGroup &a, TaskGroup &b) -> int64_t {
int64_t bytes = 0;
for (auto &ta : a) {
for (auto &tb : b) {
bytes += get_task_overlap(ta, tb);
}
}
return bytes;
};
#ifdef NAM_USE_NVTX
nvtxRangePush("get_overlap");
#endif
for (size_t i = 0; i < groups.size(); ++i) {
for (size_t j = 0; j < groups.size(); ++j) {
overlap[i][j] = get_overlap(groups[i], groups[j]);
}
}
#ifdef NAM_USE_NVTX
nvtxRangePop();
#endif
printf("NodeAwareMustEpochMapper::%s(): task-group overlap matrix\n",
__FUNCTION__);
for (auto &src : overlap) {
printf("NodeAwareMustEpochMapper::%s():", __FUNCTION__);
for (auto &dst : src.second) {
printf(" %6ld", dst.second);
}
printf("\n");
}
/* print our GPU number
*/
for (size_t i = 0; i < gpuFBs.size(); ++i) {
log_nam.debug() << "GPU index " << i << "proc:" << gpuFBs[i].first
<< "/mem:" << gpuFBs[i].second;
}
/* build the distance matrix */
#ifdef NAM_USE_NVTX
nvtxRangePush("distance matrix");
#endif
solve::Mat2D<double> distance = get_gpu_distance_matrix(gpuFBs);
#ifdef NAM_USE_NVTX
nvtxRangePop(); // distance matrix
#endif
printf("NodeAwareMustEpochMapper::%s(): distance matrix\n", __FUNCTION__);
for (size_t i = 0; i < distance.shape()[1]; ++i) {
printf("NodeAwareMustEpochMapper::%s():", __FUNCTION__);
for (size_t j = 0; j < distance.shape()[0]; ++j) {
printf(" %6f", distance.at(i, j));
}
printf("\n");
}
/* build the flow matrix */
solve::Mat2D<int64_t> weight(overlap.size(), overlap.size(), 0);
{
size_t i = 0;
for (auto &src : overlap) {
size_t j = 0;
for (auto &dst : src.second) {
weight.at(i, j) = dst.second;
++j;
}
++i;
}
}
printf("NodeAwareMustEpochMapper::%s(): weight matrix\n", __FUNCTION__);
for (size_t i = 0; i < weight.shape()[1]; ++i) {
printf("NodeAwareMustEpochMapper::%s():", __FUNCTION__);
for (size_t j = 0; j < weight.shape()[0]; ++j) {
printf(" %8ld", weight.at(i, j));
}
printf("\n");
}
// TODO: for a must-epoch task, we should never have more tasks than agents,
// so solve_ap only needs to work for distance >= weight
// TODO this should be QAP
#ifdef NAM_USE_NVTX
nvtxRangePush("solve_ap");
#endif
double cost;
std::vector<size_t> assignment =
solve::ap_sum_brute_force(&cost, weight, distance);
#ifdef NAM_USE_NVTX
nvtxRangePop(); // solve_ap
#endif
if (assignment.empty()) {
log_nam.fatal() << "couldn't find an assignment";
exit(1);
}
{
std::stringstream ss;
ss << __FUNCTION__ << "(): task assignment:";
for (auto &e : assignment) {
ss << e << " ";
}
log_nam.info() << ss.str();
log_nam.info() << __FUNCTION__ << "(): cost was " << cost;
}
// copy the mapping to the output
std::map<const Task *, Processor> procMap;
for (size_t gi = 0; gi < groups.size(); ++gi) {
for (const Task *task : groups[gi]) {
procMap[task] = gpuFBs[assignment[gi]].first;
}
}
for (unsigned i = 0; i < input.tasks.size(); ++i) {
output.task_processors[i] = procMap[input.tasks[i]];
}
// map all constraints.
// BEGIN: lifted from default mapper
// Now let's map the constraints, find one requirement to use for
// mapping each of the constraints, but get the set of fields we
// care about and the set of logical regions for all the requirements
for (unsigned cid = 0; cid < input.constraints.size(); cid++) {
const MappingConstraint &constraint = input.constraints[cid];
std::vector<PhysicalInstance> &constraint_mapping =
output.constraint_mappings[cid];
std::set<LogicalRegion> needed_regions;
std::set<FieldID> needed_fields;
for (unsigned idx = 0; idx < constraint.constrained_tasks.size(); idx++) {
const Task *task = constraint.constrained_tasks[idx];
unsigned req_idx = constraint.requirement_indexes[idx];
log_nam.debug("input constraint %u: task %u region %u", cid, task->task_id,
req_idx);
needed_regions.insert(task->regions[req_idx].region);
needed_fields.insert(task->regions[req_idx].privilege_fields.begin(),
task->regions[req_idx].privilege_fields.end());
}
// Now delegate to a policy routine to decide on a memory and layout
// constraints for this constrained instance
std::vector<Processor> target_procs;
for (std::vector<const Task *>::const_iterator it =
constraint.constrained_tasks.begin();
it != constraint.constrained_tasks.end(); ++it)
target_procs.push_back(procMap[*it]);
LayoutConstraintSet layout_constraints;
layout_constraints.add_constraint(
FieldConstraint(needed_fields, false /*!contiguous*/));
Memory mem = default_policy_select_constrained_instance_constraints(
ctx, constraint.constrained_tasks, constraint.requirement_indexes,
target_procs, needed_regions, needed_fields, layout_constraints);
LogicalRegion to_create =
((needed_regions.size() == 1)
? *(needed_regions.begin())
: default_find_common_ancestor(ctx, needed_regions));
PhysicalInstance inst;
bool created;
bool ok = runtime->find_or_create_physical_instance(
ctx, mem, layout_constraints, std::vector<LogicalRegion>(1, to_create),
inst, created, true /*acquire*/);
assert(ok);
if (!ok) {
log_nam.error("Default mapper error. Unable to make instance(s) "
"in memory " IDFMT " for index %d of constrained "
"task %s (ID %lld) in must epoch launch.",
mem.id, constraint.requirement_indexes[0],
constraint.constrained_tasks[0]->get_task_name(),
constraint.constrained_tasks[0]->get_unique_id());
assert(false);
}
constraint_mapping.push_back(inst);
}
// END: lifted from default mapper
#if 0
printf("NodeAwareMustEpochMapper::%s(): actually just use "
"DefaultMapper::map_must_epoch()\n",
__FUNCTION__);
DefaultMapper::map_must_epoch(ctx, input, output);
#endif
printf("NodeAwareMustEpochMapper::%s(): [exit]\n", __FUNCTION__);
#ifdef NAM_USE_NVTX
nvtxRangePop(); // NodeAwareMustEpochMapper::map_must_epoch
#endif
}
/*
struct PostMapInput {
std::vector<std::vector<PhysicalInstance> > mapped_regions;
std::vector<std::vector<PhysicalInstance> > valid_instances;
};
struct PostMapOutput {
std::vector<std::vector<PhysicalInstance> > chosen_instances;
};
*/
void NodeAwareMustEpochMapper::postmap_task(const MapperContext ctx,
const Task &task,
const PostMapInput &input,
PostMapOutput &output) {
log_nam.debug() << "in NodeAwareMustEpochMapper::postmap_task";
}
// TODO: incomplete
int64_t NodeAwareMustEpochMapper::get_logical_region_overlap(
MapperContext ctx, const LogicalRegion &lra, const LogicalRegion &lrb) {
// if the two regions are not rooted by the same LogicalRegion, they can't
// overlap
if (lra.get_tree_id() != lrb.get_tree_id()) {
return 0;
}
// if the two regions don't have the same field space, they can't overlap
// TODO: true?
if (lra.get_field_space() != lrb.get_field_space()) {
return 0;
}
Domain aDom = runtime->get_index_space_domain(ctx, lra.get_index_space());
Domain bDom = runtime->get_index_space_domain(ctx, lrb.get_index_space());
Domain intersection = aDom.intersection(bDom);
return intersection.get_volume();
}
TaskHash NodeAwareMustEpochMapper::compute_task_hash(const Task &task) {
return DefaultMapper::compute_task_hash(task);
}
int64_t NodeAwareMustEpochMapper::get_region_requirement_overlap(
MapperContext ctx, const RegionRequirement &rra,
const RegionRequirement &rrb) {
// If the region requirements have no shared fields, the overlap is zero
std::set<FieldID> sharedFields;
for (auto &field : rrb.privilege_fields) {
auto it = std::find(rra.privilege_fields.begin(),
rra.privilege_fields.end(), field);
if (it != rra.privilege_fields.end()) {
sharedFields.insert(field);
}
}
if (sharedFields.empty()) {
return 0;
}
// if the RegionRequirement was a logical partition, the caller
// should have converted it to a logical region for us
LogicalRegion lra;
if (rra.region.exists()) {
lra = rra.region;
} else if (rra.partition.exists()) {
assert(false);
} else {
assert(false);
}
LogicalRegion lrb;
if (rrb.region.exists()) {
lrb = rrb.region;
} else if (rrb.partition.exists()) {
assert(false);
} else {
assert(false);
}
int64_t sharedFieldSize = 0;
for (auto &f : sharedFields) {
sharedFieldSize += runtime->get_field_size(ctx, lra.get_field_space(), f);
}
int64_t numPoints = get_logical_region_overlap(ctx, lra, lrb);
return numPoints * sharedFieldSize;
}
std::vector<std::pair<Processor, Memory>>
NodeAwareMustEpochMapper::get_gpu_fbs() {
printf("NodeAwareMustEpochMapper::%s(): GPU-FB affinities\n", __FUNCTION__);
std::vector<Machine::ProcessorMemoryAffinity> procMemAffinities;
machine.get_proc_mem_affinity(procMemAffinities);
for (auto &aff : procMemAffinities) {
// find the closes FB mem to each GPU
if (aff.p.kind() == Processor::TOC_PROC &&
aff.m.kind() == Memory::GPU_FB_MEM) {
std::cerr << aff.p << "-" << aff.m << " " << aff.bandwidth << " "
<< aff.latency << "\n";
}
}
std::vector<std::pair<Processor, Memory>> gpus;
{
// find the highest-bandwidth fb each GPU has access to
std::map<Processor, Machine::ProcessorMemoryAffinity> best;
for (auto &aff : procMemAffinities) {
if (aff.p.kind() == Processor::TOC_PROC &&
aff.m.kind() == Memory::GPU_FB_MEM) {
auto it = best.find(aff.p);
if (it != best.end()) {
if (aff.bandwidth > it->second.bandwidth) {
it->second = aff;
}
} else {
best[aff.p] = aff;
}
}
}
size_t i = 0;
for (auto &kv : best) {
assert(kv.first == kv.second.p);
assert(kv.first.kind() == Processor::TOC_PROC);
assert(kv.second.m.kind() == Memory::GPU_FB_MEM);
log_nam.spew() << "proc " << kv.first << ": closes mem=" << kv.second.m
<< " bw=" << kv.second.bandwidth
<< "latency=" << kv.second.latency;
std::pair<Processor, Memory> pmp;
pmp.first = kv.first;
pmp.second = kv.second.m;
gpus.push_back(pmp);
++i;
}
}
return gpus;
}
solve::Mat2D<double> NodeAwareMustEpochMapper::get_gpu_distance_matrix(
const std::vector<std::pair<Processor, Memory>> &gpus) {
printf("NodeAwareMustEpochMapper::%s(): GPU memory-memory affinities\n",
__FUNCTION__);
std::vector<Machine::MemoryMemoryAffinity> memMemAffinities;
machine.get_mem_mem_affinity(memMemAffinities);
for (auto &aff : memMemAffinities) {
log_nam.spew() << aff.m1 << "-" << aff.m2 << " " << aff.bandwidth << " "
<< aff.latency;
}
solve::Mat2D<double> ret(gpus.size(), gpus.size(), 0);
size_t i = 0;
for (auto &src : gpus) {
size_t j = 0;
for (auto &dst : gpus) {
// TODO: self distance is 0
if (src.first == dst.first) {
ret.at(i, j) = 0;
// Look for a MemoryMemoryAffinity between the GPU fbs and use that
} else {
bool found = false;
for (auto &mma : memMemAffinities) {
if (mma.m1 == src.second && mma.m2 == dst.second) {
ret.at(i, j) = 1.0 / mma.bandwidth;
found = true;
break;
}
}
if (!found) {
log_nam.error("couldn't find mem-mem affinity for GPU FBs");
assert(false);
}
}
++j;
}
++i;
}
return ret;
}
|
7ccf3777a26419b0d87ff8405304e2a384a76471
|
3e7ae0d825853090372e5505f103d8f3f39dce6d
|
/AutMarine v4.2.0/AutLib/HydroDynamics/CFD/Vector/FvVector.hxx
|
4d6935dfbc3f0df46d03cd97e3619544c2f099d1
|
[] |
no_license
|
amir5200fx/AutMarine-v4.2.0
|
bba1fe1aa1a14605c22a389c1bd3b48d943dc228
|
6beedbac1a3102cd1f212381a9800deec79cb31a
|
refs/heads/master
| 2020-11-27T05:04:27.397790
| 2019-12-20T17:59:03
| 2019-12-20T17:59:03
| 227,961,590
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 976
|
hxx
|
FvVector.hxx
|
#pragma once
#ifndef _FvVector_Header
#define _FvVector_Header
#include <FvPrimitives_Scalar.hxx>
#include <FvPrimitives_Label.hxx>
#include <Standard_String.hxx>
namespace AutLib
{
namespace FvLib
{
class FvVector
{
private:
Standard_String theName_;
public:
const Standard_String& Name() const;
void SetName(const Standard_String theName);
virtual Label Size() const = 0;
virtual Scalar Value(const Label theIndex) const = 0;
virtual Scalar operator[](const Label theIndex) const = 0;
virtual Scalar operator()(const Label theIndex) const = 0;
virtual void Init(const Scalar theValue) = 0;
virtual void SetValue(const Label theIndex, const Scalar theValue) = 0;
virtual void AddValue(const Label theIndex, const Scalar theValue) = 0;
virtual void Allocate(const Label theSize) = 0;
virtual void ReleaseMemory() = 0;
protected:
FvVector();
};
}
}
#include <FvVectorI.hxx>
#endif // !_FvVector_Header
|
5268348dbce2b60abb52fb62d79bcbbc46f86315
|
0076b581f0e0bf5b37b237b0fc3c61d848f4a098
|
/libraries/ros_lib/iri_common_drivers_msgs/compass3axis.h
|
2e4dfb1f399ba5f85db8bb08e4e0836a0f65f43d
|
[] |
no_license
|
ericguerrero/arduino_lib
|
cfa0f8da26cda45ca31487c6409dc67b21154ca5
|
c9cda17251f3ab7bca44c578eb224dc6d944d62e
|
refs/heads/master
| 2020-09-14T12:57:55.639687
| 2016-09-08T11:49:14
| 2016-09-08T11:49:14
| 67,698,488
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,100
|
h
|
compass3axis.h
|
#ifndef _ROS_iri_common_drivers_msgs_compass3axis_h
#define _ROS_iri_common_drivers_msgs_compass3axis_h
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "std_msgs/Header.h"
namespace iri_common_drivers_msgs
{
class compass3axis : public ros::Msg
{
public:
std_msgs::Header header;
float angles[3];
float covariances[9];
bool alarms[3];
compass3axis():
header(),
angles(),
covariances(),
alarms()
{
}
virtual int serialize(unsigned char *outbuffer) const
{
int offset = 0;
offset += this->header.serialize(outbuffer + offset);
for( uint8_t i = 0; i < 3; i++){
offset += serializeAvrFloat64(outbuffer + offset, this->angles[i]);
}
for( uint8_t i = 0; i < 9; i++){
offset += serializeAvrFloat64(outbuffer + offset, this->covariances[i]);
}
for( uint8_t i = 0; i < 3; i++){
union {
bool real;
uint8_t base;
} u_alarmsi;
u_alarmsi.real = this->alarms[i];
*(outbuffer + offset + 0) = (u_alarmsi.base >> (8 * 0)) & 0xFF;
offset += sizeof(this->alarms[i]);
}
return offset;
}
virtual int deserialize(unsigned char *inbuffer)
{
int offset = 0;
offset += this->header.deserialize(inbuffer + offset);
for( uint8_t i = 0; i < 3; i++){
offset += deserializeAvrFloat64(inbuffer + offset, &(this->angles[i]));
}
for( uint8_t i = 0; i < 9; i++){
offset += deserializeAvrFloat64(inbuffer + offset, &(this->covariances[i]));
}
for( uint8_t i = 0; i < 3; i++){
union {
bool real;
uint8_t base;
} u_alarmsi;
u_alarmsi.base = 0;
u_alarmsi.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
this->alarms[i] = u_alarmsi.real;
offset += sizeof(this->alarms[i]);
}
return offset;
}
const char * getType(){ return "iri_common_drivers_msgs/compass3axis"; };
const char * getMD5(){ return "a78a36c0da6797b6cab1e7e993c489c3"; };
};
}
#endif
|
bc5b5bf6f2424d74b70fa6f3a040cd6c44971792
|
b8d1007362afcd7dbe85ff82745217388c435150
|
/LUOGU/C - Piggy-Bank.cpp
|
f2f5fbd89dcfb7b8ccc7844babb7e5b3179554d5
|
[
"MIT"
] |
permissive
|
PIPIKAI/ACM
|
5ef5bcd0193ed49e48806cca64875c1abaa00c42
|
b8e4416a29c0619946c9b73b0fe5699b6e96e782
|
refs/heads/master
| 2021-07-19T02:29:04.010478
| 2020-08-03T01:36:58
| 2020-08-03T01:36:58
| 200,979,733
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 970
|
cpp
|
C - Piggy-Bank.cpp
|
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1e9+7
#define ffr(i,a,b) for(int i=a;i<b;i++)
#define mem(a,b) memset( a,b,sizeof a)
#define Max(x,y) y>x?x=y:x=x
int n,m;
const int maxn=508;
struct node
{
int w,v;
}f[maxn];
int dp[10008];
int main()
{
std::ios::sync_with_stdio(false);
int T;
int emp,full;
cin>>T;
while(T--){
mem(dp,0);
cin>>emp>>full;
full=full-emp;
cin>>n;
dp[0]=inf;
for(int i=0;i<n;i++){
cin>>f[i].w>>f[i].v;
}
for(int i=0;i<n;i++){
for(int j=f[i].v;j<=full;j++){
dp[j]=dp[j]==0 ?dp[j-f[i].v] + f[i].w :min (dp[j-f[i].v]+f[i].w,dp[j] );
}
}
if(dp[full]==inf){
cout<<"This is impossible."<<endl;
}
else{
cout<<"The minimum amount of money in the piggy-bank is "<<dp[full]-inf<<"."<<endl;
}
}
return 0;
}
|
c4cc6529ccc62e856ae0bdc3a726eb6160144e10
|
568f85b8f56d120e93280a4e5574fae7023cbf83
|
/HackerRank/30 Days of Code/Day 7 - Arrays!/Day 7.cpp
|
486f62e84afcd3db870f6015dc6bff246b5dcbc5
|
[] |
no_license
|
Mystery-College-of-The-Adapts/Programming-Challenges
|
4150ccd8c7958d15b0bb44a1e22aa26efab2744d
|
cf2163f0e8da4dca7482dbf1db6d5aa996de9bbc
|
refs/heads/master
| 2021-06-12T13:00:03.664957
| 2017-04-13T06:18:51
| 2017-04-13T06:18:51
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 283
|
cpp
|
Day 7.cpp
|
#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
for (int arr_i = 0;arr_i < n;arr_i++) {
cin >> arr[arr_i];
}
for (auto i = 0; i < n;i++)
cout << arr[n - 1 - i] << " ";
return 0;
}
|
a84528c7e5e9e3f67ca1cfb47794d7e40cb2362e
|
0644709ec5d51e7af89803c070958a674a3d124a
|
/Luogu/p5020.cpp
|
dae78f0a4a777123a0f6a060202f0c5f93446cbe
|
[] |
no_license
|
ClConstantine/OI
|
5ae64510ceaecd891d0e6c7de750a49a768f796f
|
84842bda3498ba62949f32bfaca1898433d27023
|
refs/heads/master
| 2021-06-13T05:49:08.890493
| 2021-06-10T14:07:07
| 2021-06-10T14:07:07
| 160,818,111
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 796
|
cpp
|
p5020.cpp
|
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
using std::cin;using std::cout;using std::cerr;using std::endl;
const int mmax = 100,nmax = 25000;
int a[mmax + 10];
bool f[nmax + 10];
int n,max = 0,T,ans;
int main(){
std::ios::sync_with_stdio(0);
cin.tie(0);
cin>>T;
while(T--){
ans = 0;
memset(f,0,sizeof(f));
f[0] = 1;
cin>>n;
for(int i = 1;i <= n;++i){
cin>>a[i];
max = std::max(a[i],max);
}
std::sort(a + 1,a + n + 1);
for(int i = 1;i <= n;i++){
if(f[a[i]]){continue;}
ans++;
for(int j = 0;j + a[i] <= max;j++){
if(f[j]) f[j + a[i]] = 1;
}
}
cout<<ans<<endl;
}
return 0;
}
|
7fdedc641e68bbb6c9a510ceec1e5e67a5d4caf0
|
fd75a2ddee54d1b7f96a624ddf8441291cc6f911
|
/2268.cpp
|
1304c0bb99cbd974d45cfcc195808202915279dd
|
[] |
no_license
|
laz/BOJ
|
4f58c6238d9fc2a8909e24fb429a49a2f0d387ac
|
2372c82838408ad6479bb0183e68043eac48835e
|
refs/heads/master
| 2023-08-22T06:05:34.840623
| 2021-10-12T17:25:09
| 2021-10-12T17:25:09
| 322,253,999
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,033
|
cpp
|
2268.cpp
|
#include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(0), cin.tie(0)
using namespace std;
using ll = long long;
int arr[1000007];
int n, m;
void input() {
fastio;
cin >> n >> m;
}
ll query(vector<ll>& tree, int l, int r, int i = 1, int s = 0, int e = n-1) {
if(l > e || r < s) return 0;
if(l <= s && e <= r) return tree[i];
int m = (s + e) >> 1;
return query(tree, l, r, i<<1, s, m) + query(tree, l, r, i<<1|1, m+1, e);
}
ll update(vector<ll>& tree, int t, int v, int i = 1, int s = 0, int e = n-1) {
if(t < s || t > e) return tree[i];
if(s == e) return tree[i] = v;
int m = (s + e) >> 1;
return tree[i] = update(tree, t, v, i<<1, s, m) + update(tree, t, v, i<<1|1, m+1, e);
}
int main() {
input();
int h = (int)ceil(log2(n));
vector<ll> tree((1 << (h+1)));
while(m--) {
int a, b, c; cin >> a >> b >> c;
if(a) update(tree, b-1, c);
else {
if(b > c) swap(b, c);
cout << query(tree, b-1, c-1) << '\n';
}
}
}
|
74d813f75d1a18f0f89f4adcf151fcddcd344986
|
dde172ff95646cb6e85b86e67b8c8c87381ef450
|
/GridNode.h
|
6ba23a7178aee732ff03aa7a9eb121839e67dcb2
|
[] |
no_license
|
AaratiS12/Project-2
|
b0407c48740848aec64b06cbf2cb0daae071c842
|
4cc6c6123bfc82ffece39846cb825494c787f24e
|
refs/heads/master
| 2022-04-19T15:16:28.737548
| 2020-04-12T03:32:30
| 2020-04-12T03:32:30
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,451
|
h
|
GridNode.h
|
class GridNode{
private:
int x;
int y;
std::string val;
mutable bool visited;
mutable std::unordered_set<const GridNode*> neighbors;
public:
GridNode(){
x=-1;
y=-1;
val=-1;
visited=false;
}
GridNode(int xval,int yval, std::string nStr){
x=xval;
y=yval;
val=nStr;
visited=false;
neighbors.reserve(4);
}
std::string getVal()const{
return val;
}
int getX()const{
return x;
}
int getY()const{
return y;
}
std::unordered_set<const GridNode*> getNeighbors()const{
return neighbors;
}
void addNeighbor(const GridNode* node)const{
neighbors.insert(node);
}
void visit()const{
visited=true;
return;
}
bool isVisited()const{
return visited;
}
bool operator==(const GridNode node)const{
if(x==node.getX()&&y==node.getY()){
return true;
}
return false;
}
bool operator!=(const GridNode node)const{
return !operator==(node);
}
};
struct GridNodeHash{
public:
size_t operator() (const GridNode& n) const{
std::string str=n.getVal();
return std::hash<std::string>()(str);
}
size_t operator() (const GridNode* n) const{
std::string str=n->getVal();
return std::hash<std::string>()(str);
}
};
|
ea02d8136b96cf4d9faac0bfbb8b2cb71988e962
|
e6389d3cd6fe210fbe8a4a5c23531bab17eb40d0
|
/libs/hwdrivers/src/CGenericSensor.cpp
|
78d2f09d3d0d89ec1e4cc5a2e104e0d1682da53a
|
[
"BSD-3-Clause"
] |
permissive
|
bigjun/mrpt
|
7b107cb35fbc2fefb2e456552695557780e0164c
|
99b922ed9aee1778e9d01780a70673ac3456031d
|
refs/heads/master
| 2021-01-21T09:11:25.927850
| 2013-12-12T18:27:07
| 2013-12-12T18:27:07
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,115
|
cpp
|
CGenericSensor.cpp
|
/* +---------------------------------------------------------------------------+
| The Mobile Robot Programming Toolkit (MRPT) |
| |
| http://www.mrpt.org/ |
| |
| Copyright (c) 2005-2013, Individual contributors, see AUTHORS file |
| Copyright (c) 2005-2013, MAPIR group, University of Malaga |
| Copyright (c) 2012-2013, University of Almeria |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted provided that the following conditions are |
| met: |
| * Redistributions of source code must retain the above copyright |
| notice, this list of conditions and the following disclaimer. |
| * Redistributions in binary form must reproduce the above copyright |
| notice, this list of conditions and the following disclaimer in the |
| documentation and/or other materials provided with the distribution. |
| * Neither the name of the copyright holders nor the |
| names of its contributors may be used to endorse or promote products |
| derived from this software without specific prior written permission.|
| |
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR|
| PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE |
| FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL|
| DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR|
| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| POSSIBILITY OF SUCH DAMAGE. |
+---------------------------------------------------------------------------+ */
#include <mrpt/hwdrivers.h> // Precompiled headers
#include <mrpt/slam/CAction.h>
#include <mrpt/slam/CObservation.h>
using namespace mrpt::utils;
using namespace mrpt::slam;
using namespace mrpt::system;
using namespace mrpt::hwdrivers;
using namespace std;
map< std::string , const TSensorClassId *> CGenericSensor::m_knownClasses;
extern CStartUpClassesRegister mrpt_hwdrivers_class_reg;
const int dumm = mrpt_hwdrivers_class_reg.do_nothing(); // Avoid compiler removing this class in static linking
/*-------------------------------------------------------------
Constructor
-------------------------------------------------------------*/
CGenericSensor::CGenericSensor() :
m_process_rate(0),
m_max_queue_len(200),
m_grab_decimation(0),
m_sensorLabel("UNNAMED_SENSOR"),
m_grab_decimation_counter(0),
m_state( ssInitializing ),
m_verbose(false),
m_path_for_external_images (),
m_external_images_format ("jpg"),
m_external_images_jpeg_quality (95)
{
const char * sVerbose = getenv("MRPT_HWDRIVERS_VERBOSE");
m_verbose = (sVerbose!=NULL) && atoi(sVerbose)!=0;
}
/*-------------------------------------------------------------
Destructor
-------------------------------------------------------------*/
CGenericSensor::~CGenericSensor()
{
// Free objects in list, if any:
m_objList.clear();
}
/*-------------------------------------------------------------
appendObservations
-------------------------------------------------------------*/
void CGenericSensor::appendObservations( const std::vector<mrpt::utils::CSerializablePtr> &objs)
{
if (++m_grab_decimation_counter>=m_grab_decimation)
{
m_grab_decimation_counter = 0;
synch::CCriticalSectionLocker lock( & m_csObjList );
for (size_t i=0;i<objs.size();i++)
{
const CSerializablePtr &obj = objs[i];
if (!obj) continue;
// It must be a CObservation or a CAction!
TTimeStamp timestamp;
if ( obj->GetRuntimeClass()->derivedFrom( CLASS_ID(CAction) ) )
{
timestamp = CActionPtr(obj)->timestamp;
}
else
if ( obj->GetRuntimeClass()->derivedFrom( CLASS_ID(CObservation) ) )
{
timestamp = CObservationPtr(obj)->timestamp;
}
else THROW_EXCEPTION("Passed object must be CObservation.");
// Add it:
m_objList.insert( TListObsPair(timestamp, obj) );
}
}
}
/*-------------------------------------------------------------
getObservations
-------------------------------------------------------------*/
void CGenericSensor::getObservations( TListObservations &lstObjects )
{
synch::CCriticalSectionLocker lock( & m_csObjList );
lstObjects = m_objList;
m_objList.clear(); // Memory of objects will be freed by invoker.
}
extern void registerAllClasses_mrpt_hwdrivers();
/*-------------------------------------------------------------
createSensor
-------------------------------------------------------------*/
CGenericSensor* CGenericSensor::createSensor(const std::string &className)
{
registerAllClasses_mrpt_hwdrivers(); // make sure all sensors are registered.
std::map< std::string , const TSensorClassId *>::iterator it=m_knownClasses.find(className);
return it==m_knownClasses.end() ? NULL : it->second->ptrCreateObject();
}
/*-------------------------------------------------------------
registerClass
-------------------------------------------------------------*/
void CGenericSensor::registerClass(const TSensorClassId* pNewClass)
{
m_knownClasses[ pNewClass->className ] = pNewClass;
}
/** Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensorSpecific"
* \exception This method throws an exception with a descriptive message if some critical parameter is missing or has an invalid value.
*/
void CGenericSensor::loadConfig(
const mrpt::utils::CConfigFileBase &cfg,
const std::string § )
{
MRPT_START
m_process_rate = cfg.read_double(sect,"process_rate",0 ); // Leave it to 0 so rawlog-grabber can detect if it's not set by the user.
m_max_queue_len = static_cast<size_t>(cfg.read_int(sect,"max_queue_len",int(m_max_queue_len)));
m_grab_decimation = static_cast<size_t>(cfg.read_int(sect,"grab_decimation",int(m_grab_decimation)));
m_sensorLabel = cfg.read_string( sect, "sensorLabel", m_sensorLabel );
m_grab_decimation_counter = 0;
loadConfig_sensorSpecific(cfg,sect);
MRPT_END
}
|
ecca4bd53df72611ac95ce4503a34a1e662d3acf
|
04b1803adb6653ecb7cb827c4f4aa616afacf629
|
/services/ws/public/cpp/input_devices/input_device_controller_client.h
|
596bdb4ab6e45abd0541ba2b58e2d743569a5d69
|
[
"BSD-3-Clause"
] |
permissive
|
Samsung/Castanets
|
240d9338e097b75b3f669604315b06f7cf129d64
|
4896f732fc747dfdcfcbac3d442f2d2d42df264a
|
refs/heads/castanets_76_dev
| 2023-08-31T09:01:04.744346
| 2021-07-30T04:56:25
| 2021-08-11T05:45:21
| 125,484,161
| 58
| 49
|
BSD-3-Clause
| 2022-10-16T19:31:26
| 2018-03-16T08:07:37
| null |
UTF-8
|
C++
| false
| false
| 3,526
|
h
|
input_device_controller_client.h
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_WS_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CONTROLLER_CLIENT_H_
#define SERVICES_WS_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CONTROLLER_CLIENT_H_
#include <string>
#include "base/callback_forward.h"
#include "base/macros.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "services/ws/public/mojom/input_devices/input_device_controller.mojom.h"
namespace base {
class FilePath;
}
namespace service_manager {
class Connector;
}
namespace ui {
enum class DomCode;
}
namespace ws {
// InputDeviceControllerClient is mostly a call through to
// mojom::InputDeviceController. It does a minimal amount of caching and is
// itself a KeyboardDeviceObserver to maintain local keyboard state.
class InputDeviceControllerClient : public mojom::KeyboardDeviceObserver {
public:
// |service_Name| is the name of the service providing mojom::KeyboardDevice,
// generally use the default, unless a specific service is needed.
explicit InputDeviceControllerClient(
service_manager::Connector* connector,
const std::string& service_name = std::string());
~InputDeviceControllerClient() override;
using GetHasMouseCallback = base::OnceCallback<void(bool)>;
void GetHasMouse(GetHasMouseCallback callback);
using GetHasTouchpadCallback = base::OnceCallback<void(bool)>;
void GetHasTouchpad(GetHasTouchpadCallback callback);
bool IsCapsLockEnabled();
void SetCapsLockEnabled(bool enabled);
void SetNumLockEnabled(bool enabled);
bool IsAutoRepeatEnabled();
void SetAutoRepeatEnabled(bool enabled);
void SetAutoRepeatRate(base::TimeDelta delay, base::TimeDelta interval);
void SetKeyboardLayoutByName(const std::string& layout_name);
void SetTouchpadSensitivity(int value);
void SetTapToClick(bool enabled);
void SetThreeFingerClick(bool enabled);
void SetTapDragging(bool enabled);
void SetNaturalScroll(bool enabled);
void SetMouseSensitivity(int value);
void SetPrimaryButtonRight(bool right);
void SetMouseReverseScroll(bool enabled);
using GetTouchDeviceStatusCallback =
base::OnceCallback<void(const std::string&)>;
void GetTouchDeviceStatus(GetTouchDeviceStatusCallback callback);
using GetTouchEventLogCallback =
base::OnceCallback<void(const std::vector<base::FilePath>&)>;
void GetTouchEventLog(const base::FilePath& out_dir,
GetTouchEventLogCallback callback);
void SetTapToClickPaused(bool state);
void SetTouchscreensEnabled(bool enabled);
void SetInternalKeyboardFilter(bool enable_filter,
const std::vector<ui::DomCode>& allowed_keys);
// Sets whether the internal touch pad. Returns true if there is an internal
// touchpad.
using SetInternalTouchpadEnabledCallback = base::OnceCallback<void(bool)>;
void SetInternalTouchpadEnabled(bool enable,
SetInternalTouchpadEnabledCallback callback);
private:
// mojom::KeyboardDeviceObserver:
void OnKeyboardStateChanged(mojom::KeyboardDeviceStatePtr state) override;
mojom::InputDeviceControllerPtr input_device_controller_;
mojom::KeyboardDeviceState keyboard_device_state_;
mojo::Binding<mojom::KeyboardDeviceObserver> binding_;
DISALLOW_COPY_AND_ASSIGN(InputDeviceControllerClient);
};
} // namespace ws
#endif // SERVICES_WS_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CONTROLLER_CLIENT_H_
|
665ee7535e9a43082cff5bd5b8ed334ecd6d4fc4
|
7a2dc3c8c6c7d5cb0602d86d14f1cd48a3b64c79
|
/src/utils.cpp
|
3ec3cd1de795709e2beefb65d20e1acd11ed354c
|
[] |
no_license
|
small-luck/httpserver
|
c22080f56eb229b3389ec481368dcc1d73cab655
|
2b2076b31235568bd3dfe743df232dec578ce3f3
|
refs/heads/master
| 2020-08-30T19:57:48.494811
| 2019-11-14T03:36:44
| 2019-11-14T03:36:44
| 218,474,455
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,408
|
cpp
|
utils.cpp
|
/*
*工具模块封装
*author:liupei
*date:2019/10/31
* */
#include "utils.h"
#include "log.h"
#include <sys/syscall.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <string.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
//获取线程ID
pid_t Util::get_thread_id()
{
return ::syscall(SYS_gettid);
}
//设置fd non-block
int Util::set_fd_nonblock(int fd)
{
if (fd < 0)
return -NET_ARGUMENT_ERROR;
int oldflag = ::fcntl(fd, F_GETFL, 0);
int newflag = oldflag | O_NONBLOCK;
return (::fcntl(fd, F_SETFL, newflag));
}
//设置socket reuseaddr
int Util::set_reuseaddr(int fd)
{
int on = 1;
if (fd < 0)
return -NET_ARGUMENT_ERROR;
return (::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&on, sizeof(on)));
}
//设置socket reuseport
int Util::set_reuseport(int fd)
{
int on = 1;
if (fd < 0)
return -NET_ARGUMENT_ERROR;
return (::setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, (char*)&on, sizeof(on)));
}
//设置socket nodelay, forbidden nagel
int Util::set_no_use_nagle(int fd)
{
int on = 1;
if (fd < 0)
return -NET_ARGUMENT_ERROR;
return (::setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&on, sizeof(on)));
}
//设置socket fd send and recv timeout
int Util::set_fd_send_recv_timeout(int fd)
{
struct timeval tv;
int ret;
if (fd < 0)
return -NET_ARGUMENT_ERROR;
tv.tv_sec = TCP_SEND_TIMEO;
tv.tv_usec = 0;
ret = setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char*)&tv, sizeof(tv));
if (ret < 0)
return ret;
return (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (char*)&tv, sizeof(tv)));
}
//ET模式下发送数据
bool Util::send_data(int fd, std::string& sendstr)
{
int nsend = 0;
if (fd < 0 ||sendstr.empty())
return false;
while (true) {
nsend = ::send(fd, sendstr.c_str(), sendstr.length(), 0);
if (nsend < 0) {
//如果是因为tcp发送窗口过小,无法发出去,休眠一段时间后再尝试发送
if (errno == EWOULDBLOCK) {
std::this_thread::sleep_for(std::chrono::milliseconds(500));
continue;
}
//如果因为中断,则继续尝试发送
if (errno == EINTR)
continue;
return false;
}
//如果对端关闭
if (nsend == 0) {
LOG_INFO("fd:%d is closed\n", fd);
return false;
}
sendstr.erase(nsend);
if (sendstr.length() == 0)
break;
}
return true;
}
//ET模式下接收数据
bool Util::recv_data(int fd, std::string& recvstr)
{
int nrecv;
char msg[4096];
if (fd < 0)
return false;
while (true) {
memset(&msg, 0, sizeof(msg));
nrecv = ::recv(fd, msg, 4096, 0);
if (nrecv < 0) {
if (errno == EWOULDBLOCK || errno == EINTR) {
break;
}
return false;
} else if (nrecv == 0) {
//对端关闭
return false;
} else {
recvstr.append(msg);
}
}
return true;
}
//根据分隔符将str分成若干个,放入vector
void Util::split(const std::string& str, std::vector<std::string>& v, const char* separator/* = ";"*/)
{
if (str.empty() || separator == nullptr)
return;
std::string buf(str);
std::size_t pos = std::string::npos;
int separator_len = strlen(separator);
std::string substr_str;
while (true) {
pos = buf.find(separator);
if (pos != std::string::npos) {
substr_str = buf.substr(0, pos);
if (!substr_str.empty())
v.push_back(substr_str);
buf = buf.substr(pos + separator_len);
} else {
if (!buf.empty())
v.push_back(buf);
break;
}
}
}
//根据分隔符将str分成两半,放入map中
void Util::cut(const std::string& str, std::pair<std::string, std::string>& m, const char* separator/* = ":"*/)
{
if (str.empty() || separator == nullptr)
return;
int separator_len = strlen(separator);
std::size_t pos;
pos = str.find(separator);
if (pos != std::string::npos) {
m.first = str.substr(0, pos);
m.second = str.substr(pos + separator_len);
}
}
|
8889e3e6f2f52397143110aafa75384691245f60
|
565f81c925193217535e9476764cafc78bf3aa4d
|
/Infrastructure/inc/SoundDevice.hpp
|
02217064372c62b2ce62a295d84e133f07d51f97
|
[] |
no_license
|
BreakEngine/Break-0.1
|
4d22616e9d4bad1d463657b0c719f6b8a970ae52
|
77e26ce547231bdee970b6afb1fec2bf0c5a09d7
|
refs/heads/master
| 2021-05-02T12:38:52.683454
| 2016-02-06T20:39:15
| 2016-02-06T20:39:15
| 44,031,627
| 3
| 3
| null | 2016-09-08T18:40:42
| 2015-10-10T23:05:58
|
C++
|
UTF-8
|
C++
| false
| false
| 1,693
|
hpp
|
SoundDevice.hpp
|
#ifndef BREAK_0_1_SOUNDDEVICE_HPP
#define BREAK_0_1_SOUNDDEVICE_HPP
#include "Globals.hpp"
#include "SoundEffect.hpp"
#include <vector>
namespace Break{
namespace Infrastructure{
struct AudioFormat
{
u16 Channels;
u32 SamplesPerSec;
u16 SampleSize;
AudioFormat()
{
Channels = 2;
SamplesPerSec = 48000;
SampleSize = 2;
}
};
typedef void (*GetAudioCallback)(byte*,u32,void*);
class BREAK_API ISoundDevice{
public:
ISoundDevice();
virtual ~ISoundDevice();
virtual void play(SoundEffect* track)=0;
virtual void stop(SoundEffect* track)=0;
virtual void setVolume(real64 volume)=0;
virtual real64 getVolume()=0;
virtual void setFormat(AudioFormat format)=0;
virtual AudioFormat getFormat()=0;
virtual GetAudioCallback getAudioFeedCallback()=0;
};
typedef std::shared_ptr<ISoundDevice> ISoundDevicePtr;
class BREAK_API Engine;
class BREAK_API SoundDevice : public ISoundDevice{
friend class Engine;
static void FeedAudio(byte* buffer, u32 framesPerBuffer, void* userData);
public:
SoundDevice();
virtual ~SoundDevice();
void setFormat(AudioFormat format) override;
AudioFormat getFormat() override;
void play(SoundEffect* track) override;
void stop(SoundEffect* track) override;
void setVolume(real64 volume) override;
real64 getVolume() override;
GetAudioCallback getAudioFeedCallback() override;
private:
AudioFormat m_format;
real64 m_volume;
std::vector<std::pair<SoundEffect*,bool> > m_sounds;
byte* m_buffer;
u32 m_bufferOffset;
u32 m_bufferSize;
u32 m_written;
};
typedef std::shared_ptr<SoundDevice> SoundDevicePtr;
}
}
#endif
|
235163e134811f182d8c9794ca6b1f13425dabc9
|
c475cd8531a94ffae69cc92371d41531dbbddb6c
|
/Projects/bullet3-2.89/test/hello_gtest/main.cpp
|
e3177799237f14bf318bbcd72c24629f150e7fcc
|
[
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"Zlib"
] |
permissive
|
WolfireGames/overgrowth
|
72d3dd29cbd7254337265c29f8de3e5c32400114
|
594a2a4f9da0855304ee8cd5335d042f8e954ce1
|
refs/heads/main
| 2023-08-15T19:36:56.156578
| 2023-05-17T08:17:53
| 2023-05-17T08:20:36
| 467,448,492
| 2,264
| 245
|
Apache-2.0
| 2023-05-09T07:29:58
| 2022-03-08T09:38:54
|
C++
|
UTF-8
|
C++
| false
| false
| 791
|
cpp
|
main.cpp
|
/////////////////////////////
// In the header file
#include <sstream>
using namespace std;
class Salutation
{
public:
static string greet(const string& name);
};
///////////////////////////////////////
// In the class implementation file
string Salutation::greet(const string& name)
{
ostringstream s;
s << "Hello " << name << "!";
return s.str();
}
///////////////////////////////////////////
// In the test file
#include <gtest/gtest.h>
TEST(SalutationTest, Static)
{
EXPECT_EQ(string("Hello World!"), Salutation::greet("World"));
}
int main(int argc, char** argv)
{
#if _MSC_VER
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
//void *testWhetherMemoryLeakDetectionWorks = malloc(1);
#endif
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
|
eeaf298b3b8408c4c222d7c3b2011b2ff7596aad
|
709e79dc1b9ed2eb0e255482681e0f8d263158f3
|
/benchmark/askit_release/treecode/src/matern_kernel.hpp
|
d186bb827ab6bf392ac50c07755c29ce0254841d
|
[
"GPL-3.0-only",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
kexinrong/rehashing
|
ebd935cc30cdbb40dca54f7ef76a08b0c87d8048
|
401b1f99970d2cc8cb8444f4c7ee5b94f4ebeb7f
|
refs/heads/master
| 2021-07-03T10:45:32.498877
| 2020-10-21T05:42:28
| 2020-10-21T05:42:28
| 186,186,245
| 22
| 3
|
MIT
| 2020-10-09T04:15:15
| 2019-05-11T22:15:47
|
C++
|
UTF-8
|
C++
| false
| false
| 763
|
hpp
|
matern_kernel.hpp
|
#ifndef MATERN_KERNEL_HPP_
#define MATERN_KERNEL_HPP_
#include <mpi.h>
#include "kernel_inputs.hpp"
#include <iostream>
#include "direct_knn/direct_knn.h"
#include <gsl/gsl_sf_bessel.h>
#include <gsl/gsl_sf_gamma.h>
namespace askit {
class MaternKernel {
public:
MaternKernel(KernelInputs& inputs);
~MaternKernel();
void Compute(std::vector<double>::iterator row_start, std::vector<double>::iterator row_end,
std::vector<double>::iterator col_start, std::vector<double>::iterator col_end, int d,
std::vector<double>& K, vector<int>& source_inds);
void Compute(std::vector<double>& distances, std::vector<double>& K, int d);
double nu;
double sqrt2nu;
double prefactor;
protected:
};
} // namespace
#endif
|
ec6f94f9811cc76d496ee65f4feb7b7fdb2045b6
|
4352b5c9e6719d762e6a80e7a7799630d819bca3
|
/tutorials/oldd/eulerVortex.twitch/eulerVortex.cyclic.twitch/4.04/e
|
12f93bf97c9304e6b135dc2363c26a40c5452ea5
|
[] |
no_license
|
dashqua/epicProject
|
d6214b57c545110d08ad053e68bc095f1d4dc725
|
54afca50a61c20c541ef43e3d96408ef72f0bcbc
|
refs/heads/master
| 2022-02-28T17:20:20.291864
| 2019-10-28T13:33:16
| 2019-10-28T13:33:16
| 184,294,390
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 80,443
|
e
|
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "4.04";
object e;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField nonuniform List<scalar>
10000
(
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.28
1006.28
1006.28
1006.27
1006.27
1006.28
1006.28
1006.28
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.28
1006.27
1006.26
1006.25
1006.25
1006.25
1006.25
1006.25
1006.26
1006.26
1006.27
1006.28
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.28
1006.26
1006.24
1006.23
1006.21
1006.2
1006.2
1006.2
1006.2
1006.22
1006.23
1006.24
1006.26
1006.27
1006.28
1006.29
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.27
1006.25
1006.23
1006.2
1006.16
1006.14
1006.11
1006.11
1006.11
1006.12
1006.15
1006.17
1006.2
1006.22
1006.24
1006.26
1006.28
1006.29
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.27
1006.25
1006.21
1006.17
1006.11
1006.05
1006
1005.96
1005.94
1005.95
1005.97
1006.02
1006.07
1006.12
1006.16
1006.2
1006.23
1006.26
1006.28
1006.29
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.28
1006.25
1006.21
1006.15
1006.06
1005.96
1005.85
1005.75
1005.67
1005.64
1005.65
1005.7
1005.78
1005.88
1005.97
1006.06
1006.13
1006.18
1006.22
1006.25
1006.27
1006.29
1006.3
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.27
1006.22
1006.15
1006.04
1005.89
1005.7
1005.49
1005.3
1005.16
1005.09
1005.11
1005.21
1005.36
1005.54
1005.72
1005.88
1006
1006.1
1006.17
1006.22
1006.25
1006.28
1006.29
1006.3
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.3
1006.28
1006.25
1006.17
1006.05
1005.85
1005.58
1005.24
1004.87
1004.52
1004.26
1004.14
1004.17
1004.35
1004.63
1004.96
1005.28
1005.56
1005.79
1005.96
1006.08
1006.16
1006.22
1006.26
1006.28
1006.3
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.3
1006.3
1006.28
1006.22
1006.09
1005.87
1005.53
1005.05
1004.46
1003.81
1003.2
1002.74
1002.52
1002.58
1002.91
1003.4
1003.98
1004.55
1005.04
1005.44
1005.73
1005.94
1006.08
1006.17
1006.23
1006.26
1006.29
1006.3
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.3
1006.29
1006.3
1006.31
1006.31
1006.27
1006.16
1005.95
1005.58
1005
1004.19
1003.18
1002.06
1001.01
1000.23
999.865
999.982
1000.54
1001.39
1002.39
1003.36
1004.2
1004.87
1005.36
1005.71
1005.94
1006.09
1006.18
1006.24
1006.27
1006.29
1006.3
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.31
1006.31
1006.32
1006.31
1006.3
1006.29
1006.29
1006.31
1006.32
1006.32
1006.25
1006.07
1005.72
1005.11
1004.16
1002.81
1001.13
999.279
997.552
996.267
995.674
995.874
996.798
998.227
999.878
1001.49
1002.89
1003.99
1004.8
1005.36
1005.73
1005.97
1006.11
1006.2
1006.25
1006.28
1006.3
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.32
1006.31
1006.29
1006.28
1006.29
1006.32
1006.35
1006.34
1006.22
1005.93
1005.36
1004.38
1002.85
1000.68
997.97
995.015
992.276
990.245
989.309
989.634
991.11
993.402
996.057
998.654
1000.9
1002.67
1003.96
1004.85
1005.43
1005.79
1006.01
1006.15
1006.22
1006.27
1006.29
1006.3
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.32
1006.32
1006.31
1006.28
1006.27
1006.29
1006.34
1006.39
1006.35
1006.16
1005.71
1004.82
1003.29
1000.89
997.502
993.307
988.769
984.576
981.465
980.025
980.515
982.784
986.323
990.442
994.484
997.985
1000.74
1002.74
1004.1
1004.99
1005.54
1005.88
1006.07
1006.18
1006.25
1006.28
1006.3
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.32
1006.32
1006.3
1006.26
1006.25
1006.3
1006.38
1006.44
1006.37
1006.07
1005.38
1004.04
1001.72
998.068
992.987
986.753
980.039
973.821
969.187
967.033
967.755
971.127
976.395
982.544
988.599
993.864
998.009
1001.02
1003.06
1004.38
1005.2
1005.69
1005.97
1006.13
1006.22
1006.27
1006.29
1006.3
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.32
1006.33
1006.29
1006.24
1006.24
1006.32
1006.44
1006.5
1006.38
1005.93
1004.92
1002.96
999.541
994.221
986.912
978.008
968.391
959.431
952.755
949.697
950.796
955.677
963.24
972.044
980.731
988.319
994.322
998.691
1001.66
1003.57
1004.74
1005.44
1005.84
1006.06
1006.18
1006.25
1006.28
1006.3
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.31
1006.3
1006.3
1006.33
1006.34
1006.28
1006.21
1006.22
1006.35
1006.51
1006.58
1006.39
1005.74
1004.31
1001.53
996.689
989.269
979.2
966.927
953.554
941.064
931.883
927.852
929.583
936.457
946.924
959.011
970.904
981.323
989.62
995.701
999.85
1002.52
1004.15
1005.12
1005.67
1005.97
1006.14
1006.23
1006.27
1006.3
1006.3
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.31
1006.29
1006.3
1006.35
1006.35
1006.26
1006.17
1006.21
1006.39
1006.61
1006.67
1006.39
1005.51
1003.56
999.742
993.18
983.297
969.979
953.599
935.602
918.94
907
902.012
904.587
913.903
927.907
943.913
959.521
973.149
984.047
992.103
997.648
1001.23
1003.43
1004.72
1005.46
1005.87
1006.09
1006.2
1006.26
1006.29
1006.3
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.31
1006.31
1006.28
1006.3
1006.36
1006.36
1006.24
1006.12
1006.19
1006.44
1006.72
1006.78
1006.4
1005.26
1002.68
997.652
989.159
976.583
959.607
938.465
915.232
894.128
879.308
873.092
876.273
888.232
906.469
927.231
947.169
964.326
977.974
988.112
995.159
999.757
1002.6
1004.27
1005.22
1005.74
1006.03
1006.17
1006.25
1006.28
1006.3
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.28
1006.28
1006.32
1006.32
1006.27
1006.29
1006.39
1006.38
1006.21
1006.07
1006.17
1006.5
1006.84
1006.91
1006.44
1005
1001.73
995.391
984.911
969.576
948.705
922.464
893.918
868.492
850.432
841.899
844.585
858.956
882.202
908.937
934.199
955.379
971.888
984.072
992.586
998.2
1001.7
1003.78
1004.96
1005.61
1005.96
1006.14
1006.23
1006.28
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.3
1006.28
1006.28
1006.33
1006.32
1006.25
1006.28
1006.41
1006.41
1006.19
1006.01
1006.14
1006.55
1006.97
1007.06
1006.51
1004.79
1000.81
993.168
980.813
962.853
938.153
907.027
873.734
844.325
822.257
809.614
810.064
826.144
854.93
888.881
920.691
946.628
966.21
980.357
990.191
996.716
1000.82
1003.28
1004.69
1005.47
1005.89
1006.11
1006.22
1006.27
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.28
1006.29
1006.3
1006.28
1006.27
1006.34
1006.33
1006.24
1006.27
1006.43
1006.44
1006.17
1005.94
1006.09
1006.59
1007.1
1007.24
1006.66
1004.68
1000.02
991.224
977.275
957.056
929.005
893.837
856.903
824.091
797.584
779.733
776.699
793.446
827.24
868.49
907.31
938.451
961.273
977.283
988.225
995.472
1000.07
1002.85
1004.46
1005.35
1005.83
1006.08
1006.2
1006.26
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.28
1006.28
1006.31
1006.28
1006.26
1006.35
1006.35
1006.22
1006.24
1006.45
1006.48
1006.17
1005.87
1006.01
1006.6
1007.22
1007.44
1006.88
1004.73
999.517
989.796
974.67
952.789
922.285
884.43
845.326
810.248
780.414
758.572
752.479
768.78
805.422
851.828
896.216
931.831
957.532
975.122
986.892
994.616
999.528
1002.52
1004.27
1005.25
1005.78
1006.05
1006.19
1006.26
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.28
1006.29
1006.28
1006.28
1006.32
1006.28
1006.25
1006.35
1006.37
1006.21
1006.21
1006.46
1006.54
1006.2
1005.8
1005.91
1006.57
1007.32
1007.67
1007.2
1004.99
999.401
989.069
973.269
950.496
918.74
879.838
840.186
804.562
774.018
751.431
744.256
759.296
795.634
843.387
890.198
928.231
955.65
974.17
986.349
994.252
999.272
1002.35
1004.16
1005.19
1005.74
1006.03
1006.18
1006.25
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.28
1006.28
1006.3
1006.28
1006.27
1006.32
1006.29
1006.23
1006.34
1006.4
1006.22
1006.16
1006.44
1006.6
1006.27
1005.76
1005.77
1006.47
1007.36
1007.88
1007.59
1005.49
999.769
989.168
973.211
950.36
918.667
880.359
841.677
807.179
778.465
758.327
752.234
765.597
798.866
844.354
890.372
928.471
956.095
974.642
986.693
994.433
999.337
1002.36
1004.15
1005.17
1005.73
1006.03
1006.18
1006.25
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.28
1006.3
1006.29
1006.26
1006.32
1006.31
1006.22
1006.32
1006.43
1006.25
1006.11
1006.39
1006.66
1006.38
1005.77
1005.62
1006.29
1007.32
1008.05
1008.03
1006.22
1000.66
990.153
974.502
952.297
921.86
885.533
848.995
816.579
790.868
774.758
770.952
782.585
811.394
852.533
895.673
932.129
958.724
976.485
987.891
995.141
999.717
1002.55
1004.24
1005.21
1005.75
1006.04
1006.18
1006.25
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.28
1006.29
1006.3
1006.25
1006.31
1006.33
1006.22
1006.28
1006.45
1006.3
1006.08
1006.3
1006.67
1006.53
1005.86
1005.48
1006.04
1007.18
1008.13
1008.46
1007.13
1002.06
992.034
977.076
956.071
927.776
894.434
860.777
830.638
807.867
795.693
794.274
804.625
829.289
865.647
904.831
938.444
963.062
979.406
989.771
996.279
1000.36
1002.89
1004.41
1005.3
1005.79
1006.05
1006.19
1006.26
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.28
1006.29
1006.28
1006.29
1006.31
1006.25
1006.29
1006.36
1006.23
1006.23
1006.44
1006.38
1006.08
1006.18
1006.63
1006.68
1006.04
1005.42
1005.72
1006.88
1008.07
1008.78
1008.08
1003.84
994.736
980.828
961.403
935.789
906.095
875.686
847.764
827.528
818.354
818.734
828.505
850.294
882.406
917.145
946.962
968.737
983.098
992.11
997.704
1001.19
1003.35
1004.65
1005.42
1005.85
1006.08
1006.2
1006.26
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.28
1006.28
1006.31
1006.27
1006.26
1006.36
1006.28
1006.18
1006.4
1006.46
1006.14
1006.07
1006.5
1006.78
1006.32
1005.49
1005.4
1006.43
1007.83
1008.94
1008.9
1005.77
998.053
985.585
967.98
945.347
919.674
892.644
867.109
849.23
842.102
843.572
853.142
872.943
901.264
931.374
956.871
975.257
987.24
994.682
999.263
1002.1
1003.86
1004.93
1005.56
1005.92
1006.11
1006.22
1006.27
1006.29
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.27
1006.31
1006.29
1006.24
1006.34
1006.33
1006.17
1006.32
1006.5
1006.26
1006.01
1006.31
1006.78
1006.61
1005.76
1005.2
1005.86
1007.36
1008.86
1009.44
1007.54
1001.63
991.014
975.439
956.014
934.403
910.812
888.09
872.528
866.783
868.858
878.234
896.19
920.689
945.988
966.987
981.865
991.401
997.243
1000.81
1003.01
1004.38
1005.21
1005.71
1005.99
1006.15
1006.23
1006.28
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.27
1006.29
1006.31
1006.24
1006.3
1006.37
1006.21
1006.23
1006.48
1006.39
1006.05
1006.11
1006.62
1006.83
1006.17
1005.26
1005.33
1006.66
1008.43
1009.59
1008.93
1005.02
996.516
983.299
967.293
949.558
929.514
909.936
896.575
891.847
894.274
903.285
919.232
939.77
960.143
976.586
988.003
995.208
999.569
1002.21
1003.84
1004.85
1005.48
1005.85
1006.07
1006.19
1006.25
1006.28
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.28
1006.28
1006.3
1006.28
1006.28
1006.32
1006.26
1006.26
1006.37
1006.28
1006.18
1006.39
1006.49
1006.19
1006
1006.37
1006.86
1006.58
1005.6
1005.08
1005.89
1007.59
1009.22
1009.8
1007.79
1001.41
990.9
978.43
964.428
947.972
931.507
920.255
916.563
919.258
927.554
941.122
957.59
973.167
985.256
993.414
998.483
1001.54
1003.4
1004.54
1005.26
1005.7
1005.97
1006.13
1006.22
1006.27
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.28
1006.29
1006.29
1006.27
1006.31
1006.29
1006.24
1006.33
1006.35
1006.2
1006.27
1006.49
1006.35
1006.03
1006.15
1006.68
1006.8
1006.11
1005.3
1005.34
1006.48
1008.34
1010
1009.52
1005.12
997.509
988.655
978.313
965.144
951.533
942.585
940.235
943.05
950.052
960.707
973.001
984.126
992.415
997.821
1001.12
1003.11
1004.33
1005.1
1005.59
1005.89
1006.07
1006.18
1006.24
1006.28
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.28
1006.28
1006.29
1006.27
1006.29
1006.31
1006.26
1006.28
1006.36
1006.27
1006.21
1006.4
1006.44
1006.18
1006.07
1006.39
1006.72
1006.51
1005.83
1005.27
1005.62
1007.25
1009.31
1009.72
1007.15
1002.61
997.466
990.335
979.771
969.033
962.88
961.886
964.203
969.226
976.711
985.101
992.419
997.682
1001.02
1003.04
1004.26
1005.03
1005.51
1005.83
1006.02
1006.15
1006.22
1006.26
1006.29
1006.3
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.28
1006.29
1006.29
1006.27
1006.3
1006.29
1006.25
1006.32
1006.33
1006.24
1006.3
1006.42
1006.33
1006.16
1006.19
1006.46
1006.62
1006.31
1005.69
1005.52
1006.41
1007.8
1008.32
1007.45
1006.14
1004.17
999.069
990.738
983.476
980.215
979.739
980.698
983.546
988.329
993.676
998.146
1001.23
1003.16
1004.32
1005.04
1005.5
1005.8
1006
1006.12
1006.2
1006.25
1006.28
1006.3
1006.3
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.28
1006.29
1006.28
1006.28
1006.3
1006.27
1006.28
1006.34
1006.3
1006.25
1006.33
1006.4
1006.3
1006.17
1006.24
1006.45
1006.48
1006.24
1006
1006
1006.19
1006.44
1007.11
1008.09
1007.37
1003.25
997.806
994.345
992.837
991.693
991.289
992.816
995.95
999.286
1001.85
1003.51
1004.52
1005.14
1005.55
1005.82
1005.99
1006.11
1006.19
1006.24
1006.27
1006.29
1006.3
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.28
1006.3
1006.29
1006.27
1006.3
1006.33
1006.28
1006.28
1006.36
1006.36
1006.26
1006.19
1006.26
1006.43
1006.52
1006.33
1005.87
1005.51
1005.89
1007.15
1007.97
1006.74
1004.02
1001.98
1000.9
999.386
997.59
997.131
998.54
1000.79
1002.77
1004.08
1004.86
1005.34
1005.65
1005.87
1006.01
1006.11
1006.18
1006.23
1006.26
1006.28
1006.3
1006.3
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.28
1006.28
1006.3
1006.29
1006.28
1006.31
1006.31
1006.29
1006.31
1006.34
1006.32
1006.26
1006.25
1006.34
1006.4
1006.25
1006
1006.04
1006.54
1006.89
1006.31
1005.15
1004.5
1004.28
1003.27
1001.48
1000.43
1000.97
1002.44
1003.83
1004.74
1005.26
1005.57
1005.78
1005.94
1006.05
1006.13
1006.19
1006.23
1006.26
1006.28
1006.29
1006.3
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.28
1006.29
1006.3
1006.29
1006.29
1006.31
1006.32
1006.3
1006.3
1006.32
1006.32
1006.31
1006.27
1006.2
1006.18
1006.35
1006.62
1006.6
1006.04
1005.44
1005.41
1005.58
1004.99
1003.68
1002.83
1003.12
1004.07
1004.93
1005.42
1005.65
1005.8
1005.91
1006.02
1006.1
1006.16
1006.2
1006.23
1006.25
1006.27
1006.29
1006.3
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.28
1006.29
1006.29
1006.29
1006.3
1006.31
1006.31
1006.3
1006.31
1006.33
1006.31
1006.25
1006.22
1006.33
1006.46
1006.38
1006.07
1005.91
1006.13
1006.33
1005.91
1005.06
1004.58
1004.84
1005.41
1005.81
1005.94
1005.96
1005.98
1006.03
1006.09
1006.15
1006.19
1006.22
1006.24
1006.26
1006.27
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.28
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.31
1006.32
1006.32
1006.3
1006.29
1006.29
1006.34
1006.35
1006.24
1006.1
1006.16
1006.42
1006.53
1006.22
1005.76
1005.63
1005.89
1006.18
1006.26
1006.18
1006.1
1006.08
1006.11
1006.15
1006.19
1006.22
1006.23
1006.25
1006.26
1006.27
1006.28
1006.29
1006.3
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.32
1006.31
1006.3
1006.31
1006.33
1006.32
1006.25
1006.2
1006.29
1006.43
1006.4
1006.18
1006.01
1006.09
1006.31
1006.41
1006.34
1006.21
1006.14
1006.14
1006.17
1006.2
1006.23
1006.24
1006.25
1006.26
1006.27
1006.27
1006.28
1006.29
1006.3
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.31
1006.31
1006.31
1006.32
1006.32
1006.31
1006.27
1006.28
1006.34
1006.37
1006.29
1006.16
1006.16
1006.28
1006.39
1006.37
1006.27
1006.19
1006.17
1006.2
1006.23
1006.25
1006.25
1006.26
1006.26
1006.27
1006.27
1006.28
1006.28
1006.29
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.32
1006.31
1006.3
1006.31
1006.33
1006.32
1006.26
1006.22
1006.27
1006.35
1006.36
1006.29
1006.22
1006.2
1006.23
1006.26
1006.27
1006.27
1006.27
1006.27
1006.27
1006.27
1006.28
1006.28
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.32
1006.32
1006.3
1006.28
1006.28
1006.32
1006.33
1006.3
1006.25
1006.23
1006.25
1006.28
1006.29
1006.29
1006.28
1006.28
1006.28
1006.28
1006.28
1006.28
1006.28
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.31
1006.32
1006.32
1006.31
1006.3
1006.31
1006.32
1006.31
1006.28
1006.27
1006.28
1006.3
1006.31
1006.3
1006.29
1006.28
1006.28
1006.28
1006.28
1006.28
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.32
1006.32
1006.3
1006.29
1006.3
1006.31
1006.31
1006.3
1006.29
1006.29
1006.28
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.32
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.31
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.3
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
1006.29
)
;
boundaryField
{
emptyPatches_empt
{
type empty;
}
top_cyc
{
type cyclic;
}
bottom_cyc
{
type cyclic;
}
inlet_cyc
{
type cyclic;
}
outlet_cyc
{
type cyclic;
}
}
// ************************************************************************* //
|
|
0c23f883f4d7048b1278f4f9c11515e2d68f1b31
|
6b2a8dd202fdce77c971c412717e305e1caaac51
|
/solutions_5634697451274240_0/C++/StarCuriosity/B.cpp
|
419f5d57ecb88d6ec03f4f506f1d464ddba37df4
|
[] |
no_license
|
alexandraback/datacollection
|
0bc67a9ace00abbc843f4912562f3a064992e0e9
|
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
|
refs/heads/master
| 2021-01-24T18:27:24.417992
| 2017-05-23T09:23:38
| 2017-05-23T09:23:38
| 84,313,442
| 2
| 4
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 807
|
cpp
|
B.cpp
|
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define FINAL_OUT(x) {cout << x << '\n'; exit(0);}
int func(const vector<int>& a)
{
int ans = 0;
for(int i = 1; i < a.size(); ++i)
if (a[i - 1] != a[i])
++ans;
if (a.back() == 1)
++ans;
return ans;
}
void solve(int numtest)
{
cout << "Case #" << numtest << ": ";
string s;
cin >> s;
vector<int> a;
for(char x : s)
a.push_back(x == '-');
cout << func(a) << '\n';
}
int main()
{
freopen("B-small.in", "r", stdin);
freopen("B-small.out", "w", stdout);
ios_base::sync_with_stdio(false);
int T;
cin >> T;
for(int i = 1; i <= T; ++i)
solve(i);
}
|
59668379f04bce7f46382c0356d0e65801bfe655
|
4bba092d23270856d469a78061d3ac2464365037
|
/raygame/goblin.h
|
6b844bf028b79c3ff7276d425400bd980478adb9
|
[] |
no_license
|
alyoshenka/AKGameJam
|
a0df9f7296a9f860342429815f8c9375e2db7bf4
|
05a286ff82822c15ece091a800a0e2744fbb16b3
|
refs/heads/master
| 2020-04-14T06:52:42.453130
| 2019-01-15T01:23:17
| 2019-01-15T01:23:17
| 163,697,863
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 435
|
h
|
goblin.h
|
#pragma once
#include "raylib.h"
#include "player.h"
struct goblin
{
private:
Vector2 pos;
Vector2 dest;
static const int animCnt = 4;
Texture2D idleAnim[animCnt];
Texture2D runAnim[animCnt];
int curFrame;
float frameTime;
float elapsedFrameTime;
bool isMoving;
float speed;
public:
goblin();
~goblin();
void update(player & p);
void draw();
void drawHealthBar();
int curHealth;
int maxHealth;
int attackP;
};
|
cbd2d6cf773c85a92b433ecfa812d51f4136c532
|
13740c1f486a513b1a45ca060add0455737a03f9
|
/cpp/sourcepoj/trie/h1075.cpp
|
08a0aa14297a2d60dc64a24ca0816307710d84b5
|
[] |
no_license
|
zxwtry/OJ
|
66b2bfd465f7875bc391ef6cd13fb615509d16ce
|
b6028e1afcce89e2214242033707d10dc814d14d
|
refs/heads/master
| 2021-04-22T11:54:36.455136
| 2020-09-30T15:02:24
| 2020-09-30T15:02:24
| 57,225,986
| 7
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,827
|
cpp
|
h1075.cpp
|
#include <bits/stdc++.h>
using namespace std;
// AC 577MS 120372K
const int NEXT_LEN = 26;
struct TrieNode {
char *replace;
int replaceLen;
struct TrieNode *next[NEXT_LEN];
TrieNode() {
replace = NULL;
replaceLen = 0;
memset(next, 0, sizeof(next));
}
};
void buildTrie(struct TrieNode *root, char *find, char *replace) {
int findLen = strlen(find);
int replaceLen = strlen(replace);
struct TrieNode *rootNow = root;
for (int findIndex = 0; findIndex < findLen; findIndex++) {
int nextIndex = find[findIndex] - 'a';
if (!rootNow->next[nextIndex]) {
rootNow->next[nextIndex] = new TrieNode();
}
rootNow = rootNow->next[nextIndex];
}
rootNow->replace = (char *)malloc(sizeof(char) * (replaceLen + 1));
strcpy_s(rootNow->replace, replaceLen + 1, replace);
}
void queryTrie(struct TrieNode *root, char *find) {
int findLen = strlen(find);
struct TrieNode *rootNow = root;
for (int findIndex = 0; findIndex < findLen; findIndex++) {
int nextIndex = find[findIndex] - 'a';
if (rootNow->next[nextIndex]) {
rootNow = rootNow->next[nextIndex];
} else {
printf("%s", find);
return;
}
}
if (rootNow->replace != NULL) {
printf("%s", rootNow->replace);
} else {
printf("%s", find);
}
}
bool checkCharNormal(char c) {
if (c >= 'a' && c <= 'z') {
return true;
}
return false;
}
const int LEN = 10000;
char findStr[LEN];
char replaceStr[LEN];
char END[] = "END";
int main() {
if (getenv("ZXWPC")) {
freopen("h1075.in", "r", stdin);
freopen("h1075.out", "w", stdout);
}
struct TrieNode *root = new TrieNode();
scanf("%s\n", findStr);
while (true) {
scanf("%s %s\n", replaceStr, findStr);
if (strcmp(replaceStr, END) == 0) {
break;
}
buildTrie(root, findStr, replaceStr);
}
int findLen;
while (true) {
cin.getline(findStr, LEN, '\n');
if (strcmp(findStr, END) == 0) {
break;
}
// 这里有了一行一行数据
int findIndex = 0;
int replaceIndex = 0;
char c;
while (true) {
c = findStr[findIndex++];
if (c == '\0') {
break;
}
if (!checkCharNormal(c)) {
replaceStr[replaceIndex++] = '\0';
queryTrie(root, replaceStr);
if (c != '\n')
printf("%c", c);
replaceIndex = 0;
continue;
}
replaceStr[replaceIndex++] = c;
}
replaceStr[replaceIndex++] = '\0';
queryTrie(root, replaceStr);
printf("\n");
}
}
|
a6e7eeb1f8cfd1afda13d418dc1bcb91ad0c9399
|
e650b749460a93f09c3174ebd180e5bb40ee7eb2
|
/firmware/esp8266_multinodes/node_modes.cpp
|
c6ee03b80813e479ba57e291e349d94f8a6893f7
|
[
"MIT"
] |
permissive
|
nodebotsau/internetoftents
|
c7b80207c007b291932b3c7f26233de9dd453ace
|
c6bfe2ef5e28051ec19a17195215e94b8a066ed8
|
refs/heads/master
| 2020-07-31T17:09:17.194267
| 2016-11-26T00:20:45
| 2016-11-26T00:20:45
| 73,594,673
| 4
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,003
|
cpp
|
node_modes.cpp
|
#include <Arduino.h>
#include <FS.h>
#include <stdio.h>
#include <ESP8266WebServer.h>
#include <PubSubClient.h>
#include <ESP_MQTTLogger.h>
#include "peripherals.h"
#include "noperipheral.h"
#include "temp_peripheral.h"
#include "baro_peripheral.h"
#include "dht_peripheral.h"
#include "servo_peripheral.h"
#include "pixel_peripheral.h"
#include "led_peripheral.h"
#include "./node_modes.h"
bool _state_config = false;
uint8_t _sleep_period = DEFAULT_SLEEP_MINS;
#define DEBUG true
// we use this to determine the minimum period between publish messages.
// This is so that if we're "always on" then we won't keep spamming the MQTT
// server with messages
#define MIN_PUBLISH_PERIOD (5 * 60 * 1000) // 5mins default
unsigned long _lastpublish = 0;
unsigned long _nextpublish = 0;
Peripheral * _vcc_sensor;
Peripheral * _device_peripheral;
MODES _mode = NONE;
void setup_node_peripherals(ESP_MQTTLogger& l) {
// here we take the mode and we set up the sensors we're going to be using.
#ifdef DEBUG
Serial.println("Setting up node peripherals");
Serial.print("Defined MODE is: ");
Serial.println(_mode);
#endif
_vcc_sensor = new NoPeripheral();
_vcc_sensor->begin(l);
// choose which mode we're in and set up peripheral appropriately.
switch (_mode) {
case NONE:
break;
case TEMP_1WIRE:
_device_peripheral = new TempPeripheral();
break;
case BARO:
_device_peripheral = new BaroPeripheral();
break;
case DHT:
_device_peripheral = new DHTPeripheral();
break;
case SERVO:
_device_peripheral = new ServoPeripheral();
break;
case PIXEL:
_device_peripheral = new PixelPeripheral();
break;
case LED:
_device_peripheral = new LedPeripheral();
break;
}
if (_mode > NONE) {
_device_peripheral->begin(l);
}
// As this is only called from the .ino initialiser we set this true
// here as it is possible that a set mode message has not arrived in time
// and we land in a race condition with the network. As such in setting this
// we explicitly state that our config is complete and if a mode change
// occurs after this point then we'll handle it as though it were a "live"
// mode change against the node
_state_config = true;
}
void publish_peripheral_data() {
// publish whatever the peripherals are.
// do a check on timing for publish
// we do a zero val check here to get a publish on wakeup.
if (millis() > _nextpublish) {
#ifdef DEBUG
Serial.println("Publishing peripheral data");
#endif
_vcc_sensor->publish_data();
if (_mode > NONE) {
_device_peripheral->publish_data();
}
_lastpublish = millis();
_nextpublish = _lastpublish + MIN_PUBLISH_PERIOD;
} else {
;
}
}
void update_peripheral() {
// we use this to update the peripherals state if we are able to.
if (_mode > NONE) {
if (_device_peripheral->updatable() ) {
_device_peripheral->update();
}
}
}
void subscription_handler(char* topic, byte* payload, unsigned int length) {
// handles the things around any subscription messages
//
String t = (String)topic;
// grab the data from the payload and get it in a form we can use it.
char buf[length + 1];
for (int i = 0; i < length; i++) {
buf[i] = (char)payload[i];
}
buf[length] = '\0';
String p = String(buf);
#ifdef DEBUG
Serial.print("Topic: ");
Serial.print(t);
Serial.print(" Payload: ");
Serial.println(p);
#endif
// handle the message
if (t.endsWith("sleep")) {
set_sleep_time(p.toInt());
} else if (t.endsWith("mode")) {
set_mode(p);
} else {
// it's not a config message so pass it out to the peripheral
if (_mode > NONE) {
_device_peripheral->sub_handler(t, p);
}
}
}
bool state_configured() {
return _state_config;
}
uint8_t get_sleep_time() {
return _sleep_period;
}
void set_sleep_time(uint8_t sleep) {
// here we set how long the system should hibernate for
_sleep_period = sleep;
// TODO Write to the file system.
}
MODES get_mode() {
return _mode;
}
void set_mode(String modename) {
MODES oldmode = _mode;
if (modename == "1wiretemp") {
_mode = TEMP_1WIRE;
} else if (modename == "baro") {
_mode = BARO;
} else if (modename == "dht") {
_mode = DHT;
} else if (modename == "servo") {
_mode = SERVO;
} else if (modename == "pixel") {
_mode = PIXEL;
} else if (modename == "led") {
_mode = LED;
} else {
_mode = NONE;
}
if (oldmode == _mode) {
return; // nothing to see here
}
if (! _state_config) {
_state_config = true;
} else {
// DEAL WITH A MODE CHANGE
// The best thing to do here is actually trigger a
// deep sleep reset as it will come back up in the different
// mode with all the appropriate objects set up etc.
#ifdef LIGHT_SLEEP
Serial.println(F("Mode reconfigure"));
#else
Serial.println(F("Mode reconfigure. Reset 1 sec"));
ESP.deepSleep(1 * 1000l * 1000l);
#endif
}
}
bool save_config(String filename, String value) {
// takes a filename and a string and writes it down.
File configFile = SPIFFS.open(filename, "w");
if (!configFile) {
Serial.println("Error saving to file system");
return false;
}
configFile.print(value);
return true;
}
String load_config(String filename) {
// loads a file and returns its contents
File configFile = SPIFFS.open(filename, "r");
if (configFile) {
return configFile.readString();
}
Serial.println("Error reading from file");
return "";
}
|
e459a536a46bb1e891865f4cb6b857ee0a24d67f
|
70424c4d8c75465ae9df8038d21aee274b603973
|
/factory/main.cpp
|
6c5380f582a6b27f920e87a3a905d39e82eb77a8
|
[] |
no_license
|
caifubing/study
|
528ace369264cefc9adb516ff0d1d50338fe562c
|
1e4042d4641fce12ecd7704be2411243f11b1054
|
refs/heads/master
| 2021-01-22T13:46:52.889859
| 2015-07-29T13:13:32
| 2015-07-29T13:13:32
| 35,789,668
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 310
|
cpp
|
main.cpp
|
#include <iostream>
#include "nypizzastore.h"
#include "nystylecheesepizza.h"
using namespace std;
int main()
{
shared_ptr<PizzaStore> ps = make_shared<NYPizzaStore>();
shared_ptr<Pizza> pizza = ps->orderPizza("cheese") ;
cout << "Ethan order a " << pizza->getName() << endl;
return 0;
}
|
ab2b6ecd4b29917b323207a36358618c66868ab2
|
aa690aad56f8fa5b95714f737b5ccdcf96aaede3
|
/AI Project/project2D/Sequence.h
|
ee9973665dc2a9e650c0303b8297acf45bd689c0
|
[
"MIT"
] |
permissive
|
RvBVakama/Artificial-Intelligence-Project
|
bc9cd103fd94fd0d19a9133dcf58d60951f22dde
|
36f54411a5379134d244841e8ee421fc12e648bc
|
refs/heads/master
| 2021-01-01T18:39:04.916797
| 2017-08-06T07:34:00
| 2017-08-06T07:34:00
| 98,390,174
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 829
|
h
|
Sequence.h
|
//--------------------------------------------------------------------------------------
// Class for the Sequence
//--------------------------------------------------------------------------------------
#pragma once
#include "Composite.h"
//--------------------------------------------------------------------------------------
// Sequence object
// Looks for all true return values and executes.
//--------------------------------------------------------------------------------------
class Sequence : public Composite
{
public:
EBehaviourResult Execute(Agent* pAgent, float fDeltaTime)
{
for (unsigned int i = 0; i < children.size(); ++i)
{
if (children[i]->Execute(pAgent, fDeltaTime) == EBEHAVIOUR_FAILURE)
{
return EBEHAVIOUR_FAILURE;
}
}
return EBEHAVIOUR_SUCCESS;
}
};
|
75d507cc91c7a30b980b71e56f6d58acae226a30
|
137ff7ec373ce8d14e559eba624d3e95599491b6
|
/Body.h
|
74afde0af8dcf8d08c700607184db964578fe39a
|
[] |
no_license
|
JonataSouzaC/myVensim
|
2f4afa3d064a0194ca1fa62287e7e8b00a261514
|
2a44b345027a7bd1c7f52d1087745dee526ad37e
|
refs/heads/master
| 2020-06-08T16:49:02.053831
| 2019-06-23T15:18:44
| 2019-06-23T15:18:44
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,019
|
h
|
Body.h
|
#pragma once
/**
* \brief
*
* The class Implementation was implemented based on the class teCounted writed by Ricardo Cartaxo
* and Gilberto Câmara and founded in the geographic library TerraLib.
*/
#include<iostream>
using namespace std;
class Body{
public:
/// Constructor: zero references when the object is being built
Body(): refCount_ ( 0 ){ }
/// Increases the number of references to this object
void attach () {
refCount_++; }
/// Decreases the number of references to this object.
/// Destroy it if there are no more references to it
void detach (){
refCount_--;
if ( refCount_ == 0 ) {
delete this;
}
}
/// Returns the number of references to this object
int refCount(){ return refCount_; }
/// Destructor
virtual ~Body(){}
private:
/// No copy allowed
Body(const Body&);
/// Implementation
Body& operator=(const Body&){return *this;}
int refCount_; /// the number of references to this class
};
|
e625a7f2d5db864f59851bc94b28443c1d8f5437
|
4a277b8452bdc0d290420e2646683055410992eb
|
/Plugins/SamplePM/Source/RasterUtils.cp
|
109139fd548a08ede5d033c7536cb105e80aed90
|
[] |
no_license
|
fruitsamples/Printer
|
34d1263e230323dd854d1158a06c04e9aa096fee
|
bd8e7055a65a10c121a107698a66ff70bc464f3a
|
refs/heads/master
| 2021-01-10T11:06:22.396451
| 2015-11-04T03:04:22
| 2015-11-04T03:04:22
| 45,437,654
| 0
| 0
| null | null | null | null |
ISO-8859-1
|
C++
| false
| false
| 47,191
|
cp
|
RasterUtils.cp
|
/*
IMPORTANT: This Apple software is supplied to you by Apple Computer,
Inc. ("Apple") in consideration of your agreement to the following terms,
and your use, installation, modification or redistribution of this Apple
software constitutes acceptance of these terms. If you do not agree with
these terms, please do not use, install, modify or redistribute this Apple
software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under AppleÍs copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following text
and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Computer,
Inc. may be used to endorse or promote products derived from the Apple
Software without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES
NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION
ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT
LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE. */
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
File: RasterUtils.cp
Contains: Implements internal utility routines for the Sample Raster Printer Module
Version: Technology: Tioga SDK
Release: 1.0
Copyright (C) 2000-2001, Apple Computer, Inc., all rights reserved.
Bugs?: For bug reports, consult the following page on
the World Wide Web:
http://developer.apple.com/bugreporter/
Change History:
To Do:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#include <stdio.h>
#include <dirent.h>
#include <ApplicationServices/ApplicationServices.h>
#include <PrintCore/PMPrinterModule.h>
#include <PrintCore/PMTicket.h>
#include <PrintCore/PMTemplate.h>
#include <PrintCore/PMRaster.h>
#include "RasterModule.h"
#include <unistd.h> // for sleep
OSErr AddPaperToList( PMTicketRef ourListTicket, SInt32 index, CFStringRef paperName, double pageLeft,
double pageTop, double pageRight, double pageBottom, double paperLeft,
double paperTop, double paperRight, double paperBottom );
#define DOCUSTOMPAPER 0
#define DUPLEXING_PRINTER 0
#if DOCUSTOMPAPER
static OSStatus addCustomPaperToTemplate(PMTemplateRef pmTemplate);
#endif
/*--------------------------------------------------------------------------------------------
Function: hpCreateIconData()
Description:
Opens Sample.icns file in Resources folder and returns its data to caller as CFDataRef.
Parameters:
cfIconData - Reference to the CFData where icon data is stored.
return value - OSStatus, contains errors if there were any.
History:
--------------------------------------------------------------------------------------------*/
OSStatus hpCreateIconData( CFDataRef *cfIconData)
{
OSStatus osStatus = noErr;
CFDataRef cfDataRef = NULL;
CFBundleRef bundleRef = NULL;
CFURLRef bundleUrl = NULL, resUrl = NULL;
CFStringRef bundlePath = NULL, resPath = NULL;
FILE *fileNum = NULL;
Ptr buffer = NULL;
char fullName[MAXNAMLEN];
UInt32 fileSize = 0;
// Get URLs for bundle folder and Resources folder
bundleRef = CFBundleGetBundleWithIdentifier( kRasterPMBundleID);
if (bundleRef != NULL)
{
bundleUrl = CFBundleCopyBundleURL( bundleRef);
resUrl = CFBundleCopyResourcesDirectoryURL( bundleRef);
}
// Convert to actual path names
if (bundleUrl != NULL && resUrl != NULL)
{
bundlePath = CFURLCopyFileSystemPath( bundleUrl, kCFURLPOSIXPathStyle);
resPath = CFURLCopyFileSystemPath( resUrl, kCFURLPOSIXPathStyle);
CFRelease( bundleUrl);
CFRelease( resUrl);
}
// Convert to C strings, append to make a full path name to the icon file.
if (bundlePath != NULL && resPath != NULL)
{
char resStr[MAXNAMLEN];
CFStringGetCString( bundlePath, fullName, MAXNAMLEN-1, kCFStringEncodingUTF8);
CFStringGetCString( resPath, resStr, MAXNAMLEN-1 , kCFStringEncodingUTF8);
CFRelease( bundlePath);
CFRelease( resPath);
strcat(fullName, "/");
strcat(fullName, resStr);
strcat(fullName, "/");
strcat(fullName, kRasterPMIconFileName);
// open icon file now
fileNum = fopen( fullName, "r");
if (fileNum == NULL)
osStatus = errno;
}
if (osStatus == noErr && fileNum != NULL)
{
// get file size, allocate a buffer of the same size, and read into it at once
osStatus = fseek( fileNum, 0, 2 ) ; // Seek to the end of the file.
if ( osStatus == noErr )
{
fileSize = ftell( fileNum ) ; // Find size
osStatus = fseek( fileNum, 0, 0 ) ; // Rewind.
buffer = (Ptr)malloc( fileSize);
if (buffer != NULL)
fileSize = (UInt32) fread( buffer, 1, (size_t) fileSize, fileNum);
else
osStatus = memFullErr;
}
fclose( fileNum);
}
// we read the data, now it is time to make a CFData out of it and pass it backup
if (osStatus == noErr && buffer != NULL)
{
cfDataRef = CFDataCreate( CFAllocatorGetDefault(), (const UInt8 *)buffer, fileSize);
if (cfIconData != NULL)
*cfIconData = cfDataRef;
else
osStatus = memFullErr;
free (buffer);
}
return osStatus;
}
/*--------------------------------------------------------------------------------------------
Function: hpCreateProfileDict()
Description:
Opens <Vendor-Model>.Profiles.xml file in Resources folder and returns its data to
caller as CFDictionaryRef.
The dictionary will contain key-value pairs for:
the default profile ID
an array of profile dictionaries - each of which will have:
the profile ID
the profile name
the profile URL
It will look something like this:
<dict>
<key>PMColorDeviceDefaultProfileID</key>
<integer>1</integer>
<key>PMColorDeviceProfiles</key>
<array>
<dict>
<key>PMColorDeviceProfileID</key>
<integer>1</integer>
<key>PMColorDeviceProfileName</key>
<string>Plain Paper</string>
<key>PMColorDeviceProfileURL</key>
<string>file://localhost/...path to profile</string>
</dict>
...more profile dicts
</array>
</dict>
Parameters:
pmProfileDict - ptr to CFDictionaryRef in which profile data is stored - REQUIRED
return value - OSStatus, contains errors if there were any.
History:
--------------------------------------------------------------------------------------------*/
OSStatus hpCreateProfileDict( CFDictionaryRef *pmProfileDict)
{
CFAllocatorRef allocator = CFAllocatorGetDefault();
CFDataRef dataRef = NULL;
CFBundleRef bundleRef = NULL;
CFURLRef bundleUrl = NULL;
CFURLRef resUrl = NULL;
CFURLRef plistUrl = NULL;
CFStringRef resPath = NULL;
CFStringRef bundlePath = NULL;
CFMutableStringRef bundleAndResPath = NULL;
OSStatus osStatus = noErr;
SInt32 errorCode = 0;
#define mCFRelease(cfo) if(NULL!=cfo){CFRelease(cfo);cfo=NULL;}
// First check then zero the return CFDictionaryRef param
if (pmProfileDict == NULL)
return (OSStatus) paramErr;
*pmProfileDict = NULL;
// Get URLs for bundle folder and Resources folder.
// The Bundle path will be a full path - from volume.
// The Resources path will be partial, relative to the Bundle.
//
bundleRef = CFBundleGetBundleWithIdentifier( kRasterPMBundleID);
if (bundleRef != NULL)
{
resUrl = CFBundleCopyResourcesDirectoryURL( bundleRef);
bundleUrl = CFBundleCopyBundleURL( bundleRef);
}
// Convert resource and Bundle URL to path component CFString
if (bundleUrl != NULL && resUrl != NULL)
{
resPath = CFURLCopyFileSystemPath( resUrl, kCFURLPOSIXPathStyle);
bundlePath = CFURLCopyFileSystemPath( bundleUrl, kCFURLPOSIXPathStyle);
// Release URLs
mCFRelease(resUrl);
mCFRelease(bundleUrl);
}
// Copy the bundlePath StringRef to a mutable StringRef - to append to it
if (bundlePath != NULL)
{
bundleAndResPath = CFStringCreateMutableCopy(allocator, 0, bundlePath);
mCFRelease(bundlePath);
}
// Combine StringRefs to get full path to resources dir
if (bundleAndResPath != NULL && resPath != NULL)
{
// Unfortunately, the resources path doesn't start with "/"
CFStringAppend(bundleAndResPath, CFSTR("/"));
CFStringAppend(bundleAndResPath, resPath);
mCFRelease(resPath);
}
// Now create the full URL
if (bundleAndResPath != NULL)
{
// The "base URL" needs to be provided - file://localhost
// otherwise CFURLCreateDataAndPropertiesFromResource
// returns kCFURLImproperArgumentsError.
//
resUrl = CFURLCreateWithString(allocator, bundleAndResPath,
CFURLCreateWithString(allocator, CFSTR("file://localhost"), NULL));
mCFRelease(bundleAndResPath);
}
// Append file name of plist to make a full path URL to the plist file.
if (resUrl != NULL)
{
plistUrl = CFURLCreateCopyAppendingPathComponent(allocator,
resUrl,
CFSTR(kRasterPMProfileListFileName),
false );
mCFRelease(resUrl);
}
//
// If there is no data in this file, we get nil back
// and an error code of -10: kCFURLUnknownError.
//
if (plistUrl != NULL)
{
CFURLCreateDataAndPropertiesFromResource (
allocator,
plistUrl,
&dataRef, // get file data here
NULL, // don't need properties
NULL, // no desired properties
&errorCode );
mCFRelease(plistUrl);
}
if (dataRef != NULL && errorCode == 0)
{
// Create a propertyList and pass it back.
// If empty return value, set errorCode
*pmProfileDict = (CFDictionaryRef)
CFPropertyListCreateFromXMLData (
allocator,
dataRef,
kCFPropertyListImmutable,
NULL );
mCFRelease(dataRef);
if (*pmProfileDict == NULL)
errorCode = kPMProfileDictLoadFailure;
}
else errorCode = kPMProfileDictNotFound;
// Release any locally allocated objects. We do this
// here to catch anything we might have missed above.
//
mCFRelease(dataRef);
mCFRelease(resPath);
mCFRelease(bundlePath);
mCFRelease(bundleAndResPath);
mCFRelease(resUrl);
mCFRelease(bundleUrl);
mCFRelease(plistUrl);
osStatus = (OSStatus) errorCode;
return osStatus;
}
/*--------------------------------------------------------------------------------------------
Function: hpCopyEntriesFromProfileDict()
Description:
Queries CFDictionaryRef for standard key-values.
Parameters:
pmProfileDict - CFDictionaryRef in which profile data is stored.
pmDefaultProfileID - SInt32* to be returned with the value found
pmProfileArray - CFArrayRef* to be returned with the value found
pmProfileCount - SInt32* to be returned with the CFArray count (of profiles)
pmProfileIDList - SInt32**
return value - OSStatus, contains errors if there were any.
History:
--------------------------------------------------------------------------------------------*/
OSStatus hpCopyEntriesFromProfileDict( CFDictionaryRef pmProfileDict,
SInt32* pmDefaultProfileID,
CFArrayRef* pmProfileArray,
SInt32* pmProfileCount,
SInt32** pmProfileIDList )
{
OSStatus osStatus = noErr;
CFDictionaryRef aProfileDict;
CFNumberRef aProfileID;
CFArrayRef profileArray;
SInt32 i, count, num;
SInt32* ourProfileIDList = NULL;
Boolean found = true;
// Ensure the passed dict exists
if (NULL == pmProfileDict)
osStatus = paramErr;
// Find the default profileID entry
if (noErr == osStatus)
{
found = CFDictionaryGetValueIfPresent ( pmProfileDict,
kPMColorDeviceDefaultProfileID,
(const void**) &aProfileID );
if (found && pmDefaultProfileID)
found = CFNumberGetValue(aProfileID, kCFNumberSInt32Type, pmDefaultProfileID);
if (!found) // Use specific error codes to track failures
osStatus = kPMProfileDictProfileIDFailure;
}
if (noErr == osStatus)
{
// Find the profile array entry
found = CFDictionaryGetValueIfPresent ( pmProfileDict,
kPMColorDeviceProfiles,
(const void**) &profileArray );
// If we got it, return the count.
if (found)
{
if (pmProfileArray)
*pmProfileArray = (CFArrayRef)CFRetain(profileArray); // hpCopyEntriesFromProfileDict needs to do a copy
count = (SInt32) CFArrayGetCount(profileArray);
if (pmProfileCount)
*pmProfileCount = count;
}
else // Error getting array of profiles
osStatus = kPMProfileDictProfileArrayFailure;
}
// Get the list of IDs from the profile dict - if asked for
if (noErr == osStatus && pmProfileIDList)
{
ourProfileIDList = (SInt32 *) malloc(count * sizeof(SInt32));
if (NULL != ourProfileIDList)
{
// Pass array back to caller
*pmProfileIDList = ourProfileIDList;
for (i = 0; i < count; i++)
{
// Clear the slot first
ourProfileIDList[i] = 0;
// Get the dictionary object from the array
aProfileDict = (CFDictionaryRef) CFArrayGetValueAtIndex(profileArray, (CFIndex) i);
if (NULL == aProfileDict)
found = false;
else
// Get the profile ID entry
found = CFDictionaryGetValueIfPresent ( aProfileDict,
kPMColorDeviceProfileID,
(const void**) &aProfileID );
// Store the ID if we got a value and it can be converted to SInt32
if (found && CFNumberGetValue(aProfileID, kCFNumberSInt32Type, &num))
ourProfileIDList[i] = num;
}
}
else // No memory for list
osStatus = memFullErr;
}
if (!found) // Error getting list of profileIDs
osStatus = kPMProfileDictProfileIDListFailure;
return osStatus;
}
/*--------------------------------------------------------------------------------------------
Function: hpCreatePrinterInfo()
Description:
Creates a new Printer Info ticket and returns it to the caller. This printer info ticket
supplies information about the printer's characteristics such as recommended application
drawing resolutions, device resolution, colors available, profiles, input and output
trays, etc. Unlike PMTemplates, PrinterInfo entries are not used in verifying job ticket
entries.
Parameters:
pmContext - our private context data so there can be multiple sessions going at once.
printerInfo - Pointer to ticket ref for our ticket once we've allocated it.
return value - OSStatus, contains errors if there were any.
History:
To Do:
--------------------------------------------------------------------------------------------*/
OSStatus hpCreatePrinterInfo(PMContext pmContext, PMTicketRef *printerInfo )
{
OSStatus result = noErr ;
CFMutableArrayRef tempFileArray = NULL ; // CFArray to hold our file type strings.
CFArrayRef ourProfiles = NULL; // CFArray of ColorSync profile dicts
CFDictionaryRef ourProfileDict = NULL; // Holds data on our profiles.
PMResolution ourRes[1] ; // Holds values before Template code gets them.
// Start by allocating a ticket to return and filling it from our array in our header file.
result = PMTicketCreate( CFAllocatorGetDefault(), kPMPrinterInfoTicket, printerInfo ) ;
// Set our printer long name (this string may be used in UI where we have lots of space)
if ( result == noErr )
result = PMTicketSetCFString( *printerInfo, kRasterPMBundleID, kPMPrinterLongNameKey,
kRasterPrinterLongName, kPMLocked) ;
// Set our printer short name (this string is used in UI where we have little space)
if ( result == noErr )
result = PMTicketSetCFString( *printerInfo, kRasterPMBundleID, kPMPrinterShortNameKey,
kRasterPrinterShortName, kPMLocked) ;
// Set our product name
if ( result == noErr )
result = PMTicketSetCFString( *printerInfo, kRasterPMBundleID, kPMMakeAndModelNameKey,
kRasterPrinterProductName, kPMLocked) ;
// Set color capability to true
if ( result == noErr )
result = PMTicketSetBoolean( *printerInfo, kRasterPMBundleID, kPMSupportsColorKey, true, kPMLocked);
// Set copies capability to false (our PM and printer are unable to do multi copies on its own)
if ( result == noErr )
result = PMTicketSetBoolean( *printerInfo, kRasterPMBundleID, kPMDoesCopiesKey, false, kPMLocked);
// Set copy collate capability to false (cannot do collation)
if ( result == noErr )
result = PMTicketSetBoolean( *printerInfo, kRasterPMBundleID, kPMDoesCopyCollateKey, false, kPMLocked);
// Set reverse order capability to false (cannot do reverse order printing)
if ( result == noErr )
result = PMTicketSetBoolean( *printerInfo, kRasterPMBundleID, kPMDoesReverseOrderKey, false, kPMLocked);
// Set supported file types
// We can handle two different types of input - deep raster data (RGB for now) and
// "already processed engine" data. This already processed data would be the result of a
// previous print job that went through this same module and printed to disk.
if ( result == noErr )
{
tempFileArray = CFArrayCreateMutable( CFAllocatorGetDefault(), NULL, &kCFTypeArrayCallBacks ) ;
if ( tempFileArray == NULL )
result = memFullErr ;
}
if ( result == noErr )
{
CFArrayAppendValue( tempFileArray, kPMDataFormatRaster ) ;
CFArrayAppendValue( tempFileArray, kPMDataFormat ) ;
result = PMTicketSetCFArray( *printerInfo, kRasterPMBundleID, kPMInputFileTypeListKey,
tempFileArray, kPMUnlocked ) ;
CFRelease( tempFileArray ) ;
}
// All printers are resolution independent now, in the same fashion that PostScript devices used to
// be. This is because Quartz takes care of any necessary scaling required to get from the application's
// drawing resolution to the resolution requested by the PM at conversion time.
// We start out with the suggested resolution for this printer - the resolution(s) you would most
// like to see the application drawing art and images with. This can be an array of discreete
// resolutions, but are just recommendations to the application. It will also be allowed to
// pick any resolution between the min and max given below.
if ( result == noErr )
{
ourRes[0].hRes = 300.0 ;
ourRes[0].vRes = 300.0 ;
result = PMTicketSetPMResolutionArray( *printerInfo, kRasterPMBundleID, kPMPrinterSuggestedResKey,
&ourRes[0], 1, false );
}
// Continue by setting the printer's minimum and maximum resolutions. We're suggesting reasonable
// values here, but you may wish to modify them. Keep in mind that the "default" drawing res for
// application is 72dpi.
if ( result == noErr )
{
ourRes[0].hRes = 25.0 ;
ourRes[0].vRes = 25.0 ;
result = PMTicketSetPMResolutionArray( *printerInfo, kRasterPMBundleID, kPMPrinterMinResKey,
&ourRes[0], 1, false );
}
if ( result == noErr )
{
ourRes[0].hRes = 2500.0 ;
ourRes[0].vRes = 2500.0 ;
result = PMTicketSetPMResolutionArray( *printerInfo, kRasterPMBundleID, kPMPrinterMaxResKey,
&ourRes[0], 1, false );
}
// Get a list of ColorSync profile info dictionaries.
if ( result == noErr )
result = hpCreateProfileDict( &ourProfileDict );
if ( result == noErr )
{
// Add the profile list to the printer info ticket
// Our list of profiles is defined as an array of CFDictionaries.
// The keys in each profile dictionary are:
//
// key value
// --- -----
// PMColorDeviceProfileID CFString (convert to number)
// PMColorDeviceProfileName CFString (for menus or other HI)
// PMColorDeviceProfileURL CFURL (complete location specifier for profile)
//
// Get the profile array only
result = hpCopyEntriesFromProfileDict( ourProfileDict, NULL, &ourProfiles, NULL, NULL);
CFRelease(ourProfileDict);
ourProfileDict = NULL;
// Make the profile array entry
if ( result == noErr ) {
result = PMTicketSetCFArray( *printerInfo, kRasterPMBundleID, kPMColorSyncProfilesKey, ourProfiles, kPMLocked);
CFRelease(ourProfiles);
ourProfiles = NULL;
}
}
else if ( result == kPMProfileDictNotFound )
result = noErr;
// Let go of the printerInfo if we had any trouble up to this point.
if ( result != noErr )
{
if ( *printerInfo != NULL )
PMTicketReleaseAndClear( printerInfo ) ;
}
return( result ) ;
}
/*--------------------------------------------------------------------------------------------
Function: AddPaperToList()
Description:
Adds a paper info ticket to the list of paper info tickets. This utility was created
simply to make the code easier to read and to facilitate testing by adding various
paper sizes quickly.
Parameters:
--------------------------------------------------------------------------------------------*/
OSErr AddPaperToList( PMTicketRef ourListTicket, SInt32 index, CFStringRef paperName, double pageLeft,
double pageTop, double pageRight, double pageBottom, double paperLeft,
double paperTop, double paperRight, double paperBottom )
{
OSErr result = noErr ;
PMTicketRef ourPaperTicket ;
PMRect tempRect ;
// Create a paper info ticket to store all this in.
result = PMTicketCreate( CFAllocatorGetDefault(), kPMPaperInfoTicket, &ourPaperTicket ) ;
if ( result == noErr )
result = PMTicketSetCFString( ourPaperTicket, kRasterPMBundleID, kPMPaperNameKey, paperName, kPMLocked ) ;
tempRect.top = paperTop ;
tempRect.left = paperLeft ;
tempRect.bottom = paperBottom ;
tempRect.right = paperRight ;
if ( result == noErr )
result = PMTicketSetPMRect( ourPaperTicket, kRasterPMBundleID, kPMUnadjustedPaperRectKey, &tempRect, kPMLocked ) ;
tempRect.top = pageTop ;
tempRect.left = pageLeft ;
tempRect.bottom = pageBottom ;
tempRect.right = pageRight ;
if ( result == noErr )
result = PMTicketSetPMRect( ourPaperTicket, kRasterPMBundleID, kPMUnadjustedPageRectKey, &tempRect, kPMLocked ) ;
if ( result == noErr )
result = PMTicketSetTicket( ourListTicket, ourPaperTicket, index ) ;
if ( ourPaperTicket != NULL )
PMTicketReleaseAndClear( &ourPaperTicket ) ;
return ( result ) ;
}
/*!
* @function addDuplexValue
* @abstract Convert the provided value to a CFNumber and add it to the provided
* array.
*/
static OSStatus addDuplexValue(CFMutableArrayRef duplexArray, SInt32 duplexValue)
{
OSStatus err = noErr;
CFNumberRef duplexRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &duplexValue);
if (duplexRef != NULL) {
CFArrayAppendValue(duplexArray, duplexRef);
CFRelease(duplexRef);
duplexRef = NULL;
} else {
err = memFullErr;
}
return err;
}
/*--------------------------------------------------------------------------------------------
Function: addDuplexToTemplate()
Description:
Adds duplexing information to a job template.
Parameters:
templateTicket - the template ticket to add to.
canDuplexNoTumble - A boolean indicating whether the printer can duplexNoTumble without
any intervention from the operating system.
canDuplexTumble - A boolean indicating whether the printer can duplexTumble without
any intervention from the operating system.
requiresDifferentMarginsForOSFlippedSide2 - a boolean indicating whether the OS should
adjust the raster for the bottom margin rather than the top margin.
haveOurOwnPDE - a boolean indicating whether we have our own custom PDE to handle
the duplex layout. If true the printing system will not do its
own duplex UI.
return value - OSStatus, contains errors if there were any.
History:
--------------------------------------------------------------------------------------------*/
static OSStatus addDuplexToTemplate(PMTemplateRef templateTicket, Boolean canDuplexNoTumble,
Boolean canDuplexTumble, Boolean requiresDifferentMarginsForOSFlippedSide2,
Boolean haveOurOwnPDE)
{
CFMutableArrayRef duplexArray = NULL;
OSStatus err = noErr;
duplexArray = CFArrayCreateMutable(kCFAllocatorDefault, 0 /* capacity */, &kCFTypeArrayCallBacks);
if (duplexArray != NULL) {
/* If the local host states the printer can do duplex, then we'll enable simplex,
* duplex, and duplex tumble. As long as the printer can duplex, we can flip the
* page images to get the correct tumble state.
*/
err = addDuplexValue(duplexArray, kPMDuplexNone);
if (!err && canDuplexNoTumble) err = addDuplexValue(duplexArray, kPMDuplexNoTumble);
if (!err && canDuplexTumble) err = addDuplexValue(duplexArray, kPMDuplexTumble);
/* Create the duplex template entry.
*/
if (!err) err = PMTemplateMakeEntry(templateTicket, kPMDuplexingKey, kPMValueSInt32, kPMConstraintList);
/* Set the list of duplex options.
*/
if (!err) err = PMTemplateSetCFArrayConstraintValue(templateTicket, kPMDuplexingKey, duplexArray);
/* The default is duplex off.
*/
if (!err) err = PMTemplateSetSInt32DefaultValue(templateTicket, kPMDuplexingKey, kPMDuplexNone);
#ifdef kPMDuplexingRequiresFlippedMarginAdjustKey // need to build with updated headers to add this entry
if(!err){
err = PMTemplateMakeEntry( templateTicket, kPMDuplexingRequiresFlippedMarginAdjustKey,
kPMValueBoolean, kPMConstraintList) ;
if (!err)
err = PMTemplateSetBooleanDefaultValue( templateTicket, kPMDuplexingRequiresFlippedMarginAdjustKey,
requiresDifferentMarginsForOSFlippedSide2) ;
}
#endif
#ifdef kPMHasCustomDuplexPDEKey
if(!err){
err = PMTemplateMakeEntry( templateTicket, kPMHasCustomDuplexPDEKey,
kPMValueBoolean, kPMConstraintList) ;
if (!err)
err = PMTemplateSetBooleanDefaultValue( templateTicket, kPMHasCustomDuplexPDEKey,
haveOurOwnPDE) ;
}
#endif
CFRelease(duplexArray);
duplexArray = NULL;
}
return noErr;
}
/*--------------------------------------------------------------------------------------------
Function: hpCreatePMTemplate()
Description:
Creates Job Template and returns it to the caller. This job template describes the
range of possible settings for this Printer module.
Parameters:
pmContext - our private context data so there can be multiple sessions going at once.
pmTemplate - Pointer to ticket ref for the template we must return.
return value - OSStatus, contains errors if there were any.
History:
--------------------------------------------------------------------------------------------*/
OSStatus hpCreatePMTemplate(PMContext pmContext, PMTemplateRef *pmTemplate)
{
OSStatus result = noErr ;
CFDictionaryRef ourProfileDict = NULL; // Holds data on our profiles.
SInt32 ourDefaultProfileID; // ID of default profile
SInt32 ourProfileCount; // Count of profiles
SInt32* ourProfileIDList = NULL; // List of profile IDs
PMTemplateRef ourTemplate ; // The template we're building up.
SInt32 ourSInt32s[4] ; // Holding place on the way to template call.
PMTicketRef ourPaperInfoTicket = NULL; // Place to store a paper info ticket
PMTicketRef ourListTicket = NULL ; // Holds the entire series of Paper Info Tickets
// Make a template to fill
result = PMTemplateCreate( &ourTemplate ) ;
// Start by setting up the color modes.
if ( result == noErr )
result = PMTemplateMakeEntry( ourTemplate, kPMColorModeKey, kPMValueSInt32,
kPMConstraintList ) ;
// Set the default color mode to color.
if ( result == noErr )
result = PMTemplateSetSInt32DefaultValue( ourTemplate, kPMColorModeKey,
kPMColor ) ;
// We allow B/W, Grayscale, and Color.
ourSInt32s[0] = kPMBlackAndWhite ;
ourSInt32s[1] = kPMGray ;
ourSInt32s[2] = kPMColor ;
if ( result == noErr )
result = PMTemplateSetSInt32ListConstraint( ourTemplate, kPMColorModeKey, 3, &ourSInt32s[0] ) ;
#ifdef kPMColorSpaceModelKey // need to build with updated headers to add this entry
if(result == noErr){
// We allow only RGB.
PMColorSpaceModel ourSupportedColorSpaceModels[1] = {kPMRGBColorSpaceModel};
result = PMTemplateMakeEntry( ourTemplate, kPMColorSpaceModelKey, kPMValueSInt32,
kPMConstraintList ) ;
// Our default color space model is kPMRGBColorSpaceModel.
if ( result == noErr )
result = PMTemplateSetSInt32DefaultValue( ourTemplate, kPMColorSpaceModelKey, kPMRGBColorSpaceModel ) ;
if ( result == noErr )
result = PMTemplateSetSInt32ListConstraint( ourTemplate, kPMColorSpaceModelKey,
sizeof(ourSupportedColorSpaceModels)/sizeof(PMColorSpaceModel),
(SInt32 *)&ourSupportedColorSpaceModels[0] ) ;
}
#endif
// Set up quality modes - we allow draft, normal, and best modes, with draft as the default.
if ( result == noErr )
result = PMTemplateMakeEntry( ourTemplate, kPMQualityKey, kPMValueSInt32, kPMConstraintList ) ;
if ( result == noErr )
result = PMTemplateSetSInt32DefaultValue( ourTemplate, kPMQualityKey, kPMQualityDraft ) ;
ourSInt32s[0] = kPMQualityDraft ;
ourSInt32s[1] = kPMQualityNormal ;
ourSInt32s[2] = kPMQualityBest ;
if ( result == noErr )
result = PMTemplateSetSInt32ListConstraint( ourTemplate, kPMQualityKey, 3, &ourSInt32s[0] ) ;
// ColorSync Matching Intent key was removed
#if OLD
// Setup color matching intent
if ( result == noErr )
result = PMTemplateMakeEntry( ourTemplate, kPMColorSyncIntentKey, kPMValueSInt32, kPMConstraintList ) ;
if ( result == noErr )
result = PMTemplateSetSInt32DefaultValue( ourTemplate, kPMColorSyncIntentKey, kPMColorIntentAutomatic ) ;
ourSInt32s[0] = kPMColorIntentAutomatic ;
ourSInt32s[1] = kPMColorIntentPhoto ;
ourSInt32s[2] = kPMColorIntentBusiness ;
if ( result == noErr )
result = PMTemplateSetSInt32ListConstraint( ourTemplate, kPMColorSyncIntentKey, 3, &ourSInt32s[0] ) ;
#endif
#if DUPLEXING_PRINTER
if(!result){
/*
These settings match the HP Deskjet 970 (and similar) duplexing printers. Specifically: this printer
feeds the second side of a sheet with the leading edge of the edge that was the bottom of the sheet
when the first side was fed. This means that printer always "tumbles" the sheet when printing duplex.
Because this printer cannot do duplexNoTumble without operating system intervention, we so indicate
here. For this specific configuration the OS will flip the coordinate system when generating duplexNoTumble
to compensate for the fact that the printer can only produce tumbled output.
The requiresDifferentMarginsForOSFlippedSide2 indicates whether we wish to have the raster supplied to us
for the second sheet adjusted when the OS must flip the coordinate system to achieve the resulting duplex request.
For our case here by setting this to true, we are saying we want the raster supplied to us for side 2 to BEGIN
at a distance from the top of the sheet equivalent to the BOTTOM margin of the imageable area of the paper rather
than at the TOP margin of the imageable area of the paper as it normally would be.
The haveOurOwnPDE value reflects whether we have our own PDE for allowing the user to handle 2 sided printing. Apple strongly
recommends that you use the standard system UI for this purpose but if you provide your own UI you should set this
true so that the printing system does not present its own UI.
*/
Boolean printerCanDuplexNoTumble = false;
Boolean printerCanDuplexTumble = true;
Boolean requiresDifferentMarginsForOSFlippedSide2 = true;
Boolean haveOurOwnPDE = false;
result = addDuplexToTemplate(ourTemplate, printerCanDuplexNoTumble, printerCanDuplexTumble,
requiresDifferentMarginsForOSFlippedSide2, haveOurOwnPDE);
}
#endif
#ifdef kPMDefaultReverseOutputOrderKey
/*
This entry tells the printing system what order the default output paper tray stacks the paper. Specifying a value
of true for the default value of this template entry tells the printing system that the printer stacks the paper in reverse
order (N, N-1, ..., 2, 1). Specifying a value of false for the default value of this template entry tells the printing system that
the printer stacks the paper in Normal order (1, 2, ... N-1, N). The printing system uses this information to determine
the appropriate initial default value for reverse order printing for this printer.
*/
if(!result){
Boolean printerStacksOutputInReverseOrder = true; // This entry is printer model dependent. Change appropriately for your printer model.
result = PMTemplateMakeEntry( ourTemplate, kPMDefaultReverseOutputOrderKey, kPMValueBoolean, kPMConstraintList) ;
if (!result)
result = PMTemplateSetBooleanDefaultValue( ourTemplate, kPMDefaultReverseOutputOrderKey, printerStacksOutputInReverseOrder) ;
}
#endif
// Paper Sources. We allow only the standard input tray for now.
if ( result == noErr )
result = PMTemplateMakeEntry( ourTemplate, kPMPaperSourceKey, kPMValueSInt32, kPMConstraintList ) ;
if ( result == noErr )
result = PMTemplateSetSInt32DefaultValue( ourTemplate, kPMPaperSourceKey, 1 ) ;
ourSInt32s[0] = 1 ;
if ( result == noErr )
result = PMTemplateSetSInt32ListConstraint( ourTemplate, kPMPaperSourceKey, 1, &ourSInt32s[0] ) ;
// Get a list of ColorSync profile info dictionaries.
if ( result == noErr )
result = hpCreateProfileDict( &ourProfileDict );
if ( result == noErr )
{
// Get the default profile ID, a count of profiles (IDs), and a list of profile IDs
result = hpCopyEntriesFromProfileDict( ourProfileDict, &ourDefaultProfileID,
NULL, &ourProfileCount, &ourProfileIDList);
CFRelease(ourProfileDict);
ourProfileDict = NULL;
// Set the default profile ID and its constraint list
if ( result == noErr )
result = PMTemplateMakeEntry( ourTemplate, kPMColorSyncProfileIDKey,
kPMValueSInt32, kPMConstraintList ) ;
if ( result == noErr )
result = PMTemplateSetSInt32DefaultValue( ourTemplate, kPMColorSyncProfileIDKey,
ourDefaultProfileID ) ;
if ( result == noErr )
result = PMTemplateSetSInt32ListConstraint( ourTemplate, kPMColorSyncProfileIDKey,
ourProfileCount, ourProfileIDList ) ;
// Free the list if it was allocated (by hpCopyEntriesFromProfileDict)
if (ourProfileIDList != NULL)
free (ourProfileIDList);
}
else if ( result == kPMProfileDictNotFound )
result = noErr;
// Paper sizes: we'll support letter, legal, A4, B5, and a vendor specific size.
// Paper sizes are now localized using the localizable.strings file under the print
// framework. Please see the constants defined in PMPrinterModule.h for all currently
// standard paper names.
if ( result == noErr )
result = PMTemplateMakeEntry( ourTemplate, kPMPaperInfoList, kPMValueTicket,
kPMConstraintList ) ;
// Create the list ticket of papers.
if ( result == noErr )
result = PMTicketCreate( CFAllocatorGetDefault(), kPMTicketList, &ourListTicket ) ;
// If we were able to create a paper info, then fill it with the values needed to define the
// letter size paper. This will be our default paper size for the PSPM.
if ( result == noErr )
result = AddPaperToList( ourListTicket, 1, USLetter, 0.0, 0.0, 576., 756., -18., -18., 594., 774. ) ;
// Need to add the first paper as the default paper.
if ( result == noErr )
result = PMTicketGetTicket( ourListTicket, kPMPaperInfoTicket, 1, &ourPaperInfoTicket ) ;
if ( result == noErr )
result = PMTemplateSetPMTicketDefaultValue( ourTemplate, kPMPaperInfoList, ourPaperInfoTicket ) ;
// Continue to add papers to the template.
if ( result == noErr )
result = AddPaperToList( ourListTicket, 2, USLegal, 0.0, 0.0, 576., 972., -18., -18., 594., 990. ) ;
if ( result == noErr )
result = AddPaperToList( ourListTicket, 3, A4, 0.0, 0.0, 595., 842., -18., -18., 613., 860. ) ;
if ( result == noErr )
result = AddPaperToList( ourListTicket, 4, B5, 0.0, 0.0, 516., 728., -18., -18., 534., 746. ) ;
if ( result == noErr )
result = AddPaperToList( ourListTicket, 5, CFSTR("HPPOSTCARD"), 0.0, 0.0, 360., 288., -18., -18., 378., 306. ) ;
// Ok, we have our paper sizes stored as tickets in our list ticket. From here, we
// can save this list ticket as the constraint for Paper Info.
if ( result == noErr )
result = PMTemplateSetPMTicketListConstraint( ourTemplate, kPMPaperInfoList, ourListTicket ) ;
if ( result == noErr )
result = PMTicketReleaseAndClear( &ourListTicket ) ;
#if DOCUSTOMPAPER
if( result == noErr){
result = addCustomPaperToTemplate(ourTemplate);
}
#endif
// For now, we return the template as far as we have it.
if ( result == noErr )
*pmTemplate = ourTemplate ;
else
PMTemplateDelete( &ourTemplate ) ;
return( result ) ;
}
#if DOCUSTOMPAPER
/*
For this example we are claiming support for custom paper size for widths of
2 to 11 inches and heights from 2 to 17 inches. The margins that are imposed on
each custom size are 18 points on the top and bottom and 9 points on the
left and right side.
*/
static OSStatus addCustomPaperToTemplate(PMTemplateRef pmTemplate)
{
OSStatus err = noErr;
PMRect marginRect;
double minWidth, maxWidth, minHeight, maxHeight;
// NOTE: these must all be POSITIVE values, i.e. these are absolute distances
marginRect.top = 18; // required hardware margin for top edge in points
marginRect.bottom = 18; // required hardware margin for bottom edge in points
marginRect.left = 9; // required hardware margin for left edge in points
marginRect.right = 9; // required hardware margin for right edge in points
minWidth = 2*72; // minimum paper width in points
maxWidth = 11*72; // maximum paper width in points
minHeight = 2*72; // minimum paper height in points
maxHeight = 17*72; // maximum paper height in points
// make entry for width of custom page size
if(!err)
err = PMTemplateMakeEntry( pmTemplate, kPMCustomPageWidthKey, kPMValueDouble, kPMConstraintRange);
if (!err)
err = PMTemplateSetDoubleRangeConstraint( pmTemplate, kPMCustomPageWidthKey, minWidth, maxWidth);
// make entry for height of custom page size
if(!err)
err = PMTemplateMakeEntry( pmTemplate, kPMCustomPageHeightKey, kPMValueDouble, kPMConstraintRange);
if (!err)
err = PMTemplateSetDoubleRangeConstraint( pmTemplate, kPMCustomPageHeightKey, minHeight, maxHeight);
// make entry for margins
if(!err)
err = PMTemplateMakeEntry( pmTemplate, kPMCustomPageMarginsKey, kPMValuePMRect, kPMConstraintPrivate);
if(!err)
err = PMTemplateSetPMRectDefaultValue (pmTemplate, kPMCustomPageMarginsKey, &marginRect);
return err;
}
#endif
/*****************************************************************************
Name: hpCreateConverterSetup
Setup raster converter with resolution, banding, color format information.
Uses the JobTicket to determine the right converterSetup settings.
Parameters:
jobTicket - The control parameters for this job, as defined by the application and user.
paperType - Type of paper we are printing on to; it might effect converterSetup.
quality - Print quality impacts converter setup.
profileID - ID of default profile, to be verified and put in converter settings.
converterSetup - Ticket that holds the converter settings.
return value - OSStatus, contains errors if there were any.
Description:
History:
*****************************************************************************/
OSStatus hpCreateConverterSetup ( PMTicketRef jobTicket, SInt32 paperType, SInt32 quality, SInt32 profileID,
PMTicketRef *converterSetup)
{
OSStatus osStatus = noErr;
float xResolution, yResolution;
PMTicketRef converterSetupTicket=NULL;
if( converterSetup == NULL)
osStatus = kPMInvalidTicket;
// Create the ConverterSetup ticket
if (osStatus == noErr)
osStatus = PMTicketCreate(CFAllocatorGetDefault(), kPMConverterSetupTicket, &converterSetupTicket);
if (quality == kPMQualityBest)
xResolution = yResolution = kBestResolution;
else if (quality == kPMQualityNormal)
xResolution = yResolution = kNormalResolution;
else
xResolution = yResolution = kDraftResolution;
// Set resolution based on print quality mode as set by our PDE.
if( osStatus == noErr && converterSetupTicket != NULL)
{
osStatus = PMTicketSetDouble( converterSetupTicket, kRasterPMBundleID,
kPMConverterResHorizontalKey, xResolution, kPMLocked);
osStatus = PMTicketSetDouble( converterSetupTicket, kRasterPMBundleID,
kPMConverterResVerticalKey, yResolution, kPMLocked);
}
// Set banding & band height:
if( osStatus == noErr && converterSetupTicket != NULL)
{
osStatus = PMTicketSetBoolean( converterSetupTicket, kRasterPMBundleID,
kPMBandingRequestedKey, true, kPMLocked);
osStatus = PMTicketSetSInt32 ( converterSetupTicket, kRasterPMBundleID,
kPMRequiredBandHeightKey, kDraftQualityBandSize, kPMLocked );
}
// Set Pixel format and layout.
if( osStatus == noErr && converterSetupTicket != NULL)
{
osStatus = PMTicketSetSInt32( converterSetupTicket, kRasterPMBundleID,
kPMRequestedPixelFormatKey, kPMXRGB_32, kPMLocked );
osStatus = PMTicketSetSInt32( converterSetupTicket, kRasterPMBundleID,
kPMRequestedPixelLayoutKey, kPMDataChunky, kPMLocked );
}
// Set ColorSync Profile ID.
// Here is where the PM can override the setting passed in, which is based
// on defaults. The profile ID that we store in the converterSetupTicket
// is the one that will actually be used when doing color matching.
//
if( osStatus == noErr && converterSetupTicket != NULL)
{
osStatus = hpVerifyColorSyncProfileID(jobTicket, paperType, quality, &profileID);
if (osStatus == noErr && profileID != 0)
osStatus = PMTicketSetSInt32( converterSetupTicket, kRasterPMBundleID,
kPMCVColorSyncProfileIDKey, profileID, kPMLocked );
}
// Set the passed argument to our converterSetup ticket just created
if( osStatus == noErr)
*converterSetup = converterSetupTicket;
else
{
if (converterSetupTicket != NULL)
PMTicketReleaseAndClear( &converterSetupTicket);
*converterSetup = NULL;
}
return osStatus;
}
/*****************************************************************************
Name: hpVerifyColorSyncProfileID
The printer module "knows" which is the correct profile ID to use based
on the other job settings. The profile ID that is passed in may need
to be reset to the proper one - hence a pointer to it is passed in.
Parameters:
jobTicket - The control parameters for this job, as defined by the application and user.
paperType - Type of paper we are printing on impacts ColorSync Profile Selection.
quality - Print quality impacts ColorSync Profile Selection.
profileID - Ptr to ID of default profile, to be changed if need be.
return value - OSStatus, contains errors if there were any.
Description:
History:
*****************************************************************************/
OSStatus hpVerifyColorSyncProfileID ( PMTicketRef jobTicket, SInt32 paperType, SInt32 quality, SInt32 *profileID )
{
OSStatus osStatus = noErr;
/*
The value of *profileID passed in is that obtained from the print settings or is 0 if it could not be
obtained from the print settings. The only reason we would override the value in the print settings
is if it didn't make sense for this print job.
This routine should, based on the job ticket and other data passed in, determine which profileID
should be used to handle this print job. If the data in the jobTicket that we would normally use
to determine which profile to use is not available we should handle that gracefully and
set profileID to an appropriate default.
In all cases we should make sure that the profileID we return is valid for our printer. Since
this sample code only registers one profile (with ID = 1) we always update the profileID passed
in to point to our profile.
*/
*profileID = 1; // this is the only profile ID we've registered in our sample PM
return osStatus;
}
|
406738ae0d3981d824230d64e171f6a6676ddc37
|
089c787f663a7e98f54cea93af60534276363934
|
/Algorithm/Recursion/P19.cpp
|
b45276520f0ec7f6430b64e0fd58132c629c3b77
|
[] |
no_license
|
delower-hosen/Competitive-Programming
|
a723e6b4bccdb62b22be5794781b0c4319c86cc4
|
79869ffe451234f0feb00be10176b7de7fa3632f
|
refs/heads/master
| 2022-12-16T00:09:37.866203
| 2020-09-13T18:42:06
| 2020-09-13T18:42:06
| 295,212,924
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 828
|
cpp
|
P19.cpp
|
#include<bits/stdc++.h>
using namespace std;
void preorder(int n){
if(n==1 or n==2){
printf(" %d",n);
return;
}
printf(" %d",n);
preorder(n-2);
preorder(n-1);
}
void inorder(int n){
if(n==1 or n==2){
printf(" %d",n);
return;
}
inorder(n-2);
printf(" %d",n);
inorder(n-1);
}
void postorder(int n){
if(n==1 or n==2){
printf(" %d",n);
return;
}
postorder(n-2);
postorder(n-1);
printf(" %d",n);
}
int main()
{
int n;
scanf("%d",&n);
printf("Preorder: "); //printing sequence root->left->right
preorder(n);
printf("\nInorder: "); //printing sequence left->root->right
inorder(n);
printf("\nPostorder: "); //printing sequence left->right->root
postorder(n);
printf("\n");
return 0;
}
|
4bea3046f1d26fb862a7b4f5cff4969d204814b6
|
70fe255d0a301952a023be5e1c1fefd062d1e804
|
/LeetCode/LCP 07.cpp
|
d7e89485edae25835e3f80852f75eddf6a4d2158
|
[
"MIT"
] |
permissive
|
LauZyHou/Algorithm-To-Practice
|
524d4318032467a975cf548d0c824098d63cca59
|
66c047fe68409c73a077eae561cf82b081cf8e45
|
refs/heads/master
| 2021-06-18T01:48:43.378355
| 2021-01-27T14:44:14
| 2021-01-27T14:44:14
| 147,997,740
| 8
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 319
|
cpp
|
LCP 07.cpp
|
class Solution {
public:
int numWays(int n, vector<vector<int>>& relation, int k) {
vector<vector<int>> f(k + 1, vector<int>(n));
f[0][0] = 1;
for (int i = 0; i < k; i ++ )
for (auto& p: relation)
f[i + 1][p[1]] += f[i][p[0]];
return f[k][n - 1];
}
};
|
a24c72debde0b3b93335800aae17566e93276d9c
|
6f541233ccdd1d5d256624da6e69a88ec90f404d
|
/src/Common.h
|
394e70f24910b9301196d682a80a0e2203fa46ad
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
mfkiwl/HDRView
|
5cd5009c055e895e4d1c33cd9a2a225e343b67ab
|
b5f68a51cd7afaf3cb066ed94b3ebcf947116b33
|
refs/heads/master
| 2023-07-09T21:15:33.201353
| 2021-08-13T17:48:43
| 2021-08-13T17:48:43
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 9,317
|
h
|
Common.h
|
//
// Copyright (C) Wojciech Jarosz <wjarosz@gmail.com>. All rights reserved.
// Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE.txt file.
//
#pragma once
#if defined(_MSC_VER)
// Make MS cmath define M_PI
#define _USE_MATH_DEFINES
#endif
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <memory>
#include "Fwd.h"
// Also define control key for windows/mac/linux
#if defined(__APPLE__) || defined(DOXYGEN_DOCUMENTATION_BUILD)
/// If on OSX, maps to ``GLFW_MOD_CONTROL``. Otherwise, maps to ``GLFW_MOD_SUPER``.
#define SYSTEM_CONTROL_MOD GLFW_MOD_CONTROL
#else
#define SYSTEM_CONTROL_MOD GLFW_MOD_SUPER
#endif
template <typename T>
inline T sign(T a) {return (a > 0) ? T (1) : (a < 0) ? T (-1) : 0;}
/*!
* @brief Clamps a double between two bounds.
*
* This function has been specially crafted to prevent NaNs from propagating.
*
* @param a The value to clamp.
* @param l The lower bound.
* @param h The upper bound.
* @return The value \a a clamped to the lower and upper bounds.
*/
template <typename T>
inline T clamp(T a, T l, T h)
{
return (a >= l) ? ((a <= h) ? a : h) : l;
}
template <typename T>
inline T clamp01(T a)
{
return clamp(a, T(0), T(1));
}
/*!
* @brief Linear interpolation.
*
* Linearly interpolates between \a a and \a b, using parameter t.
*
* @param a A value.
* @param b Another value.
* @param t A blending factor of \a a and \a b.
* @return Linear interpolation of \a a and \b -
* a value between a and b if \a t is between 0 and 1.
*/
template <typename T, typename S>
inline T lerp(T a, T b, S t)
{
return T((S(1)-t) * a + t * b);
}
/*!
* @brief Inverse linear interpolation.
*
* Given three values \a a, \a b, \a m, determines the parameter value
* \a t, such that m = lerp(a,b,lerpFactor(a,b,m))
*
* @param a The start point
* @param b The end point
* @param m A third point (typically between \a a and \a b)
* @return The interpolation factor \a t such that m = lerp(a,b,lerpFactor(a,b,m))
*/
template <typename T>
inline T lerpFactor(T a, T b, T m)
{
return (m - a) / (b - a);
}
/*!
* @brief Smoothly interpolates between 0 and 1 as x moves between a and b.
*
* Does a smooth s-curve (Hermite) interpolation between two values.
*
* @param a A value.
* @param b Another value.
* @param x A number between \a a and \a b.
* @return A value between 0.0 and 1.0.
*/
template <typename T>
inline T smoothStep(T a, T b, T x)
{
T t = clamp(lerpFactor(a,b,x), T(0), T(1));
return t*t*(T(3) - T(2)*t);
}
/*!
* @brief Smoothly interpolates between 0 and 1 as x moves between a and b.
*
* Does a smooth s-curve interpolation between two values using the
* 6th-order polynomial proposed by Perlin.
*
* @param a A value.
* @param b Another value.
* @param x A number between \a a and \a b.
* @return A value between 0.0 and 1.0.
*/
template <typename T>
inline T smootherStep(T a, T b, T x)
{
T t = clamp(lerpFactor(a,b,x), T(0), T(1));
return t*t*t*(t*(t*T(6) - T(15)) + T(10));
}
/*!
* @brief Cosine interpolation between between 0 and 1 as x moves between a and b.
*
* @param a A value.
* @param b Another value.
* @param x A number between \a a and \a b.
* @return A value between 0.0 and 1.0.
*/
template <typename T>
inline T cosStep(T a, T b, T x)
{
T t = clamp(lerpFactor(a,b,x), T(0), T(1));
return T(0.5)*(T(1)-cos(t*T(M_PI)));
}
//! The inverse of the cosStep function.
template <typename T>
inline T inverseCosStep(T a, T b, T x)
{
T t = clamp(lerpFactor(a,b,x), T(0), T(1));
return acos(T(1) - T(2)*t)*T(M_1_PI);
}
/*!
* @brief Evaluates Perlin's bias function to control the mean/midpoint of a function.
*
* Remaps the value t to increase/decrease the midpoint while preserving the values at t=0 and t=1.
*
* As described in:
* "Hypertexture"
* Ken Perlin and Eric M. Hoffert: Computer Graphics, v23, n3, p287-296, 1989.
*
* Properties:
* bias(0.0, a) = 0,
* bias(0.5, a) = a,
* bias(1.0, a) = 1, and
* bias(t , a) remaps the value t using a power curve.
*
* @tparam T The template parameter (typically float or double)
* @param t The percentage value in [0,1]
* @param a The shape parameter in [0,1]
* @return The remapped result in [0,1]
*/
template <typename T>
inline T biasPerlin(T t, T a)
{
return pow(t, -log2(a));
}
/*!
* @brief Perlin's gain function to increase/decrease the gradient/slope of the input at the midpoint.
*
* Remaps the value t to increase or decrease contrast using an s-curve (or inverse s-curve) function.
*
* As described in:
* "Hypertexture"
* Ken Perlin and Eric M. Hoffert: Computer Graphics, v23, n3, p287-296, 1989.
*
* Properties:
* gain(0.0, P) = 0.0,
* gain(0.5, P) = 0.5,
* gain(1.0, P) = 1.0,
* gain(t , 1) = t.
* gain(gain(t, P, 1/P) = t.
*
* @tparam T The template parameter (typically float or double)
* @param t The percentage value in [0,1]
* @param P The shape exponent. In Perlin's original version the exponent P = -log2(a).
* In this version we pass the exponent directly to avoid the logarithm.
* P > 1 creates an s-curve, and P < 1 an inverse s-curve.
* If the input is a linear ramp, the slope of the output at the midpoint 0.5 becomes P.
* @return The remapped result in [0,1]
*/
template <typename T>
inline T gainPerlin(T t, T P)
{
if (t > T(0.5))
return T(1) - T(0.5)*pow(T(2) - T(2)*t, P);
else
return T(0.5)*pow(T(2)*t, P);
}
/*!
* @brief Evaluates Schlick's rational version of Perlin's bias function.
*
* As described in:
* "Fast Alternatives to Perlin's Bias and Gain Functions"
* Christophe Schlick: Graphics Gems IV, p379-382, April 1994.
*
* @tparam T The template parameter (typically float or double)
* @param t The percentage value (between 0 and 1)
* @param a The shape parameter (between 0 and 1)
* @return The remapped result
*/
template <typename T>
inline T biasSchlick(T t, T a)
{
return t / ((((T(1)/a) - T(2)) * (T(1) - t)) + T(1));
}
/*!
* @brief Evaluates Schlick's rational version of Perlin's gain function.
*
* As described in:
* "Fast Alternatives to Perlin's Bias and Gain Functions"
* Christophe Schlick: Graphics Gems IV, p379-382, April 1994.
*
* @tparam T The template parameter (typically float or double)
* @param t The percentage value (between 0 and 1)
* @param a The shape parameter (between 0 and 1)
* @return The remapped result
*/
template <typename T>
inline T gainSchlick(T t, T a)
{
if (t < T(0.5))
return biasSchlick(t * T(2), a)/T(2);
else
return biasSchlick(t * T(2) - T(1), T(1) - a)/T(2) + T(0.5);
}
template <typename T>
inline T brightnessContrastL(T v, T slope, T midpoint)
{
return (v - midpoint) * slope + T(0.5);
}
template <typename T>
inline T brightnessContrastNL(T v, T slope, T bias)
{
return gainPerlin(biasSchlick(clamp01(v), bias), slope);
}
//! Returns a modulus b.
template <typename T>
inline T mod(T a, T b)
{
int n = (int)(a/b);
a -= n*b;
if (a < 0)
a += b;
return a;
}
template <typename T>
inline T logScale(T val)
{
static const T eps = T(0.001);
static const T logeps = std::log(eps);
return val > 0 ? (std::log(val + eps) - logeps) : -(std::log(-val + eps) - logeps);
}
template <typename T>
inline T normalizedLogScale(T val, T minLog, T diffLog)
{
return (logScale(val) - minLog) / diffLog;
}
template <typename T>
inline T normalizedLogScale(T val)
{
static const T minLog = logScale(T(0));
static const T diffLog = logScale(T(1)) - minLog;
return normalizedLogScale(val, minLog, diffLog);
}
template <typename T>
inline const T& min(const T& a, const T& b, const T& c)
{
return std::min(std::min(a, b), c);
}
template <typename T>
inline const T& min(const T& a, const T& b, const T& c, const T& d)
{
return std::min(min(a, b, c), d);
}
template <typename T>
inline const T& min(const T& a, const T& b, const T& c, const T& d, const T& e)
{
return std::min(min(a, b, c, d), e);
}
template <typename T>
inline const T& max(const T& a, const T& b, const T& c)
{
return std::max(std::max(a, b), c);
}
template <typename T>
inline const T& max(const T& a, const T& b, const T& c, const T& d)
{
return std::max(max(a, b, c), d);
}
template <typename T>
inline const T& max(const T& a, const T& b, const T& c, const T& d, const T& e)
{
return std::max(max(a, b, c, d), e);
}
template <typename T>
inline T square(T value)
{
return value*value;
}
std::string getExtension(const std::string& filename);
std::string getBasename(const std::string& filename);
const std::vector<std::string> & channelNames();
const std::vector<std::string> & blendModeNames();
std::string channelToString(EChannel channel);
std::string blendModeToString(EBlendMode mode);
inline int codePointLength(char first)
{
if ((first & 0xf8) == 0xf0)
return 4;
else if ((first & 0xf0) == 0xe0)
return 3;
else if ((first & 0xe0) == 0xc0)
return 2;
else
return 1;
}
std::vector<std::string> split(std::string text, const std::string& delim);
std::string toLower(std::string str);
std::string toUpper(std::string str);
bool matches(std::string text, std::string filter, bool isRegex);
enum EDirection
{
Forward,
Backward,
};
|
f0a0823b747797d7d1f6f94e1215063ab3ee2059
|
a6d8297fc98da4873134e12c8c15662f4dc99473
|
/Source/Test/Src/DatabaseFieldTest.cpp
|
025be813e206122cfbe37eefbc0d8e64bba32477
|
[
"MIT"
] |
permissive
|
DragonJoker/DatabaseConnector
|
507459f171cf3fd696b5208a9b4f0b584200d97d
|
502b136588b46119c2a0f4ed6b6623c0cc6715c2
|
refs/heads/master
| 2021-05-16T02:42:51.816583
| 2020-10-17T02:39:47
| 2020-10-17T02:39:47
| 38,719,651
| 2
| 1
|
MIT
| 2020-10-17T02:39:48
| 2015-07-07T23:09:28
|
C
|
UTF-8
|
C++
| false
| false
| 28,183
|
cpp
|
DatabaseFieldTest.cpp
|
/************************************************************************//**
* @file DatabaseFieldTest.cpp
* @author Sylvain Doremus
* @version 1.0
* @date 12/02/2014 14:29:35
*
*
* @brief Class testing CDatabaseField class
*
***************************************************************************/
#include "DatabaseTestPch.h"
#include "DatabaseFieldTest.h"
#include "DatabaseTestConnection.h"
#include "DatabaseTestHelpers.h"
#include "DatabaseTestValuedObject.h"
#include <DatabaseValuedObjectInfos.h>
namespace std
{
inline ostream & operator <<( ostream & out, const NAMESPACE_DATABASE::ByteArray & value )
{
auto flags = out.setf( std::ios::hex, std::ios::basefield );
for ( auto && it : value )
{
out.width( 2 );
out.fill( '0' );
out << int( it );
}
out.setf( flags );
return out;
}
}
BEGIN_NAMESPACE_DATABASE_TEST
{
namespace
{
template< EFieldType FieldType, typename Enable = void >
struct InfosCreator
{
static DatabaseValuedObjectInfosSPtr Create()
{
return std::make_shared< CDatabaseValuedObjectInfos >( STR( "Infos" ), FieldType );
}
};
template< EFieldType FieldType >
struct InfosCreator< FieldType, typename std::enable_if< SFieldTypeNeedsLimits< FieldType >::value >::type >
{
static DatabaseValuedObjectInfosSPtr Create()
{
return std::make_shared< CDatabaseValuedObjectInfos >( STR( "Infos" ), FieldType, DatabaseUtils::Helpers< FieldType >::Limit );
}
};
template< EFieldType FieldType >
struct InfosCreator< FieldType, typename std::enable_if< SFieldTypeNeedsPrecision< FieldType >::value >::type >
{
static DatabaseValuedObjectInfosSPtr Create()
{
return std::make_shared< CDatabaseValuedObjectInfos >( STR( "Infos" ), FieldType, DatabaseUtils::Helpers< FieldType >::Precision );
}
};
template< EFieldType FieldTypeA, EFieldType FieldTypeB >
struct GetValueCheck
{
static void Check( std::random_device & generator, DatabaseConnectionSPtr connection, DatabaseValuedObjectInfosSPtr infos )
{
CDatabaseField object( connection, infos );
auto valueIn = DatabaseUtils::Helpers< FieldTypeA >::GetRandomValue( generator );
BOOST_CHECK( object.IsNull() );
BOOST_CHECK_NO_THROW( static_cast< CDatabaseValue< FieldTypeA > & >( object.GetObjectValue() ).SetValue( valueIn ) );
typename DatabaseUtils::Helpers< FieldTypeB >::ParamType valueOut;
if ( AreTypesCompatibleGet( FieldTypeA, FieldTypeB ) )
{
BOOST_CHECK_NO_THROW( object.GetValue( valueOut ) );
}
else
{
BOOST_CHECK_THROW( object.GetValue( valueOut ), CDatabaseException );
}
}
};
template< EFieldType FieldTypeA, EFieldType FieldTypeB >
struct GetValueOptCheck
{
static void Check( std::random_device & generator, DatabaseConnectionSPtr connection, DatabaseValuedObjectInfosSPtr infos )
{
CDatabaseField object( connection, infos );
BOOST_CHECK( object.IsNull() );
CDatabaseNullable< typename DatabaseUtils::Helpers< FieldTypeB >::ParamType > valueOpt;
BOOST_CHECK_NO_THROW( object.GetValueOpt( valueOpt ) );
BOOST_CHECK( !valueOpt );
auto value = DatabaseUtils::Helpers< FieldTypeA >::GetRandomValue( generator );
BOOST_CHECK_NO_THROW( static_cast< CDatabaseValue< FieldTypeA > & >( object.GetObjectValue() ).SetValue( value ) );
if ( AreTypesCompatibleGet( FieldTypeA, FieldTypeB ) )
{
BOOST_CHECK_NO_THROW( object.GetValueOpt( valueOpt ) );
BOOST_CHECK( ( bool )valueOpt );
}
else
{
BOOST_CHECK_THROW( object.GetValueOpt( valueOpt ), CDatabaseException );
}
}
};
template< EFieldType FieldTypeA, EFieldType FieldTypeB >
struct GetValueFastCheck
{
static void Check( std::random_device & generator, DatabaseConnectionSPtr connection, DatabaseValuedObjectInfosSPtr infos )
{
CDatabaseField object( connection, infos );
BOOST_CHECK( object.IsNull() );
auto valueIn = DatabaseUtils::Helpers< FieldTypeA >::GetRandomValue( generator );
BOOST_CHECK_NO_THROW( static_cast< CDatabaseValue< FieldTypeA > & >( object.GetObjectValue() ).SetValue( valueIn ) );
typename DatabaseUtils::Helpers< FieldTypeB >::ParamType valueOut;
BOOST_CHECK_NO_THROW( object.GetValueFast( valueOut ) );
BOOST_CHECK_EQUAL( valueIn, valueOut );
}
};
template< EFieldType FieldTypeA, EFieldType FieldTypeB >
struct GetValueOptFastCheck
{
static void Check( std::random_device & generator, DatabaseConnectionSPtr connection, DatabaseValuedObjectInfosSPtr infos )
{
CDatabaseField object( connection, infos );
BOOST_CHECK( object.IsNull() );
CDatabaseNullable< typename DatabaseUtils::Helpers< FieldTypeB >::ParamType > valueOpt;
BOOST_CHECK_NO_THROW( object.GetValueOpt( valueOpt ) );
BOOST_CHECK( !valueOpt );
auto value = DatabaseUtils::Helpers< FieldTypeA >::GetRandomValue( generator );
BOOST_CHECK_NO_THROW( static_cast< CDatabaseValue< FieldTypeA > & >( object.GetObjectValue() ).SetValue( value ) );
BOOST_CHECK_NO_THROW( object.GetValueOpt( valueOpt ) );
BOOST_CHECK( ( bool )valueOpt );
BOOST_CHECK_EQUAL( *valueOpt, value );
}
};
template< EFieldType FieldType >
struct SValuedObjectChecks
{
static void GetValueChecks( std::random_device & generator )
{
String connectionString;
DatabaseConnectionSPtr connection = std::make_shared< CDatabaseTestConnection >( TEST_GOOD_SERVER, TEST_GOOD_USER, TEST_GOOD_PASSWORD, connectionString );
connection->SelectDatabase( TEST_GOOD_DATABASE );
DatabaseValuedObjectInfosSPtr infos = InfosCreator< FieldType >::Create();
GetValueCheck< FieldType, EFieldType_BIT >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_SINT8 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_SINT16 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_SINT24 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_SINT32 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_SINT64 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_UINT8 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_UINT16 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_UINT24 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_UINT32 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_UINT64 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_FLOAT32 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_FLOAT64 >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_FIXED_POINT >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_CHAR >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_VARCHAR >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_TEXT >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_NCHAR >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_NVARCHAR >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_NTEXT >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_DATE >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_DATETIME >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_TIME >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_BINARY >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_VARBINARY >::Check( generator, connection, infos );
GetValueCheck< FieldType, EFieldType_BLOB >::Check( generator, connection, infos );
}
static void GetValueOptChecks( std::random_device & generator )
{
String connectionString;
DatabaseConnectionSPtr connection = std::make_shared< CDatabaseTestConnection >( TEST_GOOD_SERVER, TEST_GOOD_USER, TEST_GOOD_PASSWORD, connectionString );
connection->SelectDatabase( TEST_GOOD_DATABASE );
DatabaseValuedObjectInfosSPtr infos = InfosCreator< FieldType >::Create();
GetValueOptCheck< FieldType, EFieldType_BIT >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_SINT8 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_SINT16 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_SINT24 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_SINT32 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_SINT64 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_UINT8 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_UINT16 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_UINT24 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_UINT32 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_UINT64 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_FLOAT32 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_FLOAT64 >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_FIXED_POINT >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_CHAR >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_VARCHAR >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_TEXT >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_NCHAR >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_NVARCHAR >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_NTEXT >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_DATE >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_DATETIME >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_TIME >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_BINARY >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_VARBINARY >::Check( generator, connection, infos );
GetValueOptCheck< FieldType, EFieldType_BLOB >::Check( generator, connection, infos );
}
static void GetValueFastChecks( std::random_device & generator )
{
String connectionString;
DatabaseConnectionSPtr connection = std::make_shared< CDatabaseTestConnection >( TEST_GOOD_SERVER, TEST_GOOD_USER, TEST_GOOD_PASSWORD, connectionString );
connection->SelectDatabase( TEST_GOOD_DATABASE );
DatabaseValuedObjectInfosSPtr infos = InfosCreator< FieldType >::Create();
GetValueFastCheck< FieldType, FieldType >::Check( generator, connection, infos );
}
static void GetValueOptFastChecks( std::random_device & generator )
{
String connectionString;
DatabaseConnectionSPtr connection = std::make_shared< CDatabaseTestConnection >( TEST_GOOD_SERVER, TEST_GOOD_USER, TEST_GOOD_PASSWORD, connectionString );
connection->SelectDatabase( TEST_GOOD_DATABASE );
DatabaseValuedObjectInfosSPtr infos = InfosCreator< FieldType >::Create();
GetValueOptFastCheck< FieldType, FieldType >::Check( generator, connection, infos );
}
};
}
CDatabaseFieldTest::CDatabaseFieldTest()
{
}
CDatabaseFieldTest::~CDatabaseFieldTest()
{
}
boost::unit_test::test_suite * CDatabaseFieldTest::Init_Test_Suite()
{
//!@remarks Create the internal TS instance.
testSuite = new boost::unit_test::test_suite( "CDatabaseFieldTest", __FILE__, __LINE__ );
//!@remarks Add the TC to the internal TS.
testSuite->add( BOOST_TEST_CASE( std::bind( &CDatabaseFieldTest::TestCase_FieldGetValue, this ) ) );
testSuite->add( BOOST_TEST_CASE( std::bind( &CDatabaseFieldTest::TestCase_FieldGetValueOpt, this ) ) );
testSuite->add( BOOST_TEST_CASE( std::bind( &CDatabaseFieldTest::TestCase_FieldGetValueFast, this ) ) );
testSuite->add( BOOST_TEST_CASE( std::bind( &CDatabaseFieldTest::TestCase_FieldGetValueOptFast, this ) ) );
//!@remarks Return the TS instance.
return testSuite;
}
void CDatabaseFieldTest::TestCase_FieldGetValue()
{
CLogger::LogInfo( StringStream() << "**** Start TestCase_FieldGetValue ****" );
std::random_device generator;
CLogger::LogInfo( StringStream() << " EFieldType_BIT" );
SValuedObjectChecks< EFieldType_BIT >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT8" );
SValuedObjectChecks< EFieldType_SINT8 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT16" );
SValuedObjectChecks< EFieldType_SINT16 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT24" );
SValuedObjectChecks< EFieldType_SINT24 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT32" );
SValuedObjectChecks< EFieldType_SINT32 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT64" );
SValuedObjectChecks< EFieldType_SINT64 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT8" );
SValuedObjectChecks< EFieldType_UINT8 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT16" );
SValuedObjectChecks< EFieldType_UINT16 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT24" );
SValuedObjectChecks< EFieldType_UINT24 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT32" );
SValuedObjectChecks< EFieldType_UINT32 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT64" );
SValuedObjectChecks< EFieldType_UINT64 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FLOAT32" );
SValuedObjectChecks< EFieldType_FLOAT32 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FLOAT64" );
SValuedObjectChecks< EFieldType_FLOAT64 >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FIXED_POINT" );
SValuedObjectChecks< EFieldType_FIXED_POINT >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_CHAR" );
SValuedObjectChecks< EFieldType_CHAR >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_VARCHAR" );
SValuedObjectChecks< EFieldType_VARCHAR >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_TEXT" );
SValuedObjectChecks< EFieldType_TEXT >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NCHAR" );
SValuedObjectChecks< EFieldType_NCHAR >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NVARCHAR" );
SValuedObjectChecks< EFieldType_NVARCHAR >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NTEXT" );
SValuedObjectChecks< EFieldType_NTEXT >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_DATE" );
SValuedObjectChecks< EFieldType_DATE >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_DATETIME" );
SValuedObjectChecks< EFieldType_DATETIME >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_TIME" );
SValuedObjectChecks< EFieldType_TIME >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_BINARY" );
SValuedObjectChecks< EFieldType_BINARY >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_VARBINARY" );
SValuedObjectChecks< EFieldType_VARBINARY >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_BLOB" );
SValuedObjectChecks< EFieldType_BLOB >::GetValueChecks( generator );
CLogger::LogInfo( StringStream() << "**** End TestCase_FieldGetValue ****" );
}
void CDatabaseFieldTest::TestCase_FieldGetValueOpt()
{
CLogger::LogInfo( StringStream() << "**** Start TestCase_FieldGetValue ****" );
std::random_device generator;
CLogger::LogInfo( StringStream() << " EFieldType_BIT" );
SValuedObjectChecks< EFieldType_BIT >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT8" );
SValuedObjectChecks< EFieldType_SINT8 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT16" );
SValuedObjectChecks< EFieldType_SINT16 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT24" );
SValuedObjectChecks< EFieldType_SINT24 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT32" );
SValuedObjectChecks< EFieldType_SINT32 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT64" );
SValuedObjectChecks< EFieldType_SINT64 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT8" );
SValuedObjectChecks< EFieldType_UINT8 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT16" );
SValuedObjectChecks< EFieldType_UINT16 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT24" );
SValuedObjectChecks< EFieldType_UINT24 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT32" );
SValuedObjectChecks< EFieldType_UINT32 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT64" );
SValuedObjectChecks< EFieldType_UINT64 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FLOAT32" );
SValuedObjectChecks< EFieldType_FLOAT32 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FLOAT64" );
SValuedObjectChecks< EFieldType_FLOAT64 >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FIXED_POINT" );
SValuedObjectChecks< EFieldType_FIXED_POINT >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_CHAR" );
SValuedObjectChecks< EFieldType_CHAR >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_VARCHAR" );
SValuedObjectChecks< EFieldType_VARCHAR >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_TEXT" );
SValuedObjectChecks< EFieldType_TEXT >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NCHAR" );
SValuedObjectChecks< EFieldType_NCHAR >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NVARCHAR" );
SValuedObjectChecks< EFieldType_NVARCHAR >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NTEXT" );
SValuedObjectChecks< EFieldType_NTEXT >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_DATE" );
SValuedObjectChecks< EFieldType_DATE >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_DATETIME" );
SValuedObjectChecks< EFieldType_DATETIME >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_TIME" );
SValuedObjectChecks< EFieldType_TIME >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_BINARY" );
SValuedObjectChecks< EFieldType_BINARY >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_VARBINARY" );
SValuedObjectChecks< EFieldType_VARBINARY >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_BLOB" );
SValuedObjectChecks< EFieldType_BLOB >::GetValueOptChecks( generator );
CLogger::LogInfo( StringStream() << "**** End TestCase_FieldGetValue ****" );
}
void CDatabaseFieldTest::TestCase_FieldGetValueFast()
{
CLogger::LogInfo( StringStream() << "**** Start TestCase_FieldGetValueFast ****" );
std::random_device generator;
CLogger::LogInfo( StringStream() << " EFieldType_BIT" );
SValuedObjectChecks< EFieldType_BIT >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT8" );
SValuedObjectChecks< EFieldType_SINT8 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT16" );
SValuedObjectChecks< EFieldType_SINT16 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT24" );
SValuedObjectChecks< EFieldType_SINT24 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT32" );
SValuedObjectChecks< EFieldType_SINT32 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT64" );
SValuedObjectChecks< EFieldType_SINT64 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT8" );
SValuedObjectChecks< EFieldType_UINT8 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT16" );
SValuedObjectChecks< EFieldType_UINT16 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT24" );
SValuedObjectChecks< EFieldType_UINT24 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT32" );
SValuedObjectChecks< EFieldType_UINT32 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT64" );
SValuedObjectChecks< EFieldType_UINT64 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FLOAT32" );
SValuedObjectChecks< EFieldType_FLOAT32 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FLOAT64" );
SValuedObjectChecks< EFieldType_FLOAT64 >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FIXED_POINT" );
SValuedObjectChecks< EFieldType_FIXED_POINT >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_CHAR" );
SValuedObjectChecks< EFieldType_CHAR >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_VARCHAR" );
SValuedObjectChecks< EFieldType_VARCHAR >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_TEXT" );
SValuedObjectChecks< EFieldType_TEXT >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NCHAR" );
SValuedObjectChecks< EFieldType_NCHAR >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NVARCHAR" );
SValuedObjectChecks< EFieldType_NVARCHAR >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NTEXT" );
SValuedObjectChecks< EFieldType_NTEXT >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_DATE" );
SValuedObjectChecks< EFieldType_DATE >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_DATETIME" );
SValuedObjectChecks< EFieldType_DATETIME >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_TIME" );
SValuedObjectChecks< EFieldType_TIME >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_BINARY" );
SValuedObjectChecks< EFieldType_BINARY >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_VARBINARY" );
SValuedObjectChecks< EFieldType_VARBINARY >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_BLOB" );
SValuedObjectChecks< EFieldType_BLOB >::GetValueFastChecks( generator );
CLogger::LogInfo( StringStream() << "**** End TestCase_FieldGetValueFast ****" );
}
void CDatabaseFieldTest::TestCase_FieldGetValueOptFast()
{
CLogger::LogInfo( StringStream() << "**** Start TestCase_FieldGetValueOptFast ****" );
std::random_device generator;
CLogger::LogInfo( StringStream() << " EFieldType_BIT" );
SValuedObjectChecks< EFieldType_BIT >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT8" );
SValuedObjectChecks< EFieldType_SINT8 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT16" );
SValuedObjectChecks< EFieldType_SINT16 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT24" );
SValuedObjectChecks< EFieldType_SINT24 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT32" );
SValuedObjectChecks< EFieldType_SINT32 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_SINT64" );
SValuedObjectChecks< EFieldType_SINT64 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT8" );
SValuedObjectChecks< EFieldType_UINT8 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT16" );
SValuedObjectChecks< EFieldType_UINT16 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT24" );
SValuedObjectChecks< EFieldType_UINT24 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT32" );
SValuedObjectChecks< EFieldType_UINT32 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_UINT64" );
SValuedObjectChecks< EFieldType_UINT64 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FLOAT32" );
SValuedObjectChecks< EFieldType_FLOAT32 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FLOAT64" );
SValuedObjectChecks< EFieldType_FLOAT64 >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_FIXED_POINT" );
SValuedObjectChecks< EFieldType_FIXED_POINT >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_CHAR" );
SValuedObjectChecks< EFieldType_CHAR >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_VARCHAR" );
SValuedObjectChecks< EFieldType_VARCHAR >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_TEXT" );
SValuedObjectChecks< EFieldType_TEXT >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NCHAR" );
SValuedObjectChecks< EFieldType_NCHAR >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NVARCHAR" );
SValuedObjectChecks< EFieldType_NVARCHAR >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_NTEXT" );
SValuedObjectChecks< EFieldType_NTEXT >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_DATE" );
SValuedObjectChecks< EFieldType_DATE >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_DATETIME" );
SValuedObjectChecks< EFieldType_DATETIME >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_TIME" );
SValuedObjectChecks< EFieldType_TIME >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_BINARY" );
SValuedObjectChecks< EFieldType_BINARY >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_VARBINARY" );
SValuedObjectChecks< EFieldType_VARBINARY >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << " EFieldType_BLOB" );
SValuedObjectChecks< EFieldType_BLOB >::GetValueOptFastChecks( generator );
CLogger::LogInfo( StringStream() << "**** End TestCase_FieldGetValueOptFast ****" );
}
}
END_NAMESPACE_DATABASE_TEST
|
beaff63641c2589e383c34d9d6670857b0e52504
|
0ff71c971ce12049fb148d7b9a7b4f8f61983e6a
|
/c++/Slide.cpp
|
85772c7189f73ac6155e726f2929abcdfe6733c3
|
[] |
no_license
|
noahrichards/cs4-project
|
b88087e1a81c1f70fde2663fe20ea1d93f85c7e0
|
69ab862ff45e546c5a900bdb7b8b7f0403b5fbfd
|
refs/heads/master
| 2016-09-06T12:38:03.808284
| 2011-06-24T04:58:37
| 2011-06-24T04:58:37
| 91,961
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 929
|
cpp
|
Slide.cpp
|
#include <iostream>
#include <fstream>
#include "Slide.h"
#include "Solver.h"
using namespace std;
int main(int argc, char** argv)
{
if(argc != 3)
{
cerr << "Illegal number of arguments.\n"
<< "Usage:\n"
<< "slide <input-file> <output-file>\n"
<< "If input-file is -, input taken from standard input.\n"
<< "If output-file is -, output directed to standard out.\n"
<< endl;
exit(1);
}
ifstream infile;
ofstream outfile;
istream* in;
ostream* out;
if(!strcmp(argv[1], "-"))
in = &cin;
else
{
infile.open(argv[1]);
if(!infile)
{
cerr << "Error opening input file: " << argv[1] << endl;
exit(1);
}
in = &infile;
}
if(!strcmp(argv[2], "-"))
out = &cout;
else
{
outfile.open(argv[2]);
if(!outfile)
{
cerr << "Error opening output file: " << argv[2] << endl;
exit(1);
}
out = &outfile;
}
Slide slide(*in);
solver::solve(slide, *out);
return 0;
}
|
768789969b4f561bea760272d6c750f254e70b12
|
726d8518a8c7a38b0db6ba9d4326cec172a6dde6
|
/1672. Richest Customer Wealth/Solution.cpp
|
535cf1714e5a0d47a91816a5db939abbf9811454
|
[] |
no_license
|
faterazer/LeetCode
|
ed01ef62edbcfba60f5e88aad401bd00a48b4489
|
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
|
refs/heads/master
| 2023-08-25T19:14:03.494255
| 2023-08-25T03:34:44
| 2023-08-25T03:34:44
| 128,856,315
| 4
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 320
|
cpp
|
Solution.cpp
|
#include <numeric>
#include <vector>
using namespace std;
class Solution
{
public:
int maximumWealth(vector<vector<int>> &accounts)
{
int res = 0;
for (const vector<int> &account : accounts)
res = max(res, accumulate(account.begin(), account.end(), 0));
return res;
}
};
|
a6f2244713e412e2121901ba9caa9de0aada924a
|
ee77b79fb6b171aed892d57a21326aa7bd6872b0
|
/semester2/practice4/exercise1/myVector.cpp
|
5eb3905a76cb17b38077796ddebe27234d70268e
|
[
"WTFPL",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
bahlo-practices/pa
|
413cf41c771df635c805528b7e59a4afa15febd1
|
098e40b2525b172e4bece8b134006c350852aa6b
|
refs/heads/master
| 2019-01-01T23:52:19.322085
| 2013-07-10T16:21:57
| 2013-07-10T16:21:57
| 6,282,589
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,187
|
cpp
|
myVector.cpp
|
/*
* File: myVector.cpp
*
* Created on 13. Mai 2013, 17:03
*/
#include "myVector.h"
#include <math.h>
#include <stdexcept>
myVector::myVector() : sz(0), elem(0), space(0) {
}
myVector::myVector(int s) : sz(s) {
int tmp = 2 * s;
elem = new double[tmp];
space =tmp;
for (int i = 0; i < s; ++i) elem[i] = 0.0;
}
myVector::myVector(const myVector& a)
: sz(a.size()), elem(new double [a.size()]) , space(a.capacity()){ // Copy-Konstruktor
for (int i(0); i < a.size(); i++ ){
elem[i] = a.get(i);
}
}
myVector::~myVector() {
delete[] elem;
elem = 0;
}
void myVector::reserve(int newspace) {
if (newspace <= space) return; // nie weniger Platz holen
double* p = new double[newspace]; // mit new Speicher allokieren
for (int i = 0; i < sz; ++i) p[i] = elem[i]; // Elemente kopieren
delete[] elem; // alten Speicher freigeben
elem = p; // Zeiger umhaengen
space = newspace; // Platz korrekt setzen
}
void myVector::push_back(double d) {
if (space == 0) // Erstes Element
reserve(8); // Platz aus dem Heap holen
else
if (sz == space) // Kein Platz mehr?
reserve(space * 2); // Aus dem Heap holen
elem[sz]=d; // Jetzt d anhaengen…
sz++; // …und den Elementezaehler erhoehen
}
void myVector::resize(int newsize) {
reserve(newsize); // Speicher im Heap reservieren
for (int i = sz; i < newsize; ++i) // Initialisierung der
elem[i] = double(); // zusaetzlichen Elemente
sz = newsize;
}
double& myVector::operator[](int index) {
if (index < 0 || sz <= index) {
//cout << "myVector::operator[](), bad index";
throw std::out_of_range("myVector::operator[](), bad index");
}
return elem[index];
};
const double& myVector::operator [](int index) const{
if (index < 0 || sz <= index) {
//cout << "myVector::operator[](), bad index";
throw std::out_of_range("myVector::operator[](), bad index");
}
return elem[index];
}
int myVector::size() const {
return sz;
}
int myVector::capacity() const {
return space;
}
myVector& myVector::operator=(const myVector& a) {
if (this == &a) return *this;
if (a.sz <= space) { // genug Platz, d.h. keine weitere Allokation
for (int i = 0; i < a.sz; ++i)
elem[i] = a.elem[i]; // Elemente kopieren
// Bem.: die beiden myVector Objekte sind
// bzgl. space nicht mehr unbedingt identisch
sz = a.sz;
return *this;
}
double* p = new double[a.sz]; // copy & swap, Platz aus dem Heap holen
for (int i = 0; i < a.sz; ++i)
p[i] = a.elem[i]; // Elemente kopieren
delete[] elem; // alten Speicherplatz feigeben
elem = p; // Zeiger umhaengen
space = sz = a.sz; // Groesse richtig setzen
return *this; // die (eigene) Adresse zurueckgeben
}
double myVector::get(int a) const {
if (a < 0 || sz <= a) {
throw std::out_of_range("myVector::operator[](), bad index");
}
return elem[a];
}
void myVector::set(int a, double e) {
if (a < 0 || sz <= a) {
throw std::out_of_range("myVector::operator[](), bad index");
}
elem[a] = e;
}
|
b665759c414752bb53b9efa9a88a4e2ad5fcf0f3
|
c6ff9b43d2954d7de3b1ff0e505ca69bdabd6838
|
/Bltc/Bltc/Items/i204.cpp
|
f805d1dbf9d996fe5f60b8b8dbcb76fded26ef47
|
[] |
no_license
|
Ewenwan/ow
|
39ddb33c81094fa715b399d369ad4ac27c5b0e80
|
94c5598fd686cdb3adebff6dd9d50acaa6ab10c5
|
refs/heads/master
| 2021-06-08T03:53:51.541463
| 2016-08-10T08:21:44
| 2016-08-10T08:21:44
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,261
|
cpp
|
i204.cpp
|
// Author : Gamma Chen
#ifdef CONFIG_WITH_OSD
#include "ModelConfig.h"
#include "Items.h"
#include "TiLib.h"
#if 1
#include "UI_StationTest.h"
#include "UserInterface.h"
#include "TiLib_Glyph.h"
#include "TiLib_Text.h"
extern UI_StationTest ui_stationTest;
extern UserInterface *ui;
#define FONT_WIDTH 30
#define FONT_HEIGHT 60
#define FONT_LINE_WIDTH 6
#define FONT_INTERVAL 10
#endif // #if 0
void Items::AI204()
{
#if 1
char sError[20];
// Save original setting of window.
TiLib_Rect rect = lib.window.rect;
TiLib_Text text = lib.window.text;
/* if (ui != &ui_stationTest) {
return;
}*/
ErrorCode error = ui_stationTest.CurrStation()->Error();
for (int i = 0; i < error.size; i++) {
sprintf(sError+i*4, "%.4X", error.code[i]);
}
lib.osd.ClearScreen();
// lib.window.Create(0, 380, 720, 200, FONT_LINE_WIDTH, BLUE, "", RED, FONT_WIDTH, FONT_HEIGHT, FONT_INTERVAL, WIN_CENTER);
lib.window.Create(0, 380, 720, 200, FONT_LINE_WIDTH, BLACK, "", WHITE, FONT_WIDTH, FONT_HEIGHT, FONT_INTERVAL, WIN_CENTER);
lib.window.DisplayStr(sError);
// Restore original setting of window.
lib.window.rect = rect;
lib.window.text = text;
#endif // #if 0
return;
}
#endif // CONFIG_WITH_OSD
|
9323af924f9d5b942980642733175fa65caae04b
|
cf1f306536e7859b0b1995c426ce32b09d275851
|
/tilesweep/third_party/h2o/deps/brotli/enc/utf8_util.h
|
74f22b6a7f6b98aeee178c997d33faa304895874
|
[
"MIT"
] |
permissive
|
seemk/TileSweep
|
a7c8c81513565e9a236bbd981207612191bd4d5a
|
627999b38f59202678c4ea2a65d761e8e2a8f48a
|
refs/heads/master
| 2018-12-07T07:40:06.556025
| 2018-09-10T19:09:57
| 2018-09-10T19:09:57
| 55,528,632
| 17
| 6
|
MIT
| 2018-09-10T19:13:06
| 2016-04-05T17:37:15
|
C
|
UTF-8
|
C++
| false
| false
| 715
|
h
|
utf8_util.h
|
/* Copyright 2013 Google Inc. All Rights Reserved.
Distributed under MIT license.
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/
// Heuristics for deciding about the UTF8-ness of strings.
#ifndef BROTLI_ENC_UTF8_UTIL_H_
#define BROTLI_ENC_UTF8_UTIL_H_
#include "./types.h"
namespace brotli {
static const double kMinUTF8Ratio = 0.75;
// Returns true if at least min_fraction of the bytes between pos and
// pos + length in the (data, mask) ringbuffer is UTF8-encoded.
bool IsMostlyUTF8(const uint8_t* data, const size_t pos, const size_t mask,
const size_t length, const double min_fraction);
} // namespace brotli
#endif // BROTLI_ENC_UTF8_UTIL_H_
|
be3968b6bacc39c817fbf4cf6e15da7eb9718ec5
|
ee26fe88c24d6c3a9ac4828c4f27cb726014daa6
|
/05-ScenceManager/Water.cpp
|
9b7e9ea1696da001e04720b330d00c4cc3feae3e
|
[] |
no_license
|
ChauDucGiang/SE102.L21
|
0481a7c7dcc02cc15ab9dabf6648c7a4e84a01ae
|
81eb76a6b565b552bfeb56119e42db8aa54926bf
|
refs/heads/master
| 2023-06-21T09:23:26.846249
| 2021-07-27T13:27:20
| 2021-07-27T13:27:20
| 348,246,374
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 645
|
cpp
|
Water.cpp
|
#include "Water.h"
#include "Game.h"
CWater::CWater()
{
SetBoundingBox();
}
CWater::CWater(float x, float y)
{
SetPosition(x, y);
SetBoundingBox();
}
void CWater::Update(DWORD dt, vector<LPGAMEOBJECT>* coObjects)
{
}
void CWater::Render()
{
int ani = 0;
animation_set->at(ani)->Render(x, y);
RenderBoundingBox();
}
void CWater::GetBoundingBox(float& l, float& t, float& r, float& b)
{
l = x + 2;
t = y - 4;
r = x + WATER_BBOX_WIDTH ;
b = y - WATER_BBOX_HEIGHT;
CGameObject::GetBoundingBox(l, t, r, b);
}
void CWater::SetBoundingBox()
{
left = x;
top = y - 4;
right = x + WATER_BBOX_WIDTH;
bottom = y - WATER_BBOX_HEIGHT;
}
|
1c4deaa3fc45db0427d26e2d7e4bafcdcea66e47
|
e68c1f9134b44ddea144f7efa7523076f3f12d3a
|
/FinalCode/Enchantress_HTH_energy_bomb_01.cpp
|
0c8cbbc82122f4a8b5c4640da8f2c16a2ec248a0
|
[] |
no_license
|
iso5930/Direct-3D-Team-Portfolio
|
4ac710ede0c9176702595cba5579af42887611cf
|
84e64eb4e91c7e5b4aed77212cd08cfee038fcd3
|
refs/heads/master
| 2021-08-23T08:15:00.128591
| 2017-12-04T06:14:39
| 2017-12-04T06:14:39
| 112,998,717
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 543
|
cpp
|
Enchantress_HTH_energy_bomb_01.cpp
|
#include "StdAfx.h"
#include "Enchantress_HTH_energy_bomb_01.h"
CEnchantress_HTH_energy_bomb_01::CEnchantress_HTH_energy_bomb_01(int _iMode)
: CFollowerState(_iMode)
{
// StateType
m_eStateType = STATE_TYPE_ENCHANTRESS_HTH_ENERGY_BOMB_01;
}
CEnchantress_HTH_energy_bomb_01::~CEnchantress_HTH_energy_bomb_01()
{
}
void CEnchantress_HTH_energy_bomb_01::Initialize()
{
// Initialize
CFollowerState::Initialize();
// SetAnimation
m_pOwner->SetAnimation(30);
}
CFollowerState* CEnchantress_HTH_energy_bomb_01::Action()
{
return NULL;
}
|
771ebaa95863c99ed56433ce3cef29ae270e8b03
|
3d1d2e69d80810b297b5fe70eb841c3fe5d9306d
|
/src/Roster.cpp
|
5feabbf2d7c7c7cc0489989101bb2257c91ce7af
|
[
"MIT"
] |
permissive
|
indeterminateoutcomesstudios/AoSSimulator
|
dce3da661f16e9db794cb619685ed4701cd334ef
|
d125464e516b461205aaf23a8cc206ca797e83de
|
refs/heads/master
| 2020-04-26T10:41:22.143680
| 2019-02-24T06:23:52
| 2019-02-24T06:23:52
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,618
|
cpp
|
Roster.cpp
|
/*
* Warhammer Age of Sigmar battle simulator.
*
* Copyright (C) 2019 by Rick Weyrauch - rpweyrauch@gmail.com
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/
#include <cfloat>
#include <Roster.h>
void Roster::doHeroPhase()
{
for (auto u : m_units)
{
u->hero(m_id);
}
}
void Roster::doMovementPhase()
{
for (auto u : m_units)
{
u->movement(m_id);
}
}
void Roster::doShootingPhase()
{
for (auto u : m_units)
{
u->shooting(m_id);
}
}
void Roster::doChargePhase()
{
for (auto u : m_units)
{
u->charge(m_id);
}
}
void Roster::doCombatPhase()
{
for (auto u : m_units)
{
u->combat(m_id);
}
}
void Roster::doBattleshockPhase()
{
for (auto u : m_units)
{
u->battleshock(m_id);
}
}
void Roster::beginTurn(int battleRound, PlayerId playerWithTurn)
{
for (auto u : m_units)
{
u->beginTurn(battleRound, playerWithTurn);
}
}
Unit *Roster::nearestUnit(const Unit *unit) const
{
Unit *nearestUnit = m_units.front();
float minDistance = FLT_MAX;
for (auto u : m_units)
{
float dist = unit->distanceTo(u);
if (dist < minDistance)
{
minDistance = dist;
nearestUnit = u;
}
}
return nearestUnit;
}
int Roster::totalPoints() const
{
int points = 0;
for (auto u : m_units)
{
points += u->points();
}
return points;
}
void Roster::endTurn(int battleRound)
{
for (auto u : m_units)
{
u->endTurn(battleRound);
}
}
|
cf1ecf2d3544ca73d3866d55f7468a0006aad040
|
0db5d2ed33a432b7c45c0faa021fe47600b218ca
|
/include/flow/source/istreambuf.hpp
|
3644f9066b6e4032ff0ed35d957307da32c88d70
|
[] |
no_license
|
YernurSFU/libflow
|
c64763076a09af70f01b6d20714498c86a0b5673
|
ac56cc60a482ca309dc2c48d2ce13c093bfd74ea
|
refs/heads/master
| 2023-05-10T20:30:56.201707
| 2021-05-28T23:44:31
| 2021-05-28T23:44:31
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,377
|
hpp
|
istreambuf.hpp
|
#ifndef FLOW_SOURCE_ISTREAMBUF_HPP_INCLUDED
#define FLOW_SOURCE_ISTREAMBUF_HPP_INCLUDED
#include <flow/core/flow_base.hpp>
namespace flow {
namespace detail {
template <typename CharT, typename Traits>
struct istreambuf_flow : flow_base<istreambuf_flow<CharT, Traits>> {
using streambuf_type = std::basic_streambuf<CharT, Traits>;
explicit istreambuf_flow(streambuf_type* buf)
: buf_(buf)
{}
istreambuf_flow(istreambuf_flow&&) = default;
istreambuf_flow& operator=(istreambuf_flow&&) = default;
auto next() -> maybe<CharT>
{
if (!buf_) {
return {};
}
auto c = buf_->sbumpc();
if (c == Traits::eof()) {
buf_ = nullptr;
return {};
}
return Traits::to_char_type(c);
}
private:
streambuf_type* buf_ = nullptr;
};
struct from_istreambuf_fn {
template <typename CharT, typename Traits>
auto operator()(std::basic_streambuf<CharT, Traits>* buf) const
{
return istreambuf_flow<CharT, Traits>(buf);
}
template <typename CharT, typename Traits>
auto operator()(std::basic_istream<CharT, Traits>& stream) const
{
return istreambuf_flow<CharT, Traits>(stream.rdbuf());
}
};
} // namespace detail
inline constexpr auto from_istreambuf = detail::from_istreambuf_fn{};
} // namespace flow
#endif
|
50d25ac565970749b01bd0a4aff2770a203806b7
|
901d1e324696f083618e9e24c541d31cf5faa630
|
/Source/MGS/ItemContainer.cpp
|
9d79474b56edc73c4d0b6c862a792ed7396ed780
|
[] |
no_license
|
LochNessy64/MGS
|
4c2cbdaf786aca8f4af89208853b5550038032a4
|
961e0c4f085bd49bb777a332d34689de0cc61c9d
|
refs/heads/master
| 2020-02-26T15:08:59.636227
| 2017-01-18T08:07:05
| 2017-01-18T08:07:05
| 68,567,579
| 0
| 0
| null | 2016-11-24T08:14:55
| 2016-09-19T03:55:30
|
C++
|
UTF-8
|
C++
| false
| false
| 197
|
cpp
|
ItemContainer.cpp
|
// Fill out your copyright notice in the Description page of Project Settings.
#include "MGS.h"
#include "ItemContainer.h"
ItemContainer::ItemContainer()
{
}
ItemContainer::~ItemContainer()
{
}
|
4aadd46ca3757c6a677e4dbd73b56c7ade67fbfb
|
cfeac52f970e8901871bd02d9acb7de66b9fb6b4
|
/generated/src/aws-cpp-sdk-migrationhubstrategy/source/model/SrcCodeOrDbAnalysisStatus.cpp
|
3968f0cf6ea7e586d868c787d04d6dcd7c715100
|
[
"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
| 3,993
|
cpp
|
SrcCodeOrDbAnalysisStatus.cpp
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/migrationhubstrategy/model/SrcCodeOrDbAnalysisStatus.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>
using namespace Aws::Utils;
namespace Aws
{
namespace MigrationHubStrategyRecommendations
{
namespace Model
{
namespace SrcCodeOrDbAnalysisStatusMapper
{
static const int ANALYSIS_TO_BE_SCHEDULED_HASH = HashingUtils::HashString("ANALYSIS_TO_BE_SCHEDULED");
static const int ANALYSIS_STARTED_HASH = HashingUtils::HashString("ANALYSIS_STARTED");
static const int ANALYSIS_SUCCESS_HASH = HashingUtils::HashString("ANALYSIS_SUCCESS");
static const int ANALYSIS_FAILED_HASH = HashingUtils::HashString("ANALYSIS_FAILED");
static const int ANALYSIS_PARTIAL_SUCCESS_HASH = HashingUtils::HashString("ANALYSIS_PARTIAL_SUCCESS");
static const int UNCONFIGURED_HASH = HashingUtils::HashString("UNCONFIGURED");
static const int CONFIGURED_HASH = HashingUtils::HashString("CONFIGURED");
SrcCodeOrDbAnalysisStatus GetSrcCodeOrDbAnalysisStatusForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == ANALYSIS_TO_BE_SCHEDULED_HASH)
{
return SrcCodeOrDbAnalysisStatus::ANALYSIS_TO_BE_SCHEDULED;
}
else if (hashCode == ANALYSIS_STARTED_HASH)
{
return SrcCodeOrDbAnalysisStatus::ANALYSIS_STARTED;
}
else if (hashCode == ANALYSIS_SUCCESS_HASH)
{
return SrcCodeOrDbAnalysisStatus::ANALYSIS_SUCCESS;
}
else if (hashCode == ANALYSIS_FAILED_HASH)
{
return SrcCodeOrDbAnalysisStatus::ANALYSIS_FAILED;
}
else if (hashCode == ANALYSIS_PARTIAL_SUCCESS_HASH)
{
return SrcCodeOrDbAnalysisStatus::ANALYSIS_PARTIAL_SUCCESS;
}
else if (hashCode == UNCONFIGURED_HASH)
{
return SrcCodeOrDbAnalysisStatus::UNCONFIGURED;
}
else if (hashCode == CONFIGURED_HASH)
{
return SrcCodeOrDbAnalysisStatus::CONFIGURED;
}
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
if(overflowContainer)
{
overflowContainer->StoreOverflow(hashCode, name);
return static_cast<SrcCodeOrDbAnalysisStatus>(hashCode);
}
return SrcCodeOrDbAnalysisStatus::NOT_SET;
}
Aws::String GetNameForSrcCodeOrDbAnalysisStatus(SrcCodeOrDbAnalysisStatus enumValue)
{
switch(enumValue)
{
case SrcCodeOrDbAnalysisStatus::ANALYSIS_TO_BE_SCHEDULED:
return "ANALYSIS_TO_BE_SCHEDULED";
case SrcCodeOrDbAnalysisStatus::ANALYSIS_STARTED:
return "ANALYSIS_STARTED";
case SrcCodeOrDbAnalysisStatus::ANALYSIS_SUCCESS:
return "ANALYSIS_SUCCESS";
case SrcCodeOrDbAnalysisStatus::ANALYSIS_FAILED:
return "ANALYSIS_FAILED";
case SrcCodeOrDbAnalysisStatus::ANALYSIS_PARTIAL_SUCCESS:
return "ANALYSIS_PARTIAL_SUCCESS";
case SrcCodeOrDbAnalysisStatus::UNCONFIGURED:
return "UNCONFIGURED";
case SrcCodeOrDbAnalysisStatus::CONFIGURED:
return "CONFIGURED";
default:
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
if(overflowContainer)
{
return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
}
return {};
}
}
} // namespace SrcCodeOrDbAnalysisStatusMapper
} // namespace Model
} // namespace MigrationHubStrategyRecommendations
} // namespace Aws
|
a6b6e5ab42563758296e6a1e7f541a77819ee2aa
|
f82cd75666c164da58bb7fdaeabcac0f13377e38
|
/numpy_eigen/src/autogen_test_module/test_12_10_float.cpp
|
9ec9110e8a15663cac1c4ba4f5ac301a30d2a820
|
[] |
no_license
|
omaris/Schweizer-Messer
|
54b4639d3a30bed03db29458c713a05fdfa6f91a
|
ec4d523d9ac7c377e0701ce0b5fdede3043ecd8a
|
refs/heads/master
| 2021-01-15T17:37:01.645963
| 2013-06-18T06:52:50
| 2013-06-18T06:52:50
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 261
|
cpp
|
test_12_10_float.cpp
|
#include <Eigen/Core>
#include <numpy_eigen/boost_python_headers.hpp>
Eigen::Matrix<float, 12, 10> test_float_12_10(const Eigen::Matrix<float, 12, 10> & M)
{
return M;
}
void export_float_12_10()
{
boost::python::def("test_float_12_10",test_float_12_10);
}
|
9e1d8107bfa0af8927d623138ad8db4054ad60dc
|
31406f420f019a191a74b9288a6e37dcd89e8e82
|
/lib/Support/OSCompatWindows.cpp
|
7c9268d30341bd44554b89108d20c1e999b729f4
|
[
"MIT"
] |
permissive
|
facebook/hermes
|
b1bf3cb60b5946450c7c9a421ac8dad7a675e0f5
|
440578b31ecce46fcc5ba2ad745ffd5712d63a35
|
refs/heads/main
| 2023-09-06T04:16:02.263184
| 2023-09-05T20:12:54
| 2023-09-05T20:12:54
| 154,201,259
| 8,449
| 593
|
MIT
| 2023-09-14T21:25:56
| 2018-10-22T19:13:00
|
C++
|
UTF-8
|
C++
| false
| false
| 14,336
|
cpp
|
OSCompatWindows.cpp
|
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#ifdef _WINDOWS
#include "hermes/Support/Compiler.h"
#include "hermes/Support/ErrorHandling.h"
#include "hermes/Support/OSCompat.h"
#include <cassert>
// Include windows.h first because other includes from windows API need it.
// The blank line after the include is necessary to avoid lint error.
#define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
#define NOMINMAX // do not define min/max macros
#endif
#include <windows.h>
#include <intrin.h>
#include <io.h>
#include <psapi.h>
#include "llvh/ADT/Twine.h"
#include "llvh/Support/raw_ostream.h"
namespace hermes {
namespace oscompat {
#ifndef NDEBUG
static size_t testPgSz = 0;
void set_test_page_size(size_t pageSz) {
testPgSz = pageSz;
}
void reset_test_page_size() {
testPgSz = 0;
}
#endif
static inline size_t page_size_real() {
SYSTEM_INFO system_info;
GetSystemInfo(&system_info);
return system_info.dwPageSize;
}
size_t page_size() {
#ifndef NDEBUG
if (testPgSz != 0) {
return testPgSz;
}
#endif
return page_size_real();
}
#ifndef NDEBUG
static constexpr size_t unsetVMAllocLimit = std::numeric_limits<size_t>::max();
static size_t totalVMAllocLimit = unsetVMAllocLimit;
void set_test_vm_allocate_limit(size_t totSz) {
totalVMAllocLimit = totSz;
}
void unset_test_vm_allocate_limit() {
totalVMAllocLimit = unsetVMAllocLimit;
}
#endif // !NDEBUG
static char *alignAlloc(void *p, size_t alignment) {
return reinterpret_cast<char *>(
llvh::alignTo(reinterpret_cast<uintptr_t>(p), alignment));
}
static llvh::ErrorOr<void *>
vm_allocate_impl(void *addr, size_t sz, DWORD flags) {
void *result = VirtualAlloc(addr, sz, flags, PAGE_READWRITE);
if (result == nullptr) {
// Windows does not have POSIX error codes, but defines its own set.
// Use system_category with GetLastError so that the codes are interpreted
// correctly.
return std::error_code(GetLastError(), std::system_category());
}
return result;
}
static std::error_code vm_free_impl(void *p, size_t sz) {
BOOL ret = VirtualFree(p, 0, MEM_RELEASE);
return ret ? std::error_code{}
: std::error_code(GetLastError(), std::system_category());
}
// TODO(T40416012): Use hint on Windows.
static llvh::ErrorOr<void *> vm_allocate_aligned_impl(
size_t sz,
size_t alignment,
bool commit,
void * /* hint */) {
/// A value of 3 means vm_allocate_aligned_impl will:
/// 1. Opportunistic: allocate and see if it happens to be aligned
/// 2. Regular: Try aligned allocation 3 times (see below for details)
/// 3. Fallback: Allocate more than needed, and waste the excess
constexpr int aligned_allocation_attempts = 3;
#ifndef NDEBUG
assert(sz > 0 && sz % page_size() == 0);
assert(alignment > 0 && alignment % page_size() == 0);
if (LLVM_UNLIKELY(sz > totalVMAllocLimit)) {
return make_error_code(OOMError::TestVMLimitReached);
} else if (LLVM_UNLIKELY(totalVMAllocLimit != unsetVMAllocLimit)) {
totalVMAllocLimit -= sz;
}
#endif // !NDEBUG
DWORD commitFlag = commit ? MEM_COMMIT : 0;
// Opportunistically allocate without alignment constraint,
// and see if the memory happens to be aligned.
// While this may be unlikely on the first allocation request,
// subsequent allocation requests have a good chance.
llvh::ErrorOr<void *> result =
vm_allocate_impl(nullptr, sz, MEM_RESERVE | commitFlag);
if (!result) {
// Don't attempt to do anything further if the allocation failed.
return result;
}
void *addr = *result;
if (LLVM_LIKELY(addr == alignAlloc(addr, alignment))) {
return addr;
}
// Free the oppotunistic allocation.
if (std::error_code err = vm_free_impl(addr, sz)) {
hermes_fatal(
"Failed to free memory region in vm_allocate_aligned_impl", err);
}
for (int attempts = 0; attempts < aligned_allocation_attempts; attempts++) {
// Allocate a larger section to ensure that it contains
// a subsection that satisfies the request.
result = vm_allocate_impl(
nullptr, sz + alignment - page_size_real(), MEM_RESERVE);
if (!result) {
return result;
}
addr = *result;
// Find the desired subsection
char *aligned = alignAlloc(addr, alignment);
// Free the larger allocation (including the desired subsection)
if (std::error_code err = vm_free_impl(addr, sz)) {
hermes_fatal(
"Failed to free memory region in vm_allocate_aligned_impl", err);
}
// Request allocation at the desired subsection
result = vm_allocate_impl(aligned, sz, MEM_RESERVE | commitFlag);
if (result) {
assert(result.get() == aligned);
return result.get();
}
}
// Similar to the regular mechanism, but simply return the desired
// subsection (instead of free and re-allocate). This has two downsides:
// 1. Wasted virtual address space.
// 2. vm_free_aligned is now required to call VirtualQuery, which has
// a non-trivial cost.
result =
vm_allocate_impl(nullptr, sz + alignment - page_size_real(), MEM_RESERVE);
if (!result) {
return result;
}
addr = *result;
addr = alignAlloc(addr, alignment);
if (commit) {
result = vm_allocate_impl(addr, alignment, MEM_COMMIT);
if (!result) {
hermes_fatal(
"Failed to commit subsection of reserved memory in vm_allocate_aligned_impl",
result.getError());
}
return result;
} else {
return addr;
}
}
llvh::ErrorOr<void *> vm_allocate(size_t sz, void * /* hint */) {
#ifndef NDEBUG
assert(sz % page_size() == 0);
if (testPgSz != 0 && testPgSz > static_cast<size_t>(page_size_real())) {
return vm_allocate_aligned(sz, testPgSz);
}
if (LLVM_UNLIKELY(sz > totalVMAllocLimit)) {
return make_error_code(OOMError::TestVMLimitReached);
} else if (LLVM_UNLIKELY(totalVMAllocLimit != unsetVMAllocLimit)) {
totalVMAllocLimit -= sz;
}
#endif // !NDEBUG
return vm_allocate_impl(nullptr, sz, MEM_RESERVE | MEM_COMMIT);
}
llvh::ErrorOr<void *>
vm_allocate_aligned(size_t sz, size_t alignment, void *hint) {
constexpr bool commit = true;
return vm_allocate_aligned_impl(sz, alignment, commit, hint);
}
void vm_free(void *p, size_t sz) {
#ifndef NDEBUG
if (testPgSz != 0 && testPgSz > static_cast<size_t>(page_size_real())) {
vm_free_aligned(p, sz);
return;
}
#endif // !NDEBUG
if (std::error_code err = vm_free_impl(p, sz)) {
hermes_fatal("Failed to free virtual memory region", err);
}
#ifndef NDEBUG
if (LLVM_UNLIKELY(totalVMAllocLimit != unsetVMAllocLimit) && p) {
totalVMAllocLimit += sz;
}
#endif
}
void vm_free_aligned(void *p, size_t sz) {
// VirtualQuery is necessary because p may not be the base location
// of the allocation (due to possible fallback in vm_allocate_aligned_impl).
MEMORY_BASIC_INFORMATION mbi;
SIZE_T query_ret = VirtualQuery(p, &mbi, sizeof(MEMORY_BASIC_INFORMATION));
assert(query_ret != 0 && "Failed to invoke VirtualQuery in vm_free_aligned");
BOOL ret = VirtualFree(mbi.AllocationBase, 0, MEM_RELEASE);
assert(ret && "Failed to invoke VirtualFree in vm_free_aligned.");
(void)ret;
#ifndef NDEBUG
if (LLVM_UNLIKELY(totalVMAllocLimit != unsetVMAllocLimit) && p) {
totalVMAllocLimit += sz;
}
#endif
}
// TODO(T40416012): Implement these functions for Windows.
llvh::ErrorOr<void *>
vm_reserve_aligned(size_t sz, size_t alignment, void *hint) {
constexpr bool commit = false;
return vm_allocate_aligned_impl(sz, alignment, commit, hint);
}
void vm_release_aligned(void *p, size_t sz) {
vm_free_aligned(p, sz);
}
llvh::ErrorOr<void *> vm_commit(void *p, size_t sz) {
// n.b. the nullptr check here is important; Windows "helpfully" assumes you
// forgot to set MEM_RESERVE if you send in a null pointer with only
// MEM_COMMIT. If we didn't check p, mistakenly calling vm_commit with a
// nullptr p will succeed and *reserve and commit* the memory. see:
// https://devblogs.microsoft.com/oldnewthing/20151008-00/?p=91411
if (p == nullptr) {
// These are a bit "special case semantics" but for all intents and
// purposes we can treat this as an invalid operation
return std::error_code(ERROR_INVALID_OPERATION, std::system_category());
}
void *result = VirtualAlloc(p, sz, MEM_COMMIT, PAGE_READWRITE);
if (result == nullptr) {
// Windows does not have POSIX error codes, but defines its own set.
// Use system_category with GetLastError so that the codes are interpreted
// correctly.
return std::error_code(GetLastError(), std::system_category());
}
return result;
}
void vm_uncommit(void *, size_t) {}
void vm_hugepage(void *p, size_t sz) {
assert(
reinterpret_cast<uintptr_t>(p) % page_size() == 0 &&
"Precondition: pointer is page-aligned.");
}
void vm_unused(void *p, size_t sz) {
#ifndef NDEBUG
const size_t PS = page_size();
assert(
reinterpret_cast<intptr_t>(p) % PS == 0 &&
"Precondition: pointer is page-aligned.");
assert(sz % PS == 0 && "Precondition: size is page-aligned.");
#endif
// TODO(T40416012) introduce explicit "commit" in OSCompat abstraction of
// virtual memory
// Do nothing.
// In POSIX, a mem page implicitly transitions from "reserved" state to
// "committed" state on access. However, on Windows, accessing
// "reserved" but not "committed" page results in an access violation.
// There is no explicit call to transition to "committed" state
// in Hermes' virtual memory abstraction.
// As a result, even though Windows has an API to transition a page from
// "committed" state back to "reserved" state, we can not invoke it here.
}
void vm_prefetch(void *p, size_t sz) {
assert(
reinterpret_cast<intptr_t>(p) % page_size() == 0 &&
"Precondition: pointer is page-aligned.");
// TODO(T40415796) provide actual "prefetch" implementation
// Do nothing
}
void vm_name(void *p, size_t sz, const char *name) {
(void)p;
(void)sz;
(void)name;
}
bool vm_protect(void *p, size_t sz, ProtectMode mode) {
DWORD oldProtect;
DWORD newProtect = PAGE_NOACCESS;
if (mode == ProtectMode::ReadWrite) {
newProtect = PAGE_READWRITE;
}
BOOL err = VirtualProtect(p, sz, newProtect, &oldProtect);
return err != 0;
}
bool vm_madvise(void *p, size_t sz, MAdvice advice) {
// Not implemented.
return false;
}
llvh::ErrorOr<size_t> vm_footprint(char *start, char *end) {
return std::error_code(errno, std::generic_category());
}
int pages_in_ram(const void *p, size_t sz, llvh::SmallVectorImpl<int> *runs) {
// Not yet supported.
return -1;
}
uint64_t peak_rss() {
PROCESS_MEMORY_COUNTERS pmc;
auto ret = GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
if (ret != 0) {
// failed
return 0;
}
return pmc.PeakWorkingSetSize;
}
uint64_t current_rss() {
PROCESS_MEMORY_COUNTERS pmc;
auto ret = GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
if (ret != 0) {
// failed
return 0;
}
return pmc.WorkingSetSize;
}
uint64_t current_private_dirty() {
// Not yet supported.
return 0;
}
std::vector<std::string> get_vm_protect_modes(const void *p, size_t sz) {
// Not yet supported.
return std::vector<std::string>{};
}
bool num_context_switches(long &voluntary, long &involuntary) {
// Not yet supported.
voluntary = involuntary = -1;
return false;
}
uint64_t process_id() {
return GetCurrentProcessId();
}
uint64_t thread_id() {
return GetCurrentThreadId();
}
void set_thread_name(const char *name) {
// Set the thread name for TSAN. It doesn't share the same name mapping as the
// OS does. This macro expands to nothing if TSAN isn't on.
TsanThreadName(name);
// SetThreadDescription is too new (since Windows 10 version 1607).
// Prior to that, the concept of thread names only exists when
// a Visual Studio debugger is attached.
}
static std::chrono::microseconds::rep fromFileTimeToMicros(
const FILETIME &fileTime) {
ULARGE_INTEGER uli;
uli.LowPart = fileTime.dwLowDateTime;
uli.HighPart = fileTime.dwHighDateTime;
// convert from 100-nanosecond to microsecond
return uli.QuadPart / 10;
}
std::chrono::microseconds thread_cpu_time() {
FILETIME creationTime;
FILETIME exitTime;
FILETIME kernelTime;
FILETIME userTime;
GetThreadTimes(
GetCurrentThread(), &creationTime, &exitTime, &kernelTime, &userTime);
return std::chrono::microseconds(
fromFileTimeToMicros(kernelTime) + fromFileTimeToMicros(userTime));
}
bool thread_page_fault_count(int64_t *outMinorFaults, int64_t *outMajorFaults) {
// Windows provides GetProcessMemoryInfo. There is no counterpart of this
// API call for threads. In addition, it measures soft page faults.
// It may be possible to get per-thread information by using ETW (Event
// Tracing for Windows), which is probably overkill for the use case here.
// not supported on Windows
return false;
}
std::string thread_name() {
// SetThreadDescription/GetThreadDescription is too new (since
// Windows 10 version 1607).
// Prior to that, the concept of thread names only exists when
// a Visual Studio debugger is attached.
return "";
}
std::vector<bool> sched_getaffinity() {
// Not yet supported.
return std::vector<bool>();
}
int sched_getcpu() {
// Not yet supported.
return -1;
}
uint64_t cpu_cycle_counter() {
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
return __rdtsc();
#elif __has_builtin(__builtin_readcyclecounter)
return __builtin_readcyclecounter();
#else
LARGE_INTEGER cnt;
QueryPerformanceCounter(&cnt);
return static_cast<uint64_t>(cnt.QuadPart);
#endif
}
bool set_env(const char *name, const char *value) {
// Setting an env var to empty requires a lot of hacks on Windows
assert(*value != '\0' && "value cannot be empty string");
return _putenv_s(name, value) == 0;
}
bool unset_env(const char *name) {
return _putenv_s(name, "") == 0;
}
/// Windows does not have the concept of alternate signal stacks, so nothing to
/// do.
/*static*/
void *SigAltStackLeakSuppressor::stackRoot_{nullptr};
SigAltStackLeakSuppressor::~SigAltStackLeakSuppressor() {}
} // namespace oscompat
} // namespace hermes
#endif // _WINDOWS
|
8e204ad7eac7ac45e1444dc34065b0a7c7fb75be
|
220c245d5589146b1e0bb6f4f79f781f02c13227
|
/Uva/514.cpp
|
1b77f8ed875f18ad46176f8366191ed904d4c78f
|
[] |
no_license
|
hossamthapit/CompetitiveProgramming
|
f0d21f5f60f5b17d9004c3e6c431f97284b31450
|
dd072a92b7f268aa2c4ba7e4dfac358baa27e772
|
refs/heads/master
| 2021-01-25T13:29:20.933667
| 2021-01-05T12:31:03
| 2021-01-05T12:31:03
| 123,578,764
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,540
|
cpp
|
514.cpp
|
#include<bits/stdc++.h>
#define FAST ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
#define all(x) x.begin(),x.end()
#define szz(s) ll(s.size())
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define endl '\n'
void file()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);freopen("out.txt", "w", stdout);
#endif
}
int main(){
file();
int n , p = 0 ;
here:
while(cin >> n ){
if(p&&!n)return 0 ;
while(1){
deque < int > dq(n);
for(int i = 0 ; i < n ;i++){
cin >> dq[i];
if(dq[i]==0){p=1;cout << endl;goto here;}
}
p=0;
stack < int > stk ;
int k = n , yes = 1 ;
while(1){
bool e = 0 ;
while(szz(dq)&&dq.back()==k){
dq.pop_back();
k--;
e=1;
}
while(szz(stk)&&stk.top()==k){
stk.pop();
k--;
e=1;
}
while(szz(dq)&&dq.back()!=k){
stk.push(dq.back());
e=1;
dq.pop_back();
}
if(!e)break;
}
if(!k)cout << "Yes" << endl;
else cout << "No" << endl;
}
}
}
|
10241c49a43723e60546e1a8075992e70c4c667d
|
1c65bc244f46cbf07daf68df0cbb69ea649d4de0
|
/Cipher translation.cpp
|
efae8e7715bc2d24fd6bd71aabeacc56d78cd6d0
|
[] |
no_license
|
xueyaohuang/Cipher-translation
|
da3c90118b9556a8fc50095c643973ec538a48e6
|
eb0c55ecbfb7f01f99a7eeb069730211037f30b6
|
refs/heads/master
| 2021-06-12T08:46:00.938698
| 2016-12-29T08:25:54
| 2016-12-29T08:25:54
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 449
|
cpp
|
Cipher translation.cpp
|
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main()
{
unsigned int i, n;
string str;
cin >> n;
getchar();
while (n-- > 0)
{
getline(cin, str);
for (i = 0; str[i]!='\0'; i++)
if ((str[i] >= 'a'&&str[i] <= 'z') || (str[i] >= 'A'&&str[i] <= 'Z'))
{
str[i]++;
if (str[i] == ('z' + 1) || str[i] == ('Z'+1))
str[i] -= 26;
}
cout << str << endl;
}
return 0;
}
|
1366e0aaa5f2cef54abadcd465441716e319c28c
|
c665317312d8d63c0fe9f2ad6a4a28d771edd2cf
|
/assignment4/Assignment4.cpp
|
c4b5944337998ce41c80b0e974a54f732ed68ef4
|
[] |
no_license
|
jdidier001/My-Projects
|
6d90c6044f656ba502612e92965e07ea2bb81390
|
3fb19d6441fecc15c44547dbd2bf1849413dfeca
|
refs/heads/master
| 2020-07-07T02:18:04.540145
| 2016-12-13T17:56:11
| 2016-12-13T17:56:11
| 66,401,272
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 13,604
|
cpp
|
Assignment4.cpp
|
/*
_________________________________________________
Jared Didier
email:jdidier001@student.butte.edu
-------------------------------------------------
_________________________________________________
Assignment 4
11-28-16
------------------------------------------------
________________________________________________
Fall 2016 CSCI 20 – Programming and Algorithms I
instructor: A Browne
email: browneap@butte.edu
--------------------------------------------------
________________________________________________
Version # 1.0 - 11-28-16
_________________________________________________
**Notes**
*************************************
Submissions=
git add Assignment 4
git commit –a –m ‘Submissions Assignment 4’
git push
*/
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <chrono>
#include <string>
#include <fstream>
using namespace std;
//Initionalize the Variables
int art() {
cout << " Tying Digital Flies " << endl;
cout << " ______________________________" << endl;
cout << " ##### " << endl;
cout << " #*# " << endl;
cout << " * $$ " << endl;
cout << " #####$$$$$$$$$$$------ " << endl;
cout << " * $$ & " << endl;
cout << " #*# ] " << endl;
cout << " ##### & " << endl;
cout << " -^- " << endl;
cout << "Computerized FLies!" << endl << endl;
cout << "Copyright Jared W Didier 2016";
};
class StudentNAnswers{
public: // The class' public functions
ifstream inFS; // Input file stream
ofstream outFS; // Output string stream
string fileName; //For User file input
string testAnswers[21]; // array for test answers to be read into
string studentAnswers[6][23]; // array for students and student answer to be read into
double studentGradeTotal =0;
int i = 0;
int m = 0;
//Overload Consrctor
StudentNAnswers(int name)
{
fileName="";
studentGradeTotal =0;
};
//Default Constructor
StudentNAnswers()
{
return ;
};
// Set up the users file
int SetUserFile()
{
// Prompt user for filename
cout << "Enter file name: " << endl;
cin >> fileName;
cout << endl;
// Try to open file
inFS.open(fileName); // ************ Sholud be fileName for real program
if (!inFS.is_open()) {
cout << "Could not open file " << fileName << endl;
return 1;
}
//student answers - writes in to the studentAnswers Array
m=0;
while (m<6){
i=0;
while (i<23){
inFS >> studentAnswers[m][i];
cout << studentAnswers[m][i] << " ";
i++;}
cout << endl;
m++;}
cout << endl;
inFS.close(); // Done with file, close it
}
// Get the users file
string GetUserFile()
{
return studentAnswers[m][i];
}
// Set the answer key up
int SetTestAnswers(){
int zeroCount=0;
// Try to open file
inFS.open("answerkey.txt");
if (!inFS.is_open()) {
cout << "Could not open file answerkey.txt" << endl;
return 1;
}
//answer key - writes in to the testAnswers Array
m=0;
while ( m< 1){
i=0;
int questionCount =0;
while (i<21){
inFS >> testAnswers[i];
cout << testAnswers[i] << " ";// << "was entered " << " ";
questionCount = questionCount + 1;
i++;}
cout << endl;
m++;}
inFS.close(); // Done with file, closing it
}
string GetTestAnswers()
{
return testAnswers[i];
}
};
// ******************** Trying to make a function *******************
string CompareData(){
string testAnswers[21]; // array for test answers to be read into
string studentAnswers[6][23]; // array for students and student answer to be read into
string studentPerQuesScore[6][23]; //for score per question per student
double studentTotals[6][1];
int zeroCount=0;
int wrongCount=0;
int rightCount=0;
double totalCount=0;
int m = 0;
int questionCount =0;
double classAverage=0;
ifstream inFile;
ofstream outFS; // Output string stream
outFS.open("testscoreoutput.txt");
StudentNAnswers test1;
test1.SetUserFile();
test1.SetTestAnswers();
test1.GetTestAnswers();
test1.GetUserFile();
while ( m < 6){
totalCount=0;
questionCount =0;
int i=0;
while (i<21){
questionCount=questionCount+1;
string str1 = test1.studentAnswers[m][i+2];
string str2 = test1.testAnswers[i];
//cout << "Student Answer = " << str1 << " and Test Answer = " << str2 << endl <<endl;
if (str1.compare("?") == 0){
//cout << str1 << " means was left blank No Match too " << str2 << "no points not deduction." << '\n';
studentPerQuesScore[m][i] = test1.studentAnswers[m][i+2];
zeroCount= zeroCount +1;
}
else if (str1.compare(str2) != 0){
// cout << str1 << " is incorrect and does not match " << str2 << " minus 0.25!" << '\n';
studentPerQuesScore[m][i] = test1.studentAnswers[m][i+2];
totalCount = totalCount - .25;
wrongCount = wrongCount +1;
}
else if (str1.compare(str2) == 0){
// cout << str1 << " is CORRECT! Plus one! " << str2 << '\n';
studentPerQuesScore[m][i] = 'X';
totalCount = totalCount + 1;
rightCount = rightCount + 1;
}
i++; }
studentTotals[m][0]= totalCount;
m++;}
cout << rightCount << " Right. " << wrongCount << " Wrong. " << zeroCount << " not answered. "<< endl;
outFS << rightCount << " Right. " << wrongCount << " Wrong. " << zeroCount << " not answered. "<< endl;
cout << endl << "Grand Totals are Rights = 34 Wrongs = 56 ? = 36" << endl<< endl;
m = 0;
while ( m < 6){
cout << test1.studentAnswers[m][0] << " " << test1.studentAnswers[m][1] << ": Test Score ** " << studentTotals[m][0] << " ** points scored on this test here are the questions that were wrong or ? for unanswered questions. " << endl;
outFS << test1.studentAnswers[m][0] << " " << test1.studentAnswers[m][1] << ": Test Score ** " << studentTotals[m][0] << " ** points scored on this test here are the questions that were wrong or ? for unanswered questions. " << endl;
classAverage = classAverage + studentTotals[m][0];
//cout << classAverage << " Class Average " << endl;
int i=0;
while (i<21){
if (studentPerQuesScore[m][i] != "X"){
cout << i+1 << ". " << studentPerQuesScore[m][i] << " ";
outFS << i+1 << ". " << studentPerQuesScore[m][i] << " ";
}
i++;}
m++;
cout << endl << endl;
}
classAverage = (classAverage/6);
cout << endl << "The class average was " << classAverage << endl;
outFS << endl << "The class average was " << classAverage << endl;
outFS.close();
}
int main(){
CompareData();
}
/*
Assignment #4 Test Grading program –
#### This program will read in student answers for a test and compare the answers to the corresponding answer key for the test.
#### It should prompt the user for a text file to read.
#### 1 point is awarded for each correct answer, omitted answers get 0 points, and incorrect answers deduct ¼ point.
#### The program should output to the screen and a file the student’s name, overall grade on the exam and each omitted or incorrect question.
#### It should then compute the class average grade and if there were
any questions that more than 50% of the class omitted or got incorrect.
PseudoCode:
Class StudentNAnswers;
Files to read in:
studentanswer.txt
answerkey.txt
Array needed:
UserFileIn[];
Evaluation Array[]:
Variables needed:
string userFile:
int studentGradeTotal;
int ClassTotal;
Begin running program:
Get users file name and read in
Compare to AnswerKey
if statements to compare and add the student grades up.
Output to evaluation array
Evaluate number of students missed question
Calculate averages & Output to screen and File
string str1 = test1.studentAnswers[m][i+2];
string str2 = test1.studentAnswers[m+1][i+2];
string str3 = test1.studentAnswers[m+2][i+2];
string str4 = test1.studentAnswers[m+3][i+2];
string str5 = test1.studentAnswers[m+4][i+2];
string str6 = test1.studentAnswers[m+5][i+2];
//cout << "Student Answer = " << str1 << " and Test Answer = " << str2 << endl <<endl;
if (str1.compare("?") == 0){
//cout << str1 << " means was left blank No Match too " << str2 << "no points not deduction." << '\n';
studentPerQuesScore[m][i] = test1.studentAnswers[m][i+2];
zeroCount= zeroCount +1;
}
else if (str1.compare(str2) != 0){
// cout << str1 << " is incorrect and does not match " << str2 << " minus 0.25!" << '\n';
studentPerQuesScore[m][i] = test1.studentAnswers[m][i+2];
totalCount = totalCount - .25;
wrongCount = wrongCount +1;
}
else if (str1.compare(str2) == 0){
// cout << str1 << " is CORRECT! Plus one! " << str2 << '\n';
studentPerQuesScore[m][i] = 'X';
totalCount = totalCount + 1;
rightCount = rightCount + 1;
}
*/
|
23b068c7a647b62f246b3772b719d9ea039c41d3
|
286f0517720fcb9102e29b59ac058a69a0627a3c
|
/lab6assignmnent/lab63.cpp
|
ee4c6758073860e9cf8108e4007a3ebdd97804ae
|
[] |
no_license
|
Akshayjain60165/Assignment
|
8421e4812902d42e7132f2dea025528a372fa211
|
beef9989ffc2d11877dd61f809cf82cdcb55d8ce
|
refs/heads/master
| 2022-12-02T18:23:18.366138
| 2020-08-14T12:27:00
| 2020-08-14T12:27:00
| 287,526,895
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,156
|
cpp
|
lab63.cpp
|
#include <iostream>
using namespace std;
struct node{
int data;
node* left;
node* right;
};
class avlTree{
public:
node* root;
avlTree(){root = NULL;}
//HEIGHT OF TREE
int height(node* ptr){
if(ptr == NULL)
return 0;
int leftHeight, rightHeight;
leftHeight = height(ptr->left);
rightHeight = height(ptr->right);
if(leftHeight > rightHeight)
return leftHeight + 1;
else return rightHeight + 1;
}
//HEIGHT DIFFERENCE BETWEEN LEFT AND RIGHT SUBTREES OF PTR
int heightDiff(node* ptr){
return height(ptr->left) - height(ptr->right);
}
//LEFTROTATE ABOUT PTR
void leftRotate(node*& ptr){
if(ptr == NULL)
return;
node* temp = ptr->right;
ptr->right = ptr->right->left;
temp->left = ptr;
ptr = temp;
}
//RIGHTROTATE ABOUT PTR
void rightRotate(node*& ptr){
if(ptr == NULL)
return;
node* temp = ptr->left;
ptr->left = ptr->left->right;
temp->right = ptr;
ptr = temp;
}
//REBALANCE ABOUT PTR
void rebalanceTree(node*& ptr){
if(ptr == NULL)
return;
if(heightDiff(ptr) > 1){
//left-left type
if(heightDiff(ptr->left) >= 1)
rightRotate(ptr);
//left-right type
else if(heightDiff(ptr->left) <= -1){
leftRotate(ptr->left);
rightRotate(ptr);
}
}
else if(heightDiff(ptr) < -1){
//right-right type
if(heightDiff(ptr->right) <= -1)
leftRotate(ptr);
//right-left type
else if(heightDiff(ptr->right) >= 1){
rightRotate(ptr->right);
leftRotate(ptr);
}
}
rebalanceTree(ptr->left);
rebalanceTree(ptr->right);
}
//INSERTS A NODE AND BALANCES TREE
void addNode(node*& ptr, int elem){
if(ptr == NULL){
node* temp = new node();
temp->data = elem;
temp->left = NULL;
temp->right = NULL;
ptr = temp;
rebalanceTree(root);
return;
}
if(ptr->data >= elem)
addNode(ptr->left,elem);
else addNode(ptr->right,elem);
}
//DELETES A NODE AND REBALANCES TREE
void deleteNode(node*& ptr, int elem){
if(ptr == NULL)
return;
else if(elem > ptr->data)
deleteNode(ptr->right,elem);
else if(elem < ptr->data)
deleteNode(ptr->left,elem);
else{
if(ptr->left == NULL && ptr->right == NULL){
ptr = NULL;
rebalanceTree(root);
return;
}
node* temp = ptr->right;
while(temp!= NULL && temp->left != NULL)
temp = temp->left;
ptr->data = temp->data;
deleteNode(ptr->right,temp->data);
rebalanceTree(root);
return;
}
}
//CHECKS IF TREE IS BALANCED
bool isBalanced(node* ptr){
if(ptr == NULL)
return true;
if(height(ptr->left) - height(ptr->right) > 1 || height(ptr->left) - height(ptr->right) < -1)
return false;
return isBalanced(ptr->left) && isBalanced(ptr->right);
}
//LEVEL ORDER TRAVERSAL
void printLevelOrder(node* ptr){
int level = height(ptr);
int j;
for(j=1;j<=level;j++){
printCurrentLevel(ptr,j);
}
cout << endl;
}
//PRINTS CURRENT LEVEL
void printCurrentLevel(node* ptr, int level){
if(ptr==NULL)
return;
if(level == 1)
cout << ptr->data << " ";
else if(level > 1){
printCurrentLevel(ptr->left,level-1);
printCurrentLevel(ptr->right,level-1);
}
}
//RETURNS ROOT
node* getRoot(){
return root;
}
};
int main(){
avlTree tree;
cout << "Select the operation and enter the number to inserted or deleted." << endl;
cout << "1) Insertion" << endl << "2) Deletion" << endl;
int i,elem;
while(1){
cin >> i;
if(i==1){
cin >> elem;
cout << "List before the operation: ";
tree.printLevelOrder(tree.root);
cout << "List after the operation: ";
tree.addNode(tree.root,elem);
tree.printLevelOrder(tree.root);
}
else if(i==2){
cin >> elem;
cout << "List before the operation: ";
tree.printLevelOrder(tree.root);
cout << "List after the operation: ";
tree.deleteNode(tree.root,elem);
tree.printLevelOrder(tree.root);
}
else if(i!=1 || i!= 2)
break;
}
return 0;
}
|
a5d4811051f8048adaa57ddbb38cbd3eb0dcdf4a
|
ea3683c840a241ad0feb816937f0d1b978cef1fb
|
/01Basics/quick_sort.cpp
|
61d0a9a50ee364c4e705ea780defa8f541b53205
|
[] |
no_license
|
vinay-yadav/Getting-Started-with-C-plusplus
|
eb7c0e73984b2bd6a72e121910cded5ab0e83fe4
|
c01e1e69955c7fbec75c4e00acc749cc15216a91
|
refs/heads/master
| 2023-06-19T08:30:32.976775
| 2021-07-15T15:28:15
| 2021-07-15T15:28:15
| 347,006,794
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 766
|
cpp
|
quick_sort.cpp
|
#include <bits/stdc++.h>
using namespace std;
int partition(int arr[], int low, int high){
int i = low - 1, pivot = arr[high];
for(int j = low; j < high; ++j){
if(arr[j] <= pivot){
i++;
swap(arr[i], arr[j]);
}
}
swap(arr[i+1], arr[high]);
return i+1;
}
void quickSort(int arr[], int low, int high){
if(low < high){
int pi = partition(arr, low, high);
quickSort(arr, low, pi-1);
quickSort(arr, pi+1, high);
}
}
void printList(int arr[], int size){
for(int i=0; i < size; ++i)
cout << arr[i] << " ";
cout << endl;
}
int main(){
int arr[] = {10, 80, 30, 90, 40, 50, 70};
int size = sizeof(arr)/sizeof(arr[0]);
cout << "Before: ";
printList(arr, size);
quickSort(arr, 0, size-1);
cout << "After: ";
printList(arr, size);
}
|
a6202e589c2b71249f72518694fd30f823fd5b90
|
a6bd0fddbd5148a0b44ec4b49204ef5d7508ff8b
|
/src/Objet.cpp
|
155485cea86815022c69511daae8cb83ca9a5ad9
|
[] |
no_license
|
GuillaumeRahbari/Robot
|
a6ebafbb30d9a6432357b83905573f360e63e93b
|
c8f824581d14f7b61aa3e0eb83f4b547b8ed0ee7
|
refs/heads/master
| 2021-01-21T07:35:02.171189
| 2015-01-04T10:13:13
| 2015-01-04T10:13:13
| 25,627,905
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 295
|
cpp
|
Objet.cpp
|
//
// Objet.cpp
// Robot
//
#include "Objet.h"
using namespace std;
Objet::Objet (int poids) : poids(poids){}
ostream& operator<< (ostream& flux, Objet const& objet){
flux << "La poids est : " << objet.getPoids();
return flux;
}
int Objet::getPoids() const{
return this->poids;
}
|
39d0d5aeaff46ab79fb2d15d9bc5dfc457c6ef7e
|
f11c546227ccaf79759fc00aa6c6f7c7df9ac78b
|
/Game/.svn/text-base/DebrisEffect.hpp.svn-base
|
61dacc3bd1b360d96a200c51ee61897265ca28ca
|
[] |
no_license
|
jefrsilva/PGCPandora
|
23450213b199683326d7e94d7e0ebbbfd4f565ae
|
b876470932648f9511f49ddf8e09ae33120df2b5
|
refs/heads/master
| 2020-05-18T12:55:20.117658
| 2012-08-29T11:19:00
| 2012-08-29T11:19:00
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 636
|
DebrisEffect.hpp.svn-base
|
#ifndef _INC_DEBRISEFFECT_HPP
#define _INC_DEBRISEFFECT_HPP
#include "VisualEffect.hpp"
#include "Region.hpp"
#include "BoundingCircle.hpp"
#include "Color.hpp"
#include <Engine/Mantis.hpp>
class DebrisEffect : public VisualEffect {
private:
bool dead;
Vector position;
Vector start;
Vector end;
int finalDuration;
int duration;
int orientation;
Color color;
public:
DebrisEffect(Vector position, Vector destination, int orientation,
int duration, Color color);
~DebrisEffect();
bool isDead();
void update();
void render(const Region &view);
BoundingCircle getBoundingCircle();
};
#endif
|
|
ca1cf2f9fe6e8d5b8ee9965f9e54e782a8fbdee7
|
ba23e2bbc549f23ebff25a1ce8ba9cab1e48be67
|
/algorithm/c++/test/TestClass.cpp
|
3bc0e3fcabaecd25da04d9a32b7421d2a4f5fb4f
|
[] |
no_license
|
choice17/git-note
|
2357687491277f4c8c272778b6a0001804d8bacd
|
ba89a2efb76e0fbe0709817c00ecb6a5460b82b7
|
refs/heads/master
| 2023-07-20T18:47:37.463683
| 2023-07-14T04:23:44
| 2023-07-14T04:23:44
| 103,606,286
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 197
|
cpp
|
TestClass.cpp
|
#include "TestClass.h"
#include <iostream>
TestClass::TestClass()
{
std::cout << "Created TestClass\n";
}
TestClass::~TestClass()
{
}
void TestClass::gimme()
{
std::cout << "Called gimme\n";
}
|
c34bfdf9c7da744ce4429ae65edeeb23b01f1c57
|
4ae0e872c106c9ee5e9d1491c0f0b6faf66e7d9d
|
/AlgorithmLibrary/剑指offer/InterviewProblem9.hpp
|
20431915b8ca74252fff0531d8b8b58cead875a3
|
[] |
no_license
|
imerakk/AlgorithmLibrary
|
21eab76071e3263c392ecf5db4315a47e8a67a78
|
7be423df381273b0c0247701bda52878e6bd3dab
|
refs/heads/master
| 2020-04-24T08:10:24.740113
| 2019-05-29T03:11:21
| 2019-05-29T03:11:21
| 171,822,710
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 304
|
hpp
|
InterviewProblem9.hpp
|
//
// InterviewProblem9.hpp
// AlgorithmLibrary
//
// Created by liuchunxi on 2019/2/28.
// Copyright © 2019年 imera. All rights reserved.
//
#ifndef InterviewProblem9_hpp
#define InterviewProblem9_hpp
#include <stdio.h>
long long TotalCount(unsigned int n);
#endif /* InterviewProblem9_hpp */
|
ec520e51ed9a97982558931cbccaff9cc643a58c
|
dff79ca9c6dda6ad69bdd53a2fb2c150bd262d3f
|
/services/imageservice.cpp
|
936039ddcd7e8975dacd3a243f040d09047842e1
|
[] |
no_license
|
gurmaaan/CancerAnalysis
|
e448a3272bdefdd7d0385a817098255d5b29f542
|
a6e5966220cc4cebf000a40476f948718477911f
|
refs/heads/master
| 2020-03-27T19:58:27.618778
| 2018-09-05T16:00:32
| 2018-09-05T16:00:32
| 147,026,763
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,048
|
cpp
|
imageservice.cpp
|
#include "imageservice.h"
ImageService::ImageService()
{
}
QPixmap ImageService::addRect(QPixmap &pm, int w, QColor clr)
{
QImage img = QImage(pm.toImage());
QColor baseClr = img.pixelColor(pm.width() / 2, pm.height() / 2);
for (int i = 0; i < img.height(); i++) {
for (int j = 0; j < img.width(); j++)
{
if(borderArea(img, i, j, w))
img.setPixelColor(j,i, clr);
else
img.setPixelColor(j, i, baseClr);
}
}
pm = QPixmap::fromImage(img);
return pm;
}
QImage *ImageService::threshold(QImage *img, int val)
{
QImage *trImg = new QImage(img->size(), QImage::Format_Grayscale8);
for (int i = 0; i < img->width(); i++) {
for (int j = 0; j < img->height(); j++)
{
int grVal = qGray(img->pixelColor(i, j).rgb());
if(grVal <= val)
trImg->setPixelColor(i, j, QColor(Qt::black));
else
trImg->setPixelColor(i, j, QColor(Qt::white));
}
}
return trImg;
}
bool ImageService::colorRange(QColor test, QColor etalon, int percentage)
{
int eR = qRed(etalon.rgb());
int eG = qGreen(etalon.rgb());
int eB = qBlue(etalon.rgb());
double koeff = static_cast<double>(static_cast<double>(percentage) / static_cast<double>(100));
int eRMin = eR - static_cast<int>(eR*koeff);
eRMin = (eRMin >= 0) ? eRMin : 0;
int eGMin = eG - static_cast<int>(eG*koeff);
eGMin = (eGMin >= 0) ? eGMin : 0;
int eBMin = eB - static_cast<int>(eB*koeff);
eBMin = (eBMin >= 0) ? eBMin : 0;
int eRMax = eR + static_cast<int>(eR*koeff);
eRMax = (eRMax <= 255) ? eRMax : 255;
int eGMax = eG + static_cast<int>(eG*koeff);
eGMax = (eGMax <= 255) ? eGMax : 255;
int eBMax = eB + static_cast<int>(eB*koeff);
eBMax = (eBMax <= 255) ? eBMax : 255;
int tR = qRed(test.rgb());
int tG = qGreen(test.rgb());
int tB = qBlue(test.rgb());
bool cROk = false;
bool cGOk = false;
bool cBOk = false;
if(tR >= eRMin && tR <= eRMax)
cROk = true;
if(tG >= eGMin && tG <= eGMax)
cGOk = true;
if(tB >= eBMin && tB <= eBMax)
cBOk = true;
return cROk && cGOk && cBOk;
}
QVector<QPoint> ImageService::selectWhiteArea(QImage *img, QImage *tr, QColor areaColor, QPoint startPoint)
{
QVector<QPoint> areaPoints;
//вправо вверх
for (int i = startPoint.x(); i < img->width(); i++)
{
for (int j = startPoint.y(); j >=0; j--)
{
if( colorRange(img->pixelColor(i,j), areaColor, 5))
{
QPoint p = QPoint(i, j);
areaPoints.append(p);
}
}
}
for(int i = startPoint.x(); i >= 0; i--)
{
for(int j = startPoint.y(); j < img->height(); j++)
{
if( colorRange(img->pixelColor(i,j), areaColor, 5))
{
QPoint p = QPoint(i, j);
areaPoints.append(p);
}
}
}
return areaPoints;
}
int ImageService::areaW(QVector<QPoint> areaPoints)
{
QVector<int> xV;
for(auto p : areaPoints)
xV << p.x();
int lx = FloatService::min(xV);
int rx = FloatService::max(xV);
int w = rx - lx;
if(w >= 0)
return w;
else
return -w;
}
int ImageService::areaH(QVector<QPoint> areaPoints)
{
QVector<int> yV;
for(auto p : areaPoints)
yV << p.y();
int tY = FloatService::min(yV);
int bY = FloatService::max(yV);
int h = bY - tY;
if(h >= 0)
return h;
else
return -h;
}
bool ImageService::borderArea(QImage img, int i, int j, int w)
{
bool top = false;
bool bot = false;
bool lef = false;
bool rig = false;
bool res = false;
top = ( (i>=img.height()-1-w) && (i<=img.height()-1) );
bot = ( (j>=img.width() -1-w) && (j<=img.width() -1) );
lef = ( (j>=0) && (j<=w) );
rig = ( (i>=0) && (i<=w) );
res = top || bot || lef || rig;
return res;
}
|
b9bbee46b89e31c955a0fe81dd90a1b83d9eb42e
|
569d64661f9e6557022cc45428b89eefad9a6984
|
/code/gameholder/item_config_manager.cpp
|
422631c612022524696d8243c93c52646695fd28
|
[] |
no_license
|
dgkang/ROG
|
a2a3c8233c903fa416df81a8261aab2d8d9ac449
|
115d8d952a32cca7fb7ff01b63939769b7bfb984
|
refs/heads/master
| 2020-05-25T02:44:44.555599
| 2019-05-20T08:33:51
| 2019-05-20T08:33:51
| 187,584,950
| 0
| 1
| null | 2019-05-20T06:59:06
| 2019-05-20T06:59:05
| null |
GB18030
|
C++
| false
| false
| 23,998
|
cpp
|
item_config_manager.cpp
|
#include "gameholder_pch.h"
#include "item_config_manager.h"
#include "item_equip.h"
#include "game_util.h"
IMPLEMENT_SINGLETON(ItemConfigManager)
ItemConfigManager::ItemConfigManager() :
m_EquipStarUpMax(0)
{
EQUIP_ENTRY::CreateInstance();
CONSUME_ENTRY::CreateInstance();
MATERIAL_ENTRY::CreateInstance();
STONE_ENTRY::CreateInstance();
EQUIP_ATTRIBUTE_ENTRY::CreateInstance();
EQUIP_QUALITY_ATTRIBUTE_ENTRY::CreateInstance();
EQUIP_QUALITY_UP_ENTRY::CreateInstance();
EQUIP_WASH_UP_ENTRY::CreateInstance();
EQUIP_STAR_UP_ENTRY::CreateInstance();
EQUIP_ENCHANTMENT_ENTRY::CreateInstance();
}
ItemConfigManager::~ItemConfigManager()
{
EQUIP_ENTRY::DestroyInstance();
CONSUME_ENTRY::DestroyInstance();
MATERIAL_ENTRY::DestroyInstance();
STONE_ENTRY::DestroyInstance();
EQUIP_ATTRIBUTE_ENTRY::DestroyInstance();
EQUIP_QUALITY_ATTRIBUTE_ENTRY::DestroyInstance();
EQUIP_QUALITY_UP_ENTRY::DestroyInstance();
EQUIP_WASH_UP_ENTRY::DestroyInstance();
EQUIP_STAR_UP_ENTRY::DestroyInstance();
EQUIP_ENCHANTMENT_ENTRY::DestroyInstance();
}
bool ItemConfigManager::LoadConfig( const char* path )
{
if (EQUIP_ENTRY::Instance()->LoadConfig(path))
{
m_EquipMap.clear();
const EQUIP_ROOT_STRUCT& RootStruct = EQUIP_ENTRY::Instance()->GetStruct();
std::vector<EQUIP_ROOT_TEMPLATE_STRUCT>::const_iterator cIter = RootStruct.template_list.begin();
for (; cIter != RootStruct.template_list.end(); ++cIter)
{
if (m_EquipMap.end() != m_EquipMap.find(cIter->id))
{
CnWarn("EQUIP duplicate id = %d!\n", cIter->id);
continue;
}
m_EquipMap.insert(std::make_pair(cIter->id, &(*cIter)));
}
}
else
{
return false;
}
if (CONSUME_ENTRY::Instance()->LoadConfig(path))
{
m_ConsumeMap.clear();
const CONSUME_ROOT_STRUCT& RootStruct = CONSUME_ENTRY::Instance()->GetStruct();
std::vector<CONSUME_ROOT_TEMPLATE_STRUCT>::const_iterator cIter = RootStruct.template_list.begin();
for (; cIter != RootStruct.template_list.end(); ++cIter)
{
if (m_ConsumeMap.end() != m_ConsumeMap.find(cIter->id))
{
CnWarn("CONSUME duplicate id = %d!\n", cIter->id);
continue;
}
m_ConsumeMap.insert(std::make_pair(cIter->id, &(*cIter)));
}
}
else
{
return false;
}
if (MATERIAL_ENTRY::Instance()->LoadConfig(path))
{
m_MaterialMap.clear();
const MATERIAL_ROOT_STRUCT& RootStruct = MATERIAL_ENTRY::Instance()->GetStruct();
std::vector<MATERIAL_ROOT_TEMPLATE_STRUCT>::const_iterator cIter = RootStruct.template_list.begin();
for (; cIter != RootStruct.template_list.end(); ++cIter)
{
if (m_MaterialMap.end() != m_MaterialMap.find(cIter->id))
{
CnWarn("MATERIAL duplicate id = %d!\n", cIter->id);
continue;
}
m_MaterialMap.insert(std::make_pair(cIter->id, &(*cIter)));
}
}
else
{
return false;
}
if (STONE_ENTRY::Instance()->LoadConfig(path))
{
m_StoneMap.clear();
const STONE_ROOT_STRUCT& RootStruct = STONE_ENTRY::Instance()->GetStruct();
std::vector<STONE_ROOT_TEMPLATE_STRUCT>::const_iterator cIter = RootStruct.template_list.begin();
for (; cIter != RootStruct.template_list.end(); ++cIter)
{
if (m_StoneMap.end() != m_StoneMap.find(cIter->id))
{
CnWarn("STONE duplicate id = %d!\n", cIter->id);
continue;
}
m_StoneMap.insert(std::make_pair(cIter->id, &(*cIter)));
}
}
else
{
return false;
}
if (EQUIP_ATTRIBUTE_ENTRY::Instance()->LoadConfig(path))
{
m_EquipAttributeMap.clear();
const EQUIP_ATTRIBUTE_ROOT_STRUCT& RootStruct = EQUIP_ATTRIBUTE_ENTRY::Instance()->GetStruct();
std::vector<EQUIP_ATTRIBUTE_ROOT_MODIFIER_STRUCT>::const_iterator cIter = RootStruct.modifier_list.begin();
for (; cIter != RootStruct.modifier_list.end(); ++cIter)
{
if (m_EquipAttributeMap.end() != m_EquipAttributeMap.find(cIter->id))
{
CnWarn("EQUIP_ATTRIBUTE duplicate id = %d!\n", cIter->id);
continue;
}
m_EquipAttributeMap.insert(std::make_pair(cIter->id, &(*cIter)));
InsertToGradeMap(&(*cIter));
InsertToPropMap(&(*cIter));
}
}
else
{
return false;
}
if(EQUIP_QUALITY_ATTRIBUTE_ENTRY::Instance()->LoadConfig(path))
{
const EQUIP_QUALITY_ATTRIBUTE_ROOT_STRUCT& RootStruct = EQUIP_QUALITY_ATTRIBUTE_ENTRY::Instance()->GetStruct();
std::vector<uint32> empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_1] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_2] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_3] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_4] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_5] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_6] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_7] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_8] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_9] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_10] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_11] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_12] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_13] = empty;
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_14] = empty;
std::vector<EQUIP_QUALITY_ATTRIBUTE_ROOT_PROP_STRUCT>::const_iterator cIter = RootStruct.prop_list.begin();
for(; cIter != RootStruct.prop_list.end(); ++cIter)
{
uint32 prop_id = cIter->id;
std::vector<uint32> equipClassIDs;
const EQUIP_QUALITY_ATTRIBUTE_ROOT_PROP_STRUCT& PropStruct = *cIter;
if(PropStruct.class_1)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_1);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_1].push_back(prop_id);
}
if(PropStruct.class_2)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_2);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_2].push_back(prop_id);
}
if(PropStruct.class_3)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_3);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_3].push_back(prop_id);
}
if(PropStruct.class_4)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_4);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_4].push_back(prop_id);
}
if(PropStruct.class_5)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_5);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_5].push_back(prop_id);
}
if(PropStruct.class_6)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_6);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_6].push_back(prop_id);
}
if(PropStruct.class_7)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_7);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_7].push_back(prop_id);
}
if(PropStruct.class_8)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_8);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_8].push_back(prop_id);
}
if(PropStruct.class_9)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_9);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_9].push_back(prop_id);
}
if(PropStruct.class_10)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_10);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_10].push_back(prop_id);
}
if(PropStruct.class_11)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_11);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_11].push_back(prop_id);
}
if(PropStruct.class_12)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_12);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_12].push_back(prop_id);
}
if(PropStruct.class_13)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_13);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_13].push_back(prop_id);
}
if(PropStruct.class_14)
{
equipClassIDs.push_back(EQUIP_SUB_TYPE_14);
m_EquipQualityAttributeClassMap[EQUIP_SUB_TYPE_14].push_back(prop_id);
}
m_EquipQualityAttributePropMap[prop_id] = equipClassIDs;
}
}
if (EQUIP_QUALITY_UP_ENTRY::Instance()->LoadConfig(path))
{
m_EquipQualityUpMap.clear();
const EQUIP_QUALITY_UP_ROOT_STRUCT& RootStruct = EQUIP_QUALITY_UP_ENTRY::Instance()->GetStruct();
std::vector<EQUIP_QUALITY_UP_ROOT_HEAD_STRUCT>::const_iterator cIter = RootStruct.head_list.begin();
for (; cIter != RootStruct.head_list.end(); ++cIter)
{
std::string key = Crown::ToString(cIter->quality);
if (m_EquipQualityUpMap.end() != m_EquipQualityUpMap.find(key))
{
CnWarn("EQUIP_ATTRIBUTE duplicate id = %d!\n", cIter->id);
continue;
}
m_EquipQualityUpMap[key] = &(*cIter);
}
}
else
{
return false;
}
if (EQUIP_WASH_UP_ENTRY::Instance()->LoadConfig(path))
{
/*
m_EquipWashUpMap.clear();
const EQUIP_WASH_UP_ROOT_STRUCT& RootStruct = EQUIP_WASH_UP_ENTRY::Instance()->GetStruct();
m_EquipWashUpMap[0] = &RootStruct.head; */
m_EquipWashUpMap.clear();
const EQUIP_WASH_UP_ROOT_STRUCT& RootStruct = EQUIP_WASH_UP_ENTRY::Instance()->GetStruct();
std::vector<EQUIP_WASH_UP_ROOT_HEAD_STRUCT>::const_iterator cIter = RootStruct.head_list.begin();
uint32 key = 0;
for (; cIter != RootStruct.head_list.end(); ++cIter)
{
if (m_EquipWashUpMap.end() != m_EquipWashUpMap.find(cIter->id))
{
CnWarn("EQUIP_ATTRIBUTE duplicate id = %d!\n", cIter->id);
continue;
}
m_EquipWashUpMap[key] = &(*cIter);
key++ ;
}
}
else
{
return false;
}
if (EQUIP_STAR_UP_ENTRY::Instance()->LoadConfig(path))
{
m_EquipStarUpMap.clear();
m_EquipStarUpMax = 0;
const EQUIP_STAR_UP_ROOT_STRUCT& RootStruct = EQUIP_STAR_UP_ENTRY::Instance()->GetStruct();
std::vector<EQUIP_STAR_UP_ROOT_HEAD_STRUCT>::const_iterator cIter = RootStruct.head_list.begin();
for (; cIter != RootStruct.head_list.end(); ++cIter)
{
uint32 key = cIter->star;
if (m_EquipStarUpMap.end() != m_EquipStarUpMap.find(key))
{
CnWarn("EQUIP_STAR_UP duplicate star = %d!\n", key);
continue;
}
uint32 star = cIter->star;
if (m_EquipStarUpMax < star)
{
m_EquipStarUpMax = star;
}
m_EquipStarUpMap[key] = &(*cIter);
}
}
else
{
return false;
}
if (EQUIP_ENCHANTMENT_ENTRY::Instance()->LoadConfig(path))
{
m_EquipEnchantMap.clear();
const EQUIP_ENCHANTMENT_ROOT_STRUCT& RootStruct = EQUIP_ENCHANTMENT_ENTRY::Instance()->GetStruct();
std::vector<EQUIP_ENCHANTMENT_ROOT_FORMULA_STRUCT>::const_iterator cIter = RootStruct.formula_list.begin();
for (; cIter != RootStruct.formula_list.end(); ++cIter)
{
uint32 key = cIter->attribute_id;
if (m_EquipEnchantMap.end() != m_EquipEnchantMap.find(key))
{
CnWarn("EQUIP_ENCHANTMENT duplicate attribute_id = %d!\n", key);
continue;
}
m_EquipEnchantMap[key] = &(*cIter);
}
}
else
{
return false;
}
return true;
}
const std::vector<uint32>* ItemConfigManager::FindCanPropIdListByEquipClass(uint32 equip_class) const
{
TpltEquipQualityAttributeClassMap::const_iterator citer = m_EquipQualityAttributeClassMap.find(equip_class);
if(citer == m_EquipQualityAttributeClassMap.end())
{
CnAssert(false);
return NULL;
}
return &citer->second;
}
const EQUIP_ROOT_TEMPLATE_STRUCT* ItemConfigManager::FindEquipTpltById( uint32 id ) const
{
TpltEquipMap::const_iterator cIter = m_EquipMap.find(id);
if (m_EquipMap.end() == cIter)
{
return NULL;
}
return cIter->second;
}
const CONSUME_ROOT_TEMPLATE_STRUCT* ItemConfigManager::FindConsumeTpltById( uint32 id ) const
{
TpltConsumeMap::const_iterator cIter = m_ConsumeMap.find(id);
if (m_ConsumeMap.end() == cIter)
{
return NULL;
}
return cIter->second;
}
const MATERIAL_ROOT_TEMPLATE_STRUCT* ItemConfigManager::FindMaterialTpltById( uint32 id ) const
{
TpltMaterialMap::const_iterator cIter = m_MaterialMap.find(id);
if (m_MaterialMap.end() == cIter)
{
return NULL;
}
return cIter->second;
}
const STONE_ROOT_TEMPLATE_STRUCT* ItemConfigManager::FindStoneTpltById(uint32 id) const
{
TpltStoneMap::const_iterator cIter = m_StoneMap.find(id);
if (m_StoneMap.end() == cIter)
{
return NULL;
}
return cIter->second;
}
const EQUIP_QUALITY_UP_ROOT_HEAD_STRUCT* ItemConfigManager::FindQualityUpData(uint32 quality) const
{
const EQUIP_QUALITY_UP_ROOT_STRUCT& RootStruct = EQUIP_QUALITY_UP_ENTRY::Instance()->GetStruct();
for (std::vector<EQUIP_QUALITY_UP_ROOT_HEAD_STRUCT>::const_iterator cIter = RootStruct.head_list.begin(); cIter != RootStruct.head_list.end(); ++cIter)
{
if(cIter->quality == quality)
{
return &(*cIter);
}
}
return NULL;
}
const EQUIP_WASH_UP_ROOT_HEAD_STRUCT* ItemConfigManager::FindWashStone() const
{
TpltEquipWashUpMap::const_iterator cIter = m_EquipWashUpMap.find(0); // 现在只有一个洗练石
if (m_EquipWashUpMap.end() == cIter)
{
return NULL;
}
return cIter->second;
}
const EQUIP_STAR_UP_ROOT_HEAD_STRUCT* ItemConfigManager::FindStarUpData(uint32 star) const
{
TpltEquipStarUpMap::const_iterator cIter = m_EquipStarUpMap.find(star); // 现在只有一个洗练石
if (m_EquipStarUpMap.end() == cIter)
{
return NULL;
}
return cIter->second;
}
const EQUIP_ENCHANTMENT_ROOT_FORMULA_STRUCT* ItemConfigManager::FindEnchantData(uint32 attribute_id) const
{
TpltEquipEnchantMap::const_iterator cIter = m_EquipEnchantMap.find(attribute_id);
if (m_EquipEnchantMap.end() == cIter)
{
return NULL;
}
return cIter->second;
}
const EQUIP_ATTRIBUTE_ROOT_MODIFIER_STRUCT* ItemConfigManager::FindEquipAttributeTpltById( uint32 id ) const
{
TpltEquipAttributeMap::const_iterator cIter = m_EquipAttributeMap.find(id);
if (m_EquipAttributeMap.end() == cIter)
{
return NULL;
}
return cIter->second;
}
const TpltEquipAttributeMap* ItemConfigManager::FindEquipAttributeMapByGrade( uint32 grade ) const
{
TpltEquipAttributeGradeMap::const_iterator cIter = m_EquipAttributeGradeMap.find(grade);
if (m_EquipAttributeGradeMap.end() == cIter)
{
return NULL;
}
return &(cIter->second);
}
const TpltEquipAttributeMap* ItemConfigManager::FindEquipAttributeMapByProp( uint32 prop ) const
{
TpltEquipAttributePropMap::const_iterator cIter = m_EquipAttributePropMap.find(prop);
if (m_EquipAttributePropMap.end() == cIter)
{
return NULL;
}
return &(cIter->second);
}
bool ItemConfigManager::CheckEquipTypeWithPos( int32 type, int32 part )
{
switch(type)
{
case EQUIP_TYPE_HEAD:
return (EQUIP_PART_HEAD == part);
case EQUIP_TYPE_BODY:
return (EQUIP_PART_BODY == part);
case EQUIP_TYPE_SHOULDER:
return (EQUIP_PART_SHOULDER == part);
case EQUIP_TYPE_HAND:
return (EQUIP_PART_HAND == part);
case EQUIP_TYPE_FOOT:
return (EQUIP_PART_FOOT == part);
case EQUIP_TYPE_NECK:
return (EQUIP_PART_NECK == part);
case EQUIP_TYPE_FINGER:
return (EQUIP_PART_FINGER_L == part || EQUIP_PART_FINGER_R == part);
case EQUIP_TYPE_TWO_HAND:
return (EQUIP_PART_HAND_R == part);
case EQUIP_TYPE_ONE_HAND:
return (EQUIP_PART_HAND_L == part || EQUIP_PART_HAND_R == part);
case EQUIP_TYPE_DEPUTY_HAND:
return (EQUIP_PART_HAND_L == part);
default:
break;
}
return false;
}
bool ItemConfigManager::CheckEquipSwapType( int32 type )
{
switch (type)
{
case EQUIP_TYPE_FINGER:
return true;
case EQUIP_TYPE_ONE_HAND:
return true;
default:
break;
}
return false;
}
bool ItemConfigManager::CheckEquipSwapPart( int32 part1, int32 part2 )
{
switch (part1)
{
case EQUIP_PART_FINGER_L:
return (EQUIP_PART_FINGER_R == part2);
case EQUIP_PART_FINGER_R:
return (EQUIP_PART_FINGER_L == part2);
case EQUIP_PART_HAND_L:
return (EQUIP_PART_HAND_R == part2);
case EQUIP_PART_HAND_R:
return (EQUIP_PART_HAND_L == part2);
default:
break;
}
return false;
}
int32 ItemConfigManager::FindEquipPartByType(uint32 type, const EquipGrid& grid)
{
if (grid.size() != EQUIP_PART_WHOLE_BODY)
{
CnAssert(false);
return NULL_GRID;
}
switch(type)
{
case EQUIP_TYPE_HEAD:
return EQUIP_PART_HEAD;
case EQUIP_TYPE_BODY:
return EQUIP_PART_BODY;
case EQUIP_TYPE_SHOULDER:
return EQUIP_PART_SHOULDER;
case EQUIP_TYPE_HAND:
return EQUIP_PART_HAND;
case EQUIP_TYPE_FOOT:
return EQUIP_PART_FOOT;
case EQUIP_TYPE_NECK:
return EQUIP_PART_NECK;
case EQUIP_TYPE_FINGER:
{
if (NULL == grid[EQUIP_PART_FINGER_R] || NULL != grid[EQUIP_PART_FINGER_L])
{
return EQUIP_PART_FINGER_R;
}
return EQUIP_PART_FINGER_L;
}
break;
case EQUIP_TYPE_TWO_HAND:
return EQUIP_PART_HAND_R;
case EQUIP_TYPE_ONE_HAND:
{
if (NULL == grid[EQUIP_PART_HAND_R] || NULL != grid[EQUIP_PART_HAND_L])
{
return EQUIP_PART_HAND_R;
}
if (EQUIP_TYPE_TWO_HAND == grid[EQUIP_PART_HAND_R]->GetPartType())
{
return EQUIP_PART_HAND_R;
}
return EQUIP_PART_HAND_L;
}
break;
case EQUIP_TYPE_DEPUTY_HAND:
return EQUIP_PART_HAND_L;
default:
break;
}
return -1;
}
uint8 ItemConfigManager::GetEquipAnimation(const EquipGrid& grid)
{
if (grid.size() != EQUIP_PART_WHOLE_BODY)
{
CnAssert(false);
return EQUIP_ANIMATION_JD;
}
// 右手是空的--剑盾
if (!grid[EQUIP_PART_HAND_R])
{
return EQUIP_ANIMATION_JD;
}
// 右手是单手武器
if (EQUIP_TYPE_ONE_HAND == grid[EQUIP_PART_HAND_R]->GetPartType())
{
// 左手是空的--剑盾
if (!grid[EQUIP_PART_HAND_L])
{
return EQUIP_ANIMATION_JD;
}
// 左手是单手武器--双持
if (EQUIP_TYPE_ONE_HAND == grid[EQUIP_PART_HAND_L]->GetPartType())
{
return EQUIP_ANIMATION_SC;
}
// 其他情况--剑盾
return EQUIP_ANIMATION_JD;
}
// 右手是双手武器
// 双手剑
if (EQUIP_SUB_TYPE_11 == grid[EQUIP_PART_HAND_R]->GetSubType())
{
return EQUIP_ANIMATION_SJ;
}
// 双手杖
if (EQUIP_SUB_TYPE_12 == grid[EQUIP_PART_HAND_R]->GetSubType())
{
return EQUIP_ANIMATION_SZ;
}
// 双手弓
if (EQUIP_SUB_TYPE_13 == grid[EQUIP_PART_HAND_R]->GetSubType())
{
return EQUIP_ANIMATION_GJ;
}
// 其他情况--剑盾
return EQUIP_ANIMATION_JD;
}
void ItemConfigManager::FindEquipAttributeProp(int32 type, std::vector<const TpltEquipAttributeMap*>& Vector)
{
Vector.clear();
for (TpltEquipAttributePropMap::const_iterator cIter = m_EquipAttributePropMap.begin();
cIter != m_EquipAttributePropMap.end(); ++cIter)
{
Vector.push_back(&(cIter->second));
}
}
void ItemConfigManager::InsertToGradeMap( const EQUIP_ATTRIBUTE_ROOT_MODIFIER_STRUCT* pStruct )
{
CnAssert(pStruct);
TpltEquipAttributeGradeMap::iterator mIter = m_EquipAttributeGradeMap.find(pStruct->grade);
if (m_EquipAttributeGradeMap.end() == mIter)
{
TpltEquipAttributeMap tpltMap;
tpltMap.insert(std::make_pair(pStruct->id, pStruct));
m_EquipAttributeGradeMap.insert(std::make_pair(pStruct->grade, tpltMap));
return;
}
TpltEquipAttributeMap & tpltMap = mIter->second;
if (tpltMap.end() != tpltMap.find(pStruct->id))
{
CnWarn("EQUIP_ATTRIBUTE grade duplicate id = %d!\n", pStruct->id);
return;
}
tpltMap.insert(std::make_pair(pStruct->id, pStruct));
}
void ItemConfigManager::InsertToPropMap( const EQUIP_ATTRIBUTE_ROOT_MODIFIER_STRUCT* pStruct )
{
CnAssert(pStruct);
TpltEquipAttributeGradeMap::iterator mIter = m_EquipAttributePropMap.find(pStruct->prop_id);
if (m_EquipAttributePropMap.end() == mIter)
{
TpltEquipAttributeMap tpltMap;
tpltMap.insert(std::make_pair(pStruct->id, pStruct));
m_EquipAttributePropMap.insert(std::make_pair(pStruct->prop_id, tpltMap));
return;
}
TpltEquipAttributeMap & tpltMap = mIter->second;
if (tpltMap.end() != tpltMap.find(pStruct->id))
{
CnWarn("EQUIP_ATTRIBUTE grade duplicate id = %d!\n", pStruct->id);
return;
}
tpltMap.insert(std::make_pair(pStruct->id, pStruct));
}
bool ItemConfigManager::IsWeapon(uint32 equipSubType)
{
return equipSubType == EQUIP_SUB_TYPE_8
|| equipSubType == EQUIP_SUB_TYPE_9
|| equipSubType == EQUIP_SUB_TYPE_10
|| equipSubType == EQUIP_SUB_TYPE_11
|| equipSubType == EQUIP_SUB_TYPE_12
|| equipSubType == EQUIP_SUB_TYPE_13;
}
bool ItemConfigManager::IsArmor(uint32 equipSubType)
{
return equipSubType == EQUIP_SUB_TYPE_1
|| equipSubType == EQUIP_SUB_TYPE_2
|| equipSubType == EQUIP_SUB_TYPE_3
|| equipSubType == EQUIP_SUB_TYPE_4
|| equipSubType == EQUIP_SUB_TYPE_5
|| equipSubType == EQUIP_SUB_TYPE_14;
}
bool ItemConfigManager::IsJewelry(uint32 equipSubType)
{
return equipSubType == EQUIP_SUB_TYPE_6
|| equipSubType == EQUIP_SUB_TYPE_7;
}
uint32 ItemConfigManager::GetItemTypeById(uint32 id) const
{
if(FindEquipTpltById(id))
return ITEM_TYPE_EQUIP;
else if(FindConsumeTpltById(id))
return ITEM_TYPE_CONSUME;
else if(FindMaterialTpltById(id))
return ITEM_TYPE_MATERIAL;
else if(FindStoneTpltById(id))
return ITEM_TYPE_STONE;
else
{
CnAssert(false); // 找不到对应的物品
return 0;
}
}
uint32 ItemConfigManager::IsItemId(uint32 id) const
{
if (FindEquipTpltById(id) ||
FindConsumeTpltById(id) ||
FindMaterialTpltById(id) ||
FindStoneTpltById(id))
{
return true;
}
return false;
}
|
449049d40503e4d5c04bf71d59516100cade85ca
|
81f6419ea475836b1f1b24bcd2de77a316bc46a1
|
/GFG must do questions/inheritance in c++.cpp
|
fd3986f0f779da34d73ff4ef86b19302ec41ed71
|
[] |
no_license
|
Pramodjais517/competitive-coding
|
f4e0f6f238d98c0a39f8a9c940265f886ce70cb3
|
2a8ad013246f2db72a4dd53771090d931ab406cb
|
refs/heads/master
| 2023-02-25T12:09:47.382076
| 2021-01-28T06:57:26
| 2021-01-28T06:57:26
| 208,445,032
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,045
|
cpp
|
inheritance in c++.cpp
|
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define rs reserve
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define fi(i,s,e,inc) for(auto i=s;i<e;i+=inc)
#define fie(i,s,e,inc) for(auto i=s;i<=e;i+=inc)
#define fd(i,s,e,dec) for(auto i=s;i>e;i-=dec)
#define fde(i,s,e,dec) for(auto i=s;i>=e;i-=dec)
#define itr(i,ar) for(auto i=ar.begin();i!=ar.end();i++)
#define mod 1000000007
class Animal{
public:
string name;
int height;
int weight;
string color;
Animal(string name, int height, int weight, string color)
{
this->name = name;
this->height = height;
this->weight = weight;
this->color = color;
}
void display()
{
cout<<name<<" "<<height<<" "<<weight<<" "<<color<<"\n";
}
};
class Cat:public Animal{
public:
Cat(string name,int height,int weight,string color) : Animal(name,height,weight,color)
{
}
};
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
Cat c("Pussy",10,15,"black");
c.display();
return 0;
}
|
2379b07039077917d893c3514d94ee35fc7be444
|
32b8db47c9335f65aeb39848c928c3b64fc8a52e
|
/tgame-client-classes-20160829/CfgMaster/WeaponRefitAdditionCfgMaster.h
|
83d9fc78c8244a604302eed1e126453ca7530db5
|
[] |
no_license
|
mengtest/backup-1
|
763dedbb09d662b0940a2cedffb4b9fd1f7fb35d
|
d9f34e5bc08fe88485ac82f8e9aa09b994bb0e54
|
refs/heads/master
| 2020-05-04T14:29:30.181303
| 2016-12-13T02:28:23
| 2016-12-13T02:28:23
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 749
|
h
|
WeaponRefitAdditionCfgMaster.h
|
#ifndef WeaponRefitAdditionCfgMaster_h__
#define WeaponRefitAdditionCfgMaster_h__
#include "vlib/base/CVSingleton.h"
#include "WeaponRefitAdditionCfg.pb.h"
#include "CfgMasterBase.h"
using namespace com::cfg::vo;
class CWeaponRefitAdditionCfgMaster : public CCfgMasterBase<WeaponRefitAdditionCfgSet>
{
public:
CWeaponRefitAdditionCfgMaster(){}
~CWeaponRefitAdditionCfgMaster(){}
const WeaponRefitAdditionCfg* GetCfg(const unsigned int uiColor)const;
int GetCfgSize(){
return m_stCfg.weaponrefitadditioncfg_size();
}
protected:
virtual int ValidateCfg()const;
};
#define WEAPONREFITADDITION_CFG_MASTER (CVSingleton<CWeaponRefitAdditionCfgMaster>::Instance())
#endif // WeaponRefitAdditionCfgMaster_h__
|
a9381e76e1d7962dd1f358574f09d4b63b2f7596
|
745d39cad6b9e11506d424f008370b5dcb454c45
|
/BOJ/1000/1850.cpp
|
0de219d3c50320e81e61401c616a4d5439192978
|
[] |
no_license
|
nsj6646/PS
|
0191a36afa0c04451d704d8120dc25f336988a17
|
d53c111a053b159a0fb584ff5aafc18556c54a1c
|
refs/heads/master
| 2020-04-28T09:18:43.333045
| 2019-06-19T07:19:03
| 2019-06-19T07:19:03
| 175,162,727
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 303
|
cpp
|
1850.cpp
|
#include <iostream>
using namespace std;
typedef unsigned long long ull;
ull gcd(ull x, ull y) {
if (y == 0) {
return x;
}
return gcd(y, x%y);
}
int main()
{
ios::sync_with_stdio(false);
ull a, b;
cin >> a >> b;
ull n = gcd(a, b);
for (ull i = 0; i < n; i++) {
cout << 1;
}
return 0;
}
|
85d82e1fbb4bcf2e78b3a96f455f57f95f1ac746
|
2ff09a0c14f4d0468c8afaea73618c5649d758f8
|
/robot/control/Src/modules/KickerModule.cpp
|
3310e7e87d635387b8cb500d6968a5f075747514
|
[
"Apache-2.0"
] |
permissive
|
guyfleeman/robocup-firmware
|
771706084875a54b0777259a79470b7f9beb39be
|
11e1e773cb9c549349fd2ad76939d6485b04590f
|
refs/heads/master
| 2020-04-05T22:46:30.159155
| 2020-01-27T03:11:40
| 2020-01-27T03:11:40
| 237,810,180
| 0
| 0
|
Apache-2.0
| 2020-02-02T17:43:07
| 2020-02-02T17:43:06
| null |
UTF-8
|
C++
| false
| false
| 2,125
|
cpp
|
KickerModule.cpp
|
#include "modules/KickerModule.hpp"
#include "mtrain.hpp"
#include "iodefs.h"
KickerModule::KickerModule(std::shared_ptr<SPI> spi,
KickerCommand *const kickerCommand,
KickerInfo *const kickerInfo)
: kickerCommand(kickerCommand), kickerInfo(kickerInfo),
prevKickTime(0), nCs(std::make_shared<DigitalOut>(KICKER_CS)), kicker(spi, nCs, KICKER_RST) {
kicker.flash(false, true);
kickerInfo->isValid = false;
kickerInfo->lastUpdate = 0;
kickerInfo->kickerHasError = false;
kickerInfo->kickerCharged = false;
kickerInfo->ballSenseTriggered = false;
printf("INFO: Kicker initialized\r\n");
}
void KickerModule::entry(void) {
kicker.setChargeAllowed(true);
// Check if valid
// and within the last few ms
// and not same as previous command
if (kickerCommand->isValid) {
kickerCommand->isValid = false;
kicker.kickType(kickerCommand->shootMode == KickerCommand::ShootMode::KICK);
kicker.setChargeAllowed(true);
switch (kickerCommand->triggerMode) {
case KickerCommand::TriggerMode::OFF:
kicker.setChargeAllowed(true);
kicker.cancelBreakbeam();
break;
case KickerCommand::TriggerMode::IMMEDIATE:
kicker.setChargeAllowed(true);
kicker.kick(kickerCommand->kickStrength);
break;
case KickerCommand::TriggerMode::ON_BREAK_BEAM:
kicker.setChargeAllowed(true);
kicker.kickOnBreakbeam(kickerCommand->kickStrength);
break;
case KickerCommand::TriggerMode::INVALID:
kicker.setChargeAllowed(false);
kicker.cancelBreakbeam();
break;
}
}
// Do all the commands
kicker.service();
kickerInfo->isValid = true;
kickerInfo->lastUpdate = HAL_GetTick();
kickerInfo->kickerHasError = kicker.isHealthy();
kickerInfo->ballSenseTriggered = kicker.isBallSensed();
kickerInfo->kickerCharged = kicker.isCharged();
}
|
f300c1d5e5f80173837efe48c1a74473a949ec89
|
28bf7793cde66074ac6cbe2c76df92bd4803dab9
|
/answers/AasthaCodex/Day 26/question2.cpp
|
edc668611687eaad295132f0e99cae73800bbaf6
|
[
"MIT"
] |
permissive
|
Codechef-SRM-NCR-Chapter/30-DaysOfCode-March-2021
|
2dee33e057ba22092795a6ecc6686a9d31607c9d
|
66c7d85025481074c93cfda7853b145c88a30da4
|
refs/heads/main
| 2023-05-29T10:33:31.795738
| 2021-06-10T14:57:30
| 2021-06-10T14:57:30
| 348,153,476
| 22
| 135
|
MIT
| 2021-06-10T14:57:31
| 2021-03-15T23:37:26
|
Java
|
UTF-8
|
C++
| false
| false
| 651
|
cpp
|
question2.cpp
|
#include<bits/stdc++.h>
using namespace std;;
int sumME(int array[], int len);
int smallest(int array[], int len);
int minayy(int array[], int len);
int main(){
int array[] = {3, 2, 5, 1, 7};
int len = 5;
cout<<minayy(array , len);
return 0;
}
int sumME(int array[], int len){
int sum = 0;
for (int i=0; i<len; sum+=array[i++]);
return sum;
}
int smallest(int array[], int len){
int small = INT_MAX;
for (int i=0; i<len; i++)
if (array[i] < small)
small = array[i];
return small;
}
int minayy(int array[], int len){
int sum = sumME(array, len);
int small = smallest (array, len);
int minOpe = sum - (len * small);
return minOpe;
}
|
84fbec7b2673d533687bff441106449e73451f1a
|
cb0d520558754282f8b586dd57df248460a8ae22
|
/sct_plot/inc/internal/platform.hh
|
1fe4f78c9d54fe2987829dc75739010fd52c3327
|
[] |
no_license
|
RPeschke/SCT_correlations
|
a21e2ea4407d7e2be08ffde172a2917fbc8b0dc1
|
6ff4ce7ca5d7529d4ba7f386f1f1b8234cb55f66
|
refs/heads/master
| 2021-01-18T22:58:13.034155
| 2016-05-25T08:23:21
| 2016-05-25T08:23:21
| 35,161,842
| 0
| 3
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,153
|
hh
|
platform.hh
|
#ifndef platform_h__
#define platform_h__
#define CONCATENATE_DETAIL(x, y) x##y
#define CONCATENATE(x, y) CONCATENATE_DETAIL(x, y)
#define MAKE_UNIQUE(x) CONCATENATE(x, __LINE__)
#define LOOP_TASK(x) auto MAKE_UNIQUE(_ret) = x; if (MAKE_UNIQUE(_ret) == return_skip) continue; else if (MAKE_UNIQUE(_ret) == return_stop) break
#define TASK_DEFINITION(TASK) template<typename next_t, typename... Args> returnTypes runTask(TASK , next_t&& next, Args&&... args)
#define LOOP_TASK_NEXT(buffer) LOOP_TASK( runTask(setBuffer(buffer, next), args...))
#define RUN_TASK(buffer) runTask(setBuffer(buffer, next), args...)
#define RETURN_OK return return_ok
#define RETURN_SKIP return return_skip
#define RETURN_STOP return return_stop
#define RETURN_NEXT_TASK(buffer) return RUN_TASK(buffer)
enum returnTypes {
return_ok,
return_skip,
return_stop
};
#ifdef WIN32
#ifndef __CINT__
#define DllExport __declspec( dllexport )
#else
#define DllExport
#endif // __CINT__
#else
#define DllExport
#endif // WIN32
#ifdef WIN32
#define SCT_FUNC __FUNCSIG__
#else
#define SCT_FUNC __PRETTY_FUNCTION__
#endif // WIN32
#endif // platform_h__
|
12cdf7329fb5d790f3fa8f9c6935ddc553812e60
|
78972b29a72d87010895b129b7bf42ac2829e940
|
/elang/elang/grammar/parser/identifier_parser.h
|
1552c5cf19c639aa9e59861d1587eeb2b385026d
|
[
"MIT"
] |
permissive
|
benbraide/elang
|
c55d8e44c8e8b8faa1e0c8762bbe2ae49710302d
|
7f148be0c0f4144d10c09840c2e02c37899e13f6
|
refs/heads/master
| 2021-05-08T04:20:05.901250
| 2017-11-28T06:23:56
| 2017-11-28T06:23:56
| 108,399,081
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,069
|
h
|
identifier_parser.h
|
#pragma once
#ifndef ELANG_IDENTIFIER_PARSER_H
#define ELANG_IDENTIFIER_PARSER_H
#include "../ast/identifier_ast.h"
#include "keyword_parser.h"
#include "operator_symbol_parser.h"
namespace elang::grammar::parser{
namespace x3 = boost::spirit::x3;
x3::rule<class identifier, ast::identifier> const identifier = "identifier";
x3::rule<class operator_identifier, ast::operator_identifier> const operator_identifier = "operator_identifier";
x3::rule<class global_qualified_identifier, ast::global_qualified_identifier> const global_qualified_identifier = "global_qualified_identifier";
x3::rule<class qualified_identifier, ast::qualified_identifier> const qualified_identifier = "qualified_identifier";
x3::rule<class identifier_compatible, ast::identifier_compatible> const identifier_compatible = "identifier_compatible";
x3::rule<class non_operator_identifier_compatible, ast::non_operator_identifier_compatible> const non_operator_identifier_compatible = "non_operator_identifier_compatible";
auto const identifier_def = (!keyword >> elang_identifier);
auto const operator_identifier_def = (utils::keyword("operator") >> (
((x3::lit("(") > ")") >> x3::attr(elang::common::operator_id::call)) |
((x3::lit("[") > "]") >> x3::attr(elang::common::operator_id::index)) |
operator_symbol |
non_operator_identifier_compatible
));
auto const global_qualified_identifier_def = ("::" >> (operator_identifier | identifier));
auto const qualified_identifier_def = ((global_qualified_identifier | operator_identifier | identifier) >> "::" >> (operator_identifier | identifier));
auto const identifier_compatible_def = (qualified_identifier | global_qualified_identifier | operator_identifier | identifier);
auto const non_operator_identifier_compatible_def = (qualified_identifier | global_qualified_identifier | identifier);
BOOST_SPIRIT_DEFINE(
identifier,
operator_identifier,
global_qualified_identifier,
qualified_identifier,
identifier_compatible,
non_operator_identifier_compatible
)
}
#endif /* !ELANG_IDENTIFIER_PARSER_H */
|
c84e189f983e0f9af44ae541d1fdd1b212b7a44a
|
e9602eada3b5dcb48c127035740f8a57909e7b6d
|
/practica2/P4.cpp
|
17ecf155d3e6a7bcbe74ae40b4693cec8d375759
|
[] |
no_license
|
JaimeRamosMiranda/C-plus-plus-1st-repository-2018
|
1247f8a3e47115fa7fbdc2128f13dd806391c639
|
093d3581adb00fd48fe2e78e1098e31b851f54f1
|
refs/heads/master
| 2020-03-22T12:09:15.285792
| 2018-07-06T21:12:26
| 2018-07-06T21:12:26
| 140,020,596
| 0
| 0
| null | null | null | null |
ISO-8859-1
|
C++
| false
| false
| 904
|
cpp
|
P4.cpp
|
/*
4.- Escribir un pseudocódigo y el correspondiente programa en C++ que,
al recibir como dato un entero positivo, escriba todos los números perfectos que hay entre 1 y el número dado,
y que además imprima la cantidad de números perfectos que hay en el intervalo.
Un número se considera perfecto si la suma de todos sus divisores es igual al propio número.
*/
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{int i,j,num,c,suma;
cout<<"Ingrese un numero entero : "<<endl;
cin>>num;
c=0;
for(i=1;i<=num;i++)
{suma=0;
for(j=1;j<=(i/2);j++)//j es el divisor, i es el número entero positivo
if((i%j)==0)
suma=suma+j;
if(suma==i)
{cout<<i<<"\t";
c=c+1;
}
}
cout<<endl;
cout<<"Entre 1 y "<<num<<" hay "<<c<<" numeros perfectos "<<endl;
getche();
return 0;
}
|
4c52aadc5c212f23a2d433c0b89168502a06e854
|
f55fc94338728c2ca4f90ab83d8b969331160166
|
/catkin_ws/src/mbz2020_planner/src/mbz2020_target_planners/src/target_planner/target_planner.cpp
|
06ec493563a785b08e276a9d497712f932390002
|
[] |
no_license
|
asaba96/senior-design-2019
|
c3cdb68a7d9cee350e00aec30a1da5c7bf64c484
|
3088bbad2fe67af60e2e94e69ecf6f124c1fceaa
|
refs/heads/master
| 2020-09-21T21:00:10.764321
| 2019-12-09T05:25:27
| 2019-12-09T05:25:27
| 224,928,730
| 0
| 1
| null | 2019-12-08T23:38:27
| 2019-11-29T22:16:15
|
C++
|
UTF-8
|
C++
| false
| false
| 6,616
|
cpp
|
target_planner.cpp
|
#include <target_planner/target_planner.hpp>
namespace Mbz2020Planner {
TargetPlanner::TargetPlanner(std::shared_ptr<Domain> env,
std::shared_ptr<State> start, double eps)
: open_(), _env(env) {
numSearches = 0;
goalNode = nullptr;
setStart(start, eps);
_eps = eps;
}
void TargetPlanner::setStart(std::shared_ptr<State> start, double eps) {
std::shared_ptr<Successor> startNode = std::make_shared<Successor>();
GroundedState node = _env->makeGroundedState(start);
startNode->closed = 0;
startNode->done = false;
startNode->g = 0.0;
startNode->v = std::numeric_limits<double>::infinity();
startNode->f = eps * _env->getHeuristic(node);
startNode->state = start;
startNode->parent = nullptr;
nodes.insert({*start, startNode});
open_.push(startNode);
}
PathTrajectory TargetPlanner::getPlanTrajectory() {
PathTrajectory p;
double totalCost = 0;
std::vector<MotionPointStamped> planVector;
if (this->goalNode == nullptr) {
ROS_ERROR("PathPlanner: Goal Node is null");
return p;
}
std::shared_ptr<const Successor> parent = this->goalNode;
totalCost = parent->g;
while (parent != nullptr) {
GroundedState gs = _env->makeGroundedState(parent->state);
MotionPointStamped pt = gs.toMotionPoint();
planVector.push_back(pt);
parent = parent->parent;
}
ROS_INFO_STREAM("TargetPathPlanner: total plan cost: " << totalCost);
std::reverse(planVector.begin(), planVector.end());
p.motion_points = planVector;
return p;
}
bool TargetPlanner::plan() {
this->startTime = std::chrono::high_resolution_clock::now();
this->stopTime = startTime + std::chrono::milliseconds(500);
this->numSearches = 1;
double eps = this->_eps;
bool result = false;
while (eps > 1.0) {
eps = eps - .5;
eps = std::max(eps, 1.0);
ROS_INFO("TargetPlanner: search %d with EPS %f", numSearches, eps);
this->resetOpenList(eps);
this->_env->setEps(eps);
result = replan() || result;
if (std::chrono::high_resolution_clock::now() > this->stopTime) {
ROS_WARN("TargetPlanner: ran out of time with %d searches, ending at epsilon %f", numSearches, eps);
break;
}
numSearches++;
}
return result;
}
bool TargetPlanner::replan() {
bool success = false;
if (!this->_env->canPlan()) {
ROS_ERROR("TargetPlanner: cannot plan yet");
return success;
}
// ROS_INFO("TargetPlanner: Start of search %d", numSearches);
std::chrono::time_point<std::chrono::high_resolution_clock> replanStartTime =
std::chrono::high_resolution_clock::now();
int numExpand = 0;
while (ros::ok() && !open_.empty()) {
if (std::chrono::high_resolution_clock::now() > this->stopTime) {
ROS_WARN("TargetPlanner: ran out of time with %d searches",
numSearches);
return false;
}
if (goalNode != nullptr && goalNode->g <= open_.top()->f) {
// done this round
const auto rePlanEnd = std::chrono::high_resolution_clock::now();
ROS_INFO_STREAM("TargetPlanner: done replanning");
ROS_INFO_STREAM("TargetPlanner: num nodes expanded: " << numExpand);
ROS_INFO_STREAM("TargetPlanner: re-planning time: "
<< std::chrono::duration_cast<std::chrono::milliseconds>(
rePlanEnd - replanStartTime)
.count()
<< "ms.");
ROS_INFO_STREAM("TargetPlanner: G of GoalNode: "
<< goalNode->g << " open V: " << open_.top()->f);
return true;
}
std::shared_ptr<Successor> next = open_.top();
open_.pop();
if (next->done) {
// done
continue;
}
numExpand++;
next->v = next->g;
next->closed = numSearches;
if (_env->isGoal(next->state) &&
(goalNode == nullptr || goalNode->g > next->g)) {
const auto rePlanEnd = std::chrono::high_resolution_clock::now();
ROS_INFO_STREAM("Targetlanner: Goal found!");
ROS_INFO_STREAM("TargetPLanner: num nodes expanded: " << numExpand);
ROS_INFO_STREAM("TargetPlanner: planning time: "
<< std::chrono::duration_cast<std::chrono::milliseconds>(
rePlanEnd - replanStartTime)
.count()
<< "ms.");
this->goalNode = next;
return true;
}
// get all successors
for (std::shared_ptr<Successor> newSucc : _env->getSuccessors(next)) {
bool alreadySeen = (nodes.count(*newSucc->state) != 0);
if (!alreadySeen || nodes[*newSucc->state]->closed < numSearches) {
if (!alreadySeen || newSucc->g < nodes[*newSucc->state]->g) {
// new node or already seen and has lower cost
open_.push(newSucc);
if (alreadySeen) {
nodes[*newSucc->state]->done = true;
nodes.erase(*newSucc->state);
}
nodes.insert({*newSucc->state, newSucc});
}
} else {
// already closed
nodes[*newSucc->state]->g = newSucc->g;
if (incons.count(*newSucc->state) == 0) {
incons.insert({*newSucc->state, nodes[*newSucc->state]});
}
}
}
}
ROS_ERROR_STREAM(
"TargetPlanner: NO PATH FOUND!! NODES EXPANDED: " << numExpand);
return false;
}
void TargetPlanner::resetOpenList(double eps) {
std::priority_queue<std::shared_ptr<Successor>,
std::vector<std::shared_ptr<Successor> >,
CompareSuccessors>
newQueue;
while (ros::ok() && !open_.empty()) {
std::shared_ptr<Successor> next = open_.top();
open_.pop();
if (next->done)
continue;
next->f = next->g + eps * _env->getHeuristic(next->state);
newQueue.push(next);
}
for (auto& set : incons) {
std::shared_ptr<Successor> node = set.second;
node->f = node->g + eps * _env->getHeuristic(node->state);
newQueue.push(node);
}
incons.clear();
open_.swap(newQueue);
}
} // namespace Mbz2020Planner
|
66e12b0248fa3c6e5356dcc46b7f888896c03ff2
|
ecc68323f7dff91461bb46c1064734af5942cc12
|
/Source/Cards/BasicCard.cpp
|
e068e1f287632482fb3dbb315463e8c22b5cf2f5
|
[
"MIT"
] |
permissive
|
weirdwizardthomas/bi-pa2-b182-semestral
|
7e4e20fd4454c87fc742dd5ddeaf441952b0b8f3
|
8b7d17df4dc284ffc7de2417e1a9abf3f8bc7169
|
refs/heads/master
| 2023-07-12T11:57:41.724790
| 2021-08-23T15:10:11
| 2021-08-24T09:20:20
| 399,084,666
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 471
|
cpp
|
BasicCard.cpp
|
#include <exception>
#include "BasicCard.h"
using namespace std;
BasicCard::BasicCard(int value) : value(value) {
if (!validInput(value)) {
throw invalid_argument("Invalid Basic Card value");
}
}
int BasicCard::play(std::vector<int> &playedCards, int currentScore, int opponentScore) const {
return value;
}
int BasicCard::play() const {
return value;
}
string BasicCard::getDescription() const {
return offsetPositiveNumber(value);
}
|
1248c08b03accc1b05bab4af73e382871fbd8bc8
|
9162a3334cadf6e4f724425a261d68070adb431f
|
/Luogu/P2921.cpp
|
51db290195b778dfc87d2b6018e9b855aac70e84
|
[] |
no_license
|
agicy/OI
|
c8c375c6586110ed0df731d6bd1a1c65aed603d4
|
1050632a0d9bde7666d9aa2162bba6939b148c1b
|
refs/heads/master
| 2023-06-25T01:02:30.336307
| 2021-07-22T12:57:49
| 2021-07-22T12:57:49
| 227,121,193
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,566
|
cpp
|
P2921.cpp
|
#include <cstdio>
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++)
static char buf[100000], *p1 = buf, *p2 = buf;
inline int read(void)
{
register char ch = getchar();
register int sum = 0;
while (!(ch >= '0' && ch <= '9'))
ch = getchar();
while (ch >= '0' && ch <= '9')
sum = (sum << 1) + (sum << 3) + ch - 48, ch = getchar();
return sum;
}
bool vis[100001];
int n;
int to[100001];
int time, dfn[100001], low[100001];
int Tarjan_cnt, color[100001], size[100001];
int top, Stack[100001];
int to_[100001];
int f[100001];
void Tarjan(int);
int DFS(int);
int main(void)
{
register int i;
n = read();
for (i = 1; i <= n; ++i)
to[i] = read();
for (i = 1; i <= n; ++i)
if (!dfn[i])
Tarjan(i);
for (i = 1; i <= n; ++i)
if (color[i] != color[to[i]])
to_[color[i]] = color[to[i]];
for (i = 1; i <= n; ++i)
printf("%d\n", DFS(color[i]));
return 0;
}
void Tarjan(int ID)
{
register int To;
vis[ID] = true;
dfn[ID] = low[ID] = ++time;
Stack[++top] = ID;
if (!dfn[to[ID]])
{
Tarjan(to[ID]);
low[ID] = min(low[ID], low[to[ID]]);
}
else if (vis[to[ID]])
low[ID] = min(low[ID], dfn[to[ID]]);
if (dfn[ID] == low[ID])
{
++Tarjan_cnt;
do
{
To = Stack[top--];
vis[To] = false;
color[To] = Tarjan_cnt;
++size[color[To]];
} while (To != ID);
}
return;
}
int DFS(int ID)
{
if (f[ID])
return f[ID];
f[ID] = size[ID];
if (to_[ID])
f[ID] += DFS(to_[ID]);
return f[ID];
}
|
de104365213578eff67673f893e1a47f87744a3d
|
baf49d3f3f1862086bab856dbc0888ce64df5b87
|
/The worst Link Adventure/File_Manager.h
|
323a9eee33fe6a58a52e985be481983fdf87c3ea
|
[] |
no_license
|
CHP-EmAS/TWLA
|
8e0d1b98576d083502d28ecdb389905a2d0d47c0
|
305f2486888f076d28747fd7ae55adfab7a7dd55
|
refs/heads/master
| 2023-02-25T13:29:26.014831
| 2021-02-02T13:58:51
| 2021-02-02T13:58:51
| 271,309,305
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 892
|
h
|
File_Manager.h
|
#pragma once
#include <string>
#include <list>
#include <iostream>
#include <fstream>
#include "Defines.h"
class File_Manager : public Singleton<File_Manager>
{
friend class Singleton<File_Manager>;
public:
std::string create_SaveGame(std::string name, int difficulty);
bool load_Savegame(std::string saveGamePath);
bool save_Savegame();
sf::Image doScreenShotFromPlayer();
bool loadCurrentMapChanges();
bool saveCurrentMapChanges();
bool saveSettings();
bool loadSettings();
std::list<fullCommand> convertFileToCommandlist(std::string filePath);
std::string getPlayerName();
int getGameDifficulty();
std::ofstream& getLogStream();
void forceReset();
~File_Manager(void);
private:
File_Manager(void);
struct saveGame
{
std::string path;
std::string name;
std::string date;
int difficulty;
};
saveGame currentSaveGame;
std::ofstream logStream;
};
|
ab76484264ed5643baae6b030c04dfe26b152e73
|
434f413cf365825dd320878e6cca4b621a5e7ccc
|
/BasicSevenSegmentDisplay.ino
|
02f4a1953669cc6deaf913ad8c5234135cb5eead
|
[] |
no_license
|
SachiKaur/BasicSevenSegmentDisplay
|
6d34f3d6fb46cc2ec5ae70fef082e7ad7e6a5f2c
|
decd2387e45e81061dc70cd2c934a68bf46b6df9
|
refs/heads/master
| 2020-03-27T13:59:39.221360
| 2018-08-29T17:59:07
| 2018-08-29T17:59:07
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 645
|
ino
|
BasicSevenSegmentDisplay.ino
|
void setup()
{
DDRB = 0b00000011; //B0-B1(Set as output); DDR-Data Direvction Register is used to set the pin as input(0) or output(1)
DDRD = 0b11111110; //D1-D7(Set as output)
}
const int digit1[] = {0b00000000, 0b11011010, 0b11101110,0b01110010,0b11101100,0b01100000,0b00000000};
const int digit2[] = {0b11011010, 0b11101110,0b01110010,0b11101100,0b01100000,0b00000000,0b00000000};
void loop(){
for (int i = 0; i < 6; i++){
for (int del = 0; del < 30; del++)
{
PORTB = 0b00000001;
PORTD = digit1[i];
delay(10);
PORTB = 0b00000010;
PORTD = digit2[i];
delay(10);
}
}
}
|
f47a395959ea0e350d334ab78de2fd556f8cdd22
|
f6b966ca46379cd6037ecffaa539ec1807205314
|
/Chapter_19_Exercises/Vector.h
|
d456ed3afb6bb0bad2cea21af54ceec366425ae3
|
[] |
no_license
|
guilhermezardo0/Programming-Principles-and-Practice-Exercise-Solutions
|
e39a811e06c58572f1c626d01efe205d3ee671c0
|
a7322501be813dd23962ea6104b998527cc5f55a
|
refs/heads/master
| 2021-09-06T03:22:40.960540
| 2018-02-02T01:25:58
| 2018-02-02T01:25:58
| null | 0
| 0
| null | null | null | null |
WINDOWS-1252
|
C++
| false
| false
| 4,783
|
h
|
Vector.h
|
#include "../../std_lib_facilities.h"
template<typename T> class allocatr {
public:
// . . .
T* allocate(int n); // allocate space for n objects of type T
void deallocate(T* p, int n); // deallocate n objects of type T starting at p
void construct(T* p, const T& v); // construct a T with the value v in p
void destroy(T* p); // destroy the T in p
};
// an almost real vector of Ts:
template<typename T,typename A = allocatr<T>>
class Vectr { // read “for all types T” (just like in math)
int sz; // the size
T* elem; // a pointer to the elements
int space; // size + free space
A alloc; // Allocator for reserve()
public:
Vectr() : sz{ 0 }, elem{ nullptr }, space{ 0 } { }
explicit Vectr(int s) :sz{ s }, elem{ new T[s] }, space{ s }
{
for (int i = 0; i<sz; ++i) elem[i] = 0; // elements are initialized
}
Vectr(const Vectr& a); // copy constructor
Vectr& operator=(const Vectr& a); // copy assignment
Vectr(Vectr&&); // move constructor
Vectr& operator=(Vectr&&); // move assignment
~Vectr() { delete[] elem; } // destructor
T& operator[](int n) { return elem[n]; } // access: return reference
const T& operator[](int n) const { return elem[n]; }
int size() const { return sz; } // the current size
int capacity() const { return space; }
void resize(int newsize, T val = T()); // growth
void push_back(const T& val);
void reserve(int newalloc);
};
template<class T> T* allocatr<T>::allocate(int n) {
T* p = static_cast<T*>(calloc(n,sizeof(T)));
return p;
}
template<typename T>
void allocatr<T>::deallocate(T * p, int n)
{
free(p);
}
template<typename T>
void allocatr<T>::construct(T * p, const T & v)
{
*p = T(v);
}
template<typename T>
void allocatr<T>::destroy(T * p)
{
p->~T();
}
template<typename T, typename A>
void Vectr<T, A>::reserve(int newalloc)
{
if (newalloc <= space) return; // never decrease allocation
T* p = alloc.allocate(newalloc); // allocate new space
for (int i = 0; i<sz; ++i) alloc.construct(&p[i], elem[i]); // copy
for (int i = 0; i<sz; ++i) alloc.destroy(&elem[i]); // destroy
alloc.deallocate(elem, space); // deallocate old space
elem = p;
space = newalloc;
}
template<typename T, typename A>
void Vectr<T, A>::push_back(const T& val)
{
if (space == 0) reserve(8); // start with space for 8 elements
else if (sz == space) reserve(2 * space); // get more space
alloc.construct(&elem[sz], val); // add val at end
++sz; // increase the size
}
template<typename T, typename A>
void Vectr<T, A>::resize(int newsize, T val = T())
{
reserve(newsize);
for (int i = sz; i<newsize; ++i) alloc.construct(&elem[i], val); // construct
for (int i = newsize; i<sz; ++i) alloc.destroy(&elem[i]); // destroy
sz = newsize;
}
template<typename T, typename A>
Vectr<T, A>::Vectr(const Vectr<T, A> & a)
: sz(a.sz), elem(alloc.allocate(a.sz)), space(a.sz)
{
for (int i = 0; i<sz; ++i)
alloc.construct(&elem[i], a.elem[i]);
}
template<typename T, typename A>
Vectr<T, A> & Vectr<T, A>::operator=(const Vectr<T, A> & a)
{
if (this == &a) return *this; // self-assignment, no work needed
if (a.sz <= space) { // enough space, no need for new allocation
for (int i = 0; i<a.sz; ++i)
alloc.construct(&elem[i], a.elem[i]);
sz = a.sz;
return *this;
}
T* p = alloc.allocate(a.sz); // allocate new space
for (int i = 0; i<a.sz; ++i) alloc.construct(&p[i], a.elem[i]);
for (int i = 0; i<sz; ++i) alloc.destroy(&elem[i]);
alloc.deallocate(elem); // deallocate old space
sz = a.sz; // set new size
space = a.sz;
elem = p; // set new elements
return *this;
}
template<typename T, typename A>
Vectr<T, A>::Vectr(Vectr<T, A>&& a)
:sz{ a.sz }, elem{ a.elem } // copy a’s elem and sz
{
a.sz = 0; // make a the empty vector
a.elem = nullptr;
}
template<typename T, typename A>
Vectr<T, A>& Vectr<T, A>::operator=(Vectr<T, A>&& a) // move a to this vector
{
delete[] elem; // deallocate old space
elem = a.elem; // copy a’s elem and sz
sz = a.sz;
a.elem = nullptr; // make a the empty vector
a.sz = 0;
return *this; // return a self-reference (see §17.10)
}
|
bcf51373f8eb26e935211bda8a73bec4e75054ce
|
d1bebb6936f968273c5bdf2bdb455d2f49bf95bc
|
/core/tsystem_communication_dock.h
|
44c14583eb9bd0dbcc63505e5917b0aca8cecbfd
|
[] |
no_license
|
spartawwy/TLib
|
e53c01d1cb30ba86430c1c53e0322e518ecfbbc9
|
67197852902a41701ba3a4a5712dfeba4d45ca2b
|
refs/heads/master
| 2021-10-08T03:12:58.731511
| 2018-12-07T06:37:47
| 2018-12-07T06:37:47
| 116,125,521
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,085
|
h
|
tsystem_communication_dock.h
|
// by Xixin Silas Cheng
// a communication dock containers all types of connection owners
#ifndef TSYSTEM_COMMUNICATION_DOCK_H_
#define TSYSTEM_COMMUNICATION_DOCK_H_
#include <mutex>
#include <unordered_map>
#include "TLib/core/tsystem_connection.h"
namespace TSystem
{
// forward declaration
class TaskPool;
// forward declaration;
namespace communication
{
// forward declaration
class TcpDock;
// a communication dock wraps all types of connection owners
// currently, only tcp is implemented
class CommunicationDock
{
public:
explicit CommunicationDock(const TaskPool& pool);
~CommunicationDock();
// disconnect all connections
void Shutdown();
// get a connection, return a weak_ptr in case of removed connid
std::weak_ptr<Connection> GetConnection(int connid);
//-----------------------
// connection operations
//-----------------------
// start a tcp port, throw TException when socket fails
void StartPort(unsigned short port, ConnectingHandler&& handler );
// blocking connect to an (address, port) using tcp or udp, return connection
std::shared_ptr<Connection> Connect(const std::string& address, int port, TSystem::TError& err
, Connection::Type type);
// async connect to an (address, port) using tcp or udp
void AsyncConnect(const std::string& address, int port, ConnectingHandler&& handler
, Connection::Type type);
private:
const TaskPool& pool_;
int NextConnID();
void Register(const std::shared_ptr<Connection>& pconn);
std::shared_ptr<Connection> Unregister(int connid );
std::atomic_bool shutdown_;
// next connid
std::atomic_int next_connid_;
// connection container lock
std::recursive_mutex connections_lock_;
// connid to connections, connection holder
std::unordered_map<int, std::shared_ptr<Connection>> connections_;
// tcp utilities
std::unique_ptr<TSystem::communication::TcpDock> tcp_dock_;
friend class TcpDock;
};
}
}
#endif // TSYSTEM_COMMUNICATION_DOCK_H_
|
26624320071cb0be048edccd54b8a845679673fb
|
78947ee9cc645cbbc4acd2cd45cd43e8d28eec79
|
/app/db/imagedao.h
|
db6e307ce2e0fbc7fcb514af3928227e93cac662
|
[] |
no_license
|
baptistegasser/Bibliotheque_Photo
|
4924c194048cee9392782cf2c6a1e550b5448c03
|
b8d5e2ba8244e30a495e426937a3a2a3dca6d4c9
|
refs/heads/main
| 2023-03-03T02:26:50.632319
| 2021-02-12T22:45:03
| 2021-02-12T22:45:03
| 330,893,496
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 689
|
h
|
imagedao.h
|
#ifndef IMAGEDAO_H
#define IMAGEDAO_H
#include "dao.h"
#include "model/image.h"
#include "model/directory.h"
#include "db/imagesearch.h"
#include "QSqlRecord"
class ImageDAO : public DAO
{
public:
using DAO::DAO;
bool exist(Image &image);
bool save(Image &image);
bool saveAll(Image images[]);
bool saveAll(QList<Image> images);
bool remove(Image &image);
QList<Image> getAll();
QList<Image> search(const ImageSearch &search);
QList<Image> getInDir(const Directory &dir);
int maxPageNb(ImageSearch search);
private:
bool create(Image &image);
bool update(Image &image);
Image fromRecord(QSqlRecord record);
};
#endif // IMAGEDAO_H
|
7e18fa0506aa0d410abb768426994becc5ceeff1
|
1824b659c0fc57a92a27f451d875c2c50e05df98
|
/Spoj/cprmt.cpp
|
a99f39ffae66200abf36eaa851692d494b2bad97
|
[] |
no_license
|
convexhull/codechef-ds-and-algo-solutions
|
78b46c51926ac38984d877b9c97cb0213b4003ea
|
dde7f8d768c3eb7d2184aba74c4722a54e73f3f8
|
refs/heads/master
| 2022-08-10T18:02:46.802337
| 2020-05-23T12:16:36
| 2020-05-23T12:16:36
| 266,325,011
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 541
|
cpp
|
cprmt.cpp
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
string a,b;
while(cin>>a)
{
cin>>b;
string ans;
vector<int>marka(200);
vector<int>markb(200);
for(auto x:a)
marka[x]++;
for(auto x:b)
markb[x]++;
for(int i=96;i<=130;i++)
{
int t=min(marka[i],markb[i]);
while(t--)
ans.push_back(i);
}
cout<<ans<<endl;
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.