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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4f347539d9093e400948ab928645128d175a70a1 | a9ffbbebac6555279efbf865e4b46cd9dafddc14 | /src/tests/SpMV.cpp | 84916ad4f905e6f558aaa2438bf0aa10ec7ec58b | [] | no_license | GPUPeople/faimGraph | ad7caa26b4d29a3a8ed345a72cb23cdf41e01f28 | d54a72ee54f8f6a614a32d6625b9f3caf56c59ea | refs/heads/master | 2023-04-09T19:31:24.998002 | 2021-04-23T10:24:33 | 2021-04-23T10:24:33 | 272,967,532 | 8 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 28,140 | cpp | SpMV.cpp | //------------------------------------------------------------------------------
// SpMV.cpp
//
// faimGraph
//
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
// Library Includes
//
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <algorithm>
//------------------------------------------------------------------------------
// Includes
//
#include "MemoryManager.h"
#include "GraphParser.h"
#include "faimGraph.h"
#include "EdgeUpdate.h"
#include "VertexUpdate.h"
#include "ConfigurationParser.h"
#include "CSVWriter.h"
#include "SpMV.h"
#include "SpMM.h"
template <typename VertexDataType, typename EdgeDataType>
void testrunImplementationMV(const std::shared_ptr<Config>& config, const std::unique_ptr<Testruns>& testrun);
template <typename VertexDataType, typename EdgeDataType>
void testrunImplementationMM(const std::shared_ptr<Config>& config, const std::unique_ptr<Testruns>& testrun);
template <typename VertexDataType, typename VertexUpdateType, typename EdgeDataType, typename UpdateDataType>
void verification(std::unique_ptr<faimGraph<VertexDataType, VertexUpdateType, EdgeDataType, UpdateDataType>>& aimGraph, const std::string& outputstring, std::unique_ptr<GraphParser>& parser, const std::unique_ptr<Testruns>& testrun, int round, int updateround, bool duplicate_check);
template <typename VertexDataType, typename VertexUpdateType, typename EdgeDataType, typename UpdateDataType>
void verificationMMMultiplication(std::unique_ptr<faimGraph<VertexDataType, VertexUpdateType, EdgeDataType, UpdateDataType>>& aimGraph, const std::string& outputstring, std::unique_ptr<GraphParser>& parser, const std::unique_ptr<Testruns>& testrun, int round, int updateround, bool duplicate_check, std::unique_ptr<SpMMManager>& spmm);
//#define SPMM
int main(int argc, char *argv[])
{
if (argc != 2)
{
std::cout << "Usage: ./spmv <configuration-file>" << std::endl;
return RET_ERROR;
}
std::cout << "########## faimGraph Demo ##########" << std::endl;
// Query device properties
//queryAndPrintDeviceProperties();
ConfigurationParser config_parser(argv[1]);
std::cout << "Parse Configuration File" << std::endl;
auto config = config_parser.parseConfiguration();
// Print the configuration information
printConfigurationInformation(config);
cudaDeviceProp prop;
cudaSetDevice(config->deviceID_);
HANDLE_ERROR(cudaGetDeviceProperties(&prop, config->deviceID_));
std::cout << "Used GPU Name: " << prop.name << std::endl;
// Perform testruns
for (const auto& testrun : config->testruns_)
{
if (testrun->params->memory_layout_ == ConfigurationParameters::MemoryLayout::AOS)
{
#ifdef SPMM
testrunImplementationMV <VertexData, EdgeDataMatrix>(config, testrun);
#else
testrunImplementationMM <VertexData, EdgeDataMatrix>(config, testrun);
#endif
}
else if (testrun->params->memory_layout_ == ConfigurationParameters::MemoryLayout::SOA)
{
#ifdef SPMM
testrunImplementationMV <VertexData, EdgeDataMatrixSOA>(config, testrun);
#else
testrunImplementationMM <VertexData, EdgeDataMatrixSOA>(config, testrun);
#endif
}
else
{
std::cout << "Error parsing memory layout configuration" << std::endl;
}
}
return 0;
}
//------------------------------------------------------------------------------
//
template <typename VertexDataType, typename EdgeDataType>
void testrunImplementationMV(const std::shared_ptr<Config>& config, const std::unique_ptr<Testruns>& testrun)
{
// Timing
cudaEvent_t ce_start, ce_stop;
float time_diff;
std::vector<PerformanceData> perfData;
// Global Properties
bool realisticDeletion = true;
bool gpuVerification = true;
bool writeToFile = false;
bool duplicate_check = true;
unsigned int range = 1000;
unsigned int offset = 0;
int vertex_batch_size = 100;
int max_adjacency_size = 10;
for (auto batchsize : testrun->batchsizes)
{
std::cout << "Batchsize: " << batchsize << std::endl;
for (const auto& graph : testrun->graphs)
{
// Timing information
float time_elapsed_init = 0;
float time_elapsed_multiplication = 0;
float time_elapsed_transposeCSR = 0;
float time_elapsed_transpose = 0;
//Setup graph parser and read in file
std::unique_ptr<GraphParser> parser(new GraphParser(graph));
if (!parser->parseGraph())
{
std::cout << "Error while parsing graph" << std::endl;
return;
}
for (int i = 0; i < testrun->params->rounds_; i++, offset += range)
{
//------------------------------------------------------------------------------
// Initialization phase
//------------------------------------------------------------------------------
//
//std::cout << "Round: " << i + 1 << std::endl;
std::unique_ptr<faimGraph<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>> faimGraph(std::make_unique<faimGraph<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>>(config, parser));
std::unique_ptr<SpMVManager> spmv(std::make_unique<SpMVManager>(faimGraph->memory_manager->next_free_vertex_index, faimGraph->memory_manager->next_free_vertex_index));
start_clock(ce_start, ce_stop);
faimGraph->initializeMemory(parser);
time_diff = end_clock(ce_start, ce_stop);
time_elapsed_init += time_diff;
for (int j = 0; j < testrun->params->update_rounds_; j++)
{
//std::cout << "Update-Round: " << j + 1 << std::endl;
//------------------------------------------------------------------------------
// Start Timer for Multiplication
//------------------------------------------------------------------------------
//
/*spmv->generateRandomVector();
start_clock(ce_start, ce_stop);
spmv->deviceSpMV(aimGraph->memory_manager, config);
time_diff = end_clock(ce_start, ce_stop);
time_elapsed_multiplication += time_diff;*/
//------------------------------------------------------------------------------
// Start Timer for Transpose CSR
//------------------------------------------------------------------------------
//
start_clock(ce_start, ce_stop);
spmv->template transposeaim2CSR2aim<EdgeDataType>(faimGraph, config);
time_diff = end_clock(ce_start, ce_stop);
time_elapsed_transposeCSR += time_diff;
if (testrun->params->verification_)
{
// Transpose back and check if everything is still the same
spmv->template transposeaim2CSR2aim<EdgeDataType>(faimGraph, config);
verification<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>(faimGraph, "Test Transpose ", parser, testrun, i, j, false);
}
//------------------------------------------------------------------------------
// Start Timer for Transpose
//------------------------------------------------------------------------------
//
//start_clock(ce_start, ce_stop);
//spmv->transpose(aimGraph->memory_manager, config);
//time_diff = end_clock(ce_start, ce_stop);
//time_elapsed_transpose += time_diff;
}
}
// std::cout << "Time elapsed during initialization: ";
// std::cout << std::setw(10) << time_elapsed_init / static_cast<float>(testrun->params->rounds_) << " ms" << std::endl;
//std::cout << "Time elapsed during MV multiplication: ";
//std::cout << std::setw(10) << time_elapsed_multiplication / static_cast<float>(testrun->params->rounds_ * testrun->params->update_rounds_) << " ms" << std::endl;
std::cout << "Time elapsed during transpose CSR: ";
std::cout << std::setw(10) << time_elapsed_transposeCSR / static_cast<float>(testrun->params->rounds_ * testrun->params->update_rounds_) << " ms" << std::endl;
//std::cout << "Time elapsed during transpose: ";
//std::cout << std::setw(10) << time_elapsed_transpose / static_cast<float>(testrun->params->rounds_ * testrun->params->update_rounds_) << " ms" << std::endl;
}
std::cout << "################################################################" << std::endl;
std::cout << "################################################################" << std::endl;
std::cout << "################################################################" << std::endl;
}
// Increment the testrun index
config->testrun_index_++;
}
//------------------------------------------------------------------------------
//
template <typename VertexDataType, typename EdgeDataType>
void testrunImplementationMM(const std::shared_ptr<Config>& config, const std::unique_ptr<Testruns>& testrun)
{
// Timing
cudaEvent_t ce_start, ce_stop;
float time_diff;
std::vector<PerformanceData> perfData;
// Global Properties
bool gpuVerification = true;
bool writeToFile = false;
bool duplicate_check = true;
for (auto batchsize : testrun->batchsizes)
{
std::cout << "Batchsize: " << batchsize << std::endl;
for (const auto& graph : testrun->graphs)
{
// Timing information
float time_elapsed_init = 0;
float time_elapsed_multiplication = 0;
//Setup graph parser and read in file
std::unique_ptr<GraphParser> parser(new GraphParser(graph, true));
if (!parser->parseGraph())
{
std::cout << "Error while parsing graph" << std::endl;
return;
}
for (int i = 0; i < testrun->params->rounds_; i++)
{
//------------------------------------------------------------------------------
// Initialization phase
//------------------------------------------------------------------------------
//
std::cout << "Round: " << i + 1 << std::endl;
std::unique_ptr<faimGraph<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>> faimGraph(std::make_unique<faimGraph<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>>(config, parser));
std::unique_ptr<SpMMManager> spmm(std::make_unique<SpMMManager>(faimGraph->memory_manager->next_free_vertex_index, faimGraph->memory_manager->next_free_vertex_index, faimGraph->memory_manager->next_free_vertex_index, faimGraph->memory_manager->next_free_vertex_index));
start_clock(ce_start, ce_stop);
spmm->template initializeFaimGraphMatrix<EdgeDataType>(faimGraph, parser, config);
time_diff = end_clock(ce_start, ce_stop);
time_elapsed_init += time_diff;
for (int j = 0; j < testrun->params->update_rounds_; j++)
{
//std::cout << "Update-Round: " << j + 1 << std::endl;
//------------------------------------------------------------------------------
// Start Timer for Multiplication MM
//------------------------------------------------------------------------------
//
start_clock(ce_start, ce_stop);
spmm->template spmmMultiplication<EdgeDataType>(faimGraph, config);
time_diff = end_clock(ce_start, ce_stop);
time_elapsed_multiplication += time_diff;
/*std::cout << "Time elapsed during MM multiplication: ";
std::cout << std::setw(10) << time_diff << " ms" << std::endl;*/
//hostMatrixMultiplyWriteToFile(parser, spmm->output_rows, spmm->output_columns, graph + ".matrix");
if (testrun->params->verification_)
{
verificationMMMultiplication<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>(faimGraph, "Test Multiplication ", parser, testrun, i, j, false, spmm, graph + ".matrix");
}
spmm->template resetResultMatrix <EdgeDataType>(faimGraph, config);
}
}
std::cout << "Time elapsed during initialization: ";
std::cout << std::setw(10) << time_elapsed_init / static_cast<float>(testrun->params->rounds_) << " ms" << std::endl;
std::cout << "Time elapsed during MM multiplication: ";
std::cout << std::setw(10) << time_elapsed_multiplication / static_cast<float>(testrun->params->rounds_ * testrun->params->update_rounds_) << " ms" << std::endl;
}
std::cout << "################################################################" << std::endl;
std::cout << "################################################################" << std::endl;
std::cout << "################################################################" << std::endl;
}
// Increment the testrun index
config->testrun_index_++;
}
//------------------------------------------------------------------------------
//
//template <typename VertexDataType, typename EdgeDataType>
//void testrunImplementationMM(const std::shared_ptr<Config>& config, const std::unique_ptr<Testruns>& testrun)
//{
// // Timing
// cudaEvent_t ce_start, ce_stop;
// float time_diff;
// std::vector<PerformanceData> perfData;
//
// // Global Properties
// bool gpuVerification = true;
// bool writeToFile = false;
// bool duplicate_check = true;
//
// for (auto batchsize : testrun->batchsizes)
// {
// std::cout << "Batchsize: " << batchsize << std::endl;
// for (const auto& graph : testrun->graphs)
// {
// // Timing information
// float time_elapsed_init = 0;
// float time_elapsed_multiplication = 0;
//
// //Setup graph parser and read in file
// std::unique_ptr<GraphParser> parser(new GraphParser(graph, true));
// if (!parser->parseGraph())
// {
// std::cout << "Error while parsing graph" << std::endl;
// return;
// }
//
// for (int i = 0; i < testrun->params->rounds_; i++)
// {
// //------------------------------------------------------------------------------
// // Initialization phase
// //------------------------------------------------------------------------------
// //
// std::cout << "Round: " << i + 1 << std::endl;
//
// config->device_mem_size_ /= 3;
//
// std::unique_ptr<aimGraph<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>> input_matrix_A(std::make_unique<aimGraph<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>>(config, parser));
// std::unique_ptr<aimGraph<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>> input_matrix_B(std::make_unique<aimGraph<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>>(config, parser));
// std::unique_ptr<aimGraph<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>> output_matrix(std::make_unique<aimGraph<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>>(config, parser));
// std::unique_ptr<SpMMManager> spmm(std::make_unique<SpMMManager>(input_matrix_A->memory_manager->next_free_vertex_index, input_matrix_A->memory_manager->next_free_vertex_index, input_matrix_A->memory_manager->next_free_vertex_index, input_matrix_A->memory_manager->next_free_vertex_index));
//
// start_clock(ce_start, ce_stop);
//
// input_matrix_A->initializeaimGraphMatrix(parser);
// input_matrix_B->initializeaimGraphMatrix(parser);
// output_matrix->initializeaimGraphEmptyMatrix(parser->getNumberOfVertices());
//
// time_diff = end_clock(ce_start, ce_stop);
// time_elapsed_init += time_diff;
//
// for (int j = 0; j < testrun->params->update_rounds_; j++)
// {
// //std::cout << "Update-Round: " << j + 1 << std::endl;
//
// //------------------------------------------------------------------------------
// // Start Timer for Multiplication MM
// //------------------------------------------------------------------------------
// //
// start_clock(ce_start, ce_stop);
//
// spmm->template spmmMultiplication<EdgeDataType>(input_matrix_A, input_matrix_B, output_matrix, config);
//
// time_diff = end_clock(ce_start, ce_stop);
// time_elapsed_multiplication += time_diff;
//
// std::cout << "Time elapsed during MM multiplication: ";
// std::cout << std::setw(10) << time_diff << " ms" << std::endl;
//
// if (testrun->params->verification_)
// {
// verificationMMMultiplication<VertexDataType, VertexUpdate, EdgeDataType, EdgeDataUpdate>(output_matrix, "Test Multiplication ", parser, testrun, i, j, false, spmm);
// }
//
// spmm->template resetResultMatrix <EdgeDataType>(output_matrix, config, true);
// }
// }
//
// std::cout << "Time elapsed during initialization: ";
// std::cout << std::setw(10) << time_elapsed_init / static_cast<float>(testrun->params->rounds_) << " ms" << std::endl;
//
// std::cout << "Time elapsed during MM multiplication: ";
// std::cout << std::setw(10) << time_elapsed_multiplication / static_cast<float>(testrun->params->rounds_ * testrun->params->update_rounds_) << " ms" << std::endl;
// }
// std::cout << "################################################################" << std::endl;
// std::cout << "################################################################" << std::endl;
// std::cout << "################################################################" << std::endl;
// }
// // Increment the testrun index
// config->testrun_index_++;
//}
//------------------------------------------------------------------------------
//
template <typename VertexDataType, typename VertexUpdateType, typename EdgeDataType, typename UpdateDataType>
void verification(std::unique_ptr<faimGraph<VertexDataType, VertexUpdateType, EdgeDataType, UpdateDataType>>& aimGraph,
const std::string& outputstring,
std::unique_ptr<GraphParser>& parser,
const std::unique_ptr<Testruns>& testrun,
int round,
int updateround,
bool duplicate_check)
{
std::cout << "############ " << outputstring << " " << (round * testrun->params->rounds_) + updateround << " ############" << std::endl;
std::unique_ptr<aimGraphCSR> verify_graph = aimGraph->verifyGraphStructure(aimGraph->memory_manager);
// Compare graph structures
if (!aimGraph->compareGraphs(parser, verify_graph, duplicate_check))
{
std::cout << "########## Graphs are NOT the same ##########" << std::endl;
exit(-1);
}
}
std::unique_ptr<CSRMatrix> hostMatrixMultiply(std::unique_ptr<GraphParser>& parser, vertex_t number_rows, vertex_t number_columns)
{
std::unique_ptr<CSRMatrix> csr_matrix(std::make_unique<CSRMatrix>());
auto const& offset = parser->getOffset();
auto const& adjacency = parser->getAdjacency();
auto const& matrix_values = parser->getMatrixValues();
//for (int i = 0; i < offset[1282] - offset[1281]; ++i)
//{
// std::cout << "Dest: " << adjacency[offset[1281] + i] << " Val: " << matrix_values[offset[1281] + i] << std::endl;
//}
//std::cout << "###########" << std::endl;
//for (int j = 0; j < offset[1281] - offset[1280]; ++j)
//{
// std::cout << "Dest: " << adjacency[offset[1280] + j] << " Val: " << matrix_values[offset[1280] + j] << std::endl;
//}
//std::cout << "###########" << std::endl;
//for (int j = 0; j < offset[1283] - offset[1282]; ++j)
//{
// std::cout << "Dest: " << adjacency[offset[1282] + j] << " Val: " << matrix_values[offset[1282] + j] << std::endl;
//}
//std::cout << "###########" << std::endl;
//for (int j = 0; j < offset[107873] - offset[107872]; ++j)
//{
// std::cout << "Dest: " << adjacency[offset[107872] + j] << " Val: " << matrix_values[offset[107872] + j] << std::endl;
//}
csr_matrix->offset.resize(offset.size(), 0);
for (unsigned int i = 0; i < offset.size() - 1; ++i)
{
vertex_t neighbours = offset[i + 1] - offset[i];
auto A_adjacency_iterator = adjacency.begin() + offset[i];
auto A_matrix_value_iterator = matrix_values.begin() + offset[i];
for (unsigned int j = 0; j < neighbours; ++j)
{
vertex_t A_destination = A_adjacency_iterator[j];
matrix_t A_value = A_matrix_value_iterator[j];
vertex_t B_neighbours = offset[A_destination + 1] - offset[A_destination];
auto B_adjacency_iterator = adjacency.begin() + offset[A_destination];
auto B_matrix_value_iterator = matrix_values.begin() + offset[A_destination];
/*if (i == 66327)
{
std::cout << "A_Destination: " << A_destination << " and value: " << A_value << std::endl;
}*/
for (unsigned int k = 0; k < B_neighbours; ++k)
{
vertex_t B_destination = B_adjacency_iterator[k];
matrix_t B_value = B_matrix_value_iterator[k];
/*if (i == 66327)
{
std::cout << "B_Destination: " << B_destination << " and value: " << B_value << " at position: " << offset[A_destination] + k << std::endl;
}*/
B_value *= A_value;
// Check if value is already here or not
auto begin_iter = csr_matrix->adjacency.begin() + csr_matrix->offset[i];
auto end_iter = csr_matrix->adjacency.begin() + csr_matrix->offset[i + 1];
// Search if item is present
auto pos = std::find(begin_iter, end_iter, B_destination);
if (pos != end_iter)
{
// Edge already present, add new factor
vertex_t position = pos - csr_matrix->adjacency.begin();
csr_matrix->matrix_values[position] += B_value;
}
else
{
// Insert edge
auto matrix_iter = csr_matrix->matrix_values.begin() + (pos - csr_matrix->adjacency.begin());
csr_matrix->adjacency.insert(pos, B_destination);
csr_matrix->matrix_values.insert(matrix_iter, B_value);
for (auto l = i + 1; l < (csr_matrix->offset.size()); ++l)
{
csr_matrix->offset[l] += 1;
}
}
}
}
if(i % 10000 == 0)
std::cout << "HOST: Handled " << i << " vertices" << std::endl;
}
std::cout << "HOST: Number edges: " << csr_matrix->adjacency.size() << std::endl;
return std::move(csr_matrix);
}
void hostMatrixMultiplyWriteToFile(std::unique_ptr<GraphParser>& parser, vertex_t number_rows, vertex_t number_columns, const std::string& filename)
{
std::unique_ptr<CSRMatrix> csr_matrix(std::make_unique<CSRMatrix>());
std::cout << "Write to file with name: " << filename << std::endl;
auto const& offset = parser->getOffset();
auto const& adjacency = parser->getAdjacency();
auto const& matrix_values = parser->getMatrixValues();
csr_matrix->offset.resize(offset.size(), 0);
for (unsigned int i = 0; i < offset.size() - 1; ++i)
{
vertex_t neighbours = offset[i + 1] - offset[i];
auto A_adjacency_iterator = adjacency.begin() + offset[i];
auto A_matrix_value_iterator = matrix_values.begin() + offset[i];
for (unsigned int j = 0; j < neighbours; ++j)
{
vertex_t A_destination = A_adjacency_iterator[j];
matrix_t A_value = A_matrix_value_iterator[j];
vertex_t B_neighbours = offset[A_destination + 1] - offset[A_destination];
auto B_adjacency_iterator = adjacency.begin() + offset[A_destination];
auto B_matrix_value_iterator = matrix_values.begin() + offset[A_destination];
for (unsigned int k = 0; k < B_neighbours; ++k)
{
vertex_t B_destination = B_adjacency_iterator[k];
matrix_t B_value = B_matrix_value_iterator[k];
B_value *= A_value;
// Check if value is already here or not
auto begin_iter = csr_matrix->adjacency.begin() + csr_matrix->offset[i];
auto end_iter = csr_matrix->adjacency.begin() + csr_matrix->offset[i + 1];
// Search if item is present
auto pos = std::find(begin_iter, end_iter, B_destination);
if (pos != end_iter)
{
// Edge already present, add new factor
vertex_t position = pos - csr_matrix->adjacency.begin();
csr_matrix->matrix_values[position] += B_value;
}
else
{
// Insert edge
auto matrix_iter = csr_matrix->matrix_values.begin() + (pos - csr_matrix->adjacency.begin());
csr_matrix->adjacency.insert(pos, B_destination);
csr_matrix->matrix_values.insert(matrix_iter, B_value);
for (auto l = i + 1; l < (csr_matrix->offset.size()); ++l)
{
csr_matrix->offset[l] += 1;
}
}
}
}
if (i % 10 == 0)
std::cout << "HOST: Handled " << i << " vertices" << std::endl;
}
std::cout << "HOST: Number edges: " << csr_matrix->adjacency.size() << std::endl;
// Write to File
std::ofstream matrix_file(filename);
// Write number of vertices and edges
matrix_file << number_rows << " " << csr_matrix->adjacency.size() << std::endl;
for (unsigned int i = 0; i < offset.size() - 1; ++i)
{
int offset = csr_matrix->offset[i];
int neighbours = csr_matrix->offset[i + 1] - csr_matrix->offset[i];
for (int j = 0; j < neighbours; ++j)
{
matrix_file << csr_matrix->adjacency[offset + j] << " ";
matrix_file << csr_matrix->matrix_values[offset + j];
if (j < (neighbours - 1))
matrix_file << " ";
}
matrix_file << "\n";
}
matrix_file.close();
return;
}
std::unique_ptr<CSRMatrix> hostReadMatrixMultiplyFromFile(const std::string& filename)
{
std::unique_ptr<CSRMatrix> csr_matrix(std::make_unique<CSRMatrix>());
std::ifstream graph_file(filename);
std::string line;
vertex_t number_vertices;
vertex_t number_edges;
vertex_t offset{ 0 };
// Parse in number vertices and number edges
std::getline(graph_file, line);
std::istringstream istream(line);
istream >> number_vertices;
istream >> number_edges;
std::cout << "Comparsion-Matrix | #v: " << number_vertices << " | #e: " << number_edges << std::endl;
while (std::getline(graph_file, line))
{
vertex_t adjacency;
matrix_t matrix_value;
csr_matrix->offset.push_back(offset);
std::istringstream istream(line);
while (!istream.eof())
{
istream >> adjacency;
istream >> matrix_value;
++offset;
csr_matrix->adjacency.push_back(adjacency);
csr_matrix->matrix_values.push_back(matrix_value);
}
}
csr_matrix->offset.push_back(offset);
graph_file.close();
return std::move(csr_matrix);
}
//------------------------------------------------------------------------------
//
template <typename VertexDataType, typename VertexUpdateType, typename EdgeDataType, typename UpdateDataType>
void verificationMMMultiplication(std::unique_ptr<faimGraph<VertexDataType, VertexUpdateType, EdgeDataType, UpdateDataType>>& aimGraph,
const std::string& outputstring,
std::unique_ptr<GraphParser>& parser,
const std::unique_ptr<Testruns>& testrun,
int round,
int updateround,
bool duplicate_check,
std::unique_ptr<SpMMManager>& spmm,
const std::string& matrix_file)
{
std::cout << "############ " << outputstring << " " << (round * testrun->params->rounds_) + updateround << " ############" << std::endl;
std::unique_ptr<aimGraphCSR> verify_graph = aimGraph->verifyMatrixStructure(aimGraph->memory_manager, spmm->output_offset, spmm->output_rows);
//auto csrmatrix = hostMatrixMultiply(parser, spmm->output_rows, spmm->output_columns);
std::cout << "Parsing result matrix" << std::endl;
auto csrmatrix = hostReadMatrixMultiplyFromFile(matrix_file);
std::cout << "Verification in progress" << std::endl;
// Compare graph structures
if (!aimGraph->compareGraphs(csrmatrix, verify_graph, duplicate_check))
{
std::cout << "########## Graphs are NOT the same ##########" << std::endl;
exit(-1);
}
}
|
68faa5352420c2b9fab48fab03515c0d9760dbce | 2ec026e28db6c5e9c1605eff08c0ae5f98c35675 | /src/actions/watch.h | 418a9d389ae7e497d577bda90db73e50bb2cd2f6 | [] | no_license | hoxha-saber/mipsdbg | 249f8f85d4adaea43ac193e542eac1420a37a152 | bb7ddfbf27df63c31907cd1d39d355a209b90758 | refs/heads/master | 2022-12-06T04:15:13.488233 | 2020-08-19T15:09:06 | 2020-08-19T15:09:06 | 270,061,559 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 367 | h | watch.h | #ifndef WATCH_H
#define WATCH_H
#include "action.h"
class WatchAction : public Action {
uint32_t addr;
public:
WatchAction(uint32_t x);
void Execute(MIPS::Debugger &dbg) override;
};
class WatchRemoveAction : public Action {
uint32_t addr;
public:
WatchRemoveAction(uint32_t x);
void Execute(MIPS::Debugger &dbg) override;
};
#endif |
c16f7442e6b5085a61ae9f59d92f5c9de0bc80a3 | dc3274326782b866acf8112af0229a1ad00b10d7 | /src/level_editor/undo_buffer.hpp | e31ebbc5b0ed4defbe88fccbf1de37c4df68b89f | [] | no_license | MBeijer/graal-gonstruct | bcc1b5c5a47afcb7bf4da7ebb8cb2abba2dabe8f | 26ceb1b597329deac790ef2e4e960063f6c5470c | refs/heads/master | 2022-12-22T01:41:07.912484 | 2020-10-02T21:37:06 | 2020-10-02T21:37:06 | 300,091,782 | 0 | 0 | null | 2020-09-30T23:53:18 | 2020-09-30T23:53:17 | null | UTF-8 | C++ | false | false | 496 | hpp | undo_buffer.hpp | #ifndef GRAAL_LEVEL_EDITOR_UNDO_BUFFER_HPP_
#define GRAAL_LEVEL_EDITOR_UNDO_BUFFER_HPP_
#include <boost/ptr_container/ptr_list.hpp>
#include "undo_diffs.hpp"
namespace Graal {
namespace level_editor {
class undo_buffer {
public:
basic_diff* apply(Graal::level_editor::level_map& target);
void clear();
bool empty();
void push(basic_diff* diff);
private:
typedef boost::ptr_list<basic_diff> undos_type;
undos_type m_undos;
};
}
}
#endif
|
068fab51b6c37816293c7f86bfff8c681e957b67 | 5ee0eb940cfad30f7a3b41762eb4abd9cd052f38 | /Case_save/case2/100/T | 45755d0273e564517131440b632cd89c1220fa99 | [] | no_license | mamitsu2/aircond5_play4 | 052d2ff593661912b53379e74af1f7cee20bf24d | c5800df67e4eba5415c0e877bdeff06154d51ba6 | refs/heads/master | 2020-05-25T02:11:13.406899 | 2019-05-20T04:56:10 | 2019-05-20T04:56:10 | 187,570,146 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,209 | T | // -*- C++ -*-
// File generated by PyFoam - sorry for the ugliness
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "100";
object T;
}
dimensions [ 0 0 0 1 0 0 0 ];
internalField nonuniform List<scalar> 459
(
301.797
301.518
301.479
301.453
301.429
301.423
301.451
301.478
301.506
301.535
301.566
301.599
301.633
301.672
301.726
302.526
302.441
302.381
302.362
302.395
302.428
302.46
302.491
302.523
302.555
302.588
302.621
302.656
302.692
302.729
302.769
302.815
302.875
302.972
301.959
301.546
301.48
301.431
301.375
301.364
301.389
301.421
301.455
301.486
301.517
301.551
301.59
301.635
301.69
301.718
301.763
302.553
302.456
302.293
302.289
302.329
302.378
302.412
302.445
302.479
302.513
302.548
302.584
302.622
302.662
302.704
302.75
302.804
302.873
302.979
302.152
301.624
301.541
301.429
301.334
301.323
301.352
301.398
301.442
301.48
301.511
301.544
301.58
301.62
301.667
301.705
301.749
302.548
302.305
302.212
302.23
302.303
302.383
302.407
302.438
302.471
302.507
302.546
302.588
302.634
302.683
302.733
302.784
302.837
302.9
302.998
302.353
301.735
301.584
301.392
301.291
301.281
301.328
301.396
301.46
301.509
301.544
301.575
301.605
301.636
301.671
301.705
301.741
301.766
301.873
301.933
302.04
302.185
302.337
302.469
302.573
302.652
302.721
302.786
302.848
302.908
302.967
303.027
303.085
303.014
302.965
302.963
303.026
302.583
301.876
301.543
301.3
301.206
301.232
301.324
301.432
301.526
301.591
301.637
301.663
301.679
301.693
301.711
301.734
301.761
301.797
301.865
301.986
302.157
302.349
302.533
302.689
302.819
302.918
303.001
303.068
303.123
303.167
303.203
303.228
303.239
303.175
303.084
303.035
303.059
303.397
303.799
303.706
302.843
302.1
301.402
301.08
301.07
301.211
301.393
301.561
301.687
301.773
301.811
301.81
301.8
301.796
301.802
301.821
301.859
301.938
302.075
302.257
302.464
302.668
302.848
302.993
303.108
303.199
303.263
303.313
303.352
303.381
303.398
303.4
303.382
303.308
303.202
303.123
303.11
303.28
303.439
303.538
301.268
300.456
299.997
300.426
300.98
301.409
301.706
301.903
302.036
302.055
302.025
301.995
301.973
301.968
301.983
302.025
302.11
302.259
302.461
302.675
302.882
303.065
303.214
303.328
303.417
303.471
303.509
303.538
303.56
303.572
303.574
303.56
303.525
303.444
303.34
303.248
303.207
303.274
303.356
303.446
299.831
298.124
298.011
301.607
302.322
302.426
302.416
302.389
302.354
302.318
302.283
302.26
302.253
302.268
302.312
302.394
302.53
302.729
302.951
303.165
303.338
303.473
303.574
303.643
303.685
303.71
303.728
303.741
303.747
303.746
303.736
303.713
303.674
303.611
303.516
303.431
303.389
303.434
303.493
303.636
299.118
297.346
297.189
302.302
302.845
302.859
302.799
302.737
302.689
302.656
302.639
302.64
302.662
302.709
302.788
302.904
303.06
303.248
303.436
303.6
303.724
303.81
303.866
303.898
303.915
303.924
303.928
303.929
303.924
303.913
303.894
303.868
303.837
303.809
303.793
303.801
303.84
303.894
303.93
304.031
293.909
302.524
303.171
303.198
303.155
303.114
303.084
303.074
303.082
303.108
303.155
303.225
303.319
303.438
303.575
303.719
303.851
303.957
304.033
304.081
304.108
304.12
304.124
304.122
304.116
304.105
304.09
304.068
304.04
304.009
303.979
303.955
303.944
303.952
303.987
304.052
304.164
304.498
303.03
303.463
303.558
303.562
303.547
303.535
303.532
303.543
303.569
303.611
303.668
303.739
303.823
303.918
304.016
304.11
304.189
304.249
304.289
304.312
304.322
304.323
304.318
304.309
304.295
304.276
304.251
304.222
304.189
304.154
304.12
304.09
304.067
304.059
304.072
304.14
304.292
304.465
303.81
303.741
303.722
303.98
304.038
304.049
304.059
304.072
304.087
304.11
304.142
304.18
304.225
304.274
304.326
304.378
304.426
304.468
304.5
304.522
304.534
304.538
304.535
304.528
304.517
304.503
304.485
304.464
304.439
304.411
304.379
304.345
304.309
304.272
304.238
304.212
304.222
304.296
304.42
304.688
)
;
boundaryField
{
floor
{
type wallHeatTransfer;
Tinf uniform 305.2;
alphaWall uniform 0.24;
value nonuniform List<scalar> 29
(
302.103
302.916
302.8
302.71
302.67
302.689
302.721
302.763
302.808
302.853
302.898
302.942
302.985
303.028
303.071
303.114
303.16
303.212
303.277
303.383
303.383
303.367
303.373
303.389
302.103
302.916
302.948
302.947
302.108
)
;
}
ceiling
{
type wallHeatTransfer;
Tinf uniform 303.2;
alphaWall uniform 0.24;
value nonuniform List<scalar> 43
(
303.762
303.7
303.683
303.918
303.968
303.979
303.988
304.001
304.016
304.038
304.067
304.103
304.144
304.189
304.236
304.282
304.324
304.36
304.385
304.401
304.407
304.406
304.4
304.39
304.376
304.36
304.341
304.319
304.294
304.267
304.239
304.208
304.177
304.147
304.12
304.099
304.111
304.173
304.277
304.516
299.331
297.641
303.041
)
;
}
sWall
{
type wallHeatTransfer;
Tinf uniform 315.2;
alphaWall uniform 0.36;
value uniform 305.117;
}
nWall
{
type wallHeatTransfer;
Tinf uniform 307.2;
alphaWall uniform 0.36;
value nonuniform List<scalar> 6
(
304.383
304.223
304.088
304.902
304.864
305.103
)
;
}
sideWalls
{
type empty;
}
glass1
{
type wallHeatTransfer;
Tinf uniform 315.2;
alphaWall uniform 4.3;
value nonuniform List<scalar> 9
(
310.043
309.56
309.224
308.981
309.008
309.172
307.855
306.816
307.193
)
;
}
glass2
{
type wallHeatTransfer;
Tinf uniform 307.2;
alphaWall uniform 4.3;
value nonuniform List<scalar> 2
(
305.921
306.093
)
;
}
sun
{
type wallHeatTransfer;
Tinf uniform 305.2;
alphaWall uniform 0.24;
value nonuniform List<scalar> 14
(
302.07
301.788
301.741
301.702
301.673
301.669
301.707
301.745
301.784
301.826
301.871
301.918
301.968
302.025
)
;
}
heatsource1
{
type fixedGradient;
gradient uniform 0;
}
heatsource2
{
type fixedGradient;
gradient uniform 0;
}
Table_master
{
type zeroGradient;
}
Table_slave
{
type zeroGradient;
}
inlet
{
type fixedValue;
value uniform 290.15;
}
outlet
{
type zeroGradient;
}
} // ************************************************************************* //
| |
3ae6ea860e3cd3a5cc45398e834a3ccef39523e9 | 43456104272092dbf96bca396ef42ab643b63628 | /spatial.cpp | ecc5a34eea71ff3faa99175dadcd12e8323d2ace | [] | no_license | chrisdembia/feather | 79a40fe6858192674fd8615ed269d10f0f8899a3 | ba9dea9f4d5951c0f6271a3a509a305998aa3c59 | refs/heads/master | 2016-09-05T20:48:17.832978 | 2011-11-14T01:52:16 | 2011-11-14T01:52:16 | 2,768,618 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,898 | cpp | spatial.cpp | #include <armadillo>
#include <cmath>
#include "spatial.h"
using namespace arma;
mat rx( double theta)
{
double c = cos(theta);
double s = sin(theta);
mat RX(3,3);
RX << 1.0 << 0.0 << 0.0 << endr
<< 0.0 << c << s << endr
<< 0.0 << -s << c << endr;
return RX;
}
mat ry( double theta)
{
double c = cos(theta);
double s = sin(theta);
mat RY(3,3);
RY << c << 0.0 << -s << endr
<< 0.0 << 1.0 << 0.0 << endr
<< s << 0.0 << c << endr;
return RY;
}
mat rz( double theta)
{
double c = cos(theta);
double s = sin(theta);
mat RY(3,3);
RY << c << s << 0.0 << endr
<< -s << c << 0.0 << endr
<< 0.0 << 0.0 << 1.0 << endr;
return RY;
}
mat crmp( vec v)
{
if ( v.n_elem != 3 )
cout << "function crmp: v.n_elem != 3 " << v << endl;
mat V(3,3);
V << 0.0 << -v(2) << v(1) << endr
<< v(2) << 0.0 << -v(0) << endr
<< -v(1) << v(0) << 0.0 << endr;
return V;
}
mat rotx( double theta)
{
mat E = rx(theta);
mat X = zeros<mat>(6,6);
X( span(0,2), span(0,2) ) = E;
X( span(3,5), span(3,5) ) = E;
return X;
}
mat roty( double theta)
{
mat E = ry(theta);
mat X = zeros<mat>(6,6);
X( span(0,2), span(0,2) ) = E;
X( span(3,5), span(3,5) ) = E;
return X;
}
mat rotz( double theta)
{
mat E = rz(theta);
mat X = zeros<mat>(6,6);
X( span(0,2), span(0,2) ) = E;
X( span(3,5), span(3,5) ) = E;
return X;
}
mat xlt( vec r)
{
if ( r.n_elem != 3 )
cout << "function xlt: r.n_elem != 3 " << r << endl;
mat X = eye<mat>(6,6);
X( span(3,5), span(0,2) ) = -crmp(r);
return X;
}
mat crm( vec v)
{
if ( v.n_elem != 6 )
cout << "function crm: v.n_elem != 6 " << v << endl;
mat V = zeros<mat>(6,6);
V( span(0,2), span(0,2) ) = crmp( v.rows(0,2) );
V( span(3,5), span(3,5) ) = crmp( v.rows(0,2) );
V( span(3,5), span(0,2) ) = crmp( v.rows(3,5) );
return V;
}
mat crf( vec v)
{
if ( v.n_elem != 6 )
cout << "function crf: v.n_elem != 6 " << v << endl;
return -trans(crm(v));
}
mat mcI( double m, vec c, mat Ic)
{
if ( c.n_elem != 3 )
cout << "function mcI: c.n_elem != 3 " << c << endl;
if ( Ic.n_elem != 9 )
cout << "function mcI: Ic.n_elem != 9 " << Ic << endl;
mat I(6,6);
I( span(0,2), span(0,2) ) = Ic - m * crmp(c) * crmp(c);
I( span(0,2), span(3,5) ) = m * crmp(c);
I( span(3,5), span(0,2) ) = -m * crmp(c);
I( span(3,5), span(3,5) ) = m * eye<mat>(3,3);
return I;
}
vec XtoV( mat X)
{
if ( X.n_elem != 36 )
cout << "function XtoV X.n_elem != 36 " << X << endl;
vec v(6);
v(0) = X(1,2) - X(2,1);
v(1) = X(2,0) - X(0,2);
v(2) = X(0,1) - X(1,0);
v(3) = X(4,2) - X(5,1);
v(4) = X(5,0) - X(3,2);
v(5) = X(3,1) - X(4,0);
v = 0.5*v;
return v;
}
|
d90c3de3ab0386fe76d679b7d9a88f190b82f106 | 9162a3334cadf6e4f724425a261d68070adb431f | /Luogu/P1776.cpp | 6c2d10b190b67bef6addd0ab3107ff241ddafd70 | [] | 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,133 | cpp | P1776.cpp | #include<bits/stdc++.h>
using namespace std;
#define reg register
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
static char buf[1<<21],*p1=buf,*p2=buf;
inline int read(void){
reg bool f=false;
reg char ch=getchar();
reg int res=0;
while(!isdigit(ch)) f|=(ch=='-'),ch=getchar();
while(isdigit(ch)) res=10*res+(ch^'0'),ch=getchar();
return f?-res:res;
}
const int MAXN=100+5;
const int MAXLOG2N=20+1;
const int MAXW=40000+5;
int n,W;
int v[MAXN*MAXLOG2N],w[MAXN*MAXLOG2N],cnt[MAXN*MAXLOG2N];
int dp[MAXW];
inline void Read(void);
inline void Work(void);
int main(void){
Read();
Work();
return 0;
}
inline void Read(void){
n=read(),W=read();
for(reg int i=1;i<=n;++i)
v[i]=read(),w[i]=read(),cnt[i]=read();
return;
}
inline void Work(void){
reg int tot=n;
for(reg int i=1;i<=n;++i){
for(reg int j=1;j<=cnt[i];j<<=1){
cnt[i]-=j;
v[++tot]=v[i]*j;
w[tot]=w[i]*j;
}
if(cnt[i]){
v[++tot]=v[i]*cnt[i];
w[tot]=w[i]*cnt[i];
}
}
for(reg int i=n+1;i<=tot;++i)
for(reg int j=W;j>=w[i];--j)
dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
printf("%d\n",dp[W]);
return;
} |
9b6838d18c90ed6d6b8aa105eb394905c856855a | 2f78e134c5b55c816fa8ee939f54bde4918696a5 | /code/3rdparty/hk410/include/physics/hkvehicle/tyremarks/hkTyremarksInfoClass.cpp | 20142ebb8c3fa45be2c982244e90df5bb40dea38 | [] | no_license | narayanr7/HeavenlySword | b53afa6a7a6c344e9a139279fbbd74bfbe70350c | a255b26020933e2336f024558fefcdddb48038b2 | refs/heads/master | 2022-08-23T01:32:46.029376 | 2020-05-26T04:45:56 | 2020-05-26T04:45:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,164 | cpp | hkTyremarksInfoClass.cpp | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent.This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2006 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
// WARNING: THIS FILE IS GENERATED. EDITS WILL BE LOST.
// Generated from 'hkvehicle/tyremarks/hkTyremarksInfo.h'
#include <hkvehicle/hkVehicle.h>
#include <hkbase/class/hkClass.h>
#include <hkbase/class/hkInternalClassMember.h>
#include <hkvehicle/tyremarks/hkTyremarksInfo.h>
// External pointer and enum types
extern const hkClass hkTyremarkPointClass;
extern const hkClass hkTyremarksWheelClass;
//
// Class hkTyremarkPoint
//
static const hkInternalClassMember hkTyremarkPointClass_Members[] =
{
{ "pointLeft", HK_NULL, HK_NULL, hkClassMember::TYPE_VECTOR4, hkClassMember::TYPE_VOID, 0, 0, HK_OFFSET_OF(hkTyremarkPoint,m_pointLeft) },
{ "pointRight", HK_NULL, HK_NULL, hkClassMember::TYPE_VECTOR4, hkClassMember::TYPE_VOID, 0, 0, HK_OFFSET_OF(hkTyremarkPoint,m_pointRight) }
};
const hkClass hkTyremarkPointClass(
"hkTyremarkPoint",
HK_NULL, // parent
sizeof(hkTyremarkPoint),
HK_NULL,
0, // interfaces
HK_NULL,
0, // enums
reinterpret_cast<const hkClassMember*>(hkTyremarkPointClass_Members),
int(sizeof(hkTyremarkPointClass_Members)/sizeof(hkInternalClassMember)),
HK_NULL // defaults
);
//
// Class hkTyremarksWheel
//
static const hkInternalClassMember hkTyremarksWheelClass_Members[] =
{
{ "currentPosition", HK_NULL, HK_NULL, hkClassMember::TYPE_INT32, hkClassMember::TYPE_VOID, 0, 0, HK_OFFSET_OF(hkTyremarksWheel,m_currentPosition) },
{ "numPoints", HK_NULL, HK_NULL, hkClassMember::TYPE_INT32, hkClassMember::TYPE_VOID, 0, 0, HK_OFFSET_OF(hkTyremarksWheel,m_numPoints) },
{ "tyremarkPoints", &hkTyremarkPointClass, HK_NULL, hkClassMember::TYPE_ARRAY, hkClassMember::TYPE_STRUCT, 0, 0, HK_OFFSET_OF(hkTyremarksWheel,m_tyremarkPoints) }
};
extern const hkClass hkReferencedObjectClass;
const hkClass hkTyremarksWheelClass(
"hkTyremarksWheel",
&hkReferencedObjectClass, // parent
sizeof(hkTyremarksWheel),
HK_NULL,
0, // interfaces
HK_NULL,
0, // enums
reinterpret_cast<const hkClassMember*>(hkTyremarksWheelClass_Members),
int(sizeof(hkTyremarksWheelClass_Members)/sizeof(hkInternalClassMember)),
HK_NULL // defaults
);
//
// Class hkTyremarksInfo
//
static const hkInternalClassMember hkTyremarksInfoClass_Members[] =
{
{ "minTyremarkEnergy", HK_NULL, HK_NULL, hkClassMember::TYPE_REAL, hkClassMember::TYPE_VOID, 0, 0, HK_OFFSET_OF(hkTyremarksInfo,m_minTyremarkEnergy) },
{ "maxTyremarkEnergy", HK_NULL, HK_NULL, hkClassMember::TYPE_REAL, hkClassMember::TYPE_VOID, 0, 0, HK_OFFSET_OF(hkTyremarksInfo,m_maxTyremarkEnergy) },
{ "tyremarksWheel", &hkTyremarksWheelClass, HK_NULL, hkClassMember::TYPE_ARRAY, hkClassMember::TYPE_POINTER, 0, 0, HK_OFFSET_OF(hkTyremarksInfo,m_tyremarksWheel) }
};
extern const hkClass hkTyremarksInfoClass;
const hkClass hkTyremarksInfoClass(
"hkTyremarksInfo",
&hkReferencedObjectClass, // parent
sizeof(hkTyremarksInfo),
HK_NULL,
0, // interfaces
HK_NULL,
0, // enums
reinterpret_cast<const hkClassMember*>(hkTyremarksInfoClass_Members),
int(sizeof(hkTyremarksInfoClass_Members)/sizeof(hkInternalClassMember)),
HK_NULL // defaults
);
/*
* Havok SDK - PUBLIC RELEASE, BUILD(#20060902)
*
* Confidential Information of Havok. (C) Copyright 1999-2006
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available from salesteam@havok.com.
*
*/
|
23e422ab9179e7f594278c2b09cdab5bfd1b6702 | 567c9f7c7751e612143e84c6518410c187c9cfc2 | /GDW_Y2 - CRY LIB/cherry/scenes/EngineMenuScene.cpp | fe9fd94be92eead60bbd5b0b69b05ebc8b645b7b | [] | no_license | mecha-rm/GDW_Y2-PJT-repos | aad71238bd8b0da00e3b54a7417e31a7120f740b | 661575f9d1d368a46782e324491e1da7e8d01f78 | refs/heads/master | 2022-12-04T04:19:20.692702 | 2020-08-23T23:57:44 | 2020-08-23T23:57:44 | 209,378,063 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,577 | cpp | EngineMenuScene.cpp | #include "EngineMenuScene.h"
#include "..\Game.h"
// used for ADS - GDW Component
#include <chrono>
#include <stack>
// constructor
cherry::EngineMenuScene::EngineMenuScene(std::string name)
: MenuScene(name)
{
}
// loading the content
void cherry::EngineMenuScene::OnOpen()
{
MenuScene::OnOpen();
Game* const game = Game::GetRunningGame();
if (game == nullptr)
return;
std::string sceneName = GetName();
// gets the window size
glm::ivec2 myWindowSize = game->GetWindowSize();
// setting up the camera
Camera::Sptr& myCamera = game->myCamera; // camera reference
myCamera->clearColor = game->myClearColor; // setting the clear colour
myCamera->SetPosition(glm::vec3(0, 0.001F, 1.0F));
// myCamera->SetPosition(glm::vec3(0, 5, 12));
myCamera->LookAt(glm::vec3(0));
myCamera->SetPerspectiveMode(glm::radians(45.0f), 1.0f, 0.01f, 1000.0f);
myCamera->SetOrthographicMode(
-myWindowSize.x / 2.0F, myWindowSize.x / 2.0F, -myWindowSize.y / 2.0F, myWindowSize.y / 2.0F, 0.0f, 1000.0f, true);
// myCamera->SetPerspectiveMode(true);
// myCamera->SetOrthographicMode(-5.0f, 5.0f, -5.0f, 5.0f, 0.0f, 100.0f, false);
myCamera->targetOffset = cherry::Vec3(0, 5, 12);
// secondary camera, which is used for UI for the game.
Camera::Sptr& myCameraX = game->myCameraX;
myCameraX->clearColor = game->myClearColor;
myCameraX->SetPosition(0, 0.001F, 1.0F); // try adjusting the position of the perspecitve cam and orthographic cam
myCameraX->Rotate(glm::vec3(0.0F, 0.0F, 0.0f));
myCameraX->LookAt(glm::vec3(0));
// this camera is used for UI elements
myCameraX->SetPerspectiveMode(glm::radians(60.0f), 1.0f, 0.01f, 1000.0f, false);
myCameraX->SetOrthographicMode(
-myWindowSize.x / 2.0F, myWindowSize.x / 2.0F, -myWindowSize.y / 2.0F, myWindowSize.y / 2.0F, 0.0f, 1000.0f, true);
// image 1
{
Button* button = new Button();
Image* image = new Image("res/images/bonus_fruit_logo.png", sceneName, false, false);
PhysicsBodyBox* pbb = new PhysicsBodyBox(image->GetWidth(), image->GetHeight(), 0.01F);
image->AddPhysicsBody(pbb); // if addded here, collision doesn't trigger.
image->SetWindowChild(true);
image->SetScale(0.2F);
// pbb->SetVisible(true);
button->object = image;
button->text = new Text("DEBUG SCENE", sceneName, FONT_ARIAL, Vec4(1.0F, 1.0F, 1.0F, 1.0F), 10.0F);
// button->text->ClearText();
button->text->SetText("DEBUG MENU");
// button->text->SetWindowChild(false);
button->text->SetPosition(40.0F, 0.0F, 0.0F);
button->text->SetWindowChild(true);
button->text->SetPositionByWindowSize(Vec2(0.9F, 0.30F));
button->text->SetRotationZDegrees(15.0F);
// button->text->GetMesh()->cullFaces = false;
button->text->SetVisible(true);
// objectList->AddObject(button->text);
// button-
// image->SetPositionByWindowSize(myWindowSize.x / 4.0F, myWindowSize.y / 2.0F * 3);
// image->AddPhysicsBody(pbb);
// objectList->AddObject(image);
AddButton(button);
// UpdateButton(button);
Text* tester = new Text("Click Title to Enter Scene", GetName(), FONT_ARIAL, Vec4(0.0F, 0.0F, 0.0F, 1.0F), 8);
tester->SetWindowChild(true);
tester->SetPositionByWindowSize(0.82F, 0.83F);
// tester->SetPosition(5.0F, 10.0F, -2.0F);
// tester->SetScale(1.9F);
// tester->SetRotationZDegrees(14.0F);
objectList->AddObject(tester);
}
// Algorithm Test (Algorithms and Data Structures GDW Component)
// for(int n = 1000; n <= 10000; n += 1000)
// {
// std::stack<Object*> delStack;
//
// // shader
// Shader::Sptr shader = std::make_shared<Shader>();
// shader->Load("res/shaders/shader.vs.glsl", "res/shaders/shader.fs.glsl");
//
// // material
// Material::Sptr mat = std::make_shared<Material>(shader);
//
// // trial
// const int N = n;
//
// // adding values
// for (int i = 1; i <= N; i++)
// {
// Object* obj = new PrimitiveCube();
// obj->CreateEntity(sceneName, mat);
//
// objectList->AddObject(obj);
// delStack.push(obj);
// }
//
// // Deletion
// auto start = std::chrono::high_resolution_clock::now(); // current time.
//
// // while the stack isn't empty.
// while (!delStack.empty())
// {
// // this is a function that removes an object from its object list, then deletes it.
// objectList->DeleteObjectByPointer(delStack.top());
//
// // pops the top of the stack.
// delStack.pop();
// }
//
// auto end = std::chrono::high_resolution_clock::now(); // current time.
//
// // printing
// std::cout << "\n" << "(n = " << N << ") - Time: "
// << std::chrono::duration<double, std::milli>(end - start).count() << "\n";
//
// }
// std::cout << std::endl;
game->imguiMode = true;
// calling on window resize to fix aspect ratio
Game::GetRunningGame()->Resize(myWindowSize.x, myWindowSize.y);
}
// unloading the scene
void cherry::EngineMenuScene::OnClose()
{
nextScene = "";
MenuScene::OnClose();
}
// generates a new instance of the engine menu scene.
cherry::Scene* cherry::EngineMenuScene::GenerateNewInstance() const
{
return new EngineMenuScene(GetName());
}
// update loop
void cherry::EngineMenuScene::Update(float deltaTime)
{
MenuScene::Update(deltaTime);
// if (enteredButton != nullptr)
// std::cout << "STOP" << std::endl;
if (enteredButton != nullptr && mousePressed == true)
{
Game::GetRunningGame()->SetCurrentScene(nextScene, false);
}
}
|
8454e498229160e1d9a18ad71b80d5ab8997525c | 97932b2345cea95396f51b68be1170428335181a | /adp5350_example/adp5350_example.ino | a22ea45a19fce82aedf0c08f452ae366cf036bcc | [
"MIT"
] | permissive | jodalyst/ADP5350 | 19dc70cc8563156b1d6f185b5c5d5a421710fba7 | f7112d065f47bbb0c7577f250cc68307ce562e8c | refs/heads/master | 2021-09-03T22:33:13.909774 | 2018-01-12T14:37:48 | 2018-01-12T14:37:48 | 104,818,479 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,549 | ino | adp5350_example.ino | #include "adp5350.h"
//declare instance of ADP5350 class
ADP5350 adp;
void setup() {
Serial.begin(115200); // for debugging if needed.
Wire.begin(); //
delay(1000);
Serial.println("READING REGISTERS AND BATTERY VOLTAGE");
Serial.print("Model ID: "); Serial.println( adp.info()&0xF ); // Model ID
Serial.print("Manufacturing ID: "); Serial.println( adp.info()>>4 ); // Manufacturing ID
Serial.print("Silicon Revision: "); Serial.println( adp.sirev() ); // Silicon Revision
Serial.print("Charger Setting:");
adp.setCharger(1);
Serial.print("Fuel Gauge: ");
adp.enableFuelGauge(1);
adp.enableLDO(1, 1);
//adp.voltage_LDO(1,8);
Serial.print("SOC reset: ");
adp.resetSOC();
delay(1000); // give Teensy time to print the first text block
}
void loop() {
bool work;
for(int i = 0; i<13; i++){
Serial.print("Voltage: "); Serial.println(i);
//adp.voltage_LDO(1,i);
delay(400);
}
Serial.println("READING REGISTERS AND BATTERY VOLTAGE");
Serial.print("Model ID: "); Serial.println( adp.info()&0xF ); // Model ID
Serial.print("Manufacturing ID: "); Serial.println( adp.info()>>4 ); // Manufacturing ID
Serial.print("Silicon Revision: "); Serial.println( adp.sirev() ); // Silicon Revision
Serial.print("V_BSNS (mV): "); Serial.println( adp.batteryVoltage() ); // Battery Voltage (mV)
Serial.println("\n");
Serial.print("SOC: "); Serial.println(adp.getSOC());
work = adp.enableLDO(3, 1);
if (work) Serial.println("Turning LDO 3 on ...");
delay(3500);
work = adp.enableLDO(2, 1);
if (work) Serial.println("Turning LDO 2 on ...");
delay(3500);
adp.voltage_LDO(2,8);
delay(3500);
work = adp.enableLDO(3, 0);
if (work) Serial.println("Turning LDO 3 off ...");
work = adp.enableLDO(2, 0);
if (work) Serial.println("Turning LDO 2 off ...");
delay(3500);
adp.voltage_LDO(2,2);
adp.writeByte(ADP5350_ADDRESS,LDO_CTRL,255);
Serial.print("Fuel Gauge Setting: "); Serial.println(adp.readByte(ADP5350_ADDRESS,FUEL_GAUGE_MODE));
adp.resetSOC();
delay(1000);
Serial.print("cH STAT1: "); Serial.println(adp.readByte(ADP5350_ADDRESS,0x08));
Serial.print("ch STAT2: "); Serial.println(adp.readByte(ADP5350_ADDRESS,0x09));
Serial.print("CHG FAULT: "); Serial.println(adp.readByte(ADP5350_ADDRESS,0x0A));
Serial.print("BATT SHORT: "); Serial.println(adp.readByte(ADP5350_ADDRESS,0x0B));
Serial.print("CHG Term: "); Serial.println(adp.readByte(ADP5350_ADDRESS,0x03));
Serial.print("ILIM: "); Serial.println(adp.readByte(ADP5350_ADDRESS,0x02));
delay(3000);
}
|
557a6a0515d8ad39c93a37768077c0beddd9a78e | 8adc0f6392fa41fc7497962f84bdc8eaa1471a83 | /src/deps/v8/src/common/external-pointer-inl.h | 32a78002e1550bf181f7ae5bb358a51b33d1dbde | [
"MIT",
"LicenseRef-scancode-openssl",
"Zlib",
"LicenseRef-scancode-public-domain-disclaimer",
"ICU",
"LicenseRef-scancode-unknown-license-reference",
"Artistic-2.0",
"NAIST-2003",
"NTP",
"CC0-1.0",
"BSD-3-Clause",
"ISC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scan... | permissive | odant/conan-jscript | 91d57eb46886ebda4b21683b290f726197362729 | 0e7433ebe9e5ebf331a47c8b2d01a510c7f53952 | refs/heads/dev-14x | 2023-08-25T03:00:34.085881 | 2021-11-01T08:12:58 | 2021-11-01T08:12:58 | 123,407,718 | 0 | 3 | MIT | 2023-01-07T04:16:47 | 2018-03-01T08:48:23 | C++ | UTF-8 | C++ | false | false | 1,111 | h | external-pointer-inl.h | // Copyright 2020 the V8 project 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 V8_COMMON_EXTERNAL_POINTER_INL_H_
#define V8_COMMON_EXTERNAL_POINTER_INL_H_
#include "include/v8-internal.h"
#include "src/common/external-pointer.h"
#include "src/execution/isolate.h"
namespace v8 {
namespace internal {
V8_INLINE ExternalPointer_t EncodeExternalPointer(Isolate* isolate,
Address external_pointer) {
STATIC_ASSERT(kExternalPointerSize == kSystemPointerSize);
if (!V8_HEAP_SANDBOX_BOOL) return external_pointer;
return external_pointer ^ kExternalPointerSalt;
}
V8_INLINE Address DecodeExternalPointer(const Isolate* isolate,
ExternalPointer_t encoded_pointer) {
STATIC_ASSERT(kExternalPointerSize == kSystemPointerSize);
if (!V8_HEAP_SANDBOX_BOOL) return encoded_pointer;
return encoded_pointer ^ kExternalPointerSalt;
}
} // namespace internal
} // namespace v8
#endif // V8_COMMON_EXTERNAL_POINTER_INL_H_
|
aeb0274995b4d14e2dba985010a4a26800ded646 | 4352b5c9e6719d762e6a80e7a7799630d819bca3 | /tutorials/eulerVortex.twitch/eulerVortex.cyclic.twitch.test.test/processor1/2.73/p | a403ecc04bfe1a8ca563a5f32ccc9a9f534caeec | [] | 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 | 32,594 | p | /*--------------------------------*- 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 "2.73";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField nonuniform List<scalar>
5625
(
1.03273
1.02363
1.01285
1.0007
0.987317
0.972618
0.956403
0.938424
0.918532
0.896789
0.873569
0.849632
0.826012
0.803822
0.784192
0.768151
0.756476
0.749723
0.748307
0.752368
0.761662
0.775687
0.793791
0.815038
0.838201
0.862024
0.885485
0.907811
0.92845
0.947157
0.964092
0.979707
0.994414
1.00826
1.0208
1.03123
1.0387
1.0427
1.04321
1.04075
1.03621
1.03057
1.02469
1.01919
1.01443
1.01054
1.00752
1.00525
1.00361
1.00245
1.00165
1.00111
1.00075
1.00051
1.00035
1.00024
1.00017
1.00012
1.00008
1.00006
1.00004
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1.03584
1.02776
1.01795
1.00681
0.994543
0.98121
0.966722
0.950935
0.933742
0.91518
0.895524
0.875333
0.855387
0.836592
0.819922
0.806268
0.79629
0.790485
0.789223
0.792606
0.80041
0.812216
0.82746
0.84532
0.864764
0.884807
0.904673
0.923759
0.94162
0.958067
0.973252
0.98753
1.00114
1.01395
1.02535
1.03452
1.04065
1.04337
1.04281
1.03959
1.03462
1.02885
1.02306
1.01777
1.01327
1.00965
1.00686
1.00478
1.00329
1.00224
1.00151
1.00102
1.00069
1.00048
1.00033
1.00023
1.00016
1.00012
1.00008
1.00006
1.00004
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1.0387
1.03173
1.02297
1.01284
1.00166
0.98957
0.976608
0.962718
0.947853
0.932043
0.915476
0.898566
0.881901
0.866197
0.852248
0.84078
0.832347
0.827397
0.826254
0.828986
0.835406
0.845189
0.857852
0.872679
0.888831
0.905575
0.922335
0.93863
0.954093
0.968582
0.982236
0.995303
1.00785
1.01957
1.02974
1.03753
1.04225
1.04366
1.04205
1.03813
1.03282
1.02699
1.02134
1.01631
1.0121
1.00875
1.0062
1.00431
1.00296
1.00202
1.00137
1.00093
1.00064
1.00044
1.00031
1.00022
1.00015
1.00011
1.00008
1.00006
1.00004
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1.0412
1.03544
1.02779
1.01872
1.00859
0.997661
0.986046
0.973779
0.960872
0.947363
0.9334
0.919296
0.905471
0.892465
0.880903
0.871366
0.86431
0.860129
0.859097
0.861251
0.866449
0.874456
0.884867
0.897069
0.910408
0.924357
0.9385
0.952442
0.96587
0.978688
0.991007
1.00296
1.01445
1.025
1.03383
1.04014
1.04338
1.04349
1.0409
1.03637
1.03081
1.02501
1.01957
1.01483
1.01093
1.00787
1.00555
1.00386
1.00265
1.00181
1.00124
1.00085
1.00058
1.00041
1.00029
1.0002
1.00015
1.00011
1.00008
1.00005
1.00004
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1.04322
1.03875
1.0323
1.02434
1.01528
1.00545
0.995033
0.984154
0.972874
0.961262
0.949455
0.937669
0.926197
0.915452
0.905925
0.898047
0.892188
0.888693
0.887772
0.889445
0.89362
0.900125
0.908626
0.918622
0.929629
0.941285
0.953273
0.965263
0.976991
0.988388
0.99953
1.01043
1.02082
1.0301
1.03748
1.04222
1.04397
1.04282
1.03934
1.03432
1.02862
1.02294
1.01776
1.01335
1.00978
1.00701
1.00493
1.00342
1.00236
1.00161
1.00111
1.00076
1.00053
1.00037
1.00027
1.00019
1.00014
1.0001
1.00007
1.00005
1.00004
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1.04465
1.04154
1.03637
1.02959
1.02164
1.01288
1.00357
0.993895
0.983978
0.973921
0.963848
0.953917
0.944349
0.935466
0.92762
0.921123
0.916279
0.913378
0.912567
0.913858
0.917208
0.922491
0.929421
0.937614
0.946743
0.956558
0.966801
0.977185
0.987497
0.997681
1.00775
1.0176
1.02682
1.03471
1.04052
1.04365
1.04392
1.04162
1.03738
1.03201
1.02629
1.02081
1.01595
1.01189
1.00866
1.00618
1.00434
1.00301
1.00207
1.00143
1.00098
1.00068
1.00048
1.00034
1.00025
1.00018
1.00013
1.00009
1.00007
1.00005
1.00004
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1.04539
1.04367
1.03985
1.03434
1.02754
1.01986
1.01161
1.00303
0.994281
0.985504
0.976817
0.968357
0.960313
0.952925
0.946424
0.941045
0.937049
0.934651
0.933939
0.934937
0.937645
0.941958
0.94763
0.954392
0.962044
0.970406
0.979242
0.988299
0.997415
1.00654
1.0156
1.02435
1.03228
1.03866
1.04281
1.04432
1.0432
1.03987
1.03504
1.02948
1.02386
1.01866
1.01417
1.01049
1.00759
1.0054
1.00378
1.00262
1.00181
1.00125
1.00087
1.00061
1.00043
1.00031
1.00022
1.00016
1.00012
1.00009
1.00006
1.00005
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1.04532
1.04502
1.04261
1.03843
1.03286
1.02631
1.01912
1.01155
1.00384
0.996142
0.98859
0.981315
0.974481
0.968263
0.962818
0.958334
0.955022
0.953028
0.952407
0.953199
0.955418
0.958969
0.96366
0.969319
0.975827
0.983036
0.990724
0.998673
1.00675
1.01489
1.02293
1.0305
1.03701
1.04176
1.04421
1.04415
1.04178
1.03762
1.03239
1.02679
1.02138
1.01654
1.01244
1.00914
1.00659
1.00467
1.00327
1.00227
1.00157
1.00109
1.00076
1.00054
1.00039
1.00028
1.0002
1.00015
1.00011
1.00008
1.00006
1.00004
1.00003
1.00002
1.00002
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1.04441
1.04548
1.04451
1.04172
1.03745
1.03208
1.02597
1.01942
1.01268
1.00593
0.999336
0.993032
0.987165
0.981863
0.977248
0.97348
0.970714
0.969036
0.968497
0.969149
0.970999
0.973959
0.977899
0.982719
0.988337
0.994611
1.00134
1.00833
1.01547
1.02264
1.02958
1.03584
1.0408
1.04385
1.04463
1.04313
1.03969
1.03492
1.02949
1.024
1.01891
1.01447
1.0108
1.00789
1.00565
1.004
1.0028
1.00194
1.00135
1.00094
1.00067
1.00047
1.00034
1.00025
1.00019
1.00014
1.0001
1.00008
1.00006
1.00004
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1.04263
1.04498
1.04542
1.04406
1.04114
1.03703
1.03205
1.02654
1.02074
1.01489
1.00915
1.00367
0.9986
0.994031
0.990085
0.986897
0.98456
0.983129
0.982666
0.983226
0.984799
0.987307
0.990671
0.994846
0.999752
1.00524
1.01112
1.01723
1.02346
1.02961
1.03535
1.04015
1.04346
1.0448
1.04401
1.04126
1.03701
1.03187
1.02643
1.0212
1.0165
1.01251
1.00926
1.00672
1.0048
1.00339
1.00237
1.00165
1.00115
1.00081
1.00058
1.00042
1.0003
1.00022
1.00017
1.00012
1.00009
1.00007
1.00005
1.00004
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1.04002
1.04347
1.04525
1.0453
1.04379
1.04098
1.0372
1.03276
1.02794
1.02297
1.01803
1.01331
1.00893
1.00499
1.0016
0.998877
0.99688
0.995657
0.995275
0.995776
0.997132
0.999286
1.00221
1.00586
1.01015
1.01493
1.02002
1.02528
1.03055
1.03559
1.03998
1.04321
1.04482
1.04454
1.04238
1.03865
1.03386
1.02857
1.02331
1.01844
1.0142
1.01067
1.00785
1.00567
1.00404
1.00284
1.00199
1.00139
1.00098
1.00069
1.0005
1.00036
1.00027
1.0002
1.00015
1.00011
1.00008
1.00006
1.00005
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1.03669
1.041
1.04394
1.04534
1.04522
1.04377
1.04125
1.03795
1.03414
1.03007
1.02595
1.02195
1.01821
1.01483
1.01194
1.00961
1.0079
1.00687
1.00657
1.00702
1.0082
1.01007
1.01262
1.01581
1.01953
1.02362
1.02792
1.03229
1.03652
1.04031
1.04323
1.04484
1.04483
1.0431
1.03983
1.03542
1.03037
1.02517
1.02023
1.01581
1.01205
1.00898
1.00657
1.00472
1.00336
1.00236
1.00166
1.00116
1.00082
1.00059
1.00043
1.00031
1.00023
1.00018
1.00013
1.0001
1.00007
1.00006
1.00004
1.00003
1.00002
1.00002
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1.03282
1.03768
1.04155
1.04413
1.04534
1.04523
1.04401
1.04189
1.03916
1.03605
1.03277
1.0295
1.02639
1.02357
1.02114
1.01917
1.01772
1.01687
1.01665
1.01706
1.01808
1.01971
1.02193
1.02466
1.02779
1.03116
1.03462
1.03802
1.0411
1.04352
1.04492
1.04495
1.04348
1.04058
1.03653
1.03175
1.02671
1.02178
1.01727
1.01335
1.01009
1.00746
1.00543
1.00389
1.00276
1.00194
1.00137
1.00097
1.00069
1.0005
1.00037
1.00027
1.0002
1.00015
1.00012
1.00009
1.00007
1.00005
1.00004
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1.02866
1.03372
1.03819
1.04171
1.04408
1.04525
1.04531
1.04442
1.04282
1.04071
1.03832
1.03582
1.03337
1.03111
1.02913
1.02752
1.02635
1.02567
1.02551
1.02587
1.02674
1.02813
1.03
1.03223
1.03472
1.03731
1.03987
1.0422
1.04402
1.04503
1.04494
1.04357
1.04092
1.03719
1.0327
1.02786
1.02303
1.01852
1.01451
1.01111
1.00832
1.00612
1.00443
1.00317
1.00224
1.00158
1.00112
1.0008
1.00057
1.00042
1.00031
1.00023
1.00018
1.00014
1.0001
1.00008
1.00006
1.00004
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1.02445
1.02939
1.03411
1.03825
1.04152
1.04379
1.04504
1.04536
1.04489
1.04383
1.04237
1.04069
1.03895
1.03727
1.03576
1.03452
1.03362
1.03311
1.033
1.03331
1.03403
1.03514
1.03659
1.03827
1.04006
1.04182
1.04339
1.04457
1.04511
1.04477
1.04337
1.04087
1.03739
1.03319
1.02859
1.02393
1.01949
1.01547
1.01199
1.0091
1.00677
1.00495
1.00357
1.00255
1.00181
1.00128
1.00091
1.00065
1.00047
1.00035
1.00026
1.0002
1.00015
1.00012
1.00009
1.00007
1.00005
1.00004
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1.02041
1.02499
1.02963
1.03402
1.03787
1.04097
1.04321
1.04461
1.04523
1.04521
1.04471
1.04387
1.04286
1.0418
1.0408
1.03995
1.03932
1.03897
1.0389
1.03913
1.03967
1.04046
1.04144
1.04251
1.04355
1.04442
1.04497
1.04501
1.04435
1.04284
1.04041
1.03714
1.0332
1.02887
1.02443
1.02013
1.01618
1.0127
1.00976
1.00735
1.00543
1.00395
1.00284
1.00202
1.00144
1.00102
1.00073
1.00053
1.00039
1.00029
1.00022
1.00017
1.00013
1.0001
1.00008
1.00006
1.00004
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1.01669
1.02077
1.02508
1.02939
1.03345
1.03705
1.04001
1.04227
1.04383
1.04476
1.04517
1.04516
1.04489
1.04446
1.04397
1.04352
1.04317
1.04296
1.04292
1.04306
1.04338
1.04381
1.04428
1.04471
1.04497
1.04497
1.04455
1.04357
1.04191
1.03951
1.03641
1.03273
1.02869
1.02451
1.02042
1.0166
1.01319
1.01026
1.00781
1.00584
1.00429
1.00311
1.00223
1.00159
1.00113
1.00081
1.00058
1.00043
1.00032
1.00024
1.00018
1.00014
1.00011
1.00009
1.00007
1.00005
1.00004
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1.01342
1.0169
1.02073
1.02471
1.02867
1.03241
1.03576
1.0386
1.04086
1.04256
1.04375
1.0445
1.0449
1.04507
1.04508
1.04501
1.04492
1.04485
1.04484
1.04487
1.04494
1.04499
1.04496
1.04476
1.04432
1.04353
1.04229
1.04051
1.03814
1.0352
1.03178
1.02804
1.02416
1.02033
1.01671
1.01343
1.01057
1.00814
1.00616
1.00457
1.00335
1.00242
1.00173
1.00123
1.00088
1.00063
1.00046
1.00034
1.00026
1.0002
1.00015
1.00012
1.00009
1.00007
1.00006
1.00004
1.00003
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1.01061
1.01351
1.01676
1.02028
1.02391
1.02751
1.03092
1.03401
1.03668
1.0389
1.04066
1.04201
1.04299
1.04367
1.04411
1.04438
1.04452
1.04458
1.04457
1.04449
1.04432
1.04402
1.04353
1.04281
1.04178
1.04038
1.03855
1.03625
1.03349
1.03035
1.02693
1.02339
1.01986
1.01649
1.0134
1.01066
1.00831
1.00636
1.00477
1.00353
1.00257
1.00185
1.00132
1.00094
1.00068
1.00049
1.00036
1.00027
1.00021
1.00016
1.00013
1.0001
1.00008
1.00006
1.00005
1.00004
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00827
1.01062
1.01331
1.01628
1.01946
1.02272
1.02593
1.02898
1.03178
1.03425
1.03635
1.03807
1.03945
1.04051
1.04128
1.04181
1.04214
1.04229
1.04228
1.0421
1.04173
1.04115
1.04032
1.03921
1.03778
1.036
1.03384
1.03131
1.02847
1.0254
1.02221
1.01903
1.01596
1.01311
1.01055
1.00832
1.00643
1.00488
1.00364
1.00267
1.00194
1.00139
1.001
1.00071
1.00052
1.00038
1.00028
1.00021
1.00017
1.00013
1.0001
1.00008
1.00007
1.00005
1.00004
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00636
1.00822
1.01039
1.01283
1.0155
1.0183
1.02116
1.02398
1.02666
1.02912
1.03131
1.03321
1.03479
1.03606
1.03704
1.03775
1.0382
1.03841
1.03839
1.03813
1.03763
1.03687
1.03583
1.03451
1.03288
1.03093
1.02869
1.02619
1.02349
1.02069
1.01787
1.01513
1.01255
1.01021
1.00814
1.00636
1.00488
1.00368
1.00273
1.00199
1.00144
1.00103
1.00074
1.00053
1.00039
1.00029
1.00022
1.00017
1.00013
1.00011
1.00009
1.00007
1.00005
1.00004
1.00003
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00482
1.00628
1.00799
1.00994
1.01211
1.01444
1.01687
1.01932
1.02172
1.02401
1.0261
1.02797
1.02957
1.03091
1.03197
1.03275
1.03325
1.03349
1.03346
1.03317
1.03261
1.03177
1.03066
1.02927
1.02762
1.02571
1.02357
1.02127
1.01886
1.01643
1.01404
1.01177
1.00967
1.0078
1.00616
1.00478
1.00364
1.00272
1.002
1.00146
1.00105
1.00075
1.00054
1.00039
1.00029
1.00022
1.00017
1.00013
1.0001
1.00008
1.00007
1.00006
1.00005
1.00004
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00362
1.00474
1.00606
1.00759
1.0093
1.01118
1.01316
1.01522
1.01727
1.01925
1.02112
1.02283
1.02434
1.02561
1.02664
1.02741
1.02791
1.02815
1.02812
1.02782
1.02726
1.02643
1.02535
1.02403
1.02248
1.02073
1.01883
1.01682
1.01477
1.01274
1.01079
1.00896
1.0073
1.00584
1.00457
1.00352
1.00266
1.00197
1.00144
1.00104
1.00075
1.00053
1.00039
1.00028
1.00021
1.00016
1.00013
1.0001
1.00008
1.00007
1.00006
1.00005
1.00004
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00269
1.00353
1.00454
1.00572
1.00704
1.00851
1.01009
1.01175
1.01342
1.01508
1.01667
1.01814
1.01946
1.0206
1.02152
1.02222
1.02269
1.0229
1.02287
1.02259
1.02206
1.02131
1.02033
1.01914
1.01778
1.01627
1.01466
1.01299
1.01131
1.00967
1.00811
1.00668
1.0054
1.00428
1.00332
1.00254
1.0019
1.0014
1.00101
1.00073
1.00052
1.00037
1.00027
1.0002
1.00015
1.00012
1.00009
1.00008
1.00006
1.00005
1.00004
1.00004
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00199
1.00261
1.00337
1.00425
1.00527
1.00639
1.00762
1.00891
1.01024
1.01157
1.01286
1.01407
1.01518
1.01613
1.01692
1.01752
1.01792
1.0181
1.01807
1.01782
1.01736
1.0167
1.01586
1.01485
1.01371
1.01246
1.01114
1.00979
1.00846
1.00718
1.00597
1.00488
1.00391
1.00307
1.00236
1.00178
1.00132
1.00096
1.00069
1.00049
1.00035
1.00025
1.00018
1.00014
1.00011
1.00009
1.00007
1.00006
1.00005
1.00004
1.00004
1.00003
1.00002
1.00002
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00145
1.00192
1.00248
1.00314
1.00389
1.00474
1.00567
1.00666
1.00768
1.00872
1.00973
1.0107
1.01158
1.01235
1.01299
1.01348
1.0138
1.01394
1.01391
1.0137
1.01332
1.01277
1.01207
1.01124
1.01032
1.00932
1.00827
1.00722
1.00619
1.00521
1.0043
1.00348
1.00276
1.00214
1.00163
1.00122
1.00089
1.00064
1.00046
1.00032
1.00023
1.00016
1.00012
1.00009
1.00007
1.00006
1.00005
1.00004
1.00004
1.00003
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00106
1.0014
1.00181
1.00229
1.00285
1.00348
1.00417
1.00491
1.00568
1.00646
1.00724
1.00799
1.00867
1.00926
1.00976
1.01014
1.01039
1.0105
1.01047
1.01029
1.00998
1.00953
1.00898
1.00832
1.00759
1.00681
1.00601
1.00521
1.00443
1.00369
1.00302
1.00242
1.0019
1.00146
1.00109
1.0008
1.00058
1.00041
1.00029
1.0002
1.00014
1.0001
1.00007
1.00006
1.00005
1.00004
1.00004
1.00003
1.00003
1.00002
1.00002
1.00002
1.00001
1.00001
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00077
1.00102
1.00132
1.00167
1.00207
1.00253
1.00303
1.00358
1.00415
1.00473
1.00531
1.00586
1.00637
1.00683
1.0072
1.00748
1.00767
1.00775
1.00771
1.00757
1.00731
1.00696
1.00653
1.00602
1.00546
1.00487
1.00427
1.00367
1.00309
1.00255
1.00206
1.00163
1.00126
1.00095
1.0007
1.00051
1.00036
1.00025
1.00017
1.00011
1.00008
1.00006
1.00004
1.00003
1.00003
1.00003
1.00003
1.00002
1.00002
1.00002
1.00002
1.00001
1.00001
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00057
1.00074
1.00096
1.00121
1.0015
1.00183
1.00219
1.00258
1.00299
1.00342
1.00384
1.00425
1.00462
1.00494
1.00522
1.00543
1.00556
1.0056
1.00557
1.00545
1.00525
1.00498
1.00465
1.00426
1.00384
1.0034
1.00296
1.00252
1.0021
1.00171
1.00137
1.00107
1.00081
1.0006
1.00043
1.0003
1.0002
1.00013
1.00008
1.00005
1.00004
1.00003
1.00002
1.00002
1.00002
1.00002
1.00002
1.00002
1.00002
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00042
1.00054
1.0007
1.00087
1.00108
1.00132
1.00158
1.00185
1.00215
1.00245
1.00275
1.00303
1.0033
1.00353
1.00372
1.00387
1.00395
1.00398
1.00394
1.00385
1.00369
1.00349
1.00324
1.00295
1.00264
1.00232
1.00199
1.00168
1.00138
1.00111
1.00087
1.00066
1.00049
1.00035
1.00024
1.00016
1.0001
1.00006
1.00003
1.00002
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00031
1.0004
1.00051
1.00064
1.00078
1.00095
1.00113
1.00132
1.00153
1.00174
1.00194
1.00214
1.00233
1.00249
1.00262
1.00271
1.00277
1.00278
1.00274
1.00266
1.00254
1.00239
1.0022
1.00199
1.00177
1.00153
1.0013
1.00108
1.00087
1.00069
1.00052
1.00039
1.00027
1.00018
1.00011
1.00006
1.00003
1.00001
0.999998
0.999993
0.999992
0.999994
0.999997
1
1
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00023
1.0003
1.00038
1.00046
1.00057
1.00068
1.00081
1.00094
1.00108
1.00123
1.00137
1.00151
1.00163
1.00173
1.00182
1.00188
1.00191
1.00191
1.00187
1.00181
1.00172
1.0016
1.00146
1.00131
1.00114
1.00098
1.00082
1.00066
1.00052
1.0004
1.00029
1.0002
1.00013
1.00007
1.00003
1.00001
0.999989
0.99998
0.999978
0.999979
0.999982
0.999986
0.999991
0.999995
0.999999
1
1
1
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00018
1.00023
1.00028
1.00035
1.00042
1.0005
1.00058
1.00067
1.00077
1.00086
1.00096
1.00105
1.00113
1.0012
1.00125
1.00128
1.00129
1.00129
1.00126
1.0012
1.00113
1.00104
1.00094
1.00083
1.00071
1.0006
1.00049
1.00038
1.00029
1.00021
1.00014
1.00008
1.00004
1
0.999984
0.999971
0.999966
0.999965
0.999967
0.999972
0.999978
0.999984
0.999989
0.999994
0.999997
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00014
1.00018
1.00021
1.00025
1.00031
1.00036
1.00042
1.00048
1.00055
1.00061
1.00067
1.00073
1.00078
1.00082
1.00085
1.00087
1.00087
1.00085
1.00082
1.00078
1.00073
1.00066
1.00059
1.00051
1.00043
1.00035
1.00027
1.0002
1.00014
1.00008
1.00004
1.00001
0.999982
0.999966
0.999957
0.999953
0.999954
0.999958
0.999964
0.99997
0.999976
0.999982
0.999987
0.999992
0.999996
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00011
1.00013
1.00016
1.0002
1.00023
1.00027
1.00031
1.00035
1.00039
1.00043
1.00047
1.00051
1.00054
1.00056
1.00057
1.00058
1.00057
1.00056
1.00053
1.0005
1.00045
1.0004
1.00035
1.00029
1.00024
1.00018
1.00013
1.00008
1.00004
1.00001
0.999985
0.999967
0.999955
0.999948
0.999945
0.999946
0.999951
0.999957
0.999964
0.99997
0.999977
0.999983
0.999988
0.999993
0.999995
0.999998
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00009
1.00011
1.00012
1.00015
1.00018
1.0002
1.00023
1.00025
1.00028
1.00031
1.00033
1.00035
1.00037
1.00038
1.00038
1.00038
1.00037
1.00036
1.00034
1.00031
1.00027
1.00024
1.0002
1.00016
1.00012
1.00008
1.00004
1.00001
0.99999
0.99997
0.999954
0.999945
0.99994
0.999939
0.999942
0.999947
0.999953
0.999959
0.999966
0.999973
0.999979
0.999984
0.999988
0.999992
0.999995
0.999997
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00007
1.00008
1.0001
1.00012
1.00013
1.00015
1.00017
1.00019
1.00021
1.00022
1.00024
1.00025
1.00026
1.00026
1.00026
1.00025
1.00024
1.00023
1.00021
1.00018
1.00016
1.00013
1.0001
1.00007
1.00004
1.00002
0.999994
0.999975
0.99996
0.99995
0.999943
0.999939
0.999938
0.99994
0.999944
0.999949
0.999956
0.999962
0.999969
0.999975
0.999981
0.999986
0.99999
0.999993
0.999996
0.999998
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00006
1.00006
1.00007
1.00009
1.00011
1.00012
1.00013
1.00014
1.00015
1.00016
1.00017
1.00018
1.00018
1.00018
1.00017
1.00017
1.00016
1.00014
1.00013
1.00011
1.00009
1.00007
1.00004
1.00002
1
0.999985
0.99997
0.999958
0.999948
0.999942
0.999939
0.999939
0.999941
0.999944
0.99995
0.999956
0.999962
0.999968
0.999973
0.999979
0.999983
0.999988
0.999991
0.999994
0.999996
0.999998
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00004
1.00005
1.00006
1.00007
1.00008
1.00009
1.0001
1.00011
1.00012
1.00012
1.00012
1.00013
1.00013
1.00013
1.00012
1.00011
1.0001
1.00009
1.00008
1.00006
1.00004
1.00002
1.00001
0.999995
0.999981
0.999968
0.999958
0.999951
0.999947
0.999944
0.999944
0.999944
0.999947
0.999951
0.999956
0.999961
0.999967
0.999973
0.999978
0.999983
0.999987
0.99999
0.999992
0.999995
0.999996
0.999998
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00003
1.00004
1.00005
1.00005
1.00006
1.00007
1.00008
1.00008
1.00009
1.00009
1.00009
1.00009
1.00009
1.00009
1.00008
1.00007
1.00007
1.00005
1.00004
1.00003
1.00002
1.00001
0.999993
0.999981
0.999972
0.999963
0.999956
0.999952
0.999949
0.999948
0.999949
0.999951
0.999955
0.999959
0.999964
0.999968
0.999973
0.999977
0.999981
0.999985
0.999988
0.999991
0.999994
0.999995
0.999997
0.999998
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00003
1.00003
1.00004
1.00004
1.00005
1.00005
1.00006
1.00006
1.00007
1.00007
1.00007
1.00007
1.00007
1.00006
1.00006
1.00005
1.00004
1.00003
1.00002
1.00001
1
0.999993
0.999984
0.999977
0.99997
0.999964
0.99996
0.999957
0.999956
0.999956
0.999957
0.999959
0.999961
0.999965
0.999969
0.999973
0.999978
0.999982
0.999985
0.999988
0.999991
0.999993
0.999995
0.999997
0.999998
0.999998
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00002
1.00002
1.00003
1.00003
1.00004
1.00004
1.00004
1.00005
1.00005
1.00005
1.00005
1.00005
1.00005
1.00005
1.00004
1.00003
1.00003
1.00002
1.00001
1.00001
0.999998
0.99999
0.999983
0.999976
0.999971
0.999967
0.999964
0.999962
0.999961
0.999962
0.999964
0.999966
0.999969
0.999972
0.999976
0.999979
0.999982
0.999985
0.999988
0.99999
0.999993
0.999994
0.999996
0.999997
0.999998
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00002
1.00002
1.00002
1.00003
1.00003
1.00003
1.00004
1.00004
1.00004
1.00004
1.00004
1.00004
1.00004
1.00003
1.00003
1.00002
1.00002
1.00001
1.00001
1
0.999994
0.999988
0.999983
0.999979
0.999975
0.999972
0.99997
0.999969
0.999969
0.99997
0.999971
0.999973
0.999975
0.999978
0.999981
0.999984
0.999986
0.999989
0.999991
0.999993
0.999994
0.999996
0.999997
0.999998
0.999998
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00001
1.00001
1.00002
1.00002
1.00002
1.00003
1.00003
1.00003
1.00003
1.00003
1.00003
1.00003
1.00003
1.00002
1.00002
1.00002
1.00001
1.00001
1
0.999998
0.999993
0.999989
0.999985
0.999981
0.999979
0.999977
0.999975
0.999975
0.999975
0.999975
0.999977
0.999979
0.999981
0.999983
0.999985
0.999987
0.999989
0.999991
0.999993
0.999994
0.999995
0.999996
0.999997
0.999998
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00001
1.00001
1.00001
1.00002
1.00002
1.00002
1.00002
1.00002
1.00002
1.00002
1.00002
1.00002
1.00002
1.00002
1.00002
1.00001
1.00001
1
1
0.999998
0.999994
0.99999
0.999987
0.999985
0.999983
0.999981
0.99998
0.99998
0.999981
0.999981
0.999982
0.999983
0.999985
0.999987
0.999988
0.99999
0.999992
0.999993
0.999994
0.999995
0.999997
0.999997
0.999998
0.999998
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00002
1.00002
1.00002
1.00002
1.00002
1.00002
1.00002
1.00001
1.00001
1.00001
1.00001
1
1
0.999997
0.999995
0.999992
0.99999
0.999988
0.999986
0.999985
0.999985
0.999985
0.999985
0.999985
0.999987
0.999988
0.999989
0.99999
0.999991
0.999993
0.999994
0.999995
0.999996
0.999997
0.999997
0.999998
0.999998
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1
1
1
0.999997
0.999996
0.999995
0.999993
0.999991
0.99999
0.999989
0.999989
0.999988
0.999988
0.999989
0.999989
0.99999
0.999991
0.999992
0.999993
0.999994
0.999995
0.999996
0.999997
0.999997
0.999998
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1
1
1
1
0.999998
0.999997
0.999995
0.999993
0.999993
0.999992
0.999991
0.999991
0.999991
0.999991
0.999992
0.999993
0.999993
0.999994
0.999994
0.999995
0.999996
0.999996
0.999997
0.999998
0.999998
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1.00001
1
1
1
1
1
0.999999
0.999998
0.999996
0.999995
0.999995
0.999994
0.999994
0.999994
0.999993
0.999994
0.999994
0.999994
0.999994
0.999995
0.999996
0.999996
0.999997
0.999997
0.999998
0.999998
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1.00001
1
1
1
1.00001
1
1
1
1
1
1
1
0.999999
0.999998
0.999998
0.999997
0.999996
0.999996
0.999996
0.999995
0.999995
0.999995
0.999996
0.999996
0.999996
0.999997
0.999997
0.999997
0.999998
0.999998
0.999999
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
0.999999
0.999998
0.999998
0.999998
0.999998
0.999997
0.999997
0.999996
0.999996
0.999997
0.999997
0.999997
0.999998
0.999998
0.999998
0.999998
0.999999
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
0.999998
0.999998
0.999998
0.999997
0.999997
0.999997
0.999998
0.999998
0.999998
0.999998
0.999998
0.999998
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
0.999999
0.999998
0.999998
0.999998
0.999998
0.999998
0.999998
0.999998
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
1
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
1
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
0.999999
1
1
1
1
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
1
1
0.999999
1
1
1
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
1
1
0.999999
0.999999
1
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
1
1
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
0.999999
0.999999
0.999999
0.999998
0.999998
0.999998
0.999998
0.999998
0.999998
0.999998
0.999998
0.999998
0.999998
0.999999
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999998
0.999998
0.999998
0.999998
0.999997
0.999998
0.999997
0.999997
0.999997
0.999997
0.999997
0.999997
0.999998
0.999998
0.999998
0.999999
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
)
;
boundaryField
{
emptyPatches_empt
{
type empty;
}
top_cyc
{
type cyclic;
}
bottom_cyc
{
type cyclic;
}
inlet_cyc
{
type cyclic;
}
outlet_cyc
{
type cyclic;
}
procBoundary1to0
{
type processor;
value nonuniform List<scalar>
75
(
1.03969
1.04169
1.04335
1.04459
1.04528
1.04536
1.04474
1.04339
1.04131
1.03854
1.0352
1.03144
1.02745
1.02345
1.01964
1.01614
1.01304
1.01037
1.00813
1.00628
1.0048
1.00362
1.0027
1.002
1.00147
1.00107
1.00078
1.00057
1.00042
1.00031
1.00024
1.00018
1.00014
1.00011
1.00009
1.00007
1.00006
1.00004
1.00003
1.00003
1.00002
1.00002
1.00001
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999
1
0.999999
0.999999
0.999999
)
;
}
procBoundary1to0throughoutlet_cyc
{
type processorCyclic;
value nonuniform List<scalar>
75
(
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
)
;
}
procBoundary1to3
{
type processor;
value nonuniform List<scalar>
75
(
1.0295
1.01945
1.00774
0.994603
0.980042
0.963844
0.945684
0.925238
0.902327
0.877046
0.849865
0.821758
0.794085
0.768248
0.745525
0.727014
0.713555
0.705775
0.704144
0.708863
0.719687
0.73605
0.757204
0.7821
0.809325
0.837349
0.864857
0.89085
0.914634
0.935896
0.9548
0.971892
0.987749
1.00261
1.0162
1.02778
1.03651
1.04172
1.04329
1.04163
1.03757
1.03212
1.02621
1.02054
1.01555
1.01142
1.00818
1.00573
1.00394
1.00267
1.0018
1.0012
1.0008
1.00054
1.00037
1.00025
1.00017
1.00012
1.00009
1.00006
1.00004
1.00003
1.00002
1.00001
1.00001
1.00001
1
1
1
1
1
1
1
1
1
)
;
}
procBoundary1to3throughbottom_cyc
{
type processorCyclic;
value nonuniform List<scalar>
75
(
0.999998
0.999998
0.999998
0.999997
0.999997
0.999996
0.999996
0.999996
0.999996
0.999996
0.999996
0.999996
0.999997
0.999997
0.999998
0.999998
0.999999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
)
;
}
}
// ************************************************************************* //
| |
9548a8d61606ba09514e429ab8d5a43da8e2c8e7 | 0150d34d5ced4266b6606c87fbc389f23ed19a45 | /Cpp/SDK/SettingsComboboxItem_classes.h | 21950230edef10e8dcd5a9cb15abbb040b751c97 | [
"Apache-2.0"
] | permissive | joey00186/Squad-SDK | 9aa1b6424d4e5b0a743e105407934edea87cbfeb | 742feb5991ae43d6f0cedd2d6b32b949923ca4f9 | refs/heads/master | 2023-02-05T19:00:05.452463 | 2021-01-03T19:03:34 | 2021-01-03T19:03:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,625 | h | SettingsComboboxItem_classes.h | #pragma once
// Name: S, Version: b
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
/*!!HELPER_DEF!!*/
/*!!DEFINE!!*/
namespace UFT
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// WidgetBlueprintGeneratedClass SettingsComboboxItem.SettingsComboboxItem_C
// 0x0069 (FullSize[0x0299] - InheritedSize[0x0230])
class USettingsComboboxItem_C : public UUserWidget
{
public:
struct FPointerToUberGraphFrame UberGraphFrame; // 0x0230(0x0008) (ZeroConstructor, Transient, DuplicateTransient)
class UButton* Button_1; // 0x0238(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, NoDestructor, PersistentInstance, HasGetValueTypeHash)
class UComboBoxString* ComboBoxString; // 0x0240(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, NoDestructor, PersistentInstance, HasGetValueTypeHash)
class UHorizontalBox* HorizontalBox_1; // 0x0248(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, NoDestructor, PersistentInstance, HasGetValueTypeHash)
class UImage* SpacerImg; // 0x0250(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, NoDestructor, PersistentInstance, HasGetValueTypeHash)
class UTextBlock* TB_Title; // 0x0258(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, NoDestructor, PersistentInstance, HasGetValueTypeHash)
struct FText SettingName; // 0x0260(0x0018) (Edit, BlueprintVisible)
TArray<struct FString> DefaultOptions; // 0x0278(0x0010) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance)
struct FScriptMulticastDelegate OnValueChanged; // 0x0288(0x0010) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, BlueprintAssignable, BlueprintCallable)
bool bConstructed; // 0x0298(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor)
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("WidgetBlueprintGeneratedClass SettingsComboboxItem.SettingsComboboxItem_C");
return ptr;
}
void SetSelectedIndex(int Index);
void SetSelected(const struct FString& Option);
void SetOptions(TArray<struct FString>* NewOptions);
struct FSlateBrush Get_SpacerImg_Brush_1();
void Construct();
void BndEvt__ComboBoxString_K2Node_ComponentBoundEvent_289_OnSelectionChangedEvent__DelegateSignature(const struct FString& SelectedItem, TEnumAsByte<ESelectInfo> SelectionType);
void ExecuteUbergraph_SettingsComboboxItem(int EntryPoint);
void OnValueChanged__DelegateSignature(const struct FString& Option, int Index);
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
181b256395d9c1818c889ce8033e4af54d578355 | 257ab43320e479040e912ea2904aac9e52039468 | /knightrider_with_pwm_STM32_12LED_v0016/diagnostic2.ino | 2a5d53b7f47cf995c236e1a5b42a11525a3466f0 | [] | no_license | grassm/LED-Light-bar-sequencer | e9d98015938673a8f593359b3ed1904793136449 | 71c97d236b97a21ca270f217eb7b0970a5b6b520 | refs/heads/master | 2021-01-18T18:40:17.180176 | 2017-04-01T02:57:56 | 2017-04-01T02:57:56 | 86,870,710 | 0 | 0 | null | 2017-04-01T02:35:59 | 2017-04-01T00:36:39 | null | UTF-8 | C++ | false | false | 1,462 | ino | diagnostic2.ino | /*Diagnostic2() is a slow sequencial fade of all the PWM pins in the boardPWMPin[] array
*
*/
#define T 500 // This allows for a slow fade, so this slow human can make sure what's happening on each pin
void diagnostic2()
{
for(int index=0; index <= 11; index++)
{
output(index);
}
//next line was replaced by the for loop above
//output(0);output(1);output(2);output(3);output(4);output(5);output(6);output(7);output(8);output(9);output(10);output(11);
//now reset the output for each pwm pin
for (uint8 index=0; index <=11 ; index++)
{
pwmWrite(boardPWMPins[index], POWER_OFF);
}
}//end of function ----------------------------------------- diagnostic2() ------------------------------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++ start of function diagnostic2() +++++++++++++++++++++++
void output(uint8 index)
{
#ifdef PRINT_INFO
SERIAL.print("input="); SERIAL.print(index); SERIAL.print(", associated pin="); SERIAL.println(boardPWMPins[index]);
#endif
pwmWrite(boardPWMPins[index],POWER_A);
delay(T);
pwmWrite(boardPWMPins[index],POWER_B);
delay(T);
pwmWrite(boardPWMPins[index],POWER_C);
delay(T);
pwmWrite(boardPWMPins[index],POWER_D);
delay(T);
z_all_off();
}//---------------------------------------------------------------------------- end of function output() ---------------------------------------------------
|
47a39afeb216d122c427565a2652eb1776f37c1a | 522c568e8920d76a94198599614e9315f575ce23 | /Temp/UI/Panel/WRUIPanel_InputIcon.h | 6fa74da5d5b7bf4b732f64051ad4086ae968a634 | [] | no_license | kyukyu86/Demo | 2ba6fe1f2264f9d4820437736c9870a5c59960cb | d2bb86e623ec5f621e860aa5defe335ee672ca53 | refs/heads/master | 2023-01-07T11:46:08.313633 | 2020-11-06T08:59:06 | 2020-11-06T08:59:06 | 269,510,905 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 802 | h | WRUIPanel_InputIcon.h | // Copyright 2019-2024 WemadeXR Inc. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "UI/Base/WRUIPanel.h"
#include "Enum/EWRCharacter.h"
#include "WRUIPanel_InputIcon.generated.h"
UCLASS()
class WR_API UWRUIPanel_InputIcon : public UWRUIPanel
{
GENERATED_BODY()
public:
virtual void NativeConstruct() override;
virtual void NativeDestruct() override;
void SetInputKey(const EWRInput IN InInput);
void SetContent(const FText& IN InContent);
public:
UPROPERTY(EditAnywhere)
class UTexture2D* Texture_Triangle;
UPROPERTY(EditAnywhere)
class UTexture2D* Texture_Circle;
UPROPERTY(EditAnywhere)
class UTexture2D* Texture_Square;
UPROPERTY(EditAnywhere)
class UTexture2D* Texture_Cross;
private:
class UTextBlock* TextBlock_Content;
class UImage* Image_Icon;
};
|
b9c1b85c8c17024059bef64c062448a0f4ae7449 | e4fc911ff3adf77a2a8f73c52f6a9ac1a56d4b81 | /jobshandler.h | 65f1e7dae08320d047b1b6b2486af202ba1948c8 | [] | no_license | lucasjadami/Chew | fbb7ab29d28e4f159d1af44ef1d2606184397d83 | 4cc5247900e2bc9a231103a283acd932ab108dc6 | refs/heads/master | 2016-09-06T12:37:10.616653 | 2011-11-14T15:28:24 | 2011-11-14T15:28:24 | 2,254,729 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,277 | h | jobshandler.h | #ifndef JOBSHANDLER_H
#define JOBSHANDLER_H
#include "iohandler.h"
#include <unistd.h>
#include <signal.h>
#include <vector>
#define JOB_BACKGROUND 0
#define JOB_FOREGROUND 1
#define JOB_STOPPED 2
using namespace std;
/**
* The job class represents a chain running.
*/
class Job
{
public:
Job(string line, int pid, int state)
{
this->line = line;
this->pid = pid;
this->state = state;
}
string getLine() { return line; }
int getPid() { return pid; }
int getState() { return state; }
void setState(int state) { this->state = state; }
private:
/** The line beeing executed. */
string line;
/** The pid (it is also the gpid). */
int pid;
/** State of the job. */
int state;
};
/**
* Handles the job part.
*/
class JobsHandler
{
public:
int getMainPid();
int getJobPid(unsigned int);
bool isMainForeground();
bool setupJob();
bool removeJob(unsigned int);
bool removeJobByPid(int);
bool addJob(string, int, int);
bool setJobState(unsigned int, int);
bool setJobStateByPid(int, int);
bool setMainForeground();
bool init();
void showJobs(IOHandler&);
private:
/** Jobs created. */
vector<Job> jobs;
/* Main pid. */
int mainPid;
/** The terminal file descriptor. */
int terminalFd;
};
extern JobsHandler jobsHandler;
#endif
|
39778164997b3418231d9cdd6887d12f5bd77420 | e559e1f31768c080244a772ab95966baca6f7c9c | /newplayer.cpp | 46b9ae4c64639f66e108b74b76da111cf8ba2e5a | [] | no_license | meveric/extremetuxracer | eb5846bf852b3d217280b88ce2991f4f0a70b4c4 | ae1f98af55331ff8f6f4c057814670a74f83dcd5 | refs/heads/master | 2020-04-05T17:29:58.429483 | 2014-11-19T10:45:24 | 2014-11-19T10:45:24 | 16,082,693 | 7 | 0 | null | 2014-11-19T10:45:24 | 2014-01-20T20:36:25 | C++ | UTF-8 | C++ | false | false | 7,677 | cpp | newplayer.cpp | /* --------------------------------------------------------------------
EXTREME TUXRACER
Copyright (C) 1999-2001 Jasmin F. Patry (Tuxracer)
Copyright (C) 2010 Extreme Tuxracer Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
---------------------------------------------------------------------*/
#include "newplayer.h"
#include "particles.h"
#include "audio.h"
#include "gui.h"
#include "ogl.h"
#include "textures.h"
#include "font.h"
#include "game_ctrl.h"
#include "translation.h"
static int curr_focus = 0;
static TVector2 cursor_pos = {0, 0};
static string name;
static int posit;
static float curposit;
static int maxlng = 32;
static bool crsrvisible = true;
static float crsrtime = 0;
static int curr_avatar = 0;
static int last_avatar = 0;
#define CRSR_PERIODE 0.4
void DrawCrsr (float x, float y, int pos, double timestep) {
if (crsrvisible) {
float w = 3;
float h = 26*param.scale;
TColor col = MakeColor (1, 1, 0, 1);
float scrheight = param.y_resolution;
const GLfloat vtx[] = {
x, scrheight-y-h,
x+w, scrheight-y-h,
x+w, scrheight-y,
x, scrheight-y
};
glDisable (GL_TEXTURE_2D);
glEnableClientState(GL_VERTEX_ARRAY);
glColor4f (col.r, col.g, col.b, col.a);
glVertexPointer(2, GL_FLOAT, 0, vtx);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
glEnable (GL_TEXTURE_2D);
}
crsrtime += timestep;
if (crsrtime > CRSR_PERIODE) {
crsrtime = 0;
crsrvisible = !crsrvisible;
}
}
int len (const string s) {return s.size(); }
void CalcCursorPos () {
int le = len (name);
if (posit == 0) curposit = 0;
if (posit > le) posit = le;
string temp = name.substr (0, posit);
curposit = FT.GetTextWidth (temp);
}
void NameInsert (string ss) {
int le = len (name);
if (posit > le) posit = le;
name.insert (posit, ss);
}
void NameInsert (char *ss) {
int le = len (name);
if (posit > le) posit = le;
name.insert (posit, ss);
}
void NameInsert (char c) {
char temp[2];
temp[0] = c;
temp[1] = 0;
NameInsert (temp);
}
void NameDelete (int po) {
int le = len (name);
if (po > le) po = le;
name.erase (po, 1);
}
void QuitAndAddPlayer () {
if (name.size () > 0)
Players.AddPlayer (name, Players.GetDirectAvatarName (curr_avatar));
Winsys.SetMode (REGIST);
}
// NewPlayerKeys not used any longer, see NewPlayerKeySpec instead
void NewPlayerKeys (unsigned int key, bool special, bool release, int x, int y) {}
void ChangeAvatarSelection (int focus, int dir) {
if (dir == 0) {
switch (focus) {
case 0: if (curr_avatar > 0) curr_avatar--; break;
}
} else {
switch (focus) {
case 0: if (curr_avatar < last_avatar) curr_avatar++; break;
}
}
}
/*
typedef struct{
Uint8 scancode;
SDLKey sym;
SDLMod mod;
Uint16 unicode;
} SDL_keysym;*/
void NewPlayerKeySpec (SDL_keysym sym, bool release) {
if (release) return;
unsigned int key = sym.sym;
unsigned int mod = sym.mod;
crsrtime = 0;
crsrvisible = true;
if (islower (key)) {
if (len (name) < maxlng) {
if (mod & KMOD_SHIFT) NameInsert (toupper (key));
else NameInsert (key);
posit++;
}
} else if (isdigit (key)) {
if (len (name) < maxlng) {
NameInsert (key);
posit++;
}
} else {
switch (key) {
case 127: if (posit < len(name)) NameDelete (posit); break;
case 8: if (posit > 0) NameDelete (posit-1); posit--; break;
case 27: Winsys.SetMode (REGIST); break;
case 13:
if (curr_focus == 1) Winsys.SetMode (REGIST);
else QuitAndAddPlayer ();
break;
case SDLK_RIGHT: if (posit < len(name)) posit++; break;
case SDLK_LEFT: if (posit > 0) posit--; break;
case 278: posit = 0; break;
case 279: posit = len (name); break;
case 32: NameInsert (32); posit++; break;
case SDLK_UP: if (curr_avatar>0) curr_avatar--; break;
case SDLK_DOWN: if (curr_avatar<last_avatar) curr_avatar++; break;
case SDLK_TAB: curr_focus++; if (curr_focus>2) curr_focus =0; break;
}
}
}
void NewPlayerMouseFunc (int button, int state, int x, int y) {
int foc, dir;
if (state == 1) {
GetFocus (x, y, &foc, &dir);
switch (foc) {
case 0: ChangeAvatarSelection (foc, dir); break;
case 1: Winsys.SetMode (REGIST); break;
case 2: QuitAndAddPlayer(); break;
}
}
}
void NewPlayerMotionFunc (int x, int y ){
TVector2 old_pos;
int sc, dir;
if (Winsys.ModePending ()) return;
GetFocus (x, y, &sc, &dir);
if (sc >= 0) curr_focus = sc;
y = param.y_resolution - y;
old_pos = cursor_pos;
cursor_pos = MakeVector2 (x, y);
if (old_pos.x != x || old_pos.y != y) {
if (param.ui_snow) push_ui_snow (cursor_pos);
}
}
static TArea area;
static int framewidth, frameheight, frametop;
static int prevleft, prevtop, prevwidth, prevoffs;
void NewPlayerInit (void) {
Winsys.KeyRepeat (true);
Winsys.ShowCursor (!param.ice_cursor);
init_ui_snow ();
Music.Play (param.menu_music, -1);
g_game.loopdelay = 10;
name = "";
posit = 0;
framewidth = 400 * param.scale;
frameheight = 50 * param.scale;
frametop = AutoYPosN (38);
area = AutoAreaN (30, 80, framewidth);
prevleft = area.left;
prevtop = AutoYPosN (52);
prevwidth = 75 * param.scale;
prevoffs = 80;
ResetWidgets ();
AddArrow (area.left + prevwidth + prevoffs + 8, prevtop, 0, 0);
AddArrow (area.left + prevwidth + prevoffs + 8, prevtop +prevwidth -18, 1, 0);
int siz = FT.AutoSizeN (5);
AddTextButton (Trans.Text(8), area.left+50, AutoYPosN (70), 1, siz);
double len = FT.GetTextWidth (Trans.Text(15));
AddTextButton (Trans.Text(15), area.right-len-50, AutoYPosN (70), 2, siz);
last_avatar = Players.numAvatars - 1;
curr_focus = 0;
}
void NewPlayerLoop (double timestep ){
int ww = param.x_resolution;
int hh = param.y_resolution;
TColor col;
Music.Update ();
check_gl_error();
ClearRenderContext ();
set_gl_options (GUI);
SetupGuiDisplay ();
update_ui_snow (timestep);
draw_ui_snow();
// DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
// 0, colMBackgr, col, 0.2);
Tex.Draw (BOTTOM_LEFT, 0, hh - 256, 1);
Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
Tex.Draw (TOP_LEFT, 0, 0, 1);
Tex.Draw (TOP_RIGHT, ww-256, 0, 1);
Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), param.scale);
FT.SetColor (colWhite);
FT.AutoSizeN (4);
FT.DrawString (CENTER, AutoYPosN (30), "Enter a name for the new player and select an avatar:");
DrawFrameX (area.left, frametop, framewidth, frameheight, 3, colMBackgr, colWhite, 1.0);
FT.AutoSizeN (5);
FT.DrawString (area.left+20, frametop, name);
CalcCursorPos ();
DrawCrsr (area.left+20+curposit+1, frametop+9, 0, timestep);
if (curr_focus == 0) col = colDYell; else col = colWhite;
Tex.DrawDirectFrame (Players.GetDirectAvatarID (curr_avatar),
prevleft + prevoffs, prevtop, prevwidth, prevwidth, 2, col);
FT.SetColor (colWhite);
PrintArrow (0, (curr_avatar > 0));
PrintArrow (1, (curr_avatar < last_avatar));
PrintTextButton (0, curr_focus);
PrintTextButton (1, curr_focus);
if (param.ice_cursor) DrawCursor ();
Winsys.SwapBuffers();
}
void NewPlayerTerm () {
// Winsys.SetFonttype ();
}
void NewPlayerRegister() {
Winsys.SetModeFuncs (NEWPLAYER, NewPlayerInit, NewPlayerLoop, NewPlayerTerm,
NULL, NewPlayerMouseFunc, NewPlayerMotionFunc, NULL, NULL, NewPlayerKeySpec);
}
|
39455afae3ab50b0a46b47d0477922a326fa995f | 4b7582342eeb493b166d9d9c70afb41042d6db8e | /translator/analyzer.cpp | 8c77ab17e7f13e2fd1a49e282dbce31c83f746e9 | [] | no_license | josh1986/Vavaja | f528341e582b36182b4fa24401dd3e140a3f5df4 | 007b24c127a7a46c65d144172bb7e9412a2d829d | refs/heads/master | 2021-01-17T21:40:02.659312 | 2014-08-31T07:53:31 | 2014-08-31T07:53:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,704 | cpp | analyzer.cpp | /*
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 "analyzer.h"
//------------------------------------------------------------------------------------------
void Analyzer::load(const std::string fname)
{
std::ifstream source(fname);
if (!source)
{
error(0,"Include file not exists");
}
std::string tmp;
while (!source.eof())
{
getline(source,tmp);
if (tmp.length()!=0)
{
Args args;
split(tmp,args);
if (args[0]=="#include")
{
load(args[1]);
} else
{
listing_.push_back(tmp);
}
}
}
source.close();
}
//------------------------------------------------------------------------------------------
void Analyzer::loadSyntax(const std::string fname)
{
std::ifstream source(fname);
while (!source.eof())
{
std::string tmp;
getline(source,tmp);
if (tmp.length()!=0)
{
SyntaxRecord synt;
Lines splited;
split(tmp,splited,':');
synt.cmd=splited[0];
synt.code=atoi(*(splited.end()-1));
for (auto i=(splited.begin()+1);i<(splited.end()-1);i++)
{
synt.args.push_back(*i);
}
syntax_.push_back(synt);
}
}
source.close();
}
//------------------------------------------------------------------------------------------
void Analyzer::process()
{
for (auto i=listing_.begin();i<listing_.end();i++)
{
Args args;
split((*i),args);
curLine_++;
bool matched=false;
if (args[0][0]=='.')
{
if (args[0]==".byte")
{
memory_->putByte(atoi(args[1]));
matched=true;
} else
if (args[0]==".short")
{
memory_->putNum(args[1]);
matched=true;
} else
if (args[0]==".float")
{
memory_->putFloat(args[1]);
matched=true;
} else
if (args[0]==".space")
{
int count=atoi(args[1]);
for (auto i=0;i<count;++i)
{
memory_->putByte(0);
}
matched=true;
} else
if (args[0]==".string")
{
std::string tmp;
for (auto i=(args.begin()+1);i<args.end();i++)
{
tmp+=(*i)+" ";
}
for (auto i=0;i<tmp.length()-1;i++)
{
memory_->putByte(tmp[i]);
}
memory_->putByte(0);
matched=true;
}
if (args[0]==".ascii")
{
std::string tmp;
for (auto i=(args.begin()+1);i<args.end();i++)
{
tmp+=(*i)+" ";
}
for (auto i=0;i<tmp.length()-1;i++)
{
memory_->putByte(tmp[i]);
}
matched=true;
}
} else
if (labels_->isLabel(args[0]))
{
labels_->addLabel(args[0],memory_->getCurrent());
matched=true;
} else
for (auto j=syntax_.begin();j<syntax_.end();j++)
{
if (args[0]==j->cmd)
{
int mCount=0,currArg=0;
for (auto k=j->args.begin();k<j->args.end();k++)
{ // в первом проходе считаем соответствия
currArg++;
if (currArg>=args.size()) break;
if ( ((*k)=="num") && isNumber(args[currArg]))
{
mCount++;
continue;
} else
if ( ((*k)=="float") && isFloat(args[currArg]))
{
mCount++;
continue;
} else
if ( ((*k)=="reg") && regs_->isReg(args[currArg]))
{
//std::cout << "reg matched!\n";
mCount++;
continue;
} else
if ( ((*k)=="regfloat") && regs_->isRegFloat(args[currArg]))
{
//std::cout << "regfloat matched!\n";
mCount++;
continue;
} else
if ( ( ((*k)=="mem") || ((*k)=="regmem") ) && (args[currArg][0]=='%') )
{
std::string tmpStr=args[currArg];
tmpStr.erase(0,1);
//std::cout << "T: " << tmpStr << "\n";
if ( ((*k)=="mem") && isNumber(tmpStr))
{
mCount++;
continue;
} else
if ( ((*k)=="regmem") && regs_->isReg(tmpStr))
{
mCount++;
continue;
} else
if (((*k)=="mem") && (regs_->isReg(tmpStr)!=true))
{
mCount++;
continue;
}
} else
if (((*k)=="num") &&
(isNumber(args[currArg])==false) &&
(isFloat(args[currArg])==false) &&
(regs_->isReg(args[currArg])==false) &&
(regs_->isRegFloat(args[currArg])==false) &&
(args[currArg][0]!='%'))
{
mCount++;
continue;
}
}
if (mCount==(args.size()-1))
{
matched=true;
memory_->putByte(j->code);
currArg=0;
for (auto k=j->args.begin();k<j->args.end();k++)
{ // во втором проставляем байты
currArg++;
if (currArg>=args.size()) break;
if ( ((*k)=="num") && isNumber(args[currArg]))
{
memory_->putNum(args[currArg]);
continue;
} else
if ( ((*k)=="float") && isFloat(args[currArg]))
{
memory_->putFloat(args[currArg]);
continue;
} else
if ( ((*k)=="reg") && regs_->isReg(args[currArg]))
{
memory_->putReg(args[currArg]);
continue;
} else
if ( ((*k)=="regfloat") && regs_->isRegFloat(args[currArg]))
{
memory_->putRegFloat(args[currArg]);
continue;
} else
if ( ( ((*k)=="mem") || ((*k)=="regmem") ) && (args[currArg][0]=='%') )
{
std::string tmpStr=args[currArg];
tmpStr.erase(0,1);
if ( ((*k)=="mem") && isNumber(tmpStr))
{
memory_->putNum(tmpStr);
continue;
} else
if ( ((*k)=="regmem") && regs_->isReg(tmpStr))
{
memory_->putReg(tmpStr);
continue;
} else
if ((*k)=="mem")
{
labels_->addAddr(memory_->getCurrent(),tmpStr);
memory_->putByte(0);
memory_->putByte(0);
continue;
}
} else
if (((*k)=="num") &&
(isNumber(args[currArg])==false) &&
(isFloat(args[currArg])==false) &&
(regs_->isReg(args[currArg])==false) &&
(regs_->isRegFloat(args[currArg])==false) &&
(args[currArg][0]!='%'))
{
labels_->addAddr(memory_->getCurrent(),args[currArg]);
memory_->putByte(0);
memory_->putByte(0);
continue;
}
}
break;
}
}
}
if (matched==false)
error(curLine_,"Syntax error");
}
//memory_->print();
labels_->setLabels();
}
|
1d7772e41df133d129a10946368d082dd7db3544 | 2553211587d202e7510268b8d8bbb9dd26c8978b | /mainwindow.cpp | 45f0575468abfff769c627ee2a35674a5b30be4d | [] | no_license | Albert753258/GoogleDino | 0736e058a98a532f21b1e700ea60e1e02832230a | e3976cf2cb88c62a68bffb7d5ccb4a70d8274063 | refs/heads/master | 2022-09-25T12:18:48.898886 | 2020-06-01T15:34:50 | 2020-06-01T15:34:50 | 268,560,808 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 659 | cpp | mainwindow.cpp | #include "gamemainwindow.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<iostream>
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->startButton, SIGNAL(clicked()), this, SLOT(on_startButton_clicked()));
connect(ui->exitButton, SIGNAL(clicked()), this, SLOT(on_exitButton_clicked()));
}
std::vector<Kaktus*> MainWindow::vect;
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_startButton_clicked()
{
MainWindow::window.show();
hide();
}
void MainWindow::on_exitButton_clicked()
{
MainWindow::close();
}
|
23d18bc28c0469edb64387e26962e8df7d57954c | b4f6d6be79d1e6c7e80983ea50b171da852d59c7 | /xml_parser.cpp | 1edd2604dabdf252515bbdfe32234a3d6a4384f2 | [] | no_license | KrashLeviathan/nextbus | 882df4fc5a87937f3a1c0c9a8c924f9a554f5608 | 7a030ada1c0c435542bbfb070a2071d952adf35d | refs/heads/master | 2021-06-05T22:00:33.225050 | 2018-01-20T05:58:53 | 2018-01-20T05:58:53 | 56,706,175 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,786 | cpp | xml_parser.cpp | #include <iostream>
#include <map>
#include "xml_parser.h"
#include "io.h"
std::map<char, std::string> *XmlParser::parse_attributes() {
std::map<char, std::string> *attributeMap = new std::map<char, std::string>();
char key;
bool readingValueString = false;
substring.erase();
while (index < text->length()) {
c = (*text)[index++];
switch (c) {
case ' ':
if (!readingValueString) {
// New attribute coming up
substring.erase();
} else {
// The space is part of a string value
substring += c;
}
break;
case '=':
key = key_from_string(&substring);
break;
case '"':
if (readingValueString) {
(*attributeMap)[key] = substring;
readingValueString = false;
} else {
readingValueString = true;
substring.erase();
}
break;
case '>':
// Closing bracket found
substring.erase();
return attributeMap;
default:
substring += c;
break;
}
}
std::cout << IO_RED "ERROR: XmlParser::parse_attributes()"
<< IO_NORMAL << std::endl;
return attributeMap;
}
void XmlParser::parse_error() {
std::map<char, std::string> *attributeMap;
attributeMap = parse_attributes();
errorShouldRetry = (*attributeMap)[ATTR_ERROR_SHOULD_RETRY];
}
void XmlParser::parse_element_open() {
substring.erase();
c = (*text)[index++];
if (c == '/') {
// Element closing
substring.erase();
while (index < text->length()) {
c = (*text)[index++];
// Is it an element we care about?
if (c == ' ' || c == '>') {
if (!substring.compare("Error")) {
// Error complete
errorText = pText;
std::cout << IO_RED "ERROR: "
<< errorText << IO_NORMAL
<< "Should Retry? " << errorShouldRetry << std::endl;
}
element_close_actions();
substring.erase();
break;
} else {
substring += c;
}
}
} else {
// Element opening
substring.erase();
substring += c;
while (index < text->length()) {
c = (*text)[index++];
// Is it an element we care about?
if (c == ' ' || c == '>') {
if (!substring.compare("Error")) {
// Received Error from NextBus API
parse_error();
}
element_open_actions();
substring.erase();
break;
} else {
substring += c;
pText.erase();
}
}
}
}
void XmlParser::parse() {
while (index < text->length()) {
c = (*text)[index++];
if (c == '<') {
// Found an opening bracket
parse_element_open();
} else {
pText += c;
}
}
}
|
3293dd3466dec80b246c67e014b4dbe1598a4835 | 51b32cc4fc2b0650e1e2fe4c9bcdbeb6141e5f2e | /3-2.TextLSTM/TextLSTM_Torch.cpp | 552fc2294174323137e6cfce6316bc19b1cb4485 | [
"MIT"
] | permissive | KeisukeTagami/nlp-tutorial | ed0f8ed0104bcfda7704839cccf826f42842c44b | 9a64dd149d6dc9160eed000640b5ffcbf1486f2e | refs/heads/master | 2020-05-16T16:49:13.953090 | 2019-05-26T12:26:12 | 2019-05-26T12:26:12 | 183,175,187 | 0 | 0 | MIT | 2019-04-24T07:41:18 | 2019-04-24T07:41:16 | Jupyter Notebook | UTF-8 | C++ | false | false | 4,837 | cpp | TextLSTM_Torch.cpp | /********************************************
* $ mkdir build
* $ cd build
* $ cmake -DCMAKE_PREFIX_PATH=/path/to/libtorch ..
* $ make
**********************************************/
#include <torch/torch.h>
#include <cstddef>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include "NLPDataset.h"
// The number of epochs to train.
const int64_t kNumberOfEpochs = 5000;
// After how many batches to log a new update with the loss value.
const int64_t kLogInterval = 1000;
const int64_t n_step = 3;
const int64_t n_hidden = 128;
std::shared_ptr<torch::nn::LSTMImpl> make_lstm(int64_t input_size, int64_t hidden_size) {
auto options = torch::nn::LSTMOptions(input_size, hidden_size);
return std::make_shared<torch::nn::LSTMImpl>(options);
}
struct Net : torch::nn::Module {
Net(int64_t n_class)
: lstm(make_lstm(n_class, n_hidden)),
W(torch::rand({n_hidden, n_class})),
b(torch::rand({n_class}))
{
register_module("lstm", lstm);
register_parameter("W", W);
register_parameter("b", b);
}
torch::Tensor forward(torch::Tensor state, torch::Tensor X) {
X = X.transpose(0, 1); // X : [n_step, batch_size, n_class]
auto outputs = lstm->forward(X, state).output;
outputs = outputs[-1]; //[batch_size, num_directions(=1) * n_hidden]
outputs = torch::mm(outputs, W) + b; // model : [batch_size, n_class]
outputs = torch::log_softmax(outputs, /*dim=*/1);
return outputs;
}
std::shared_ptr<torch::nn::LSTMImpl> lstm;
torch::Tensor W;
torch::Tensor b;
};
auto main() -> int {
torch::manual_seed(1);
torch::DeviceType device_type;
if (torch::cuda::is_available()) {
std::cout << "CUDA available! Training on GPU." << std::endl;
device_type = torch::kCUDA;
} else {
std::cout << "Training on CPU." << std::endl;
device_type = torch::kCPU;
}
// device_type = torch::kCPU;
torch::Device device(device_type);
std::vector<std::string> words{ "make", "need", "coal", "word", "love", "hate", "live", "home", "hash", "star"};
const int64_t batch_size = static_cast<int64_t>(words.size());
auto dataset = torch::data::datasets::NLP(words);
auto train_dataset = dataset.map(torch::data::transforms::Stack<>());
auto data_loader = torch::data::make_data_loader<torch::data::samplers::SequentialSampler>(std::move(train_dataset), batch_size);
int64_t nClass = dataset.getClassNumber();
Net model(nClass);
model.to(device);
torch::optim::Adam optimizer(model.parameters(), torch::optim::AdamOptions(0.001));
model.train();
for (size_t epoch = 1; epoch <= kNumberOfEpochs; ++epoch) {
float loss_value;
for (auto& batch : *data_loader) {
auto data = batch.data.to(device);
auto targets = batch.target.to(device);
auto hidden_state = torch::Tensor(torch::zeros({1, 1, data.sizes().vec().at(0), n_hidden}));
auto cell_state = torch::Tensor(torch::zeros({1, 1, data.sizes().vec().at(0), n_hidden}));
auto state = torch::cat({hidden_state, cell_state}, 0).to(device);
optimizer.zero_grad();
auto output = model.forward(state, data);
auto loss = torch::nll_loss(output, targets);
AT_ASSERT(!std::isnan(loss.template item<float>()));
loss.backward();
optimizer.step();
loss_value = loss.template item<float>();
}
if (epoch % kLogInterval == 0) {
std::cout << std::endl;
std::cout << "\rTrain Epoch: " << epoch
<< "[" << std::setfill(' ') << std::setw(5) << epoch
<< "/" << std::setfill(' ') << std::setw(5) << kNumberOfEpochs
<< "]"
<< " Loss: " << loss_value;
}
}
model.eval();
for (auto& batch : *data_loader) {
auto input = batch.data.to(device);
auto targets = batch.target.to(device);
auto hidden_state = torch::Tensor(torch::zeros({1, 1, input.sizes().vec().at(0), n_hidden}));
auto cell_state = torch::Tensor(torch::zeros({1, 1, input.sizes().vec().at(0), n_hidden}));
auto state = torch::cat({hidden_state, cell_state}, 0).to(device);
auto predict = model.forward(state, input);
input = input.argmax(2).cpu();
targets = targets.cpu();
predict = predict.argmax(1).cpu();
auto input_accessor = input.accessor<int64_t,2>();
auto targets_accessor = targets.accessor<int64_t,1>();
auto predict_accessor = predict.accessor<int64_t,1>();
std::cout << std::endl;
for(int i = 0; i < input_accessor.size(0); i++) {
for(int j = 0; j < input_accessor.size(1); j++) {
std::cout << dataset.index_to_string(input_accessor[i][j]);
}
std::cout << " ";
std::cout << dataset.index_to_string(predict_accessor[i]);
std::cout << " [" << dataset.index_to_string(targets_accessor[i]) << "]";
std::cout << std::endl;
}
}
}
|
c128a4a89e6168cdd1d8b777a2695b22996dd659 | 8e2a1db9c369754efe689dd5e9707a1845bc7fd2 | /test1.cpp | 919b4dce7853473b847de04c1a5a625c7cb712e7 | [] | no_license | zhanyeye/C | a5bf9b383b723b1dac370e53fc26229f798e7a19 | c099cfaa6fd1859503c4dcabee2d45858ad813c7 | refs/heads/master | 2020-04-11T17:56:02.712922 | 2019-08-10T11:18:42 | 2019-08-10T11:18:42 | 161,979,905 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 617 | cpp | test1.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
void deletestr(char *s, char *t, char *u) {
int cnt = 0;
int i, j;
for (i = 0; s[i] != '\0'; i++) {
int flag = 0;
for (j = 0; t[j] != '\0'; j++) {
if (s[i] == t[j]) {
flag = 1;
break;
}
}
if (flag == 0) {
u[cnt++] = s[i];
}
}
u[cnt] = '\0';
}
int main() {
int m=3,n=4,x;
x=-m++;
cout << x << endl;
cout << m << endl;
int y = -++m;
cout << y;
x=x+8/++n;
printf("%d\n",x);
} |
376881447b0304a1bb4efbd37c6d6cb9dd9fc60d | 702efaeceb35ba0f5ce302f9ceaf0b6682793bcc | /bronze/17_jan_cowtip/main.cpp | 5ef911ddc777ec37066c4a538c4108e1f5391957 | [] | no_license | milkykittybunny/USACO | 6e08a79dd51e18739410696c051d257900db9274 | beb8c1e8b0ef634b86eec0b527505b17d93ab9e5 | refs/heads/master | 2020-04-17T23:51:39.264780 | 2019-01-07T02:41:50 | 2019-01-07T02:41:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,105 | cpp | main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ifstream fIn("cowtip.in");
ofstream fOut("cowtip.out");
// solution comes here
int n;
fIn >> n;
vector<vector<char> > farm(n, vector<char> (n));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
char temp;
fIn >> temp;
farm[i][j] = temp;
}
}
int totalflips = 0;
for (int i = n-1; i >= 0; i--) {
for (int j = n-1; j >= 0; j--) {
if (farm[i][j] == '1') {
totalflips++;
// function cow_flip()
for (int a = 0; a <= i; a++) {
for (int b = 0; b <= j; b++) {
if (farm[a][b] == '0') {
farm[a][b] = '1';
}
else {
farm[a][b] = '0';
}
}
}
// end function cow_flip()
}
}
}
fOut << totalflips;
fIn.close();
fOut.close();
} |
20b6b012dd2b625163f65c64d489603ce5215670 | 3836fcf9763b2bb775020d7c8b5575eef995f9b7 | /src/BasicBlock.cpp | 71b1f143598d98c4b57bd047cd93f1fbbca58050 | [] | no_license | armbuster/compilers_phase2 | 919512afdae02206120dfa1e6ff78f2f664f83b1 | 51e19c5a11be664650885ae644a5887f4d27d8ca | refs/heads/main | 2023-04-04T05:13:35.538571 | 2021-04-24T16:34:13 | 2021-04-24T16:34:13 | 348,886,075 | 0 | 0 | null | 2021-04-24T16:34:14 | 2021-03-17T23:58:15 | C++ | UTF-8 | C++ | false | false | 1,140 | cpp | BasicBlock.cpp | #include "BasicBlock.h"
#include "Instruction.h"
IR::BasicBlock::BasicBlock() : id_(0)
{}
bool IR::BasicBlock::addInstruction(Instruction* inst)
{
instructions_->push_back(inst);
return true;
}
void IR::BasicBlock::markFinalInstruction()
{
Instruction* finalInstruction = instructions_->at(instructions_->size()-1);
finalInstruction->markAsFinal();
}
void IR::BasicBlock::addSuccessor(BasicBlock* bb)
{
successors_->push_back(bb);
}
void IR::BasicBlock::addPredecessor(BasicBlock* bb)
{
predecessors_->push_back(bb);
}
void IR::BasicBlock::print()
{
printf("BasicBlock: ID: %d\n", id_);
for (Instruction* inst : *instructions_)
{
printf("\t\t");
inst->print();
}
printSuccessors();
printPredecessors();
printf("\n\n");
}
// Private
void IR::BasicBlock::printSuccessors()
{
printf("\t");
printf("BasicBlockSuccessors: ");
for (BasicBlock* successor : *successors_)
{
printf("%d ", successor->getId());
}
}
// Private
void IR::BasicBlock::printPredecessors()
{
printf("\t");
printf("BasicBlockPredecessors: ");
for (BasicBlock* predecessor : *predecessors_)
{
printf("%d ", predecessor->getId());
}
} |
c09b6cce4ee9c82e93e8fef4d36b3215d185f4c2 | a0155e192c9dc2029b231829e3db9ba90861f956 | /MailFilter/Main/MFConfig.cpp | 8b4dcc4582182a6a7c984254ebaa9d212845ab11 | [] | no_license | zeha/mailfilter | d2de4aaa79bed2073cec76c93768a42068cfab17 | 898dd4d4cba226edec566f4b15c6bb97e79f8001 | refs/heads/master | 2021-01-22T02:03:31.470739 | 2010-08-12T23:51:35 | 2010-08-12T23:51:35 | 81,022,257 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 1,601 | cpp | MFConfig.cpp | /*+
+ MFConfig.cpp
+
+ MailFilter Configuration
+
+ Copyright 2001-2004 Christian Hofstädtler
+
+
+*/
#define _MFD_MODULE "MFCONFIG.CPP"
#include "MailFilter.h"
#include "MFConfig-defines.h"
#define MAILFILTER_CONFIGURATIONFILE_STRING (MAILFILTER_CONFIGURATION_LENGTH+1)
//
// Show Configuration
//
int MF_ConfigReadFile(char* FileName, char* szDestination, long iBufLen)
{
FILE* cfgFile;
size_t dRead;
szDestination[0] = 0;
cfgFile = fopen(FileName,"rb");
if (cfgFile == NULL)
return -2;
dRead = fread(szDestination,sizeof(char),(unsigned int)(iBufLen-1),cfgFile);
fclose(cfgFile);
szDestination[dRead]=0;
szDestination[iBufLen-1]=0;
return (int)(dRead);
}
int MF_ConfigReadString(char* ConfigFile, int Entry, char Value[])
{
FILE* cfgFile;
size_t dRead;
Value[0]=0;
cfgFile = fopen(ConfigFile,"rb");
if (cfgFile == NULL)
return -2;
fseek(cfgFile,Entry,SEEK_SET);
dRead = fread(Value,sizeof(char),MAILFILTER_CONFIGURATION_LENGTH-2,cfgFile);
fclose(cfgFile);
Value[dRead+1]=0;
Value[MAX_PATH-2]=0;
return (int)(strlen(Value));
}
int MF_ConfigReadInt(char ConfigFile[MAX_PATH], int Entry)
{
int retVal = 0;
char readBuf[16];
FILE* cfgFile;
readBuf[0]='\0';
cfgFile = fopen(ConfigFile,"rb");
if (cfgFile == NULL)
return -2;
fseek(cfgFile,Entry,SEEK_SET);
fread(readBuf,sizeof(char),15,cfgFile);
fclose(cfgFile);
readBuf[14]=0;
retVal = atoi(readBuf);
return retVal;
}
/*
*
*
* --- eof ---
*
*
*/
|
53d967754848973fa41e4f957e2e75f30916706a | e8160a316d2943cce7e2eb914cfc626e3e51cbfe | /10991 별 찍기 - 16/10991 별 찍기 - 16/main.cpp | cffffe13cf5fecb95332f3fc649bd7c5bc4e81e0 | [] | no_license | Erica1217/algorithm | c5a411289ae12672c3d7418672be574beab370a1 | a2e15aa72fbfbc149d5409a9a14a8379e929d949 | refs/heads/main | 2023-01-20T13:17:19.652577 | 2020-11-26T05:31:24 | 2020-11-26T05:31:24 | 316,132,323 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 476 | cpp | main.cpp | //
// main.cpp
// 10991 별 찍기 - 16
//
// Created by 김유진 on 21/09/2019.
// Copyright © 2019 김유진. All rights reserved.
//
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=n-1 ; i>=0 ; i--)
{
for(int j=0 ; j<i ; j++)
{
printf(" ");
}
for(int j=0 ; j<n-i ; j++)
{
printf("* ");
}
printf("\n");
}
}
|
f6b46f02ca742a9089c91f56760631e064d60d5d | f8bfb5129396a42c2de76adfebc078c0cad11aa5 | /AdventofCode18/headers/Day11.h | 776b2e4434ff7d57cf04a8d6016228aac43f3ff1 | [] | no_license | metinsuloglu/AdventofCode18 | 02ea8e788d22f8e3499f18048a3d7594b7fde172 | 2fe662e1545bca0ce786f02a0536392954ff13f6 | refs/heads/master | 2020-04-09T01:42:01.590692 | 2018-12-31T15:14:58 | 2018-12-31T15:14:58 | 159,913,853 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 241 | h | Day11.h | //
// Advent of Code 2018
// Day 11: Chronal Charge
//
// adventofcode.com
//
// Metin Suloglu, Dec 2018
//
#ifndef Day11_h
#define Day11_h
#include "AoCDay.h"
class Day11 {
public:
static void run(int);
};
#endif /* Day11_h */
|
65136ef465f1abea093f910bc1d465ad7e3f84d5 | c053016740f5dcffad184cb587ffb09b00bd45ea | /klxh CPP design/Menu.h | a56d5ec71e8751dd03ee774769a0844b7e2fab3d | [] | no_license | klxh-max/C-Restaurant-management-system | af28a8d4668a1be1bddeca6129862d136cd887bb | 07dbd22101173d4a8a9bcbcf5da462f5458eb37b | refs/heads/main | 2023-04-01T10:28:24.348148 | 2021-03-08T13:04:24 | 2021-03-08T13:04:24 | 345,657,292 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 301 | h | Menu.h | #pragma once
#ifndef MENU
#define MENU
#include <bits/stdc++.h>
#include "Food.h"
using namespace std;
class Menu
{
private:
int fnum=0;
public:
Food food[50];
void Add(string a, double b, double c);
void Delete(int a);
void Display();
void setFnum();
int getFnum();
};
#endif // !MENU
|
eb61c17557e0b440382bbb4380df7c13b9e613fb | fe9935b08e22fc019fbcfd6c0bc37ab235e2a0e2 | /catkin_ws/build/find-object/src/utilite/moc_UPlot.cpp | 66b2bde50b9bc632d63090dd29927d931ac47ad3 | [] | no_license | abdussametkaradeniz/RosLessonsAndTutorials | ce22a06d8a881d949479956ea6aa06ff9f8bf41b | 940597350f5ed85244696ec44fe567fd89a6d5d8 | refs/heads/main | 2023-07-18T22:56:52.075918 | 2021-09-07T21:42:24 | 2021-09-07T21:42:24 | 404,125,607 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 25,650 | cpp | moc_UPlot.cpp | /****************************************************************************
** Meta object code from reading C++ file 'UPlot.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../../../../src/find-object/src/utilite/UPlot.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#include <QtCore/QVector>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'UPlot.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.12.8. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_UPlotCurve_t {
QByteArrayData data[24];
char stringdata0[235];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_UPlotCurve_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_UPlotCurve_t qt_meta_stringdata_UPlotCurve = {
{
QT_MOC_LITERAL(0, 0, 10), // "UPlotCurve"
QT_MOC_LITERAL(1, 11, 11), // "dataChanged"
QT_MOC_LITERAL(2, 23, 0), // ""
QT_MOC_LITERAL(3, 24, 17), // "const UPlotCurve*"
QT_MOC_LITERAL(4, 42, 5), // "clear"
QT_MOC_LITERAL(5, 48, 10), // "setVisible"
QT_MOC_LITERAL(6, 59, 7), // "visible"
QT_MOC_LITERAL(7, 67, 13), // "setXIncrement"
QT_MOC_LITERAL(8, 81, 9), // "increment"
QT_MOC_LITERAL(9, 91, 9), // "setXStart"
QT_MOC_LITERAL(10, 101, 3), // "val"
QT_MOC_LITERAL(11, 105, 8), // "addValue"
QT_MOC_LITERAL(12, 114, 10), // "UPlotItem*"
QT_MOC_LITERAL(13, 125, 4), // "data"
QT_MOC_LITERAL(14, 130, 1), // "y"
QT_MOC_LITERAL(15, 132, 1), // "x"
QT_MOC_LITERAL(16, 134, 9), // "addValues"
QT_MOC_LITERAL(17, 144, 20), // "QVector<UPlotItem*>&"
QT_MOC_LITERAL(18, 165, 14), // "QVector<float>"
QT_MOC_LITERAL(19, 180, 2), // "xs"
QT_MOC_LITERAL(20, 183, 2), // "ys"
QT_MOC_LITERAL(21, 186, 12), // "QVector<int>"
QT_MOC_LITERAL(22, 199, 18), // "std::vector<float>"
QT_MOC_LITERAL(23, 218, 16) // "std::vector<int>"
},
"UPlotCurve\0dataChanged\0\0const UPlotCurve*\0"
"clear\0setVisible\0visible\0setXIncrement\0"
"increment\0setXStart\0val\0addValue\0"
"UPlotItem*\0data\0y\0x\0addValues\0"
"QVector<UPlotItem*>&\0QVector<float>\0"
"xs\0ys\0QVector<int>\0std::vector<float>\0"
"std::vector<int>"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_UPlotCurve[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
15, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 89, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
4, 0, 92, 2, 0x0a /* Public */,
5, 1, 93, 2, 0x0a /* Public */,
7, 1, 96, 2, 0x0a /* Public */,
9, 1, 99, 2, 0x0a /* Public */,
11, 1, 102, 2, 0x0a /* Public */,
11, 1, 105, 2, 0x0a /* Public */,
11, 2, 108, 2, 0x0a /* Public */,
11, 1, 113, 2, 0x0a /* Public */,
16, 1, 116, 2, 0x0a /* Public */,
16, 2, 119, 2, 0x0a /* Public */,
16, 1, 124, 2, 0x0a /* Public */,
16, 1, 127, 2, 0x0a /* Public */,
16, 1, 130, 2, 0x0a /* Public */,
16, 1, 133, 2, 0x0a /* Public */,
// signals: parameters
QMetaType::Void, 0x80000000 | 3, 2,
// slots: parameters
QMetaType::Void,
QMetaType::Void, QMetaType::Bool, 6,
QMetaType::Void, QMetaType::Float, 8,
QMetaType::Void, QMetaType::Float, 10,
QMetaType::Void, 0x80000000 | 12, 13,
QMetaType::Void, QMetaType::Float, 14,
QMetaType::Void, QMetaType::Float, QMetaType::Float, 15, 14,
QMetaType::Void, QMetaType::QString, 14,
QMetaType::Void, 0x80000000 | 17, 13,
QMetaType::Void, 0x80000000 | 18, 0x80000000 | 18, 19, 20,
QMetaType::Void, 0x80000000 | 18, 20,
QMetaType::Void, 0x80000000 | 21, 20,
QMetaType::Void, 0x80000000 | 22, 20,
QMetaType::Void, 0x80000000 | 23, 20,
0 // eod
};
void UPlotCurve::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
auto *_t = static_cast<UPlotCurve *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->dataChanged((*reinterpret_cast< const UPlotCurve*(*)>(_a[1]))); break;
case 1: _t->clear(); break;
case 2: _t->setVisible((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 3: _t->setXIncrement((*reinterpret_cast< float(*)>(_a[1]))); break;
case 4: _t->setXStart((*reinterpret_cast< float(*)>(_a[1]))); break;
case 5: _t->addValue((*reinterpret_cast< UPlotItem*(*)>(_a[1]))); break;
case 6: _t->addValue((*reinterpret_cast< float(*)>(_a[1]))); break;
case 7: _t->addValue((*reinterpret_cast< float(*)>(_a[1])),(*reinterpret_cast< float(*)>(_a[2]))); break;
case 8: _t->addValue((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 9: _t->addValues((*reinterpret_cast< QVector<UPlotItem*>(*)>(_a[1]))); break;
case 10: _t->addValues((*reinterpret_cast< const QVector<float>(*)>(_a[1])),(*reinterpret_cast< const QVector<float>(*)>(_a[2]))); break;
case 11: _t->addValues((*reinterpret_cast< const QVector<float>(*)>(_a[1]))); break;
case 12: _t->addValues((*reinterpret_cast< const QVector<int>(*)>(_a[1]))); break;
case 13: _t->addValues((*reinterpret_cast< const std::vector<float>(*)>(_a[1]))); break;
case 14: _t->addValues((*reinterpret_cast< const std::vector<int>(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 10:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 1:
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QVector<float> >(); break;
}
break;
case 11:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QVector<float> >(); break;
}
break;
case 12:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QVector<int> >(); break;
}
break;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (UPlotCurve::*)(const UPlotCurve * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&UPlotCurve::dataChanged)) {
*result = 0;
return;
}
}
}
}
QT_INIT_METAOBJECT const QMetaObject UPlotCurve::staticMetaObject = { {
&QObject::staticMetaObject,
qt_meta_stringdata_UPlotCurve.data,
qt_meta_data_UPlotCurve,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *UPlotCurve::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *UPlotCurve::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_UPlotCurve.stringdata0))
return static_cast<void*>(this);
return QObject::qt_metacast(_clname);
}
int UPlotCurve::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 15)
qt_static_metacall(this, _c, _id, _a);
_id -= 15;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 15)
qt_static_metacall(this, _c, _id, _a);
_id -= 15;
}
return _id;
}
// SIGNAL 0
void UPlotCurve::dataChanged(const UPlotCurve * _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
struct qt_meta_stringdata_UPlotCurveThreshold_t {
QByteArrayData data[7];
char stringdata0[87];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_UPlotCurveThreshold_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_UPlotCurveThreshold_t qt_meta_stringdata_UPlotCurveThreshold = {
{
QT_MOC_LITERAL(0, 0, 19), // "UPlotCurveThreshold"
QT_MOC_LITERAL(1, 20, 12), // "setThreshold"
QT_MOC_LITERAL(2, 33, 0), // ""
QT_MOC_LITERAL(3, 34, 9), // "threshold"
QT_MOC_LITERAL(4, 44, 14), // "setOrientation"
QT_MOC_LITERAL(5, 59, 15), // "Qt::Orientation"
QT_MOC_LITERAL(6, 75, 11) // "orientation"
},
"UPlotCurveThreshold\0setThreshold\0\0"
"threshold\0setOrientation\0Qt::Orientation\0"
"orientation"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_UPlotCurveThreshold[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
2, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 1, 24, 2, 0x0a /* Public */,
4, 1, 27, 2, 0x0a /* Public */,
// slots: parameters
QMetaType::Void, QMetaType::Float, 3,
QMetaType::Void, 0x80000000 | 5, 6,
0 // eod
};
void UPlotCurveThreshold::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
auto *_t = static_cast<UPlotCurveThreshold *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->setThreshold((*reinterpret_cast< float(*)>(_a[1]))); break;
case 1: _t->setOrientation((*reinterpret_cast< Qt::Orientation(*)>(_a[1]))); break;
default: ;
}
}
}
QT_INIT_METAOBJECT const QMetaObject UPlotCurveThreshold::staticMetaObject = { {
&UPlotCurve::staticMetaObject,
qt_meta_stringdata_UPlotCurveThreshold.data,
qt_meta_data_UPlotCurveThreshold,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *UPlotCurveThreshold::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *UPlotCurveThreshold::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_UPlotCurveThreshold.stringdata0))
return static_cast<void*>(this);
return UPlotCurve::qt_metacast(_clname);
}
int UPlotCurveThreshold::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = UPlotCurve::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 2)
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 2)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 2;
}
return _id;
}
struct qt_meta_stringdata_UPlotLegendItem_t {
QByteArrayData data[4];
char stringdata0[53];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_UPlotLegendItem_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_UPlotLegendItem_t qt_meta_stringdata_UPlotLegendItem = {
{
QT_MOC_LITERAL(0, 0, 15), // "UPlotLegendItem"
QT_MOC_LITERAL(1, 16, 17), // "legendItemRemoved"
QT_MOC_LITERAL(2, 34, 0), // ""
QT_MOC_LITERAL(3, 35, 17) // "const UPlotCurve*"
},
"UPlotLegendItem\0legendItemRemoved\0\0"
"const UPlotCurve*"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_UPlotLegendItem[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 19, 2, 0x06 /* Public */,
// signals: parameters
QMetaType::Void, 0x80000000 | 3, 2,
0 // eod
};
void UPlotLegendItem::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
auto *_t = static_cast<UPlotLegendItem *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->legendItemRemoved((*reinterpret_cast< const UPlotCurve*(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (UPlotLegendItem::*)(const UPlotCurve * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&UPlotLegendItem::legendItemRemoved)) {
*result = 0;
return;
}
}
}
}
QT_INIT_METAOBJECT const QMetaObject UPlotLegendItem::staticMetaObject = { {
&QPushButton::staticMetaObject,
qt_meta_stringdata_UPlotLegendItem.data,
qt_meta_data_UPlotLegendItem,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *UPlotLegendItem::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *UPlotLegendItem::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_UPlotLegendItem.stringdata0))
return static_cast<void*>(this);
return QPushButton::qt_metacast(_clname);
}
int UPlotLegendItem::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QPushButton::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 1)
qt_static_metacall(this, _c, _id, _a);
_id -= 1;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 1)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 1;
}
return _id;
}
// SIGNAL 0
void UPlotLegendItem::legendItemRemoved(const UPlotCurve * _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
struct qt_meta_stringdata_UPlotLegend_t {
QByteArrayData data[9];
char stringdata0[114];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_UPlotLegend_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_UPlotLegend_t qt_meta_stringdata_UPlotLegend = {
{
QT_MOC_LITERAL(0, 0, 11), // "UPlotLegend"
QT_MOC_LITERAL(1, 12, 17), // "legendItemRemoved"
QT_MOC_LITERAL(2, 30, 0), // ""
QT_MOC_LITERAL(3, 31, 17), // "const UPlotCurve*"
QT_MOC_LITERAL(4, 49, 5), // "curve"
QT_MOC_LITERAL(5, 55, 17), // "legendItemToggled"
QT_MOC_LITERAL(6, 73, 7), // "toggled"
QT_MOC_LITERAL(7, 81, 16), // "removeLegendItem"
QT_MOC_LITERAL(8, 98, 15) // "redirectToggled"
},
"UPlotLegend\0legendItemRemoved\0\0"
"const UPlotCurve*\0curve\0legendItemToggled\0"
"toggled\0removeLegendItem\0redirectToggled"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_UPlotLegend[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
2, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 34, 2, 0x06 /* Public */,
5, 2, 37, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
7, 1, 42, 2, 0x0a /* Public */,
8, 1, 45, 2, 0x08 /* Private */,
// signals: parameters
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, 0x80000000 | 3, QMetaType::Bool, 4, 6,
// slots: parameters
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, QMetaType::Bool, 2,
0 // eod
};
void UPlotLegend::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
auto *_t = static_cast<UPlotLegend *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->legendItemRemoved((*reinterpret_cast< const UPlotCurve*(*)>(_a[1]))); break;
case 1: _t->legendItemToggled((*reinterpret_cast< const UPlotCurve*(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
case 2: _t->removeLegendItem((*reinterpret_cast< const UPlotCurve*(*)>(_a[1]))); break;
case 3: _t->redirectToggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (UPlotLegend::*)(const UPlotCurve * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&UPlotLegend::legendItemRemoved)) {
*result = 0;
return;
}
}
{
using _t = void (UPlotLegend::*)(const UPlotCurve * , bool );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&UPlotLegend::legendItemToggled)) {
*result = 1;
return;
}
}
}
}
QT_INIT_METAOBJECT const QMetaObject UPlotLegend::staticMetaObject = { {
&QWidget::staticMetaObject,
qt_meta_stringdata_UPlotLegend.data,
qt_meta_data_UPlotLegend,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *UPlotLegend::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *UPlotLegend::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_UPlotLegend.stringdata0))
return static_cast<void*>(this);
return QWidget::qt_metacast(_clname);
}
int UPlotLegend::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 4)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 4;
}
return _id;
}
// SIGNAL 0
void UPlotLegend::legendItemRemoved(const UPlotCurve * _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void UPlotLegend::legendItemToggled(const UPlotCurve * _t1, bool _t2)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
struct qt_meta_stringdata_UOrientableLabel_t {
QByteArrayData data[1];
char stringdata0[17];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_UOrientableLabel_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_UOrientableLabel_t qt_meta_stringdata_UOrientableLabel = {
{
QT_MOC_LITERAL(0, 0, 16) // "UOrientableLabel"
},
"UOrientableLabel"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_UOrientableLabel[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
void UOrientableLabel::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject UOrientableLabel::staticMetaObject = { {
&QLabel::staticMetaObject,
qt_meta_stringdata_UOrientableLabel.data,
qt_meta_data_UOrientableLabel,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *UOrientableLabel::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *UOrientableLabel::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_UOrientableLabel.stringdata0))
return static_cast<void*>(this);
return QLabel::qt_metacast(_clname);
}
int UOrientableLabel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QLabel::qt_metacall(_c, _id, _a);
return _id;
}
struct qt_meta_stringdata_UPlot_t {
QByteArrayData data[10];
char stringdata0[94];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_UPlot_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_UPlot_t qt_meta_stringdata_UPlot = {
{
QT_MOC_LITERAL(0, 0, 5), // "UPlot"
QT_MOC_LITERAL(1, 6, 11), // "removeCurve"
QT_MOC_LITERAL(2, 18, 0), // ""
QT_MOC_LITERAL(3, 19, 17), // "const UPlotCurve*"
QT_MOC_LITERAL(4, 37, 5), // "curve"
QT_MOC_LITERAL(5, 43, 9), // "showCurve"
QT_MOC_LITERAL(6, 53, 5), // "shown"
QT_MOC_LITERAL(7, 59, 10), // "updateAxis"
QT_MOC_LITERAL(8, 70, 9), // "clearData"
QT_MOC_LITERAL(9, 80, 13) // "captureScreen"
},
"UPlot\0removeCurve\0\0const UPlotCurve*\0"
"curve\0showCurve\0shown\0updateAxis\0"
"clearData\0captureScreen"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_UPlot[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
6, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 1, 44, 2, 0x0a /* Public */,
5, 2, 47, 2, 0x0a /* Public */,
7, 0, 52, 2, 0x0a /* Public */,
8, 0, 53, 2, 0x0a /* Public */,
9, 0, 54, 2, 0x08 /* Private */,
7, 1, 55, 2, 0x08 /* Private */,
// slots: parameters
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, 0x80000000 | 3, QMetaType::Bool, 4, 6,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void, 0x80000000 | 3, 4,
0 // eod
};
void UPlot::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
auto *_t = static_cast<UPlot *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->removeCurve((*reinterpret_cast< const UPlotCurve*(*)>(_a[1]))); break;
case 1: _t->showCurve((*reinterpret_cast< const UPlotCurve*(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
case 2: _t->updateAxis(); break;
case 3: _t->clearData(); break;
case 4: _t->captureScreen(); break;
case 5: _t->updateAxis((*reinterpret_cast< const UPlotCurve*(*)>(_a[1]))); break;
default: ;
}
}
}
QT_INIT_METAOBJECT const QMetaObject UPlot::staticMetaObject = { {
&QWidget::staticMetaObject,
qt_meta_stringdata_UPlot.data,
qt_meta_data_UPlot,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *UPlot::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *UPlot::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_UPlot.stringdata0))
return static_cast<void*>(this);
return QWidget::qt_metacast(_clname);
}
int UPlot::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 6)
qt_static_metacall(this, _c, _id, _a);
_id -= 6;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 6)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 6;
}
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
|
99f8bee40fc18c1bf6aabba819a433abe2b654a7 | 75af9ed348bc6d8dc9ff03ec898309bebce485db | /src/gpe_scene_helper_class.cpp | 2feaf422417353dc52b567832ab0f8670761b5b2 | [
"MIT"
] | permissive | creikey/Game-Pencil-Engine | eea63d5345f6c7f516fb4ab108709444529d3568 | 961a33f090b6b8d94a660db9e4b67644d829c96f | refs/heads/master | 2020-07-08T12:53:04.073564 | 2019-08-21T23:36:55 | 2019-08-21T23:36:55 | 203,677,843 | 0 | 0 | MIT | 2019-08-21T23:16:40 | 2019-08-21T23:16:40 | null | UTF-8 | C++ | false | false | 14,825 | cpp | gpe_scene_helper_class.cpp | /*
gpe_scene_helper_class.cpp
This file is part of:
GAME PENCIL ENGINE
https://create.pawbyte.com
Copyright (c) 2014-2019 Nathan Hurde, Chase Lee.
Copyright (c) 2014-2019 PawByte LLC.
Copyright (c) 2014-2019 Game Pencil Engine contributors ( Contributors Page )
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-Game Pencil Engine <https://create.pawbyte.com>
*/
#include "gpe_scene_helper_class.h"
GPE_SceneEditorHelper * spm = NULL;
gameScenePopupCategories::gameScenePopupCategories( std::string cName )
{
name = cName;
categoryLabel = new GPE_Label_Title( name, name );
categoryLabel->needsNewLine = true;
}
gameScenePopupCategories::~gameScenePopupCategories()
{
GPE_VerticalCardButton * tempButon = NULL;
for( int i = (int)elements.size()-1; i >=0; i-- )
{
tempButon = elements[i];
if( tempButon!=NULL)
{
delete tempButon;
tempButon = NULL;
}
}
elements.clear();
if( categoryLabel!=NULL)
{
delete categoryLabel;
categoryLabel = NULL;
}
}
GPE_VerticalCardButton * gameScenePopupCategories::add_button( std::string name, int id, std::string imgLocation, std::string parsedLines )
{
GPE_VerticalCardButton * newCard = new GPE_VerticalCardButton( imgLocation, parsedLines, name, id, 64 );
newCard->showBackground = false;
newCard->usingFlagIcon = true;
elements.push_back( newCard );
return newCard;
}
void gameScenePopupCategories::add_if_available( GPE_GuiElementList * cList, std::string str )
{
if( cList !=NULL )
{
int i = 0;
if( (int)str.size() > 0 )
{
bool categoryAdded = false;
if( string_contains( string_lower( categoryLabel->get_name() ), string_lower( str ) ) )
{
cList->add_gui_element( categoryLabel, true );
categoryAdded = true;
}
for( i = 0; i < (int)elements.size(); i++ )
{
if( elements[i]!=NULL && string_contains( string_lower( elements[i]->get_name() ), string_lower (str ) ) )
{
if( !categoryAdded )
{
cList->add_gui_element( categoryLabel, true );
categoryAdded = true;
}
cList->add_gui_auto( elements[i] );
}
}
}
else
{
cList->add_gui_element( categoryLabel, true );
for( i = 0; i < (int)elements.size(); i++ )
{
cList->add_gui_auto( elements[i] );
}
}
}
}
GPE_SceneEditorHelper::GPE_SceneEditorHelper()
{
editMode = SCENE_MODE_PLACE;
mouseInScene = false;
mouseXPos = 0;
mouseYPos = 0;
sWidth = 0;
sHeight = 0;
cSceneAnimtList = NULL;
cSceneObjList = NULL;
cSceneTexList = NULL;
cSceneTstList = NULL;
zoomValue = 1.0;
currentCamera = new GPE_Rect();
tempRect = new GPE_Rect();
cameraFloorXPos = cameraFloorYPos = 0;
lightCircleTexture = new GPE_Texture();
lightCircleTexture->prerender_circle(256, c_white, 255 );
lightCircleTexture->set_blend_mode( blend_mode_add);
lightCircleTexture->change_alpha( 255 );
highlightRect = new GPE_Texture();
highlightRect->prerender_rectangle(256, 256, c_blue );
highlightRect->set_blend_mode( blend_mode_add );
highlightRect->change_alpha( 255 );
topList = new GPE_GuiElementList();
middleList = new GPE_GuiElementList();
bottomList = new GPE_GuiElementList();
confirmButton = new GPE_ToolLabelButton("Create","Creates new element");
cancelButton = new GPE_ToolLabelButton("Cancel","Cancels Operation");
currentLabel = new GPE_Label_Text( "","" );
descriptionLabel = new GPE_Label_Paragraph( "","","" );
nameField = new GPE_TextInputBasic("","Name...");
searchField = new GPE_TextInputBasic("","Search...");
gameScenePopupCategories * tCategory = add_category("Layer Element");
tCategory->add_button("Layer",BRANCH_TYPE_LAYER,APP_DIRECTORY_NAME+"resources/gfx/iconpacks/fontawesome/map.png","Layer" );
tCategory->add_button("Group",BRANCH_TYPE_GROUP,APP_DIRECTORY_NAME+"resources/gfx/iconpacks/fontawesome/object-group.png","Group" );
tCategory->add_button("TileMap",BRANCH_TYPE_TILEMAP,APP_DIRECTORY_NAME+"resources/gfx/iconpacks/fontawesome/th.png","TileMap" );
tCategory = add_category("Standard Element");
tCategory->add_button("Animation",BRANCH_TYPE_ANIMATION,APP_DIRECTORY_NAME+"resources/gfx/iconpacks/fontawesome/magnet.png","Animation" );
tCategory->add_button("Background",BRANCH_TYPE_BACKGROUND,APP_DIRECTORY_NAME+"resources/gfx/iconpacks/fontawesome/image.png","Background" );
tCategory->add_button("Object",BRANCH_TYPE_OBJECT,APP_DIRECTORY_NAME+"resources/gfx/iconpacks/fontawesome/automobile.png","Object" );
tCategory->add_button("Multi-Line Text",BRANCH_TYPE_TEXT,APP_DIRECTORY_NAME+"resources/gfx/iconpacks/fontawesome/text-height.png","Multi-Line\nText" );
tCategory->add_button("Single-Line Text",BRANCH_TYPE_STEXT,APP_DIRECTORY_NAME+"resources/gfx/iconpacks/fontawesome/text-width.png","Single-Line\nText" );
tCategory = add_category("Effects");
tCategory->add_button("Light",BRANCH_TYPE_LIGHT,APP_DIRECTORY_NAME+"resources/gfx/iconpacks/fontawesome/lightbulb-o.png","Light" );
tCategory->add_button("Particle Emitter",BRANCH_TYPE_PARTIClE_EMITTER,APP_DIRECTORY_NAME+"resources/gfx/iconpacks/fontawesome/magic.png","Particle\n Emitter" );
layerListsDropDown = new GPE_DropDown_Menu("Available Layers", false);
}
GPE_SceneEditorHelper::~GPE_SceneEditorHelper()
{
if( highlightRect!=NULL )
{
delete highlightRect;
highlightRect = NULL;
}
if( lightCircleTexture!=NULL )
{
delete lightCircleTexture;
lightCircleTexture = NULL;
}
if( topList!=NULL )
{
topList->clear_list();
delete topList;
topList = NULL;
}
if( middleList!=NULL )
{
middleList->clear_list();
delete middleList;
middleList = NULL;
}
if( bottomList!=NULL )
{
bottomList->clear_list();
delete bottomList;
bottomList = NULL;
}
if( highlightRect!=NULL )
{
delete highlightRect;
highlightRect = NULL;
}
}
gameScenePopupCategories * GPE_SceneEditorHelper::add_category( std::string name )
{
gameScenePopupCategories * newCategory = new gameScenePopupCategories( name );
popupCategories.push_back( newCategory );
return newCategory;
}
int GPE_SceneEditorHelper::get_new_resource(std::string title )
{
reset_meta();
if( GPE_MAIN_GUI!=NULL && MAIN_RENDERER!=NULL )
{
gpe->end_loop();
currentLabel->set_name("Select an option below for a new type in your scene");
RESOURCE_TO_DRAG = NULL;
GPE_change_cursor(SDL_SYSTEM_CURSOR_ARROW);
MAIN_OVERLAY->process_cursor();
GPE_MAIN_GUI->reset_gui_info();
MAIN_OVERLAY->take_frozen_screenshot( );
int promptBoxWidth = SCREEN_WIDTH *3/4;
if( promptBoxWidth < 320 )
{
promptBoxWidth = 320;
}
int promptBoxHeight = SCREEN_HEIGHT * 7/8;
if( promptBoxHeight < 240 )
{
promptBoxHeight = 240;
}
GPE_Rect elementBox;
bool exitOperation = false;
input->reset_all_input();
MAIN_RENDERER->reset_viewpoint();
//MAIN_OVERLAY->render_frozen_screenshot( );
int selectedOptionId = -1;
std::string selectedOptionStr = "";
GPE_VerticalCardButton * selectedButton = NULL;
while(exitOperation==false)
{
GPE_change_cursor(SDL_SYSTEM_CURSOR_ARROW);
//GPE_Report("Processing tip of the day");
gpe->start_loop();
elementBox.x = (SCREEN_WIDTH-promptBoxWidth)/2;
elementBox.y = (SCREEN_HEIGHT-promptBoxHeight)/2;
elementBox.w = promptBoxWidth;
elementBox.h = promptBoxHeight;
topList->set_height( 64 );
bottomList->set_height( 128 );
topList->set_coords(elementBox.x, elementBox.y +32 );
topList->set_width(elementBox.w);
topList->barXMargin = 0;
topList->barYMargin = 0;
topList->barXPadding = GENERAL_GPE_PADDING;
topList->barYPadding = GENERAL_GPE_PADDING;
topList->clear_list();
topList->add_gui_element(currentLabel,true);
topList->add_gui_element(searchField,true);
topList->process_self( );
middleList->set_coords(elementBox.x, topList->get_y2pos() );
middleList->set_width(elementBox.w);
middleList->set_height(elementBox.h - middleList->get_ypos() - bottomList->get_height());
middleList->barXMargin = GENERAL_GPE_PADDING;
middleList->barYMargin = GENERAL_GPE_PADDING;
middleList->barXPadding = GENERAL_GPE_PADDING;
middleList->barYPadding = GENERAL_GPE_PADDING;
GPE_MAIN_GUI->reset_gui_info();
middleList->clear_list();
for( int i = 0; i < (int)popupCategories.size(); i++ )
{
if( popupCategories[i]!=NULL )
{
popupCategories[i]->add_if_available( middleList, searchField->get_string() );
}
}
middleList->process_self( NULL, NULL );
if( middleList->selectedElement !=NULL && middleList->selectedElement->get_element_type()=="verticalButton" )
{
selectedOptionStr = middleList->selectedElement->descriptionText;
if( descriptionText!= selectedOptionStr)
{
descriptionText = selectedOptionStr;
descriptionLabel->update_text( descriptionText );
selectedButton = (GPE_VerticalCardButton * ) middleList->selectedElement;
selectedOptionId = selectedButton->get_id();
}
}
bottomList->clear_list();
bottomList->set_coords(middleList->get_xpos(), middleList->get_y2pos() );
bottomList->set_width(elementBox.w);
bottomList->barXMargin = 0;
bottomList->barYMargin = 0;
bottomList->barXPadding = GENERAL_GPE_PADDING;
bottomList->barYPadding = GENERAL_GPE_PADDING;
bottomList->clear_list();
bottomList->add_gui_element(descriptionLabel,true);
if( descriptionLabel->get_paragraph() == "Layer")
{
bottomList->add_gui_element(layerListsDropDown,true);
}
else
{
bottomList->add_gui_element(nameField, true );
}
bottomList->add_gui_auto(confirmButton );
bottomList->add_gui_auto(cancelButton );
bottomList->process_self( NULL, NULL );
if( input->check_keyboard_released(kb_esc) || cancelButton->is_clicked() || WINDOW_WAS_JUST_RESIZED )
{
exitOperation = true;
selectedOptionId = -1;
chosenName = "";
}
else if( confirmButton->is_clicked() )
{
exitOperation = true;
chosenName = nameField->get_string();
}
//GPE_Report("Rendering tip of the day");
MAIN_RENDERER->reset_viewpoint();
if( !WINDOW_WAS_JUST_RESIZED)
{
//if( input->windowEventHappendInFrame )
{
MAIN_OVERLAY->render_frozen_screenshot( );
}
//Update screen
gcanvas->render_rect( &elementBox,GPE_MAIN_THEME->Main_Box_Color,false);
gcanvas->render_rectangle( elementBox.x,elementBox.y,elementBox.x+elementBox.w,elementBox.y+32,GPE_MAIN_THEME->PopUp_Box_Color,false);
gcanvas->render_rect( &elementBox,GPE_MAIN_THEME->PopUp_Box_Highlight_Color,true);
gfs->render_text( elementBox.x+elementBox.w/2,elementBox.y+GENERAL_GPE_PADDING,title,GPE_MAIN_THEME->PopUp_Box_Font_Color,GPE_DEFAULT_FONT,FA_CENTER,FA_TOP);
topList->render_self( NULL, NULL );
middleList->render_self( NULL, NULL );
bottomList->render_self( NULL, NULL );
//GPE_MAIN_GUI-render_gui_info( true);
gcanvas->render_rect( &elementBox,GPE_MAIN_THEME->PopUp_Box_Border_Color,true);
MAIN_OVERLAY->process_cursor();
GPE_MAIN_GUI->render_gui_info( true);
}
gpe->end_loop();
}
input->reset_all_input();
MAIN_OVERLAY->render_frozen_screenshot( );
MAIN_RENDERER->update_renderer();
return selectedOptionId;
}
return -1;
}
void GPE_SceneEditorHelper::reset_meta()
{
boxIsMoving = false;
boxWasResized = false;
boxBeingResized = false;
bottomList->reset_self();
middleList->reset_self();
topList->reset_self();
currentLabel->set_name("");
descriptionText = "";
chosenName = "";
currentLabel->descriptionText = "";
nameField->set_string( "" );
searchField->set_string( "" );
descriptionLabel->update_text("");
}
|
b3ac9f9cabed32ea30c229b9b6e9c39cf1552e2e | 3f7028cc89a79582266a19acbde0d6b066a568de | /source/extensions/upstreams/http/http/upstream_request.h | 79932f506a041c2ec3e8bb60b3327112dfb2064f | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | envoyproxy/envoy | 882d3c7f316bf755889fb628bee514bb2f6f66f0 | 72f129d273fa32f49581db3abbaf4b62e3e3703c | refs/heads/main | 2023-08-31T09:20:01.278000 | 2023-08-31T08:58:36 | 2023-08-31T08:58:36 | 65,214,191 | 21,404 | 4,756 | Apache-2.0 | 2023-09-14T21:56:37 | 2016-08-08T15:07:24 | C++ | UTF-8 | C++ | false | false | 4,342 | h | upstream_request.h | #pragma once
#include <cstdint>
#include <memory>
#include "envoy/http/codes.h"
#include "envoy/http/conn_pool.h"
#include "envoy/upstream/thread_local_cluster.h"
#include "source/common/common/assert.h"
#include "source/common/common/logger.h"
#include "source/common/config/well_known_names.h"
#include "source/common/router/upstream_request.h"
namespace Envoy {
namespace Extensions {
namespace Upstreams {
namespace Http {
namespace Http {
class HttpConnPool : public Router::GenericConnPool, public Envoy::Http::ConnectionPool::Callbacks {
public:
HttpConnPool(Upstream::ThreadLocalCluster& thread_local_cluster,
const Router::RouteEntry& route_entry,
absl::optional<Envoy::Http::Protocol> downstream_protocol,
Upstream::LoadBalancerContext* ctx) {
pool_data_ =
thread_local_cluster.httpConnPool(route_entry.priority(), downstream_protocol, ctx);
}
~HttpConnPool() override {
ASSERT(conn_pool_stream_handle_ == nullptr, "conn_pool_stream_handle not null");
}
// GenericConnPool
void newStream(Router::GenericConnectionPoolCallbacks* callbacks) override;
bool cancelAnyPendingStream() override;
bool valid() const override { return pool_data_.has_value(); }
Upstream::HostDescriptionConstSharedPtr host() const override {
return pool_data_.value().host();
}
// Http::ConnectionPool::Callbacks
void onPoolFailure(ConnectionPool::PoolFailureReason reason,
absl::string_view transport_failure_reason,
Upstream::HostDescriptionConstSharedPtr host) override;
void onPoolReady(Envoy::Http::RequestEncoder& callbacks_encoder,
Upstream::HostDescriptionConstSharedPtr host, StreamInfo::StreamInfo& info,
absl::optional<Envoy::Http::Protocol> protocol) override;
protected:
// Points to the actual connection pool to create streams from.
absl::optional<Envoy::Upstream::HttpPoolData> pool_data_{};
Envoy::Http::ConnectionPool::Cancellable* conn_pool_stream_handle_{};
Router::GenericConnectionPoolCallbacks* callbacks_{};
};
class HttpUpstream : public Router::GenericUpstream, public Envoy::Http::StreamCallbacks {
public:
HttpUpstream(Router::UpstreamToDownstream& upstream_request, Envoy::Http::RequestEncoder* encoder)
: upstream_request_(upstream_request), request_encoder_(encoder) {
request_encoder_->getStream().addCallbacks(*this);
}
// GenericUpstream
void encodeData(Buffer::Instance& data, bool end_stream) override {
request_encoder_->encodeData(data, end_stream);
}
void encodeMetadata(const Envoy::Http::MetadataMapVector& metadata_map_vector) override {
request_encoder_->encodeMetadata(metadata_map_vector);
}
Envoy::Http::Status encodeHeaders(const Envoy::Http::RequestHeaderMap& headers,
bool end_stream) override {
return request_encoder_->encodeHeaders(headers, end_stream);
}
void encodeTrailers(const Envoy::Http::RequestTrailerMap& trailers) override {
request_encoder_->encodeTrailers(trailers);
}
void readDisable(bool disable) override { request_encoder_->getStream().readDisable(disable); }
void resetStream() override {
auto& stream = request_encoder_->getStream();
stream.removeCallbacks(*this);
stream.resetStream(Envoy::Http::StreamResetReason::LocalReset);
}
void setAccount(Buffer::BufferMemoryAccountSharedPtr account) override {
request_encoder_->getStream().setAccount(std::move(account));
}
// Http::StreamCallbacks
void onResetStream(Envoy::Http::StreamResetReason reason,
absl::string_view transport_failure_reason) override {
upstream_request_.onResetStream(reason, transport_failure_reason);
}
void onAboveWriteBufferHighWatermark() override {
upstream_request_.onAboveWriteBufferHighWatermark();
}
void onBelowWriteBufferLowWatermark() override {
upstream_request_.onBelowWriteBufferLowWatermark();
}
const StreamInfo::BytesMeterSharedPtr& bytesMeter() override {
return request_encoder_->getStream().bytesMeter();
}
private:
Router::UpstreamToDownstream& upstream_request_;
Envoy::Http::RequestEncoder* request_encoder_{};
};
} // namespace Http
} // namespace Http
} // namespace Upstreams
} // namespace Extensions
} // namespace Envoy
|
2bc6946b9b825219191f09dd4a74392dae4b4f0e | 383c417abca8aa70c4427a8679a7144a7ce26084 | /src/Ray/internal/shaders/output/prepare_indir_args.comp.cso.inl | 004811c9764b756e42d517332cdcf58fc51c61e4 | [
"MIT"
] | permissive | sergcpp/RayDemo | f3c4378e7e0af13aa594df071604756784690ddd | cba5e91afdaca34450398076918b209122ed2ae9 | refs/heads/master | 2023-08-28T02:34:04.104557 | 2023-08-27T17:30:52 | 2023-08-27T17:30:52 | 163,214,002 | 17 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 20,922 | inl | prepare_indir_args.comp.cso.inl | /* Contents of file internal/shaders/output/prepare_indir_args.comp.cso */
const int internal_shaders_output_prepare_indir_args_comp_cso_size = 3412;
const unsigned char internal_shaders_output_prepare_indir_args_comp_cso[3412] = {
0x44, 0x58, 0x42, 0x43, 0x66, 0xE8, 0x04, 0x7F, 0x8F, 0x07, 0xD6, 0x0F, 0x6A, 0xFE, 0x98, 0x63, 0x77, 0x76, 0x1F, 0xF1, 0x01, 0x00, 0x00, 0x00, 0xFC, 0x0C, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0xEC, 0x00, 0x00, 0x00, 0xF8, 0x05, 0x00, 0x00, 0x14, 0x06, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4F, 0x53, 0x47, 0x31, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x53, 0x56, 0x30, 0x78, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x54, 0x41, 0x54, 0x04, 0x05, 0x00, 0x00, 0x60, 0x00, 0x05, 0x00, 0x41, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4C,
0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xEC, 0x04, 0x00, 0x00, 0x42, 0x43, 0xC0, 0xDE, 0x21, 0x0C, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x0B, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xC8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0C, 0x25, 0x05, 0x08, 0x19, 0x1E, 0x04, 0x8B, 0x62, 0x80, 0x14, 0x45, 0x02,
0x42, 0x92, 0x0B, 0x42, 0xA4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4B, 0x0A, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xA5, 0x00, 0x19, 0x32, 0x42, 0xE4, 0x48, 0x0E, 0x90, 0x91, 0x22, 0xC4, 0x50, 0x41, 0x51, 0x81, 0x8C, 0xE1, 0x83, 0xE5, 0x8A, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1B, 0x8C, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x07,
0x40, 0x02, 0xAA, 0x0D, 0x84, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x20, 0x01, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xA4, 0x84, 0x04, 0x93, 0x22, 0xE3, 0x84, 0xA1, 0x90, 0x14, 0x12, 0x4C, 0x8A, 0x8C,
0x0B, 0x84, 0xA4, 0x4C, 0x10, 0x4C, 0x23, 0x00, 0x25, 0x00, 0x14, 0xE6, 0x08, 0x10, 0x1A, 0xF7, 0x0C, 0x97, 0x3F, 0x61, 0x0F, 0x21, 0xF9, 0x21, 0xD0, 0x0C, 0x0B, 0x81, 0x02, 0x32, 0x47, 0x00, 0x06, 0x73, 0x04, 0x41, 0x31, 0x8A, 0x19, 0xC6, 0x1C, 0x42, 0x37, 0x0D, 0x97, 0x3F, 0x61, 0x0F, 0x21, 0xF9, 0x2B, 0x21, 0xAD, 0xC4, 0xE4, 0x23, 0xB7, 0x8D, 0x0A, 0x63, 0x8C, 0x31, 0xA5, 0x50,
0xA6, 0x18, 0x43, 0xAB, 0x28, 0xC0, 0x14, 0x63, 0x8C, 0x31, 0x66, 0x50, 0x1B, 0x08, 0x38, 0x4D, 0x9A, 0x22, 0x4A, 0x98, 0xFC, 0x15, 0xDE, 0xB0, 0x89, 0xD0, 0x86, 0x21, 0x22, 0x24, 0x69, 0xA3, 0x8A, 0x82, 0x88, 0x50, 0x60, 0x08, 0xCE, 0x11, 0x80, 0x02, 0x00, 0x00, 0x13, 0x14, 0x72, 0xC0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xC0, 0x87, 0x0D, 0xAF, 0x50,
0x0E, 0x6D, 0xD0, 0x0E, 0x7A, 0x50, 0x0E, 0x6D, 0x00, 0x0F, 0x7A, 0x30, 0x07, 0x72, 0xA0, 0x07, 0x73, 0x20, 0x07, 0x6D, 0x90, 0x0E, 0x71, 0xA0, 0x07, 0x73, 0x20, 0x07, 0x6D, 0x90, 0x0E, 0x78, 0xA0, 0x07, 0x73, 0x20, 0x07, 0x6D, 0x90, 0x0E, 0x71, 0x60, 0x07, 0x7A, 0x30, 0x07, 0x72, 0xD0, 0x06, 0xE9, 0x30, 0x07, 0x72, 0xA0, 0x07, 0x73, 0x20, 0x07, 0x6D, 0x90, 0x0E, 0x76, 0x40, 0x07,
0x7A, 0x60, 0x07, 0x74, 0xD0, 0x06, 0xE6, 0x10, 0x07, 0x76, 0xA0, 0x07, 0x73, 0x20, 0x07, 0x6D, 0x60, 0x0E, 0x73, 0x20, 0x07, 0x7A, 0x30, 0x07, 0x72, 0xD0, 0x06, 0xE6, 0x60, 0x07, 0x74, 0xA0, 0x07, 0x76, 0x40, 0x07, 0x6D, 0xE0, 0x0E, 0x78, 0xA0, 0x07, 0x71, 0x60, 0x07, 0x7A, 0x30, 0x07, 0x72, 0xA0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9E, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x86, 0x3C, 0x08, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x79, 0x16, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xF2, 0x34, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x05, 0x02, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x32, 0x1E, 0x98, 0x14, 0x19, 0x11, 0x4C, 0x90, 0x8C, 0x09, 0x26, 0x47,
0xC6, 0x04, 0x43, 0x32, 0x25, 0x30, 0x02, 0x50, 0x0C, 0x65, 0x51, 0x08, 0x05, 0x55, 0x04, 0x05, 0x53, 0x0A, 0x74, 0x46, 0x00, 0x48, 0x16, 0x08, 0xC5, 0x19, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x1A, 0x03, 0x4C, 0x90, 0x46, 0x02, 0x13, 0x44, 0x8F, 0x0C, 0x6F, 0xEC, 0xED, 0x4D, 0x0C, 0x24, 0xC6, 0xE5, 0xC6, 0x45, 0x46, 0x26, 0x46, 0xC6, 0x85, 0x06, 0x06, 0x04,
0xA5, 0x0C, 0x86, 0x66, 0xC6, 0x8C, 0x26, 0x2C, 0x46, 0x26, 0x65, 0x43, 0x10, 0x4C, 0x10, 0x0C, 0x62, 0x82, 0x60, 0x14, 0x1B, 0x84, 0x81, 0xD8, 0x20, 0x10, 0x04, 0x85, 0xB1, 0xB9, 0x09, 0x82, 0x61, 0x6C, 0x18, 0x0E, 0x84, 0x98, 0x20, 0x44, 0x0F, 0x87, 0xAF, 0x18, 0x99, 0x09, 0x82, 0x71, 0x4C, 0x10, 0x8E, 0x66, 0xC3, 0x42, 0x28, 0x0B, 0x41, 0x0C, 0x4C, 0xD3, 0x34, 0x00, 0x87, 0x2F,
0x99, 0x98, 0x0D, 0xCB, 0xA0, 0x3C, 0xC4, 0x30, 0x30, 0x4D, 0xD3, 0x00, 0x1B, 0x04, 0x07, 0xDA, 0x40, 0x00, 0x11, 0x00, 0x4C, 0x10, 0x04, 0x60, 0x03, 0xB0, 0x61, 0x18, 0x28, 0x6A, 0x43, 0x50, 0x6D, 0x18, 0x86, 0xC9, 0x22, 0xD1, 0x16, 0x96, 0xE6, 0x36, 0x41, 0x90, 0x9C, 0x09, 0x82, 0x81, 0x6C, 0x18, 0x86, 0x61, 0xD8, 0x40, 0x10, 0x99, 0xB6, 0x6D, 0x28, 0x26, 0x0C, 0x90, 0x38, 0x16,
0x69, 0x6E, 0x73, 0x74, 0x73, 0x13, 0x04, 0x23, 0x21, 0x91, 0xE6, 0x46, 0x37, 0x47, 0x84, 0xAE, 0x0C, 0xEF, 0x8B, 0xED, 0x2D, 0x8C, 0x6C, 0x82, 0x60, 0x28, 0x4C, 0xE8, 0xCA, 0xF0, 0xBE, 0xE6, 0xE8, 0xDE, 0xE4, 0xCA, 0x26, 0x08, 0xC6, 0xC2, 0xA2, 0x2E, 0xCD, 0x8D, 0x6E, 0x6E, 0x82, 0x60, 0x30, 0x1B, 0x14, 0xEF, 0x03, 0x03, 0x2D, 0x0C, 0xC4, 0x60, 0x0C, 0xC8, 0xA0, 0x0C, 0xCC, 0xA0,
0x0A, 0x1B, 0x9B, 0x5D, 0x9B, 0x4B, 0x1A, 0x59, 0x99, 0x1B, 0xDD, 0x94, 0x20, 0xA8, 0x42, 0x86, 0xE7, 0x62, 0x57, 0x26, 0x37, 0x97, 0xF6, 0xE6, 0x36, 0x25, 0x20, 0x9A, 0x90, 0xE1, 0xB9, 0xD8, 0x85, 0xB1, 0xD9, 0x95, 0xC9, 0x4D, 0x09, 0x8A, 0x3A, 0x64, 0x78, 0x2E, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4D, 0x6F, 0x64, 0x65, 0x6C, 0x53, 0x02, 0xA4, 0x0C, 0x19, 0x9E, 0x8B, 0x5C, 0xD9,
0xDC, 0x5B, 0x9D, 0xDC, 0x58, 0xD9, 0xDC, 0x94, 0x20, 0xAA, 0x44, 0x86, 0xE7, 0x42, 0x97, 0x07, 0x57, 0x16, 0xE4, 0xE6, 0xF6, 0x46, 0x17, 0x46, 0x97, 0xF6, 0xE6, 0x36, 0x37, 0x25, 0xB0, 0xEA, 0x90, 0xE1, 0xB9, 0x94, 0xB9, 0xD1, 0xC9, 0xE5, 0x41, 0xBD, 0xA5, 0xB9, 0xD1, 0xCD, 0x4D, 0x09, 0xB8, 0x2E, 0x64, 0x78, 0x2E, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x65, 0x72, 0x73, 0x53, 0x02, 0x33,
0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1C, 0xC4, 0xE1, 0x1C, 0x66, 0x14, 0x01, 0x3D, 0x88, 0x43, 0x38, 0x84, 0xC3, 0x8C, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0C, 0xE6, 0x00, 0x0F, 0xED, 0x10, 0x0E, 0xF4, 0x80, 0x0E, 0x33, 0x0C, 0x42, 0x1E, 0xC2, 0xC1, 0x1D, 0xCE, 0xA1, 0x1C, 0x66, 0x30, 0x05, 0x3D, 0x88, 0x43,
0x38, 0x84, 0x83, 0x1B, 0xCC, 0x03, 0x3D, 0xC8, 0x43, 0x3D, 0x8C, 0x03, 0x3D, 0xCC, 0x78, 0x8C, 0x74, 0x70, 0x07, 0x7B, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7A, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xCC, 0x11, 0x0E, 0xEC, 0x90, 0x0E, 0xE1, 0x30, 0x0F, 0x6E, 0x30, 0x0F, 0xE3, 0xF0, 0x0E, 0xF0, 0x50, 0x0E, 0x33, 0x10, 0xC4, 0x1D, 0xDE, 0x21, 0x1C, 0xD8,
0x21, 0x1D, 0xC2, 0x61, 0x1E, 0x66, 0x30, 0x89, 0x3B, 0xBC, 0x83, 0x3B, 0xD0, 0x43, 0x39, 0xB4, 0x03, 0x3C, 0xBC, 0x83, 0x3C, 0x84, 0x03, 0x3B, 0xCC, 0xF0, 0x14, 0x76, 0x60, 0x07, 0x7B, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xF8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5F, 0x08, 0x87, 0x71,
0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2C, 0xEE, 0xF0, 0x0E, 0xEE, 0xE0, 0x0E, 0xF5, 0xC0, 0x0E, 0xEC, 0x30, 0x03, 0x62, 0xC8, 0xA1, 0x1C, 0xE4, 0xA1, 0x1C, 0xCC, 0xA1, 0x1C, 0xE4, 0xA1, 0x1C, 0xDC, 0x61, 0x1C, 0xCA, 0x21, 0x1C, 0xC4, 0x81, 0x1D, 0xCA, 0x61, 0x06, 0xD6, 0x90, 0x43, 0x39, 0xC8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xC8, 0x43, 0x39, 0xB8, 0xC3, 0x38, 0x94, 0x43,
0x38, 0x88, 0x03, 0x3B, 0x94, 0xC3, 0x2F, 0xBC, 0x83, 0x3C, 0xFC, 0x82, 0x3B, 0xD4, 0x03, 0x3B, 0xB0, 0xC3, 0x8C, 0xC8, 0x21, 0x07, 0x7C, 0x70, 0x03, 0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7B, 0x08, 0x07, 0x79, 0x60, 0x87, 0x70, 0xC8, 0x87, 0x77, 0xA8, 0x07, 0x7A, 0x00, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x26, 0x40, 0x0D, 0x97, 0xEF, 0x3C, 0x7E, 0x40,
0x15, 0x05, 0x11, 0x95, 0x0E, 0x30, 0xF8, 0xC8, 0x6D, 0xDB, 0x40, 0x35, 0x5C, 0xBE, 0xF3, 0xF8, 0x01, 0x55, 0x14, 0x44, 0xC4, 0x4E, 0x4E, 0x44, 0xF8, 0xC8, 0x6D, 0x5B, 0x80, 0x34, 0x5C, 0xBE, 0xF3, 0xF8, 0x42, 0x44, 0x00, 0x13, 0x11, 0x02, 0xCD, 0xB0, 0x10, 0x06, 0x40, 0x30, 0x00, 0xD2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xC9, 0x6D, 0x2A, 0x13, 0x05, 0x91, 0xCB, 0xA1, 0xC5, 0xA8, 0x90, 0x7B, 0xBD, 0x06, 0x42, 0x84, 0x44, 0x58, 0x49, 0x4C, 0xE0, 0x06, 0x00, 0x00, 0x60, 0x00, 0x05, 0x00, 0xB8, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4C, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xC8, 0x06, 0x00, 0x00, 0x42, 0x43, 0xC0, 0xDE, 0x21, 0x0C, 0x00, 0x00, 0xAF, 0x01, 0x00, 0x00,
0x0B, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xC8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0C, 0x25, 0x05, 0x08, 0x19, 0x1E, 0x04, 0x8B, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0B, 0x42, 0xA4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4B, 0x0A, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xA5,
0x00, 0x19, 0x32, 0x42, 0xE4, 0x48, 0x0E, 0x90, 0x91, 0x22, 0xC4, 0x50, 0x41, 0x51, 0x81, 0x8C, 0xE1, 0x83, 0xE5, 0x8A, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1B, 0x8C, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x40, 0x02, 0xAA, 0x0D, 0x84, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x20, 0x01, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x13, 0x82, 0x60, 0x42, 0x20, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xA4, 0x84, 0x04, 0x93, 0x22, 0xE3, 0x84, 0xA1, 0x90, 0x14, 0x12, 0x4C, 0x8A, 0x8C, 0x0B, 0x84, 0xA4, 0x4C, 0x10, 0x4C, 0x23, 0x00, 0x25, 0x00, 0x14, 0xE6, 0x08, 0x10, 0x1A, 0xF7, 0x0C, 0x97, 0x3F, 0x61, 0x0F, 0x21, 0xF9, 0x21,
0xD0, 0x0C, 0x0B, 0x81, 0x02, 0x32, 0x47, 0x00, 0x06, 0x73, 0x04, 0x41, 0x31, 0x8A, 0x19, 0xC6, 0x1C, 0x42, 0x37, 0x0D, 0x97, 0x3F, 0x61, 0x0F, 0x21, 0xF9, 0x2B, 0x21, 0xAD, 0xC4, 0xE4, 0x23, 0xB7, 0x8D, 0x0A, 0x63, 0x8C, 0x31, 0xA5, 0x50, 0xA6, 0x18, 0x43, 0xAB, 0x28, 0xC0, 0x14, 0x63, 0x8C, 0x31, 0x66, 0x50, 0x1B, 0x08, 0x38, 0x4D, 0x9A, 0x22, 0x4A, 0x98, 0xFC, 0x15, 0xDE, 0xB0,
0x89, 0xD0, 0x86, 0x21, 0x22, 0x24, 0x69, 0xA3, 0x8A, 0x82, 0x88, 0x50, 0x60, 0x08, 0xCE, 0x11, 0x80, 0x02, 0x00, 0x00, 0x13, 0x14, 0x72, 0xC0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xC0, 0x87, 0x0D, 0xAF, 0x50, 0x0E, 0x6D, 0xD0, 0x0E, 0x7A, 0x50, 0x0E, 0x6D, 0x00, 0x0F, 0x7A, 0x30, 0x07, 0x72, 0xA0, 0x07, 0x73, 0x20, 0x07, 0x6D, 0x90, 0x0E, 0x71, 0xA0,
0x07, 0x73, 0x20, 0x07, 0x6D, 0x90, 0x0E, 0x78, 0xA0, 0x07, 0x73, 0x20, 0x07, 0x6D, 0x90, 0x0E, 0x71, 0x60, 0x07, 0x7A, 0x30, 0x07, 0x72, 0xD0, 0x06, 0xE9, 0x30, 0x07, 0x72, 0xA0, 0x07, 0x73, 0x20, 0x07, 0x6D, 0x90, 0x0E, 0x76, 0x40, 0x07, 0x7A, 0x60, 0x07, 0x74, 0xD0, 0x06, 0xE6, 0x10, 0x07, 0x76, 0xA0, 0x07, 0x73, 0x20, 0x07, 0x6D, 0x60, 0x0E, 0x73, 0x20, 0x07, 0x7A, 0x30, 0x07,
0x72, 0xD0, 0x06, 0xE6, 0x60, 0x07, 0x74, 0xA0, 0x07, 0x76, 0x40, 0x07, 0x6D, 0xE0, 0x0E, 0x78, 0xA0, 0x07, 0x71, 0x60, 0x07, 0x7A, 0x30, 0x07, 0x72, 0xA0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3C, 0x08, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x79, 0x16, 0x20, 0x00, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xF2, 0x34, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x05, 0x02, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x32, 0x1E, 0x98, 0x10, 0x19, 0x11, 0x4C, 0x90, 0x8C, 0x09, 0x26, 0x47, 0xC6, 0x04, 0x43, 0x32, 0x25, 0x30, 0x02, 0x50, 0x0E, 0xC5, 0x50, 0x16, 0x85, 0x40, 0x67, 0x04, 0x80, 0x64, 0x81, 0x50, 0x9C, 0x01, 0x00, 0x00,
0x79, 0x18, 0x00, 0x00, 0x3A, 0x00, 0x00, 0x00, 0x1A, 0x03, 0x4C, 0x90, 0x46, 0x02, 0x13, 0x44, 0x8F, 0x0C, 0x6F, 0xEC, 0xED, 0x4D, 0x0C, 0x24, 0xC6, 0xE5, 0xC6, 0x45, 0x46, 0x26, 0x46, 0xC6, 0x85, 0x06, 0x06, 0x04, 0xA5, 0x0C, 0x86, 0x66, 0xC6, 0x8C, 0x26, 0x2C, 0x46, 0x26, 0x65, 0x43, 0x10, 0x4C, 0x10, 0x0C, 0x62, 0x82, 0x60, 0x14, 0x1B, 0x84, 0x81, 0x98, 0x20, 0x18, 0xC6, 0x06,
0x61, 0x30, 0x28, 0x8C, 0xCD, 0x4D, 0x10, 0x8C, 0x63, 0xC3, 0x80, 0x24, 0xC4, 0x04, 0x21, 0x62, 0x08, 0x4C, 0x10, 0x0C, 0x64, 0x82, 0x70, 0x28, 0x1B, 0x16, 0x62, 0x61, 0x08, 0x62, 0x68, 0x1C, 0xC7, 0x01, 0x36, 0x2C, 0xC3, 0xC2, 0x10, 0xC3, 0xD0, 0x38, 0x8E, 0x03, 0x6C, 0x10, 0x1E, 0x68, 0x03, 0x01, 0x44, 0x00, 0x30, 0x41, 0x10, 0x00, 0x12, 0x6D, 0x61, 0x69, 0x6E, 0x13, 0x04, 0x69,
0x99, 0x20, 0x18, 0xC9, 0x86, 0x61, 0x18, 0x86, 0x0D, 0x04, 0x51, 0x59, 0xD7, 0x86, 0x62, 0xA2, 0x00, 0x09, 0xAB, 0xC2, 0xC6, 0x66, 0xD7, 0xE6, 0x92, 0x46, 0x56, 0xE6, 0x46, 0x37, 0x25, 0x08, 0xAA, 0x90, 0xE1, 0xB9, 0xD8, 0x95, 0xC9, 0xCD, 0xA5, 0xBD, 0xB9, 0x4D, 0x09, 0x88, 0x26, 0x64, 0x78, 0x2E, 0x76, 0x61, 0x6C, 0x76, 0x65, 0x72, 0x53, 0x02, 0xA3, 0x0E, 0x19, 0x9E, 0xCB, 0x1C,
0x5A, 0x18, 0x59, 0x99, 0x5C, 0xD3, 0x1B, 0x59, 0x19, 0xDB, 0x94, 0x20, 0x29, 0x43, 0x86, 0xE7, 0x22, 0x57, 0x36, 0xF7, 0x56, 0x27, 0x37, 0x56, 0x36, 0x37, 0x25, 0x88, 0xEA, 0x90, 0xE1, 0xB9, 0x94, 0xB9, 0xD1, 0xC9, 0xE5, 0x41, 0xBD, 0xA5, 0xB9, 0xD1, 0xCD, 0x4D, 0x09, 0x30, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1C, 0xC4, 0xE1, 0x1C, 0x66,
0x14, 0x01, 0x3D, 0x88, 0x43, 0x38, 0x84, 0xC3, 0x8C, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0C, 0xE6, 0x00, 0x0F, 0xED, 0x10, 0x0E, 0xF4, 0x80, 0x0E, 0x33, 0x0C, 0x42, 0x1E, 0xC2, 0xC1, 0x1D, 0xCE, 0xA1, 0x1C, 0x66, 0x30, 0x05, 0x3D, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1B, 0xCC, 0x03, 0x3D, 0xC8, 0x43, 0x3D, 0x8C, 0x03, 0x3D, 0xCC, 0x78, 0x8C, 0x74, 0x70, 0x07, 0x7B,
0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7A, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xCC, 0x11, 0x0E, 0xEC, 0x90, 0x0E, 0xE1, 0x30, 0x0F, 0x6E, 0x30, 0x0F, 0xE3, 0xF0, 0x0E, 0xF0, 0x50, 0x0E, 0x33, 0x10, 0xC4, 0x1D, 0xDE, 0x21, 0x1C, 0xD8, 0x21, 0x1D, 0xC2, 0x61, 0x1E, 0x66, 0x30, 0x89, 0x3B, 0xBC, 0x83, 0x3B, 0xD0, 0x43, 0x39, 0xB4, 0x03, 0x3C, 0xBC, 0x83,
0x3C, 0x84, 0x03, 0x3B, 0xCC, 0xF0, 0x14, 0x76, 0x60, 0x07, 0x7B, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xF8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5F, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2C, 0xEE, 0xF0, 0x0E, 0xEE, 0xE0, 0x0E, 0xF5, 0xC0, 0x0E, 0xEC, 0x30,
0x03, 0x62, 0xC8, 0xA1, 0x1C, 0xE4, 0xA1, 0x1C, 0xCC, 0xA1, 0x1C, 0xE4, 0xA1, 0x1C, 0xDC, 0x61, 0x1C, 0xCA, 0x21, 0x1C, 0xC4, 0x81, 0x1D, 0xCA, 0x61, 0x06, 0xD6, 0x90, 0x43, 0x39, 0xC8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xC8, 0x43, 0x39, 0xB8, 0xC3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3B, 0x94, 0xC3, 0x2F, 0xBC, 0x83, 0x3C, 0xFC, 0x82, 0x3B, 0xD4, 0x03, 0x3B, 0xB0, 0xC3, 0x8C, 0xC8,
0x21, 0x07, 0x7C, 0x70, 0x03, 0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7B, 0x08, 0x07, 0x79, 0x60, 0x87, 0x70, 0xC8, 0x87, 0x77, 0xA8, 0x07, 0x7A, 0x00, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x26, 0x40, 0x0D, 0x97, 0xEF, 0x3C, 0x7E, 0x40, 0x15, 0x05, 0x11, 0x95, 0x0E, 0x30, 0xF8, 0xC8, 0x6D, 0xDB, 0x40, 0x35, 0x5C, 0xBE, 0xF3, 0xF8, 0x01, 0x55, 0x14, 0x44,
0xC4, 0x4E, 0x4E, 0x44, 0xF8, 0xC8, 0x6D, 0x5B, 0x80, 0x34, 0x5C, 0xBE, 0xF3, 0xF8, 0x42, 0x44, 0x00, 0x13, 0x11, 0x02, 0xCD, 0xB0, 0x10, 0x06, 0x40, 0x30, 0x00, 0xD2, 0x00, 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2C, 0x10, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x34, 0x4A, 0x80, 0xCC, 0x0C, 0x40, 0x29, 0x06, 0x14, 0x62, 0x40, 0x41,
0x94, 0x5C, 0xF9, 0x15, 0x46, 0x81, 0x14, 0x4A, 0xF9, 0x1F, 0x94, 0x44, 0x81, 0x15, 0x5A, 0xC1, 0x15, 0x5E, 0x01, 0x06, 0x14, 0x4C, 0xE1, 0x14, 0x50, 0x21, 0x15, 0x54, 0x61, 0x01, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0x8C, 0x81, 0x74, 0x81, 0x01, 0x18, 0x68, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0x90, 0xC1, 0x84, 0x81, 0x01, 0x18, 0x6C, 0x23, 0x06, 0x08, 0x00,
0x82, 0x60, 0xB0, 0x90, 0x81, 0x15, 0x84, 0x01, 0x36, 0x9A, 0x10, 0x00, 0x15, 0x54, 0x50, 0x81, 0x18, 0xE0, 0x88, 0x41, 0x03, 0x80, 0x20, 0x18, 0x34, 0x67, 0xB0, 0x19, 0x65, 0xC0, 0x05, 0x1C, 0xC7, 0x75, 0x23, 0x06, 0x0D, 0x00, 0x82, 0x60, 0xD0, 0x9C, 0xC1, 0x66, 0x84, 0x01, 0x67, 0x06, 0x1C, 0xC7, 0x75, 0x23, 0x06, 0x0D, 0x00, 0x82, 0x60, 0xD0, 0x9C, 0xC1, 0x66, 0x64, 0x9C, 0x19,
0x70, 0x1C, 0xD7, 0x8D, 0x18, 0x34, 0x00, 0x08, 0x82, 0x41, 0x73, 0x06, 0x9B, 0x61, 0x71, 0x03, 0xC7, 0x71, 0xDD, 0x88, 0x41, 0x03, 0x80, 0x20, 0x18, 0x34, 0x67, 0xB0, 0x19, 0x15, 0x67, 0x06, 0x1C, 0xC7, 0x75, 0x23, 0x06, 0x0D, 0x00, 0x82, 0x60, 0xD0, 0x9C, 0xC1, 0x66, 0x50, 0x9C, 0x19, 0x70, 0x1C, 0xD7, 0xD5, 0x30, 0x41, 0x05, 0x13, 0x8E, 0x18, 0x34, 0x00, 0x08, 0x82, 0x41, 0x93,
0x06, 0xDD, 0x71, 0x79, 0x85, 0xE7, 0x79, 0xDF, 0x88, 0x41, 0x03, 0x80, 0x20, 0x18, 0x34, 0x69, 0xD0, 0x21, 0x93, 0x17, 0x78, 0x9E, 0xF7, 0x8D, 0x18, 0x34, 0x00, 0x08, 0x82, 0x41, 0x93, 0x06, 0x1D, 0x22, 0x79, 0x68, 0xE0, 0x79, 0xDE, 0x37, 0x62, 0xD0, 0x00, 0x20, 0x08, 0x06, 0x4D, 0x1A, 0x74, 0x48, 0xE4, 0xA1, 0x81, 0xE7, 0x79, 0xDF, 0x88, 0x41, 0x03, 0x80, 0x20, 0x18, 0x34, 0x69,
0xD0, 0x1D, 0x96, 0x17, 0x78, 0x9E, 0xF7, 0x59, 0x50, 0xC1, 0xA0, 0x82, 0x0A, 0x2D, 0x28, 0x83, 0x1B, 0x8C, 0x18, 0x34, 0x00, 0x08, 0x82, 0x41, 0xC3, 0x06, 0x60, 0xB0, 0x4C, 0x61, 0x10, 0x84, 0x41, 0x18, 0x84, 0x81, 0x18, 0x8C, 0x18, 0x34, 0x00, 0x08, 0x82, 0x41, 0xC3, 0x06, 0x60, 0xB0, 0x48, 0x61, 0xB0, 0x06, 0x61, 0x10, 0x06, 0x61, 0x20, 0x06, 0x23, 0x06, 0x0D, 0x00, 0x82, 0x60,
0xD0, 0xB0, 0x01, 0x18, 0x2C, 0x5F, 0x18, 0xAC, 0x41, 0x18, 0x84, 0x41, 0x18, 0x88, 0xC1, 0x88, 0x41, 0x03, 0x80, 0x20, 0x18, 0x34, 0x6C, 0x00, 0x06, 0x8A, 0x1A, 0x84, 0x81, 0x1A, 0x84, 0x41, 0x18, 0x84, 0x81, 0x18, 0x8C, 0x18, 0x34, 0x00, 0x08, 0x82, 0x41, 0xC3, 0x06, 0x60, 0xA0, 0x98, 0x41, 0x18, 0x20, 0x61, 0x10, 0x06, 0x61, 0x20, 0x06, 0x23, 0x06, 0x08, 0x00, 0x82, 0x60, 0xB0,
0xB4, 0xC1, 0xA7, 0x78, 0x61, 0x30, 0x9A, 0x10, 0x00, 0x15, 0x78, 0x50, 0xC1, 0x1A, 0xE0, 0x88, 0x41, 0x03, 0x80, 0x20, 0x18, 0x34, 0x70, 0x40, 0x06, 0x4F, 0x55, 0x06, 0x41, 0x19, 0x94, 0x41, 0x19, 0x98, 0xC1, 0x88, 0x41, 0x03, 0x80, 0x20, 0x18, 0x34, 0x70, 0x40, 0x06, 0x0F, 0x55, 0x06, 0x6F, 0x50, 0x06, 0x65, 0x50, 0x06, 0x66, 0x30, 0x62, 0xD0, 0x00, 0x20, 0x08, 0x06, 0x0D, 0x1C,
0x90, 0xC1, 0x33, 0x95, 0xC1, 0x1B, 0x94, 0x41, 0x19, 0x94, 0x81, 0x19, 0x8C, 0x18, 0x34, 0x00, 0x08, 0x82, 0x41, 0x03, 0x07, 0x64, 0xF0, 0x48, 0x65, 0x30, 0x94, 0x41, 0x19, 0x94, 0x81, 0x19, 0x8C, 0x18, 0x34, 0x00, 0x08, 0x82, 0x41, 0x03, 0x07, 0x64, 0xF0, 0x44, 0x65, 0xF0, 0x06, 0x65, 0x50, 0x06, 0x65, 0x60, 0x06, 0x23, 0x06, 0x0D, 0x00, 0x82, 0x60, 0xD0, 0xC0, 0x01, 0x19, 0x3C,
0x50, 0x19, 0xBC, 0x41, 0x19, 0x94, 0x41, 0x19, 0x98, 0xC1, 0x88, 0x41, 0x03, 0x80, 0x20, 0x18, 0x34, 0x70, 0x40, 0x06, 0x8E, 0x18, 0x94, 0x81, 0x1B, 0x94, 0x41, 0x19, 0x94, 0x81, 0x19, 0x8C, 0x18, 0x34, 0x00, 0x08, 0x82, 0x41, 0x03, 0x07, 0x64, 0xE0, 0x7C, 0x65, 0x30, 0x94, 0x41, 0x19, 0x94, 0x81, 0x19, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x5F, 0x31, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5F, 0x32, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
};
|
fa6f4091076b8b1c74d095a4c9c26b0b1d3f71eb | fbcbaaaed3e5dde05f2a352557319ddef5f40987 | /server/src/network_server.cpp | 34ab2651657b0bfaf37f62854fb2298c35351b3a | [] | no_license | fredrikluo/test-image-server | 2d7cc7774c21fa4ba77f5cbe8cf184ed5a78f690 | a42793bb5a289e2406a943b86f21d167c0ba5c1e | refs/heads/master | 2021-01-18T21:46:49.663421 | 2017-04-03T01:03:10 | 2017-04-03T01:04:21 | 87,022,828 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 197 | cpp | network_server.cpp | #include "network_server.h"
#include "tcp_server.h"
network_server *network_server::get_tcp_server(
network_server_listener *listener, short port) {
return new tcp_server(port, listener);
}
|
22652583f12d8179574703abb2b62de6003304e7 | d1dc50f8b94d61d618b3803c048347fb94715335 | /C++/sort_numbers_ based_on_even_first_and_odd_next.cpp | 4abdb06159879696130d280d9588598c459a7898 | [] | no_license | wafarifki/Hacktoberfest2021 | 5360e7f57d45e2bec2e0626fb8d49d1e511fb57b | 6c062feb71fb0d6225af64ed6b6df83f7924432d | refs/heads/main | 2023-08-23T20:04:52.179436 | 2021-10-01T06:58:30 | 2021-10-01T06:58:30 | 412,358,558 | 3 | 1 | null | 2021-10-01T06:44:27 | 2021-10-01T06:44:26 | null | UTF-8 | C++ | false | false | 408 | cpp | sort_numbers_ based_on_even_first_and_odd_next.cpp | #include<bits/stdc++.h>
using namespace std;
int sortEvenOdd(int arr[],int n){
int even = 0;
for(int i=0;i<n;i++){
if(arr[i]%2 == 0){
swap(arr[i],arr[even]);
even++;
}
}
for(int i=0;i<n;i++){
cout<<arr[i];
}
}
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
sortEvenOdd(arr,n);
}
|
36d6310fa4093431d05b0d27e951b5412c98acc1 | 64cc1cd2bfbae27fbaee72558b94a1efd048809d | /SendFilesClientThread.h | 2e69e94954a95ac80cde7c9fe1600e2c50a14d93 | [] | no_license | FrankGuo22/Instantmessaging | 86924915a8b67c430df162d29bbb5ed7c5cd7b3e | d1e7ff217e2149ab39c53ca416f8d034a70f7aa5 | refs/heads/master | 2021-01-10T17:16:24.342217 | 2016-01-20T17:51:53 | 2016-01-20T17:51:53 | 50,048,461 | 2 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,568 | h | SendFilesClientThread.h | #if !defined(AFX_SENDFILESCLIENTTHREAD_H__B50835DE_3B5E_4D21_B116_E482C7130E1D__INCLUDED_)
#define AFX_SENDFILESCLIENTTHREAD_H__B50835DE_3B5E_4D21_B116_E482C7130E1D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SendFilesClientThread.h : header file
//
#include "ReceiveFilesSocket.h"
#include "SendFilesClientDlg.h"
/////////////////////////////////////////////////////////////////////////////
// CSendFilesClientThread thread
class CSendFilesClientThread : public CWinThread
{
DECLARE_DYNCREATE(CSendFilesClientThread)
protected:
CSendFilesClientThread(); // protected constructor used by dynamic creation
// Attributes
private:
CReceiveFilesSocket m_receiveFilesSocket; /// 与此线程相关的socket
CSendFilesClientDlg *m_pDlgSendFilesClient; /// 接收文件对话框指针
DWORD m_dwLength; /// 要传输文件的总长度
DWORD m_dwReceived; /// 已经接收的长度
CString m_strSourcePath; /// 传输文件的源路径
char m_szSoureceIP[ 16 ]; /// 传输文件的源IP
CString m_strDesPath; /// 保存的路径
CString m_strConfig; /// 配置文件的路径
BOOL m_bRun; /// 程序持续运行的标记
CFile m_fileSave; /// 保存的文件类
CFile m_fileCfg; /// 配置的文件类
DWORD m_dwReceiveCount; /// 在timer内接收的长度
BOOL m_bStop; /// 是否停止接收文件
// Operations
public:
/// 附加套接字
void AttachSocket( SOCKET hSocket );
/// 接收网络数据
void OnReceive();
/// 接收文件对话框指针
void SetSendFilesClientDlg( CSendFilesClientDlg *pDlgSendFilesClient )
{
m_pDlgSendFilesClient = pDlgSendFilesClient;
}
/// 设置
void SetInfo( CString strSourcePath, CString strDesPath, DWORD dwLength, LPCSTR szSourceIP )
{
m_strSourcePath = strSourcePath;
m_strDesPath = strDesPath;
m_strConfig = m_strDesPath.Left( m_strDesPath.ReverseFind( '\\' ) + 1 )
+ m_strDesPath.Right( m_strDesPath.GetLength() - 1 - m_strDesPath.ReverseFind( '\\' ) )
+ "." + SENDFILES_CONFIG_SUB;
m_dwLength = dwLength;
m_dwReceived = 0;
memcpy( m_szSoureceIP, szSourceIP, 16 );
}
/// 发送请求文件的消息
void SendReceiveMessage( DWORD dwReceived );
/// 接收数据
void ReceiveData( LPCSTR szReceive );
/// 删除接收线程
void StopReceive();
/// 关闭连接
void OnClose();
CString GetSourceFilePath(){ return m_strSourcePath; }
CString GetDesFilePath(){ return m_strDesPath; }
LPCSTR GetIP(){ return m_szSoureceIP; }
DWORD GetLength(){ return m_dwLength; }
DWORD GetReceived(){ return m_dwReceived; }
BOOL GetStop(){ return m_bStop ; }
DWORD GetReceiveCount(){ DWORD dwReceiveCount = m_dwReceiveCount; m_dwReceiveCount = 0; return dwReceiveCount; }
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSendFilesClientThread)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CSendFilesClientThread();
// Generated message map functions
//{{AFX_MSG(CSendFilesClientThread)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SENDFILESCLIENTTHREAD_H__B50835DE_3B5E_4D21_B116_E482C7130E1D__INCLUDED_)
|
5a2cfbef638937d471b545a33a52d9410aaa6927 | fb17b4cb741d9ab81ec9cc9d4a8c70ad2700e203 | /mapbuilder/himmbuilder.cxx | 3497cdbcae03a662520980cb883da700e4e3dba3 | [] | no_license | silei862/robotic | 34273caec1c94cead3c1dcc44518925f956e2126 | 0b92de89848a6830a522ebf0b595db6b34c3604b | refs/heads/master | 2020-05-17T06:06:12.746432 | 2013-03-18T07:33:31 | 2013-03-18T07:33:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,023 | cxx | himmbuilder.cxx | /*
* =====================================================================================
*
* Filename: himmbuilder.cxx
*
* Description: Histogramic in-motion mapping实现
*
* Version: 1.0
* Created: 2012年11月19日 22时14分09秒
* Revision: none
* Compiler: gcc
*
* Author: 思磊 (Silei), silei862@gmail.com
* Organization: TSA@PLA
*
* =====================================================================================
*/
#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <exception.h>
#include <debug.h>
#include "himmbuilder.h"
using namespace SlamLab;
const double HIMMBuilder::tpl_val[TPL_NUM]={ 0.5, 0.5, 0.5, \
0.5, 1.0, 0.5, \
0.5, 0.5, 0.5 };
const double HIMMBuilder::max_reading = 5.0;
const double HIMMBuilder::min_reading = 0.0;
HIMMBuilder::HIMMBuilder( uint8_t inc ,
uint8_t dec ,
uint8_t max )
:_tpl(DEF_TPLSIZE,DEF_TPLSIZE),
_inc(inc),_dec(dec),_max(max),
p_pos2d( NULL ),
p_ranger( NULL ),
p_map( NULL )
{
// 初始化模板数据
for( uint32_t y=0;y<DEF_TPLSIZE;y++ )
for( uint32_t x=0;x<DEF_TPLSIZE;x++ )
_tpl[y][x] = tpl_val[y*DEF_TPLSIZE+x];
}
void HIMMBuilder::build()
{
ASSERT( p_pos2d && p_ranger && p_map );
// 获取机器人中心坐标
double robot_x = p_pos2d->get_x_pos();
double robot_y = p_pos2d->get_y_pos();
double robot_yaw = p_pos2d->get_yaw();
// 依次计算各个数据
for( size_t i = 0 ; i< p_ranger->ranger_num(); i++ )
{
// 获取传感器数据
double rg_reading = (*p_ranger)[i];
// 获取传感器安装姿态,作为修正
Pose3D& ranger_pose = p_ranger->get_pose( i );
Point3D<double> rg_pos = ranger_pose._pos;
// 计算传感器全局坐标:
double rg_x = robot_x + rg_pos._x*cos( robot_yaw ) - rg_pos._y*sin( robot_yaw );
double rg_y = robot_y + rg_pos._x*sin( robot_yaw ) + rg_pos._y*cos( robot_yaw );
//计算障碍点的坐标:
double ob_x = rg_x + rg_reading*cos( ranger_pose._rz + robot_yaw );
double ob_y = rg_y + rg_reading*sin( ranger_pose._rz + robot_yaw );
// 更新地图,只有在传感器读数处于范围内方才进行增量计算:
if( rg_reading < max_reading )
cell_inc( ob_x , ob_y );
cell_dec( robot_x , robot_y , ob_x , ob_y );
}
}
HIMMGrid& HIMMBuilder::operator>>( HIMMGrid& r_hg )
{
attach_map( r_hg );
build();
return r_hg;
}
void HIMMBuilder::cell_inc( double x , double y )
{
if( !p_map->in( x ,y ) )
return ;
int cell_val = int((*p_map)( x, y));
// 生成模板坐标索引:
for( int p = -1 ; p <=1 ; p++ )
for( int q = -1 ; q <=1 ; q++ )
{
double cx = x + p_map->cell_size()*double(q);
double cy = y + p_map->cell_size()*double(p);
if( p_map->in( cx ,cy ) )
{
uint8_t nc_val = (*p_map)(cx,cy);
cell_val+=int(double(nc_val)*_tpl[p+1][q+1]);
}
}
cell_val+=_inc;
// 限制上限值:
if( cell_val > _max )
cell_val = _max;
// 回写:
(*p_map)(x,y) = uint8_t(cell_val);
}
void HIMMBuilder::cell_dec( double x0,double y0,double x1,double y1 )
{
double delta_x = x1 - x0 ;
double delta_y = y1 - y0 ;
double abs_dx = fabs( delta_x );
double abs_dy = fabs( delta_y );
double cell_size = p_map->cell_size();
double inc_x = cell_size;
double inc_y = cell_size;
int inc_num;
if( abs_dx < cell_size && abs_dy < cell_size )
return;
if( abs_dx > abs_dy )
{
inc_y *= delta_y/abs_dx;
inc_x *= delta_x/abs_dx;
inc_num = abs_dx/cell_size;
}
else
{
inc_x *= delta_x/abs_dy;
inc_y *= delta_y/abs_dy;
inc_num = abs_dy/cell_size;
}
double bx = x0;
double by = y0;
for( int i = 0; i<inc_num; i++)
{
bx +=inc_x;
by +=inc_y;
if( !p_map->in( bx,by ) )
continue;
int cell_val =int((*p_map)( bx , by ));
cell_val -=_dec;
if( cell_val < 0 )
cell_val =0;
(*p_map)( bx , by ) = cell_val;
}
}
SlamLab::HIMMBuilder& SlamLab::operator>>( SlamLab::RangerBridge& r_rb , SlamLab::HIMMBuilder& r_builder )
{
r_builder.attach_ranger( r_rb );
return r_builder;
}
|
bd5bb02524b3afc6cbc400cff5c8a44089b225d7 | 011006ca59cfe75fb3dd84a50b6c0ef6427a7dc3 | /codeforces/practice/B_Dima_and_To_do_List.cpp | 55acd10ebe5caefb0b2fa0f029fa9b7b7457e05f | [] | no_license | ay2306/Competitive-Programming | 34f35367de2e8623da0006135cf21ba6aec34049 | 8cc9d953b09212ab32b513acf874dba4fa1d2848 | refs/heads/master | 2021-06-26T16:46:28.179504 | 2021-01-24T15:32:57 | 2021-01-24T15:32:57 | 205,185,905 | 5 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 281 | cpp | B_Dima_and_To_do_List.cpp | #include<bits/stdc++.h>
using namespace std;
int s[100100];
int main(){
int n,a,k,mni=0;
cin >> n >> k;
for(int i = 0; i < n; ++i){
cin >> a;
s[i%k]+=a;
}
for(int i = 1; i < k; ++i)
if(s[i] < s[mni])mni=i;
return cout << mni+1 , 0;
} |
7a56ab8179017874f1889a6cbb5688802ca1c9b8 | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /components/payments/content/payment_credential_factory.h | 70dad0dadb570bec6c118de3c4816a1b33c7a0e6 | [
"BSD-3-Clause"
] | permissive | chromium/chromium | aaa9eda10115b50b0616d2f1aed5ef35d1d779d6 | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | refs/heads/main | 2023-08-24T00:35:12.585945 | 2023-08-23T22:01:11 | 2023-08-23T22:01:11 | 120,360,765 | 17,408 | 7,102 | BSD-3-Clause | 2023-09-10T23:44:27 | 2018-02-05T20:55:32 | null | UTF-8 | C++ | false | false | 804 | h | payment_credential_factory.h | // Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_CREDENTIAL_FACTORY_H_
#define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_CREDENTIAL_FACTORY_H_
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "third_party/blink/public/mojom/payments/payment_credential.mojom-forward.h"
namespace content {
class RenderFrameHost;
}
namespace payments {
// Connect a PaymentCredential receiver to handle payment credential creation.
void CreatePaymentCredential(
content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<mojom::PaymentCredential> receiver);
} // namespace payments
#endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_CREDENTIAL_FACTORY_H_
|
2b66e666b18f7af924fd7954fcac9fe764a396c2 | 89d71656f1ba411c081f7e26258b498b7f10aaa2 | /GreedyMethod/SegmentProblem.cpp | 39b0901f03ce063e9e6011ab0d2a9eea16db770d | [] | no_license | noblesseoblige6/Algorithms | 4b06d01b7ca015c5b2b28398ae3142f10a281048 | ae8d1085009e0cd98e805795b4cc31a4e2e161ac | refs/heads/master | 2023-08-29T09:22:47.419651 | 2023-08-02T06:50:05 | 2023-08-02T06:50:05 | 51,254,943 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 979 | cpp | SegmentProblem.cpp | #include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
namespace algorithm::greedy
{
int Solve(std::vector<std::pair<int, int> >& segments)
{
std::sort(segments.begin(), segments.end());
int res = 0;
int t = 0;
for (const auto &seg : segments)
{
if (t < seg.second)
{
++res;
t = seg.first;
}
}
return res;
}
}
int main()
{
int n = 0;
std::cin >> n;
std::vector<int> starts(n);
std::vector<int> ends(n);
for (int i = 0; i < n; ++i)
{
std::cin >> starts.at(i);
}
for (int i = 0; i < n; ++i)
{
std::cin >> ends.at(i);
}
std::vector<std::pair<int, int> > segments;
for (int i = 0; i < n; ++i)
{
segments.push_back(std::make_pair(ends[i], starts[i]));
}
std::cout << algorithm::greedy::Solve(segments) << std::endl;
return 0;
} |
0678ea11bb1b30a6e33217cb36886392b62a0fd5 | 74f18dac7e14c50b921851eff47a8471c7acc9ec | /src/read_pdb.cpp | a78c6837337cf1f0fc75c37bedd267667e0cb538 | [
"MIT"
] | permissive | qj-Huang/AlloType | 6bae74a457f0bbf568b3fe7ac00664f0936d084a | 7b854d17c0646256e2ab4235052c57f391141812 | refs/heads/main | 2023-04-11T09:03:59.590417 | 2021-04-19T06:37:49 | 2021-04-19T06:37:49 | 357,469,291 | 7 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 1,372 | cpp | read_pdb.cpp | #include "read_pdb.h"
string sslice(size_t begin, size_t end, string in)
{
string out = in.substr(begin, end - begin);
trim(out);
return out;
}
size_t read_resid(string line)
{
return lexical_cast<size_t>(sslice(22, 26, line));
}
string read_record(string line)
{
return sslice(0, 6, line);
}
string read_resname(string line)
{
return sslice(17, 20, line);
}
string read_chain(string line)
{
return sslice(21, 22, line);
}
string read_atomname(string line)
{
return sslice(12, 16, line);
}
ResInfo read_res(string line)
{
ResInfo res;
res.resname = sslice(17, 20, line);
res.chain = sslice(21, 22, line);
res.resid = lexical_cast<size_t>(sslice(22, 26, line));
res.x = lexical_cast<double>(sslice(30, 38, line));
res.y = lexical_cast<double>(sslice(38, 46, line));
res.z = lexical_cast<double>(sslice(46, 54, line));
res.bfactor = lexical_cast<double>(sslice(60, 66, line));
return res;
}
AtomInfo read_atom(string line)
{
AtomInfo atom;
atom.atomname = sslice(12, 16, line);
atom.resname = sslice(17, 20, line);
atom.chain = sslice(21, 22, line);
atom.resid = lexical_cast<size_t>(sslice(22, 26, line));
atom.x = lexical_cast<double>(sslice(30, 38, line));
atom.y = lexical_cast<double>(sslice(38, 46, line));
atom.z = lexical_cast<double>(sslice(46, 54, line));
atom.bfactor = lexical_cast<double>(sslice(60, 66, line));
return atom;
} |
6a599643f911808beb3234eaed0120b5c0603bdf | 635a31fb5f4fed8f1f630f6f6620e55ce4ae03e6 | /CODEJAM/Practice/seg.cpp | dd7ff1423dd26e9e580b1c47e4ecfc29d6fc6101 | [] | no_license | iCodeIN/Problem-Solving | 82cd4eef0e4606baf31d8de34135dd5366d19a1e | 92f13c2cab5dfe914755dae7790c9cf8c6fb8782 | refs/heads/master | 2022-11-27T16:49:30.319955 | 2020-08-08T08:47:24 | 2020-08-08T08:47:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,915 | cpp | seg.cpp | #include<bits/stdc++.h>
#include<vector>
//#include"header.h"
using namespace std;
typedef struct start_pt
{
int x_c;
int y_c;
int e;
}Point;
int DIRECTION(Point P1,Point P2,Point P3)
{
return((P3.x_c-P1.x_c)*(P2.y_c-P1.y_c)-(P2.x_c-P1.x_c)*(P3.y_c-P1.y_c));
//return (P3-P1)*(P2-P1) vector product returns
}
int min(int a , int b)
{
if(a<b)
return a;
else
return b;
}
int max(int a, int b)
{
if(a>b)
return a;
else return b;
}
bool ON_SEGMENT(Point P1,Point P2,Point P3)
{
if(min(P1.x_c,P2.x_c)<=P3.x_c && max(P1.x_c,P2.x_c)>=P3.x_c && min(P1.y_c,P2.y_c)<=P3.y_c && max(P1.y_c,P2.y_c)>=P3.y_c)
return true;
else
false;
}
char* minDistance(int input1[])
{
//Write code here
}
int main()
{
// int input1[8]={5,6,46,6,10,6,34,6};
vector<Point> Seg(2*4);
int i,j;
for(i=0,j=0;i<4,j<8;i+=2,j+=4)
{
Seg[i].x_c=input1[j];
Seg[i].y_c=input1[j+1];
Seg[i].e=0;
Seg[i+1].x_c =input1[j+2];
Seg[i+1].y_c=input1[j+3];
Seg[i+1].e=1;
}
int d1,d2,d3,d4,num_seg=0;
d1=DIRECTION(Seg[2],Seg[3],Seg[0]);
d2=DIRECTION(Seg[2],Seg[3],Seg[1]);
d3=DIRECTION(Seg[0],Seg[1],Seg[2]);
d4=DIRECTION(Seg[0],Seg[1],Seg[3]);
if(((d1>0 && d2<0)||(d1<0 && d2>0))&&((d3>0 && d4<0)||(d3<0 && d4>0)))
{
cout<<num_seg+1<<"th segment cuts with "<<j/2+1<<"th segment\n";
return "INTERSECT";
}
else if(d1==0 && ON_SEGMENT(Seg[2],Seg[3],Seg[0]))
{
cout<<num_seg+1<<"th segment over with "<<j/2+1<<"th segment\n";
return "OVERLAP";
}
else if(d2==0 && ON_SEGMENT(Seg[2],Seg[3],Seg[1]))
{
cout<<num_seg+1<<"th segment over with "<<j/2+1<<"th segment\n";
return "OVERLAP";
}
else if(d3==0 && ON_SEGMENT(Seg[0],Seg[1],Seg[2]))
{
cout<<num_seg+1<<"th segment over with "<<j/2+1<<"th segment\n";
return "OVERLAP";
}
else if(d4==0 && ON_SEGMENT(Seg[0],Seg[1],Seg[3]))
{
cout<<num_seg+1<<"th segment over with "<<j/2+1<<"th segment\n";
return "OVERLAP";
}
else
{
cout<<num_seg+1<<"th segment does not cut with "<<j/2+1<<"th segment\n";
return "NO";
}
// cout<<Seg[5].x_c<<"\t"<<Seg[5].y_c<<"\n";
}
|
bdc56575091042cb3d65ca6ef0a2c9233bd60a34 | 3542c2c2c189878b796b3258bed58a6cbe62b716 | /tp2/InputPin.cpp | c4e8f92fe7723588e70d4d895c58ca2584dcfcfc | [] | no_license | progdev8201/pi-4-electronics-buttons-password-project | f1c0d717e316f9fb97ec2861bae7b5e2cfcad096 | 457d76932af073588d54dc9b2f91366b91d60054 | refs/heads/main | 2023-01-30T05:49:17.082385 | 2020-12-15T00:55:35 | 2020-12-15T00:55:35 | 321,512,867 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,005 | cpp | InputPin.cpp | #include "InputPin.hpp"
#include <wiringPi.h>
#include <iostream>
InputPin::InputPin(const size_t pinNumber) : _pinNumber{pinNumber}
{
pinMode(_pinNumber, INPUT);
}
int InputPin::debouncedRead()
{
bool isStable = false;
int readVal;
while (!isStable)
{
readVal = digitalRead(_pinNumber);
delay(DEBOUNCED_DELAY);
if (readVal == digitalRead(_pinNumber))
isStable = true;
}
return readVal;
}
int InputPin::checkSignal()
{
// make sure that user has released button since last click
// if his finger is still on the button set signal state to false
const bool clicked{debouncedRead() == HIGH};
if (clicked && _inputCallback.released())
{
_inputCallback(true);
_inputCallback.setReleased(false);
}
else if (clicked)
_inputCallback(false);
if (!clicked)
{
_inputCallback(false);
_inputCallback.setReleased(true);
}
return _inputCallback.signalState();
} |
349c0c9006f7c640732f3fa908da7a67196c4288 | c6551fc92088db6d2a8481fd974994f1880ec198 | /common/win/com_verify.h | 5d11e67004da4623d04178b9f1fa9220b8df36c1 | [] | no_license | eval1749/evita | dd2c40180b32fada64dce4aad1f597a6beeade8a | 4e9dd86009af091e213a208270ef9bd429fbb698 | refs/heads/master | 2022-10-16T23:10:07.605527 | 2022-10-04T07:35:37 | 2022-10-04T07:35:37 | 23,464,799 | 3 | 3 | null | 2015-09-19T20:33:38 | 2014-08-29T13:27:24 | C++ | UTF-8 | C++ | false | false | 1,213 | h | com_verify.h | // Copyright (c) 2015 Project Vogue. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMMON_WIN_COM_VERIFY_H_
#define COMMON_WIN_COM_VERIFY_H_
#include "base/logging.h"
namespace win {
#define COM_VERIFY_LOG(expr) \
{ DVLOG(ERROR) << "hr=" << std::hex << macro_hr << ' ' << #expr; }
#if defined(_DEBUG)
#define COM_VERIFY(expr) \
{ \
const auto macro_hr = (expr); \
if (FAILED(macro_hr)) { \
COM_VERIFY_LOG(expr); \
NOTREACHED(); \
} \
}
#else
#define COM_VERIFY(expr) \
{ \
const auto macro_hr = (expr); \
if (FAILED(macro_hr)) { \
COM_VERIFY_LOG(expr); \
} \
}
#endif
#define COM_VERIFY2(expr, ret_expr) \
{ \
const auto macro_hr = (expr); \
if (FAILED(macro_hr)) { \
COM_VERIFY_LOG(expr); \
return (ret_expr); \
} \
}
} // namespace win
#endif // COMMON_WIN_COM_VERIFY_H_
|
d62f226c8d82d3e466644be4e90cbbd490b135cb | 9e71afd5bef444741bef62e5dc62245095c171c6 | /Sources/GameEngine/Renderers/Objects/Water/WaterReflectionRefractionRenderer.h | fb4679fcae563cde88c5e5da5424f263b32708a5 | [] | no_license | wbach/OpenGL_Engine | f243f5e5c854278660d077593f764f18bb7949c1 | b88cf1da8d57b4737544e6acdf4a5e1bfbbf4613 | refs/heads/master | 2023-02-23T08:40:26.120920 | 2023-02-18T16:48:24 | 2023-02-18T16:48:24 | 91,100,184 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,889 | h | WaterReflectionRefractionRenderer.h | #pragma once
#include <GraphicsApi/IGraphicsApi.h>
#include "GameEngine/Engine/Configuration.h"
#include "GameEngine/Renderers/IRenderer.h"
#include "GameEngine/Renderers/Objects/Entity/EntityRenderer.h"
#include "GameEngine/Renderers/Objects/SkyBox/SkyBoxRenderer.h"
#include "GameEngine/Renderers/Objects/Terrain/Mesh/TerrainMeshRenderer.h"
#include "GameEngine/Renderers/RendererContext.h"
#include "GameEngine/Resources/ShaderBuffers/ShadowsBuffer.h"
#include "GameEngine/Scene/Scene.hpp"
#include "GameEngine/Shaders/ShaderProgram.h"
#include <set>
namespace GameEngine
{
class Mesh;
class CameraWrapper;
struct Material;
class Projection;
class ShadowFrameBuffer;
class ModelWrapper;
struct Time;
namespace Components
{
class Animator;
class RendererComponent;
} // namespace Components
class WaterReflectionRefractionRenderer : public IRenderer
{
public:
struct WaterTextures
{
GraphicsApi::ID waterReflectionTextureId;
GraphicsApi::ID waterRefractionTextureId;
GraphicsApi::ID waterRefractionDepthTextureId;
};
struct WaterFbo
{
float positionY;
GraphicsApi::IFrameBuffer* reflectionFrameBuffer_;
GraphicsApi::IFrameBuffer* refractionFrameBuffer_;
WaterTextures waterTextures_;
std::set<uint32> usingByObjects;
};
struct Subscriber
{
GameObject& gameObject;
WaterTextures* waterTextures_{nullptr};
std::optional<float> waterFboPositionY;
};
WaterReflectionRefractionRenderer(RendererContext&);
~WaterReflectionRefractionRenderer();
void init() override;
void prepare() override;
void subscribe(GameObject&) override;
void unSubscribe(GameObject&) override;
void unSubscribeAll() override;
void reloadShaders() override;
WaterReflectionRefractionRenderer::WaterTextures* GetWaterTextures(uint32) const;
private:
GraphicsApi::IFrameBuffer* createWaterFbo(const vec2ui&);
void initResources();
void cleanUp();
void renderScene();
void createRefractionTexture(WaterFbo&);
void createReflectionTexture(WaterFbo&);
void cleanNotUsedFbos();
WaterFbo* getFbo(uint32, Subscriber&);
WaterFbo* findFbo(float);
WaterFbo* createWaterTilesTextures(float);
private:
RendererContext& context_;
EntityRenderer entityRenderer_;
TerrainMeshRenderer terrainMeshRenderer_;
SkyBoxRenderer skyBoxRenderer_;
ShaderProgram entityShader_;
ShaderProgram instancedEntityShader_;
ShaderProgram terrainShader_;
ShaderProgram skyBoxShader_;
GraphicsApi::ID reflectionPerFrameBuffer_;
GraphicsApi::ID refractionPerFrameBuffer_;
std::list<WaterFbo> waterFbos_;
std::unordered_map<uint32, Subscriber> subscribers_;
std::mutex subscriberMutex_;
IdType enabledSubscriptionId_;
bool isInit_;
bool isActive_;
};
} // namespace GameEngine |
fd18cc7a5aed7b8a0592f830f1991bd2493e082b | bb7a1df4ddad0dd4595eb62d1ee7f962ffcf4068 | /area-calculator.cpp | a3249ee5e5a1c09086a46ab48b1588915cbfe80a | [] | no_license | Arkiralor/Example-of-Runtime-Polymorphism-in-CPP | a9b41f48deb7e83d4a45f68da15107f5ca3b4541 | 2960d836d3574dba72b33cf49faf34e4392a8158 | refs/heads/master | 2020-04-24T20:21:53.470188 | 2019-02-27T19:21:59 | 2019-02-27T19:21:59 | 172,240,643 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,364 | cpp | area-calculator.cpp | //Sample program to test runtime polymorphism parameters using a basic area claculator.
#include<iostream>
using namespace std;
void switch1(int x); //initialisation of switch-case function named, "switch1".
class shape //declaration of base class.
{
public:
float r, b, h, l, w, pi=3.1416; //all possible atrributes in program.
virtual void area1()=0; //initial pure virtual function to find the area.
virtual void entry1()=0; //initial pure virtual function to take attributes from user-input.
};
class circle: public shape //class circle derived from class shape.
{
public:
void area1(); //function to calculate the area of the circle.
void entry1(); //function to enter attribute(s) of circle i.e, the radius.
};
class triangle: public shape //class triangle derived from class shape.
{
public:
void area1(); //function to calculate the area of the triangle.
void entry1(); //function to enter attributes of triangle i.e, the base and height.
};
class rectangle: public shape //class rectangle derived from class shape.
{
public:
void area1(); //function to calculate the area of the rectangle.
void entry1(); //function to enter the attributes of the rectangle i.e, the lenght and width.
};
int main()
{
int choice;
cout<<"\n--------------------\n";
cout<<"\n--------MENU--------\n";
cout<<"\nPlease select the shape. \n1. Circle \n2. Triangle \n3. Rectangle \n4. All shapes. \n"; //basic menu.
cout<<"\n--------------------\n";
cin>>choice; //actual argument for switch-case function.
switch1(choice); //argument passed to switch-case function.
return 0; //come on! I seriously should not need to explain this of all things!
}
void circle::entry1() //function definition of entry1 for class circle.
{
cout<<"\nEnter the radius. \n";
cin>>r; //console-input for the radius.
}
void circle::area1() //function definition of area1 for class circle.
{
float area=pi*r*r; //simple expression based on the formula for the area of a circle.
cout<<"\nThe area of the given circle is "<<area<<" sq-units. \n";
}
void triangle::entry1() //function definition of entry1 for class triangle.
{
cout<<"\nEnter the base and height, respectively. \n";
cin>>b>>h; //console-input for base and height.
}
void triangle::area1() //function definition of area1 for class triangle.
{
float area=0.5*b*h; //simple expression based on the formula for the area of a triangle.
cout<<"\nThe area of the given triangle is "<<area<<" sq-units. \n";
}
void rectangle::entry1() //function definition of entry1 for class rectangle.
{
cout<<"\nEnter the lenght and width, respectively. \n";
cin>>l>>w; //consle-input for lenght and width i.e, breadth.
}
void rectangle::area1() //function definition of area1 for class rectangle.
{
float area=l*w; //simple expression based on the formula for the area of a rectangle.
cout<<"\nThe area of the given rectangle is "<<area<<" sq-units. \n";
}
void switch1(int x) //function definition of switch-case function named, "switch1".
{
shape *o1; //create POINTER object from base class.
circle o4; //create object for circle.
triangle o5; //create object for triangle.
rectangle o6; //create object for rectangle.
switch(x) //begin switch-case block.
{
case 1: //if circle is chosen.
cout<<"\nYou have chosen a circle. \n";
o1=&o4; //assigning address of circle object to base pointer-object.
o1->entry1(); //base object points to entry function.
o1->area1(); //base object poits to area function.
break;
case 2: //if triangle is chosen.
cout<<"\nYou have chosen a triangle. \n";
o1=&o5; //assigning address of triangle object to base pointer-object.
o1->entry1();
o1->area1();
break;
case 3: //if rectangle is chosen.
cout<<"\nYou have chosen a rectangle. \n";
o1=&o6; //assigning address of rectangle object to base pointer-object.
o1->entry1();
o1->area1();
break;
case 4: //if all three shapes are chosen.
cout<<"\nYou have chosen all given shapes. \n";
o1=&o4;
o1->entry1();
o1->area1();
o1=&o5;
o1->entry1();
o1->area1();
o1=&o6;
o1->entry1();
o1->area1();
break;
default: //if invalid selection is made.
cout<<"\nInvalid selection, resubmit selection. \n";
cin>>x; //console-input for new argument.
switch1(x); //recursive call to switch-case function named, "switch1".
}
}
|
95cf76017dd5357fb5d1324e7ff646af5642866a | ddd8bec8fc0990fe1d4a9d3788d33a4de4a5c5e5 | /cpp/tests/test_splash.cpp | 8d26be5b0956725e4dbffe63df27db00afda8577 | [
"BSD-3-Clause"
] | permissive | berlinguyinca/spectra-hash | 7219a24f2f4f5ae564d43b3ff73186037a56c951 | 174fbf289a0357535f9bacda282b9a2dbb7807cc | refs/heads/master | 2022-05-08T14:01:14.238185 | 2022-03-31T21:56:14 | 2022-03-31T21:56:14 | 38,338,132 | 27 | 15 | BSD-3-Clause | 2022-03-31T21:56:15 | 2015-06-30T23:20:50 | C++ | UTF-8 | C++ | false | false | 3,403 | cpp | test_splash.cpp | #define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "splash.hpp"
using namespace std;
TEST_CASE("Spectrum #1") {
string spectrum_string = "66.0463:2.1827 105.0698:7.9976 103.0541:4.5676 130.065:8.6025 93.0572:0.2544 79.0542:4.4657 91.0541:2.5671 131.0728:2.6844 115.0541:1.3542 65.0384:0.6554 94.0412:0.5614 116.0494:1.2008 95.049:2.1338 117.0572:100 89.0385:11.7808 77.0385:3.3802 90.0463:35.6373 132.0806:2.343 105.0446:1.771";
string splash_code = "splash10-014i-4900000000-889a38f7ace2626a0435";
REQUIRE(splashIt(spectrum_string, '1') == splash_code);
}
TEST_CASE("Spectrum #2") {
string spectrum_string = "303.07:100 662.26:1.2111 454.91:1.2023 433.25:0.8864 432.11:2.308 592.89:3.9052 259.99:0.6406 281.14:1.2549 451.34:1.1847 499.85:1.2374 482.14:2.4133 450:23.5191 483:1.0004 285.25:1.448 253.1:46.5731 254.11:3.247 259.13:6.9241 304.14:17.2795";
string splash_code = "splash10-0udi-0049200000-ef488ecacceeaaadb4a2";
REQUIRE(splashIt(spectrum_string, '1') == splash_code);
}
TEST_CASE("Spectrum #3") {
string spectrum_string = "85:1095.0 86:185.0 87:338.0 88:20.0 89:790.0 91:7688.0 92:1208.0 93:5630.0 94:838.0 95:7354.0 96:661.0 97:1634.0 99:410.0 101:712.0 102:182.0 103:1080.0 104:304.0 105:7310.0 106:1494.0 107:4463.0 108:768.0 109:2996.0 110:466.0 111:771.0 112:27.0 113:317.0 114:66.0 115:1485.0 116:673.0 117:2789.0 118:719.0 119:4687.0 120:2294.0 121:4237.0 122:489.0 123:1162.0 124:120.0 125:335.0 126:204.0 128:1042.0 129:15126.0 130:2142.0 131:3635.0 132:966.0 133:2697.0 134:681.0 135:1701.0 136:205.0 137:360.0 139:199.0 141:544.0 142:147.0 143:2163.0 144:394.0 145:3924.0 146:869.0 147:1624.0 148:615.0 149:1321.0 150:88.0 151:373.0 152:109.0 153:268.0 154:84.0 155:770.0 156:266.0 157:859.0 158:486.0 159:2227.0 160:1288.0 161:1723.0 162:387.0 163:949.0 164:178.0 165:359.0 166:52.0 167:62.0 168:118.0 169:352.0 170:79.0 171:675.0 172:238.0 173:1051.0 174:364.0 175:465.0 176:140.0 177:434.0 178:137.0 179:218.0 180:65.0 181:195.0 182:77.0 183:215.0 184:104.0 185:341.0 186:141.0 187:327.0 188:104.0 189:376.0 190:42.0 191:261.0 193:13.0 195:79.0 196:99.0 197:70.0 198:120.0 199:378.0 200:216.0 201:267.0 202:67.0 203:596.0 204:151.0 205:153.0 206:184.0 208:85.0 209:132.0 212:62.0 213:724.0 214:270.0 215:238.0 216:119.0 217:433.0 218:81.0 219:258.0 220:22.0 221:1.0 224:42.0 225:23.0 227:142.0 228:122.0 229:159.0 231:15.0 232:25.0 233:240.0 235:101.0 236:39.0 237:47.0 239:47.0 240:64.0 241:37.0 242:31.0 243:58.0 244:16.0 245:199.0 246:47.0 247:433.0 248:60.0 249:16.0 250:34.0 251:30.0 255:636.0 256:151.0 257:20.0 258:30.0 259:138.0 260:66.0 261:79.0 264:13.0 267:85.0 268:41.0 271:32.0 273:128.0 274:117.0 275:182.0 279:40.0 280:24.0 282:74.0 284:40.0 287:36.0 288:49.0 289:79.0 291:50.0 295:55.0 296:23.0 297:67.0 298:55.0 300:30.0 301:74.0 303:67.0 304:31.0 306:10.0 311:73.0 312:61.0 313:87.0 314:32.0 317:7.0 318:33.0 326:127.0 327:192.0 328:272.0 329:1729.0 330:473.0 331:136.0 339:47.0 340:21.0 342:30.0 349:32.0 351:29.0 353:641.0 354:300.0 355:14.0 368:1096.0 369:424.0 370:76.0 382:32.0 407:19.0 415:29.0 416:8.0 429:90.0 430:28.0 440:8.0 442:10.0 443:31.0 444:63.0 447:36.0 451:31.0 454:7.0 456:40.0 458:354.0 459:298.0 460:83.0 461:57.0 468:23.0 469:29.0 472:16.0 484:19.0 486:27.0";
string splash_code = "splash10-056v-2900000000-f47edee35669c8f014c2";
REQUIRE(splashIt(spectrum_string, '1') == splash_code);
}
|
b8d72036298a8440926486a6ec1e8d1c034227bb | 6ff88e486f72dc796876a7d60a446a84690dc345 | /Header.h | 9f607d0857ee004a67374f359d39a1614d66ca57 | [] | no_license | DmitriyAvdyukhov/List | b4c3d056890e75a6ed0cd31db7a0318a0e1d4859 | ecb97b448bf8128632e55794c6207d6ec6f084e0 | refs/heads/master | 2023-06-25T16:18:00.251627 | 2021-07-27T19:10:35 | 2021-07-27T19:10:35 | 390,099,070 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,866 | h | Header.h | #pragma once
#include <cassert>
#include <cstddef>
#include <string>
#include <utility>
#include <iterator>
#include <cstddef>
#include <iostream>
template <typename Type>
class SingleLinkedList {
struct Node {
Node() = default;
Node(const Type& val, Node* next)
: value(val)
, next_node(next) {
}
Type value = {};
Node* next_node = nullptr;
};
template <typename ValueType>
class BasicIterator {
friend class SingleLinkedList;
explicit BasicIterator(Node* node) :node_(node) {}
public:
using iterator_category = std::forward_iterator_tag;
using value_type = Type;
using difference_type = std::ptrdiff_t;
using pointer = ValueType*;
using reference = ValueType&;
BasicIterator() = default;
BasicIterator(const BasicIterator<Type>& other) noexcept {
node_ = other.node_;
}
BasicIterator& operator=(const BasicIterator& rhs) = default;
[[nodiscard]] bool operator==(const BasicIterator<const Type>& rhs) const noexcept {
return node_ == rhs.node_;
}
[[nodiscard]] bool operator!=(const BasicIterator<const Type>& rhs) const noexcept {
return !(*this == rhs);
}
[[nodiscard]] bool operator==(const BasicIterator<Type>& rhs) const noexcept {
return node_ == rhs.node_;
}
[[nodiscard]] bool operator!=(const BasicIterator<Type>& rhs) const noexcept {
return !(*this == rhs);
}
BasicIterator& operator++() noexcept {
node_ = node_->next_node;
return *this;
}
BasicIterator operator++(int) noexcept {
BasicIterator<value_type> prev(node_);
++(*this);
return prev;
}
[[nodiscard]] reference operator*() const noexcept {
return node_->value;
}
[[nodiscard]] pointer operator->() const noexcept {
return &node_->value;
}
private:
Node* node_ = nullptr;
};
public:
using value_type = Type;
using reference = value_type&;
using const_reference = const value_type&;
using Iterator = BasicIterator<Type>;
using ConstIterator = BasicIterator<const Type>;
SingleLinkedList() = default;
~SingleLinkedList() {
Clear();
}
template<typename Iterator>
SingleLinkedList(Iterator begin, Iterator end) {
assert(size_ == 0 && head_.next_node == nullptr);
auto pos = before_begin();
for (Iterator it = begin; it != end; it++) {
pos = InsertAfter(pos, *it);
}
}
SingleLinkedList(std::initializer_list<Type> values) : SingleLinkedList(values.begin(), values.end()) {}
SingleLinkedList(const SingleLinkedList& other) : SingleLinkedList(other.begin(), other.end()) {}
SingleLinkedList& operator=(const SingleLinkedList& rhs) {
SingleLinkedList temp(rhs);
swap(temp);
return *this;
};
void swap(SingleLinkedList& other) noexcept {
Node* temp_head = other.head_.next_node;
other.head_.next_node = head_.next_node;
head_.next_node = temp_head;
std::swap(this->size_, other.size_);
};
[[nodiscard]] size_t GetSize() const noexcept {
return size_;
}
[[nodiscard]] bool IsEmpty() const noexcept {
return size_ == 0;
}
void PushFront(const Type&);
void PopFront() noexcept;
void Clear();
Iterator EraseAfter(ConstIterator pos) noexcept {
Node* prev = pos.node_->next_node;
Node* next_node = prev->next_node;
Node* line = pos.node_;
line->next_node = next_node;
--size_;
delete prev;
Iterator it(next_node);
return it;
}
[[nodiscard]] Iterator begin() noexcept {
Iterator begin_(head_.next_node);
return begin_;
}
[[nodiscard]] Iterator end() noexcept {
return end_;
}
[[nodiscard]] ConstIterator begin() const noexcept {
ConstIterator begin_(head_.next_node);
return begin_;
}
[[nodiscard]] ConstIterator end() const noexcept {
return end_;
}
[[nodiscard]] ConstIterator cbegin() const noexcept {
ConstIterator begin_(head_.next_node);
return begin_;
}
[[nodiscard]] ConstIterator cend() const noexcept {
return end_;
}
[[nodiscard]] Iterator before_begin() noexcept {
return before_begin_;
}
[[nodiscard]] ConstIterator cbefore_begin() const noexcept {
return before_begin_;
}
[[nodiscard]] ConstIterator before_begin() const noexcept {
return before_begin_;
}
Iterator InsertAfter(ConstIterator pos, const Type& value) {
Node* new_node = new Node(value, pos.node_->next_node);
pos.node_->next_node = new_node;
++size_;
Iterator result(new_node);
return result;
}
private:
Node head_{};
size_t size_ = 0;
Iterator before_begin_{ &head_ };
Iterator end_{};
};
template<typename Type>
void SingleLinkedList<Type>::PushFront(const Type& value) {
head_.next_node = new Node(value, head_.next_node);
size_++;
}
template<typename Type>
void SingleLinkedList<Type>::Clear() {
while (head_.next_node != nullptr) {
Node* temp = head_.next_node;
head_.next_node = head_.next_node->next_node;
delete temp;
--size_;
}
}
template<typename Type>
void SingleLinkedList<Type>::PopFront() noexcept {
if (head_.next_node != nullptr) {
Node* node = head_.next_node;
head_.next_node = head_.next_node->next_node;
delete node;
--size_;
}
}
template <typename Type>
void swap(SingleLinkedList<Type>& lhs, SingleLinkedList<Type>& rhs) noexcept {
lhs.swap(rhs);
}
template <typename Type>
bool operator==(const SingleLinkedList<Type>& lhs, const SingleLinkedList<Type>& rhs) {
return std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
template <typename Type>
bool operator!=(const SingleLinkedList<Type>& lhs, const SingleLinkedList<Type>& rhs) {
return !(lhs == rhs);
}
template <typename Type>
bool operator<(const SingleLinkedList<Type>& lhs, const SingleLinkedList<Type>& rhs) {
return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
template <typename Type>
bool operator<=(const SingleLinkedList<Type>& lhs, const SingleLinkedList<Type>& rhs) {
return rhs >= lhs;
}
template <typename Type>
bool operator>(const SingleLinkedList<Type>& lhs, const SingleLinkedList<Type>& rhs) {
return rhs < lhs;
}
template <typename Type>
bool operator>=(const SingleLinkedList<Type>& lhs, const SingleLinkedList<Type>& rhs) {
return !(lhs < rhs);
}
|
1eca39b6066aab9379dcc395cd18476111cfbcf8 | cdbde2b98c087864a90ac4a8c7512f8e63e412e5 | /serial.ino | eec6e7bc5b257cab57f774b266e6ba442c434294 | [] | no_license | nsohit/serial | b9ff8777573a9392f6072cb09b5234f8208324c0 | c83fd509d5d7d28a5c473ea30b18275e3c9953ce | refs/heads/master | 2020-11-28T17:11:32.221878 | 2019-12-24T07:23:57 | 2019-12-24T07:23:57 | 229,877,072 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,088 | ino | serial.ino |
/*
* GPS TEST
* MKRGSM1400
* SERCOM TEST (MAKE NEW SERIAL PORT)
*
*/
#include <Arduino.h>
/*
//NEW SERIAL
// | 11 | SDA | PA08 | | NMI | *16 | | X00 | | *0/00 | 2/00 | TCC0/0 | TCC1/2 | I2S/SD1 | |
// | 12 | SCL | PA09 | | 09 | *17 | | X01 | | *0/01 | 2/01 | TCC0/1 | TCC1/3 | I2S/MCK0 | |
Uart Serial3 (&sercom0, 11, 12, SERCOM_RX_PAD_0, UART_TX_PAD_2);
void SERCOM0_Handler() { Serial3.IrqHandler(); }
//IN SETUP
//pinPeripheral(11, PIO_SERCOM);
//pinPeripheral(12, PIO_SERCOM);
*/
#define SerialGPS Serial1 // RX&TX PINS
//#define SerialGPS Serial3 // SCL&SDA PINS
void setup() {
//pinPeripheral(11, PIO_SERCOM);
//pinPeripheral(12, PIO_SERCOM);
Serial.begin(9600); //USB
SerialGPS.begin(9600); //TEST GPS.
while(!Serial) { ; } //WAIT FOR SERIAL USB.
Serial.print("\nTEST SOMETHING\n\n");
}
#define CHECK_INTERVAL 5 //seconds.
unsigned long previousTest;
bool mGPS_got_line = false, mGPS_paused = false;
uint8_t mGPS_idx=0;
char mGPS_TempLine[120];
void loop() {
if (millis() - previousTest >= CHECK_INTERVAL*1000UL)
{
previousTest = millis();
Serial.print("\n\nGET NEW LINE\n\n");
if (mGPS_paused) mGPS_paused = false;
}
char mGPS = 0;
if ((SerialGPS.available() > 0) && !mGPS_got_line && !mGPS_paused)
{
mGPS = SerialGPS.read();
//Serial.write(mGPS); //DEBUG
if (mGPS == '\n')
{
mGPS_TempLine[mGPS_idx] = 0; mGPS_idx = 0; mGPS_got_line = true;
}
else
{
mGPS_TempLine[mGPS_idx++] = mGPS;
if (mGPS_idx >= 120) mGPS_idx = 119;
}
}
if (mGPS_got_line)
{
if (strstr(mGPS_TempLine, "$GPRMC"))
{
Serial.print("-->");Serial.println(mGPS_TempLine);
//DO SOMETHING WITH THE LINE.
//done parsed.
mGPS_paused = true; mGPS_got_line = false; //Reset to get a new after paused has been reset.
}
else
{
mGPS_got_line = false; //wrong line not GPRMC. get another.
}
}
} //END LOOP
|
201aa6cd80e8c8fdd5eccd5cc871af02082a1628 | 926c517f9f4c129e653fb8c21b77ff599847048a | /ImageTracking/Assets/Plugins/iOS/easyar.framework/Headers/arkitcamera.hxx | a4771335823ab6e2b3b6985dd85aa7ea9a723c53 | [] | no_license | Swagat47/easyARImageTracking | d1a71e668cace89094ca3284a436410cfcde0776 | a24432c4b1ba4f81086f80621af19d3c28452a4b | refs/heads/master | 2022-11-28T13:38:58.859477 | 2020-07-31T19:42:30 | 2020-07-31T19:42:30 | 284,109,458 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,820 | hxx | arkitcamera.hxx | //=============================================================================================================================
//
// EasyAR Sense 4.1.0.7750-f1413084f
// Copyright (c) 2015-2020 VisionStar Information Technology (Shanghai) Co., Ltd. All Rights Reserved.
// EasyAR is the registered trademark or trademark of VisionStar Information Technology (Shanghai) Co., Ltd in China
// and other countries for the augmented reality technology developed by VisionStar Information Technology (Shanghai) Co., Ltd.
//
//=============================================================================================================================
#ifndef __EASYAR_ARKITCAMERA_HXX__
#define __EASYAR_ARKITCAMERA_HXX__
#include "easyar/types.hxx"
namespace easyar {
/// <summary>
/// ARKitCameraDevice implements a camera device based on ARKit, which outputs `InputFrame`_ (including image, camera parameters, timestamp, 6DOF location, and tracking status).
/// After creation, start/stop can be invoked to start or stop data collection.
/// When the component is not needed anymore, call close function to close it. It shall not be used after calling close.
/// ARKitCameraDevice outputs `InputFrame`_ from inputFrameSource. inputFrameSource shall be connected to `InputFrameSink`_ for use. Refer to `Overview <Overview.html>`__ .
/// bufferCapacity is the capacity of `InputFrame`_ buffer. If the count of `InputFrame`_ which has been output from the device and have not been released is more than this number, the device will not output new `InputFrame`_ , until previous `InputFrame`_ have been released. This may cause screen stuck. Refer to `Overview <Overview.html>`__ .
/// </summary>
class ARKitCameraDevice
{
protected:
easyar_ARKitCameraDevice * cdata_ ;
void init_cdata(easyar_ARKitCameraDevice * cdata);
virtual ARKitCameraDevice & operator=(const ARKitCameraDevice & data) { return *this; } //deleted
public:
ARKitCameraDevice(easyar_ARKitCameraDevice * cdata);
virtual ~ARKitCameraDevice();
ARKitCameraDevice(const ARKitCameraDevice & data);
const easyar_ARKitCameraDevice * get_cdata() const;
easyar_ARKitCameraDevice * get_cdata();
ARKitCameraDevice();
/// <summary>
/// Checks if the component is available. It returns true only on iOS 11 or later when ARKit is supported by hardware.
/// </summary>
static bool isAvailable();
/// <summary>
/// `InputFrame`_ buffer capacity. The default is 8.
/// </summary>
int bufferCapacity();
/// <summary>
/// Sets `InputFrame`_ buffer capacity.
/// </summary>
void setBufferCapacity(int capacity);
/// <summary>
/// `InputFrame`_ output port.
/// </summary>
void inputFrameSource(/* OUT */ InputFrameSource * * Return);
/// <summary>
/// Starts video stream capture.
/// </summary>
bool start();
/// <summary>
/// Stops video stream capture.
/// </summary>
void stop();
/// <summary>
/// Close. The component shall not be used after calling close.
/// </summary>
void close();
};
}
#endif
#ifndef __IMPLEMENTATION_EASYAR_ARKITCAMERA_HXX__
#define __IMPLEMENTATION_EASYAR_ARKITCAMERA_HXX__
#include "easyar/arkitcamera.h"
#include "easyar/dataflow.hxx"
#include "easyar/frame.hxx"
#include "easyar/image.hxx"
#include "easyar/buffer.hxx"
#include "easyar/cameraparameters.hxx"
#include "easyar/vector.hxx"
#include "easyar/matrix.hxx"
namespace easyar {
inline ARKitCameraDevice::ARKitCameraDevice(easyar_ARKitCameraDevice * cdata)
:
cdata_(NULL)
{
init_cdata(cdata);
}
inline ARKitCameraDevice::~ARKitCameraDevice()
{
if (cdata_) {
easyar_ARKitCameraDevice__dtor(cdata_);
cdata_ = NULL;
}
}
inline ARKitCameraDevice::ARKitCameraDevice(const ARKitCameraDevice & data)
:
cdata_(NULL)
{
easyar_ARKitCameraDevice * cdata = NULL;
easyar_ARKitCameraDevice__retain(data.cdata_, &cdata);
init_cdata(cdata);
}
inline const easyar_ARKitCameraDevice * ARKitCameraDevice::get_cdata() const
{
return cdata_;
}
inline easyar_ARKitCameraDevice * ARKitCameraDevice::get_cdata()
{
return cdata_;
}
inline void ARKitCameraDevice::init_cdata(easyar_ARKitCameraDevice * cdata)
{
cdata_ = cdata;
}
inline ARKitCameraDevice::ARKitCameraDevice()
:
cdata_(NULL)
{
easyar_ARKitCameraDevice * _return_value_ = NULL;
easyar_ARKitCameraDevice__ctor(&_return_value_);
init_cdata(_return_value_);
}
inline bool ARKitCameraDevice::isAvailable()
{
bool _return_value_ = easyar_ARKitCameraDevice_isAvailable();
return _return_value_;
}
inline int ARKitCameraDevice::bufferCapacity()
{
if (cdata_ == NULL) {
return int();
}
int _return_value_ = easyar_ARKitCameraDevice_bufferCapacity(cdata_);
return _return_value_;
}
inline void ARKitCameraDevice::setBufferCapacity(int arg0)
{
if (cdata_ == NULL) {
return;
}
easyar_ARKitCameraDevice_setBufferCapacity(cdata_, arg0);
}
inline void ARKitCameraDevice::inputFrameSource(/* OUT */ InputFrameSource * * Return)
{
if (cdata_ == NULL) {
*Return = NULL;
return;
}
easyar_InputFrameSource * _return_value_ = NULL;
easyar_ARKitCameraDevice_inputFrameSource(cdata_, &_return_value_);
*Return = new InputFrameSource(_return_value_);
}
inline bool ARKitCameraDevice::start()
{
if (cdata_ == NULL) {
return bool();
}
bool _return_value_ = easyar_ARKitCameraDevice_start(cdata_);
return _return_value_;
}
inline void ARKitCameraDevice::stop()
{
if (cdata_ == NULL) {
return;
}
easyar_ARKitCameraDevice_stop(cdata_);
}
inline void ARKitCameraDevice::close()
{
if (cdata_ == NULL) {
return;
}
easyar_ARKitCameraDevice_close(cdata_);
}
}
#endif
|
8567b031d91690eab6d9686e45e692149ee4c12a | c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64 | /Engine/Plugins/Online/OnlineSubsystemTwitch/Source/Public/OnlineSubsystemTwitch.h | a59cf59e07561304b9f910dc10a9d31ef0fe0afa | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | windystrife/UnrealEngine_NVIDIAGameWorks | c3c7863083653caf1bc67d3ef104fb4b9f302e2a | b50e6338a7c5b26374d66306ebc7807541ff815e | refs/heads/4.18-GameWorks | 2023-03-11T02:50:08.471040 | 2022-01-13T20:50:29 | 2022-01-13T20:50:29 | 124,100,479 | 262 | 179 | MIT | 2022-12-16T05:36:38 | 2018-03-06T15:44:09 | C++ | UTF-8 | C++ | false | false | 3,784 | h | OnlineSubsystemTwitch.h | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "OnlineSubsystem.h"
#include "OnlineSubsystemImpl.h"
#include "OnlineSubsystemTwitchModule.h"
#include "OnlineSubsystemTwitchPackage.h"
/** Forward declarations of all interface classes */
typedef TSharedPtr<class FOnlineIdentityTwitch, ESPMode::ThreadSafe> FOnlineIdentityTwitchPtr;
typedef TSharedPtr<class FOnlineExternalUITwitch, ESPMode::ThreadSafe> FOnlineExternalUITwitchPtr;
class FOnlineAsyncTaskManagerTwitch;
class FRunnableThread;
/**
* Twitch backend services
*/
class ONLINESUBSYSTEMTWITCH_API FOnlineSubsystemTwitch :
public FOnlineSubsystemImpl
{
public:
// IOnlineSubsystem
virtual IOnlineSessionPtr GetSessionInterface() const override;
virtual IOnlineFriendsPtr GetFriendsInterface() const override;
virtual IOnlinePartyPtr GetPartyInterface() const override;
virtual IOnlineGroupsPtr GetGroupsInterface() const override;
virtual IOnlineSharedCloudPtr GetSharedCloudInterface() const override;
virtual IOnlineUserCloudPtr GetUserCloudInterface() const override;
virtual IOnlineEntitlementsPtr GetEntitlementsInterface() const override;
virtual IOnlineLeaderboardsPtr GetLeaderboardsInterface() const override;
virtual IOnlineVoicePtr GetVoiceInterface() const override;
virtual IOnlineExternalUIPtr GetExternalUIInterface() const override;
virtual IOnlineTimePtr GetTimeInterface() const override;
virtual IOnlineIdentityPtr GetIdentityInterface() const override;
virtual IOnlineTitleFilePtr GetTitleFileInterface() const override;
virtual IOnlineStorePtr GetStoreInterface() const override;
virtual IOnlineStoreV2Ptr GetStoreV2Interface() const override;
virtual IOnlinePurchasePtr GetPurchaseInterface() const override;
virtual IOnlineEventsPtr GetEventsInterface() const override;
virtual IOnlineAchievementsPtr GetAchievementsInterface() const override;
virtual IOnlineSharingPtr GetSharingInterface() const override;
virtual IOnlineUserPtr GetUserInterface() const override;
virtual IOnlineMessagePtr GetMessageInterface() const override;
virtual IOnlinePresencePtr GetPresenceInterface() const override;
virtual IOnlineChatPtr GetChatInterface() const override;
virtual IOnlineTurnBasedPtr GetTurnBasedInterface() const override;
virtual bool Init() override;
virtual void PreUnload() override;
virtual bool Shutdown() override;
virtual FString GetAppId() const override;
virtual bool Exec(class UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar) override;
virtual FText GetOnlineServiceName() const override;
// FOnlineSubsystemTwitch
/**
* Destructor
*/
virtual ~FOnlineSubsystemTwitch() = default;
/**
* Is Twitch available for use
*
* @return true if Twitch functionality is available, false otherwise
*/
static bool IsEnabled();
/**
* Get the twitch login service configuration
*
* @return login service instance associated with the subsystem
*/
inline FOnlineIdentityTwitchPtr GetTwitchIdentityService() const
{
return TwitchIdentity;
}
PACKAGE_SCOPE:
/** Only the factory makes instances */
FOnlineSubsystemTwitch(FName InInstanceName);
/** Default constructor unavailable */
FOnlineSubsystemTwitch() = delete;
/** @return Twich API version */
const FString& GetTwitchApiVersion() const { return TwitchApiVersion; }
private:
bool HandleAuthExecCommands(UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar);
/** Interface to the identity registration/auth services */
FOnlineIdentityTwitchPtr TwitchIdentity;
/** Interface for external UI services on Twitch */
FOnlineExternalUITwitchPtr TwitchExternalUIInterface;
/** Twitch API version */
FString TwitchApiVersion;
};
typedef TSharedPtr<FOnlineSubsystemTwitch, ESPMode::ThreadSafe> FOnlineSubsystemTwitchPtr;
|
8acd5e273cf58d3b512ba36eb08244257141e43f | 6545e4629184c07b7c42fa8bb555d993a750b33a | /COMP-3522-C++/examples/TypeId/main.cpp | 40f015647016ec6ceea7168e4f0da2e353dab36f | [] | no_license | kimjihyo/BCIT-CST-Course-Materials | 7a01926bec751933ad9c8392bf3f498cbe9c1a46 | 68957a187da66582be013156c878b4f7c1ecd5e2 | refs/heads/master | 2022-04-20T01:29:27.011132 | 2020-04-12T23:35:38 | 2020-04-12T23:35:38 | 255,178,510 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 404 | cpp | main.cpp | #include <iostream>
#include <stack>
#include <typeinfo>
int main()
{
int a;
std::stack<double> b;
double c;
std::cout << "a has type " << typeid(a).name() << std::endl;
std::cout << "int has type " << typeid(int).name() << std::endl;
std::cout << "b has type " << typeid(b).name() << std::endl;
std::cout << "c has type " << typeid(c).name() << std::endl;
return 0;
} |
4d3f3fdebef6ec6b74621fd333cd4a17fd45b71f | 1f4e86d704a022d2e3d99bb21a119748449e1076 | /NPC.h | 0b7562c95cc5bbb2a91587ec20d57b4626eb1962 | [] | no_license | Crawping/cDesktop | 56431c8c09dfc4d9096b5444d8e19741ccb307c5 | 1a75d2fa738f8f146d7db7815d319369bbbeacfe | refs/heads/master | 2021-05-05T10:55:35.638556 | 2013-09-18T05:06:03 | 2013-09-18T05:06:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 282 | h | NPC.h | #pragma once
#include "Object.h"
#include "Events.h"
class TaskData;
class NPC : public Object
{
public:
int moves, randX, randY, newX, newY;
NPC(std::string name, Position pos);
~NPC(void);
int getType() { return Object::TYPES::Type::NPC; }
void move(TaskData*);
};
|
e5f86f8b6a401b46d30acbce7ad80a5bdce78315 | ac92c74b7c4ca488ee3c0919f31250ac877070d9 | /Trees/Size Of Tree.cpp | 520afc0473c02b7839a47fe1826dae88a59087a9 | [] | no_license | pushp360/PrepBytes-Solutions | 8d16b7b059529d1d4b48502c63d650089017c172 | 4dae7146516830576bbfe97835a59c0dce67337e | refs/heads/main | 2023-07-14T11:56:19.919291 | 2021-08-27T13:32:57 | 2021-08-27T13:32:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 340 | cpp | Size Of Tree.cpp | // Complete the calculateSize function below.
/* For your reference:
struct node
{
long long value;
node *left;
node *right;
};
*/
int calculateSize(node* node)
{
if(node == NULL) return 0;
int left_size = calculateSize(node->left);
int right_size = calculateSize(node->right);
return 1+left_size+right_size;
}
|
ecf4f0d925cc0bc13e2c01b93bd02dd45aaacb58 | cd4587f46b5f1393e46459c7b7959455a847c0db | /source/geometry/src/GateGenericMove.cc | 4b8ed82c826e9d1fe65d0b8e1f453959c477fc4f | [] | no_license | lynch829/Gate | 8072e7e30d855b15a9152a5884fc1357c07539bc | 02754973dbaeca343a7c3b9402521f45c05e9ccf | refs/heads/develop | 2021-01-24T20:13:11.821931 | 2016-07-12T11:23:15 | 2016-07-12T11:23:15 | 66,326,268 | 1 | 0 | null | 2016-08-23T02:33:29 | 2016-08-23T02:33:29 | null | UTF-8 | C++ | false | false | 3,587 | cc | GateGenericMove.cc | /*----------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See GATE/LICENSE.txt for further details
----------------------*/
#include "GateGenericMove.hh"
#include "GateGenericMoveMessenger.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4UnitsTable.hh"
#include "GateTools.hh"
#include "GateMiscFunctions.hh"
#include "GateVVolume.hh"
#include "GateGenericRepeater.hh"
//-------------------------------------------------------------------------------------------------
GateGenericMove::GateGenericMove(GateVVolume* itsObjectInserter, const G4String& itsName)
: GateVGlobalPlacement(itsObjectInserter,itsName), mMessenger(0)
{
mPlacementsList.clear();
mUseRotation = mUseTranslation = false;
// mUseRelativeTranslation = true;
mMessenger = new GateGenericMoveMessenger(this);
}
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
GateGenericMove::~GateGenericMove()
{
delete mMessenger;
}
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
void GateGenericMove::SetFilename(G4String filename) {
ReadTimePlacements(filename, mTimeList, mPlacementsList, mUseRotation, mUseTranslation);
}
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
void GateGenericMove::PushMyPlacements(const G4RotationMatrix& currentRotationMatrix,
const G4ThreeVector& currentPosition,
G4double aTime)
{
// Check
if (mTimeList.size() ==0) {
GateError("Please provide a time-placement file with 'setPlacementsFilename'\n.");
}
// Get time index
int i = GetIndexFromTime(mTimeList, aTime);
GateDebugMessage("Move", 3, "GateGenericMove " << GetObjectName() << Gateendl);
GateDebugMessage("Move", 3, "\t current time " << aTime/s << " sec.\n");
GateDebugMessage("Move", 3, "\t current index " << i << Gateendl);
GateDebugMessage("Move", 3, "\t pos " << currentPosition << Gateendl);
GateDebugMessage("Move", 3, "\t plac " << mPlacementsList[i].second << Gateendl);
// New placement
G4RotationMatrix newRotationMatrix;
G4ThreeVector newPosition;
if (mUseRotation) newRotationMatrix = mPlacementsList[i].first;
else newRotationMatrix = currentRotationMatrix;
if (mUseTranslation)
{
// if (mUseRelativeTranslation) {
// newPosition = currentPosition + mPlacementsList[i].second;
// }
// else
newPosition = mPlacementsList[i].second;
}
else newPosition = currentPosition;
// Return placement
PushBackPlacement(GatePlacement(newRotationMatrix,newPosition));
}
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
void GateGenericMove::DescribeMyself(size_t indent)
{
G4cout << GateTools::Indent(indent) << "Move type: " << "genericMove\n";
}
//-------------------------------------------------------------------------------------------------
|
7c997e88f3b3c8cbb7f6e75f0e44ad44fb55ce40 | f36185e5fb421383743a74f92beb8ea97c9068b0 | /include/Vector.h | b41c1e3ac2fa4354b41bcf445cef3a3daa39ca66 | [
"Zlib"
] | permissive | avuorinen/Template-Math | 9ce6cf783e7b2a0acef7854d93d44417eb729c41 | 29d5e322f6bee002396efd124cb22836fa73ea24 | refs/heads/master | 2020-07-23T15:50:14.211944 | 2017-01-16T11:12:25 | 2017-01-16T11:12:25 | 67,157,557 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 12,525 | h | Vector.h | /*
Copyright (c) 2016 Atte Vuorinen <attevuorinen@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgement in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _TM_VECTOR_H
#define _TM_VECTOR_H
#include "Config.h"
#include "Operators.h"
#include "Functions.h"
#include "Vector4.h"
// std::cout support.
#include <ostream>
#ifndef AOHATAN_MATH_VECTOR11
#define AOHATAN_MATH_VECTOR11 0
#endif
TM_BEGIN_NAMESPACE
namespace Math
{
namespace Template
{
template <unsigned char VectorSize, typename Type>
struct VectorData
{
Type elements[VectorSize];
};
// Vector Bases
template <unsigned char VectorSize, typename Type>
struct VectorBase;
template <typename Type>
struct Vector2Base;
template <typename Type>
struct Vector3Base;
template <typename Type>
struct Vector4Base;
// Vector
template <unsigned char VectorSize, typename Type, class VectorBase =
typename Operator::CheckType< VectorSize == 2, Operator::TypeResult<Vector2Base<Type> >,
typename Operator::CheckType< VectorSize == 3, Operator::TypeResult<Vector3Base<Type> >,
typename Operator::CheckType< VectorSize == 4, Operator::TypeResult<Vector4Base<Type> >,
typename Operator::TypeResult<VectorBase<VectorSize, Type> > > > >::Result>
class Vector : public VectorBase
{
public:
// Typedefs //
typedef unsigned char Index;
typedef struct VectorData<VectorSize, Type> VectorData;
// Static //
static const unsigned short size = VectorSize;
inline static Vector Zero()
{
return VectorBase();
}
inline static Vector Create(const Type(&data)[VectorSize])
{
VectorData vector;
Operator::ArrayOperator<VectorSize, Type>::Set(vector.elements, data);
return Vector(vector);
}
template<unsigned char S, typename T, class B>
inline static Type Dot(const Vector& vector1, const Vector<S, T, B>& vector2)
{
return Operator::ArrayOperator< Operator::Size< size, Vector<S, T, B>::size>::result, Type, T>::Dot(vector1.Data(), vector2.Data()); }
// Data //
inline Type* Data()
{
return this->vectorData.elements;
}
inline const Type* Data() const
{
return this->vectorData.elements;
}
// Get //
inline Type& operator[](Index index)
{
return this->vectorData.elements[index];
}
inline Type& Get(Index index)
{
if (index < size)
{
return this->vectorData.elements[index];
}
return 0;
}
// Get Const //
inline const Type operator[](Index index) const
{
return this->vectorData.elements[index];
}
inline Type Get(Index index) const
{
if (index < size)
{
return this->vectorData.elements[index];
}
return 0;
}
// Set //
template <unsigned char S, typename T, class B>
inline void Set(const Vector<S, T, B>& vector)
{
Operator::ArrayOperator< Operator::Size<size, Vector<S, T, B>::size>::result, Type, T>::Set(Data(), vector.Data());
}
// Methods //
inline Type SqrtMagnitude() const
{
return Operator::ArrayOperator<size, Type>::SqrtMagnitude(Data());
}
inline Type Magnitude() const
{
return Sqrt<Type>(SqrtMagnitude());
}
inline Vector Normalize() const
{
VectorData data = this->vectorData;
Operator::ArrayOperator<size, Type>::Normalize(data.elements, Magnitude());
return Vector(data);
}
/// <summary>
/// Normalize this vector instead of copy.
/// Returns reference of it self, allows method stacking.
/// </summary>
inline Vector& NormalizeThis()
{
Operator::ArrayOperator<size, Type>::Normalize(Data(), Magnitude());
return *this;
}
template <unsigned char S, typename T, class V>
inline Type Dot(const Vector<S, T, V>& vector) const
{
return Vector::Dot(*this, vector);
}
// Constructors
Vector() : VectorBase() {}
Vector(const Type(&data)[size]) : VectorBase() { Operator::ArrayOperator<size, Type>::Set(Data(), data); }
Vector(const VectorData data) : VectorBase(data) {}
Vector(const Vector& vector) : VectorBase(vector.vectorData) {}
#if AOHATAN_MATH_VECTOR11
// C++ 11 Magic //
template<typename... Args>
/// <summary>
/// This constuctor accept unlimited parameters...
/// BUT in reality it only accept as much as vector size.
/// This will throw compiler error but not syntax!
/// </summary>
Vector(Args... value) : VectorBase({ { static_cast<Type>(value)... } }) { }
#else
// Common Constructors
// Reference values makes void* throw syntax error instead of run time failure.
typedef const typename Operator::EnableIf<2 == VectorSize, Type>::type& Vector2Type;
typedef const typename Operator::EnableIf<3 == VectorSize, Type>::type& Vector3Type;
typedef const typename Operator::EnableIf<4 == VectorSize, Type>::type& Vector4Type;
Vector(Vector2Type x, Vector2Type y) : VectorBase(Vector::VectorData{ x, y }) {}
Vector(Vector3Type x, Vector3Type y, Vector3Type z) : VectorBase(Vector::VectorData{ x, y, z }) {}
Vector(Vector4Type x, Vector4Type y, Vector4Type z, Vector4Type w) : VectorBase(Vector::VectorData{ x, y, z, w }) {}
#endif /* AOHATAN_MATH_VECTOR11 */
// Same Type Assingment
inline Vector& operator=(const Vector& vector)
{
if (this == &vector)
{
return *this;
}
this->vectorData = vector.vectorData;
return *this;
}
// Generic Type Assingment
template<unsigned char S, typename T, class B>
inline Vector& operator=(const Vector<S, T, B>& vector)
{
Operator::ArrayOperator< Operator::Size<size, Vector<S, T, B>::size>::result, Type, T>::Set(Data(), vector.Data());
return *this;
}
// Operators //
template<unsigned char S, typename T, class B>
inline operator Vector<S, T, B>()
{
Vector<S, T, B> vector;
//vector.Set<size, Type, VectorBase>(*this);
Operator::ArrayOperator< Operator::Size<size, Vector<S, T, B>::size>::result, Type, T>::Set(vector.Data(), Data());
return vector;
}
// Comparision //
template <unsigned char S, typename T, class V>
inline bool operator==(const Vector<S, T, V>& vector) const
{
return Operator::ArrayOperator< Operator::Size<size, Vector<S, T, V>::size>::result, Type, T>::Equals(Data(), vector.Data());
}
template <unsigned char S, typename T, class V>
inline bool operator!=(const Vector<S, T, V>& vector) const
{
return !operator==(vector);
}
// Unary operators //
inline Vector operator-() const
{
VectorData data = this->vectorData;
Operator::ArrayOperator<size, Type>::Mul(data.elements, -1);
return Vector(data);
}
// Operators +-*/ //
// Templates, allows inheritanced classes use operators.
template <unsigned char S, typename T, class V>
inline Vector operator+(const Vector<S, T, V>& vector) const
{
VectorData data = this->vectorData;
Operator::ArrayOperator< Operator::Size<size, Vector<S, T, V>::size>::result, Type, T>::Add(data.elements, vector.Data());
return Vector(data);
}
template <unsigned char S, typename T, class V>
inline Vector& operator+=(const Vector<S, T, V>& vector)
{
Operator::ArrayOperator< Operator::Size<size, Vector<S, T, V>::size>::result, Type, T>::Add(Data(), vector.Data());
return *this;
}
template <unsigned char S, typename T, class V>
inline Vector operator-(const Vector<S, T, V>& vector) const
{
VectorData data = this->vectorData;
Operator::ArrayOperator< Operator::Size<size, Vector<S, T, V>::size>::result, Type, T>::Sub(data.elements, vector.Data());
return Vector(data);
}
template <unsigned char S, typename T, class V>
inline Vector& operator-=(const Vector<S, T, V>& vector)
{
Operator::ArrayOperator< Operator::Size<size, Vector<S, T, V>::size>::result, Type, T>::Sub(Data(), vector.Data());
return *this;
}
inline Vector operator*(const Type scalar) const
{
VectorData data = this->vectorData;
Operator::ArrayOperator< size, Type>::Mul(data.elements, scalar);
return Vector(data);
}
inline Vector operator*=(const Type scalar)
{
Operator::ArrayOperator< size, Type>::Mul(Data(), scalar);
return *this;
}
inline Vector operator/(const Type scalar) const
{
VectorData data = this->vectorData;
Operator::ArrayOperator< size, Type>::Div(data.elements, scalar);
return Vector(data);
}
inline Vector operator/=(const Type scalar)
{
Operator::ArrayOperator< size, Type>::Div(Data(), scalar);
return *this;
}
template <unsigned char S, typename T, class V>
inline Type operator*(const Vector<S, T, V>& vector)
{
return Dot(vector);
}
// Friend operators //
template<unsigned char S, typename T, class B>
friend inline Vector<S, T, B> operator*(const Type scalar, const Vector<S, T, B>& vector);
template<unsigned char S, typename T, class B>
friend inline std::ostream& operator<<(std::ostream &out, const Vector<S, T, B>& vector);
};
template<unsigned char S, typename T, class B>
inline std::ostream& operator<<(std::ostream &out, const Vector<S, T, B>& vector)
{
out << vector.size << "[ ";
for (unsigned char i = 0; i != vector.size; i++)
{
out << vector[i] << " ";
}
out << "]";
return out;
}
template<unsigned char S, typename T, class B>
inline Vector<S, T, B> operator*(const T scalar, const Vector<S, T, B>& vector)
{
return vector * scalar;
}
// Vector Bases
// TODO: Component initialization?
template <unsigned char VectorSize, typename Type>
struct VectorBase
{
VectorData<VectorSize, Type> vectorData;
VectorBase() {}
VectorBase(VectorData<VectorSize, Type> data) : vectorData(data) {}
};
template <typename Type>
struct Vector3Base
{
typedef Vector<3, Type, Vector3Base > RealVector;
union
{
VectorData<3, Type> vectorData;
struct
{
Type x, y, z;
};
};
Vector3Base() {}
Vector3Base(VectorData<3, Type> data) : vectorData(data) {}
static void Cross(Vector<3, Type, Vector3Base >& vector, const Vector<3, Type, Vector3Base >& rhs)
{
Type x(vector.y * rhs.z - vector.z * rhs.y), y(vector.z * rhs.x - vector.x * rhs.z), z(vector.x * rhs.y - vector.y * rhs.x);
vector.x = x;
vector.y = y;
vector.z = z;
}
inline RealVector Cross(const RealVector& rhs) const
{
RealVector vector = RealVector({ { x, y, z } });
Vector3Base::Cross(vector, rhs);
return vector;
}
inline RealVector& CrossThis(const RealVector& rhs)
{
Vector3Base::Cross(*this, rhs);
return *this;
}
};
template <typename Type>
struct Vector2Base
{
typedef Vector<2, Type, Vector2Base > RealVector;
union
{
VectorData<2, Type> vectorData;
struct
{
Type x, y;
};
};
Vector2Base() {}
Vector2Base(VectorData<2, Type> data) : vectorData(data) {}
static Type Cross(RealVector& vector, const RealVector& rhs)
{
return vector.x * rhs.y - vector.y * rhs.x;
}
inline Type Cross(const RealVector& rhs) const
{
RealVector vector = RealVector({ x, y });
return Vector2Base::Cross(vector, rhs);
}
};
template <typename Type>
struct Vector4Base
{
union
{
VectorData<4, Type> vectorData;
struct
{
Type x, y, z, w;
};
};
Vector4Base() {}
Vector4Base(VectorData<4, Type> data) : vectorData(data) {}
};
}
using Template::Vector;
typedef Template::Vector<2, float, Template::Vector2Base<float> > Vector2;
typedef Template::Vector<3, float, Template::Vector3Base<float> > Vector3;
typedef Template::Vector<4, float, Template::Vector4Base<float> > Vector4;
}
TM_END_NAMESPACE
#endif /* _TM_VECTOR_H */
|
c2528e716a499ade3bf7eb10f9ccfbf38e791bab | 696edfbbeffb1da5fa1df6bc007f50d321947a77 | /src/error.cc | a49a5f0f36f084344789b386829d26af4ad232ec | [] | no_license | shin1m/gl-xemmai | 992fe3ed61b954984a78f4b7672e976f84cc237f | 994a1f010623f36f4843c0066e7d505b7271851e | refs/heads/main | 2023-06-24T21:16:58.466081 | 2023-06-11T21:57:51 | 2023-06-11T21:57:51 | 3,754,978 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 438 | cc | error.cc | #include "error.h"
namespace xemmaix::gl
{
void t_error::f_throw(GLenum a_error)
{
throw t_rvalue(f_new<t_error>(t_session::f_instance()->v_library, L"error"sv, a_error));
}
}
namespace xemmai
{
void t_type_of<xemmaix::gl::t_error>::f_define(t_library* a_library)
{
using namespace xemmaix::gl;
t_define{a_library}
(L"error"sv, t_member<GLenum(t_error::*)() const, &t_error::f_error>())
.f_derive<t_error, t_throwable>();
}
}
|
d198bf4155231f6e76de382cb2ee509021c87920 | 8e5d3e0cf1bb293e9e85c9c13c87798f80f18e51 | /kameleon-plus/tags/kameleon-plus-working-SNAPSHOT-2014-02-03/src/ccmc/Attribute.cpp | b7f04e0851ed798b02d120d1a2e7f945009719d2 | [] | no_license | ccmc/ccmc-software | 8fc43f9fa00e44d0b4a212c1841d574a9eaf3304 | 0e2fb90add626f185b0b71cdb9a7b8b3b5c43266 | refs/heads/master | 2021-01-17T03:58:07.261337 | 2018-04-04T15:22:37 | 2018-04-04T15:22:37 | 40,681,189 | 10 | 7 | null | 2015-08-13T20:51:18 | 2015-08-13T20:51:18 | null | UTF-8 | C++ | false | false | 3,380 | cpp | Attribute.cpp | #include "Attribute.h"
#include <iostream>
#include <boost/lexical_cast.hpp>
namespace ccmc
{
/**
* Default constructor. Initializes the attributeName to "", the string value to "", and the integer and
* float values to 0.
*/
Attribute::Attribute()
{
attributeName = "";
sValue = "";
iValue = 0;
fValue = 0.f;
}
/**Returns the attribute's name as a std::string object.
* @return The attribute's name
*/
std::string Attribute::getAttributeName()
{
return attributeName;
}
/**
* Sets the attribute name
* @param name The attribute name requested.
*/
void Attribute::setAttributeName(std::string name)
{
attributeName = name;
}
/**
* Copies the contents of value and stores them.
* @param value the new attribute value
*/
void Attribute::setAttributeValue(std::string& value)
{
type = Attribute::STRING;
sValue = value;
}
/**
* Copies the contents of value and stores them.
* @param value the new attribute value
*/
void Attribute::setAttributeValue(int& value)
{
type = Attribute::INT;
iValue = value;
}
/**
* Copies the contents of value and stores them.
* @param value the new attribute value
*/
void Attribute::setAttributeValue(float& value)
{
type = Attribute::FLOAT;
fValue = value;
}
/**
* @return AttributeType of the Attribute object
*/
Attribute::AttributeType Attribute::getAttributeType()
{
return type;
}
/**
* Returns the attribute value as a float, if applicable.
* @return The float value of the attribute. The value returned will be 0.f
* if the AttributeType of the Attribute object is not Attribute::FLOAT
*/
float Attribute::getAttributeFloat()
{
return fValue;
}
/**
* Returns the string representation of the attribute, if applicable.
* @return The string value of the attribute. This value will be an empty string
* if the AttributeType of the Attribute object is not Attribute::STRING
*/
std::string Attribute::getAttributeString()
{
return sValue;
}
/**
* Returns the attribute value as an int, if applicable.
* @return The int value of the attribute. The value returned will be 0
* if the AttributeType of the Attribute object is not Attribute::FLOAT
*/
int Attribute::getAttributeInt()
{
return iValue;
}
/**
* @return
*/
std::string Attribute::toString() const
{
std::string string_value = "";
if (type == Attribute::FLOAT)
{
string_value += "FLOAT: " + this->attributeName + ": " + boost::lexical_cast<std::string>(this->fValue);
} else if (type == Attribute::INT)
{
string_value += "INT: " + this->attributeName + ": " + boost::lexical_cast<std::string>(this->iValue);
} else
{
string_value += "STRING: " + this->attributeName + ": " + this->sValue;
}
return string_value;
}
std::ostream& operator<<(std::ostream& out, const Attribute attribute)
{
out << attribute.toString();
return out;
}
/**
* Destructor
*/
Attribute::~Attribute()
{
/*
if (attributeValue != NULL)
{
std::cout << "deleting attributeValue in Attribute.cpp" << std::endl;
if (type == Attribute::STRING)
{
delete [] (char *)attributeValue;
attributeValue = NULL;
}else if(type == Attribute::INT)
{
delete (int *)attributeValue;
attributeValue = NULL;
}
else
{
delete (float *)attributeValue;
attributeValue = NULL;
}
}*/
}
}
|
6bfd158faef87c03abffa2104340a1b90c765f81 | e64be1612f4ec3b0151776ec7df477b7eeb24dbb | /Target/nnetwork.h | 29a73f087b83225eef3e65881ab1b70b4eccdf9b | [] | no_license | jbongard/2006_Science_BongardZykovLipson | 463f8c397c1a43312b5c557719e2473d96bc96b1 | 37e15ef12c4412dfa13db619aa9aa7897475af97 | refs/heads/master | 2021-06-21T21:48:32.599205 | 2017-08-14T20:36:03 | 2017-08-14T20:36:03 | 100,307,255 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,535 | h | nnetwork.h | /* ---------------------------------------------------
FILE: nnetwork.h
AUTHOR: Chandana Paul
DATE: November 27, 2000
FUNCTION: This class contains the neural network
which controls the biped agent.
-------------------------------------------------- */
#include <iostream.h>
#include "fstream.h"
#include "math.h"
#include "matrix.h"
#ifndef _NEURAL_NETWORK_H
#define _NEURAL_NETWORK_H
class NEURAL_NETWORK {
public:
int numInput;
int numHidden;
int numOutput;
private:
MATRIX *inputValues;
MATRIX *hiddenValues;
MATRIX *outputValues;
MATRIX *nextHiddenValues;
MATRIX *nextOutputValues;
MATRIX *ih;
MATRIX *hh;
MATRIX *ho;
public:
NEURAL_NETWORK(void);
~NEURAL_NETWORK(void);
int AddMotor(void);
int AddSensor(void);
//void ClearValues(void);
//void DrawNeurons(double *com);
double GetMotorCommand(int neuronIndex);
double GetSensorValue(int neuronIndex);
void Init(ifstream *brainFile);
//void LabelSynapses(int genomeLength, const double *params, int numMorphParams);
//void PerturbSynapses(void);
void Print(void);
//void RecordHiddenValues(ofstream *outFile);
void UpdateSensorValue(double value, int neuronIndex);
void Update(void);
private:
//void DrawSensorNeurons(double *com);
//void DrawHiddenNeurons(double *com);
//void DrawMotorNeurons(double *com);
void PrintValues(void);
void PrintWeights(void);
void UpdateHiddenValues(void);
void UpdateOutputValues(void);
};
#endif |
949443b9cc8abb5c6c7c58b010f5272c3b6944fa | 30e432f4c1a50f9fa35cc4a69292e9f9062a01ab | /Includes/iterateurs.h | ecbb9d6862c520da05e968f136dd1e900e93fda4 | [] | no_license | geekosaurusR3x/Modelisation-Kart-M1 | 908cc7185de79ec8760b2adac9e0f4f11ddf6ed3 | c27e33fcb0652f3e611936148caf2070584addfd | refs/heads/master | 2021-05-28T10:23:19.631858 | 2013-12-21T16:00:23 | 2013-12-21T16:00:23 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 4,007 | h | iterateurs.h | //*****************************************************************************
//
// Module : Iterateurs
//
// Fichier : Iterateurs.h
//
// Auteur : lanuel
//
// Date creat. : Fri Aug 16 21:03:42 GMT+0100 1996
//
// Commentaires : Interface de la classe Iterateurs.
//
//
//*****************************************************************************
// Classe Iterateurs
// Constructeurs et destructeur
// Accesseurs
// Methodes
// Surcharge des operateurs
// Partie privee
//*****************************************************************************
#ifndef __Iterateurs__h__
#define __Iterateurs__h__
#include <iostream>
using namespace std ;
#include <stdlib.h>
#include "Listes.h"
#include "ElemListes.h"
//*****************************************************************************
//
// Classe Iterateurs
//
//*****************************************************************************
template <class T>
class CONTENEURS_DLL Iterateurs
{
public:
//*****************************************************************************
// Constructeurs et destructeur
// Ils sont tous les 4 définis ci-dessous pour obliger le compilateur à
// les compiler. En effet, les 3 sont indispensables même s'ils ne sont
// pas appelés explicitement.
//*****************************************************************************
Iterateurs()
: courant(NULL), tete(NULL), queue(NULL)
{
}
Iterateurs(const Iterateurs<T> &I)
: courant(I.courant), tete(I.tete), queue(I.queue)
{
}
~Iterateurs()
{
}
Iterateurs(const Listes<T>&L)
: courant(L.tete), tete(L.tete), queue(L.queue)
{
}
//*****************************************************************************
// Accesseurs
//*****************************************************************************
inline const T & Valeur() const;
inline T* PtrValeur();
inline const Iterateurs<T>& Valeur(const T &);
//*****************************************************************************
// Methodes
//*****************************************************************************
inline void InitDebut();
inline void InitFin();
inline void Avance();
inline void Recule();
inline bool Debut() const;
inline bool Fin() const;
//*****************************************************************************
// Surcharge des operateurs
//*****************************************************************************
const Iterateurs<T>& operator = (const Iterateurs<T>&);
//*****************************************************************************
// Partie privee
//*****************************************************************************
private:
ElemListes<T> *courant, *tete, *queue;
};
template <class T>
inline const T & Iterateurs<T>::Valeur() const
{
return courant->Valeur();
}
template <class T>
inline T* Iterateurs<T>::PtrValeur()
{
return courant->PtrValeur();
}
template <class T>
inline const Iterateurs<T>& Iterateurs<T>::Valeur(const T & a)
{
courant->Valeur(a);
return *this;
}
template <class T>
inline void Iterateurs<T>::InitDebut()
{
courant = tete;
}
template <class T>
inline void Iterateurs<T>::InitFin()
{
courant = queue;
}
template <class T>
inline void Iterateurs<T>::Avance()
{
courant = courant->Suivant();
}
template <class T>
inline void Iterateurs<T>::Recule()
{
courant = courant->Precedent();
}
template <class T>
inline bool Iterateurs<T>::Debut() const
{
return courant==NULL;
}
template <class T>
inline bool Iterateurs<T>::Fin() const
{
return courant==NULL;
}
template <class T>
const Iterateurs<T>& Iterateurs<T>::operator = (const Iterateurs<T>& O)
{
if (&O != this)
{
courant = O.courant;
tete = O.tete;
queue = O.queue;
}
return *this;
}
#endif __Iterateurs__h__
|
494f75b74362ea99fb3157a5857d5b9e7eeb5809 | b46a748df7ad8336a555ca36ec58a16c2da58722 | /DXR_SoftShadows_Project/BeLuEngine/src/Renderer/DX12Tasks/MergeLightningRenderTask.h | 623dceb331dabd6f1360368599ec07e57194f564 | [
"MIT"
] | permissive | fjz345/DXR_SoftShadows | c66aa33b7455f9b6c76df93cbe7710358faef6c3 | 00cb6b1cf560899a010c9e8504578d55e113c22c | refs/heads/main | 2023-08-26T11:45:45.232481 | 2021-07-12T14:39:32 | 2021-07-12T14:39:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 950 | h | MergeLightningRenderTask.h | #ifndef MERGELIGHTNINGRENDERTASK_H
#define MERGELIGHTNINGRENDERTASK_H
#include "RenderTask.h"
class MergeLightningRenderTask : public RenderTask
{
public:
MergeLightningRenderTask(ID3D12Device5* device,
RootSignature* rootSignature,
const std::wstring& VSName, const std::wstring& PSName,
std::vector<D3D12_GRAPHICS_PIPELINE_STATE_DESC*>* gpsds,
const std::wstring& psoName);
~MergeLightningRenderTask();
void SetCommandInterface(CommandInterface* inter);
void SetFullScreenQuadMesh(Mesh* fsq);
void CreateSlotInfo();
void Execute() override final;
void SetHeapOffsets(unsigned int shadowBufferOffset);
private:
CommandInterface* m_pCommandInterfaceTemp = nullptr;
Mesh* m_pFullScreenQuadMesh = nullptr;
// CB_PER_OBJECT
Resource* m_CbPerObjectUploadResource = nullptr;
size_t m_NumIndices;
SlotInfo m_SlotInfo;
// heap offsets
unsigned int m_SoftShadowBufferOffset = 0;
};
#endif |
a0016b05ee427600a317595388e43a4f91b9f1a7 | e0a8ffabeef9c9ebb418950ffb0e7b9742514224 | /include/CGameData.h | 5649520217d42fa98f1467bc4fdb47696bceb2fb | [] | no_license | ChuckBolin/MarioEditor | 26beed73f511cd13bbd81b8163752ffe6c3be7a2 | 5bc6cfea6c6594d7c4addc7aec647fcf11b88f13 | refs/heads/master | 2021-01-19T18:54:18.862197 | 2014-04-12T00:58:58 | 2014-04-12T00:58:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,848 | h | CGameData.h | /**************************************************************************************
Filename: CGameData.h Date: December, 2008
Purpose: Manages all game data.
**************************************************************************************/
#ifndef CGAMEDATA_H
#define CGAMEDATA_H
#include <string>
#include <windows.h>
#include "CLog.h"
#include "CINIReader.h"
#include "CFileReader.h"
#include "CGraphics.h"
class CGraphics;
struct GAME_OBJECT_TYPE{
std::string name;
int objectID;
int layer;
int behavior;
int soundID;
int spriteID1;
int spriteID2;
int spriteID3;
};
struct GAME_OBJECT{
//data object from m_objectType
std::string name;
int objectID;
int layer;
int behavior;
int soundID;
int spriteID1;
int spriteID2;
int spriteID3;
//mobility data
D3DXVECTOR3 pos;
D3DXVECTOR3 vel;
float direction;
float turnRate;
bool alive;
bool dying;
float radius;
int mode;
//gi data
int spriteID; //current sprite
int alpha;
float angle;
int width;
int height;
int left;
int top;
int asset;
int frameCount;
double totalTime;
int maxFrames;
double updateInterval;
float collisionDiameter;
};
class CGameData{
public:
CGameData();
bool LoadConfigFile(std::string filename);
int m_FPS;
std::string m_version;
HWND m_hWnd;
//screen information
int m_screenLeft;
int m_screenTop;
int m_screenWidth;
int m_screenHeight;
bool m_bFullScreen;
//environmental boundaries
int m_worldX;
int m_worldY;
int m_highlightX;
int m_highlightY;
bool m_bHighlight;
int m_highlightObject;
bool m_bLeftMouseDown;
bool m_bRightMouseDown;
//std::vector<CObject*> m_pObject;
//display debug info on screen
bool m_displayDebugInfo;
//sound
bool m_playMusic;
void LogKeyValue();
void LoadGameLevel(std::string filename);
int LevelSize();
std::vector<GAME_OBJECT> m_level;
GAME_OBJECT GetLevelData(int i);
bool LoadObjectFile(std::string filename);
std::vector<GAME_OBJECT_TYPE> m_objectType;
bool AddGraphicDataToLevelData(CGraphics &con);
bool AddObject(CGraphics &con, std::string objectName, int x, int y);
//bool AddObject(CGraphics &con, int objectID, int x, int y);
std::string GetObjectName(int id);
void LogObjects();
GAME_OBJECT_TYPE GetObjectData(std::string name);
void ClearLevel();
void SaveLevel (int level);
void OpenLevel (int level, CGraphics &con);
//variables loaded from level1.dat file
int m_screenColorRed;
int m_screenColorGreen;
int m_screenColorBlue;
int m_worldLeft;
int m_worldRight;
int m_worldTop;
int m_worldBottom;
// void InitializeObjectsFromAssets(CGraphics &con);
private:
};
#endif |
4c252bba9bb815981f4ad430be2587169edff87b | 4ddb183621a8587f45c12216d0227d36dfb430ff | /MBDGeneralFW/MBDTechInfo.m/LocalInterfaces/MBDTechnicInfoNewAddinDlg.h | 3f25f90101d92d95c146116c429762e9e165190a | [] | no_license | 0000duck/good-idea | 7cdd05c55483faefb96ef9b2efaa7b7eb2f22512 | 876b9c8bb67fa4a7dc62d89683d4fd9d28a94cae | refs/heads/master | 2021-05-29T02:46:02.336920 | 2013-07-22T17:53:06 | 2013-07-22T17:53:06 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,594 | h | MBDTechnicInfoNewAddinDlg.h | // COPYRIGHT Dassault Systemes 2011
//===================================================================
//
// MBDTechnicInfoNewAddinDlg.h
// The dialog : MBDTechnicInfoNewAddinDlg
//
//===================================================================
//
// Usage notes:
//
//===================================================================
//CAA2 Wizard Generation Report
// DIALOG
//End CAA2 Wizard Generation Report
//
// Apr 2011 Creation: Code generated by the CAA wizard ev5adm
//===================================================================
#ifndef MBDTechnicInfoNewAddinDlg_H
#define MBDTechnicInfoNewAddinDlg_H
//ktsoftware PubHeader
#include "ktPubHeaders.h"
#include "CATDlgDialog.h"
#include "CATDlgInclude.h"
#include "CATLISTPIUnknown.h"
#include "CATListOfInt.h"
#include "CATListOfCATUnicodeString.h"
//----------------------------------------------------------------------
/**
* Describe the purpose of your panel here.
* <p>
* Using this prefered syntax will enable mkdoc to document your class.
* <p>
* refer to programming resources of Dialog framework.
* (consult base class description).
*/
class MBDTechnicInfoNewAddinDlg: public CATDlgDialog
{
// Allows customization/internationalization of command's messages
// ---------------------------------------------------------------
DeclareResource( MBDTechnicInfoNewAddinDlg, CATDlgDialog )
public:
MBDTechnicInfoNewAddinDlg();
virtual ~MBDTechnicInfoNewAddinDlg();
void Build ();
void ChangeDatabaseComboListCB(CATCommand* cmd, CATNotification* evt, CATCommandClientData data);
CATBoolean ComboItemSearchCB(CATCommand* cmd, CATNotification* evt, CATCommandClientData data);
HRESULT SetSearchItemComboList(CATListValCATUnicodeString astrKeyWords,CATDlgCombo * piDlgCombo);
void GetAllWBSItemInfo(CATLISTV(CATUnicodeString) &listStrSearchItems);
void ApplyNoteToEditorPBCB(CATCommand* cmd, CATNotification* evt, CATCommandClientData data);
HRESULT GetSerialNumberList();
void ApplyNoteToDatabasePBCB(CATCommand* cmd, CATNotification* evt, CATCommandClientData data);
//CAA2 WIZARD WIDGET DECLARATION SECTION
CATDlgFrame* _Frame001;
CATDlgLabel* _Label005;
CATDlgCombo* _DatabaseListCombo;
CATDlgFrame* _Frame002;
CATDlgEditor* _TechnicalNoteCttEditor;
CATDlgFrame* _SearchItemsFrame;
CATDlgFrame* _Frame004;
CATDlgPushButton* _ApplyNoteToEditorPB;
CATDlgPushButton* _ApplyNoteToDatabasePB;
//END CAA2 WIZARD WIDGET DECLARATION SECTION
//初始创建列表
CATLISTP(IUnknown) m_ItemEditorList;
CATLISTP(IUnknown) m_ItemComboList;
//显示的控件列表
CATLISTP(IUnknown) m_ShowItemComboList;
CATLISTP(IUnknown) m_ShowItemEditorList;
CATLISTV(CATUnicodeString) ListDbName;
CATLISTV(CATUnicodeString) ListDbWBSItem;
CATListOfInt countNode;
CATLISTV(CATUnicodeString) ListComboName;
CATLISTV(CATUnicodeString) ListWBSItem;
CATLISTV(CATUnicodeString) ListGSMToolName;
CATLISTV(CATUnicodeString) ListGSMToolSwitch;
//当前状态label and combo XML配置
CATLISTV(CATUnicodeString) ListCurrentComboName;
CATLISTV(CATUnicodeString) ListCurrentWBSItem;
//传输给CMD直接查询用
CATLISTV(CATUnicodeString) m_ListWBSItemValue;
//当前序列号数组
CATListValCATUnicodeString m_astrSerialNumValue;
CATUnicodeString m_CurrSerialNum;
int m_NodeLocate;
CATUnicodeString m_xmlPath;
};
//----------------------------------------------------------------------
#endif
|
23460da7f0138fe0b7036d89cef4e9e1b63e2004 | e84bfe5b43bf35e78d67cc18be31a61781f6f53c | /Cpp-Mandelbrot/mandelbrot.cpp | 6601f0e8730a996f655d98009ce110b20f8f2352 | [] | no_license | ramch101/CS510-Fall2015-FinalProject | 023e3088e1520579aac88cb1769fb60abcd2fcc4 | 61bf7c1ee9db58c7bd9e9a228d7bfa6b3cf5eb20 | refs/heads/master | 2021-01-19T08:12:42.433339 | 2015-12-17T16:05:47 | 2015-12-17T16:05:47 | 46,629,262 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,137 | cpp | mandelbrot.cpp | #include <iostream>
#include "cplane.hpp"
#include "julia.h"
//This is the main program to generate data points for the mandelbrot visualization
int main (int argc, char **argv) {
/************************************************************************************
* Function: int main()
* Input : xmin, xmax, ymin, ymax, xpoints, ypoints
* Output : Returns 0 on success
* Procedure: Performs operations on complex numbers and prints results.
************************************************************************************/
// exploit namespaces to simplify code
using namespace boost::numeric::ublas;
using std::cout; using std::endl;
std::cout.sync_with_stdio(false);
// check for input parameters
if ( argc != 7) {
cout << " The program is expecting 6 input parameters, you entered :" << argc-1 << endl;
return(-1);
};
// Initialize all the parameters
CPLANE cplane;
int MAXITER=256;
char *e;
VALUE xmin = strtold(argv[1], &e);
VALUE xmax = strtold(argv[2], &e);
VALUE ymin = strtold(argv[3], &e);
VALUE ymax = strtold(argv[4], &e);
INDEX xpoints = strtoul(argv[5], &e, 0);
INDEX ypoints = strtoul(argv[6], &e,0);
MAT_TYPE mat;
MAT_VALUE c_val, z_val;
INDEX rows, cols;
mat = cplane.set_matrix(xmin,xmax,ymin,ymax,xpoints,ypoints);
//cplane.print_matrix(mat);
//Traverse through the matrix
for(rows=0; rows<ypoints; rows++) {
for(cols=0; cols<xpoints; cols++) {
//c_val = cplane.get_value(mat,rows,cols);
c_val = mat(rows,cols);
// Initialize the z_val
z_val.real()=0.0;
z_val.imag()=0.0;
int m = 0;
while (1) {
z_val = juliamap(z_val,c_val);
++m;
// cout <<"Absolute Value " << abs(z_val) << endl;
if (abs(z_val.real()+z_val.imag()) > 2) {
cout << c_val.real() << "," << c_val.imag()<< "," << m << endl ;
break;
}
else if ( m >= MAXITER) {
cout << c_val.real() << "," << c_val.imag()<< "," << 0 << endl ;
break;
};
}; /* end of while loop */
}; /* end of cols */
}; /* end of rows */
//comp_val = cplane.get_value(mat,1,0);
return 0;
}
|
262cfce68997856456963dea83c71ce265f5eb57 | b5d9ddecb5785613375516b4c434b230114c8d3e | /student.hpp | 2c06231904c3d3109c47acf7560f091fcf95a05a | [] | no_license | DawidSwistak/university_db | dd40323049d94700267991dde129c2dc8e3b0ee0 | f597a3e07d41c6ff854d216388d1143494b973bd | refs/heads/main | 2023-09-02T19:52:21.335752 | 2021-11-17T12:29:53 | 2021-11-17T12:29:53 | 424,863,275 | 0 | 0 | null | 2021-11-17T12:24:31 | 2021-11-05T07:32:55 | C++ | UTF-8 | C++ | false | false | 699 | hpp | student.hpp | #pragma once
#include <iostream>
enum class Gender
{
man,
woman
};
class Student
{
private:
std::string name_;
std::string surname_;
std::string addres_;
int indexNumber_;
long pesel_;
Gender gender_;
public:
std::string getName() const;
std::string getSurname() const;
std::string getAddres() const;
int getIndexNumber() const;
long getPesel() const;
Gender getGender() const;
std::string getGenderAsString() const;
Student(std::string name = "name", std::string surname = "surname", std::string addres = "addres",
int indexNumber = 0, long pesel = 0, Gender gender = Gender::man);
};
|
e7ea329eab657789f1595dbaaf9925612f206108 | d084c38697d64f432288282c397d80630a0795c9 | /src/ESBAddInSimulator/src/ESBAddInSimulator.cpp | a4355ba28cbb2bad3270b3ea41beb0b5892e9f4a | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | 124327288/BeSweet | 6e0d9dd863b8e5a0927eb693c4d1ec80c7e3f880 | fc58c24a32a96cc4026fdf2ff97c1a99b89ba86f | refs/heads/master | 2021-06-13T02:49:41.213640 | 2017-04-20T20:03:29 | 2017-04-20T20:03:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,381 | cpp | ESBAddInSimulator.cpp | /**
/* Copyright (c) 2003by Marco Welti
/*
/* This document is bound by the QT Public License
/* (http://www.trolltech.com/licenses/qpl.html).
/* See License.txt for more information.
/*
/*
/*
/* ALL RIGHTS RESERVED.
/*
/* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
/*
/***********************************************************************/
// ESBAddInSimulator.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "ESBAddInSimulator.h"
#include "ESBAddInSimulatorDlg.h"
#include "ESBDSAddInImplX.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ESBAddInSimulatorApp
BEGIN_MESSAGE_MAP(ESBAddInSimulatorApp, CWinApp)
//{{AFX_MSG_MAP(ESBAddInSimulatorApp)
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// ESBAddInSimulatorApp construction
ESBAddInSimulatorApp::ESBAddInSimulatorApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only ESBAddInSimulatorApp object
ESBAddInSimulatorApp theApp;
/////////////////////////////////////////////////////////////////////////////
// ESBAddInSimulatorApp initialization
BOOL ESBAddInSimulatorApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
//SimulatorComModule::instance().UpdateRegistryFromResource(IDR_ESBDSADDIN, TRUE);
//SimulatorComModule::instance().RegisterServer(TRUE);
SimulatorComModule::instance().InitializeATL();
//AddinSimulator::setupComStuff();
ESBAddInSimulatorDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// SimulatorComModule::instance().UpdateRegistryFromResource(IDR_ESBDSADDIN, FALSE);
//SimulatorComModule::instance().UnregisterServer(TRUE); //TRUE means typelib is unreg'd
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
|
365817022bdc2fbb90ec6d083b3f4f8bbff2b49d | 536656cd89e4fa3a92b5dcab28657d60d1d244bd | /ash/ambient/model/photo_model_unittest.cc | b718db44e719bb20832e61e7c416956119eab13b | [
"BSD-3-Clause"
] | permissive | ECS-251-W2020/chromium | 79caebf50443f297557d9510620bf8d44a68399a | ac814e85cb870a6b569e184c7a60a70ff3cb19f9 | refs/heads/master | 2022-08-19T17:42:46.887573 | 2020-03-18T06:08:44 | 2020-03-18T06:08:44 | 248,141,336 | 7 | 8 | BSD-3-Clause | 2022-07-06T20:32:48 | 2020-03-18T04:52:18 | null | UTF-8 | C++ | false | false | 3,963 | cc | photo_model_unittest.cc | // Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/ambient/model/photo_model.h"
#include "ash/ambient/model/photo_model_observer.h"
#include "ash/test/ash_test_base.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_unittest_util.h"
#include "ui/views/controls/image_view.h"
namespace ash {
namespace {
// This class has a local in memory cache of downloaded photos. This is the max
// number of photos before and after currently shown image.
constexpr int kImageBufferLength = 3;
} // namespace
class PhotoModelTest : public AshTestBase {
public:
PhotoModelTest() = default;
~PhotoModelTest() override = default;
void SetUp() override {
AshTestBase::SetUp();
model_ = std::make_unique<PhotoModel>();
model_->set_buffer_length_for_testing(kImageBufferLength);
}
void TearDown() override {
model_.reset();
AshTestBase::TearDown();
}
protected:
std::unique_ptr<PhotoModel> model_;
private:
DISALLOW_COPY_AND_ASSIGN(PhotoModelTest);
};
// Test adding the first image.
TEST_F(PhotoModelTest, AddFirstImage) {
gfx::ImageSkia first_image =
gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10);
model_->AddNextImage(first_image);
EXPECT_TRUE(model_->GetPrevImage().isNull());
EXPECT_TRUE(model_->GetCurrImage().BackedBySameObjectAs(first_image));
EXPECT_TRUE(model_->GetNextImage().isNull());
}
// Test adding the second image.
TEST_F(PhotoModelTest, AddSecondImage) {
gfx::ImageSkia first_image =
gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10);
gfx::ImageSkia second_image =
gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10);
// First |AddNextImage| will set |current_image_index_| to 0.
model_->AddNextImage(first_image);
model_->AddNextImage(second_image);
EXPECT_TRUE(model_->GetPrevImage().isNull());
EXPECT_TRUE(model_->GetCurrImage().BackedBySameObjectAs(first_image));
EXPECT_TRUE(model_->GetNextImage().BackedBySameObjectAs(second_image));
// Increment the |current_image_index_| to 1.
model_->ShowNextImage();
EXPECT_TRUE(model_->GetPrevImage().BackedBySameObjectAs(first_image));
EXPECT_TRUE(model_->GetCurrImage().BackedBySameObjectAs(second_image));
EXPECT_TRUE(model_->GetNextImage().isNull());
}
// Test adding the third image.
TEST_F(PhotoModelTest, AddThirdImage) {
gfx::ImageSkia first_image =
gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10);
gfx::ImageSkia second_image =
gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10);
gfx::ImageSkia third_image =
gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10);
// The default |current_image_index_| is 0.
model_->AddNextImage(first_image);
model_->AddNextImage(second_image);
model_->AddNextImage(third_image);
EXPECT_TRUE(model_->GetPrevImage().isNull());
EXPECT_TRUE(model_->GetCurrImage().BackedBySameObjectAs(first_image));
EXPECT_TRUE(model_->GetNextImage().BackedBySameObjectAs(second_image));
// Increment the |current_image_index_| to 1.
model_->ShowNextImage();
EXPECT_TRUE(model_->GetPrevImage().BackedBySameObjectAs(first_image));
EXPECT_TRUE(model_->GetCurrImage().BackedBySameObjectAs(second_image));
EXPECT_TRUE(model_->GetNextImage().BackedBySameObjectAs(third_image));
// Pop the |images_| front and keep the |current_image_index_| to 1.
model_->ShowNextImage();
EXPECT_TRUE(model_->GetPrevImage().BackedBySameObjectAs(second_image));
EXPECT_TRUE(model_->GetCurrImage().BackedBySameObjectAs(third_image));
EXPECT_TRUE(model_->GetNextImage().isNull());
// ShowNextImage() will early return.
model_->ShowNextImage();
EXPECT_TRUE(model_->GetPrevImage().BackedBySameObjectAs(second_image));
EXPECT_TRUE(model_->GetCurrImage().BackedBySameObjectAs(third_image));
EXPECT_TRUE(model_->GetNextImage().isNull());
}
} // namespace ash
|
868bde0ff048786e25beec3b9467d862b73e3d22 | 0ba2bb448e83bdca8d5b33f3cf044c64bfbd8cb8 | /Mutex.hh | c320d0f773d77316137cb7de282c203cc8b95637 | [] | no_license | Azimdur/Test | f7e1ef14d60c65e60ccebd0f5243441e4c178d61 | 9043d3dab1a3882c623fbe26b47ae168ba3c47fe | refs/heads/master | 2021-01-23T07:29:51.039342 | 2014-04-21T20:14:07 | 2014-04-21T20:14:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 571 | hh | Mutex.hh | #ifndef MUTEX_HH__
# define MUTEX_HH__
# include "IMutex.hh"
class Mutex : public IMutex
{
public:
Mutex() {
this->_mutex = PTHREAD_MUTEX_INITIALIZER;
}
~Mutex() {
pthread_mutex_destroy(&this->_mutex);
}
public:
void lock() {
pthread_mutex_lock(&this->_mutex);
}
void unlock() {
pthread_mutex_unlock(&this->_mutex);
}
bool trylock() {
if (pthread_mutex_trylock(&this->_mutex) != 0)
return false;
return true;
}
pthread_mutex_t getMut() const {return this->_mutex;}
private:
pthread_mutex_t _mutex;
};
#endif
|
0a985c282f0bf0becb79ecef8e307a5d8fd2a5ca | c1b03b59b3974058e3dc4e3aa7a46a7ab9cc3b29 | /src/module-wx/Class_wx_GridellStringRenderer.h | e7752f8e83b6ea7d8ef34e60f09c5166d4820bb1 | [] | no_license | gura-lang/gura | 972725895c93c22e0ec87c17166df4d15bdbe338 | 03aff5e2b7fe4f761a16400ae7cc6fa7fec73a47 | refs/heads/master | 2021-01-25T08:04:38.269289 | 2020-05-09T12:42:23 | 2020-05-09T12:42:23 | 7,141,465 | 25 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,443 | h | Class_wx_GridellStringRenderer.h | //----------------------------------------------------------------------------
// wxGridellStringRenderer
// (automatically generated)
//----------------------------------------------------------------------------
#ifndef __CLASS_WX_GRIDELLSTRINGRENDERER_H__
#define __CLASS_WX_GRIDELLSTRINGRENDERER_H__
Gura_BeginModuleScope(wx)
//----------------------------------------------------------------------------
// Class declaration for wxGridellStringRenderer
//----------------------------------------------------------------------------
Gura_DeclareUserClass(wx_GridellStringRenderer);
//----------------------------------------------------------------------------
// Object declaration for wxGridellStringRenderer
//----------------------------------------------------------------------------
class Object_wx_GridellStringRenderer : public Object {
protected:
wxGridellStringRenderer *_pEntity;
GuraObjectObserver *_pObserver;
bool _ownerFlag;
public:
Gura_DeclareObjectAccessor(wx_GridellStringRenderer)
public:
inline Object_wx_GridellStringRenderer(wxGridellStringRenderer *pEntity, GuraObjectObserver *pObserver, bool ownerFlag) :
Object(Gura_UserClass(wx_GridellStringRenderer)),
_pEntity(pEntity), _pObserver(pObserver), _ownerFlag(ownerFlag) {}
inline Object_wx_GridellStringRenderer(Class *pClass, wxGridellStringRenderer *pEntity, GuraObjectObserver *pObserver, bool ownerFlag) :
Object(pClass), _pEntity(pEntity), _pObserver(pObserver), _ownerFlag(ownerFlag) {}
virtual ~Object_wx_GridellStringRenderer();
virtual Object *Clone() const;
virtual String ToString(bool exprFlag);
inline void SetEntity(wxGridellStringRenderer *pEntity, GuraObjectObserver *pObserver, bool ownerFlag) {
if (_ownerFlag) delete _pEntity;
_pEntity = pEntity;
_pObserver = pObserver;
_ownerFlag = ownerFlag;
}
inline void InvalidateEntity() { _pEntity = nullptr, _pObserver = nullptr, _ownerFlag = false; }
inline wxGridellStringRenderer *GetEntity() { return _pEntity; }
inline wxGridellStringRenderer *ReleaseEntity() {
wxGridellStringRenderer *pEntity = GetEntity();
InvalidateEntity();
return pEntity;
}
inline void NotifyGuraObjectDeleted() {
if (_pObserver != nullptr) _pObserver->GuraObjectDeleted();
}
inline bool IsInvalid(Signal &sig) const {
if (_pEntity != nullptr) return false;
SetError_InvalidWxObject(sig, "wxGridellStringRenderer");
return true;
}
};
Gura_EndModuleScope(wx)
#endif
|
399d5eeda4dd1c687639f1c2da40e4392d1ae453 | 1c7c6cb58250ad5c97b9f80163db7605d67fffba | /baglist4.cpp | 130c06b172ec81f41eb6c45d7476706a04c7fa17 | [] | no_license | ogunduz1/C-Learning | eae6852e34c9c93e38d3b05457539b6938111c76 | 5996bbac07d602049411bade77fb4c9441cae3a0 | refs/heads/master | 2022-07-27T16:12:22.268744 | 2020-05-18T14:08:38 | 2020-05-18T14:08:38 | 264,924,513 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,784 | cpp | baglist4.cpp | //linked list de araya data ekleme uygulaması
#include <stdio.h>
#include <stdlib.h>
/*bu struct ve typedef kullanım şekline gcc de hata veriyor,
*bu nedenle programı .c değil de .cpp uzantısı ile kaydedip,
*g++ ile compile etmek gerekiyor.
*g++ baglist.cpp
*./a.out
*/
struct n{
int data;
n * next;
};
typedef n node;
void bastir(node *);
void ekle(node *,int);
int main() {
node *root;
root=(node *)malloc(sizeof(node));
root->next=NULL;
root->data=10;
for(int i=0;i<10;i++) {
ekle(root,i*10);//hep en baştan yazar
}
bastir(root);//belirtilen yerden liste sonuna kadar basıtırır.
//3. elemandan sonra araya data eklenecek
node *iter;
iter=root;
//iteri üç kez öteliyoruz
for (int i=0;i<3;i++) {
iter=iter->next;
}
//yeni düğüm oluşturuyoruz
//kaybetmemek için gecici pointer kullanıyoruz.
node *temp=(node *)malloc(sizeof(node));
//yeni node'ın bir sonraki nodesi araya girdikten sonraki node olmalı, bu nedenle temp->nexti bir sonraki node ye bağlıyoruz
temp->next=iter->next;
/*şimdi de yeni nodeyi araya girdiği yerin önceki node sine bağlamak gerekli
*bu nedenle ötelenmiş iteri bu yeni nodeye bağlıyoruz.*/
iter->next=temp;
temp->data=99;
bastir(root);
return 0;
}
void bastir(node*r) {
while(r!=NULL) {
printf("\n%d\n",r->data);
r=r->next;
}
}
void ekle(node *r,int x) {
while (r->next!=NULL) {//son elemana gitmeyi sağlar
r=r->next;
}
r->next=(node*)malloc(sizeof(node));//alan aç
r->next->data=x;
r->next->next=NULL;
}
/*Dizilere erişim Random'dır,
*Bağlı listelere erişim ise squential 'dır,
*dizilerde herhangi bir elemana doğrudan erişmek mümkün,
*bağlı listelerde adım adım gidilir, çünkü bir elemanın adresi
*sadece bir önceki elemandadır.*/
|
a24e4369cafbe49523c6cdb6fc1bf808df59e920 | 26909fe43b46431fc9180c9fbe0932f817ca9d34 | /texture.h | a708522e9f13cbb553fe835df729e6eb86624127 | [] | no_license | mirmashel/rays | 26e7d25b4fe38f05b9d8d89f0056bfd95d6b9ed3 | 9d7de29b91370563db8ef3915f3bd02abb1c90da | refs/heads/master | 2021-03-11T19:47:04.699714 | 2020-03-17T15:49:07 | 2020-03-17T15:49:07 | 246,555,156 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,488 | h | texture.h | //
// Created by maxim on 13.03.2020.
//
#ifndef RAYS_TEXTURE_H
#define RAYS_TEXTURE_H
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
#include <glm/glm.hpp>
#include <iostream>
class Texture {
private:
int w, h, c;
unsigned char *image;
int get_w_coord(float w_coord) const {
return ((int) std::floor(w_coord) + w) % w;
}
int get_h_coord(float h_coord) const {
return ((int) std::floor(h_coord) + h) % h;
}
public:
Texture(const char *picture_name) {
image = stbi_load(picture_name, &w, &h, &c, STBI_rgb);
if (!image)
std::cout << "Problema s kartinkoy" << std::endl;
}
glm::vec3 get_pixel_color(glm::vec2 coords) const { // x, y E (0, 1),
coords *= glm::vec2(h, w);
int c_h = coords.x;
int c_w = coords.y;
// std::cout << c_h << " " << c_w << std::endl;
glm::vec2 coords1 = coords + glm::vec2(0.5, 0.5),
coords2 = coords + glm::vec2(0.5, -0.5),
coords3 = coords + glm::vec2(-0.5, 0.5),
coords4 = coords + glm::vec2(-0.5, -0.5);
// return glm::vec3(image[3 * (w * c_h + c_w) + 0], image[3 * (w * c_h + c_w) + 1], image[3 * (w * c_h + c_w) + 2]) / 255.f;
return (glm::vec3(
image[3 * (w * get_h_coord(coords1.x) + get_w_coord(coords1.y)) + 0],
image[3 * (w * get_h_coord(coords1.x) + get_w_coord(coords1.y)) + 1],
image[3 * (w * get_h_coord(coords1.x) + get_w_coord(coords1.y)) + 2]
) + glm::vec3(
image[3 * (w * get_h_coord(coords2.x) + get_w_coord(coords2.y)) + 0],
image[3 * (w * get_h_coord(coords2.x) + get_w_coord(coords2.y)) + 1],
image[3 * (w * get_h_coord(coords2.x) + get_w_coord(coords2.y)) + 2]
) + glm::vec3(
image[3 * (w * get_h_coord(coords3.x) + get_w_coord(coords3.y)) + 0],
image[3 * (w * get_h_coord(coords3.x) + get_w_coord(coords3.y)) + 1],
image[3 * (w * get_h_coord(coords3.x) + get_w_coord(coords3.y)) + 2]
) + glm::vec3(
image[3 * (w * get_h_coord(coords4.x) + get_w_coord(coords4.y)) + 0],
image[3 * (w * get_h_coord(coords4.x) + get_w_coord(coords4.y)) + 1],
image[3 * (w * get_h_coord(coords4.x) + get_w_coord(coords4.y)) + 2]
)) / 255.f / 4.f;
}
~Texture() {
stbi_image_free(image);
}
};
#endif //RAYS_TEXTURE_H
|
542ff273f8fe79ee7c4bf7552a18f258be82d5bf | c5c70f59b66cbd582c625a0a9df6c38185f265e0 | /SPOJ/BONUS.cpp | 986d2057c43eb537f6545f7fa09edfe80b81ba52 | [] | no_license | hoangvanthien/codeForest | 7ad0475c82443bd3d6a9a4fd8e6a7369b70fec53 | ea0c3684812edc3460b97358da53a23e7f7dd87e | refs/heads/master | 2021-01-17T21:11:50.058953 | 2017-04-07T13:43:11 | 2017-04-07T13:43:11 | 72,915,694 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,219 | cpp | BONUS.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,x,y) for(int i = (x); i<=(y); ++i)
#define DFOR(i,x,y) for(int i = (x); i>=(y); --i)
#define maxN 1002
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define oo 1e9+7
#define II pair<int,int>
#define LL long long
int n,K,a[maxN][maxN],f[maxN][maxN];
void init()
{
#ifndef ONLINE_JUDGE
freopen("input.inp", "r", stdin);
#endif // ONLINE_JUDGE
std::ios::sync_with_stdio(false);
scanf("%d%d", &n, &K);
FOR(i,1,n) FOR(j,1,n) scanf("%d", &a[i][j]);
}
void print()
{
}
int main()
{
init();
FOR(i,1,n)
{
FOR(j,1,n)
{
f[i][j] = f[i-1][j] + a[i][j];
//printf("%d ", f[i][j]);
}
//printf("\n");
}
int ans = 0;
FOR(i,1,n)
{
int j = i+K-1;
{
int k = 1, sum = 0;
while (k <= K)
{
sum += f[j][k] - f[i-1][k++];
}
ans = max(ans, sum);
while (k <= n)
{
sum += f[j][k] - f[i-1][k];
sum -= f[j][k-K] - f[i-1][k-K];
ans = max(ans, sum);
k++;
}
}
}
printf("%d", ans);
}
|
400ed4696cf8f711226c688f310603307d265270 | 1eac0a9fd10d68ebe991cfa545af6b483833088d | /arduino/RFIDWrite/RFIDWrite.ino | ff6ed5eec198059532ec7ad052f6909bf8fb924f | [] | no_license | emreakcan/Secure-Attandance-System-with-Arduino | b9dcdbca50c8026707091c63205c6fb0c2ac787c | ac87db3b65ae1480793c97dcea6c4705ac02474b | refs/heads/master | 2022-08-28T19:03:58.967279 | 2020-05-24T22:43:09 | 2020-05-24T22:43:09 | 266,510,748 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,187 | ino | RFIDWrite.ino |
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9 // Configurable, see typical pin layout above
#define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
Serial.println(F("Write personal data on a MIFARE PICC "));
}
void loop() {
// Prepare key - all keys are set to FFFFFFFFFFFFh and authenticate
MFRC522::MIFARE_Key key;
for (byte i = 0; i < 6; i++) key.keyByte[i] = 0xFF;
// Reset the loop if no new card present on the sensor/reader. This saves the entire process when idle.
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
// Serial.print(F("Card UID:")); //Dump UID
String currentUID;
for (byte i = 0; i < mfrc522.uid.size; i++) {
currentUID += String(mfrc522.uid.uidByte[i], HEX);
}
Serial.println("#"+currentUID);
Serial.print(F(" PICC type: ")); // Dump PICC type
MFRC522::PICC_Type piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
Serial.println(mfrc522.PICC_GetTypeName(piccType));
byte buffer[56];
byte block;
MFRC522::StatusCode status;
byte len;
Serial.setTimeout(20000L) ; // wait until 20 seconds for input from serial
Serial.println(F("Type tcno hash, ending with #"));
len = Serial.readBytesUntil('#', (char *) buffer, 56) ;
block = 1;
//authenticate using key A
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, block, &key, &(mfrc522.uid));
if (status != MFRC522::STATUS_OK) {
Serial.print(F("PCD_Authenticate() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
else Serial.println(F("PCD_Authenticate() success: "));
// Write block
status = mfrc522.MIFARE_Write(block, buffer, 16);
if (status != MFRC522::STATUS_OK) {
Serial.print(F("MIFARE_Write() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
else Serial.println(F("MIFARE_Write() success: "));
block = 2;
//Serial.println(F("Authenticating using key A..."));
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, block, &key, &(mfrc522.uid));
if (status != MFRC522::STATUS_OK) {
Serial.print(F("PCD_Authenticate() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
// Write block
status = mfrc522.MIFARE_Write(block, &buffer[16], 16);
if (status != MFRC522::STATUS_OK) {
Serial.print(F("MIFARE_Write() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
else Serial.println(F("MIFARE_Write() success: "));
block = 8;
//Serial.println(F("Authenticating using key A..."));
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, block, &key, &(mfrc522.uid));
if (status != MFRC522::STATUS_OK) {
Serial.print(F("PCD_Authenticate() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
// Write block
status = mfrc522.MIFARE_Write(block, &buffer[32], 16);
if (status != MFRC522::STATUS_OK) {
Serial.print(F("MIFARE_Write() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
else Serial.println(F("MIFARE_Write() success: "));
block = 9;
//Serial.println(F("Authenticating using key A..."));
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, block, &key, &(mfrc522.uid));
if (status != MFRC522::STATUS_OK) {
Serial.print(F("PCD_Authenticate() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
// Write block
status = mfrc522.MIFARE_Write(block, &buffer[48], 16);
if (status != MFRC522::STATUS_OK) {
Serial.print(F("MIFARE_Write() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
else Serial.println(F("1"));
mfrc522.PICC_HaltA(); // Halt PICC
mfrc522.PCD_StopCrypto1(); // Stop encryption on PCD
}
bool MIFARE_SetKeys(MFRC522::MIFARE_Key* oldKeyA, MFRC522::MIFARE_Key* oldKeyB,
MFRC522::MIFARE_Key* newKeyA, MFRC522::MIFARE_Key* newKeyB,
int sector) {
MFRC522::StatusCode status;
byte trailerBlock = sector * 4 + 3;
byte buffer[18];
byte size = sizeof(buffer);
// Authenticate using key A
Serial.println(F("Authenticating using key A..."));
status = (MFRC522::StatusCode)mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, trailerBlock, oldKeyA, &(mfrc522.uid));
if (status != MFRC522::STATUS_OK) {
Serial.print(F("PCD_Authenticate() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return false;
}
// Show the whole sector as it currently is
Serial.println(F("Current data in sector:"));
mfrc522.PICC_DumpMifareClassicSectorToSerial(&(mfrc522.uid), oldKeyA, sector);
Serial.println();
// Read data from the block
Serial.print(F("Reading data from block ")); Serial.print(trailerBlock);
Serial.println(F(" ..."));
status = (MFRC522::StatusCode) mfrc522.MIFARE_Read(trailerBlock, buffer, &size);
if (status != MFRC522::STATUS_OK) {
Serial.print(F("MIFARE_Read() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return false;
}
Serial.print(F("Data in block ")); Serial.print(trailerBlock); Serial.println(F(":"));
//dump_byte_array(buffer, 16); Serial.println();
Serial.println();
// Authenticate using key B
Serial.println(F("Authenticating again using key B..."));
status = (MFRC522::StatusCode)mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_B, trailerBlock, oldKeyB, &(mfrc522.uid));
if (status != MFRC522::STATUS_OK) {
Serial.print(F("PCD_Authenticate() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return false;
}
if (newKeyA != nullptr || newKeyB != nullptr) {
for (byte i = 0; i < MFRC522::MF_KEY_SIZE; i++) {
if (newKeyA != nullptr) {
buffer[i] = newKeyA->keyByte[i];
}
if (newKeyB != nullptr) {
buffer[i+10] = newKeyB->keyByte[i];
}
}
}
// Write data to the block
Serial.print(F("Writing data into block ")); Serial.print(trailerBlock);
Serial.println(F(" ..."));
status = (MFRC522::StatusCode) mfrc522.MIFARE_Write(trailerBlock, buffer, 16);
if (status != MFRC522::STATUS_OK) {
Serial.print(F("MIFARE_Write() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return false;
}
Serial.println();
// Read data from the block (again, should now be what we have written)
Serial.print(F("Reading data from block ")); Serial.print(trailerBlock);
Serial.println(F(" ..."));
status = (MFRC522::StatusCode)mfrc522.MIFARE_Read(trailerBlock, buffer, &size);
if (status != MFRC522::STATUS_OK) {
Serial.print(F("MIFARE_Read() failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
}
Serial.print(F("Data in block ")); Serial.print(trailerBlock); Serial.println(F(":"));
return true;
}
|
e6f404711ce044ddeca9eb7e35b8b66a307984e4 | 1cef07a7383f629aea3700ebb9cd1387481a8136 | /source/driver/Driver.cpp | 6c1282fadc1f85f46c1df0ad41fb31d02c082648 | [
"MIT"
] | permissive | Kuree/slang | 824d69bafa823816af163bc92039b3419edaf595 | b556ff03213d3e13f24d210b5829245207bad384 | refs/heads/master | 2023-04-26T02:16:31.548973 | 2023-04-16T18:44:03 | 2023-04-16T18:44:03 | 192,255,462 | 0 | 0 | MIT | 2019-06-17T01:35:15 | 2019-06-17T01:35:15 | null | UTF-8 | C++ | false | false | 32,193 | cpp | Driver.cpp | //------------------------------------------------------------------------------
// Driver.cpp
// Top-level handler for processing arguments and
// constructing a compilation for a CLI tool.
//
// SPDX-FileCopyrightText: Michael Popoloski
// SPDX-License-Identifier: MIT
//------------------------------------------------------------------------------
#include "slang/driver/Driver.h"
#include <fmt/color.h>
#include "slang/ast/symbols/CompilationUnitSymbols.h"
#include "slang/ast/symbols/InstanceSymbols.h"
#include "slang/diagnostics/DeclarationsDiags.h"
#include "slang/diagnostics/ExpressionsDiags.h"
#include "slang/diagnostics/LookupDiags.h"
#include "slang/diagnostics/ParserDiags.h"
#include "slang/diagnostics/StatementsDiags.h"
#include "slang/diagnostics/SysFuncsDiags.h"
#include "slang/diagnostics/TextDiagnosticClient.h"
#include "slang/parsing/Parser.h"
#include "slang/parsing/Preprocessor.h"
#include "slang/syntax/SyntaxPrinter.h"
#include "slang/syntax/SyntaxTree.h"
#include "slang/util/Random.h"
namespace fs = std::filesystem;
namespace slang::driver {
using namespace ast;
using namespace parsing;
using namespace syntax;
Driver::Driver() : diagEngine(sourceManager) {
diagClient = std::make_shared<TextDiagnosticClient>();
diagEngine.addClient(diagClient);
}
void Driver::addStandardArgs() {
// Include paths
cmdLine.add("-I,--include-directory,+incdir", options.includeDirs,
"Additional include search paths", "<dir>", /* isFileName */ true);
cmdLine.add("--isystem", options.includeSystemDirs, "Additional system include search paths",
"<dir>",
/* isFileName */ true);
cmdLine.add("-y,--libdir", options.libDirs,
"Library search paths, which will be searched for missing modules", "<dir>",
/* isFileName */ true);
cmdLine.add("-Y,--libext", options.libExts, "Additional library file extensions to search",
"<ext>");
cmdLine.add(
"--exclude-ext",
[this](std::string_view value) {
options.excludeExts.emplace(std::string(value));
return "";
},
"Exclude provided source files with these extensions", "<ext>");
// Preprocessor
cmdLine.add("-D,--define-macro,+define", options.defines,
"Define <macro> to <value> (or 1 if <value> ommitted) in all source files",
"<macro>=<value>");
cmdLine.add("-U,--undefine-macro", options.undefines,
"Undefine macro name at the start of all source files", "<macro>");
cmdLine.add("--max-include-depth", options.maxIncludeDepth,
"Maximum depth of nested include files allowed", "<depth>");
cmdLine.add("--libraries-inherit-macros", options.librariesInheritMacros,
"If true, library files will inherit macro definitions from the primary source "
"files. --single-unit must also be passed when this option is used.");
// Legacy vendor commands support
cmdLine.add(
"--cmd-ignore", [this](std::string_view value) { return cmdLine.addIgnoreCommand(value); },
"Define rule to ignore vendor command <vendor_cmd> with its following <N> parameters.\n"
"A command of the form +xyz will also match any vendor command of the form +xyz+abc,\n"
"as +abc is the command's argument, and doesn't need to be matched.",
"<vendor_cmd>,<N>");
cmdLine.add(
"--cmd-rename", [this](std::string_view value) { return cmdLine.addRenameCommand(value); },
"Define rule to rename vendor command <vendor_cmd> into existing <slang_cmd>",
"<vendor_cmd>,<slang_cmd>");
cmdLine.add("--ignore-directive", options.ignoreDirectives,
"Ignore preprocessor directive and all its arguments until EOL", "<directive>");
// Parsing
cmdLine.add("--max-parse-depth", options.maxParseDepth,
"Maximum depth of nested language constructs allowed", "<depth>");
cmdLine.add("--max-lexer-errors", options.maxLexerErrors,
"Maximum number of errors that can occur during lexing before the rest of the file "
"is skipped",
"<count>");
// Compilation
cmdLine.add("--max-hierarchy-depth", options.maxInstanceDepth,
"Maximum depth of the design hierarchy", "<depth>");
cmdLine.add("--max-generate-steps", options.maxGenerateSteps,
"Maximum number of steps that can occur during generate block "
"evaluation before giving up",
"<steps>");
cmdLine.add("--max-constexpr-depth", options.maxConstexprDepth,
"Maximum depth of a constant evaluation call stack", "<depth>");
cmdLine.add("--max-constexpr-steps", options.maxConstexprSteps,
"Maximum number of steps that can occur during constant "
"evaluation before giving up",
"<steps>");
cmdLine.add("--constexpr-backtrace-limit", options.maxConstexprBacktrace,
"Maximum number of frames to show when printing a constant evaluation "
"backtrace; the rest will be abbreviated",
"<limit>");
cmdLine.add("--max-instance-array", options.maxInstanceArray,
"Maximum number of instances allowed in a single instance array", "<limit>");
cmdLine.add("--compat", options.compat,
"Attempt to increase compatibility with the specified tool", "vcs");
cmdLine.add("-T,--timing", options.minTypMax,
"Select which value to consider in min:typ:max expressions", "min|typ|max");
cmdLine.add("--timescale", options.timeScale,
"Default time scale to use for design elements that don't specify one explicitly",
"<base>/<precision>");
cmdLine.add("--allow-use-before-declare", options.allowUseBeforeDeclare,
"Don't issue an error for use of names before their declarations.");
cmdLine.add("--ignore-unknown-modules", options.ignoreUnknownModules,
"Don't issue an error for instantiations of unknown modules, "
"interface, and programs.");
cmdLine.add("--relax-enum-conversions", options.relaxEnumConversions,
"Allow all integral types to convert implicitly to enum types.");
cmdLine.add("--allow-hierarchical-const", options.allowHierarchicalConst,
"Allow hierarchical references in constant expressions.");
cmdLine.add("--allow-dup-initial-drivers", options.allowDupInitialDrivers,
"Allow signals driven in an always_comb or always_ff block to also be driven "
"by initial blocks.");
cmdLine.add("--strict-driver-checking", options.strictDriverChecking,
"Perform strict driver checking, which currently means disabling "
"procedural 'for' loop unrolling.");
cmdLine.add("--lint-only", options.onlyLint,
"Only perform linting of code, don't try to elaborate a full hierarchy");
cmdLine.add("--top", options.topModules,
"One or more top-level modules to instantiate "
"(instead of figuring it out automatically)",
"<name>");
cmdLine.add("-G", options.paramOverrides,
"One or more parameter overrides to apply when "
"instantiating top-level modules",
"<name>=<value>");
// Diagnostics control
cmdLine.add("-W", options.warningOptions, "Control the specified warning", "<warning>");
cmdLine.add("--color-diagnostics", options.colorDiags,
"Always print diagnostics in color."
"If this option is unset, colors will be enabled if a color-capable "
"terminal is detected.");
cmdLine.add("--diag-column", options.diagColumn, "Show column numbers in diagnostic output.");
cmdLine.add("--diag-location", options.diagLocation,
"Show location information in diagnostic output.");
cmdLine.add("--diag-source", options.diagSourceLine,
"Show source line or caret info in diagnostic output.");
cmdLine.add("--diag-option", options.diagOptionName, "Show option names in diagnostic output.");
cmdLine.add("--diag-include-stack", options.diagIncludeStack,
"Show include stacks in diagnostic output.");
cmdLine.add("--diag-macro-expansion", options.diagMacroExpansion,
"Show macro expansion backtraces in diagnostic output.");
cmdLine.add("--diag-hierarchy", options.diagHierarchy,
"Show hierarchy locations in diagnostic output.");
cmdLine.add("--error-limit", options.errorLimit,
"Limit on the number of errors that will be printed. Setting this to zero will "
"disable the limit.",
"<limit>");
cmdLine.add("--suppress-warnings", options.suppressWarningsPaths,
"One or more paths in which to suppress warnings", "<filename>",
/* isFileName */ true);
// File lists
cmdLine.add("--single-unit", options.singleUnit,
"Treat all input files as a single compilation unit");
cmdLine.add("-v", options.libraryFiles,
"One or more library files, which are separate compilation units "
"where modules are not automatically instantiated.",
"<filename>", /* isFileName */ true);
cmdLine.setPositional(
[this](std::string_view fileName) {
if (!options.excludeExts.empty()) {
if (size_t extIndex = fileName.find_last_of('.');
extIndex != std::string_view::npos) {
if (options.excludeExts.count(std::string(fileName.substr(extIndex + 1))))
return "";
}
}
SourceBuffer buffer = readSource(fileName);
if (!buffer)
anyFailedLoads = true;
buffers.push_back(buffer);
return "";
},
"files", /* isFileName */ true);
cmdLine.add(
"-f",
[this](std::string_view fileName) {
if (!processCommandFile(fileName, /* makeRelative */ false))
anyFailedLoads = true;
return "";
},
"One or more command files containing additional program options. "
"Paths in the file are considered relative to the current directory.",
"<filename>", /* isFileName */ true);
cmdLine.add(
"-F",
[this](std::string_view fileName) {
if (!processCommandFile(fileName, /* makeRelative */ true))
anyFailedLoads = true;
return "";
},
"One or more command files containing additional program options. "
"Paths in the file are considered relative to the file itself.",
"<filename>", /* isFileName */ true);
}
[[nodiscard]] bool Driver::parseCommandLine(std::string_view argList) {
if (!cmdLine.parse(argList)) {
for (auto& err : cmdLine.getErrors())
OS::printE(fmt::format("{}\n", err));
return false;
}
return !anyFailedLoads;
}
SourceBuffer Driver::readSource(std::string_view fileName) {
SourceBuffer buffer = sourceManager.readSource(widen(fileName));
if (!buffer) {
OS::printE(fg(diagClient->errorColor), "error: ");
OS::printE(fmt::format("no such file or directory: '{}'\n", fileName));
}
return buffer;
}
bool Driver::processCommandFile(std::string_view fileName, bool makeRelative) {
std::error_code ec;
fs::path path = fs::canonical(widen(fileName), ec);
std::vector<char> buffer;
if (ec || !OS::readFile(path, buffer)) {
OS::printE(fg(diagClient->errorColor), "error: ");
OS::printE(fmt::format("no such file or directory: '{}'\n", fileName));
return false;
}
fs::path currPath;
if (makeRelative) {
currPath = fs::current_path();
fs::current_path(path.parent_path());
}
CommandLine::ParseOptions parseOpts;
parseOpts.expandEnvVars = true;
parseOpts.ignoreProgramName = true;
parseOpts.supportComments = true;
parseOpts.ignoreDuplicates = true;
ASSERT(!buffer.empty());
buffer.pop_back();
std::string_view argStr(buffer.data(), buffer.size());
bool result = cmdLine.parse(argStr, parseOpts);
if (makeRelative)
fs::current_path(currPath);
if (!result) {
for (auto& err : cmdLine.getErrors())
OS::printE(fmt::format("{}\n", err));
return false;
}
return true;
}
bool Driver::processOptions() {
bool showColors;
if (options.colorDiags.has_value())
showColors = *options.colorDiags;
else
showColors = OS::fileSupportsColors(stderr);
if (showColors) {
OS::setStderrColorsEnabled(true);
if (OS::fileSupportsColors(stdout))
OS::setStdoutColorsEnabled(true);
}
if (options.compat.has_value()) {
if (options.compat == "vcs") {
if (!options.allowHierarchicalConst.has_value())
options.allowHierarchicalConst = true;
if (!options.allowUseBeforeDeclare.has_value())
options.allowUseBeforeDeclare = true;
if (!options.relaxEnumConversions.has_value())
options.relaxEnumConversions = true;
}
else {
OS::printE(fg(diagClient->errorColor), "error: ");
OS::printE(fmt::format("invalid value for compat option: '{}'", *options.compat));
return false;
}
}
if (options.minTypMax.has_value() && options.minTypMax != "min" && options.minTypMax != "typ" &&
options.minTypMax != "max") {
OS::printE(fg(diagClient->errorColor), "error: ");
OS::printE(fmt::format("invalid value for timing option: '{}'", *options.minTypMax));
return false;
}
if (options.librariesInheritMacros == true && !options.singleUnit.value_or(false)) {
OS::printE(fg(diagClient->errorColor), "error: ");
OS::printE("--single-unit must be set when --libraries-inherit-macros is used");
return false;
}
if (options.timeScale.has_value() && !TimeScale::fromString(*options.timeScale)) {
OS::printE(fg(diagClient->errorColor), "error: ");
OS::printE(fmt::format("invalid value for time scale option: '{}'", *options.timeScale));
return false;
}
if (options.onlyLint == true && !options.ignoreUnknownModules.has_value())
options.ignoreUnknownModules = true;
for (const std::string& dir : options.includeDirs) {
try {
sourceManager.addUserDirectory(std::string_view(dir));
}
catch (const std::exception&) {
OS::printE(fg(diagClient->warningColor), "warning: ");
OS::printE(fmt::format("include directory '{}' does not exist\n", dir));
}
}
for (const std::string& dir : options.includeSystemDirs) {
try {
sourceManager.addSystemDirectory(std::string_view(dir));
}
catch (const std::exception&) {
OS::printE(fg(diagClient->warningColor), "warning: ");
OS::printE(fmt::format("include directory '{}' does not exist\n", dir));
}
}
if (anyFailedLoads)
return false;
if (buffers.empty() && options.libraryFiles.empty()) {
OS::printE(fg(diagClient->errorColor), "error: ");
OS::printE("no input files\n");
return false;
}
auto& dc = *diagClient;
dc.showColors(showColors);
dc.showColumn(options.diagColumn.value_or(true));
dc.showLocation(options.diagLocation.value_or(true));
dc.showSourceLine(options.diagSourceLine.value_or(true));
dc.showOptionName(options.diagOptionName.value_or(true));
dc.showIncludeStack(options.diagIncludeStack.value_or(true));
dc.showMacroExpansion(options.diagMacroExpansion.value_or(true));
dc.showHierarchyInstance(options.diagHierarchy.value_or(true));
diagEngine.setErrorLimit((int)options.errorLimit.value_or(20));
diagEngine.setDefaultWarnings();
// Some tools violate the standard in various ways, but in order to allow
// compatibility with these tools, we change the respective errors into a
// suppressible warning that we promote to an error by default, allowing
// the user to turn this back into a warning, ot turn it off altogether.
// allow ignoring duplicate module/interface/program definitions,
diagEngine.setSeverity(diag::DuplicateDefinition, DiagnosticSeverity::Error);
// allow procedural force on variable part-select
diagEngine.setSeverity(diag::BadProceduralForce, DiagnosticSeverity::Error);
if (options.compat == "vcs") {
diagEngine.setSeverity(diag::StaticInitializerMustBeExplicit, DiagnosticSeverity::Ignored);
diagEngine.setSeverity(diag::ImplicitConvert, DiagnosticSeverity::Ignored);
diagEngine.setSeverity(diag::BadFinishNum, DiagnosticSeverity::Ignored);
diagEngine.setSeverity(diag::NonstandardSysFunc, DiagnosticSeverity::Ignored);
diagEngine.setSeverity(diag::NonstandardForeach, DiagnosticSeverity::Ignored);
diagEngine.setSeverity(diag::NonstandardDist, DiagnosticSeverity::Ignored);
}
else {
// These warnings are set to Error severity by default, unless we're in vcs compat mode.
// The user can always downgrade via warning options, which get set after this.
diagEngine.setSeverity(diag::IndexOOB, DiagnosticSeverity::Error);
diagEngine.setSeverity(diag::RangeOOB, DiagnosticSeverity::Error);
diagEngine.setSeverity(diag::RangeWidthOOB, DiagnosticSeverity::Error);
diagEngine.setSeverity(diag::ImplicitNamedPortTypeMismatch, DiagnosticSeverity::Error);
}
for (const std::string& path : options.suppressWarningsPaths)
diagEngine.addIgnorePath(fs::canonical(widen(path)));
Diagnostics optionDiags = diagEngine.setWarningOptions(options.warningOptions);
for (auto& diag : optionDiags)
diagEngine.issue(diag);
return true;
}
template<typename TGenerator>
static std::string generateRandomAlphanumericString(TGenerator& gen, size_t len) {
static constexpr auto chars = "0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"sv;
auto result = std::string(len, '\0');
std::generate_n(begin(result), len,
[&] { return chars[getUniformIntDist(gen, size_t(0), chars.size() - 1)]; });
return result;
}
bool Driver::runPreprocessor(bool includeComments, bool includeDirectives, bool obfuscateIds,
bool useFixedObfuscationSeed) {
BumpAllocator alloc;
Diagnostics diagnostics;
Preprocessor preprocessor(sourceManager, alloc, diagnostics, createOptionBag());
for (auto it = buffers.rbegin(); it != buffers.rend(); it++)
preprocessor.pushSource(*it);
SyntaxPrinter output;
output.setIncludeComments(includeComments);
output.setIncludeDirectives(includeDirectives);
std::optional<std::mt19937> rng;
flat_hash_map<std::string, std::string> obfuscationMap;
if (obfuscateIds) {
if (useFixedObfuscationSeed)
rng.emplace();
else
rng = createRandomGenerator<std::mt19937>();
}
while (true) {
Token token = preprocessor.next();
if (token.kind == TokenKind::IntegerBase) {
// This is needed for the case where obfuscation is enabled,
// the digits of a vector literal may be lexed initially as
// an identifier and we don't have the parser here to fix things
// up for us.
do {
output.print(token);
token = preprocessor.next();
} while (SyntaxFacts::isPossibleVectorDigit(token.kind));
}
if (obfuscateIds && token.kind == TokenKind::Identifier) {
auto name = std::string(token.valueText());
auto translation = obfuscationMap.find(name);
if (translation == obfuscationMap.end()) {
auto newName = generateRandomAlphanumericString(*rng, 16);
translation = obfuscationMap.emplace(name, newName).first;
}
token = token.withRawText(alloc, translation->second);
}
output.print(token);
if (token.kind == TokenKind::EndOfFile)
break;
}
// Only print diagnostics if actual errors occurred.
for (auto& diag : diagnostics) {
if (diag.isError()) {
OS::printE(fmt::format("{}", DiagnosticEngine::reportAll(sourceManager, diagnostics)));
return false;
}
}
OS::print(fmt::format("{}\n", output.str()));
return true;
}
void Driver::reportMacros() {
BumpAllocator alloc;
Diagnostics diagnostics;
Preprocessor preprocessor(sourceManager, alloc, diagnostics, createOptionBag());
for (auto it = buffers.rbegin(); it != buffers.rend(); it++)
preprocessor.pushSource(*it);
while (true) {
Token token = preprocessor.next();
if (token.kind == TokenKind::EndOfFile)
break;
}
for (auto macro : preprocessor.getDefinedMacros()) {
SyntaxPrinter printer;
printer.setIncludeComments(false);
printer.setIncludeTrivia(false);
printer.print(macro->name);
printer.setIncludeTrivia(true);
if (macro->formalArguments)
printer.print(*macro->formalArguments);
if (!macro->body.empty() && macro->body[0].trivia().empty())
printer.append(" "sv);
printer.print(macro->body);
OS::print(fmt::format("{}\n", printer.str()));
}
}
bool Driver::parseAllSources() {
bool singleUnit = options.singleUnit == true;
bool onlyLint = options.onlyLint == true;
auto optionBag = createOptionBag();
if (singleUnit) {
auto tree = SyntaxTree::fromBuffers(buffers, sourceManager, optionBag);
if (onlyLint)
tree->isLibrary = true;
syntaxTrees.emplace_back(std::move(tree));
}
else {
for (const SourceBuffer& buffer : buffers) {
auto tree = SyntaxTree::fromBuffer(buffer, sourceManager, optionBag);
if (onlyLint)
tree->isLibrary = true;
syntaxTrees.emplace_back(std::move(tree));
}
}
std::span<const DefineDirectiveSyntax* const> inheritedMacros;
if (options.librariesInheritMacros == true)
inheritedMacros = syntaxTrees.back()->getDefinedMacros();
bool ok = true;
for (auto& file : options.libraryFiles) {
SourceBuffer buffer = readSource(file);
if (!buffer) {
ok = false;
continue;
}
auto tree = SyntaxTree::fromBuffer(buffer, sourceManager, optionBag, inheritedMacros);
tree->isLibrary = true;
syntaxTrees.emplace_back(std::move(tree));
}
if (!options.libDirs.empty()) {
std::vector<fs::path> directories;
directories.reserve(options.libDirs.size());
for (auto& dir : options.libDirs)
directories.emplace_back(widen(dir));
flat_hash_set<std::string_view> uniqueExtensions;
uniqueExtensions.emplace(".v"sv);
uniqueExtensions.emplace(".sv"sv);
for (auto& ext : options.libExts)
uniqueExtensions.emplace(ext);
std::vector<fs::path> extensions;
for (auto ext : uniqueExtensions)
extensions.emplace_back(widen(ext));
// If library directories are specified, see if we have any unknown instantiations
// or package names for which we should search for additional source files to load.
flat_hash_set<std::string_view> knownNames;
auto addKnownNames = [&](const std::shared_ptr<SyntaxTree>& tree) {
auto& meta = tree->getMetadata();
for (auto& [n, _] : meta.nodeMap) {
auto decl = &n->as<ModuleDeclarationSyntax>();
std::string_view name = decl->header->name.valueText();
if (!name.empty())
knownNames.emplace(name);
}
for (auto classDecl : meta.classDecls) {
std::string_view name = classDecl->name.valueText();
if (!name.empty())
knownNames.emplace(name);
}
};
auto findMissingNames = [&](const std::shared_ptr<SyntaxTree>& tree,
flat_hash_set<std::string_view>& missing) {
auto& meta = tree->getMetadata();
for (auto name : meta.globalInstances) {
if (knownNames.find(name) == knownNames.end())
missing.emplace(name);
}
for (auto idName : meta.classPackageNames) {
std::string_view name = idName->identifier.valueText();
if (!name.empty() && knownNames.find(name) == knownNames.end())
missing.emplace(name);
}
for (auto importDecl : meta.packageImports) {
for (auto importItem : importDecl->items) {
std::string_view name = importItem->package.valueText();
if (!name.empty() && knownNames.find(name) == knownNames.end())
missing.emplace(name);
}
}
};
for (auto& tree : syntaxTrees)
addKnownNames(tree);
flat_hash_set<std::string_view> missingNames;
for (auto& tree : syntaxTrees)
findMissingNames(tree, missingNames);
// Keep loading new files as long as we are making forward progress.
flat_hash_set<std::string_view> nextMissingNames;
while (true) {
for (auto name : missingNames) {
SourceBuffer buffer;
for (auto& dir : directories) {
fs::path path(dir);
path /= name;
for (auto& ext : extensions) {
path.replace_extension(ext);
if (!sourceManager.isCached(path)) {
buffer = sourceManager.readSource(path);
if (buffer)
break;
}
}
if (buffer)
break;
}
if (buffer) {
auto tree = SyntaxTree::fromBuffer(buffer, sourceManager, optionBag,
inheritedMacros);
tree->isLibrary = true;
syntaxTrees.emplace_back(tree);
addKnownNames(tree);
findMissingNames(tree, nextMissingNames);
}
}
if (nextMissingNames.empty())
break;
missingNames = std::move(nextMissingNames);
nextMissingNames.clear();
}
}
if (ok) {
Diagnostics pragmaDiags = diagEngine.setMappingsFromPragmas();
for (auto& diag : pragmaDiags)
diagEngine.issue(diag);
}
return ok;
}
Bag Driver::createOptionBag() const {
PreprocessorOptions ppoptions;
ppoptions.predefines = options.defines;
ppoptions.undefines = options.undefines;
ppoptions.predefineSource = "<command-line>";
if (options.maxIncludeDepth.has_value())
ppoptions.maxIncludeDepth = *options.maxIncludeDepth;
for (const auto& d : options.ignoreDirectives)
ppoptions.ignoreDirectives.emplace(d);
LexerOptions loptions;
if (options.maxLexerErrors.has_value())
loptions.maxErrors = *options.maxLexerErrors;
ParserOptions poptions;
if (options.maxParseDepth.has_value())
poptions.maxRecursionDepth = *options.maxParseDepth;
CompilationOptions coptions;
coptions.suppressUnused = false;
coptions.scriptMode = false;
if (options.maxInstanceDepth.has_value())
coptions.maxInstanceDepth = *options.maxInstanceDepth;
if (options.maxGenerateSteps.has_value())
coptions.maxGenerateSteps = *options.maxGenerateSteps;
if (options.maxConstexprDepth.has_value())
coptions.maxConstexprDepth = *options.maxConstexprDepth;
if (options.maxConstexprSteps.has_value())
coptions.maxConstexprSteps = *options.maxConstexprSteps;
if (options.maxConstexprBacktrace.has_value())
coptions.maxConstexprBacktrace = *options.maxConstexprBacktrace;
if (options.maxInstanceArray.has_value())
coptions.maxInstanceArray = *options.maxInstanceArray;
if (options.errorLimit.has_value())
coptions.errorLimit = *options.errorLimit * 2;
if (options.onlyLint == true) {
coptions.suppressUnused = true;
coptions.lintMode = true;
}
if (options.allowHierarchicalConst == true)
coptions.allowHierarchicalConst = true;
if (options.allowDupInitialDrivers == true)
coptions.allowDupInitialDrivers = true;
if (options.relaxEnumConversions == true)
coptions.relaxEnumConversions = true;
if (options.strictDriverChecking == true)
coptions.strictDriverChecking = true;
if (options.ignoreUnknownModules == true)
coptions.ignoreUnknownModules = true;
if (options.allowUseBeforeDeclare == true)
coptions.allowUseBeforeDeclare = true;
for (auto& name : options.topModules)
coptions.topModules.emplace(name);
for (auto& opt : options.paramOverrides)
coptions.paramOverrides.emplace_back(opt);
if (options.minTypMax.has_value()) {
if (options.minTypMax == "min")
coptions.minTypMax = MinTypMax::Min;
else if (options.minTypMax == "typ")
coptions.minTypMax = MinTypMax::Typ;
else if (options.minTypMax == "max")
coptions.minTypMax = MinTypMax::Max;
}
if (options.timeScale.has_value())
coptions.defaultTimeScale = TimeScale::fromString(*options.timeScale);
Bag bag;
bag.set(ppoptions);
bag.set(loptions);
bag.set(poptions);
bag.set(coptions);
return bag;
}
std::unique_ptr<Compilation> Driver::createCompilation() const {
auto compilation = std::make_unique<Compilation>(createOptionBag());
for (auto& tree : syntaxTrees)
compilation->addSyntaxTree(tree);
return compilation;
}
bool Driver::reportParseDiags() {
auto compilation = createCompilation();
for (auto& diag : compilation->getParseDiagnostics())
diagEngine.issue(diag);
OS::printE(fmt::format("{}", diagClient->getString()));
return diagEngine.getNumErrors() == 0;
}
bool Driver::reportCompilation(Compilation& compilation, bool quiet) {
if (!quiet) {
auto topInstances = compilation.getRoot().topInstances;
if (!topInstances.empty()) {
OS::print(fg(diagClient->warningColor), "Top level design units:\n");
for (auto inst : topInstances)
OS::print(fmt::format(" {}\n", inst->name));
OS::print("\n");
}
}
for (auto& diag : compilation.getAllDiagnostics())
diagEngine.issue(diag);
bool succeeded = diagEngine.getNumErrors() == 0;
std::string diagStr = diagClient->getString();
OS::printE(fmt::format("{}", diagStr));
if (!quiet) {
if (diagStr.size() > 1)
OS::print("\n");
if (succeeded)
OS::print(fg(diagClient->highlightColor), "Build succeeded: ");
else
OS::print(fg(diagClient->errorColor), "Build failed: ");
OS::print(fmt::format("{} error{}, {} warning{}\n", diagEngine.getNumErrors(),
diagEngine.getNumErrors() == 1 ? "" : "s",
diagEngine.getNumWarnings(),
diagEngine.getNumWarnings() == 1 ? "" : "s"));
}
return succeeded;
}
} // namespace slang::driver
|
207bf9a6d8f13a8aa6785ebba9afde57aca32d62 | 18d12e5c07fdadcd5cd047bec1a970bcce9463c6 | /implementation/MaxFlow/NaiveMaxflow.cpp | bb41ba8ee0a7e8a0ff499b21db4567919251592e | [] | no_license | ngthanhtin/Data-structures-And-Algorithms | c366afd9abb6831b8ef2e9708d43df15b579f710 | 88bb306ce8c397a4da4b5105e5d001727a136d1d | refs/heads/master | 2023-06-27T00:14:48.040920 | 2023-06-18T22:10:56 | 2023-06-18T22:10:56 | 131,296,135 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,444 | cpp | NaiveMaxflow.cpp | // //#include <iostream>
// //#include <queue>
// //using namespace std;
// //
// //int const max = 100;
// //int const maxc = 1000;
// //int c[max][max], f[max][max], cf[max][max];
// //int path[max]; // trace path
// // // n is the number of vertices
// // //a is source vertice
// // //b is sink vertice
// //int n, a, b;
// //
// ////input the arguments
// //void enter()
// //{
// // // m is the number of edges
// // int m, u, v;
// // for (int i = 0; i < max; i++)
// // {
// // for (int j = 0; j < max; j++)
// // {
// // c[i][j] = 0;
// // }
// // }
// // cin >> n >> m >> a >> b;
// // a--; // the first vertice begins at 0
// // b--; // the sink vertice ends at n - 1
// // for (int i = 0; i< m; i++)
// // {
// // cin >> u >> v; // two adjacent vertices
// // cin >> c[u - 1][v - 1]; // weight
// // }
// //}
// //// find increasing flow
// //void creategf()
// //{
// // //build cf from c and f
// // for (int u = 0; u < n; u++)
// // {
// // for (int v = 0; v <n; v++)
// // {
// // cf[u][v] = maxc;
// // }
// // }
// // for (int u = 0; u < n; u++)
// // {
// // for (int v = 0; v <n; v++)
// // {
// // if (c[u][v] > 0) // if (u,v) is a bow in g
// // {
// // if (f[u][v] < c[u][v])
// // {
// // cf[u][v] = c[u][v] - f[u][v]; // normal bow
// // }
// // if (f[u][v] > 0)// inverse bow
// // {
// // cf[v][u] = -f[u][v];
// // }
// // }
// // }
// // }
// //}
// ////find a path from a to b using bfs
// //bool findpath()
// //{
// // queue<int> q;
// // bool isfound = false;
// // bool visited[max] = { 0 };
// // q.push(a);
// // visited[a] = true;
// // while (!q.empty())
// // {
// // int s = q.front();
// // q.pop();
// // for (int i = 0; i < n; i++)
// // {
// //
// // if (visited[i] == false && cf[s][i] != maxc)
// // {
// // visited[i] = true;
// // q.push(i);
// // path[i] = s;
// // if (i == b) // have path from a to b
// // {
// // isfound = true;
// // return isfound;
// // }
// // }
// // }
// // }
// // return isfound;
// //}
// ////increase flow following the increasing flow path (have just found by bfs)
// //void incflow()
// //{
// // int u, v, incvalue;
// // // follow the path to find the smallest weight of bows on path
// // incvalue = maxc;
// // v = b;
// // while (v != a)
// // {
// // u = path[v];
// // if (abs(cf[u][v]) < incvalue)
// // {
// // incvalue = abs(cf[u][v]);
// // }
// // v = u;
// // }
// // // follow the path the second time to increase flow
// // v = b;
// // while (v != a)
// // {
// // u = path[v];
// // if (cf[u][v] > 0)
// // {
// // f[u][v] = f[u][v] + incvalue; // (u,v ) is a normal bow
// // }
// // else
// // {
// // f[u][v] = f[u][v] - incvalue; // (u,v) is a inverse bow
// // }
// // v = u;
// // }
// //}
// ////print the max-flow
// //void print()
// //{
// // int m = 0;
// // for (int u = 0; u < n; u++)
// // {
// // for (int v = 0; v < n; v++)
// // {
// // if (c[u][v] > 0)
// // {
// // cout << "f[" << u << "][" << v << "] = " << f[u][v] << endl;
// // if (u == a)
// // {
// // m = m + f[a][v];
// // }
// // }
// // }
// // }
// // cout << "max flow: " << m << endl;
// //}
int main()
{
enter();
for (int i = 0; i < max; i++)
{
for (int j = 0; j < max; j++)
{
f[i][j] = 0;
}
}
do
{
creategf();
if (findpath() == false)
break;
incflow();
} while (true);
print();
return 0;
} |
4f5459d871521805414502fe89c754bf6674c1a6 | bd3cef6df6a6cc28af443752963560d059d4545f | /math/gcd.cpp | e111317c1610176c604bb942244b0b9329ebb1f0 | [
"CC0-1.0",
"MIT"
] | permissive | Mayur1011/CodeBook | fe5581b50d3d7bcce5f85013db20c2b749186913 | 6bb5ffe6299c79a364cfa84d28520a1b3b5e4350 | refs/heads/master | 2023-08-29T11:08:24.307740 | 2021-11-09T14:28:59 | 2021-11-09T14:28:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 695 | cpp | gcd.cpp | // use only for non-negative u, v
int gcd(int u, int v) {
int shift;
if (u == 0) return v;
if (v == 0) return u;
shift = __builtin_ctz(u | v);
u >>= __builtin_ctz(u);
do {
v >>= __builtin_ctz(v);
if (u > v) {
swap(u, v);
}
v -= u;
} while (v);
return u << shift;
}
// use only for non-negative u, v
long long gcd(long long u, long long v) {
int shift;
if (u == 0 || v == 0) return u + v;
shift = __builtin_ctzll(u | v);
u >>= __builtin_ctzll(u);
do {
v >>= __builtin_ctzll(v);
if (u > v) {
swap(u, v);
}
v -= u;
} while (v);
return u << shift;
}
|
ac98750ef20dfeb878f211c5b0ece02d619c8e68 | 8b785ec952656748901fd07b360806ae2f788f05 | /src/Model/modelsnapshot.h | a2fb45d6837738eabce543d2cad50c6a481145b7 | [] | no_license | bandarichen/track0matic | 6751ff44deb6712c42b255ac8dffe1d2c1111d8a | a1d19c2f97035e754410ea5fbcf8c6349a8f754c | refs/heads/master | 2020-12-24T08:56:43.159145 | 2013-07-26T07:54:32 | 2013-07-26T07:54:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,602 | h | modelsnapshot.h | #ifndef MODEL_SNAPSHOT_H
#define MODEL_SNAPSHOT_H
#include <memory>
#include <set>
#include <Model/track.h>
#include <3rdparty/DBDataStructures.h> // for Model::MapPtr
namespace Model
{
class Snapshot
{
public:
Snapshot() = default; // to allow putting in collections
Snapshot(std::shared_ptr<
std::set<std::unique_ptr<Track> >
>);
std::shared_ptr<
std::set<std::unique_ptr<Track> >
> getData() const;
private:
std::shared_ptr<
std::set<std::unique_ptr<Track> >
> data_;
};
class WorldSnapshot
{
public:
struct StreetNodeSnapshot
{
StreetNodeSnapshot(int id, double lon, double lat, double mos);
int nodeId;
double lon; // losing constraints
double lat;
double mos;
};
struct StreetSnapshot
{
StreetSnapshot(std::shared_ptr<StreetNodeSnapshot> first,
std::shared_ptr<StreetNodeSnapshot> second);
std::shared_ptr<StreetNodeSnapshot> first;
std::shared_ptr<StreetNodeSnapshot> second;
};
WorldSnapshot() = default; // to allow putting in collections
/**
* @brief WorldSnapshot c-tor, transforms MapPtr to WorldSnapshot.
* @param MapPtr - Model's struct describing map.
*/
explicit WorldSnapshot(const MapPtr); // copies only streets!
std::set<std::shared_ptr<StreetNodeSnapshot> > vertexes;
std::set<std::shared_ptr<StreetSnapshot> > edges;
private:
std::shared_ptr<StreetNodeSnapshot> nodeToSnapshot(const StreetNodePtr);
};
} // namespace Model
#endif // MODEL_SNAPSHOT_H
|
566668c48255759207bb6ec2788db23e0c196dd5 | 044094157b8270ff590bb9f4b2eeac2ae3fc2349 | /src/aadcUser/StateMachine/BaseTask.cpp | 0b4024fc3751ec900adb8e9bc1bc1b2bf30c1de0 | [] | no_license | d-raith/frAISers_aadc_2018 | 31e682735d084853487ea9a671d9f156c4194192 | 26169227e5e5c4ddd3d87252452475424e6e8af0 | refs/heads/master | 2020-04-07T04:38:46.337676 | 2018-11-19T16:20:47 | 2018-11-19T16:20:47 | 158,065,598 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,493 | cpp | BaseTask.cpp | #include "BaseTask.h"
void BaseTask::logDebug() {
if (current_constraint && current_constraint->isActive()) {
LOG_INFO("Task: constraint active since: %f | remaining ms: %f ",
current_constraint->getTimer().getElapsedMs()/1000, current_constraint->getTimer()
.getRemainingMs());
LOG_INFO("Speed: %f", current_constraint->getDrivingSpeed());
}
}
Point &BaseTask::getCurrentWaypoint() {
if (waypoints.empty()) {
throw WaypointsEmptyException();
}
return waypoints.front();
}
bool BaseTask::isPointPassed(const Point &target) {
return isPointPassed(target, is_reverse_movement, point_passed_offset_tolerance);
}
bool BaseTask::isPointPassed(const Point &origin, const Point &target) {
return isPointPassed(origin, target, is_reverse_movement, point_passed_offset_tolerance);
}
bool BaseTask::isPointPassed(const Point &target, bool invertCheck,
int offset_tolerance) {
return isPointPassed(car_model->getRearAxis(), target, invertCheck, offset_tolerance);
}
bool BaseTask::isPointPassed(const Point &origin, const Point &target, bool invertCheck,
int offset_tolerance) {
Point local = origin.toLocal(target, car_model->getHeading());
if (invertCheck) {
return local.getY() > offset_tolerance;
}
return local.getY() < offset_tolerance;
}
/** State checking**/
bool BaseTask::isGoalReached(Point &position) {
return isValidGoal(goal) &&
(position.distanceTo(goal) < getGoalProximity() || isPointPassed(goal,
is_reverse_movement,
point_passed_offset_tolerance));
}
bool BaseTask::isGoalReached() {
return isGoalReached(wp_check_center_global);
}
bool BaseTask::isWaypointReached(Point &position, Point &waypoint) {
return position.distanceTo(waypoint) < getWaypointProximity()
|| isPointPassed(waypoint, is_reverse_movement, point_passed_offset_tolerance);
}
bool BaseTask::isWaypointReached(Point &waypoint) {
return isWaypointReached(wp_check_center_global, waypoint);
}
bool BaseTask::isValidGoal(const Point &goal) {
return !goal.isInitPoint();
}
Point BaseTask::getCurrentGoalPoint() {
return goal;
}
void BaseTask::onBeforeUpdate() {
}
void BaseTask::writeDebugOutputToLocalMap(cv::Mat *local_map_img) {
}
/**Override this to provide custom proxyimity checking (e.g. with offset)*/
Point BaseTask::getWaypointProximityCheckCenter() {
return car_model->getRearAxis();
}
void BaseTask::onUpdateProximityCenter(Point new_center) {
this->wp_check_center_global = new_center;
}
const Point BaseTask::getSteeringAnchor() {
return car_model->toGlobal(0, 36);
}
/**Control loop**/
void BaseTask::update(const float *current_speed) {
if (!car_model->isInitialized()) {
cout << "position pointer or position itself not valid " << endl;
}
if (!local_map->isInitialized()) {
cout << "Local map not initialized" << endl;
return;
}
onUpdateProximityCenter(getWaypointProximityCheckCenter());
if (goal_reached) {
// wait for state machine to detect finish and switch tasks
LOG_INFO("Goal reached, stopping");
setVelocity(Speed::STOP);
return;
}
if (goal.isInitPoint() && !onNoGlobalGoalAvailable()) {
LOG_INFO("no global goal set, returning");
return;
}
if (!goal_reached && isGoalReached()) {
onGoalReached(goal);
return;
}
onBeforeUpdate();
while (!waypoints.empty() && isWaypointReached(getCurrentWaypoint())) {
onWaypointReached(getCurrentWaypoint());
waypoints.pop_front();
}
desired_task_speed = getDrivingSpeed();
if (verifyDrivingConstraintsExists() && applyDrivingConstraints()) {
return;
}
if (isWaiting()) {
// override speed if waiting timer is active
desired_task_speed = Speed::STOP;
}
if (!waypoints.empty()) {
setNextWaypoint(getCurrentWaypoint());
setVelocity(desired_task_speed);
} else {
setVelocity(Speed::SLOW);
onEmptyWaypoints();
LOG_INFO("No more waypoints, stopping");
}
}
/**Lifecycle / Callback methods **/
void BaseTask::onStartTask() {
}
bool BaseTask::verifyDrivingConstraintsExists() {
if (current_constraint && current_constraint->isActive()) {
//LOG_INFO("Active constraint %s exists", current_constraint->getSourceTypeReadable().c_str());
return true;
}
onCheckStVoConstraints();
/*if (!current_constraint->isActive()) {
onCheckStVoConstraints(current_constraint);
}
if(!current_constraint->isActive()){
current_constraint.reset();
}*/
if (current_constraint) {
//LOG_INFO("Current constraint: %s", current_constraint->getSourceTypeReadable().c_str());
return true;
}
return false;
}
void BaseTask::onCheckStVoConstraints() {
// move this to individual tasks if logic gets more complex
bool at_junction = getType() == BaseTask::Type::turn_right || getType()
== BaseTask::Type::turn_left || getType() == BaseTask::Type::straight;
std::string task_name = getName();
at_junction = at_junction
&& task_name != "LFP"
&& task_name != "Overtake"
&& task_name != "Merge"
&& task_name != "Reverse"
&& task_name != "WP";
BaseTask::Type task_type = getType();
at_junction = at_junction
&& task_type != BaseTask::Type::pull_out_left
&& task_type != BaseTask::Type::pull_out_right
&& task_type != BaseTask::Type::cross_parking
&& task_type != BaseTask::Type::parallel_parking;
stVo.updateConstraint(*env_state, this, at_junction, current_constraint);
}
bool BaseTask::applyDrivingConstraints() {
return current_constraint->apply(&desired_task_speed, &waypoints, this);
// waypoints = ...
}
bool BaseTask::onNoGlobalGoalAvailable() {
// true indicates ok, continue update loop;
return false;
}
void BaseTask::onGoalReached(Point &goal) {
LOG_INFO("Global goal reached: %f, %f", goal.getX(), goal.getY());
goal_reached = true;
waypoints.clear();
}
void BaseTask::onWaypointReached(Point &wp) {
// LOG_INFO("Waypoint reached: %f %f", wp.getX(), wp.getY());
}
void BaseTask::onEmptyWaypoints() {
}
void BaseTask::onMarkerDetected(Marker *marker) {
if (!marker) {
// reset
detected_marker = nullptr;
return;
}
bool trigger_always = true;
if (detected_marker && (*detected_marker) == (*marker) && !trigger_always) {
// marker seen already
return;
}
this->detected_marker = marker;
auto iter_found = marker_trigger_map.find(marker->getMarkerType());
if (iter_found == marker_trigger_map.end()) {
LOG_DUMP("No registration for marker type");
return;
}
//float trigger_dist = iter_found->second;
auto distance = static_cast<float>(car_model->getRearAxis().distanceTo(*marker)
/ Coordinate::GLOBAL);
// distance check not working atm
//cout << "dist to marker: " << distance << endl;
/*if (distance > trigger_dist) {
LOG_DUMP("Marker too far away to trigger, dist: %f | %f", distance, trigger_dist);
return;
}*/
switch (detected_marker->getMarkerType()) {
case Marker::CROSSING:
onCrossingSign(marker, distance);
break;
case Marker::STOP:
onStopSign(marker, distance);
break;
case Marker::PARKING_AHEAD:
onParkSign(marker, distance);
break;
case Marker::RIGHT_OF_WAY:
onRoWSign(marker, distance);
break;
case Marker::STRAIGHT_ONLY:
onStraightOnly(marker, distance);
break;
case Marker::GIVE_WAY:
onGiveWaySign(marker, distance);
break;
case Marker::ZEBRA:
onZebraCrossingSign(marker, distance);
break;
case Marker::ROUNDABOUT:
onRoundaboutSign(marker, distance);
break;
case Marker::NO_OVERTAKING:
onNoOvertakingSign(marker, distance);
break;
case Marker::NO_ENTERING:
onNoEnteringSign(marker, distance);
break;
case Marker::ONE_WAY:
onOneWaySign(marker, distance);
break;
case Marker::CONSTRUCTION:
onConstructionSign(marker, distance);
break;
case Marker::SPEED_LIMIT_50:
onSpeedLimitSign(marker, distance);
break;
case Marker::SPEED_LIMIT_100:
onSpeedLimitSign(marker, distance);
break;
case Marker::POSITIONING:
onPositioningSign(marker, distance);
break;
}
}
void BaseTask::onLaneDataAvailable(vector<Lane> &laneData) {
}
void BaseTask::onObstacleDetected(Obstacle &obstacle) {
}
float BaseTask::computeCurvature(const Point &waypoint) {
return pps_steering.getCurvature(getSteeringAnchor(), waypoint);
/*
float lookahead = 0.5;
Point anchor = getSteeringAnchor();
Point steer_target = Point::Global(0, 0);
for (auto &wp : waypoints) {
if (anchor.distanceTo(steer_target) > lookahead) {
return pps_steering.getCurvature(anchor, wp);
}
}
if (!waypoints.empty()) {
LOG_INFO("No waypoint found outside lookahead, using last");
return pps_steering.getCurvature(anchor, waypoints.back());
}
LOG_INFO("No waypoints, steering straight");
return pps_steering.getCurvature(anchor, anchor.toGlobal(Point::Local(0, 10), car_model->getHeading()));
*/
}
bool BaseTask::isOvertakeRequested() {
return is_overtake_required;
}
void BaseTask::requestOvertake() {
is_overtake_required = true;
}
void BaseTask::doReverseEmBrakeRecovery() {
desired_task_speed = -0.4f;
setVelocity(desired_task_speed);
setNextWaypoint(car_model->getFrontAxis().toGlobal(Point::Local(0, 10), car_model->getHeading
()));
}
bool BaseTask::setNextWaypoint(const Point &waypoint) {
return steer_ctrl->setCurvature(computeCurvature(waypoint));
}
bool BaseTask::setVelocity(const float speed) {
return speed_ctrl->setVehicleSpeed(speed);
}
/**Setter methods invoked once**/
void BaseTask::setLocalMap(shared_ptr<LocalMap> &localMap) {
local_map = localMap;
if (local_map) {
onLocalMapAvailable(local_map);
}
}
void BaseTask::setGlobalMap(IGlobalMap *map) {
global_map = map;
if (global_map) {
onGlobalMapAvailable(global_map);
}
}
void BaseTask::setPlannerInstance(IPlanner *planner) {
this->planner = planner;
if (this->planner) {
onPlannerAvailable(this->planner);
}
}
void BaseTask::setCarModel(std::shared_ptr<CarModel> &carModel) {
ICarModelDependent::setCarModel(carModel);
lane_tracker.setCarModel(carModel);
pps_steering.setCarModel(carModel);
}
void BaseTask::setEnvironmentState(const shared_ptr<EnvironmentState> &state) {
env_state = state;
}
float BaseTask::getDrivingSpeed() {
return Speed::SLOW;
}
shared_ptr<DrivingConstraint> BaseTask::getCurrentDrivingConstraint() {
return current_constraint;
}
|
d7120862875a62f67cf47b8eecfb9e55b3d7f358 | a4cb2a22934d7b9d2936ed291fae91a91455d4cd | /src/main.cpp | 213f3bac786784694e7acdd783362a496441cd64 | [
"Unlicense"
] | permissive | dAmihl/ppg-rooms | 943997dd06a4895948ab05526409ddbb03b47bb3 | 20e1c7b51890afce0172f7fc7686f403d50ba311 | refs/heads/master | 2023-08-18T05:32:31.126038 | 2021-10-11T13:33:19 | 2021-10-11T13:33:19 | 412,459,858 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,097 | cpp | main.cpp |
#include <SDL.h>
#include <libtcod.h>
#include "Yaml2Puzzle.h"
#include "Room.h"
#include <cstdlib>
int main(int argc, char** argv) {
TCOD_ContextParams params = {TCOD_COMPILEDVERSION};
params.argc = argc;
params.argv = argv;
params.vsync = true;
params.sdl_window_flags = SDL_WINDOW_RESIZABLE;
params.window_title = "PPG-ROOMS";
tcod::ConsolePtr console = tcod::new_console(80, 25);
params.columns = console->w;
params.rows = console->h;
tcod::ContextPtr context = tcod::new_context(params);
Yaml2Puzzle y2p;
auto P = y2p.generatePuzzleByFile("universe1.yaml");
PPG::Vec<PPG::GraphNode*> rootNode = P->getGraphRepresentation();
Room r1{console};
// Game loop.
while (true) {
// Update
r1.update();
// Rendering.
TCOD_console_clear(console.get());
r1.draw();
context->present(*console);
// Handle input.
SDL_Event event;
SDL_WaitEvent(nullptr);
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
std::exit(EXIT_SUCCESS);
break;
}
}
}
return 0;
}
|
5d107348e389286c65234caebbb72622dcc4bee7 | 51be8db88a49f7bebeefddf431faff6048ac4f37 | /xpcc/src/xpcc/architecture/platform/arm7/at91/flash.cpp | 1a7e2d3e7b0daf73dea7276b628aae2403484e5f | [
"MIT"
] | permissive | jrahlf/3D-Non-Contact-Laser-Profilometer | 0a2cee1089efdcba780f7b8d79ba41196aa22291 | 912eb8890442f897c951594c79a8a594096bc119 | refs/heads/master | 2016-08-04T23:07:48.199953 | 2014-07-13T07:09:31 | 2014-07-13T07:09:31 | 17,915,736 | 6 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 4,560 | cpp | flash.cpp | // coding: utf-8
// ----------------------------------------------------------------------------
/* Copyright (c) 2011, Roboterclub Aachen e.V.
* 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 Roboterclub Aachen e.V. 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 ROBOTERCLUB AACHEN E.V. ''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 ROBOTERCLUB AACHEN E.V. 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 "device.h"
#include "flash.hpp"
void
xpcc::at91::Flash::write(uint32_t address, uint8_t* buffer, size_t len)
{
int wrlen;
// do automatic multi-page writes
while (len)
{
// determine how many bytes to write
wrlen = (len < AT91C_IFLASH_PAGE_SIZE) ? (len) : (AT91C_IFLASH_PAGE_SIZE);
// write page
writePage(address, buffer, wrlen);
// increment pointers
address += wrlen;
buffer += wrlen;
// decrement remaining buffer size
len -= wrlen;
}
}
void
xpcc::at91::Flash::writePage(uint32_t address, uint8_t* buffer, size_t len)
{
int pageword;
unsigned long* wrptr = (unsigned long*) address;
// do write cycle
// copy data to flash location
for (pageword = 0; pageword < (len / 4); pageword++)
{
// do the copy byte-wise because incoming buffer might not be word-aligned
// NOTE: assuming little-endian source
*wrptr++ = (buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8) | (buffer[0] << 0);
buffer += 4;
}
// if the flash address does not begin on page boundary, then we do partial-page programming
if (address & (AT91C_IFLASH_PAGE_SIZE - 1)) {
AT91C_BASE_MC->MC_FMR |= AT91C_MC_NEBP;
}
else {
AT91C_BASE_MC->MC_FMR &= ~AT91C_MC_NEBP;
}
// write flash
AT91C_BASE_MC->MC_FCR = (0x5A << 24) |
(((address / AT91C_IFLASH_PAGE_SIZE) << 8) & AT91C_MC_PAGEN) |
AT91C_MC_FCMD_START_PROG;
while (!(AT91C_BASE_MC->MC_FSR & AT91C_MC_FRDY)) {
// wait for flash done/ready
}
}
void
xpcc::at91::Flash::erase(void)
{
// erase flash
AT91C_BASE_MC->MC_FCR = (0x5A << 24) | AT91C_MC_FCMD_ERASE_ALL;
while (!(AT91C_BASE_MC->MC_FSR & AT91C_MC_FRDY)) {
// wait for flash done/ready
}
}
bool
xpcc::at91::Flash::isLocked(uint32_t address)
{
// mask address to size of flash
address &= (AT91C_IFLASH_SIZE - 1);
// determine the lock state of a flash address/page
if (AT91C_BASE_MC->MC_FSR &
(1 << (16 + (address / AT91C_IFLASH_LOCK_REGION_SIZE))))
{
return true; // region is locked
}
else {
return false; // region is not locked
}
}
void
xpcc::at91::Flash::setLock(uint32_t address, bool lock)
{
// mask address to size of flash
address &= (AT91C_IFLASH_SIZE - 1);
// since lock bits have a small lifetime (100 programming cycles),
// check to see if lock bit is already set to requested state
if (isLocked(address) == lock) {
return; // lock bit is already set as desired
}
// program the lock bit
if (lock) {
AT91C_BASE_MC->MC_FCR = (0x5A << 24) |
(((address / AT91C_IFLASH_PAGE_SIZE) << 8) & AT91C_MC_PAGEN) |
AT91C_MC_FCMD_LOCK;
}
else {
AT91C_BASE_MC->MC_FCR = (0x5A << 24) |
(((address / AT91C_IFLASH_PAGE_SIZE) << 8) & AT91C_MC_PAGEN) |
AT91C_MC_FCMD_UNLOCK;
}
while (!(AT91C_BASE_MC->MC_FSR & AT91C_MC_FRDY)) {
// wait for flash done/ready
}
}
|
d5677ddadf4ab57087d483cc54b71e8331ef8fbc | 6c9efa7fb4d810db1fd3ddb240fddae553290760 | /eigen-matrix/03-image-load/main.cpp | 408a29a638b3fe2ca2675b56f7db4b31afe8899b | [] | no_license | ippo615/experiments | 3d8515d3f9187235b44ee5329f3306d04027d47a | d6c714647764493fc654152b60525a465fdad11f | refs/heads/master | 2020-12-12T06:17:50.662053 | 2017-11-23T01:03:30 | 2017-11-23T01:03:30 | 11,753,685 | 5 | 3 | null | 2019-05-07T13:01:03 | 2013-07-30T01:27:08 | JavaScript | UTF-8 | C++ | false | false | 1,223 | cpp | main.cpp | #include <stdio.h>
#include <opencv2/opencv.hpp>
#include "../Eigen/Dense"
#include <opencv2/core/eigen.hpp>
using namespace cv;
using namespace std;
int main(int argc, char** argv ){
bool debug = true;
if ( argc < 2 ){
printf("usage: %s <Image_Path>\n", argv[0]);
return -1;
}
if( argc >= 3 ){
debug = true;
}else{
debug = false;
}
// Load the image as a grayscale image
Mat image_gray = imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE );
if ( !image_gray.data ){
printf("No image data \n");
return -1;
}
// Threshold it (for black and white), black=1, white=0
Mat image_bw;
threshold(image_gray, image_bw, 128.0, 1.0, THRESH_BINARY_INV);
// Make the values floats so they can be multiplied and will end up in the correct scale
Mat image2;
image_bw.convertTo(image2, CV_32FC1);
Eigen::Map<Eigen::MatrixXf> image(image2.ptr<float>(), image_bw.rows, image_bw.cols);
// Create the nozzle mask for slicing the image
Eigen::VectorXf nozzleMask(12);
for( int i=0; i<12; i+=1 ){
nozzleMask[i] = (1<<i);
}
for( int y=0; y<image_bw.rows-12; y+=1 ){
for( int x=0; x<image_bw.cols; x+=1 ){
//cout << image.block(x,y,1,12)*nozzleMask << "\n";
image.block(x,y,1,12)*nozzleMask;
}
}
}
|
f29d8f7c8cff217bdb7f28fc41e4d4b74f75e5ee | 42840513a0395bfc85100695731b1052a930185b | /93.cpp | a3389a5479022d42fbdef8bbc3cc61efa768db2d | [] | no_license | shuest/leetcode | 011434b1c0bdebf45e14f9126c0cd444a32b176f | 24aa6b74b52a952086daa7e62841fac76472cb64 | refs/heads/master | 2021-07-04T14:08:56.205837 | 2018-11-25T09:54:49 | 2018-11-25T09:54:49 | 129,609,193 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 874 | cpp | 93.cpp | #include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cctype>
using namespace std;
class Solution {
public:
vector<string> restoreIpAddresses(string s) {
vector<string>res;
int len=s.length();
for(int i=1;i<=3&&i<=len-3;i++) //最后三个至少3位
{
for(int j=1;j<=3&&i+j<=len-2;j++) //最后两个至少两位
{
for(int k=1;k<=3&&i+j+k<=len-1;k++) //最后一个至少1位
{
string s1=s.substr(0,i),s2=s.substr(i,j),s3=s.substr(i+j,k),s4=s.substr(i+j+k);
if(isvalid(s1)&&isvalid(s2)&&isvalid(s3)&&isvalid(s4))
res.push_back(s1+'.'+s2+'.'+s3+'.'+s4);
}
}
}
return res;
}
bool isvalid(string s)
{
return s.length()>=1&&s.length()<=3&&(s[0]!='0'||s.length()==1)&&stoi(s)<=255;
}
}; |
035945dfedbcb87c44e176511ef12b42bd7ec660 | f1a5508d96984ce0b45c02e1ba509393d7b6bf88 | /Es_lezione_05/posizione.h | 34e9942b9c39c38ee3510fcb8913f3a75ed9f518 | [] | no_license | AlessandroProserpio/LabSimNumerica | e3eab0eff21498d8f9dd74a7b49f20ae8157a015 | 7f0128891e4e859261bbf7786bb04b3d93f66945 | refs/heads/master | 2022-11-23T07:39:19.336286 | 2020-07-17T09:33:49 | 2020-07-17T09:33:49 | 278,032,292 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,015 | h | posizione.h | #ifndef __posizione_h__
#define __posizione_h__
#include<iostream>
#include <cmath>
using namespace std;
class Posizione{
double m_1, m_2, m_3;
public:
// constructors;
Posizione();
Posizione(double, double, double);
// methods:
double GetX() const {return m_1;};
double GetY() const {return m_2;};
double GetZ() const {return m_3;};
double GetR() const {return sqrt(pow(m_1,2)+pow(m_2,2)+pow(m_3,2));};
double GetRho() const {return sqrt(pow(m_1,2)+pow(m_2,2));};
double GetPhi() const {return atan2(m_2,m_1);};
double GetTheta() const {return acos(m_3/GetR());};
double Distance(const Posizione& p ) const {return sqrt(pow(GetX()-p.GetX(),2)+pow(GetY()-p.GetY(),2)+pow(GetZ()-p.GetZ(),2));};
void SetComponent(unsigned int i, double val);
void SetXYZ(double, double, double);
void Set_to_zero();
// algebra
Posizione& operator=(const Posizione &);
Posizione operator+(const Posizione&);
Posizione operator-(const Posizione&);
Posizione& operator+=(const Posizione&);
};
#endif
|
acd7d0acc42d31accb790ef5e218f18b2901a368 | bba21a9bbd9a136ef7f38cad3233bf7a8e80f153 | /Main/GDK/Runtime/Physics/RigidBody.h | 1c575ec2d1c007063f83d5ff8c28d3ae5a66e72f | [] | no_license | rezanour/randomoldstuff | da95141b3eb7698a55c27b788b2bf3315462545c | f78ccc05e5b86909325f7f2140b18d6134de5904 | refs/heads/master | 2021-01-19T18:02:40.190735 | 2014-12-15T05:27:17 | 2014-12-15T05:28:41 | 27,686,761 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,050 | h | RigidBody.h | #pragma once
#include <PhysicsInternal.h>
#include <RuntimeObject.h>
namespace GDK
{
class PhysicsWorld;
struct IBroadphaseProxy;
class RigidBody :
public RuntimeObject<RigidBody>,
public IRigidBody
{
public:
static std::shared_ptr<RigidBody> Create(_In_ const std::shared_ptr<PhysicsWorld>& world, _In_ const std::shared_ptr<IGameObject>& owner, _In_ const RigidBodyCreateParameters& parameters);
// IRigidBody
virtual std::shared_ptr<IGameObject> GetOwner() const override;
virtual const Vector3& GetPosition() const override;
virtual const Vector3& GetVelocity() const override;
virtual float GetMass() const override;
virtual float GetRestitution() const override;
virtual void SetPosition(_In_ const Vector3& value) override;
virtual void SetRotation(_In_ float value) override;
virtual void AddImpulse(_In_ const Vector3& value) override;
virtual void SetGravityScale(_In_ float value) override;
virtual const std::vector<GameObjectContact>& GetContacts() const override;
virtual RigidBodyType GetType() const override;
virtual bool IsSensor() const override;
virtual bool IsKinematic() const override;
// RigidBody
float GetInvMass() const;
const Vector3& GetAcceleration() const;
void Integrate(_In_ float deltaSeconds);
void BeginResolution(); // Called before/after contact resolution to allow
void EndResolution(); // body to suspend collision object updates and manage caches
void AdjustVelocity(_In_ const Vector3& value);
void AdjustPosition(_In_ const Vector3& value);
const Vector3& GetPositionAdjustments() const;
void ClearPositionAdjustments();
void ClearContacts();
void OnContact(_In_ const GameObjectContact& contact);
const std::shared_ptr<CollisionPrimitive>& GetWorldShape() const;
~RigidBody();
private:
RigidBody(_In_ const std::shared_ptr<PhysicsWorld>& world, _In_ const std::shared_ptr<IGameObject>& owner, _In_ const RigidBodyCreateParameters& parameters);
Vector3 _position;
Vector3 _velocity;
Vector3 _acceleration;
Vector3 _impulses;
float _rotation;
float _invMass;
float _restitution;
float _gravityScale;
// track adjustments to position during resolution stages,
// so we can account for it in future iterations this frame.
Vector3 _positionAdjustments;
RigidBodyType _type;
std::vector<GameObjectContact> _contacts;
std::weak_ptr<PhysicsWorld> _world;
std::weak_ptr<IGameObject> _owner;
std::shared_ptr<CollisionPrimitive> _shape; // shape of the body, if any. Given in local coordinate frame of object
std::shared_ptr<CollisionPrimitive> _worldShape; // transformed shape, given in the world coordinate frame
std::weak_ptr<IBroadphaseProxy> _proxy;
};
}
|
0691adc950a9f254573817a59c0478cae505f09f | a350893eaa2afd208364f16f30b7561275bffdc5 | /sources/demPencilLiveCam.cpp | beb1466d41567d8e54876868f85a695cb3c4ebab | [
"Unlicense"
] | permissive | DanielHsH/LenaKot | 52eb5cbd377ca529043f3168b3050249213cce35 | aab03b8d375df9308ee7f7b2e289b4f52732d8d6 | refs/heads/master | 2021-01-10T17:58:32.405963 | 2015-09-26T06:30:00 | 2015-09-26T06:30:00 | 43,195,003 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,599 | cpp | demPencilLiveCam.cpp | #include "stdafx.h"
#include "sfFrameGrabber.h"
#include "demPencil.h"
#include "sfCVextension.h"
namespace demPencilNS{
/****************************************************************************/
// Defines
// main debug windows command
#define MAIN_SF_WINDOW_COMMAND_OPEN (0)
#define MAIN_SF_WINDOW_COMMAND_UPDATE (1)
#define MAIN_SF_WINDOW_COMMAND_CLOSE (2)
/****************************************************************************/
// Inner variables
sfFrameGrabber* Video = NULL; // Video source
int intensNormal = 7;
int colorNormal = 5;
int looseDitails = 1;
int edgeSharpness = 8;
int noiseRatio = 2;
int colorBits = 8;
// File path's
char videoFilePath [SF_DEFAULT_PATH_LENGTH];
IplImage *curImg; // Current video frame
int keyPressed; // Current keyboard command
/****************************************************************************/
/************************* Assist methods *****************************/
/****************************************************************************/
/****************************************************************************/
// Methods which manages swordfish tracker windows. Executes command given by
// main()
void updateWindows(int action){
switch (action){
case MAIN_SF_WINDOW_COMMAND_OPEN:
// Open source video window
cvNamedWindow("Source", CV_WINDOW_AUTOSIZE );
cvCreateTrackbar("Background" ,"Source",&intensNormal ,10, NULL);
cvCreateTrackbar("Color " ,"Source",&colorNormal ,20, NULL);
cvCreateTrackbar("No ditails" ,"Source",&looseDitails ,2 , NULL);
cvCreateTrackbar("Bold Strok" ,"Source",&edgeSharpness ,20, NULL);
cvCreateTrackbar("Thin Srtok" ,"Source",&noiseRatio ,10, NULL);
cvNamedWindow("Pencil" , CV_WINDOW_AUTOSIZE);
break;
case MAIN_SF_WINDOW_COMMAND_UPDATE:
cvShowImage("Pencil",curImg);
cvExtPhoto2Pencil(curImg,curImg,intensNormal/10.,colorNormal,looseDitails,
edgeSharpness,noiseRatio/10.,colorBits);
cvShowImage("Source",curImg);
break;
case MAIN_SF_WINDOW_COMMAND_CLOSE:
cvDestroyWindow("Source");
cvDestroyWindow("Pencil");
break;
}
}
/****************************************************************************/
/*************************** Main method ******************************/
/****************************************************************************/
int demPencilLiveCam(int isCamera){
// ---------------------------------------
// Initialize video source (if no source then use online camera)
if (!isCamera){
safeStrBufCpy(videoFilePath,"TrackVideo.avi");
Video = new sfFrameGrabber(videoFilePath);
}
else{
videoFilePath[0] = 0;
Video = new sfFrameGrabber();
}
char frameName[30];
curImg = Video->grabFrame();
if (!curImg){
// Retry movie from hard-disk
delete Video;
safeStrBufCpy(videoFilePath,"TrackVideo.avi");
// safeStrBufCpy(videoFilePath,"a.txt");
Video = new sfFrameGrabber(videoFilePath);
curImg = Video->grabFrame();
if (!curImg){
fprintf(stderr,"Error: Unable to acquire video frames!\n");
delete Video;
return -1;
}
}
// ---------------------------------------
// Open program windows and prepare to the main loop.
updateWindows(MAIN_SF_WINDOW_COMMAND_OPEN);
// CvVideoWriter *writer=cvCreateVideoWriter("out2.avi",CV_FOURCC('D', 'I', 'V', 'X'),29.97,cvSize(320,240),1);
// Grab next frame
// ---------------------------------------
// main loop
while (curImg){
updateWindows(MAIN_SF_WINDOW_COMMAND_UPDATE);
sprintf_s(frameName,"Frame%0.5d.jpg",Video->getCurFrameNumber());
// cvSaveImage(frameName,curImg);
// cvWriteFrame(writer, curImg);
// Get the next frame.
cvReleaseImage(&curImg);
curImg = Video->grabFrame();
// Proccess user commands
keyPressed = cvWaitKey(1);
switch (keyPressed){
case -1:
// No key
break;
case 27:
// Quit
if (curImg){
cvReleaseImage( &curImg );
curImg = NULL;
}
break;
case 'p':
case 'P':
case 32 : // space
// pause
cvWaitKey(0);
break;
}
}
// End of main loop
// ---------------------------------------
// Program has to terminate
updateWindows(MAIN_SF_WINDOW_COMMAND_CLOSE);
//cvReleaseVideoWriter(&writer);
// Delete swordfish classes
delete Video;
return 0;
}
} // End of NameSpace
/****************************************************************************/
// EOF.
|
353bbac46e67503ef8e18eb1736b49ea0cfc263b | c560a184dc1b82240e3aeded51ee1e967e417efd | /Server.cpp | eac2ddeaeaed4548c6450d0268ed8e77e24d3ed2 | [] | no_license | Aierhaimian/parrot | 7157867f340bde5408ab590c53bf6e122507216e | 0cf4437aa843f698e31a9b724002d369d241e945 | refs/heads/master | 2020-06-16T14:58:25.546813 | 2019-07-07T05:58:19 | 2019-07-07T05:58:19 | 195,616,111 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,090 | cpp | Server.cpp | #include <iostream>
#include "Server.h"
Server::Server() {
serverAddr.sin_family = PF_INET;
serverAddr.sin_port = htons(SERVER_PORT);
serverAddr.sin_addr.s_addr = inet_addr(SERVER_IP);
bzero(&(serverAddr.sin_zero),sizeof(serverAddr.sin_zero));
listener = 0;
epfd = 0;
}
void Server::Init() {
std::cout << "Init Prrot Server..." << std::endl;
if ((listener = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
perror("socket");
exit(-1);
}
if (bind(listener, (struct sockaddr *)&serverAddr, sizeof(struct sockaddr)) < 0) {
perror("bind");
exit(-1);
}
if (listen(listener, BACKLOG) < 0) {
perror("listen");
exit(-1);
}
std::cout << "Start to listen: " << SERVER_IP << std::endl;
if ((epfd = epoll_create(EPOLL_SIZE)) < 0) {
perror("epoll_create");
exit(-1);
}
addFd(epfd, listener, true);
}
void Server::Close() {
close(listener);
close(epfd);
}
int Server::SendBroadcastMessage(int clientfd) {
// buf[BUFFER_SIZE] receive new messages
// message[BUFFER_SIZE] save formatted messages
char recv_buf[BUFFER_SIZE];
char send_buf[BUFFER_SIZE];
Msg msg;
bzero(recv_buf, BUFFER_SIZE);
// receive new message
std::cout << "receive from client (clientID = " << clientfd << ")" << std::endl;
int len = recv(clientfd, recv_buf, BUFFER_SIZE, 0);
memset(&msg, 0, sizeof(msg));
memcpy(&msg, recv_buf, sizeof(msg));
msg.fromID = clientfd;
if (msg.content[0] == '\\' && isdigit(msg.content[1])) {
msg.type = 1;
msg.toID = msg.content[1] - '0';
memcpy(msg.content, msg.content+2, sizeof(msg.content));
}
else
msg.type = 0;
// if client is close connection
if (len == 0) {
close(clientfd);
client_list.remove(clientfd);
std::cout << "ClientID = " << clientfd << "closed." << std::endl;
std::cout << "now there are " << client_list.size()
<< "client in the chat room" << std::endl;
}
// send msg to all client
else {
if (client_list.size() == 1) {
memcpy(&msg.content, CAUTION, sizeof(msg.content));
bzero(send_buf, BUFFER_SIZE);
memcpy(send_buf,&msg, sizeof(msg));
send(clientfd, send_buf, sizeof(send_buf), 0);
return len;
}
char format_message[BUFFER_SIZE];
// group chat
if (msg.type == 0) {
sprintf(format_message, SERVER_MSG, clientfd, msg.content);
memcpy(msg.content, format_message, BUFFER_SIZE);
std::list<int>::iterator it;
for (it = client_list.begin(); it!=client_list.end(); it++) {
if (*it != clientfd) {
bzero(send_buf, BUFFER_SIZE);
memcpy(send_buf, &msg, sizeof(msg));
if (send(*it, send_buf, sizeof(send_buf), 0) < 0) {
return -1;
}
}
}
}
// single chat
if (msg.type == 1) {
bool private_offline = true;
sprintf(format_message, SERVER_PRIVATE_MSG, clientfd, msg.content);
memcpy(msg.content, format_message, BUFFER_SIZE);
std::list<int>::iterator it;
for (it = client_list.begin(); it != client_list.end(); it++) {
if (*it == msg.toID) {
private_offline = false;
bzero(send_buf, BUFFER_SIZE);
memcpy(send_buf, &msg, sizeof(msg));
if (send(*it, send_buf, sizeof(send_buf), 0) < 0) {
return -1;
}
}
}
// if the another client if offline
if (private_offline) {
sprintf(format_message, SERVER_PRIVATE_ERROR_MSG, msg.toID);
memcpy(msg.content, format_message, BUFFER_SIZE);
bzero(send_buf, BUFFER_SIZE);
memcpy(send_buf, &msg, sizeof(msg));
if (send(msg.fromID, send_buf, sizeof(send_buf), 0) < 0) {
return -1;
}
}
}
}
return len;
}
void Server::Start() {
static struct epoll_event events[EPOLL_SIZE];
Init();
while (1) {
int epoll_events_count = epoll_wait(epfd, events, EPOLL_SIZE, -1);
if (epoll_events_count < 0) {
perror("epoll_wait");
exit(-1);
}
std::cout << "epoll_events_count = " << epoll_events_count << std::endl;
for (int i=0; i<epoll_events_count; i++) {
int sockfd = events[i].data.fd;
// New user connection
if (sockfd == listener) {
struct sockaddr_in client_addr;
socklen_t client_addr_length = sizeof(struct sockaddr_in);
int clientfd = accept(listener, (struct sockaddr *)&client_addr, &client_addr_length);
std::cout << "client connection from: "
<< inet_ntoa(client_addr.sin_addr) << ":"
<< ntohs(client_addr.sin_port) << ", clientfd = "
<< clientfd << std::endl;
addFd(epfd, clientfd, true);
// server save new connect client in list
client_list.push_back(clientfd);
// welcome
std::cout << "welcome msg" << std::endl;
char msg[BUFFER_SIZE];
bzero(msg, BUFFER_SIZE);
sprintf(msg, SERVER_WELCOME, clientfd);
if (send(clientfd, msg, BUFFER_SIZE, 0) < 0) {
perror("send");
exit(-1);
}
// handle messag receive and broad
else {
if (SendBroadcastMessage(sockfd) < 0) {
perror("SendBroadcastMessage");
exit(-1);
}
}
}
}
}
Close();
}
|
5d404bbab63d321b49cc8dd46b9f0f9d61033567 | 0019f0af5518efe2144b6c0e63a89e3bd2bdb597 | /antares/src/preferences/screen/RefreshWindow.h | decf6c52dae3f19372996da71fd9519e4df9376b | [] | no_license | mmanley/Antares | 5ededcbdf09ef725e6800c45bafd982b269137b1 | d35f39c12a0a62336040efad7540c8c5bce9678a | refs/heads/master | 2020-06-02T22:28:26.722064 | 2010-03-08T21:51:31 | 2010-03-08T21:51:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 584 | h | RefreshWindow.h | /*
* Copyright 2001-2006, Antares.
* Distributed under the terms of the MIT License.
*
* Authors:
* Rafael Romo
* Stefano Ceccherini (burton666@libero.it)
* Axel Dörfler, axeld@pinc-software.de
*/
#ifndef REFRESH_WINDOW_H
#define REFRESH_WINDOW_H
#include <Window.h>
class BSlider;
class RefreshWindow : public BWindow {
public:
RefreshWindow(BPoint position, float current, float min, float max);
virtual void MessageReceived(BMessage* message);
virtual void WindowActivated(bool active);
private:
BSlider* fRefreshSlider;
};
#endif // REFRESH_WINDOW_H
|
f4f86df8f6b9a54ae4b90032fe6117bdcb6af161 | bc5b4bfb895dddbbcc50671154e3850198e7002c | /laser/laser/laser.cpp | e2f0e8b8ef9d32ac53ed49c747810400b20e5c3e | [] | no_license | Flora123/gitrep | f17aec003812e99faa1c85e3e03c8be1f2358676 | 001133edc994670d4939adc851a47da8644a5363 | refs/heads/master | 2021-01-10T21:04:59.340746 | 2015-02-02T07:07:12 | 2015-02-02T07:07:12 | 29,998,283 | 0 | 1 | null | null | null | null | GB18030 | C++ | false | false | 10,624 | cpp | laser.cpp | // laser.cpp : 定义应用程序的类行为。
//
#include "stdafx.h"
#include "laser.h"
#include "laserDlg.h"
#include <io.h>
#include <odbcinst.h>
#include <afxdb.h>
#include "ADODB.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
BOOL b_EXIT;
CAdoDB g_adoDB;
// ClaserApp
BEGIN_MESSAGE_MAP(ClaserApp, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// ClaserApp 构造
ClaserApp::ClaserApp()
{
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
// 唯一的一个 ClaserApp 对象
ClaserApp theApp;
// ClaserApp 初始化
BOOL ClaserApp::InitInstance()
{
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 将它设置为包括所有要在应用程序中使用的
// 公共控件类。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
// 连接数据库
//char HostName[128];
//CString StrName;
//if( gethostname(HostName, sizeof(HostName)) == 0 )
//{
// struct hostent * pHost;
// pHost = gethostbyname(HostName);
// StrName += HostName;
//}
CString sql;
sql = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=LaserData.mdb";
if (!g_adoDB.Open(sql,adModeUnknown))
return -1;
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
///////////////////////
//if (CoInitialize(NULL)!=0)
//{
// AfxMessageBox(_T("初始化COM支持库失败!"));
// exit(1);
//}
///////////////////////
ClaserDlg dlg;
//管理员或操作员登陆
b_EXIT = TRUE;
m_UseDlg.DoModal();
if (b_EXIT == TRUE)
{
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 在此放置处理何时用
// “确定”来关闭对话框的代码
}
else if (nResponse == IDCANCEL)
{
// TODO: 在此放置处理何时用
// “取消”来关闭对话框的代码
}
}
// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
// 而不是启动应用程序的消息泵。
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////
//名称:GetExcelDriver
//功能:获取ODBC中Excel驱动
/////////////////////////////////////////////////////////////////////////////
CString GetExcelDriver()
{
char szBuf[2001];
WORD cbBufMax = 2000;
WORD cbBufOut;
char *pszBuf = szBuf;
CString sDriver;
// 获取已安装驱动的名称(涵数在odbcinst.h里)
if (!SQLGetInstalledDrivers(szBuf, cbBufMax, &cbBufOut))
return "";
// 检索已安装的驱动是否有Excel...
do
{
if (strstr(pszBuf, "Excel") != 0)
{
//发现 !
sDriver = CString(pszBuf);
break;
}
pszBuf = strchr(pszBuf, '\0') + 1;
}
while (pszBuf[1] != '\0');
return sDriver;
}
///////////////////////////////////////////////////////////////////////////////
// BOOL MakeSurePathExists( CString &Path,bool FilenameIncluded)
// 参数:
// Path 路径
// FilenameIncluded 路径是否包含文件名
// 返回值:
// 文件是否存在
// 说明:
// 判断Path文件(FilenameIncluded=true)是否存在,存在返回TURE,不存在返回FALSE
// 自动创建目录
//
///////////////////////////////////////////////////////////////////////////////
BOOL MakeSurePathExists( CString &Path,
bool FilenameIncluded)
{
int Pos=0;
while((Pos=Path.Find('\\',Pos+1))!=-1)
CreateDirectory(Path.Left(Pos),NULL);
if(!FilenameIncluded)
CreateDirectory(Path,NULL);
// return ((!FilenameIncluded)?!_access(Path,0):
// !_access(Path.Left(Path.ReverseFind('\\')),0));
return !_access(Path,0);
}
//获得默认的文件名
BOOL GetDefaultXlsFileName(CString& sExcelFile)
{
///默认文件名:yyyymmddhhmmss.xls
CString timeStr;
CTime day;
day=CTime::GetCurrentTime();
int filenameday,filenamemonth,filenameyear,filehour,filemin,filesec;
filenameday=day.GetDay();//dd
filenamemonth=day.GetMonth();//mm月份
filenameyear=day.GetYear();//yyyy
filehour=day.GetHour();//hh
filemin=day.GetMinute();//mm分钟
filesec=day.GetSecond();//ss
timeStr.Format("%04d%02d%02d%02d%02d%02d",filenameyear,filenamemonth,filenameday,filehour,filemin,filesec);
sExcelFile = timeStr + ".xls";
// prompt the user (with all document templates)
CFileDialog dlgFile(FALSE,".xls",sExcelFile);
CString title;
CString strFilter;
title = "导出";
strFilter = "Excel文件(*.xls)";
strFilter += (TCHAR)'\0'; // next string please
strFilter += _T("*.xls");
strFilter += (TCHAR)'\0'; // last string
dlgFile.m_ofn.nMaxCustFilter++;
dlgFile.m_ofn.nFilterIndex = 1;
// append the "*.*" all files filter
CString allFilter;
VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER));
strFilter += allFilter;
strFilter += (TCHAR)'\0'; // next string please
strFilter += _T("*.*");
strFilter += (TCHAR)'\0'; // last string
dlgFile.m_ofn.nMaxCustFilter++;
dlgFile.m_ofn.lpstrFilter = strFilter;
dlgFile.m_ofn.lpstrTitle = title;
if (dlgFile.DoModal()==IDCANCEL)
return FALSE; // open cancelled
sExcelFile.ReleaseBuffer();
if (MakeSurePathExists(sExcelFile,true)) {
if(!DeleteFile(sExcelFile)) { // delete the file
AfxMessageBox("覆盖文件时出错!");
return FALSE;
}
}
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// void GetExcelDriver(CListCtrl* pList, CString strTitle)
// 参数:
// pList 需要导出的List控件指针
// strTitle 导出的数据表标题
// 说明:
// 导出CListCtrl控件的全部数据到Excel文件。Excel文件名由用户通过“另存为”
// 对话框输入指定。创建名为strTitle的工作表,将List控件内的所有数据(包括
// 列名和数据项)以文本的形式保存到Excel工作表中。保持行列关系。
//
// edit by [r]@dotlive.cnblogs.com
///////////////////////////////////////////////////////////////////////////////
void ExportListToExcel(CListCtrl* pList, CString strTitle)
{
CString warningStr;
if (pList->GetItemCount()>0)
{
CDatabase database;
CString sDriver;
CString sExcelFile;
CString sSql;
CString tableName = strTitle;
// 检索是否安装有Excel驱动 "Microsoft Excel Driver (*.xls)"
sDriver = GetExcelDriver();
if (sDriver.IsEmpty())
{
// 没有发现Excel驱动
AfxMessageBox("没有安装Excel!\n请先安装Excel软件才能使用导出功能!");
return;
}
///默认文件名
if (!GetDefaultXlsFileName(sExcelFile))
return;
// 创建进行存取的字符串
sSql.Format("DRIVER={%s};DSN='';FIRSTROWHASNAMES=1;READONLY=FALSE;CREATE_DB=\"%s\";DBQ=%s",sDriver, sExcelFile, sExcelFile);
// 创建数据库 (既Excel表格文件)
if( database.OpenEx(sSql,CDatabase::noOdbcDialog) )
{
// 创建表结构
int i;
LVCOLUMN columnData;
CString columnName;
int columnNum = 0;
CString strH;
CString strV;
sSql = "";
strH = "";
columnData.mask = LVCF_TEXT;
columnData.cchTextMax =100;
columnData.pszText = columnName.GetBuffer (100);
for(i=0;pList->GetColumn(i,&columnData);i++)
{
if (i!=0)
{
sSql = sSql + ", " ;
strH = strH + ", " ;
}
sSql = sSql + " " + columnData.pszText +" TEXT";
strH = strH + " " + columnData.pszText +" ";
}
columnName.ReleaseBuffer ();
columnNum = i;
sSql = "CREATE TABLE " + tableName + " ( " + sSql + " ) ";
database.ExecuteSQL(sSql);
// 插入数据项
int nItemIndex;
for (nItemIndex=0;nItemIndex<pList->GetItemCount ();nItemIndex++){
strV = "";
for(i=0;i<columnNum;i++)
{
if (i!=0)
{
strV = strV + ", " ;
}
strV = strV + " '" + pList->GetItemText(nItemIndex,i) +"' ";
}
sSql = "INSERT INTO "+ tableName
+" ("+ strH + ")"
+" VALUES("+ strV + ")";
database.ExecuteSQL(sSql);
}
}
// 关闭数据库
database.Close();
warningStr.Format("导出文件保存于%s!",sExcelFile);
AfxMessageBox(warningStr);
}
}
///////////////////////////////
//记录信息到Excel
///////////////////////////////
void InPortToExcel(CListCtrl* pList, CString strTitle)
{
CString warningStr;
if (pList->GetItemCount ()>0) {
CDatabase database;
CString sDriver;
CString sExcelFile;
CString sSql;
CString tableName = strTitle;
// 检索是否安装有Excel驱动 "Microsoft Excel Driver (*.xls)"
sDriver = GetExcelDriver();
if (sDriver.IsEmpty())
{
// 没有发现Excel驱动
AfxMessageBox("没有安装Excel!\n请先安装Excel软件才能使用导出功能!");
return;
}
///默认文件名
if (!GetDefaultXlsFileName(sExcelFile))
return;
// 创建进行存取的字符串
sSql.Format("DRIVER={%s};DSN='';FIRSTROWHASNAMES=1;READONLY=FALSE;CREATE_DB=\"%s\";DBQ=%s",sDriver, sExcelFile, sExcelFile);
// 创建数据库 (既Excel表格文件)
if( database.OpenEx(sSql,CDatabase::noOdbcDialog) )
{
// 创建表结构
int i;
LVCOLUMN columnData;
CString columnName;
int columnNum = 0;
CString strH;
CString strV;
sSql = "";
strH = "";
columnData.mask = LVCF_TEXT;
columnData.cchTextMax =100;
columnData.pszText = columnName.GetBuffer (100);
for(i=0;pList->GetColumn(i,&columnData);i++)
{
if (i!=0)
{
sSql = sSql + ", " ;
strH = strH + ", " ;
}
sSql = sSql + " " + columnData.pszText +" TEXT";
strH = strH + " " + columnData.pszText +" ";
}
columnName.ReleaseBuffer ();
columnNum = i;
sSql = "CREATE TABLE " + tableName + " ( " + sSql + " ) ";
database.ExecuteSQL(sSql);
// 插入数据项
int nItemIndex;
for (nItemIndex=0;nItemIndex<pList->GetItemCount ();nItemIndex++){
strV = "";
for(i=0;i<columnNum;i++)
{
if (i!=0)
{
strV = strV + ", " ;
}
strV = strV + " '" + pList->GetItemText(nItemIndex,i) +"' ";
}
sSql = "INSERT INTO "+ tableName
+" ("+ strH + ")"
+" VALUES("+ strV + ")";
database.ExecuteSQL(sSql);
}
}
// 关闭数据库
database.Close();
warningStr.Format("导出文件保存于%s!",sExcelFile);
AfxMessageBox(warningStr);
}
} |
35d4bc5b9dc9ad732d4377aad8d84e2a81a43317 | 71ade23346633235f7335cabe45c3e78b84085b0 | /1860340-1860192/main.cpp | 15048ecde975944db33160f53b32bc35968789c1 | [] | no_license | gomezpirry/clases_objetos | 3c83602685f78a1c61d9c86e32672a16e373ead1 | 36e01ff862525ce03349a5b02bc90eadccbae21e | refs/heads/master | 2020-04-23T05:49:04.934265 | 2019-04-02T02:13:29 | 2019-04-02T02:13:29 | 170,952,276 | 1 | 12 | null | 2019-04-02T02:13:30 | 2019-02-16T02:06:20 | C++ | UTF-8 | C++ | false | false | 201 | cpp | main.cpp | #include <iostream>
#include <stdlib.h>
#include "Menu.h"
using namespace std ;
int main () {
//Menus
Menu MenuDeIngreso ;
MenuDeIngreso.MostrarIngreso() ;
system ("pause") ;
return 0;
}
|
9413d6055692ff5463e608d97e56b361e2b92169 | b60aeea5ca505b2aac7dc3da7bc5802dd9035db9 | /src_common/Engine/EngineStatus.cpp | ccc45677823096568f0a23ca3d4af66c36571f13 | [] | no_license | rauls/iReporter | 004b7e13c317a8c7709b91ad7717976d1e81bae2 | 4ba5e7bb3f43cd3a27a3c71cf53e0910efff0431 | refs/heads/master | 2020-12-24T16:32:38.567261 | 2016-04-22T02:36:38 | 2016-04-22T02:36:38 | 23,453,009 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,731 | cpp | EngineStatus.cpp | #include "FWA.h"
#include "EngineStatus.h"
#include "myansi.h"
#include "datetime.h"
#include "config.h" // OutPut()
#include "ResDefs.h" // for ReturnString(IDS_NOTENOUGH)
#include "EngineBuff.h"
#include "translate.h"
#include "Hash.h"
#include "DateFixFileName.h"
// changes.........
// 11/Dec/2001 : ~ AddLineToFile() handles date tokens for converting logs to w3c...
const char* GetErrorString( long code )
{
long errorStringID(SERR_000);
switch( code )
{
case 201: errorStringID=SERR_201; break;
case 202: errorStringID=SERR_202; break;
case 204: errorStringID=SERR_204; break;
case 206: errorStringID=SERR_206; break;
case 301: errorStringID=SERR_301; break;
case 302: errorStringID=SERR_302; break;
//------------------------------------
case 331: errorStringID=SERR_331; break; //ftp
case 332: errorStringID=SERR_332; break; //ftp
case 350: errorStringID=SERR_350; break; //ftp
case 400: errorStringID=SERR_400; break;
case 401: errorStringID=SERR_401; break;
case 403: errorStringID=SERR_403; break;
case 404: errorStringID=SERR_404; break;
case 405: errorStringID=SERR_405; break;
case 406: errorStringID=SERR_406; break;
case 407: errorStringID=SERR_407; break;
case 408: errorStringID=SERR_408; break;
case 421: errorStringID=SERR_421; break; //ftp
case 425: errorStringID=SERR_425; break; //ftp
case 426: errorStringID=SERR_426; break; //ftp
case 450: errorStringID=SERR_450; break; //ftp
case 451: errorStringID=SERR_451; break; //ftp
case 452: errorStringID=SERR_452; break; //ftp
case 500: errorStringID=SERR_500; break;
case 501: errorStringID=SERR_501; break;
case 502: errorStringID=SERR_502; break;
case 503: errorStringID=SERR_503; break;
case 504: errorStringID=SERR_504; break; //ftp
case 530: errorStringID=SERR_530; break; //ftp
case 532: errorStringID=SERR_532; break; //ftp
case 550: errorStringID=SERR_550; break; //ftp
case 551: errorStringID=SERR_551; break; //ftp
case 552: errorStringID=SERR_552; break; //ftp
case 553: errorStringID=SERR_553; break; //ftp
default: break;
}
return TranslateID(errorStringID);
};
// Myansi condidate
static const long sleeptype_secs[] = {
0, (1*60), (5*60), (10*60), (15*60), (30*60),
(60*60), (2*60*60),(3*60*60),(6*60*60),(12*60*60),(24*60*60),
(7*24*60*60),(14*24*60*60),(21*24*60*60),(30*24*60*60) };
long GetSleeptypeSecs( long type )
{
if ( type < 16 ) // JMC: Needs to be the same size as the array above! sizeof(sleeptype_secs)/sizeof(long)
return sleeptype_secs[ type ];
else
return type;
}
// JMC added static
static char *protocolStr[] = {
"1=http", "1=80/tcp",
"2=http-https",
"3=smtp",
"4=ftp",
"5=telnet",
"6=realaudio",
"7=dns",
"8=110/tcp", 0
};
long ConvProtocol( char *prot )
{
long i=0, j=0; char *p;
while( p=protocolStr[i] ){
if ( strstri( p+2,prot ) ){
{
j = myatoi( p );
return j;
}
}
i++;
}
return 0;
}
//////////////////////////////////////////////////////////////////////
int stopall;
void StopAll( long stopcode )
{
stopall = stopcode;
}
int IsStopped( void )
{
return stopall;
}
//////////////////////////////////////////////////////////////////////
// if filename is NULL and line is valid, keep adding to the last FP
// if filename is VALID and line is NULL, close last file and open new file
// if filename is "" and line is NULL, close last file
// if both valid, open/write/close specified filename.
void *AddLineToFile( char *filename, char *line )
{
static FILE *fp = NULL;
{
// was a filename passed?
if ( filename )
{
// close last open file if a filename is passed.
if ( fp )
{
fclose( fp );
fp = NULL;
}
// only open a new file if filename is valid.
if ( *filename )
{
char newname[512];
DateFixFilename( filename, newname );
if ( line )
fp = fopen( newname, "a+" );
else
fp = fopen( newname, "w" );
}
}
// if we have an open file, write to it
if ( fp )
{
// if we have content to write, write it
if ( line )
{
fwrite( line, mystrlen( line ), 1, fp );
fflush( fp );
// close filename, if both filename/content are supplied
if ( filename )
{
fclose( fp );
fp = NULL;
}
}
}
}
return fp;
}
int DebugLog( char *str, long err )
{
char log_str[300];
char logname[]="debug_log.txt", dateStr[64];
int ferr = 0;
struct tm tr;
time_t Days;
if ( str ){
GetCurrentDate( &tr );
Date2Days( &tr, &Days );
DaysDateToString( Days, dateStr, 0, '/', 1,0);
sprintf( log_str, "%s - err=(%ld): %s\n", dateStr, err, str );
AddLineToFile( logname, log_str );
}
return 0;
}
extern short logNumDelimInLine;
// JMC: This is really bad
void ShowBadLine( long lineNum )
{
int i = 0, count=0;
char *s, *d, c;
if ( OutDebug(NULL)==0 )
return;
s = buff;
d = buf2;
while( i < logNumDelimInLine && count < 10000 )
{
c = *s++;
if( c == 0 ){
i++;
c = ' ';
}
*d++ = c;
count++;
}
*d++ = 0;
OutDebugs( "Ignoring Line %d: Data = %s", lineNum, buf2 );
}
/////////////////////////////////////////////////////////////////////////////
/* MemoryError - print memory error message and terminate program */
void MemoryError(char *txt, long size)
{
if ( IsStopped() )
return;
#ifdef DEF_MAC
if ( txt ) {
char mytxt[512];
sprintf( mytxt, "%s, needed %ld", txt, size );
UserMsg (mytxt);
}
//else function only called with txt parameter now, so don't need else
// AlertUser (18, 0);
StopAll(OUTOFRAM);
#else
if ( txt ){
char mytxt[512];
sprintf( mytxt, "%s, needed %ld", txt, size );
ErrorMsg( mytxt );
} else
ErrorMsg( ReturnString(IDS_NOTENOUGH));
StopAll(OUTOFRAM);
#endif
}
|
78c45fbc5c44c07252bb8b345cf789d51bbadfb4 | 56971d5a089b18dede74be431cdc88dd533909ca | /Sources/App/Inc/BlockQueue.h | 6a8da05d5bce7942d0af86fafc23eb17f908a1fa | [] | no_license | dZlj95/OrionPlus | d36c81781dafca726c01b7d6262886c8a4e8a684 | 5118dad0edd257346b8f619671d2a8e5191afffd | refs/heads/master | 2023-01-01T15:52:13.309188 | 2020-08-29T15:49:02 | 2020-08-29T15:49:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,317 | h | BlockQueue.h | #ifndef BLOCKQUEUE_H
#define BLOCKQUEUE_H
#include <stdlib.h>
class Block;
class BlockQueue
{
// friend classes
friend class Planner;
friend class Conveyor;
public:
BlockQueue();
BlockQueue(unsigned int length);
~BlockQueue();
/*
* direct accessors
*/
Block& head();
Block& tail();
/*
* pointer accessors
*/
Block* head_ref();
Block* tail_ref();
void produce_head(void);
void consume_tail(void);
/*
* queue status
*/
bool is_empty(void) const;
bool is_full(void) const;
void flush_now();
/*
* resize
*
* returns true on success, or false if queue is not empty or not enough memory available
*/
bool resize(unsigned int new_size);
protected:
/*
* these functions are protected as they should only be used internally
* or in extremely specific circumstances
*/
Block& item(unsigned int i);
Block* item_ref(unsigned int i);
unsigned int next(unsigned int item) const;
unsigned int prev(unsigned int item) const;
/*
* buffer variables
*/
unsigned int length;
volatile unsigned int head_i;
volatile unsigned int tail_i;
volatile unsigned int isr_tail_i;
private:
Block* ring;
};
#endif
|
b09f8ddececc35224584aa86b987af370b98f6a3 | dd52f4694e93d576aa9b126546f0da601be00112 | /c/tiwae/src/TimeStampColumn.cpp | a65a8df02bfa8bdb329498ab77c1cb815809f58d | [
"CC0-1.0"
] | permissive | mikeb01/scratch | e0255e6ce59584f2e1a459f6291f9e68d285f1ca | 1df6b4b87f2c66dbd8f8aa47ae832e53da87d594 | refs/heads/master | 2021-01-17T14:57:13.214984 | 2019-09-27T07:04:38 | 2019-09-27T07:04:38 | 43,925,710 | 0 | 0 | CC0-1.0 | 2020-10-13T16:20:30 | 2015-10-09T01:26:02 | Java | UTF-8 | C++ | false | false | 676 | cpp | TimeStampColumn.cpp | //
// Created by Michael Barker on 06/08/15.
//
#include <dirent.h>
#include <sys/fcntl.h>
#include "TimeStampColumn.h"
TimeStampColumn::TimeStampColumn(const char* storeRoot, const char* name, size_t initialSize)
: Column(storeRoot, name, initialSize), m_body(bodyPtr<int64_t>())
{
}
int64_t TimeStampColumn::append(const int64_t timestamp)
{
m_body[header()->m_position] = timestamp;
header()->m_position++;
return header()->m_position;
}
int64_t TimeStampColumn::position()
{
return header()->m_position;
}
int64_t TimeStampColumn::get(int i)
{
if (i < 0 || position() <= i)
{
return -1;
}
return bodyPtr<int64_t>()[i];
}
|
460c085e4de00177fdd3b4c555aa9cd0cb11b825 | 01e641738e9136f4acb9f40d38b118e5cb954c01 | /easy/119 Pascal's Triangle II.cpp | 1785e0da71674cabcadd9e4c8a39c000f031313c | [] | no_license | fztfztfzt/leetcode | 707c8c09b52e31f77726f9cba4f0f5bdff74d550 | 81e1ee370821c036a07fe33e9e0fce35d9919883 | refs/heads/master | 2021-01-10T11:08:36.949693 | 2016-03-01T02:09:37 | 2016-03-01T02:09:37 | 43,273,096 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,068 | cpp | 119 Pascal's Triangle II.cpp | /*
Pascal's Triangle II
Total Accepted: 53146 Total Submissions: 179062 Difficulty: Easy
Given an index k, return the kth row of the Pascal's triangle.
For example, given k = 3,
Return [1,3,3,1].
Note:
Could you optimize your algorithm to use only O(k) extra space?
https://leetcode.com/problems/pascals-triangle-ii/
*/
1.0ms 更改Pascal's Triangle得到
vector<int> getRow(int rowIndex) {
vector<int> v1,v2;
v1.push_back(1);
for(int i=2;i<=rowIndex+1;i++)
{
for(int j=0;j<i;j++)
{
if(j==0 || j==i-1)
{
v2.push_back(1);
}
else
{
v2.push_back(v1[j-1]+v1[j]);
}
}
v1.swap(v2);
v2.clear();
}
return v1;
}
2.0ms O(k)
vector<int> getRow(int rowIndex) {
vector<int> v(rowIndex+1,1);
for(int i=1;i<=rowIndex;i++)
{
for(int j=i;j>=0;j--)
{
if(j==0 || j==i) v[j]=1;
else v[j]=v[j]+v[j-1];
}
}
return v;
} |
677509ff26ffd4d85d1a951fcbbc4d351a5bc717 | 1e10812007a403721b8fd28f400e741513795beb | /chapter19/binomial_heap_implements_MST.cpp | 83a00843d7f9f91ff69b4d818ac8fefcdef4f648 | [] | no_license | odingit/CLRS | 157bf1e4e0b5dd4282e4156bad0aba77c3d579e1 | be253912b9b3380cfdbee186e926d7fda57fb6fb | refs/heads/master | 2021-01-19T20:57:55.778198 | 2016-09-10T07:31:46 | 2016-09-10T07:31:46 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 5,325 | cpp | binomial_heap_implements_MST.cpp |
/*******************************************
* Author: bravepam
* E-mail:1372120340@qq.com
* Blog:http://blog.csdn.net/zilingxiyue
*******************************************
*/
#include<iostream>
#include<fstream>
#include<vector>
#include<utility>
#include"BinomialHeap.h"
#define NOPARENT 0
#define MAX 0x7fffffff
using namespace std;
enum color{ WHITE, GRAY, BLACK };
struct edgeNode
{//边节点
size_t adjvertex;//该边的关联的顶点
size_t weight;//边权重
edgeNode *nextEdge;//下一条边
edgeNode(size_t adj, size_t w) :adjvertex(adj), weight(w), nextEdge(nullptr){}
};
class AGraph
{//无向图
private:
vector<edgeNode*> graph;
size_t nodenum;
AGraph& operator=(const AGraph&);
AGraph(const AGraph&);
public:
AGraph(size_t n = 0){ editGraph(n); }
void editGraph(size_t n)
{
nodenum = n;
graph.resize(n + 1);
}
size_t size()const { return nodenum; }
void initGraph();//初始化无向图
edgeNode* search(size_t, size_t);//查找边
void addOneEdge(size_t, size_t, size_t);
void addTwoEdge(size_t, size_t, size_t);//无向图中添加边
void deleteOneEdge(size_t, size_t);
void deleteTwoEdge(size_t, size_t);//无向图中删除边
void BHMST(AGraph&);//采用二项堆binomial heap计算MST
void print();
void destroy();
~AGraph(){ destroy(); }
};
void AGraph::initGraph()
{
size_t start, end;
size_t w;
ifstream infile("F:\\mst.txt");
while (infile >> start >> end >> w)
addOneEdge(start, end, w);
}
edgeNode* AGraph::search(size_t start, size_t end)
{
edgeNode *curr = graph[start];
while (curr != nullptr && curr->adjvertex != end)
curr = curr->nextEdge;
return curr;
}
void AGraph::addOneEdge(size_t start, size_t end, size_t weight)
{
edgeNode *curr = search(start, end);
if (curr == nullptr)
{
edgeNode *p = new edgeNode(end, weight);
p->nextEdge = graph[start];
graph[start] = p;
}
}
inline void AGraph::addTwoEdge(size_t start, size_t end, size_t weight)
{
addOneEdge(start, end, weight);
addOneEdge(end, start, weight);
}
void AGraph::deleteOneEdge(size_t start, size_t end)
{
edgeNode *curr = search(start, end);
if (curr != nullptr)
{
if (curr->adjvertex == end)
{
graph[start] = curr->nextEdge;
delete curr;
}
else
{
edgeNode *pre = graph[start];
while (pre->nextEdge->adjvertex != end)
pre = pre->nextEdge;
pre->nextEdge = curr->nextEdge;
delete curr;
}
}
}
inline void AGraph::deleteTwoEdge(size_t start, size_t end)
{
deleteOneEdge(start, end);
deleteOneEdge(end, start);
}
inline void AGraph::print()
{
for (size_t i = 1; i != graph.size(); ++i)
{
edgeNode *curr = graph[i];
cout << i;
if (curr == nullptr) cout << " --> null";
else
while (curr != nullptr)
{
cout << " --<" << curr->weight << ">--> " << curr->adjvertex;
curr = curr->nextEdge;
}
cout << endl;
}
}
void AGraph::destroy()
{
for (size_t i = 1; i != graph.size(); ++i)
{
edgeNode *curr = graph[i], *pre;
while (curr != nullptr)
{
pre = curr;
curr = curr->nextEdge;
delete pre;
}
graph[i] = curr;
}
}
void AGraph::BHMST(AGraph &mst)
{
struct edge
{//局部类,边
size_t start, finish;//包含边起点和终点
edge(size_t s, size_t f) :start(s), finish(f){}
};
vector<binomial_heap<size_t, edge>> E(nodenum + 1);//为每个顶点的邻接链表建立一个二项堆,键为边权值
vector<size_t> parent(nodenum + 1);//前驱子图
vector<color> isDestroy(nodenum + 1);//记录顶点集合是否已销毁(合并入其他集合)
for (size_t i = 1; i <= nodenum; ++i)
{//初始化
parent[i] = i;
isDestroy[i] = WHITE;
edgeNode *curr = graph[i];
while (curr != nullptr)
{
E[i].insert(curr->weight, edge(i, curr->adjvertex));
curr = curr->nextEdge;
}
}
struct findRoot:public binary_function<vector<size_t>,size_t,size_t>
{//局部函数对象类,查找子树根,并查集
size_t operator()(const vector<size_t> &UFS, size_t v)const
{
while (UFS[v] != v) v = UFS[v];
return v;
}
};
struct getVertexSet :public unary_function <vector<color>, size_t >
{//局部函数对象类,找寻未被销毁的顶点集合,返回其编号
size_t operator()(const vector<color> &isDestroy)const
{
size_t set_num = 0;
for (size_t i = 1; i != isDestroy.size();++i)
if (isDestroy[i] == WHITE)
{
set_num = i;
break;
}
return set_num;
}
};
size_t vertex_set_total = nodenum;
while (vertex_set_total > 1)
{//不断迭代,直到只剩下一个顶点集合
size_t vertex_set_num = getVertexSet()(isDestroy);//获得顶点集合
pair<size_t, edge> min = E[vertex_set_num].extractMin();//取的对应地边集,即二项堆的最小权值及边
size_t v_root = findRoot()(parent, min.second.finish);
if (vertex_set_num != v_root)
{//若两端点所处子树不同
mst.addTwoEdge(min.second.start,min.second.finish, min.first);//那么加入到mst中
parent[v_root] = vertex_set_num;//并且合并两顶点集
isDestroy[v_root] = BLACK;//设置颜色表明销毁
E[vertex_set_num].BheapUnion(E[v_root]);//合并相对应的边集
--vertex_set_total;//顶点集数目减1
}
}
}
const int nodenum = 9;
int main()
{
AGraph graph(nodenum), mst(nodenum);
graph.initGraph();
graph.print();
cout << endl;
graph.BHMST(mst);
mst.print();
getchar();
return 0;
} |
1c4848eb4686a42ce638f9eaeabe9952027ad5b1 | ff5640ee2abb29ecb1992562b1dc9bb6eb6a5461 | /PCNtupleMaker/plugins/SimpleFlatTableProducerPlugins.cc | 669a65dbbbb33c93ea0de9d46af432712294765a | [] | no_license | Jphsx/PCNtupleMaker | d8f5fd687a5c14c29df61e2164cbe97877e5fcbb | 0fded65c53c2d9ff0a12f7807eb3cf4cdf0aec81 | refs/heads/master | 2021-12-14T17:22:10.412159 | 2021-12-03T21:10:28 | 2021-12-03T21:10:28 | 240,592,315 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,930 | cc | SimpleFlatTableProducerPlugins.cc | #include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h"
#include "DataFormats/EgammaCandidates/interface/Conversion.h"
typedef SimpleFlatTableProducer<reco::Conversion> SimpleConversionTableProducer;
#include "DataFormats/VertexReco/interface/Vertex.h"
typedef SimpleFlatTableProducer<reco::Vertex> SimpleVertexTableProducer;
#include "DataFormats/Candidate/interface/Candidate.h"
typedef SimpleFlatTableProducer<reco::Candidate> SimpleCandidateFlatTableProducer;
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
typedef SimpleFlatTableProducer<reco::GenParticle> SimpleGenParticleFlatTableProducer;
#include "SimDataFormats/Track/interface/SimTrack.h"
typedef SimpleFlatTableProducer<SimTrack> SimpleSimTrackFlatTableProducer;
#include "SimDataFormats/Vertex/interface/SimVertex.h"
typedef SimpleFlatTableProducer<SimVertex> SimpleSimVertexFlatTableProducer;
typedef SimpleFlatTableProducer<int> SimpleIntTableProducer;
typedef SimpleFlatTableProducer<float> SimpleFloatTableProducer;
//#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
//typedef EventSingletonSimpleFlatTableProducer<GenEventInfoProduct> SimpleGenEventFlatTableProducer;
//#include "SimDataFormats/HTXS/interface/HiggsTemplateCrossSections.h"
//typedef EventSingletonSimpleFlatTableProducer<HTXS::HiggsClassification> SimpleHTXSFlatTableProducer;
#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(SimpleCandidateFlatTableProducer);
DEFINE_FWK_MODULE(SimpleIntTableProducer);
DEFINE_FWK_MODULE(SimpleFloatTableProducer);
//DEFINE_FWK_MODULE(SimpleGenEventFlatTableProducer);
//EFINE_FWK_MODULE(SimpleHTXSFlatTableProducer);
DEFINE_FWK_MODULE(SimpleConversionTableProducer);
DEFINE_FWK_MODULE(SimpleVertexTableProducer);
DEFINE_FWK_MODULE(SimpleSimTrackFlatTableProducer);
DEFINE_FWK_MODULE(SimpleSimVertexFlatTableProducer);
//DEFINE_FWK_MODULE(SimpleGenParticleTableProducer);
|
d00a34ec487cad3ab4825007ca5be74829412eb9 | ef03118029fef9d2177783bb4b2a804c11cccb7c | /app/src/main/cpp/view/Triangles.cpp | 508d3a1458031ab1822d03b7ae99c7a400003a2a | [] | no_license | UI-Animation-Chen/NativeActivityDemo | dd8cf7dbd33e15d7098bde98f5d3689041d2dac3 | 339e95fbf599d4eb6d05326342c2034858f6045c | refs/heads/master | 2022-05-08T08:55:10.312961 | 2022-04-20T10:17:02 | 2022-04-20T10:17:02 | 214,618,515 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,408 | cpp | Triangles.cpp | //
// Created by czf on 2019-10-20.
//
#include "Triangles.h"
#include "../texture/TextureUtils.h"
// 子类必须调用父类构造函数,不写的话系统会默认调用,如果没有默认就会报错。
// 析构函数一定会调用父类的,编译器强制。
Triangles::Triangles(): Shape() {
app_log("Triangles constructor\n");
glGenVertexArrays(1, &vao);
glGenBuffers(2, buffers);
// vao会记录所有的状态数据,包括attrib的开启与否。
// 绑定成功后,之前的vao绑定会解除,后续的所有数据操作都会记录到这个vao上。
// 后续在切换数据时,只要切换绑定vao就行。
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, buffers[0]); // 绑定成功后,会自动解除之前的绑定。
GLfloat triangles[] = {
0.0f, 0.75f, -0.2f,
-0.25f, 0.0f, 0.2f,
0.0f, -0.75f, 0.2f,
0.5f, 0.0f, 0.2f
};
glBufferData(GL_ARRAY_BUFFER, sizeof(triangles), triangles, GL_STATIC_DRAW);
// glVertexAttribPointer操作的是[当前绑定]到GL_ARRAY_BUFFER上的VBO
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); // index与shader中的location对应
glEnableVertexAttribArray(0); // index与shader中的location对应,enable状态也是记录在vao中
glBindBuffer(GL_ARRAY_BUFFER, buffers[1]);
GLfloat texCoords[] = {
0.0f, 1.0f,
0.0f, 0.0f,
1.0f, 0.0f,
1.0f, 1.0f
};
glBufferData(GL_ARRAY_BUFFER, sizeof(texCoords), texCoords, GL_STATIC_DRAW);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(1);
initWrapBox(-0.25f, -0.75f, -0.2f, 0.5f, 0.75f, 0.2f);
}
Triangles::~Triangles() {
glDeleteBuffers(2, buffers);
glDeleteVertexArrays(1, &vao);
app_log("Triangles destructor~~~\n");
}
void Triangles::draw() {
Shape::draw();
glUniform1i(transformEnabledLocation, 1); // 开启shader中的transform
modelColorFactorV4[3] = 1.0f;
glUniform4fv(modelColorFactorLocation, 1, modelColorFactorV4);
glBindTexture(GL_TEXTURE_2D, TextureUtils::textureIds[0]); // green texture
glBindVertexArray(vao);
glUniform4fv(modelColorFactorLocation, 1, modelColorFactorV4);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
// 包围盒
drawWrapBox3D();
// wrapBox2D
drawWrapBox2D();
}
|
4592c2b8f86c48b0298bfaf8e69b278017c09f5c | 46c4ffadd9012276683e8dc712de977fdaa58e35 | /CIS2013_Week11_Lab1.cpp | 887f46f6aed10045d27bb9a7566f0da4d84cd883 | [] | no_license | sonnyicks/CIS2013_Week11_Lab1 | dd819bd5c82cf8657636bf1861fb3e581c187c67 | 39dc844cf406494225056e6f1921590fb290916f | refs/heads/master | 2020-03-08T12:56:16.265219 | 2018-04-05T01:11:13 | 2018-04-05T01:11:13 | 128,143,666 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 727 | cpp | CIS2013_Week11_Lab1.cpp | #include <iostream>
#include <cstring>
using namespace std;
struct myDate {
int day;
int month;
int year;
};
struct person {
myDate birthday;
string firstname;
string lastname;
int age;
};
int main(){
person sonny;
myDate sonny_bday;
myDate tom_bday;
sonny.firstname = "Sonny";
sonny.lastname = "Icks";
sonny.age = 32;
cout << "Enter Sonny's birthday day: ";
cin >> sonny.birthday.day;
cout << "Enter Sonny's birthday year: ";
cin >> sonny.birthday.year;
cout << "Enter Sonny's birthday month: ";
cin >> sonny.birthday.month;
cout << sonny.firstname << " " << sonny.lastname << "'s birthday is ";
cout << sonny.birthday.day << sonny.birthday.month << sonny.birthday.year;
return 0;
}
|
53e14f3138153fe38890a586e8892469bb461af0 | 5ee7b59b955ebde297f0dd924382a96a79771681 | /dbsplnr/PlnrQClcAEnv.h | d47fc9bbbcc7596a35be1a21b448f5d2e6ccb54b | [] | no_license | epsitech/planar | a3b22468e6718342218143538a93e7af50debee0 | e97374190feaf229dac4ec941e19f6661150e400 | refs/heads/master | 2021-01-21T04:25:32.542626 | 2016-08-07T19:20:49 | 2016-08-07T19:20:49 | 48,572,177 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,909 | h | PlnrQClcAEnv.h | /**
* \file PlnrQClcAEnv.h
* Dbs and XML wrapper for table TblPlnrQClcAEnv (declarations)
* \author Alexander Wirthmueller
* \date created: 4 Dec 2015
* \date modified: 4 Dec 2015
*/
#ifndef PLNRQCLCAENV_H
#define PLNRQCLCAENV_H
// IP myInclude --- BEGIN
#include <dartcore/MyDbs.h>
// IP myInclude --- END
// IP pgInclude --- BEGIN
#include <dartcore/PgDbs.h>
// IP pgInclude --- END
#include <dartcore/Xmlio.h>
using namespace Xmlio;
/**
* PlnrQClcAEnv: record of TblPlnrQClcAEnv
*/
class PlnrQClcAEnv {
public:
PlnrQClcAEnv(const ubigint qref = 0, const ubigint jref = 0, const uint jnum = 0, const ubigint ref = 0, const ubigint x1RefPlnrMCalcitem = 0, const string x2SrefKKey = "", const string titX2SrefKKey = "", const string Val = "");
public:
ubigint qref;
ubigint jref;
uint jnum;
ubigint ref;
ubigint x1RefPlnrMCalcitem;
string x2SrefKKey;
string titX2SrefKKey;
string Val;
public:
void writeXML(xmlTextWriter* wr, string difftag = "", bool jnumattr = false, bool shorttags = false);
};
/**
* ListPlnrQClcAEnv: recordset of TblPlnrQClcAEnv
*/
class ListPlnrQClcAEnv {
public:
ListPlnrQClcAEnv();
ListPlnrQClcAEnv(const ListPlnrQClcAEnv& src);
~ListPlnrQClcAEnv();
void clear();
unsigned int size() const;
void append(PlnrQClcAEnv* rec);
ListPlnrQClcAEnv& operator=(const ListPlnrQClcAEnv& src);
public:
vector<PlnrQClcAEnv*> nodes;
public:
void writeXML(xmlTextWriter* wr, string difftag = "");
};
/**
* TblPlnrQClcAEnv: C++ wrapper for table TblPlnrQClcAEnv
*/
class TblPlnrQClcAEnv {
public:
TblPlnrQClcAEnv();
virtual ~TblPlnrQClcAEnv();
public:
virtual bool loadRecBySQL(const string& sqlstr, PlnrQClcAEnv** rec);
virtual ubigint loadRstBySQL(const string& sqlstr, const bool append, ListPlnrQClcAEnv& rst);
virtual void insertRec(PlnrQClcAEnv* rec);
ubigint insertNewRec(PlnrQClcAEnv** rec = NULL, const ubigint jref = 0, const uint jnum = 0, const ubigint ref = 0, const ubigint x1RefPlnrMCalcitem = 0, const string x2SrefKKey = "", const string titX2SrefKKey = "", const string Val = "");
ubigint appendNewRecToRst(ListPlnrQClcAEnv& rst, PlnrQClcAEnv** rec = NULL, const ubigint jref = 0, const uint jnum = 0, const ubigint ref = 0, const ubigint x1RefPlnrMCalcitem = 0, const string x2SrefKKey = "", const string titX2SrefKKey = "", const string Val = "");
virtual void insertRst(ListPlnrQClcAEnv& rst);
virtual void updateRec(PlnrQClcAEnv* rec);
virtual void updateRst(ListPlnrQClcAEnv& rst);
virtual void removeRecByQref(ubigint qref);
virtual void removeRstByJref(ubigint jref);
virtual bool loadRecByQref(ubigint qref, PlnrQClcAEnv** rec);
virtual ubigint loadRstByJref(ubigint jref, const bool append, ListPlnrQClcAEnv& rst);
};
// IP myTbl --- BEGIN
/**
* MyPlnrQClcAEnv: C++ wrapper for table TblPlnrQClcAEnv (MySQL database)
*/
class MyTblPlnrQClcAEnv : public TblPlnrQClcAEnv, public MyTable {
public:
MyTblPlnrQClcAEnv();
~MyTblPlnrQClcAEnv();
public:
void initStatements();
public:
MYSQL_STMT* stmtInsertRec;
MYSQL_STMT* stmtUpdateRec;
MYSQL_STMT* stmtRemoveRecByQref;
MYSQL_STMT* stmtRemoveRstByJref;
public:
bool loadRecBySQL(const string& sqlstr, PlnrQClcAEnv** rec);
ubigint loadRstBySQL(const string& sqlstr, const bool append, ListPlnrQClcAEnv& rst);
void insertRec(PlnrQClcAEnv* rec);
void insertRst(ListPlnrQClcAEnv& rst);
void updateRec(PlnrQClcAEnv* rec);
void updateRst(ListPlnrQClcAEnv& rst);
void removeRecByQref(ubigint qref);
void removeRstByJref(ubigint jref);
bool loadRecByQref(ubigint qref, PlnrQClcAEnv** rec);
ubigint loadRstByJref(ubigint jref, const bool append, ListPlnrQClcAEnv& rst);
};
// IP myTbl --- END
// IP pgTbl --- BEGIN
/**
* PgPlnrQClcAEnv: C++ wrapper for table TblPlnrQClcAEnv (PgSQL database)
*/
class PgTblPlnrQClcAEnv : public TblPlnrQClcAEnv, public PgTable {
public:
PgTblPlnrQClcAEnv();
~PgTblPlnrQClcAEnv();
public:
void initStatements();
private:
bool loadRec(PGresult* res, PlnrQClcAEnv** rec);
ubigint loadRst(PGresult* res, const bool append, ListPlnrQClcAEnv& rst);
bool loadRecByStmt(const string& srefStmt, const unsigned int N, const char** vals, const int* l, const int* f, PlnrQClcAEnv** rec);
ubigint loadRstByStmt(const string& srefStmt, const unsigned int N, const char** vals, const int* l, const int* f, const bool append, ListPlnrQClcAEnv& rst);
public:
bool loadRecBySQL(const string& sqlstr, PlnrQClcAEnv** rec);
ubigint loadRstBySQL(const string& sqlstr, const bool append, ListPlnrQClcAEnv& rst);
void insertRec(PlnrQClcAEnv* rec);
void insertRst(ListPlnrQClcAEnv& rst);
void updateRec(PlnrQClcAEnv* rec);
void updateRst(ListPlnrQClcAEnv& rst);
void removeRecByQref(ubigint qref);
void removeRstByJref(ubigint jref);
bool loadRecByQref(ubigint qref, PlnrQClcAEnv** rec);
ubigint loadRstByJref(ubigint jref, const bool append, ListPlnrQClcAEnv& rst);
};
// IP pgTbl --- END
#endif
|
3e2a3eff2b0b912c113a1ff049971909ec8533eb | 9979174636ac45a943c762cb8630520e62a686ca | /world/Source/World/Net/Binary.h | 2cca690e917edb8c407c4ac7fe41b3a9751d4770 | [] | no_license | pirunxi/world | 38e3ff54ced8d9546266d67b915060d7a6833305 | 134e9c30e53a1f0e5e7c89280b41797b380c1fbb | refs/heads/master | 2021-01-21T06:46:49.947145 | 2017-09-13T06:16:43 | 2017-09-13T06:16:43 | 101,946,591 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 510 | h | Binary.h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
/**
*
*/
class Binary
{
public:
static char EMPTY_BYTES[];
Binary(const char* data, int size, bool owner = false);
Binary();
void operator = (const Binary& b);
void operator = (Binary&& b);
Binary(const Binary&) = delete;
virtual ~Binary();
const char* data() { return _data; }
int size() { return _size; }
void Replace(const char* data, int size);
private:
const char* _data;
int _size;
};
|
8c193d3b5a3c59c84045d927b38b0eb107c88ec6 | 033e1e353d1ff07c8680e0be7c83081906f4fcdb | /RideTheFlow/src/scene/SceneManager.cpp | efbce4483f62d8e4f7994b69471fc53d97ab8e89 | [] | no_license | KataSin/KozinKataoka | 572d897cdb777b241a2848ff18c691c7f10d7d31 | 1b15b3a12364e34561c042f3b97b99d9a4482852 | refs/heads/master | 2021-01-11T18:21:41.396200 | 2017-07-06T15:00:10 | 2017-07-06T15:00:10 | 69,627,602 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 3,211 | cpp | SceneManager.cpp | #define NOMINMAX
#include"SceneManager.h"
#include"IScene.h"
#include <algorithm>
#include "../time/Time.h"
#include "../input/GamePad.h"
#include "../input/Keyboard.h"
#include "../UIactor/SceneChangeManager/SceneChangeManager.h"
const int SceneManager::MaxStageCount = 2;
//コンストラクタ
SceneManager::SceneManager() :
mStageCount(1),
mIsGameEnd(false)
{
}
//更新前初期化
void SceneManager::Initialize() {
End();
mScenes.clear();
//wo.Clear();
}
//更新
void SceneManager::Update() {
mCurrentScene->Update();
wo.UpdateUI(PLAYER_NUMBER::PLAYER_NULL);
}
//描画
void SceneManager::Draw() {
mCurrentScene->Draw();
wo.UIDraw();
}
//終了
void SceneManager::End() {
mCurrentScene->End();
}
void SceneManager::Change()
{
//シーンチェンジ中は変更できない
if (mCurrentScene->IsEnd()&& static_cast<SceneChangeManager*>(mChangeUi.get())->GetNoBlockFlag())
{
ChangeSceneSet(mCurrentScene->Next());
static_cast<SceneChangeManager*>(mChangeUi.get())->ChangeJudge(true);
}
if (static_cast<SceneChangeManager*>(mChangeUi.get())->GetYesBlockFlag())
{
Change(mCurrentScene->Next());
static_cast<SceneChangeManager*>(mChangeUi.get())->ChangeJudge(false);
}
}
//シーンの追加
void SceneManager::Add(Scene name, const IScenePtr& scene) {
mScenes[name] = scene;
}
void SceneManager::SetScene(Scene name) {
mCurrentScene = mScenes[name];
mCurrentScene->Initialize();
}
//シーンの変更
void SceneManager::Change(Scene name) {
Scene now = Scene::None;
for (auto& i : mScenes)
{
if (mCurrentScene == i.second)
now = i.first;
}
End();
mCurrentScene = mScenes[name];
mCurrentScene->Initialize();
}
// 初期化を指定する
void SceneManager::Init(Scene name)
{
mScenes.at(name)->Initialize();
}
// 終了処理を指定する
void SceneManager::Final(Scene name)
{
mScenes.at(name)->End();
}
static int _Clamp(int t, int min, int max)
{
return std::min(max, std::max(t, min));
}
void SceneManager::SetStageCount(int n)
{
mStageCount = _Clamp(n, 0, SceneManager::MaxStageCount);
}
void SceneManager::SetChangeUi()
{
UIActorPtr ui = std::make_shared<SceneChangeManager>(wo);
mChangeUi = ui;
wo.UIAdd(UI_ID::CHANGE_BLOK_UI, ui);
}
bool SceneManager::GetEndFlag()
{
return mCurrentScene->GetGameEndFlag();
}
void SceneManager::ChangeSceneSet(Scene scene)
{
switch (scene)
{
case Scene::Title:
static_cast<SceneChangeManager*>(mChangeUi.get())->SpriteSet(SPRITE_ID::SCENE_CHANGE_TITLE_SPRITE);
break;
case Scene::GamePlay:
{
if (mScenes[mCurrentScene->Next()] == mCurrentScene)
static_cast<SceneChangeManager*>(mChangeUi.get())->SpriteSet(SPRITE_ID::SCENE_CHANGE_NEXT_RAUND_SPRITE);
else
static_cast<SceneChangeManager*>(mChangeUi.get())->SpriteSet(SPRITE_ID::SCENE_CHANGE_GAME_PLAY_SPRITE);
break;
}
case Scene::Select:
static_cast<SceneChangeManager*>(mChangeUi.get())->SpriteSet(SPRITE_ID::SCENE_CHANGE_STAGE_SELECT_SPRITE);
break;
case Scene::Result:
static_cast<SceneChangeManager*>(mChangeUi.get())->SpriteSet(SPRITE_ID::SCENE_CHANGE_RESULT_SPRITE);
break;
case Scene::Help:
static_cast<SceneChangeManager*>(mChangeUi.get())->SpriteSet(SPRITE_ID::SCENE_CHANGE_HELP_SPRITE);
break;
}
}
|
b5296263b3df25fe3590a8aeca48a9b1f5bd265c | eda03521b87da8bdbef6339b5b252472a5be8d23 | /Userland/Libraries/LibC/utsname.cpp | e8585c16b927495b6c9683bcff6aec6c45cd65e2 | [
"BSD-2-Clause"
] | permissive | SerenityOS/serenity | 6ba3ffb242ed76c9f335bd2c3b9a928329cd7d98 | ef9b6c25fafcf4ef0b44a562ee07f6412aeb8561 | refs/heads/master | 2023-09-01T13:04:30.262106 | 2023-09-01T08:06:28 | 2023-09-01T10:45:38 | 160,083,795 | 27,256 | 3,929 | BSD-2-Clause | 2023-09-14T21:00:04 | 2018-12-02T19:28:41 | C++ | UTF-8 | C++ | false | false | 308 | cpp | utsname.cpp | /*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <errno.h>
#include <sys/utsname.h>
#include <syscall.h>
extern "C" {
int uname(struct utsname* buf)
{
int rc = syscall(SC_uname, buf);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
}
|
04f44e19e5cea067593e57c31834934cb8bf1936 | cbd6b46a59217034ba6220c123142d8149857c59 | /155BFinal/RayTraceSetup155B.cpp | 07ea4e4fdd53c2a9147cbc81d73a515eef01f499 | [] | no_license | xih108/Math155B | 9740806dc7082262cb3ded20df8a0dc4d62e30f1 | 787ebabc8511c9127f49dc3e62f41a9f211a53c4 | refs/heads/master | 2021-07-12T06:32:09.499544 | 2020-07-23T22:51:41 | 2020-07-23T22:51:41 | 181,986,775 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,945 | cpp | RayTraceSetup155B.cpp | /*
*
* RayTrace Software Package, release 4.beta, May 2018.
*
* Author: Samuel R. Buss
*
* Software accompanying the book
* 3D Computer Graphics: A Mathematical Introduction with OpenGL,
* by S. Buss, Cambridge University Press, 2003.
*
* Software is "as-is" and carries no warranty. It may be used without
* restriction, but if you modify it, please change the filenames to
* prevent confusion between different versions. Please acknowledge
* all use of the software in any publications or products based on it.
*
* Bug reports: Sam Buss, sbuss@ucsd.edu.
* Web page: http://math.ucsd.edu/~sbuss/MathCG
*
*/
#include "RayTraceSetup155B.h"
#include "../Graphics/Material.h"
#include "../Graphics/ViewableSphere.h"
#include "../Graphics/ViewableEllipsoid.h"
#include "../Graphics/ViewableCone.h"
#include "../Graphics/ViewableTorus.h"
#include "../Graphics/ViewableTriangle.h"
#include "../Graphics/ViewableParallelogram.h"
#include "../Graphics/ViewableCylinder.h"
#include "../Graphics/ViewableParallelepiped.h"
#include "../Graphics/ViewableBezierSet.h"
#include "../Graphics/TextureCheckered.h"
#include "../Graphics/TextureBilinearXform.h"
#include "../Graphics/TextureSequence.h"
#include "../Graphics/Light.h"
#include "../Graphics/CameraView.h"
#include "../RaytraceMgr/SceneDescription.h"
// ******************************************
SceneDescription TheScene155B; // The scene as created by the routines below
// ******************************************
void SetupScene155B()
{
SetUpMaterials155B(TheScene155B);
SetUpLights155B(TheScene155B);
SetUpViewableObjects155B(TheScene155B);
}
void SetUpMaterials155B(SceneDescription& scene) {
// Initialize Array of Materials
// First material for the floor (yellow)
Material* mat0 = new Material;
scene.AddMaterial(mat0);
mat0->SetColorAmbientDiffuse(0.5, 0.5, 0.0);
mat0->SetColorSpecular(0.8, 0.8, 0.8);
mat0->SetColorReflective(0.6, 0.6, 0.6);
mat0->SetShininess(512); // Specular exponent
// Second material for the floor (bright blue)
Material* mat1 = new Material;
scene.AddMaterial(mat1);
mat1->SetColorAmbientDiffuse(0.0, 0.2, 0.8);
mat1->SetColorSpecular(0.8, 0.8, 0.8);
mat1->SetColorReflective(0.6, 0.6, 0.6);
mat1->SetShininess(512);
// Material for side walls, dark yellow
Material* mat2 = new Material;
scene.AddMaterial(mat2);
mat2->SetColorAmbientDiffuse(0.3, 0.3, 0.0);
mat2->SetColorSpecular(0.8, 0.8, 0.8);
mat2->SetColorReflective(0.8, 0.8, 0.4);
mat2->SetShininess(160);
// White. Goes on back wall and a sphere under a texture map
Material* mat3 = new Material;
scene.AddMaterial(mat3);
mat3->SetColorAmbientDiffuse(0.6, 0.6, 0.6);
mat3->SetColorSpecular(0.4, 0.4, 0.4);
mat3->SetColorReflective(0.1, 0.1, 0.1);
mat3->SetShininess(80);
//mat3->SetUseFresnel(true); // Default is to not use Fresnel approximation
//mat3->SetUseFresnel(true); // Default is to not use Fresnel approximation
// Black, with a high gloss
Material* mat4 = new Material;
scene.AddMaterial(mat4);
mat4->SetColorAmbientDiffuse(0.0, 0.0, 0.0);
mat4->SetColorSpecular(0.95, 0.95, 0.95);
mat4->SetColorReflective(0.0, 0.0, 0.0);
mat4->SetShininess(160);
// Glass with a specular highlight
Material* mat5 = new Material;
scene.AddMaterial(mat5);
mat5->SetColorAmbientDiffuse(0.0, 0.0, 0.0);
mat5->SetColorSpecular(0.3, 0.3, 0.3);
mat5->SetColorReflective(0.3, 0.3, 0.3);
mat5->SetColorTransmissive(1.0, 1.0, 1.0);
mat5->SetShininess(512);
mat5->SetIndexOfRefraction(1.5); // Glass!
// A near perfect mirror
Material* mat6 = new Material;
scene.AddMaterial(mat6);
mat6->SetColorAmbientDiffuse(0.05, 0.05, 0.05);
mat6->SetColorSpecular(0.6, 0.6, 0.6);
mat6->SetColorReflective(0.95, 0.95, 0.95);
mat6->SetShininess(160);
Material* mat7 = new Material;
scene.AddMaterial(mat7);
mat7->SetColorAmbientDiffuse(0.4, 0.4, 0.4);
mat7->SetColorSpecular(0.3, 0.3, 0.3);
mat7->SetColorReflective(0.05, 0.05, 0.05);
mat7->SetShininess(160);
}
void SetUpLights155B(SceneDescription& scene) {
// Global ambient light and the background color are set here.
scene.SetGlobalAmbientLight(0.2, 0.2, 0.2);
scene.SetBackGroundColor(0.0, 0.0, 0.0);
// Initialize Array of Lights
// Both lights are white, but with no ambient component
Light* myLight0 = new Light();
scene.AddLight(myLight0);
myLight0->SetColorAmbient(0.0, 0.0, 0.0);
myLight0->SetColorDiffuse(1.0, 1.0, 1.0);
myLight0->SetColorSpecular(1.0, 1.0, 1.0);
myLight0->SetPosition(15.0, 30.0, 25.0);
Light* myLight1 = new Light();
scene.AddLight(myLight1);
myLight1->SetColorAmbient(0.0, 0.0, 0.0);
myLight1->SetColorDiffuse(1.0, 1.0, 1.0);
myLight1->SetColorSpecular(1.0, 1.0, 1.0);
myLight1->SetPosition(-15.0, 30.0, 25.0);
Light* lamp = new Light();
scene.AddLight(lamp);
lamp->SetColorAmbient(0.0, 0.0, 0.0);
lamp->SetColorDiffuse(1.0, 1.0, 1.0);
lamp->SetColorSpecular(1.0, 1.0, 1.0);
lamp->SetPosition(-2.3, 7.1, -3.0);
lamp->SetDirectional(1.0,-1.0,0.0);
}
void SetUpViewableObjects155B(SceneDescription& scene) {
// Fill the scene with viewable objects
// Vertices of two rectangles
// Consists of three verts in CCW order (4th vertex is generated automatically to make a rectangle
//float FloorVerts[3][3] = { { -8.0f,0.0f,6.0f },{ 8.0f,0.0f,6.0f },{ 8.0f,0.0f, -6.0f } };
float BackWallVerts[3][3] = { { -8.0f,0.0f,-6.0f },{ 8.0f,0.0f,-6.0f },{ 8.0f,10.0f,-6.0f } };
// Vertices for the two side triangles - in CCW order
float LeftWall[3][3] = { { -8.0f,0.0f,6.0f },{ -8.0f,0.0f,-6.0f },{ -8.0f,10.0f,-6.0f } };
float RightWall[3][3] = { { 8.0f,0.0f,6.0f },{ 8.0f,0.0f,-6.0f },{ 8.0f,10.0f,-6.0f } };
// Flat plane (the floor)
/*ViewableParallelogram* vp;
vp = new ViewableParallelogram();
vp->Init(&FloorVerts[0][0]);
vp->SetMaterial(&scene.GetMaterial(0));
scene.AddViewable(vp);*/
// Base material on floor is material 0, as set by SetMaterial
// Overlay a second material to make a checkerboard texture
/*TextureCheckered* txchecked = scene.NewTextureCheckered();
txchecked->SetMaterial1(&scene.GetMaterial(1));
txchecked->SetWidths(1.0/15.0, 1.0/9.0);
vp->TextureMap(txchecked); // This line adds the texture map "texchecked" to the floor ("vp")
*/
// Back wall
ViewableParallelogram *vw = new ViewableParallelogram();
vw->Init(&BackWallVerts[0][0]);
vw->SetMaterial(&scene.GetMaterial(3)); // Underlying material is white
scene.AddViewable(vw);
TextureCheckered* txchecked = scene.NewTextureCheckered();
txchecked->SetMaterial1(&scene.GetMaterial(7));
txchecked->SetWidths(1.0 / 15.0, 1.0 / 9.0);
vw->TextureMap(txchecked);
// Left wall (triangular)
ViewableParallelogram *vt = new ViewableParallelogram();
vt = new ViewableParallelogram();
vt->Init(&LeftWall[0][0]);
vt->SetMaterial(&scene.GetMaterial(3));
scene.AddViewable(vt);
vt->TextureMap(txchecked);
// Right wall (triangular)
ViewableParallelogram *vt1 = new ViewableParallelogram();
vt1 = new ViewableParallelogram();
vt1->Init(&RightWall[0][0]);
vt1->SetMaterial(&scene.GetMaterial(3));
scene.AddViewable(vt1);
vt1-> TextureMap(txchecked);
// Left glass sphere
// Right texture mapped sphere
/* vs = new ViewableSphere();
vs->SetCenter(5.5, 2.0, 3.0);
vs->SetRadius(2.0);
vs->SetMaterial(&scene.GetMaterial(3));
scene.AddViewable(vs);
txRgb = scene.NewTextureRgbImage("earth_clouds.bmp");
vs->TextureMap(txRgb); // Apply the RGB Image texture to the sphere.
vs->SetuvCylindrical(); // SetuvSpherical is the default
// Back mirrored cylinder
ViewableCylinder* vCyl = new ViewableCylinder();
vCyl->SetCenter(0.0, 2.4, -4.0);
vCyl->SetHeight(4.0);
vCyl->SetRadius(1.5);
vCyl->SetMaterial(&scene.GetMaterial(6));
scene.AddViewable(vCyl);*/
// Back flat black cylinder
/* vCyl = new ViewableCylinder();
vCyl->SetCenter(0.0, 0.2, -4.0);
vCyl->SetHeight(0.4);
vCyl->SetRadius(2.0);
vCyl->SetMaterial(&scene.GetMaterial(4));
scene.AddViewable(vCyl);*/
// Torus
/*ViewableTorus* vTorus = new ViewableTorus();
vTorus->SetCenter(0.0, 1.0, 3.0);
vTorus->SetRadii(2.0, 0.75);
vTorus->SetAxis(VectorR3(0.0, 1.0, 0.0));
vTorus->SetMaterial(&scene.GetMaterial(5));
scene.AddViewable(vTorus);*/
// Ellipsoid
/* ViewableEllipsoid* vEllip = new ViewableEllipsoid();
vEllip->SetCenter(-6.0, 2.0, -8.0);
vEllip->SetRadii(1.5, 0.7, 0.3);
vEllip->SetAxes(VectorR3(-1.0, 0.0, 1.0), VectorR3(0.0,1.0,0.0));
vEllip->SetMaterial(&scene.GetMaterial(0));
scene.AddViewable(vEllip);*/
/*ViewableBezierSet* vBe = new ViewableBezierSet();
VectorR4 controlPoints[] = {
VectorR4(-1,0,2,1),VectorR4(0,0,1,0),VectorR4(1,0,2,1),
VectorR4(-2,1,2,1),VectorR4(0,0,2,0),VectorR4(2,1,2,1),
VectorR4(-1 / 2,3 / 2,2,1),VectorR4(0,0,1 / 2,0),VectorR4(1 / 2,3 / 2,2,1),
VectorR4(-1,2,2,1),VectorR4(0,0,1,0),VectorR4(1,2,2,1) , };
VectorR4 controlPoints1[] = {
VectorR4(-1,0,2,1),VectorR4(0,0,-1,0),VectorR4(1,0,2,1),
VectorR4(-2,1,2,1),VectorR4(0,0,-2,0),VectorR4(2,1,2,1),
VectorR4(-1 / 2,3 / 2,2,1),VectorR4(0,0,-1 / 2,0),VectorR4(1 / 2,3 / 2,2,1),
VectorR4(-1,2,2,1),VectorR4(0,0,-1,0),VectorR4(1,2,2,1) , };
vBe->AddPatch(3, 4, controlPoints);
//vBe->AddPatch(3, 4, controlPoints1);
vBe->SetMaterial(&scene.GetMaterial(3));
TextureRgbImage* txRgb = scene.NewTextureRgbImage("mirror.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vBe->TextureMap(txRgb);
scene.AddViewable(vBe);*/
ViewableBezierSet* vBe = new ViewableBezierSet();
VectorR4 controlPoints[] = {
VectorR4(-6,0,2,1),VectorR4(0,0,1,0),VectorR4(-4,0,2,1),
VectorR4(-7,1,2,1),VectorR4(0,0,2,0),VectorR4(-3,1,2,1),
VectorR4(-5.5,1.5,2,1),VectorR4(0,0,0.5,0),VectorR4(-4.5,1.5,2,1),
VectorR4(-6,2,2,1),VectorR4(0,0,1,0),VectorR4(-4,2,2,1) , };
VectorR4 controlPoints1[] = {
VectorR4(-6,0,2,1),VectorR4(0,0,-1,0),VectorR4(-4,0,2,1),
VectorR4(-7,1,2,1),VectorR4(0,0,-2,0),VectorR4(-3,1,2,1),
VectorR4(-5.5,1.5,2,1),VectorR4(0,0, -0.5,0),VectorR4(-4.5,1.5,2,1),
VectorR4(-6,2,2,1),VectorR4(0,0,-1,0),VectorR4(-4,2,2,1) , };
vBe->AddPatch(3, 4, controlPoints);
vBe->AddPatch(3, 4, controlPoints1);
vBe->SetMaterial(&scene.GetMaterial(3));
TextureRgbImage* txRgb = scene.NewTextureRgbImage("vase.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vBe->TextureMap(txRgb);
scene.AddViewable(vBe);
ViewableCylinder* vc = new ViewableCylinder();
vc->SetCenter(-5,2,2);
vc->SetRadius(1);
vc->SetHeight(0.1);
vc->SetMaterial(&scene.GetMaterial(3));
txRgb = scene.NewTextureRgbImage("mirror.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vBe->TextureMap(txRgb);
scene.AddViewable(vBe);
//vBe->SetBoundingSphereCenter(-6.0, 2.0, -8.0);
// Use a command like the following to get a handle to an object
ViewableParallelepiped *vtable = new ViewableParallelepiped();
vtable->SetVertices(VectorR3(-8.0f, -1.0f, 6.0f), VectorR3(8.0f, -1.0f, 6.0f), VectorR3(-8.0f, 0.0f, 6.0f), VectorR3(-8.0f, -1.0f, -6.0f));
vtable->SetMaterial(&scene.GetMaterial(3));
scene.AddViewable(vtable);
txRgb = scene.NewTextureRgbImage("table.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vtable->TextureMap(txRgb);
ViewableParallelepiped *vleg = new ViewableParallelepiped();
vleg->SetVertices(VectorR3(-1.5f, -5.0f, 1.5f), VectorR3(1.5f, -5.0f, 1.5f), VectorR3(-1.5f, -1.0f, 1.5f), VectorR3(-1.5f, -5.0f, -1.5f));
vleg->SetMaterial(&scene.GetMaterial(3));
scene.AddViewable(vleg);
vleg->TextureMap(txRgb);
/*ViewableSphere* vs;
vs = new ViewableSphere();
vs->SetCenter(-5.5, 2.0, 3.0);
vs->SetRadius(1.0);
vs->SetMaterial(&scene.GetMaterial(5));
int leftSphereIdx = scene.AddViewable(vs);*/
float mirror[3][3] = { { 5.0f,0.0f,-3.0f },{ 5.0+sqrt(3.0f),0.0f,-2.0f },{ 7, 3*sqrt(3.0f)/2, -2.0f } };
ViewableParallelogram* vmirror;
vmirror = new ViewableParallelogram();
vmirror->Init(& mirror[0][0]);
vmirror->SetMaterialFront(&scene.GetMaterial(6));
vmirror->SetMaterialBack(&scene.GetMaterial(3));
scene.NewTextureRgbImage("mirror.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vmirror->TextureMap(txRgb);
scene.AddViewable(vmirror);
float mirrorf[3][3] = { { 3.0f,0.1f,-5.0f },{ 5.0f,0.1f,-3.0f },{ 6.0f,4.0f, -4.0f } };
/*ViewableParallelepiped* vmirrorf = new ViewableParallelepiped();
vmirrorf->SetVertices(VectorR3(5.1f,0.0f,-3.0f), VectorR3( 5.1f,0.0f, -3.0f ), VectorR3(6.1f, 4.1f, -4.0f), VectorR3(3.0f, 0.0f, -5.1f));
vmirrorf->SetMaterial(&scene.GetMaterial(0));
scene.AddViewable(vmirrorf);
*/
// Back mirrored cylinder
ViewableCylinder* vmirrorf1 = new ViewableCylinder();
vmirrorf1->SetCenter(6.2, 0.5, -2.6);
vmirrorf1->SetHeight(2.0);
vmirrorf1->SetRadius(0.1);
vmirrorf1->SetMaterial(&scene.GetMaterial(3));
scene.NewTextureRgbImage("mirror.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vmirrorf1->TextureMap(txRgb);
scene.AddViewable(vmirrorf1);
ViewableParallelepiped *vcmp = new ViewableParallelepiped();
vcmp->SetVertices(VectorR3(-3.0f, 1.5f, 0.0f), VectorR3(3.0f, 1.5f, 0.0f), VectorR3(-3.0f, 5.7f, 0.0f), VectorR3(-3.0f, 1.5f, -0.5f));
vcmp->SetMaterial(&scene.GetMaterial(3));
scene.AddViewable(vcmp);
txRgb = scene.NewTextureRgbImage("monitor.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vcmp->TextureMap(txRgb); // Apply the RGB Image texture to the back wall.
ViewableParallelepiped *vbase = new ViewableParallelepiped();
vbase->SetVertices(VectorR3(-1.5f, 0.0f, 0.2f), VectorR3(1.5f, 0.0f, 0.2f), VectorR3(-1.5f, 0.2f, 0.2f), VectorR3(-1.5f, 0.0f, -1.8f));
vbase->SetMaterialOuter(&scene.GetMaterial(3));
scene.AddViewable(vbase);
txRgb = scene.NewTextureRgbImage("monitor.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vbase->TextureMap(txRgb);
ViewableParallelepiped *vbase1 = new ViewableParallelepiped();
vbase1->SetVertices(VectorR3(-0.7f, 0.2f, -0.5f), VectorR3(0.7f, 0.2f, -0.5f), VectorR3(-0.7f, 3.0f, -0.5f), VectorR3(-0.7f, 0.2f, -0.7f));
vbase1->SetMaterialOuter(&scene.GetMaterial(3));
scene.AddViewable(vbase1);
txRgb = scene.NewTextureRgbImage("mirror.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vbase1->TextureMap(txRgb);
float Screen[3][3] = { { -2.8f,1.7f,0.01f },{ 2.8f,1.7f,0.01f },{ 2.8f, 5.5f,0.01f } };
ViewableParallelogram *vscreen = new ViewableParallelogram();
vscreen -> Init(&Screen[0][0]);
vscreen->SetMaterial(&scene.GetMaterial(4));
scene.AddViewable(vscreen);
ViewableParallelepiped *vkey = new ViewableParallelepiped();
vkey->SetVertices(VectorR3(-2.0f, 0.0f, 3.0f), VectorR3(2.0f, 0.0f, 3.0f), VectorR3(-2.0f, 0.2f, 3.0f), VectorR3(-2.0f, 0.1f, 1.5f));
vkey->SetMaterialOuter(&scene.GetMaterial(3));
scene.AddViewable(vkey);
txRgb = scene.NewTextureRgbImage("keyboard.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vkey->TextureMap(txRgb);
ViewableParallelepiped *vs1 = new ViewableParallelepiped();
vs1->SetVertices(VectorR3(-1.8f, 0.0f, 1.7f), VectorR3(-1.7f, 0.0f, 1.7f), VectorR3(-1.8f, 0.09f, 1.7f), VectorR3(-1.8f, 0.0f, 1.6f));
vs1->SetMaterialOuter(&scene.GetMaterial(3));
scene.AddViewable(vs1);
txRgb = scene.NewTextureRgbImage("monitor.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vs1->TextureMap(txRgb);
ViewableParallelepiped *vs2 = new ViewableParallelepiped();
vs2->SetVertices(VectorR3(1.8f, 0.0f, 1.7f), VectorR3(1.7f, 0.0f, 1.7f), VectorR3(1.8f, 0.09f, 1.7f), VectorR3(1.8f, 0.0f, 1.6f));
vs2->SetMaterialOuter(&scene.GetMaterial(3));
scene.AddViewable(vs2);
txRgb = scene.NewTextureRgbImage("monitor.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vs2->TextureMap(txRgb);
ViewableCylinder* vlbase = new ViewableCylinder();
vlbase->SetCenter(-5.5, 0.1, -3.0);
vlbase->SetHeight(0.2);
vlbase->SetRadius(1.52);
vlbase->SetMaterial(&scene.GetMaterial(3));
txRgb = scene.NewTextureRgbImage("lamp.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vlbase->TextureMap(txRgb);
scene.AddViewable(vlbase);
ViewableCylinder* vls1 = new ViewableCylinder();
vls1->SetCenter(-5.5, 2.75, -3.0);
vls1->SetHeight(5);
vls1->SetRadius(0.1);
vls1->SetMaterial(&scene.GetMaterial(3));
scene.AddViewable(vls1);
vls1->TextureMap(txRgb);
ViewableCylinder* vls2 = new ViewableCylinder();
vls2->SetCenterAxis(1.0,1.0,0.0);
vls2->SetCenter(-4.5, 6.0, -3.0);
vls2->SetHeight(5);
vls2->SetRadius(0.1);
vls2->SetMaterial(&scene.GetMaterial(3));
scene.AddViewable(vls2);
vls2->TextureMap(txRgb);
ViewableCylinder* vls3 = new ViewableCylinder();
vls3->SetCenterAxis(1.0, -1.0, 0.0);
vls3->SetCenter(-2.8, 7.6, -3.0);
vls3->SetHeight(0.5);
vls3->SetRadius(0.3);
vls3->SetMaterial(&scene.GetMaterial(3));
scene.AddViewable(vls3);
vls3->TextureMap(txRgb);
ViewableCone *vlamp = new ViewableCone();
vlamp->SetCenterAxis(-1.0, 1.0, 0.0);
vlamp->SetApex(-2.8, 7.6, -3.0);
vlamp->SetHeight(1.5);
vlamp->SetMaterialOuter(&scene.GetMaterial(3));
vlamp->SetMaterialInner(&scene.GetMaterial(2));
scene.AddViewable(vlamp);
vlamp->TextureMap(txRgb);
ViewableSphere *vlight = new ViewableSphere();
vlight->SetCenter(-2.3, 7.1, -3.0);
vlight->SetRadius(0.5);
vlight->SetMaterial(&scene.GetMaterial(5));
scene.AddViewable(vlamp);
ViewableCylinder *vtb = new ViewableCylinder();
vtb->SetCenterAxis(1.0,0.0,0.0);
vtb->SetCenter(4.5,0.2,1.5);
vtb->SetRadius(0.2);
vtb->SetHeight(2);
vtb->SetMaterial(&scene.GetMaterial(3));
txRgb = scene.NewTextureRgbImage("mirror.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vtb->TextureMap(txRgb);
scene.AddViewable(vtb);
float Touch[3][3] = { { 3.5f, 0.0f, 3.0f },{ 5.5f, 0.0f, 3.0f },{ 5.5f, 0.4f, 1.5f } };
ViewableParallelogram *vtp= new ViewableParallelogram();
vtp->Init(&Touch[0][0]);
vtp->SetMaterial(&scene.GetMaterial(3));
txRgb = scene.NewTextureRgbImage("monitor.bmp");
txRgb->SetBlendMode(TextureRgbImage::MultiplyColors);
vtp->TextureMap(txRgb);
scene.AddViewable(vtp);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.