lang
stringclasses
3 values
file_path
stringlengths
5
150
repo_name
stringlengths
6
110
commit
stringlengths
40
40
file_code
stringlengths
1.52k
18.9k
prefix
stringlengths
82
16.5k
suffix
stringlengths
0
15.1k
middle
stringlengths
121
8.18k
strategy
stringclasses
8 values
context_items
listlengths
0
100
C++
Samples/NiUserSelection/DefaultTrackingInitializer.cpp
Wessi/OpenNI
613b0a43e66e1e97488624dec285341bc047d6d4
#include "DefaultTrackingInitializer.h" DefaultTrackingInitializer::DefaultTrackingInitializer(xn::UserGenerator *pUserGenerator) : TrackingInitializer(pUserGenerator), m_hCalibrationStartCallback(NULL...
#include "DefaultTrackingInitializer.h" DefaultTrackingInitializer::DefaultTrackingInitializer(xn::UserGenerator *pUserGenerator) : TrackingInitializer(pUserGenerator), m_hCalibrationStartCallback(NULL...
XnStatus DefaultTrackingInitializer::CalibrationStart(XnUserID ) { return XN_STATUS_OK; } XnStatus DefaultTrackingInitializer::CalibrationComplete(XnUserID nUserId,XnCalibrationStatus eStatus) { XnBool retVal=FALSE; if (eStatus == XN_CALIBRATION_STATUS_OK) { if(m_pUserGenerator->GetSk...
if(m_pUserGenerator->GetSkeletonCap().IsTracking(nUserId)==TRUE) { XnStatus res=m_pUserGenerator->GetSkeletonCap().StopTracking(nUserId); return res; } return m_pUserGenerator->GetSkeletonCap().AbortCalibration(nUserId); }
function_block-function_prefix_line
[ { "content": "XN_C_API XnBool XN_C_DECL xnProfilingIsActive();\n", "file_path": "Include/XnProfiling.h", "rank": 0, "score": 107637.93107806591 }, { "content": "XN_C_API XnBool XN_C_DECL xnLoggerIsEnabled(XnLogger* pLogger, XnLogSeverity severity);\n", "file_path": "Include/XnLog.h", ...
C++
src/game/scenes/GameScene.cpp
rkolovanov/game-sapper
b59b6a8ac56b5337c880ba26dbabf0200318dd93
#include "GameScene.h" #include "../Game.h" #include "../audio/MusicManager.h" #include "MainMenuScene.h" #include <random> #include <iostream> Game::Scenes::GameScene::GameScene(Game& game, size_t sizeX, size_t sizeY, size_t minesNumber) : Scene(game), m_field(sizeX, sizeY) { this->m_minesNumber = minesNumber; ...
#include "GameScene.h" #include "../Game.h" #include "../audio/MusicManager.h" #include "MainMenuScene.h" #include <random> #include <iostream> Game::Scenes::GameScene::GameScene(Game& game, size_t sizeX, size_t sizeY, size_t minesNumber) : Scene(game), m_field(sizeX, sizeY) { this->m_minesNumber = minesNumber; ...
} else { ++markedCells; } } else { ++uncheckedCells; } } } catch (const std::invalid_argument&) { } } } if (markedMines...
if (cell.isChecked) { return; } cell.isChecked = true; if (cell.nearbyMinesNumber == 0) { std::vector<std::pair<size_t, size_t>> shifts = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, ...
random
[ { "content": "#ifndef GAME_SAPPER_SRC_GAME_FIELD_CELL_H\n\n#define GAME_SAPPER_SRC_GAME_FIELD_CELL_H\n\n\n\n#include <cstddef>\n\n\n\n\n\nstruct Cell {\n\n size_t nearbyMinesNumber;\n\n bool isMine;\n\n bool isChecked;\n\n bool isMarked;\n\n};\n\n\n\n\n", "file_path": "src/game/field/Cell.h", ...
C++
include/torquis/split.hpp
devfix/torquis
5d42ee8e6af332bbfc5aaa2741405e72109e3d14
#ifndef TORQUIS_INCLUDE_GUARD #error "Do not include this file directly, include tho torquis.hpp" #endif #ifndef TORQUIS_SPLIT_HPP #define TORQUIS_SPLIT_HPP namespace torquis { template<typename CharT> [[nodiscard]] std::vector<std::basic_string_view<CharT>> split(const std::basic_string_view<CharT> str, const ...
#ifndef TORQUIS_INCLUDE_GUARD #error "Do not include this file directly, include tho torquis.hpp" #endif #ifndef TORQUIS_SPLIT_HPP #define TORQUIS_SPLIT_HPP namespace torquis { template<typename CharT> [[nodiscard]] std::vector<std::basic_string_view<CharT>> split(const std::basic_string_view<CharT> str, const ...
()) { std::size_t prev = 0, curr; do { curr = str.find(delim, prev); if (curr == std::string::npos) { parts.push_back(str.substr(prev)); } else { parts.push_back(str.substr(prev, curr - prev)); } prev = curr + delim.length(); } while (curr != std::string::npos && prev <= str.length()); }...
d::basic_string_view<CharT>> parts; std::size_t prev = 0, curr; do { curr = str.find(delim, prev); if (curr == std::string::npos) { parts.push_back(str.substr(prev)); } else { parts.push_back(str.substr(prev, curr - prev)); } prev = curr + 1; } while (curr != std::string::npos); return parts; } ...
random
[ { "content": "\n\n#define TORQUIS_INCLUDE_GUARD\n\n#include \"torquis/join.hpp\"\n\n#include \"torquis/replace.hpp\"\n\n#include \"torquis/split.hpp\"\n\n#include \"torquis/tolower.hpp\"\n\n#include \"torquis/toupper.hpp\"\n\n#undef TORQUIS_INCLUDE_GUARD\n\n\n\n#endif //TORQUIS_HPP\n", "file_path": "include...
C++
atlas_npu/ascendbase/src/Base/SingleOpProcess/SingleOpProcess.cpp
wangshankun/Tengine_Atlas
b5485039e72b4a624c795ff95d73eb6d719c7706
#include "SingleOpProcess.h" #include "acl/acl.h" SingleOpProcess::SingleOpProcess() : inputTensorNum_(0), outputTensorNum_(0), stream_(nullptr), attr_(nullptr), withHandle_(false), opHandle_(nullptr) {} SingleOpProcess::SingleOpProcess(const aclrtStream &stream) : inputTensorNum_(0), outputTensorNum_(0), a...
#include "SingleOpProcess.h" #include "acl/acl.h" SingleOpProcess::SingleOpProcess() : inputTensorNum_(0), outputTensorNum_(0), stream_(nullptr), attr_(nullptr), withHandle_(false), opHandle_(nullptr) {} SingleOpProcess::SingleOpProcess(const aclrtStream &stream) : inputTensorNum_(0), outputTensorNum_(0), a...
e); } return APP_ERR_OK; } void SingleOpProcess::SetInputTensorNum(int num) { inputTensorNum_ = num; } int SingleOpProcess::GetInputTensorNum() const { return inputTensorNum_; } void SingleOpProcess::SetOutputTensorNum(int num) { outputTensorNum_ = num; } int SingleOpProcess::GetOutputTensorNum() ...
tream_ = nullptr; } void SingleOpProcess::SetTypeName(std::string typeName) { typeName_ = typeName; } std::string SingleOpProcess::GetTypeName() { return typeName_; } APP_ERROR SingleOpProcess::SetInputTensor(std::vector<Tensor> tensors) { inputTensorDesc_.clear(); for (int i = 0; i < inputTensorNum_; ...
random
[ { "content": " uint8_t *data = nullptr; // Image data\n", "file_path": "atlas_npu/ascendbase/src/Base/CommonDataType/CommonDataType.h", "rank": 0, "score": 95849.1341938177 }, { "content": "template<typename T> FLATBUFFERS_CONSTEXPR inline bool IsConst...
C++
src/scanner/src/scanner.cpp
zainmehdi/graphslam
7abb9fd99e03f422e98571b89c6fb03208a7a64f
#include "utils.hpp" #include "scanner.hpp" #include <iostream> int gicp_maximum_iterations; double gicp_maximum_correspondence_distance, gicp_transformation_epsilon, gicp_euclidean_fitness_epsilon; int loop_closure_skip; double fitness_keyframe_threshold, fitness_loop_threshold, distance_threshold, rotation_threshol...
#include "utils.hpp" #include "scanner.hpp" #include <iostream> int gicp_maximum_iterations; double gicp_maximum_correspondence_distance, gicp_transformation_epsilon, gicp_euclidean_fitness_epsilon; int loop_closure_skip; double fitness_keyframe_threshold, fitness_loop_threshold, distance_threshold, rotation_threshol...
void scanner_callback(const sensor_msgs::LaserScan& input) { common::Registration output; output.first_frame_flag = false; output.keyframe_flag = false; output.loop_closure_flag = false; common::LastKeyframe keyframe_last_request; bool keyframe_last_request_retu...
if (fitness > fitness_keyframe_threshold) return true; if (fabs(Delta.pose.theta) > rotation_threshold) return true; if ((Delta.pose.x*Delta.pose.x+Delta.pose.y*Delta.pose.y) > distance_threshold*distance_threshold) return true; return false; }
function_block-function_prefix_line
[ { "content": "struct Alignement{\n\n bool converged;\n\n float fitness;\n\n pcl::registration::DefaultConvergenceCriteria<float>::ConvergenceState convergence_state;\n\n Eigen::Matrix4f transform;\n\n common::Pose2DWithCovariance Delta;\n\n};\n\n\n\n\n\n/**\n\n * \\brief Creat...
C++
Stream.cpp
chrisoldwood/WCL
608a83f9e41f4c1d2a7ac6991abbcf264d5924e0
#include "Common.hpp" #include "Stream.hpp" #include <Core/AnsiWide.hpp> CStream::CStream() : m_nMode(GENERIC_NONE) , m_nFormat(0) , m_nVersion(0) { } CStream::~CStream() { } template<typename CharT> size_t CStream::ReadLine(std::vector<CharT>& vBuffer) { if (!IsEOF()) { CharT cChar; do { Read(&...
#include "Common.hpp" #include "Stream.hpp" #include <Core/AnsiWide.hpp> CStream::CStream() : m_nMode(GENERIC_NONE) , m_nFormat(0) , m_nVersion(0) { } CStream::~CStream() { } template<typename CharT> size_t CStream::ReadLine(std::vector<CharT>& vBuffer) { if (!IsEOF()) { CharT cChar; do { Read(&...
uint32 CStream::Format() const { return m_nFormat; } void CStream::SetFormat(uint32 nFormat) { m_nFormat = nFormat; } uint32 CStream::Version() const { return m_nVersion; } void CStream::SetVersion(uint32 nVersion) { m_nVersion = nVersion; }
void CStream::WriteLine(const CString& str, TextFormat eFormat) { size_t nChars = str.Length(); if (eFormat == ANSI_TEXT) { #ifdef ANSI_BUILD Write(str.Buffer(), Core::numBytes<char>(nChars)); #else Write(T2A(str), Core::numBytes<char>(nChars)); #endif Write("\r\n", Core::numBytes<char>(2)); } else { #i...
function_block-full_function
[ { "content": "class CString\n\n{\n\npublic:\n\n\t//\n\n\t// Constructors/Destructor.\n\n\t//\n\n\tCString();\n\n\tCString(uint iRscID);\n\n\tCString(const tchar* pszBuffer);\n\n\tCString(const tchar* pszBuffer, size_t iChars);\n\n\tCString(const CString& strSrc);\n\n\t~CString();\n\n\n\n\tvoid BufferSize(size_t...
C++
libraries/AD520X/AD520X.cpp
AndreTeixeira1998/Arduino
16918bada3cf9dfee0f6baa72ee1de87602b84ca
#include "AD520X.h" AD520X::AD520X(uint8_t select, uint8_t reset, uint8_t shutdown, uint8_t dataOut, uint8_t clock) { _pmCount = 6; _select = select; _dataOut = dataOut; _clock = clock; _reset = reset; _shutdown = shutdown; _hwSPI = (dataOut == 255) && (clock == 255); } void AD520X::begin...
#include "AD520X.h" AD520X::AD520X(uint8_t select, uint8_t reset, uint8_t shutdown, uint8_t dataOut, uint8_t clock) { _pmCount = 6; _select = select; _dataOut = dataOut; _clock = clock; _reset = reset; _shutdown = shutdown; _hwSPI = (dataOut == 255) && (clock == 255); } void AD520X::begin...
#endif bool AD520X::setValue(uint8_t pm, uint8_t value) { if (pm >= _pmCount) return false; _value[pm] = value; updateDevice(pm); return true; } void AD520X::setAll(uint8_t value) { for (uint8_t pm = 0; pm < _pmCount; pm++) { setValue(pm, value); } } uint8_t AD520X::getValue(uint8_t pm) { if (p...
void AD520X::setGPIOpins(uint8_t clk, uint8_t miso, uint8_t mosi, uint8_t select) { _clock = clk; _dataOut = mosi; _select = select; pinMode(_select, OUTPUT); digitalWrite(_select, HIGH); mySPI->end(); mySPI->begin(clk, miso, mosi, select); }
function_block-function_prefix_line
[ { "content": "class MS5611_SPI\n\n{\n\npublic:\n\n explicit MS5611_SPI(uint8_t select, uint8_t dataOut = 255, uint8_t dataIn = 255, uint8_t clock = 255);\n\n\n\n bool begin();\n\n\n\n // reset command + get constants\n\n // returns false if ROM constants == 0;\n\n bool reset();\n\n\n\n // the actu...
C++
src/particle_subscriber.cpp
tstellanova/particle_subscriber
175440928aaa8d9d92299787ecac352758171d2c
#include <Particle.h> #include <Adafruit_SSD1306_RK.h> #include <Adafruit_GFX_RK.h> void evt_doorbell_handler(const char *event, const char *data); int render_string(String command); int tone_test(String name); void blank_screen(); void oneshot_timer_cb(); const uint8_t SCREEN_WIDTH = 128; const uint8_t SCREEN_HEIG...
#include <Particle.h> #include <Adafruit_SSD1306_RK.h> #include <Adafruit_GFX_RK.h> void evt_doorbell_handler(const char *event, const char *data); int render_string(String command); int tone_test(String name); void blank_screen(); void oneshot_timer_cb(); const uint8_t SCREEN_WIDTH = 128; const uint8_t SCREEN_HEIG...
void loop() { delay(5000); Particle.process(); if (g_clear_screen) { g_clear_screen = false; blank_screen(); } }
T); Particle.syncTime(); Particle.function("render",render_string); Particle.function("tone_test",tone_test); Particle.subscribe("household/frontdoor/bell01", evt_doorbell_handler); Log.info("My device ID: %s", (const char*)System.deviceID()); Particle.publishVitals(120); display_s...
function_block-function_prefixed
[]
C++
src/Cropper.cpp
stippi/WonderBrush-v3
7f88c3e4fbe0bca9ef2df7a92d44789877edfe1e
#include "Cropper.h" #include <Bitmap.h> #include <BitmapStream.h> #include <Directory.h> #include <File.h> #include <Rect.h> #include <TranslationUtils.h> #include <TranslatorRoster.h> #include "RenderBuffer.h" #include "RenderEngine.h" Cropper::Cropper() : BApplication("application/x-vnd.yellowbites.Cropper") , ...
#include "Cropper.h" #include <Bitmap.h> #include <BitmapStream.h> #include <Directory.h> #include <File.h> #include <Rect.h> #include <TranslationUtils.h> #include <TranslatorRoster.h> #include "RenderBuffer.h" #include "RenderEngine.h" Cropper::Cropper() : BApplication("application/x-vnd.yellowbites.Cropper") , ...
roppedRect, B_BITMAP_NO_SERVER_LINK, B_RGBA32); status_t ret = resultBitmap->InitCheck(); if (ret != B_OK) { fprintf(stderr, "Failed to create bitmap: %s\n", strerror(ret)); delete bitmap; return ret; } uint8* src = (uint8*)bitmap->Bits(); uint8* dst = (uint8*)resultBitmap->Bits(); uint32 srcBPR = bitmap...
PrintUsage(true) , fTargetWidth(-1) , fTargetHeight(-1) , fTargetFolder("/boot/home/Desktop") , fTargetFormat(B_JPEG_FORMAT) { } void Cropper::MessageReceived(BMessage* message) { switch (message->what) { default: BApplication::MessageReceived(message); break; } } void Cropper::ReadyToRun() { if (fPrin...
random
[ { "content": " class GradientF, \n", "file_path": "src/agg/include/agg_span_gradient.h", "rank": 0, "score": 99143.10744643904 }, { "content": " class ColorF>\n", "file_path": "src/agg/include/agg_span_gradient.h", "rank": 1, "score": 99143.10744643904 }...
C++
kernel/arch/amd64/mp/mp.cpp
griwes/reaveros
01cc1be330e920d45445db32e44eb4b91491f36c
#include "mp.h" #include "../../../memory/vm.h" #include "../../../scheduler/thread.h" #include "../../../time/time.h" #include "../cpu/cpu.h" #include "../cpu/lapic.h" #include "../memory/vm.h" #include <cstddef> #include <cstdint> extern "C" std::uint8_t trampoline_start[]; extern "C" std::uint8_t trampoline_end...
#include "mp.h" #include "../../../memory/vm.h" #include "../../../scheduler/thread.h" #include "../../../time/time.h" #include "../cpu/cpu.h" #include "../cpu/lapic.h" #include "../memory/vm.h" #include <cstddef> #include <cstdint> extern "C" std::uint8_t trampoline_start[]; extern "C" std::uint8_t trampoline_end...
ase_raw) / trampoline_size; for (std::size_t booted = 0; booted < core_count; booted += boot_at_once) { for (std::size_t i = booted; i < booted + boot_at_once && i < core_count; ++i) { if (cores[i].apic_id() == cpu::get_current_core()->apic_id()) { contin...
ipi_type::init, 0); } volatile bool timer_triggered = false; auto handler = +[](volatile bool * flag) { *flag = true; }; using namespace std::literals; time::get_high_precision_timer().one_shot(10ms, handler, &timer_triggered); asm volatile("sti"); while (!timer_triggered) { ...
random
[ { "content": "/*\n\n * Copyright © 2021 Michał 'Griwes' Dominiak\n\n *\n\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n\n * you may not use this file except in compliance with the License.\n\n * You may obtain a copy of the License at\n\n *\n\n * http://www.apache.org/licenses/LICEN...
C++
fulanghua_ekf_2d/src/pose_estimator.cpp
hoshianaaa/fulanghua_navigation
f6b5f5289c1b27ad45b6db6b6535b01ba4203001
#include <fulanghua_ekf_2d/pose_estimator.h> #include <boost/assign.hpp> #include <Eigen/LU> #include <Eigen/Dense> namespace fulanghua { double normalize_rad(double th) { while(th > M_PI) th -= 2 * M_PI; while(th < -M_PI) th += 2 * M_PI; return th; } PoseEstimator::PoseEstimator(ros::NodeHandle &no...
#include <fulanghua_ekf_2d/pose_estimator.h> #include <boost/assign.hpp> #include <Eigen/LU> #include <Eigen/Dense> namespace fulanghua { double normalize_rad(double th) { while(th > M_PI) th -= 2 * M_PI; while(th < -M_PI) th += 2 * M_PI; return th; } PoseEstimator::PoseEstimator(ros::NodeHandle &no...
} int main(int argc, char *argv[]) { ros::init(argc, argv, "pose_estimator"); ros::NodeHandle nh; fulanghua::PoseEstimator estimator(nh); estimator.spin(); return 0; }
est_pose.pose.covariance = boost::assign::list_of (cov_xy_th(0)) (0) (0) (0) (0) (0) (0) (cov_xy_th(1)) (0) (0) (0) (0) (0) (0) (999999.9) (0) (0) (0) (0) (0) (0) (999999.9) (0) (0) (0) (0) (0) (0) (0) (cov_xy_th(2)); pose_pub_.publish(est_pose); }
function_block-function_prefix_line
[ { "content": " Eigen::Matrix4d motion_cov_;\n\n Eigen::Matrix4d observation_cov_;\n\n\n\n tf::StampedTransform old_odom_meas_;\n\n tf::Transformer transformer_;\n\n tf::TransformBroadcaster tf_broadcaster_;\n\n \n\n bool publish_odom_topic_;\n\n bool publish_pose_topic_;\n\n double up...
C++
drone_controller/src/proportional_rotate.cpp
MikeS96/autonomous_landing_uav
c402bc38119dfc1e9c09746e8376356ddabde07e
#include <ros/ros.h> #include <stdio.h> #include <math.h> #include "mavros_msgs/PositionTarget.h" #include "object_detector/States.h" #include "drone_controller/Error.h" #define FACTORX 0.0015625 // Vx proportional gain #define FACTORY 0.0020833 // Vy proportional gain #define FACTORTH 0.0055 // Theta proporti...
#include <ros/ros.h> #include <stdio.h> #include <math.h> #include "mavros_msgs/PositionTarget.h" #include "object_detector/States.h" #include "drone_controller/Error.h" #define FACTORX 0.0015625 // Vx proportional gain #define FACTORY 0.0020833 // Vy proportional gain #define FACTORTH 0.0055 // Theta proporti...
void controllerCallBack(const object_detector::States& msg) { float ErX = imageW - msg.Xc; float ErY = imageH - msg.Yc; float ErTheta = msg.Theta; drone_controller::Error er; ...
pub = po_nh.advertise<mavros_msgs::PositionTarget>("/mavros/setpoint_raw/local",10) ; pub1 = po_nh.advertise<drone_controller::Error>("/error",10) ; sub = po_nh.subscribe("/predicted_states", 10, &Controller::controllerCallBack, this); lastTime = ros::Time:...
function_block-function_prefix_line
[ { "content": "class Controller // Controller class\n\n{\n\n private: \n\n //Private class atributes\n\n ros::NodeHandle po_nh;\n\n ros::Subscriber sub;\n\n ros::Publisher pub;\n\n ros::Publisher pub1;\n\n ros::Time lastTime;\n\n float imageW; // Image Width\n\...
C++
cppcache/src/ThinClientLocatorHelper.cpp
rhoughton-pivot/geode-native
ab6fe7d996e5ec23832f90663d03f1d66b9f5fbd
#include "ThinClientLocatorHelper.hpp" #include <algorithm> #include <set> #include <boost/thread/lock_types.hpp> #include <geode/DataInput.hpp> #include <geode/DataOutput.hpp> #include <geode/SystemProperties.hpp> #include "CacheImpl.hpp" #include "ClientConnectionRequest.hpp" #include "ClientConnectionResponse....
#include "ThinClientLocatorHelper.hpp" #include <algorithm> #include <set> #include <boost/thread/lock_types.hpp> #include <geode/DataInput.hpp> #include <geode/DataOutput.hpp> #include <geode/SystemProperties.hpp> #include "CacheImpl.hpp" #include "ClientConnectionRequest.hpp" #include "ClientConnectionResponse....
; } } else { return std::unique_ptr<Connector>(new TcpConn( hostname, static_cast<uint16_t>(port), timeout, buffer_size)); } } static constexpr int32_t kGossipVersion = 1002; std::shared_ptr<Serializable> ThinClientLocatorHelper::sendRequest( const ServerLocation& location, const std::share...
std::unique_ptr<Connector>(new TcpSslConn( hostname, static_cast<uint16_t>(port), m_sniProxyHost, m_sniProxyPort, timeout, buffer_size, sys_prop.sslTrustStore(), sys_prop.sslKeyStore(), sys_prop.sslKeystorePassword()))
call_expression
[ { "content": "struct hash<apache::geode::client::ServerLocation> {\n\n typedef apache::geode::client::ServerLocation argument_type;\n\n typedef size_t result_type;\n\n size_t operator()(const apache::geode::client::ServerLocation& val) const {\n\n return val.hashcode();\n\n }\n\n};\n\n\n\n} // namespace...
C++
content/renderer/history_controller.cc
kjthegod/chromium
cf940f7f418436b77e15b1ea23e6fa100ca1c91a
#include "content/renderer/history_controller.h" #include "content/renderer/render_frame_impl.h" #include "content/renderer/render_view_impl.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" using blink::WebFrame; using blink::WebHistoryCommitType; using blink::WebHistoryItem; using blink::WebURLRequest; ...
#include "content/renderer/history_controller.h" #include "content/renderer/render_frame_impl.h" #include "content/renderer/render_view_impl.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" using blink::WebFrame; using blink::WebHistoryCommitType; using blink::WebHistoryItem; using blink::WebURLRequest; ...
new_item.isNull()) return; if (old_item.isNull() || new_item.itemSequenceNumber() != old_item.itemSequenceNumber()) { if (!old_item.isNull() && new_item.documentSequenceNumber() == old_item.documentSequenceNumber()) same_document_loads.push_back(std::make_pair(frame, new_item)); else ...
) { } HistoryController::~HistoryController() { } void HistoryController::GoToEntry(scoped_ptr<HistoryEntry> target_entry, WebURLRequest::CachePolicy cache_policy) { HistoryFrameLoadVector same_document_loads; HistoryFrameLoadVector different_document_loads; provisional_entry_...
random
[]
C++
agent/src/beerocks/monitor/beerocks_monitor_main.cpp
ydx-coder/prplMesh
6401b15c31c563f9e00ce6ff1b5513df3d39f157
#include "monitor_thread.h" #include <bcl/beerocks_logging.h> #include <bcl/beerocks_os_utils.h> #include <bcl/beerocks_version.h> #include <easylogging++.h> BEEROCKS_INIT_BEEROCKS_VERSION static bool g_running = true; static int s_signal = 0; static std::string monitor_iface; static beerocks::logging *s_pLogge...
#include "monitor_thread.h" #include <bcl/beerocks_logging.h> #include <bcl/beerocks_os_utils.h> #include <bcl/beerocks_version.h> #include <easylogging++.h> BEEROCKS_INIT_BEEROCKS_VERSION static bool g_running = true; static int s_signal = 0; static std::string monitor_iface; static beerocks::logging *s_pLogge...
std::string slave_config_file_path = "./" + std::string(BEEROCKS_AGENT) + ".conf"; beerocks::config_file::sConfigSlave beerocks_slave_conf; if (!beerocks::config_file::read_slave_config_file(slave_config_file_path, beerocks_slave_conf)) ...
if (!parse_arguments(argc, argv)) { std::cout << "Usage: " << argv[0] << " -i <monitor iface>" << std::endl; return 0; }
if_condition
[ { "content": "struct json_object;\n\nnamespace mapf {\n", "file_path": "framework/common/include/mapf/common/logger.h", "rank": 0, "score": 203256.10839559737 }, { "content": "class Logger {\n\npublic:\n", "file_path": "framework/common/include/mapf/common/logger.h", "rank": 1, "...
C++
LinkedLists/lab2-1.cpp
eva-rubio/Data-Structures-and-Algorithms
97467f89a9a0dc928fd1f19301067dd565114470
#include<iostream> using namespace std; struct node { int num; node * next; }; void print(node * first); void prependNode(int userNum, node * & first); void deleteFirst(node * & first); void findMax(node * & first); int main() { node * first; node * last; char more_nodes = '...
#include<iostream> using namespace std; struct node { int num; node * next; }; void print(node * first); void prependNode(int userNum, node * & first); void deleteFirst(node * & first); void findMax(node * & first); int main() { node * first; node * last; char more_nodes = '...
} void findMax(node * & first){ int biggest = -1; while (first != NULL) { if (biggest < first->num) biggest = first->num; first = first->next; } cout << "The largest value in the list is: " << biggest << endl; }
if(first != NULL){ node * temp; temp = first; first = first -> next; delete temp; print(first); }else{ cout << "The list is already empty, cant delete anything!"; }
if_condition
[ { "content": "struct node {\n\n\tint numID;\t\t\t// A single integer field (called numID)\n\n\tstring name;\t\t// A single string field (called name)\n\n\tnode * next;\t\t// A pointer to the next node in the list\n\n};\n\n\n\nvoid print(node * first);\n\nvoid prepend(int userNum, string userName, node * & first...
C++
tumor2d/src/matrix.ipp
ICB-DCM/lookahead-study
b9849ce2b0cebbe55d6c9f7a248a5f4dff191007
#ifndef MATRIX_IPP #include <stdio.h> #include <stdlib.h> #include <math.h> #define SINGULAR 1e-16 template <class T> T **allocMatrix( int n, int m) { T **A = (T**) malloc( n*sizeof(T*)); for( int i=0; i<n; i++){ A[i] = (T*) malloc( m*sizeof(T)); for( int j=0; j<m; j++) A[i][j] = 0.; } return A; } templa...
#ifndef MATRIX_IPP #include <stdio.h> #include <stdlib.h> #include <math.h> #define SINGULAR 1e-16 template <class T> T **allocMatrix( int n, int m) { T **A = (T**) malloc( n*sizeof(T*)); for( int i=0; i<n; i++){ A[i] = (T*) malloc( m*sizeof(T)); for( int j=0; j<m; j++) A[i][j] = 0.; } return A; } templa...
%1i-tem Eliminationschritt:\n", s+1); MatOut (stdout, a, n, 2*n); #endif s++; } while (s < n); if (fehler) { fprintf(fout, "Inverse: Matrix ist singulaer\n"); } } template <class T> void solveLinearSystemB( T **A, T *b, T *x, int dim, T **B) { int i, j; int k; for( i=0; i<dim; i++){...
o { Maximum = fabs(a[s][s]); if (pivot) { pzeile = s; for (i = s + 1; i < n; i++) if (fabs(a[i][s]) > Maximum) { Maximum = fabs(a[i][s]); pzeile = i; } } fehler = (Maximum < Epsilon); if (fehler) break; if (pivot) { if (pzeile != s) { double h; ...
random
[ { "content": "extern SparseMatrix *J;\n", "file_path": "tumor2d/src/SparseMatrix.h", "rank": 0, "score": 140394.67320057453 }, { "content": "extern float *v1;\n", "file_path": "tumor2d/src/SparseMatrix.h", "rank": 1, "score": 140394.67320057453 }, { "content": "extern flo...
C++
gpAux/extensions/gps3ext/test/s3utils_test.cpp
chrishajas/gpdb
564b9235a46e2ead1650b753b2d070796cced6f6
#include "s3utils.cpp" #include "gtest/gtest.h" #define __STDC_FORMAT_MACROS #include <inttypes.h> TEST(Utils, simplecurl) { CURL *c = CreateCurlHandler(NULL); EXPECT_EQ(c, (void *)NULL); c = CreateCurlHandler("www.google.com"); EXPECT_NE(c, (void *)NULL); curl_easy_cleanup(c); } TEST(Utils, nth)...
#include "s3utils.cpp" #include "gtest/gtest.h" #define __STDC_FORMAT_MACROS #include <inttypes.h> TEST(Utils, simplecurl) { CURL *c = CreateCurlHandler(NULL); EXPECT_EQ(c, (void *)NULL); c = CreateCurlHandler("www.google.com"); EXPECT_NE(c, (void *)NULL); curl_easy_cleanup(c); } TEST(Utils, nth)...
"); EXPECT_EQ("This is a & ", str1); find_replace(str1, "This", ""); EXPECT_EQ(" is a & ", str1); find_replace(str1, "is a", "abcdefghijklmn"); EXPECT_EQ(" abcdefghijklmn & ", str1); find_replace(str1, " a", "a"); EXPECT_EQ("abcdefghijklmn & ", str1); find_replace(str1, "abc", "a...
); EXPECT_EQ(src4, uri_decode(dst4)); } TEST(Utils, find_replace) { string str1 = "This is a simple & short test."; find_replace(str1, "simple", ""); EXPECT_EQ("This is a & short test.", str1); find_replace(str1, "short ", ""); EXPECT_EQ("This is a & test.", str1); find_replace(str1, "...
random
[ { "content": "SELECT regexp_split_to_array('the quick brown fox jumped over the lazy dog', '');\n", "file_path": "src/test/regress/sql/strings.sql", "rank": 0, "score": 651884.2648369842 }, { "content": "SELECT regexp_split_to_array('the quick brown fox jumped over the lazy dog', 'nomatch');...
C++
toolsrc/src/vcpkg/parse.cpp
TheScarfix/vcpkg
8db6db5dac70c25b04cd4dd84392484dee822fbe
#include "pch.h" #include <utility> #include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> #include <vcpkg/packagespec.h> #include <vcpkg/paragraphparser.h> #include <vcpkg/parse.h> using namespace vcpkg; namespace vcpkg::Parse { std::string ParseError::format() const { return Strings::con...
#include "pch.h" #include <utility> #include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> #include <vcpkg/packagespec.h> #include <vcpkg/paragraphparser.h> #include <vcpkg/parse.h> using namespace vcpkg; namespace vcpkg::Parse { std::string ParseError::format() const { return Strings::con...
_whitespace(); } while (true); } ExpectedS<std::vector<std::string>> parse_default_features_list(const std::string& str, CStringView origin) { Parse::ParserBase parser; parser.init(str, origin); auto opt = parse_list_until_eof<std::string>("default features", parser, &parse_...
", line, "\"\n", " ", std::string(column - 1, ' '), "^\n"); } void ParserBase::add_error(std::string message, const ParserBase::SourceLoc&...
random
[ { "content": "namespace vcpkg::Util\n\n{\n\n template<class Container>\n\n using ElementT =\n\n std::remove_reference_t<decltype(*std::declval<typename std::remove_reference_t<Container>::iterator>())>;\n\n\n\n namespace Vectors\n\n {\n\n template<class Container, class T = ElementT<Co...
C++
fly/logger/detail/win/styler_proxy_impl.cpp
ExternalRepositories/libfly
5acfc424a68031c0004b3c1cb5bef9d76dd129fb
#include "fly/logger/detail/win/styler_proxy_impl.hpp" namespace fly::logger::detail { StylerProxyImpl::StylerProxyImpl( std::ostream &stream, std::stack<fly::logger::Style> &&styles, std::stack<fly::logger::Color> &&colors, std::stack<fly::logger::Cursor> &&cursors) noexcept : StylerProxy(stream)...
#include "fly/logger/detail/win/styler_proxy_impl.hpp" namespace fly::logger::detail { StylerProxyImpl::StylerProxyImpl( std::ostream &stream, std::stack<fly::logger::Style> &&styles, std::stack<fly::logger::Color> &&colors, std::stack<fly::logger::Cursor> &&cursors) noexcept : StylerProxy(stream)...
if (m_handle == INVALID_HANDLE_VALUE) { return; } CONSOLE_SCREEN_BUFFER_INFO console_info; if (!::GetConsoleScreenBufferInfo(m_handle, &console_info)) { m_handle = INVALID_HANDLE_VALUE; return; } if (!styles.empty() || !colors.empty()) { apply_styl...
if (m_stream_is_stdout) { m_handle = ::GetStdHandle(STD_OUTPUT_HANDLE); } else if (m_stream_is_stderr) { m_handle = ::GetStdHandle(STD_ERROR_HANDLE); }
if_condition
[ { "content": "struct Color\n\n{\n\n /**\n\n * Constants for standard colors.\n\n *\n\n * On Linux and macOS, a color may be any value in the range [0, 255]. While only the 8 standard\n\n * colors are listed here, any 8-bit integer value may be cast to a color. The color values\n\n * corre...
C++
hoomd/dem/DEMEvaluator.cc
schwendp/hoomd-blue
df7970121b19bc4f8674348ab3241055ac87153b
#ifndef __DEMEVALUATOR_CC__ #define __DEMEVALUATOR_CC__ #include "DEMEvaluator.h" #include "WCAPotential.h" #include <assert.h> template<typename Real> DEVICE inline Real clip(const Real &x) { return (x >= 0)*(x + (x > 1)*(1 - x)); } template<typename Real, typename Real4, typename Potential> template<...
#ifndef __DEMEVALUATOR_CC__ #define __DEMEVALUATOR_CC__ #include "DEMEvaluator.h" #include "WCAPotential.h" #include <assert.h> template<typename Real> DEVICE inline Real clip(const Real &x) { return (x >= 0)*(x + (x > 1)*(1 - x)); } template<typename Real, typename Real4, typename Potential> template<...
lambda = clip(dot(p11 - p00, r0)/r0sq); candidateI = p00 + lambda*r0; candidateJ = p11; rContact = candidateJ - candidateI; distsq = dot(rContact, rContact); if(distsq < closestDistsq) { closestI = candidateI; closestJ = candidateJ; closestDistsq = distsq; ...
if(distsq < closestDistsq) { closestI = candidateI; closestJ = candidateJ; closestDistsq = distsq; }
if_condition
[]
C++
src/multi_index_array/kennytm/vtmp.hpp
extragoya/LibNT
60372bf4e3c5d6665185358c4756da4fe547f093
#ifndef VTMP_HPP_KFLYEISDKHB #define VTMP_HPP_KFLYEISDKHB 1 #include <cstdlib> #include <type_traits> #include <utility> #include <array> #include "traits.hpp" namespace utils { namespace vtmp { template <size_t... ns> struct integers { template <size_t n> using push_back =...
#ifndef VTMP_HPP_KFLYEISDKHB #define VTMP_HPP_KFLYEISDKHB 1 #include <cstdlib> #include <type_traits> #include <utility> #include <array> #include "traits.hpp" namespace utils { namespace vtmp { template <size_t... ns> struct integers { template <size_t n> using push_back =...
template <typename F, typename... T> auto tuple_apply(const std::tuple<T...>& tup, F&& func) -> decltype(func(std::declval<const T&>()...)) { vtmp::template iota<sizeof...(T)> instance; return xx_impl::tuple_funcs<T...>(std::forward<F>(func), xx_impl::no_op_func(), ...
p::template iota<sizeof...(T)> instance; return xx_impl::tuple_funcs<T...>(std::forward<F>(func), xx_impl::no_op_func(), instance, std::move(tup)); }
function_block-function_prefixed
[ { "content": "struct MIANonlinearFuncType<MIA,typename boost::enable_if<internal::is_DenseMIA<typename std::remove_const<MIA>::type>>::type>{\n\n typedef typename std::remove_const<MIA>::type MIA_type;\n\n typedef DenseMIA<typename internal::data_type<MIA_type>::type,internal::order<MIA_type>::value> type...
C++
PROX/FOUNDATION/DIKUCL/DIKUCL/include/dikucl_context_manager.hpp
diku-dk/PROX
c6be72cc253ff75589a1cac28e4e91e788376900
#ifndef DIKUCL_CONTEXT_MANAGER_HPP #define DIKUCL_CONTEXT_MANAGER_HPP #include <iostream> #include <map> #include <utility> #include <vector> #include <dikucl.hpp> #include <dikucl_device_manager.hpp> namespace dikucl { namespace details { inline void opencl_notify( const char * e...
#ifndef DIKUCL_CONTEXT_MANAGER_HPP #define DIKUCL_CONTEXT_MANAGER_HPP #include <iostream> #include <map> #include <utility> #include <vector> #include <dikucl.hpp> #include <dikucl_device_manager.hpp> namespace dikucl { namespace details { inline void opencl_notify( const char * e...
ager(ContextManager const&); void operator=(ContextManager const&); public: static ContextManager& get_instance() { static ContextManager instance; return instance; } ContextHandle* get_context( cl_int *err = NULL, De...
operator==(const ContextHandle& ch1, const ContextHandle& ch2) { return ch1.device_handle == ch2.device_handle; } }; class ContextManager { private: std::map< DeviceHandle, ContextHandle > contexts; ContextManager() { } ContextMan
random
[ { "content": "class Context : public detail::Wrapper<cl_context>\n\n{\n\npublic:\n\n Context(\n\n const VECTOR_CLASS<Device>& devices,\n\n cl_context_properties* properties = NULL,\n\n void (CL_CALLBACK * notifyFptr)(\n\n const char *,\n\n const void *,\n\n ...
C++
vislib/src/sys/MemoryFile.cpp
xge/megamol
1e298dd3d8b153d7468ed446f6b2ed3ac49f0d5b
#include "vislib/sys/MemoryFile.h" using namespace vislib::sys; MemoryFile::MemoryFile(void) : File(), accessMode(READ_ONLY), buffer(NULL), bufferLen(0), pos(0), storage(NULL) {} MemoryFile::~MemoryFile(void) { this->Close(); } void MemoryFile::Close(void) { this->accessMode = READ_ONLY; this->buffer ...
#include "vislib/sys/MemoryFile.h" using namespace vislib::sys; MemoryFile::MemoryFile(void) : File(), accessMode(READ_ONLY), buffer(NULL), bufferLen(0), pos(0), storage(NULL) {} MemoryFile::~MemoryFile(void) { this->Close(); } void MemoryFile::Close(void) { this->accessMode = READ_ONLY; this->buffer ...
; this->pos += s; } return s; } File::FileSize MemoryFile::Seek(const File::FileOffset offset, const File::SeekStartPoint from) { FileSize np = this->pos; switch (from) { case BEGIN: if (offset >= 0) { np = offset; } break; case CURRENT: if (o...
::memcpy(outBuf, (this->storage != NULL) ? this->storage->At(static_cast<SIZE_T>(this->pos)) : (this->buffer + this->pos), static_cast<SIZE_T>(s))
call_expression
[ { "content": "class BufferedFile : public File {\n\npublic:\n\n /**\n\n * Answers the default size used when creating new BufferedFile objects\n\n *\n\n * @return size in bytes used when creating new buffers\n\n */\n\n inline static File::FileSize GetDefaultBufferSize(void) {\n\n re...
C++
external/include/mapnik/rule.hpp
Wujingli/OpenWebGlobeDataProcessing
932eaa00c81fc0571122bc618ade010fa255735e
#ifndef MAPNIK_RULE_HPP #define MAPNIK_RULE_HPP #include <mapnik/building_symbolizer.hpp> #include <mapnik/line_symbolizer.hpp> #include <mapnik/line_pattern_symbolizer.hpp> #include <mapnik/polygon_symbolizer.hpp> #include <mapnik/polygon_pattern_symbolizer.hpp> #include <mapnik/point_symbolizer.hpp> #i...
#ifndef MAPNIK_RULE_HPP #define MAPNIK_RULE_HPP #include <mapnik/building_symbolizer.hpp> #include <mapnik/line_sy
hield_symbolizer.hpp> #include <mapnik/text_symbolizer.hpp> #include <mapnik/markers_symbolizer.hpp> #include <mapnik/debug_symbolizer.hpp> #include <mapnik/feature.hpp> #include <mapnik/expression.hpp> #include <mapnik/expression_string.hpp> #include <mapnik/config.hpp> #include <boost/variant/variant_fwd.h...
mbolizer.hpp> #include <mapnik/line_pattern_symbolizer.hpp> #include <mapnik/polygon_symbolizer.hpp> #include <mapnik/polygon_pattern_symbolizer.hpp> #include <mapnik/point_symbolizer.hpp> #include <mapnik/raster_symbolizer.hpp> #include <mapnik/s
random
[]
C++
include/ensmallen_bits/problems/logistic_regression_function_impl.hpp
kilasuelika/ensmallen-eigen
d9df7ca4d0e519974d56441c132fb9326da4ea3d
#ifndef ENSMALLEN_PROBLEMS_LOGISTIC_REGRESSION_FUNCTION_IMPL_HPP #define ENSMALLEN_PROBLEMS_LOGISTIC_REGRESSION_FUNCTION_IMPL_HPP #include "logistic_regression_function.hpp" namespace ens { namespace test { template<typename MatType> LogisticRegressionFunction<MatType>::LogisticRegressionFunction( MatType& pred...
#ifndef ENSMALLEN_PROBLEMS_LOGISTIC_REGRESSION_FUNCTION_IMPL_HPP #define ENSMALLEN_PROBLEMS_LOGISTIC_REGRESSION_FUNCTION_IMPL_HPP #include "logistic_regression_function.hpp" namespace ens { namespace test { template<typename MatType> LogisticRegressionFunction<MatType>::LogisticRegressionFunction( MatType& pred...
; return objectiveRegularization - result; } template<typename MatType> template<typename GradType> typename MatType::Scalar LogisticRegressionFunction<MatType>::EvaluateWithGradient( const MatType& parameters, const size_t begin, GradType& gradient, const size_t batchSize) const { typedef type...
arma::accu(arma::log(1.0 - arma::conv_to<arma::Row<ElemType>>::from(responses) + sigmoids % (2 * arma::conv_to<arma::Row<ElemType>>::from(responses) - 1.0)))
call_expression
[ { "content": "//! Very, very simple test function which is the composite of three other\n\n//! functions. The gradient is not very steep far away from the optimum, so a\n\n//! larger step size may be required to optimize it in a reasonable number of\n\n//! iterations.\n\nclass GDTestFunction\n\n{\n\n public:\n...
C++
snake3d/wyShaderFunctions.cpp
wysaid/snake3d
54e167c3b1f73a3c9890f8f0e0678ec68e2ffd0c
 #include "wyShaderFunctions.h" #define GETUNIFORM(uniform, programID, name) \ GLint uniform = glGetUniformLocation(programID, name);\ if(uniform < 0) \ {\ LOG_ERROR("uniform name %s does not exist!\n", name);\ return ;\ }\ ShaderObject::ShaderObject() : m_shaderID(0) { m_shaderType = GL_FALSE; } ShaderObject::~S...
 #include "wyShaderFunctions.h" #define GETUNIFORM(uniform, programID, name) \ GLint uniform = glGetUniformLocation(programID, name);\ if(uniform < 0) \ {\ LOG_ERROR("uniform name %s does not exist!\n", name);\ return ;\ }\ ShaderObject::ShaderObject() : m_shaderID(0) { m_shaderType = GL_FALSE; } ShaderObject::~S...
LOG_INFO("LINK %d OK\n", m_programID); htCheckGLError("Link Program"); return true; } void ProgramObject::bind() { glUseProgram(m_programID); } void ProgramObject::sendUniformf(const char* name, GLfloat x) { GETUNIFORM(uniform, m_programID, name); glUniform1f(uniform, x); } void ProgramObject::sendUniformf(co...
if(programStatus != GL_TRUE) { GLint logLen = 0; glGetProgramiv(m_programID, GL_INFO_LOG_LENGTH, &logLen); if(logLen != 0) { char *buf = new char[logLen]; if(buf != NULL) { glGetProgramInfoLog(m_programID, logLen, &logLen, buf); LOG_ERROR("Failed to link the program!\n%s", buf); delete [] ...
if_condition
[ { "content": "class ProgramObject\n\n{\n\npublic:\n\n\tProgramObject();\n\n\t~ProgramObject();\n\n\n\n\tbool initFragmentShaderSourceFromString(const char* fragShader);\n\n\tbool initVertexShaderSourceFromString(const char* vertShader);\n\n\n\n\tbool link();\n\n\tvoid bind();\n\n\n\n\t// For usage convenience, ...
C++
src/lookup/PerfectCount.cc
adigenova/discovarexp-51885
f827bab9bd0e328fee3dd57b7fefebfeebd92be4
#include "Basevector.h" #include "CoreTools.h" #include "PackAlign.h" #include "lookup/LookupTable.h" #include "lookup/PerfectCount.h" #include "random/RandomSampleFromStream.h" void GetBestKmers( const vecbasevector query, const AlignDir direction, const lookup_table& look, vec<int>& best_pos, vec<unsigned int...
#include "Basevector.h" #include "CoreTools.h" #include "PackAlign.h" #include "lookup/LookupTable.h" #include "lookup/PerfectCount.h" #include "random/RandomSampleFromStream.h" void GetBestKmers( const vecbasevector query, const AlignDir direction, const lookup_table& look, vec<int>& best_pos, vec<unsigned int...
void PerfectCountPlaces( const vecbasevector& query, const String& lookup_file, const AlignDir direction, vec<int>& places ) { places.resize_and_set( query.size( ), 0 ); if ( query.empty( ) ) return; lookup_table look(lookup_file); unsigned int K = look.K( ); ...
function_block-full_function
[ { "content": "/// Orders look aligns by 1) query id, then 2) complete position/structure of the target region(s)\n\n/// the query aligns to: first by target id, then start on target, then end on target, then number\n\n/// of gaps, then starts/ends of all blocks, and finally by number of mismatches.\n\nstruct or...
C++
silo-scripts/myscripts/replay-file-27.cpp
shenweihai1/rolis-eurosys2022
59b3fd58144496a9b13415e30b41617b34924323
#include <iostream> #include <string> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <fstream> #include <string.h> #include <chrono> #include <vector> #include <map> #include <cstring> #include <algorithm> #include <stdlib.h> using namespace std; std::map<long, std::string> table_map = {}; int...
#include <iostream> #include <string> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <fstream> #include <string.h> #include <chrono> #include <vector> #include <map> #include <cstring> #include <algorithm> #include <stdlib.h> using namespace std; std::map<long, std::string> table_map = {}; int...
unsigned long number, char* buffer ) { if( number == 0 ) { *buffer++ = '0'; } else { char* p_first = buffer; while( number != 0 ) { *buffer++ = '0' + number % 10; number /= 10; } ...
; } } else { if (val >= 100) { if (val >= 1000) size = 4; else size = 3; } else { if (val>=10) size = 2; ...
random
[ { "content": "struct RemoveConstFromKey<std::pair<const K, V> > {\n\n typedef std::pair<K, V> type;\n\n};\n\n\n\n// Mapping from booleans to types. Similar to boost::bool_<kValue> and\n\n// std::integral_constant<bool, kValue>.\n\ntemplate <bool kValue>\n", "file_path": "third-party/paxos/dependencies/yaml...
C++
stereo_egomotion/base/evaluator.cc
bartn8/stereo-vision
1180045fe560478e5c441e75202cc899fe90ec3d
#include "evaluator.h" #include <iostream> #include <fstream> #include <stdio.h> #include <math.h> #include <tuple> #include <limits> #include <algorithm> #include <iomanip> #include <dirent.h> #include <sys/stat.h> namespace egomotion { typedef std::tuple<std::string,double,double> ResultTuple; using namespace st...
#include "evaluator.h" #include <iostream> #include <fstream> #include <stdio.h> #include <math.h> #include <tuple> #include <limits> #include <algorithm> #include <iomanip> #include <dirent.h> #include <sys/stat.h> namespace egomotion { typedef std::tuple<std::string,double,double> ResultTuple; using namespace st...
void Evaluator::Eval(const std::string& gt_fname, const std::vector<Eigen::Matrix4d>& egomotion_poses, double& trans_error, double& rot_error) { std::vector<libviso::Matrix> libviso_poses; EigenVectorToLibvisoVector(egomotion_poses, libviso_poses); Eval(gt_fname, libviso_poses, trans_error, rot_error)...
void Evaluator::EigenVectorToLibvisoVector(const std::vector<Eigen::Matrix4d>& vec1, std::vector<libviso::Matrix>& vec2) { vec2.clear(); for (const auto& rt : vec1) vec2.push_back(EigenMatrixToLibvisoMatrix(rt)); }
function_block-full_function
[ { "content": "struct greaterThanPtr : public std::binary_function<const float*, const float*, bool>\n\n{\n\n bool operator () (const float* a, const float* b) const\n\n { return *a > *b; }\n\n};\n\n\n\n}\n\n\n\nnamespace track {\n\n\n\nFeatureDetectorHarrisCV::FeatureDetectorHarrisCV(int block_size, int k...
C++
Source/Tools/Game/zmq/src/tcp_listener.cpp
299299/tesla_hmi
d5f2ad158d1b69d46d7fc99898ec90e19f1ae419
#include "precompiled.hpp" #include <new> #include <string> #include <stdio.h> #include "tcp_listener.hpp" #include "io_thread.hpp" #include "config.hpp" #include "err.hpp" #include "ip.hpp" #include "tcp.hpp" #include "socket_base.hpp" #include "address.hpp" #ifndef ZMQ_HAVE_WINDOWS #include <unistd.h> #include <...
#include "precompiled.hpp" #include <new> #include <string> #include <stdio.h> #include "tcp_listener.hpp" #include "io_thread.hpp" #include "config.hpp" #include "err.hpp" #include "ip.hpp" #include "tcp.hpp" #include "socket_base.hpp" #include "address.hpp" #ifndef ZMQ_HAVE_WINDOWS #include <unistd.h> #include <...
_socket->event_accept_failed ( make_unconnected_bind_endpoint_pair (_endpoint), zmq_errno ()); return; } create_engine (fd); } std::string zmq::tcp_listener_t::get_socket_name (zmq::fd_t fd_, socket_end_t socket_end_) const { return zmq::get_...
io_thread_t *io_thread_, socket_base_t *socket_, const options_t &options_) : stream_listener_base_t (io_thread_, socket_, options_) { } void zmq::tcp_listener_t::in_event () { fd_t fd = accept (); if (fd == retired_fd) { ...
random
[ { "content": " FT_Byte* string; /* this string is *not* null-terminated! */\n", "file_path": "Source/ThirdParty/FreeType/include/freetype/ftsnames.h", "rank": 0, "score": 203889.44645226406 }, { "content": " FT_Byte* string;\n", "file_path": "Source/ThirdParty/FreeType/inclu...
C++
framework/frontend/fsa/fsa_transition.hpp
aamshukov/frontend
6be5fea43b7776691034f3b4f56d318d7cdf18f8
 #ifndef __FSA_TRANSITION_H__ #define __FSA_TRANSITION_H__ #pragma once BEGIN_NAMESPACE(frontend) USINGNAMESPACE(core) #define MAX_TRANSITION_RANK (5) class fsa_transition { public: using datum_type = text::datum_type; using predicate_type = string_type; using predicat...
 #ifndef __FSA_TRANSITION_H__ #define __FSA_TRANSITION_H__ #pragma once BEGIN_NAMESPACE(frontend) USINGNAMESPACE(core) #define MAX_TRANSITION_RANK (5) class fsa_transition { public: using datum_type = text::datum_type; using predicate_type = string_type; using predicat...
public: fsa_transition(); fsa_transition(uint32_t s...
my_predicate; datum_type my_switch_predicate; int16_t my_rank;
random
[ { "content": "class string_data_provider : public data_provider, private noncopyable\n\n{\n\n public:\n\n using datum_type = data_provider::datum_type;\n\n\n\n private:\n\n string_type my_data_content;\n\n\n\n public:\n\n string_data_provider(const strin...
C++
spline_planner/src/eigen_spline.cpp
Veilkrand/drone_race
7391f1a94bfe354aab3e24be61b76e1595481ad9
#include <boost/python.hpp> #include <boost/assert.hpp> #include <vector> #include <Eigen/Dense> #include "eigen_spline.hpp" using namespace spline_planner; namespace py = boost::python; py::list ColumnMajorMatrixToRowMajorPython2DList(const Eigen::MatrixXd& mat) { py::list result; const size_t cols = mat.cols(...
#include <boost/python.hpp> #include <boost/assert.hpp> #include <vector> #include <Eigen/Dense> #include "eigen_spline.hpp" using namespace spline_planner; namespace py = boost::python; py::list ColumnMajorMatrixToRowMajorPython2DList(const Eigen::MatrixXd& mat) { py::list result; const size_t cols = mat.cols(...
.def("sampleAndCollect", &CubicSpline3DWrapper::SampleAndCollect1) .def("sampleAndCollect", &CubicSpline3DWrapper::SampleAndCollect2) .def("sampleAndCollect", &CubicSpline3DWrapper::SampleAndCollect); }
py::class_<CubicSpline3DWrapper>("CubicSpline3DWrapper", py::init<py::list>()) .def(py::init<py::list, py::list, py::list>()) .def("sampleAndCollect", &CubicSpline3DWrapper::SampleAndCollect0)
call_expression
[ { "content": "def vector_to_list(vec):\n", "file_path": "spline_planner/scripts/ros_geometry.py", "rank": 1, "score": 85291.53639601504 }, { "content": "def vec_to_quat(vec):\n\n \"\"\"To fully determine the orientation represented by the resulting quaternion, this method will assume the ...
C++
ThirdParty-mod/java2cpp/java/io/LineNumberInputStream.hpp
kakashidinho/HQEngine
8125b290afa7c62db6cc6eac14e964d8138c7fd0
#ifndef J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_JAVA_IO_LINENUMBERINPUTSTREAM_HPP_DECL #define J2CPP_JAVA_IO_LINENUMBERINPUTSTREAM_HPP_DECL namespace j2cpp { namespace java { namespace io { class FilterInputStream; } } } namespace j2cpp { namespace java { namespace io { class InputStream; } } } ...
#ifndef J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_JAVA_IO_LINENUMBERINPUTSTREAM_HPP_DECL #define J2CPP_JAVA_IO_LINENUMBERINPUTSTREAM_HPP_DECL namespace j2cpp { namespace java { namespace io { class FilterInputStream; } } } namespace j2cpp { namespace java { namespace io { class InputStream; } } } ...
jint java::io::LineNumberInputStream::read() { return call_method< java::io::LineNumberInputStream::J2CPP_CLASS_NAME, java::io::LineNumberInputStream::J2CPP_METHOD_NAME(4), java::io::LineNumberInputStream::J2CPP_METHOD_SIGNATURE(4), jint >(get_jobject()); } jint java::io::LineNumberInputStream...
m::mark(jint a0) { return call_method< java::io::LineNumberInputStream::J2CPP_CLASS_NAME, java::io::LineNumberInputStream::J2CPP_METHOD_NAME(3), java::io::LineNumberInputStream::J2CPP_METHOD_SIGNATURE(3), void >(get_jobject(), a0); }
function_block-function_prefixed
[ { "content": "\tclass Void;\n", "file_path": "ThirdParty-mod/java2cpp/java/lang/Void.hpp", "rank": 0, "score": 307452.9692886499 }, { "content": "\tclass Void\n\n\t\t: public object<Void>\n\n\t{\n\n\tpublic:\n\n\n\n\t\tJ2CPP_DECLARE_CLASS\n\n\n\n\t\tJ2CPP_DECLARE_METHOD(0)\n\n\t\tJ2CPP_DECLA...
C++
Funambol/source/common/http/DigestAuthentication.cpp
wbitos/funambol
29f76caf9cee51d51ddf5318613411cb1cfb8e4e
#include <Funambol/base/Log.h> #include <Funambol/base/messages.h> #include <Funambol/base/util/utils.h> #include <Funambol/http/constants.h> #include <Funambol/http/errors.h> #include <Funambol/http/DigestAuthentication.h> #include <Funambol/event/FireEvent.h> USE_NAMESPACE DigestAuthentication::DigestAuthenticati...
#include <Funambol/base/Log.h> #include <Funambol/base/messages.h> #include <Funambol/base/util/utils.h> #include <Funambol/http/constants.h> #include <Funambol/http/errors.h> #include <Funambol/http/DigestAuthentication.h> #include <Funambol/event/FireEvent.h> USE_NAMESPACE DigestAuthentication::DigestAuthenticati...
void DigestAuthentication::processAuthInfo(const char* authstr) { if (strstr(authstr, "Digest") != authstr) { return; } this->realm = extractDigestProp(authstr, "realm"); this->qop = extractDigestProp(authstr, "qop"); this->nonce = extractDigestProp(authstr, "nonce"); this->opaque = extractDigestProp(authstr,...
StringBuffer DigestAuthentication::extractDigestProp(const char* authstr, const char* prop) { StringBuffer result = ""; const char* start; const char* end; const char* ptr; char * temp = new char[100]; sprintf(temp, "%s=\"", prop); start = strstr(authstr, temp); if (start == NULL) { ...
function_block-full_function
[ { "content": " class URL {\n\n\n\n public:\n\n char* fullURL ;\n\n char* protocol;\n\n char* host ;\n\n char* resource;\n\n int port ;\n\n\n\n URL();\n\n URL(const URL &url);\n\n URL(const char* url);\n\n ~URL();\n\n\n\n vo...
C++
bus/map_test.cpp
UndefeatedSunny/sc-platform
5897c460bf7a4b9694324f09d2492f5e157a3955
#include "bus/memory_map.hpp" #include "report/report.hpp" #include "report/summary.hpp" #include "common/common.hpp" #include <string> #include <list> #include <vector> #include <map> using namespace std; using namespace sc_core; namespace { const char * const MSGID{ "/Doulos/Example/map_test" }; } Port_t decode...
#include "bus/memory_map.hpp" #include "report/report.hpp" #include "report/summary.hpp" #include "common/common.hpp" #include <string> #include <list> #include <vector> #include <map> using namespace std; using namespace sc_core; namespace { const char * const MSGID{ "/Doulos/Example/map_test" }; } Port_t decode...
void build_port_map( void ) { string config_name; string config_kind; Depth_t config_size; INFO( DEBUG, "Mapping port " << port << " " << config_name ); size_t matches{ 0 }; for( auto& mapping : m_addr_map ) { Addr_t addr{ mapping.first }; Target_info& mapped{ mapping.second }; ...
Addr_t reconstruct_address( Addr_t address, Port_t port, bool bias_upwards ) { Addr_t base{ BAD_ADDR }; Addr_t last; Addr_t min_address{ MAX_ADDR}; Addr_t max_address{ 0 }; Addr_t reconstructed{ BAD_ADDR }; for( const auto& mapping : m_addr_map ) { if( mapping.second.port != port ) continue; base = ...
function_block-full_function
[ { "content": "#define UNASSIGNED 0\n\n#define UNLIMITED 0\n\nstruct Target_info {\n\n // Initial values chosen to force initialization discovery if need be\n\n Port_t port { BAD_PORT }; // get from probe\n\n Addr_t base { BAD_ADDR }; // get from YAML\n\n Addr_t last { 0 }; //...
C++
code/BDataPersonName.cpp
omerdagan84/neomem
7d2f782bb37f1ab0ac6580d00672e114605afab7
#include "precompiled.h" #include "BDataPersonName.h" #include "ConstantsDatabase.h" #include "BDoc.h" #include "UI.h" #include "NeoMem.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif IMPLEMENT_SERIAL(BDataPersonName, BData, VERSIONABLE_SCHEMA | versionFileStructur...
#include "precompiled.h" #include "BDataPersonName.h" #include "ConstantsDatabase.h" #include "BDoc.h" #include "UI.h" #include "NeoMem.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif IMPLEMENT_SERIAL(BDataPersonName, BData, VERSIONABLE_SCHEMA | versionFileStructur...
rFirst = str.Mid(n+1); m_strFirst.TrimLeft(); } else { int n = str.ReverseFind(' '); if (n == -1) { m_strLast = str; } else { m_strFirst = str.Left(n); m_strLast = str.Mid(n+1); } } m_bCacheValid = FALSE; return TRUE; } CString BDataPersonName::GetBDataText(BDoc* pDoc,...
D(this); m_strTitle.Empty(); m_strFirst.Empty(); m_strMiddle.Empty(); m_strLast.Empty(); m_strNickname.Empty(); m_strSuffix.Empty(); int n = str.Find(','); if (n != -1) { m_strLast = str.Left(n); m_st
function_block-random_span
[ { "content": "#define HID_STATIC 0x1FFFF\n", "file_path": "help/HTMLDefines.h", "rank": 0, "score": 83671.20184086818 }, { "content": "#define HIDD_NEW_FILE 0x2031E\n", "file_path": "help/HTMLDefines.h", "rank": 1, "score": 8...
C++
examples/fft2d/fft2d.cpp
brycelelbach/upcxx
9a3f3b18a631d8e924298e621729ef302636908d
#include <upcxx.h> #include <forkjoin.h> #include "myfft.h" #include <cstdlib> #include <iostream> #include <vector> #include <cassert> #include <time.h> #include <sys/time.h> #define VERIFY using namespace upcxx; #include <cstdlib> size_t NX_default = 1024; size_t NY_default = 1024; global_ptr<complex_t>...
#include <upcxx.h> #include <forkjoin.h> #include "myfft.h" #include <cstdlib> #include <iostream> #include <vector> #include <cassert> #include <time.h> #include <sys/time.h> #define VERIFY using namespace upcxx; #include <cstdlib> size_t NX_default = 1024; size_t NY_default = 1024; global_ptr<complex_t>...
nx_per_p); } barrier(); } #endif local_transpose2<T>((T *)W[myid].raw_ptr(), out, ny, nx_per_p); #ifdef DEBUG for (i=0; i<nprocs; i++) { if (myid == i) { printf("P%d transpose: After the second local_transpose2:\n", myid); print_matrix<T>(cout, out, nx_per_p, ny); ...
x::copy(all_Ws, global_ptr< global_ptr<T> >(W), nprocs); #ifdef DEBUG for (int i=0; i<nprocs; i++) { fprintf(stderr, "transpose: myid %d, W[%d] ", myid, i); cerr << W[i] << "\n"; } #endif tmp_in = allocate<T>(myid, nx_per_p * ny); assert(tmp_in.raw_ptr() != NULL); #ifdef...
random
[ { "content": " int barrier();\n", "file_path": "include/upcxx/upcxx_runtime.h", "rank": 0, "score": 169134.43952992093 }, { "content": " static inline uint32_t myrank() {\n\n if (is_init() == false) return 0xFFFFFFFF; // return a special value if not inited\n\n return team::current_t...
C++
BlackVision/Test/Tools/TestLibCore/Source/Conversions/String2Integer.cpp
black-vision-engine/bv-engine
85089d41bb22afeaa9de070646e12aa1777ecedf
#include "gtest/gtest.h" #include "Serialization/SerializationHelper.h" using namespace bv; template< class Type > class LibCore_String2T_Integer : public testing::Test { protected: LibCore_String2T_Integer() {}; }; template< class Type > class LibCore_String2T_IntegerSigned : public ...
#include "gtest/gtest.h" #include "Serialization/SerializationHelper.h" using namespace bv; template< class Type > class LibCore_String2T_Integer : public testing::Test { protected: LibCore_String2T_Integer() {}; }; template< class Type > class LibCore_String2T_IntegerSigned : public ...
mFloatStr ) { Expected< TypeParam > intExp = Convert::String2T< TypeParam >( "1.0434" ); TypeParam intDef = Convert::String2T< TypeParam >( "1.0434", 5 ); EXPECT_FALSE( intExp.IsValid() ); EXPECT_EQ( intDef, 5 ); } TYPED_TEST( LibCore_String2T_Integer, ConvertOverflowing ) { Expected< ...
() {}; }; typedef testing::Types< UInt64, Int64, UInt32, Int32, UInt16, Int16, UInt8, Int8 > IntegerTypesList; typedef testing::Types< Int64, Int32, Int16, Int8 > SignedIntegerTypesList; typedef testing::Types< UInt64, UInt32, UInt16, UInt8 > UnsignedIntegerTypesList; TYPED_TEST_CASE( LibCore_String2T_Integer,...
random
[ { "content": " class TestName : public CaseName<gtest_TypeParam_> { \\\n\n private: \\\n\n typedef CaseName<gtest_TypeParam_> TestFixture; \\\n\n typedef gtest_TypeParam_ TypeParam; \\\n\n virtual void TestBody(); \\\n\n }; \\\n\n static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \...
C++
Xenakios/FloatingInspector.cpp
lorenzopistolesi/sws
6963f7563851c8dd919db426bae825843939077f
#include "stdafx.h" #include "../SnM/SnM_Dlg.h" using namespace std; HWND g_hItemInspector=NULL; bool g_ItemInspectorVisible=false; WDL_DLGRET MyItemInspectorDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { static HMENU g_hItemInspCtxMenu=0; static int g_InspshowMode=1; if (INT_...
#include "stdafx.h" #include "../SnM/SnM_Dlg.h" using namespace std; HWND g_hItemInspector=NULL; bool g_ItemInspectorVisible=false; WDL_DLGRET MyItemInspectorDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { static HMENU g_hItemInspCtxMenu=0; static int g_InspshowMode=1; if (INT_...
void DoTglFltItemInspector(COMMAND_T*) { if (g_ItemInspectorVisible) { g_ItemInspectorVisible = false; KillTimer(g_hItemInspector, 1); ShowWindow(g_hItemInspector, SW_HIDE); } else { g_ItemInspectorVisible = true; SetTimer(g_hItemInspector, 1, 200, NULL); ShowWindow(g_hItemInspector, SW_SHO...
function_block-full_function
[ { "content": "class CmdSelectAllItemsOnTrackBetweenLoopPoints: public RprCommand\n\n{\n\npublic:\n\n\tCmdSelectAllItemsOnTrackBetweenLoopPoints(bool allInLoop) {m_allInLoop = allInLoop;}\n\nprivate:\n\n\tvirtual void doCommand(int flag);\n\n\tbool m_allInLoop;\n\n};\n\n\n", "file_path": "Fingers/MediaItemCo...
C++
Library/Source/Nanites/CoreFoundation/NCoreFoundation.cpp
refnum/Nano
dceb0907061f7845d8a3c662f309ca164e932e6f
#include "NCoreFoundation.h" NCFType ToCF(const NAny& theValue) { NNumber theNumber; NCFType cfObject; if (theValue.IsBool()) { cfObject.Set(theValue.GetBool() ? kCFBooleanTrue : kCFBooleanFalse); } else if (theValue.IsArray()) { cfObject.Set(ToCF(theValue.GetArray())); } else if (theValue.IsData(...
#include "NCoreFoundation.h" NCFType ToCF(const NAny& theValue) { NNumber theNumber; NCFType cfObject; if (theValue.IsBool()) { cfObject.Set(theValue.GetBool() ? kCFBooleanTrue : kCFBooleanFalse); } else if (theValue.IsArray()) { cfObject.Set(ToCF(theValue.GetArray())); } else if (theValue.IsData(...
return cfObject; } NAny ToNN(CFTypeRef cfObject) { NAny theObject; if (cfObject != nullptr) { CFTypeID cfType = CFGetTypeID(cfObject); if (cfType == CFBooleanGetTypeID()) { theObject = CFBooleanGetValue(CFBooleanRef(cfObject)) ? true : false; } else if (cfType == CFArrayGetTypeID()) { NCF...
if (theNumber.SetValue(theValue)) { cfObject.Set(ToCF(theNumber)); } else { NN_LOG_ERROR("Unable to convert Nano object to CF!"); }
if_condition
[ { "content": " ExprList *pReturnEL; /* List of expressions to return */\n", "file_path": "Library/Source/Nano/Internal/Components/sqlite-3.36.0/sqlite3.36.0.c", "rank": 0, "score": 52241.32236349526 }, { "content": "static const char KW_INCLUDE[]\n", "file_path": "Library/Source/Nano/I...
C++
tests/server.test.cpp
lineCode/webrtc-datachannels
0f814632361c829c3aff1764cb662bd6290d54d9
#include "algo/StringUtils.hpp" #include "config/ServerConfig.hpp" #include "log/Logger.hpp" #include "storage/path.hpp" #include <algorithm> #include <boost/asio.hpp> #include <boost/asio/bind_executor.hpp> #include <boost/asio/buffer.hpp> #include <boost/asio/ip/tcp.hpp> #include <boost/asio/ssl.hpp> #include <boos...
#include "algo/StringUtils.hpp" #include "config/ServerConfig.hpp" #include "log/Logger.hpp" #include "storage/path.hpp" #include <algorithm> #include <boost/asio.hpp> #include <boost/asio/bind_executor.hpp> #include <boost/asio/buffer.hpp> #include <boost/asio/ip/tcp.hpp> #include <boost/asio/ssl.hpp> #include <boos...
{ REQUIRE(v.size() == 10); REQUIRE(v.capacity() >= 10); } } WHEN("the size is reduced") { v.resize(0); THEN("the size changes but not capacity") { REQUIRE(v.size() == 0); REQUIRE(v.capacity() >= 5); } } WHEN("more capacity is reserved") { v....
) == 5); REQUIRE(v.capacity() >= 5); WHEN("the size is increased") { v.resize(10); THEN("the size and capacity change")
random
[ { "content": "// Sends a WebSocket message and prints the response\n\nclass session : public std::enable_shared_from_this<session>\n\n{\n\n tcp::resolver resolver_;\n\n websocket::stream<beast::tcp_stream> ws_;\n\n beast::flat_buffer buffer_;\n\n std::string host_;\n\n std::string text_;\n\n\n\np...
C++
Chapter-5-Loops-and-Files/Review Questions and Exercises/Programming Challenges/016.cpp
jesushilarioh/C-Plus-Plus
bbff921460ac4267af48558f040c7d82ccf42d5e
#include <iostream> #include <iomanip> using namespace std; int main() { const int MONTHS = 12; float starting_balance, annual_interest_rate, amount_deposited, amount_withdrawn, interest_rate, monthly_interest_rate, balance, total_deposit...
#include <iostream> #include <iomanip> using namespace std; int main() { const int MONTHS = 12; float starting_balance, annual_interest_rate, amount_deposited, amount_withdrawn, interest_rate, monthly_interest_rate, balance, total_deposit...
balance += interest_rate; if (balance < 0) break; total_interest_earned += (interest_rate); } if (balance < 0) { cout << "I'm sorry, your account has been closed" << endl; cout << "due to having a negative balance." << endl; } ...
function_block-function_prefix_line
[ { "content": "//********************************************************************\n\n// This program displays a list of numbers and\n\n// their squares.\n\n//\n\n// JESUS HILARIO HERNANDEZ\n\n// Last updated: October 5, 2016\n\n//\n\n//********************************************************************\n\n\...
C++
lib/stages/pulsarNetworkProcess.cpp
james-s-willis/kotekan
155e874bb039702cec72c1785362a017548aa00a
#include <arpa/inet.h> #include <assert.h> #include <chrono> #include <cmath> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <math.h> #include <netinet/in.h> #include <signal.h> #include <stdlib.h> #include <string.h> #include <string> #include <sys/socket.h>...
#include <arpa/inet.h> #include <assert.h> #include <chrono> #include <cmath> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <math.h> #include <netinet/in.h> #include <signal.h> #include <stdlib.h> #include <string.h> #include <string> #include <sys/socket.h>...
INFO("{:s} ", my_ip_address[i]); } int frame_id = 0; uint8_t* packet_buffer = NULL; for (int i = 0; i < number_of_subnets; i++) { sock_fd[i] = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sock_fd[i] < 0) { FATAL_ERROR("network thread: socket() failed: "); ...
if (std::snprintf(my_ip_address[i], 100, "10.%d.%d.1%d", i + 15, nos + rack, node) > 100) { FATAL_ERROR("buffer spill over "); return; }
if_condition
[]
C++
chrome/browser/chromeos/cros_settings.cc
SlimKatLegacy/android_external_chromium
bc611cda58cc18d0dbaa8a7aee05eb3c0742e573
#include "chrome/browser/chromeos/cros_settings.h" #include "base/lazy_instance.h" #include "base/string_util.h" #include "base/values.h" #include "chrome/browser/chromeos/cros_settings_provider.h" #include "chrome/browser/chromeos/user_cros_settings_provider.h" #include "content/common/notification_details.h" #incl...
#include "chrome/browser/chromeos/cros_settings.h" #include "base/lazy_instance.h" #include "base/string_util.h" #include "base/values.h" #include "chrome/browser/chromeos/cros_settings_provider.h" #include "chrome/browser/chromeos/user_cros_settings_provider.h" #include "content/common/notification_details.h" #incl...
bool CrosSettings::GetBoolean(const std::string& path, bool* bool_value) const { DCHECK(CalledOnValidThread()); Value* value; if (!Get(path, &value)) return false; return value->GetAsBoolean(bool_value); } bool CrosSettings::GetInteger(const std::string& path, ...
CrosSettings::Get(const std::string& path, Value** out_value) const { DCHECK(CalledOnValidThread()); CrosSettingsProvider* provider; provider = GetProvider(path); if (provider) { return provider->Get(path, out_value); } return false; }
function_block-function_prefixed
[ { "content": "struct tuple_size<GTEST_0_TUPLE_(T)> { static const int value = 0; };\n\n\n\ntemplate <GTEST_1_TYPENAMES_(T)>\n", "file_path": "testing/gtest/include/gtest/internal/gtest-tuple.h", "rank": 0, "score": 425778.8998875817 }, { "content": "struct tuple_size<GTEST_3_TUPLE_(T)> { sta...
C++
aha/main.cpp
dlarudgus20/newly-aha
4d80bf992af3d8e7a6ddcca3c38d5959059ec66f
#include <iostream> #include <string> #include <type_traits> #include <variant> #include <locale> #include <boost/program_options.hpp> #include <boost/iterator/transform_iterator.hpp> namespace bpo = boost::program_options; #include "../libahafront/aha/front/source.hpp" #include "../libahafront/aha/front/lexer.hpp"...
#include <iostream> #include <string> #include <type_traits> #include <variant> #include <locale> #include <boost/program_options.hpp> #include <boost/iterator/transform_iterator.hpp> namespace bpo = boost::program_options; #include "../libahafront/aha/front/source.hpp" #include "../libahafront/aha/front/lexer.hpp"...
; int main(int argc, char* argv[]) { repl_source src; lexer ll; parser yy; auto get_input = [&src] (bool fresh) { std::string str; std::cout << (fresh ? ">> " : "-- "); if (!getline(std::cin, str)) { src.feedEof(); } else { ...
inline std::string utf32narrow(std::u32string_view str) { auto fn = [](char32_t ch) { return static_cast<char>(ch); }; auto tbeg = boost::iterators::make_transform_iterator(str.begin(), fn); auto tend = boost::iterators::make_transform_iterator(str.end(), fn); return std::string(tbeg, tend); }
function_block-full_function
[ { "content": "// SOFTWARE.\n\n\n\n#pragma once\n\n\n\n#include <string>\n\n#include <string_view>\n\n#include <vector>\n\n#include <deque>\n\n#include <optional>\n\n#include <stdexcept>\n\n\n\nnamespace aha::front\n\n{\n", "file_path": "libahafront/aha/front/source.hpp", "rank": 1, "score": 9.501183...
C++
cornellbox/Eyeo2012/Shockwaves/src/ShockwavesApp.cpp
eighteight/CinderEigh
d9dfc6a0ad9a9e6c5b82624971127f0335d91639
#include "cinder/app/AppBasic.h" #include "cinder/gl/gl.h" #include "cinder/gl/Texture.h" #include "cinder/Text.h" #include "cinder/gl/Fbo.h" #include "cinder/gl/Vbo.h" #include "cinder/gl/GlslProg.h" #include "cinder/ImageIo.h" #include "cinder/Utilities.h" #include "cinder/Camera.h" #include "cinder/Rand.h" #include ...
#include "cinder/app/AppBasic.h" #include "cinder/gl/gl.h" #include "cinder/gl/Texture.h" #include "cinder/Text.h" #include "cinder/gl/Fbo.h" #include "cinder/gl/Vbo.h" #include "cinder/gl/GlslProg.h" #include "cinder/ImageIo.h" #include "cinder/Utilities.h" #include "cinder/Camera.h" #include "cinder/Rand.h" #include ...
oid ShockwavesApp::keyDown( KeyEvent event ) { switch( event.getChar() ){ case '1': mController.preset( 1 ); break; case '2': mController.preset( 2 ); break; case ' ': mRoom.togglePower(); break; case 's': mController.explode(); break; default: break; } switch( event.getCode() ){ case KeyEvent...
_DIM; mVboMesh = gl::VboMesh( numVertices * 8 * 3, 0, layout, GL_TRIANGLES ); float s = 10.0f; Vec3f p0( 0.0f, s, 0.0f ); Vec3f p1( -s, 0.0f, 0.0f ); Vec3f p2( 0.0f, 0.0f, s ); Vec3f p3( s, 0.0f, 0.0f ); Vec3f p4( 0.0f, 0.0f, -s ); Vec3f p5( 0.0f, -s, 0.0f ); Vec3f n; Vec3f n0 = Ve...
random
[]
C++
Core/GraphicsView.cpp
devonchenc/NovaImage
3d17166f9705ba23b89f1aefd31ac2db97385b1c
#include "GraphicsView.h" #include <QtMath> #include <QMimeData> #include <QDebug> #include "View.h" #include "MouseHandler.h" #include "GlobalFunc.h" #include "mainwindow.h" #include "../Image/BaseImage.h" #include "../Widget/MagnifierWidget.h" GraphicsView::GraphicsView(View* view, QGraphicsScene* scene, QWidget* ...
#include "GraphicsView.h" #include <QtMath> #include <QMimeData> #include <QDebug> #include "View.h" #include "MouseHandler.h" #include "GlobalFunc.h" #include "mainwindow.h" #include "../Image/BaseImage.h" #include "../Widget/MagnifierWidget.h" GraphicsView::GraphicsView(View* view, QGraphicsScene* scene, QWidget* ...
float GraphicsView::calcScale(float pixelSpacing) { float distance = 20.0f; int flag = 0; while (distance / pixelSpacing > 60) { if (flag == 0) { distance /= 2; } else if (flag == 1) { distance /= 2; } else if (flag == 2) ...
QString str = QString::number(horzDistance, 'f', 2) + " mm"; painter.drawText(QRect(rect().center().x(), y - 23, 9 * horzInterval, 20), Qt::AlignCenter, str); painter.rotate(-90); str = QString::number(vertDistance, 'f', 2) + " mm"; painter.drawText(QRect(-rect().center().y(), rect().width() - 23 - mar...
function_block-function_prefix_line
[ { "content": "class View;\n", "file_path": "Core/GraphicsScene.h", "rank": 0, "score": 120366.99674812447 }, { "content": "class ImageQualityChartView : public ChartView\n\n{\n\n Q_OBJECT\n\n\n\npublic:\n\n ImageQualityChartView(QWidget* parent = nullptr);\n\n\n\n void setData(const...
C++
targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/TARGET_RIOT_MICRO_MODULE/ONBOARD_RM1000_AT.cpp
yogpan01/mbed
1fb9dd7ddd94239f788683e864f2dac664f33a48
#if MBED_CONF_NSAPI_PRESENT #include "ONBOARD_RM1000_AT.h" #include "UARTSerial.h" #include "mbed-trace/mbed_trace.h" #ifndef TRACE_GROUP #define TRACE_GROUP "RIOTMICRO" #endif #include "gpio_api.h" #include "PinNames.h" #include "hal/serial_api.h" #include "platform/mbed_thread.h" using namespace mbed; ONBOAR...
#if MBED_CONF_NSAPI_PRESENT #include "ONBOARD_RM1000_AT.h" #include "UARTSerial.h" #include "mbed-trace/mbed_trace.h" #ifndef TRACE_GROUP #define TRACE_GROUP "RIOTMICRO" #endif #include "gpio_api.h" #include "PinNames.h" #include "hal/serial_api.h" #include "platform/mbed_thread.h" using namespace mbed; ONBOAR...
void ONBOARD_RM1000_AT::onboard_modem_deinit() { tr_debug("onboard_modem_deinit"); gpio_t gpio; gpio_init_out_ex(&gpio, MDMRST, 0); } CellularDevice *CellularDevice::get_target_default_instance() { tr_debug("Calling CellularDevice::get_target_default_instance from ONBOARD_RM1000_AT"); sta...
unc__); serial_getc(&bootrom_uart); tr_debug("%s: MODEM first activity after reset", __func__); for (int i = 0; i < 3; i++) { do { promptEnd = serial_getc(&bootrom_uart); } while ('.' != promptEnd); } serial_putc(&bootrom_uart, ' '); for (int i = 0; i < 2; ...
function_block-function_prefixed
[]
C++
rexec/RexecShell/Environment.cpp
RWTH-OS/MP-MPICH
f2ae296477bb9d812fda587221b3419c09f85b4a
#include <vcl\vcl.h> #pragma hdrstop #include "Environment.h" #include "..\mpirun\plugins\Plugin.h" #if ((BCBVER > 1)) #include <stdio.h> #endif extern "C" { __declspec(dllexport) char* GetEnvString(HostData *Proc,char *Name,char *value,DWORD *BufSize) { char *act, *pos; int res; DWORD lenAll,lenStName,l...
#include <vcl\vcl.h> #pragma hdrstop #include "Environment.h" #include "..\mpirun\plugins\Plugin.h" #if ((BCBVER > 1)) #include <stdio.h> #endif extern "C" {
__declspec(dllexport) void PutEnvString(HostData *Proc,char *Name,char *value) { char *OldPos; DWORD oldLen,newLen,OldIndex,oldSize,namelen; if(!value) value=""; namelen = strlen(Name); newLen=namelen+strlen(value)+2; oldLen = 0; if(!Proc->ProcData) { Proc->ProcData = (TProcessData*)malloc(sizeof(TPro...
__declspec(dllexport) char* GetEnvString(HostData *Proc,char *Name,char *value,DWORD *BufSize) { char *act, *pos; int res; DWORD lenAll,lenStName,lenGName,lenValue; if(!Proc || !Proc->ProcData) return 0; act=Proc->ProcData->Environment; if(value) *value=0; if(!Name) { return 0; } while(act&&*act) { ...
function_block-full_function
[ { "content": "extern ADIOI_Flatlist_node *ADIOI_Flatlist;\n", "file_path": "romio/adio/include/adio_extern.h", "rank": 0, "score": 127407.15731490849 }, { "content": "extern MPI_Info *MPIR_Infotable;\n", "file_path": "romio/adio/include/adio_extern.h", "rank": 1, "score": 127396....
C++
image_processing/toolbox/classify/private/multiclassQuantizedTreeTrain1.cpp
bruceli-rw0/edge2pic-generation
e9ee6f89361d1a12b044c0ab665a09fca4a47089
#include <string.h> #include <stdint.h> #include <math.h> #include <mex.h> #include <iostream> #include <vector> #ifdef USEOMP #include <omp.h> #endif typedef unsigned char uint8; typedef unsigned int uint32; #define gini(p) p*p void constructCdfPerClass( uint8* data, uint32 *hs, float *wts, ...
#include <string.h> #include <stdint.h> #include <math.h> #include <mex.h> #include <iostream> #include <vector> #ifdef USEOMP #include <omp.h> #endif typedef unsigned char uint8; typedef unsigned int uint32; #define gini(p) p*p void constructCdfPerClass( uint8* data, uint32 *hs, float *wts, ...
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { int H, N, N1, F1, F, split; uint8 *data; uint32* fids, *dids; float *wts, thr; double gain; uint32 *hs; double cfactor, *costs_factor; int nBins, nThreads; data = (uint8*) mxGetData(prhs[0]); hs = (uint32*) mxGetDa...
void constructCdf( uint8* data, float *wts, int nBins, int N, uint32 *dids, std::vector<double>& cdf ) { for(int i=0; i<N; i++) cdf[data[dids[i]]] += wts[dids[i]]; for(int i=1; i<nBins; i++) cdf[i] += cdf[i-1]; }
function_block-full_function
[ { "content": "/*******************************************************************************\n\n* Piotr's Computer Vision Matlab Toolbox Version 3.01\n\n* Copyright 2014 Piotr Dollar. [pdollar-at-gmail.com]\n\n* Licensed under the Simplified BSD License [see external/bsd.txt]\n\n************************...
C++
cpp/src/simulator.cpp
mamariomiamo/online_dmpc
63a135ce6bf6f1c3a0970129a23e569797801b6c
#include "iostream" #include "simulator.h" using namespace Eigen; using namespace std; using namespace std::chrono; using json = nlohmann::json; Simulator::Simulator(std::ifstream& config_file) { Generator::Params p = parseJSON(config_file); _generator = std::make_unique<Generator>(p); _sim_model = std:...
#include "iostream" #include "simulator.h" using namespace Eigen; using namespace std; using namespace std::chrono; using json = nlohmann::json; Simulator::Simulator(std::ifstream& config_file) { Generator::Params p = parseJSON(config_file); _generator = std::make_unique<Generator>(p); _sim_model = std:...
MatrixXd Simulator::generateRandomPoints(int N, const Vector3d &pmin, const Vector3d &pmax, float rmin) { MatrixXd pts = MatrixXd::Zero(3, N); Vector3d candidate = MatrixXd::Zero(3, 1); VectorXd dist; bool pass = false; pts.col(0) = pmin.array() ...
file << _po << endl; file << _pf << endl; for(int i=0; i < _Ncmd; ++i) file << _trajectories[i] << endl; file.close(); } else { cerr << "Error while trying to open file" << endl; } }
function_block-function_prefix_line
[ { "content": "struct is_complete_type<T, decltype(void(sizeof(T)))> : std::true_type {};\n\n\n\ntemplate <typename BasicJsonType, typename CompatibleObjectType,\n\n typename = void>\n", "file_path": "cpp/include/json.hpp", "rank": 0, "score": 123715.87774488093 }, { "content": " ...
C++
net/ias/mmc/nap/logcompd.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
#include "Precompiled.h" #include "LogCompD.h" #include "LogMacNd.h" #include "LocalFileLoggingNode.h" #include "LoggingMethodsNode.h" #include "LogComp.h" #include <stdio.h> #include "ChangeNotification.h" CLoggingComponentData::CLoggingComponentData() { ATLTRACE(_T("+NAPMMC+:# +++ CLogg...
#include "Precompiled.h" #include "LogCompD.h" #include "LogMacNd.h" #include "LocalFileLoggingNode.h" #include "LoggingMethodsNode.h" #include "LogComp.h" #include <stdio.h> #include "ChangeNotification.h" CLoggingComponentData::CLoggingComponentData() { ATLTRACE(_T("+NAPMMC+:# +++ CLogg...
, LPARAM lParam ) { ATLTRACE(_T("# CLoggingComponentData::OnPropertyChange\n")); _ASSERTE( m_spConsole != NULL ); HRESULT hr = S_FALSE; if( lParam != NULL ) { CChangeNotification * pChangeNotification = (CChangeNotification *) lParam; ...
**FAILED***: CLoggingComponentData::Initialize -- ImageListSetStrip\n")); return E_UNEXPECTED; } INITCOMMONCONTROLSEX initCommCtrlsEx; initCommCtrlsEx.dwSize = sizeof(INITCOMMONCONTROLSEX); initCommCtrlsEx.dwICC = ICC_WIN95_CLASSES ; if (!In...
random
[]
C++
include/El/core/Grid.hpp
pjt1988/Elemental
71d3e2b98829594e9f52980a8b1ef7c1e99c724b
#ifndef EL_GRID_HPP #define EL_GRID_HPP namespace El { class Grid { public: explicit Grid ( mpi::Comm comm=mpi::COMM_WORLD, GridOrder order=COLUMN_MAJOR ); explicit Grid( mpi::Comm comm, int height, GridOrder order=COLUMN_MAJOR ); ~Grid(); int Row() const EL_NO_RELEASE_EXCEPT; int Col(...
#ifndef EL_GRID_HPP #define EL_GRID_HPP namespace El { class Grid { public: explicit Grid ( mpi::Comm comm=mpi::COMM_WORLD, GridOrder order=COLUMN_MAJOR ); explicit Grid( mpi::Comm comm, int height, GridOrder order=COLUMN_MAJOR ); ~Grid(); int Row() const EL_NO_RELEASE_EXCEPT; int Col(...
} #endif
inline bool GridCompare ( const Grid & g1, const Grid & g2 ) { if( g1.Height() != g2.Height() ) return false; if( g1.Order() != g2.Order() ) return false; if( !Congruent( g1.ViewingComm(), g2.ViewingComm() ) ) return false; if( !Congruent( g1.OwningGroup(),...
function_block-full_function
[ { "content": "struct IsIntegral<BigInt> { static const bool value = true; };\n\n#endif\n\n\n\n// For querying whether an element's type is a scalar\n\n// --------------------------------------------------\n\ntemplate<typename T> struct IsScalar\n\n{ static const bool value=false; };\n\ntemplate<> struct IsScala...
C++
packages/utility/stats/src/Utility_SampleMoment.hpp
bam241/FRENSIE
e1760cd792928699c84f2bdce70ff54228e88094
#ifndef UTILITY_SAMPLE_MOMENT_HPP #define UTILITY_SAMPLE_MOMENT_HPP #include <type_traits> #include "Utility_QuantityTraits.hpp" namespace Utility{ template<size_t N, typename T, typename Enabled = void> class SampleMoment { }; template<size_t N, typename T> class SampleMoment<N,T,typename std::enable_if<(N>0) ...
#ifndef UTILITY_SAMPLE_MOMENT_HPP #define UTILITY_SAMPLE_MOMENT_HPP #include <type_traits> #include "Utility_QuantityTraits.hpp" namespace Utility{ template<size_t N, typename T, typename Enabled = void> class SampleMoment { }; template<size_t N, typename T> class SampleMoment<N,T,typename std::enable_if<(N>0) ...
t<1,T>& first_moment, const size_t number_of_samples ); template<typename T> typename QuantityTraits<T>::template GetQuantityToPowerType<2>::type calculateVariance( const SampleMoment<1,T>& first_moment, const SampleMoment<2,T>& second_moment, const size_t numb...
ename QuantityTraits<T>::template GetQuantityToPowerType<N>::type ValueType; static ValueType processRawScore( const T& raw_score ); SampleMoment(); SampleMoment( const ValueType& starting_score ); SampleMoment( const SampleMoment& other_moment ); SampleMoment& operator=( const Sampl...
random
[ { "content": "struct RawRationalPowerHelper<N,D,T,typename std::enable_if<N<0 && D<0 && N!=D>::type> : public RawRationalPowerHelper<-N,-D,T>\n\n{ /* ... */ };\n\n\n\n/*! The true or false type\n\n * \\ingroup quantity_traits\n\n */\n\ntemplate<bool is_true>\n", "file_path": "packages/utility/core/src/Utili...
C++
src/csapex_remote/src/io/protocol/core_requests.cpp
betwo/csapex
f2c896002cf6bd4eb7fba2903ebeea4a1e811191
#include <csapex/io/protcol/core_requests.h> #include <csapex/serialization/request_serializer.h> #include <csapex/serialization/io/std_io.h> #include <csapex/io/feedback.h> #include <csapex/utility/uuid_provider.h> #include <csapex/model/graph_facade_impl.h> #include <csapex/serialization/parameter_serializer.h> #in...
#include <csapex/io/protcol/core_requests.h> #include <csapex/serialization/request_serializer.h> #include <csapex/serialization/io/std_io.h> #include <csapex/io/feedback.h> #include <csapex/utility/uuid_provider.h> #include <csapex/model/graph_facade_impl.h> #include <csapex/serialization/parameter_serializer.h> #in...
} break; case CoreRequestType::CoreLoad: { int args = parameters_.size(); if (args == 0) { core.load(core.getSettings().get<std::string>("config")); } else { core.load(std::any_cast<std::string>(parameters_.at(0))); } ...
if (args == 1) { core.saveAs(std::any_cast<std::string>(parameters_.at(0))); } else { core.saveAs(std::any_cast<std::string>(parameters_.at(0)), std::any_cast<bool>(parameters_.at(1))); }
if_condition
[ { "content": "struct ArgumentExtractor<0, Arg, Args...>\n\n{\n\n using type = Arg;\n\n};\n\n\n\ntemplate <int pos, typename Signature>\n", "file_path": "src/csapex_util/include/csapex/utility/slim_signal_invoker.hpp", "rank": 0, "score": 173639.98887121578 }, { "content": "struct function...
C++
src/demo/hellocpp/main.cpp
rochus-keller/nappgui_src
394875dfc11c9c73cd7995d56f77dcd4629d70b5
#include "nappgui.h" class App; class MainWindow : public IListener { public: MainWindow(App *app); ~MainWindow(); void *operator new(size_t size) { return (void*)heap_malloc((uint32_t)size, "MainWindow"); } void operator delete(void *ptr, size_t size) { heap_free((byte_t**)&ptr, (uint32_t)siz...
#include "nappgui.h" class App; class MainWindow : public IListener { public: MainWindow(App *app); ~MainWindow(); void *operator new(size_t size) { return (void*)heap_malloc((uint32_t)size, "MainWindow"); } void operator delete(void *ptr, size_t size) { heap_free((byte_t**)&ptr, (uint32_t)siz...
MainWindow::~MainWindow() { window_destroy(&this->window); } App::App(void) { this->main_window = new MainWindow(this); } App::~App() { delete this->main_window; } static App *i_create(void) { return new App(); } static void i_destroy(App **app) { delete *app; *app = NULL; } #include "osm...
D); this->clicks = 0; window_panel(this->window, panel); window_title(this->window, "Hello, C++!"); window_origin(this->window, v2df(500, 200)); window_OnClose(this->window, IListen(app, App, i_OnClose)); window_show(this->window); }
function_block-function_prefixed
[ { "content": " String *text;\n", "file_path": "src/gui/label.c", "rank": 3, "score": 145566.12840869065 }, { "content": " String *text;\n", "file_path": "src/gui/button.c", "rank": 4, "score": 145561.48196416028 }, { "content": " Window *window;\n", "file_pat...
C++
src/projects/fea/test_FEA_ancf_cable.cpp
rserban/chrono
bee5e30b2ce3b4ac62324799d1366b6db295830e
#include <assert.h> #include <iostream> #include <string> #include <vector> #include "chrono/ChConfig.h" #include "chrono/physics/ChSystemSMC.h" #include "chrono/solver/ChIterativeSolverLS.h" #include "chrono/utils/ChUtilsInputOutput.h" #include "chrono_irrlicht/ChIrrApp.h" #include "chrono_mkl/ChSolverMKL.h" #incl...
#include <assert.h> #include <iostream> #include <string> #include <vector> #include "chrono/ChConfig.h" #include "chrono/physics/ChSystemSMC.h" #include "chrono/solver/ChIterativeSolverLS.h" #include "chrono/utils/ChUtilsInputOutput.h" #include "chrono_irrlicht/ChIrrApp.h" #include "chrono_mkl/ChSolverMKL.h" #incl...
int main(int argc, char* argv[]) { bool use_MKL = true; bool use_HHT = true; ChSystemSMC mphysicalSystem; mphysicalSystem.Set_G_acc(ChVector<>(0.01, 0.0, 0.0)); auto ground = chrono_types::make_shared<ChBody>(); ground->SetIdentifier(-1); ground->SetBodyFixed(true)...
function_block-full_function
[]
C++
Qt/Components/pqDisplayColorWidget.cxx
certik/paraview
973d37b466552ce770ac0674f30040bb7e31d7fe
#include "pqDisplayColorWidget.h" #include "vtkEventQtSlotConnect.h" #include "vtkPVArrayInformation.h" #include "vtkPVDataSetAttributesInformation.h" #include "vtkPVGeometryInformation.h" #include "vtkSMIntVectorProperty.h" #include "vtkSMPVRepresentationProxy.h" #include "vtkSMStringVectorProperty.h" #include <QC...
#include "pqDisplayColorWidget.h" #include "vtkEventQtSlotConnect.h" #include "vtkPVArrayInformation.h" #include "vtkPVDataSetAttributesInformation.h" #include "vtkPVGeometryInformation.h" #include "vtkSMIntVectorProperty.h" #include "vtkSMPVRepresentationProxy.h" #include "vtkSMStringVectorProperty.h" #include <QC...
; QObject::connect(this->Display, SIGNAL(updated()), this, SLOT(reloadGUI()), Qt::QueuedConnection); } QTimer::singleShot(0, this, SLOT(reloadGUI())); } pqPipelineRepresentation* pqDisplayColorWidget::getRepresentation() const { return this->Display; } void pqDisplayColorWidget::reloadGU...
this->VTKConnect->Connect( repr->GetProperty("Representation"), vtkCommand::ModifiedEvent, this, SLOT(reloadGUI()), NULL, 0.0, Qt::QueuedConnection)
call_expression
[ { "content": "extern struct obj_stats* els;\n", "file_path": "VTK/Utilities/vtkexodus2/include/exodusII_int.h", "rank": 0, "score": 239731.76580513327 }, { "content": "class VTK_PARALLEL_EXPORT vtkPCellDataToPointData : public vtkCellDataToPointData\n\n{\n\npublic:\n\n vtkTypeRevisionMacro(...
C++
src/ellipse.cpp
DavidR86/mxd
bf0a72305701dd5c76c2b3daa4bdba14d638b29d
#include "ellipse.hpp" #include <cmath> #include <iostream> #include <memory> #include "program.hpp" #include "shader.hpp" #include "time_point.hpp" #include "utilities.hpp" #include <GL/glew.h> #include <GLFW/glfw3.h> #include <glm/glm.hpp> namespace { nzl::Program create_program() { const std::string vertex...
#include "ellipse.hpp" #include <cmath> #include <iostream> #include <memory> #include "program.hpp" #include "shader.hpp" #include "time_point.hpp" #include "utilities.hpp" #include <GL/glew.h> #include <GLFW/glfw3.h> #include <glm/glm.hpp> namespace { nzl::Program create_program() { const std::string vertex...
} namespace nzl { struct Ellipse::IDContainer { glm::vec3 m_color; unsigned int m_vao_id; unsigned int m_vbo_id; int m_number_of_points{0}; nzl::Program m_program; IDContainer(glm::vec3 color, float rX, float rY, float number_of_points) : m_color{color}, m_program{create_program()} { glGenVe...
i < number_of_points; i++) { float x = rX * cos(i * step_size); float y = rY * sin(i * step_size); points.emplace_back(x, y, 0.0f); } return points; }
function_block-function_prefixed
[ { "content": "class Program {\n\n public:\n\n /// @brief Create a Program from the given @link Shader Shaders@endlink.\n\n /// @param shaders Shaders to be used to create this Program.\n\n Program(std::vector<nzl::Shader> shaders);\n\n\n\n /// @brief Creates a Program with an empty @link Shader@endlink vect...
C++
Ai.cpp
NicoSchumann/TicTacToe
df7349ebd82dfbc2561b4dc1b4627917d4067845
#include "Ai.hpp" #include <ctime> #include <climits> Ai::Ai(Mark aiPlayer) : m_aiPlayer(aiPlayer) , m_pointsAtLost(-1) , m_pointsAtWin(1) , m_pointsAtDraw(0) {} Ai::Ai() : Ai(Mark::empty) {} RandomAi::RandomAi(const Mark aiPlayer) : Ai::Ai(aiPlayer) , m_randomRounds(100) { std::srand(std::time(0)); } RandomAi:...
#include "Ai.hpp" #include <ctime> #include <climits> Ai::Ai(Mark aiPlayer) : m_aiPlayer(aiPlayer) , m_pointsAtLost(-1) , m_pointsAtWin(1) , m_pointsAtDraw(0) {} Ai::Ai() : Ai(Mark::empty) {} RandomAi::RandomAi(const Mark aiPlayer) : Ai::Ai(aiPlayer) , m_randomRounds(100) { std::srand(std::time(0)); } RandomAi:...
No = -1; int fieldVal; if(currPlayer == Mark::cross) { fieldVal = INT_MIN; } else if (currPlayer == Mark::ring) { fieldVal = INT_MAX; } Mark changedPlayer = (currPlayer == Mark::cross ? Mark::ring : Mark::cross); for (int i = 0; i < 9; ++i) { i...
ield; } MinimaxAi::MinimaxAi(const Mark aiPlayer) : Ai::Ai(aiPlayer) {} MinimaxAi::MinimaxAi() : MinimaxAi(Mark::empty) {} int MinimaxAi::getSuggestedField(const Board & board, const Mark currPlayer) { if (board.evaluate() != State::inProgress) { return -1; } int field
random
[ { "content": "class Board\n\n{\n\npublic:\n\n Board();\n\n Board(const Board &);\n\n\n\n /** Sets all fields of Board to Mark::empty */\n\n void reset();\n\n\n\n /** Sets a field of the Board class */\n\n void setMark( Mark mark, std::size_t field);\n\n\n\n /** Returns a Board's field value...
C++
hxalignmicrotubules/mtalign/matchingGreedy.cpp
zibamira/microtubulestitching
8322b71701e33fde0400715cd5b4e855779e4eda
#include <hxalignmicrotubules/mtalign/matchingGreedy.h> #include <mclib/internal/McComparators.h> #include <mclib/McDArray.h> #include <mclib/McMath.h> #include <mclib/McPlane.h> #include <mclib/internal/McSorter.h> #include <mclib/McVec3.h> #include <hxalignmicrotubules/mtalign/NullPointRepresentation.h> #include <h...
#include <hxalignmicrotubules/mtalign/matchingGreedy.h> #include <mclib/internal/McComparators.h> #include <mclib/McDArray.h> #include <mclib/McMath.h> #include <mclib/McPlane.h> #include <mclib/internal/McSorter.h> #include <mclib/McVec3.h> #include <hxalignmicrotubules/mtalign/NullPointRepresentation.h> #include <h...
} bool getNextMatchingPair(int& set1PointIx, int& set2PointIx, double& dist2) { if (currListIndex < sortedDist2List.size()) { int ix1, ix2; do { ix1 = pointCorrespondence[sortedDist2List[currListIndex]][0]; if (pointS...
if (pointDist2.size() > 0) { McIndexByValueComparator<double> comparator(&pointDist2[0]); sort(&(sortedDist2List[0]), sortedDist2List.size(), comparator); }
if_condition
[ { "content": "/// Approximate inference algorithm \"Tree Expectation Propagation\" [\\ref MiQ04]\n\nclass TreeEP : public JTree {\n\n private:\n\n /// Maximum difference encountered so far\n\n Real _maxdiff;\n\n /// Number of iterations needed\n\n size_t ...
C++
net/ias/mmc/nap/machineenumtask.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
#include "Precompiled.h" #include "MachineEnumTask.h" #include "MachineNode.h" CMachineEnumTask::CMachineEnumTask( CMachineNode * pMachineNode ) { TRACE_FUNCTION("CMachineEnumTask::CMachineEnumTask"); _ASSERTE( pMachineNode != NULL ); m_pMachineNode = pMachineNode; } C...
#include "Precompiled.h" #include "MachineEnumTask.h" #include "MachineNode.h" CMachineEnumTask::CMachineEnumTask( CMachineNode * pMachineNode ) { TRACE_FUNCTION("CMachineEnumTask::CMachineEnumTask"); _ASSERTE( pMachineNode != NULL ); m_pMachineNode = pMachineNode; } C...
STDMETHODIMP CMachineEnumTask::CopyState( CMachineEnumTask * pSourceMachineEnumTask ) { TRACE_FUNCTION("CMachineEnumTask::CopyState"); m_pMachineNode = pSourceMachineEnumTask->m_pMachineNode; m_index = pSourceMachineEnumTask->m_index; m_type = pSourceMachineEnumTask->m_type; return S_OK; } ...
STDMETHODIMP CMachineEnumTask::Next (ULONG celt, MMC_TASK *rgelt, ULONG *pceltFetched) { TRACE_FUNCTION("CMachineEnumTask::Next"); if ((rgelt == NULL) || (pceltFetched == NULL)) { return E_INVALIDARG; } _ASSERTE(!IsBadWritePtr (rgelt, celt*sizeof(MMC_TASK))); _ASSERTE(!IsBadWritePtr (pce...
function_block-full_function
[]
C++
Analysis/AnalysisOrg/IO/CaptureImageState.cpp
konradotto/TS
bf088bd8432b1e3f4b8c8c083650a30d9ef2ae2e
#include "CaptureImageState.h" #include "IonH5File.h" #include "IonH5Arma.h" #include "ImageTransformer.h" #include "Vecs.h" #include <malloc.h> CaptureImageState::CaptureImageState(std::string _h5File) { h5file = _h5File; } void CaptureImageState::CleanUpOldFile() { if (isFile (h5file.c_str())) remove(h5fi...
#include "CaptureImageState.h" #include "IonH5File.h" #include "IonH5Arma.h" #include "ImageTransformer.h" #include "Vecs.h" #include <malloc.h> CaptureImageState::CaptureImageState(std::string _h5File) { h5file = _h5File; } void CaptureImageState::CleanUpOldFile() { if (isFile (h5file.c_str())) remove(h5fi...
void CaptureImageState::LoadImageGainCorrection(int rows, int cols) { std::string h5_name = h5file + ":/imgGain/gain_corr"; std::vector<float> gain; printf("[CaptureImageState] Loading Image gain correction from %s\n",h5file.c_str()); H5File::ReadVector (h5_name, gain); if (ImageTransformer::gain_c...
assert ( !isnan(ImageTransformer::gain_correction[row*cols + col]) ); } } std::string h5_name = h5file + ":/imgGain/gain_corr"; assert(ImageTransformer::gain_correction != NULL); std::vector<float> gain(ImageTransformer::gain_correction, ImageTransformer::gain_correction + rows*cols); printf("[Captur...
function_block-function_prefix_line
[ { "content": " int row, col; //upper left corner Row and Column\n", "file_path": "Analysis/Region.h", "rank": 0, "score": 125457.39546282355 }, { "content": "__device__\n", "file_path": "Analysis/BkgModel/CUDA/CudaUtils.h", "rank": 1, "score": 119857.84740344397 }, { "co...
C++
modules/audio_processing/aec3/aec_state_unittest.cc
imxiangpeng/webrtc
8078c53c2f8ed487b1c6bbdf3d541f7a5884ed70
#include "webrtc/modules/audio_processing/aec3/aec_state.h" #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" #include "webrtc/test/gtest.h" namespace webrtc { TEST(AecState, NormalUsage) { ApmDataDumper data_dumper(42); AecState state; FftBuffer X_buffer(Aec3Optimization::kNone, 30, std::...
#include "webrtc/modules/audio_processing/aec3/aec_state.h" #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" #include "webrtc/test/gtest.h" namespace webrtc { TEST(AecState, NormalUsage) { ApmDataDumper data_dumper(42); AecState state; FftBuffer X_buffer(Aec3Optimization::kNone, 30, std::...
; EXPECT_TRUE(state.ActiveRender()); state.Update(converged_filter_frequency_response, rtc::Optional<size_t>(2), X_buffer, E2_main, E2_shadow, Y2, x, echo_path_variability, false); EXPECT_FALSE(state.EchoLeakageDetected()); state.Update(converged_filter_frequency_response, rtc...
state.Update(converged_filter_frequency_response, rtc::Optional<size_t>(2), X_buffer, E2_main, E2_shadow, Y2, x, echo_path_variability, false)
call_expression
[ { "content": "namespace webrtc {\n\n\n\n// This function sleeps for the specified number of milliseconds.\n\n// It may return early if the thread is woken by some other event,\n\n// such as the delivery of a signal on Unix.\n\nvoid SleepMs(int msecs);\n\n\n", "file_path": "system_wrappers/include/sleep.h", ...
C++
tests/src/memory_operations/interleavelo.cpp
mkeryell/MIPP
f562541b824d7d5a5cdbdecdf2bf357bc7b47f9e
#include <exception> #include <algorithm> #include <numeric> #include <random> #include <cmath> #include <mipp.h> #include <catch.hpp> template <typename T> void test_reg_interleavelo() { T inputs1[mipp::N<T>()], inputs2[mipp::N<T>()]; std::mt19937 g; std::iota (inputs1, inputs1 + mipp::N<T>(), (T)0); std::shuff...
#include <exception> #include <algorithm> #include <numeric> #include <random> #include <cmath> #include <mipp.h> #include <catch.hpp> template <typename T> void test_reg_interleavelo() { T inputs1[mipp::N<T>()], inputs2[mipp::N<T>()]; std::mt19937 g; std::iota (inputs1, inputs1 + mipp::N<T>(), (T)0); std::shuff...
#if defined(MIPP_AVX512) TEST_CASE("Interleave4 low - mipp::Reg", "[mipp::interleavelo4]") { #if defined(MIPP_64BIT) SECTION("datatype = double") { test_Reg_interleavelo4<double>(); } #endif SECTION("datatype = float") { test_Reg_interleavelo4<float>(); } #if defined(MIPP_64BIT) SECTION("datatype = int64_t") { te...
ipp::N<T>(), (T)0); std::shuffle(inputs1, inputs1 + mipp::N<T>(), g); std::iota (inputs2, inputs2 + mipp::N<T>(), (T)0); std::shuffle(inputs2, inputs2 + mipp::N<T>(), g); mipp::Reg<T> r1 = inputs1; mipp::Reg<T> r2 = inputs2; mipp::Reg<T> ri = mipp::interleavelo4(r1, r2); for (auto j = 0; j < 4; j++) ...
function_block-function_prefixed
[ { "content": "struct Converter<float> {\n\n static_assert(sizeof(float) == sizeof(int32_t), \"Important ULP matcher assumption violated\");\n\n Converter(float f) {\n\n std::memcpy(&i, &f, sizeof(f));\n\n }\n\n int32_t i;\n\n};\n\n\n\ntemplate <>\n", "file_path": "tests/lib/Catch2/include...
C++
MagicSquareAndPipes.cpp
Sigrec/School-Projects
54dec4b6d38eb9b0c020c02d2a7f57b14e52bce2
#include <iostream> #include <unistd.h> #include <sys/utsname.h> #include <math.h> #include <cstring> #include <sys/wait.h> #define SQUARE_SIZE 9 // The max number of characters that can be used for a sequence void DisplaySystemInfo(){ printf("System Info: \n"); char domainname[256]; char hostname...
#include <iostream> #include <unistd.h> #include <sys/utsname.h> #include <math.h> #include <cstring> #include <sys/wait.h> #define SQUARE_SIZE 9 // The max number of characters that can be used for a sequence void DisplaySystemInfo(){ printf("System Info: \n"); char domainname[256]; char hostname...
if (uname(&userdata) == 0){ printf("System Name: %s\n", userdata.sysname); printf("Node Name: %s\n", userdata.nodename); printf("Release: %s\n", userdata.release); printf("Version: %s\n", userdata.version); printf("Machine: %s\n", userdata.machine); printf("Domain ...
if (gethostname(hostname, 256) == 0){ printf("Host Name: %s\n", hostname); } else { perror("gethostname() error"); }
if_condition
[ { "content": "\tprivate final String cityName;\n", "file_path": "Dijkstra Airport Project/City.java", "rank": 0, "score": 20715.04630860246 }, { "content": "#include <iostream>\n\n#include <vector>\n\n#include \"Part3ThreadedModifier.h\"\n\n#include \"FileModifyException.h\"\n\n#include \"Fi...
C++
soundmaker.cpp
increpare/beatio
68fa8400f4d97d85f1df1b0ffe372c6d9b5dae69
#include "soundmaker.h" extern "C" { #include <sndfile.h> } #include <math.h> #include <iostream> #include <QFileInfo> using namespace std; #ifndef M_PI #define M_PI 3.14159265358979323846264338 #endif #define SAMPLE_RATE 44100 #define AMPLITUDE (0.5 * 0x7F000000) #define LEFT_FREQ (344.0 / SAMPLE_...
#include "soundmaker.h" extern "C" { #include <sndfile.h> } #include <math.h> #include <iostream> #include <QFileInfo> using namespace std; #ifndef M_PI #define M_PI 3.14159265358979323846264338 #endif #define SAMPLE_RATE 44100 #define AMPLITUDE (0.5 * 0x7F000000) #define LEFT_FREQ (344.0 / SAMPLE_...
int* SoundMaker::GenerateWave(QVector<Note> onsets, int& framecount) { if (onsets.size()==0) return false; int length = ceil(onsets.last().onset)+1; int frame_count = SAMPLE_RATE*length; framecount=frame_count; SF_INFO sfinfo ; int k ; int *buffer ; buffer = new int[2 *...
function_block-full_function
[ { "content": " {\n\n //int value=(int)(32767.0*sin(2.0*M_PI*((double)(i))*(double)(400)/SYSTEM_FREQ));\n\n int value = _buffer[i];\n\n //putShort(start, value&65535);\n\n putShort(start, (value/65536)&65535);\n\n start += 2;\n\n }\n\n\n\n std::cout<<\"DELETE BUFFER2\"...
C++
perf_test/blas/blas1/KokkosBlas_team_dot_perf_test.cpp
NexGenAnalytics/kokkos-kernels
8381db0486674c1be943de23974821ddfb9e6c29
#include <Kokkos_Core.hpp> #include <KokkosBlas1_team_dot.hpp> #include <Kokkos_Random.hpp> struct Params { int use_cuda = 0; int use_openmp = 0; int use_threads = 0; int m = 100000; int repeat = 1; }; void print_options() { std::cerr << "Options:\n" << std::endl; std::cerr << "\tBACKEND:...
#include <Kokkos_Core.hpp> #include <KokkosBlas1_team_dot.hpp> #include <Kokkos_Random.hpp> struct Params { int use_cuda = 0; int use_openmp = 0; int use_threads = 0; int m = 100000; int repeat = 1; }; void print_options() { std::cerr << "Options:\n" << std::endl; std::cerr << "\tBACKEND:...
eturn 1; #endif } if (useSerial) { #if defined(KOKKOS_ENABLE_SERIAL) run<Kokkos::Serial>(params.m, params.repeat); #else std::cout << "ERROR: Serial device requested, but not available; here, " "implementation of dot is explicitly parallel.\n"; return 1; #endif } Kokkos::finalize();...
:cerr << "\t[Optional] --repeat :: how many times to repeat overall " "dot (symbolic + repeated numeric)" << std::endl; } int parse_inputs(Params& params, int argc, char** argv) { for (int i = 1; i < argc; ++i) { if (0 == strcasecmp(argv[i], "--help") || 0 == strcasecmp(argv[i], "-h"))...
random
[ { "content": "struct MultiGemm<int,int,int,Kokkos::Cuda,Kokkos::LayoutRight,Kokkos::LayoutRight,Kokkos::LayoutRight,int,2>{\n\n static void GEMM(const char transA, const char transB, int alpha,\n\n Kokkos::View<int**,Kokkos::LayoutRight,Kokkos::Cuda> A, Kokkos::View<int**,Kokkos::LayoutRight,Kok...
C++
tools/clang/lib/Analysis/CallGraph.cpp
nettrino/IntFlow
0400aef5da2c154268d8b020e393c950435395b3
#include "clang/Analysis/CallGraph.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/AST/StmtVisitor.h" #include "llvm/Support/GraphWriter.h" using namespace clang; namespace { class CGBuilder : public StmtVisitor<CGBuilder> { CallGraph *G; CallGraphNode *CallerNode; public: ...
#include "clang/Analysis/CallGraph.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/AST/StmtVisitor.h" #include "llvm/Support/GraphWriter.h" using namespace clang; namespace { class CGBuilder : public StmtVisitor<CGBuilder> { CallGraph *G; CallGraphNode *CallerNode; public: ...
}; }
static std::string getNodeLabel(const CallGraphNode *Node, const CallGraph *CG) { if (CG->getRoot() == Node) { return "< root >"; } return Node->getName(); }
function_block-function_prefix_line
[]
C++
source/code/iceshard/iceshard/private/world/iceshard_world.cxx
iceshard-engine/engine
4f2092af8d2d389ea72addc729d0c2c8d944c95c
#include "iceshard_world.hxx" #include <ice/world/world_trait.hxx> #include <ice/engine_runner.hxx> #include <ice/engine_frame.hxx> #include <ice/engine_shards.hxx> #include <ice/pod/hash.hxx> #include <ice/assert.hxx> #include "iceshard_world_portal.hxx" namespace ice { IceshardWorld::IceshardWorld...
#include "iceshard_world.hxx" #include <ice/world/world_trait.hxx> #include <ice/engine_runner.hxx> #include <ice/engine_frame.hxx> #include <ice/engine_shards.hxx> #include <ice/pod/hash.hxx> #include <ice/assert.hxx> #include "iceshard_world_portal.hxx" namespace ice { IceshardWorld::IceshardWorld...
; } } auto IceshardWorld::traits() noexcept -> ice::pod::Array<ice::WorldTrait*>& { return _traits; } }
entry.value->trait()->on_update( runner.current_frame(), runner, *entry.value )
call_expression
[ { "content": "inline void* b2Alloc(void* alloc, ice::i32 size)\n\n{\n\n return reinterpret_cast<ice::Allocator*>(alloc)->allocate(static_cast<ice::u32>(size));\n", "file_path": "source/code/framework/framework_base/private/traits/physics/b2_user_settings.h", "rank": 0, "score": 39755.43515219723 ...
C++
Src/main.cpp
KuhakuPixel/TempestPixyEngine
929d2952e2b4a83a85287c3030accade5ae449e2
#include <string.h> #include <iostream> #include <string> #include "board.h" #include "CharHelper.h" #include "math.h" #include "chessLib.h" #include "evaluation.h" #include "search.h" #include "stringHelper.h" void StartEngineUci() { std::string startFenPosition = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ...
#include <string.h> #include <iostream> #include <string> #include "board.h" #include "CharHelper.h" #include "math.h" #include "chessLib.h" #include "evaluation.h" #include "search.h" #include "stringHelper.h" void StartEngineUci() { std::string startFenPosition = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ...
int main(int argc, char *argv[]) { printf("Tempest Pixy engine\n"); while (true) { std::string command = ""; std::cin >> command; if (command == "uci") { printf("id name Tempest-Pixy-Engine 1.0.0\n"); printf("id author Kuhaku Pixel\n"); p...
1); evaluation.InitializeKnightPeriphery1(-0.18); evaluation.InitializeKnightPeriphery2(+0.54); evaluation.InitializeKnightPeriphery3(+0.1); while (true) { std::string colorToMove = board.GetCurrentTurnStr(); std::string bestMove = ""; printf("Side to move %s \n", colorToMove...
function_block-function_prefixed
[ { "content": "#pragma once\n\n#include <string>\n\n#include <map>\n\n#include \"CharHelper.h\"\n\n#include <vector>\n\n#include \"chessLib.h\"\n\n#include \"square.h\"\n\nclass Board\n\n{\n\nprivate:\n\n std::vector<MoveFlag> blackCastlingRights = {MoveFlag::shortCastle, MoveFlag::longCastle};\n\n std::ve...
C++
RedeNeural.cpp
AndreSFND/evolutive-agario
cb974d89d413e5db56fda06d6eb18a43aecf1658
#include <iostream> #include <vector> #include <list> #include <cstdlib> #include <math.h> #include <time.h> #include <stdlib.h> #include <stdio.h> #include "RedeNeural.h" using namespace std; RedeNeural::RedeNeural(double _input[], double _biasNeuron, double _biasOutput) { for(int i = 0; i < N_INPUTS; i++) { ...
#include <iostream> #include <vector> #include <list> #include <cstdlib> #include <math.h> #include <time.h> #include <stdlib.h> #include <stdio.h> #include "RedeNeural.h" using namespace std; RedeNeural::RedeNeural(double _input[], double _biasNeuron, double _biasOutput) { for(int i = 0; i < N_INPUTS; i++) { ...
void RedeNeural::setAxonsOut(double _axonsOut[][N_OUTPUTS]) { for(int i = 0; i < N_NEURONS; i++) { for(int j = 0; j < N_OUTPUTS; j++) { axons.axonsOut[i][j] = _axonsOut[i][j]; } } } void RedeNeural::setNeuron(double _neuron[]) { for(int i = 0; i < N_NEURONS; i++) { neuron[i] = _neuron[i]; } } void Red...
void RedeNeural::setAxonsIn(double _axonsIn[][N_NEURONS]) { for(int i = 0; i < N_INPUTS; i++) { for(int j = 0; j < N_NEURONS; j++) { axons.axonsIn[i][j] = _axonsIn[i][j]; } } }
function_block-full_function
[ { "content": "// Leonardo Antonetti da Motta - ICMC USP 11275338\n\n\n\n#include <iostream> \n\n#include <vector>\n\n#include <list>\n\n#include <cstdlib>\n\n#include <math.h>\n\n#include <time.h>\n\n#include <stdlib.h>\n\n#include <stdio.h>\n\n\n\nusing namespace std;\n\n\n\n#define MIN_AXON -1\n\n#define MAX_...
C++
network/gameserver/proto.hpp
hbccdf/network-core
37cbf03829bffd9c0903a1e755ce1f96f46e3dfa
#pragma once #include "network/net/tcp_connect.hpp" #include "msg_pack.hpp" namespace cytx { namespace gameserver { namespace detail { using namespace cytx; using namespace cytx::gameserver; class Proto; class game_server; using game_...
#pragma once #include "network/net/tcp_connect.hpp" #include "msg_pack.hpp" namespace cytx { namespace gameserver { namespace detail { using namespace cytx; using namespace cytx::gameserver; class Proto; class game_server; using game_...
protected: Proto(uint32_t id) : protocol_id_(id) , has_ctx_process_(false) {} uint32_t protocol_id_; bool has_ctx_process_; }; template<typename T> auto make_proto_p...
static void RegisterProto(proto_ptr_t proto) { uint32_t proto_id = proto->get_protocol_id(); if (!GetProto(proto_id)) { auto& proto_map = GetMap(); proto_map.emplace(proto_id, proto); ...
function_block-full_function
[ { "content": "class UseSkill : public virtual ::apache::thrift::TBase {\n\n public:\n\n\n\n UseSkill(const UseSkill&);\n\n UseSkill& operator=(const UseSkill&);\n\n UseSkill() : skillId(0) {\n\n }\n\n\n\n virtual ~UseSkill() throw();\n\n int32_t skillId;\n\n std::vector<int32_t> targetIds;\n\n\n\n _Use...
C++
ModuleObstacle.cpp
BravoXavi/Space-Harrier-MVJ-
cfc3d6f392b926faa0b88a2acb8c89db24a626d7
#include <math.h> #include "ModuleObstacle.h" #include "Application.h" #include "ModuleAudio.h" #include "ModuleTextures.h" #include "ModuleRender.h" #include "ModuleCollision.h" #include "ModuleParticles.h" #include "ModuleShadows.h" #include "ModulePlayer.h" #include "SDL/include/SDL_timer.h" ModuleObstacle::ModuleO...
#include <math.h> #include "ModuleObstacle.h" #include "Application.h" #include "ModuleAudio.h" #include "ModuleTextures.h" #include "ModuleRender.h" #include "ModuleCollision.h" #include "ModuleParticles.h" #include "ModuleShadows.h" #include "ModulePlayer.h" #include "SDL/include/SDL_timer.h" ModuleObstacle::ModuleO...
oat)anim.GetCurrentFrame().w * scaleValue; float newHeight = (float)anim.GetCurrentFrame().h * scaleValue; if (newHeight < 2.0f) newHeight = 2.0f; if (newWidth < 1.0f) newWidth = 1.0f; worldPosition.z = ((float)SCREEN_HEIGHT - tempY) / (App->renderer->horizonY / (float)MAX_Z); xOffset -= App->render...
or it = active.begin(); it != active.end(); ++it) RELEASE(*it); active.clear(); return true; } update_status ModuleObstacle::PreUpdate() { for (list<Obstacle*>::iterator it = active.begin(); it != active.end();) { if ((*it)->to_delete == true) { RELEASE(*it); it = active.erase(it); } else ++it...
random
[ { "content": "struct Obstacle\n\n{\n\n\tObstacle();\n\n\tObstacle(const Obstacle& p);\n\n\t~Obstacle();\n\n\n\n\tvoid Update();\n\n\n\n\tconst float calculateScaleValue(float yRender) const;\n\n\tvoid setRect(SDL_Texture* texture, const float& x, const float& y, const float& z, const float& newWidth, const floa...
C++
Sources/Modules/Core/Logger.cpp
benkaraban/anima-games-engine
8aa7a5368933f1b82c90f24814f1447119346c3b
#include <Core/Logger.h> #include <Core/IO/FileStream.h> #include <Core/System/Files.h> namespace Core { using namespace Core::System; LoggerMessage::LoggerMessage() : _msg(new Core::BufferStream()) { } LoggerMessage::~LoggerMessage() { } String LoggerMessage::getLastLine() { String8 str...
#include <Core/Logger.h> #include <Core/IO/FileStream.h> #include <Core/System/Files.h> namespace Core { using namespace Core::System; LoggerMessage::LoggerMessage() : _msg(new Core::BufferStream()) { } LoggerMessage::~LoggerMessage() { } String LoggerMessage::getLastLine() { String8 str...
if (_showTagMsgLevel) { switch(_msgLevel) { case L_ERROR: str += L"ERR"; break; case L_WARNING: str += L"WAR"; break; case L_INFO: str += L"INF"; break; ...
if (_showTagThreadId) { str += Core::toStringHex(Thread::getCurrentThreadID(), 4); str += LOGGER_TAG_SEPARATOR; }
if_condition
[]
C++
problem/Tree/Shortest distance between two nodes.cpp
mechusatveer/coding-questions
a86b41f753ffd70001357ab059ee0cb63c7914ff
#include<iostream> #include<list> using namespace std; struct Node { int val; Node *plft; Node *prgt; Node(int v) : val(v), plft(NULL), prgt(NULL) {} }; bool GetNodePath(Node *root, Node *node, list<Node*>& path) { if (root == node) return true; path.push_back(root); bool found = fals...
#include<iostream> #include<list> using namespace std; struct Node { int val; Node *plft; Node *prgt; Node(int v) : val(v), plft(NULL), prgt(NULL) {} }; bool GetNodePath(Node *root, Node *node, list<Node*>& path) { if (root == node) return true; path.push_back(root); bool found = fals...
} int main() { Node *root = new Node(1); root->plft = new Node(2); root->prgt = new Node(3); root->plft->plft = new Node(4); root->plft->prgt = new Node(5); root->prgt->plft = new Node(6); root->prgt->prgt = new Node(7); root->prgt->prgt->plft = new Node(8); root->prgt->prgt->prgt...
if (lca) { bool found = false; int dist1 = Height(lca, node1, found); cout<<"Distance of "<<node1->val<<": "<<dist1<<endl; found = false; int dist2 = Height(lca,node2,found); cout<<"Distance of "<<node2->val<<": "<<dist2<<endl; return dist1 + dist2; } else { ...
if_condition
[ { "content": "struct Node {\n\n int val;\n\n Node* plft;\n\n Node* prgt;\n\n\n\n\tNode(int v) : val(v), plft(NULL), prgt(NULL) {}\n\n};\n\n\n\n\n\n//need finish this version\n\n\n\nint main() {\n\n\n\n\t/*\n\n\tNode *root = new Node(1);\n\n\troot->plft = new Node(2);\n\n\troot->prgt = new Node(3);\n\n\...
C++
mindspore/ccsrc/runtime/device/memory_offload_strategy.cc
zhz44/mindspore
6044d34074c8505dd4b02c0a05419cbc32a43f86
#include "runtime/device/memory_offload_strategy.h" #include <vector> #include <map> #include <memory> #include <utility> #include "utils/log_adapter.h" namespace mindspore { namespace device { constexpr size_t kFirstGetMemEventIndex = 1; constexpr size_t kInitOrMallocMemEventIndex = 0; std::vector<std::shared_ptr<M...
#include "runtime/device/memory_offload_strategy.h" #include <vector> #include <map> #include <memory> #include <utility> #include "utils/log_adapter.h" namespace mindspore { namespace device { constexpr size_t kFirstGetMemEventIndex = 1; constexpr size_t kInitOrMallocMemEventIndex = 0; std::vector<std::shared_ptr<M...
rt(min_swap_index_before_update); } return swap_out_event_index; } } }
) { (void)swap_events_.emplace(event); } } return; } std::vector<size_t> cur_mem_used(min_mem_used_.begin(), min_mem_used_.end()); for (const auto &iter : event_span_) { auto span = iter.second.second; auto &event = iter.second.first; auto start_index = ((event->index + total...
random
[]
C++
example-ofxDownloadCentral/src/ofApp.cpp
hushstudios/ofxSimpleHttp
5dd8f761381a5abb05913d0a7c50f5611a7aebcf
#include "ofApp.h" void ofApp::setup(){ ofSetFrameRate(60); ofBackground(22); ofSetWindowPosition(20, 20); downloader.setNeedsChecksumMatchToSkipDownload(true); downloader.setIdleTimeAfterEachDownload(0.2); downloader.setVerbose(false); downloader.setMaxConcurrentDownloads(3); } void ofApp::downloadFinis...
#include "ofApp.h" void ofApp::setup(){ ofSetFrameRate(60); ofBackground(22); ofSetWindowPosition(20, 20); downloader.setNeedsChecksumMatchToSkipDownload(true); downloader.setIdleTimeAfterEachDownload(0.2); downloader.setVerbose(false); downloader.setMaxConcurrentDownloads(3); } void ofApp::downloadFinis...
allURLS, allSha1s, this, &ofApp::downloadFinished, "downloads_" ); downloader.startDownloading(); }else if(key == '3'){ for(int i = 0; i < allURLS.size(); i++){ downloader.downloadResources(allURLS[i], this, ...
ort.responses.size()){ if (report.responses[i].ok){ } i++; } } void ofApp::update(){ downloader.update(); } void ofApp::draw(){ ofSetColor(255); drawClock(); downloader.draw(30,30, true, false); string msg = "press 1 to download a file and supply a correct SHA1\n"; msg += "press 2 to download a f...
random
[ { "content": "struct ofxBatchDownloaderReport{\n\n\tstd::string downloadPath;\t\t\t\t\t\t//full path to the directory that holds the downloads\n\n\tofxBatchDownloader* owner;\t\t\t\t\t//pointer to the object in charge of the downloads\n\n\tstd::vector<std::string> attemptedDownloads;\t\t\t//this vector contains...
C++
lizy1.kurisu/include/lizy1/impl/kurisu/BuiltInCase.hpp
li-zhong-yuan/lizy1.kurisu
dba9136bfc966e2e81bee2b469ae4cc3a8157ca4
namespace lizy1::kurisu::impl_K { template<class T> constexpr std::uint64_t fundamental_digest() { if constexpr(std::same_as<T, std::nullptr_t>) return 0x0000000000000000; if constexpr(_in<T, _P<signed char, unsigned char>>::value) return 0x3CFE619CFCD8...
namespace lizy1::kurisu::impl_K { template<class T> constexpr std::uint64_t fundamental_digest() { if constexpr(std::same_as<T, std::nullptr_t>) return 0x0000000000000000; if constexpr(_in<T, _P<signed char, unsigned char>>::value) return 0x3CFE619CFCD8...
constexpr std::uint64_t size = sizeof(T) / sizeof(U); return combine_digests({ feature_code, element_digest, size }); } template<class Os> requires Dumpable<const U, Os> static void __dump__(Os &os, T const& t) { for(auto &x : t) dump(os, x); } template<class Os> requires Dumpable<U...
); } template<OStream Os> static void __dump__(Os &os, T const& t) { dump_machine_bytes(os, t); } template<IStream Is> static void __load__(Is &is, T & t) { load_machine_bytes(is, t); } }; template<lizy1::kurisu::Enumeration T> struct lizy1::kurisu::impl_K::BuiltInCase<T> { using U = std::underlying_...
random
[]
C++
ttk/core/vtk/ttkFiberSurface/ttkFiberSurface.cpp
julesvidal/wasserstein-pd-barycenter
1f62a5e1c40700030357b2bfb9a2f86fe4736861
#include <ttkFiberSurface.h> using namespace std; using namespace ttk; vtkStandardNewMacro(ttkFiberSurface) ttkFiberSurface::ttkFiberSurface(){ UseAllCores = true; RangeCoordinates = true; EdgeParameterization = true; EdgeIds = true; TetIds = true; CaseIds = true; PointMerge = false; ...
#include <ttkFiberSurface.h> using namespace std; using namespace ttk; vtkStandardNewMacro(ttkFiberSurface) ttkFiberSurface::ttkFiberSurface(){ UseAllCores = true; RangeCoordinates = true; EdgeParameterization = true; EdgeIds = true; TetIds = true; CaseIds =
ttkFiberSurface::~ttkFiberSurface(){ } int ttkFiberSurface::doIt(vector<vtkDataSet *> &inputs, vector<vtkDataSet *> &outputs){ Memory m; Timer t; vtkDataSet *input = inputs[0]; vtkUnstructuredGrid *polygon = vtkUnstructuredGrid::SafeDownCast(inputs[1]); vtkPolyData *output = vtkPolyData::SafeDownCas...
true; PointMerge = false; RangeOctree = true; PointMergeDistanceThreshold = 0.000001; SetNumberOfInputPorts(2); }
function_block-function_prefixed
[ { "content": " class AtomicVector : public std::vector<type>\n\n {\n\n private:\n\n std::size_t nextId;\n\n // for initialization\n\n const type defaultValue;\n\n\n\n public:\n\n AtomicVector(const std::size_t initSize = 1, const type &dv = type{})\n\n : std::vector<type...
C++
src/GrainViewer/Ui/Gui.cpp
eliemichel/GrainViewer
91d4922b3185ada90508f0944f2691ba8eba45e3
#include <OpenGL> #include "Logger.h" #include "Gui.h" #include "Window.h" #include "Scene.h" #include "Dialog.h" #include "RuntimeObject.h" #include "ShaderPool.h" #include "GlobalTimer.h" #include "Ui/SceneDialog.h" #include "Ui/DeferredShadingDialog.h" #include "Ui/WorldDialog.h" #include "Ui/GlobalTimerDialog.h"...
#include <OpenGL> #include "Logger.h" #include "Gui.h" #include "Window.h" #include "Scene.h" #include "Dialog.h" #include "RuntimeObject.h" #include "ShaderPool.h" #include "GlobalTimer.h" #include "Ui/SceneDialog.h" #include "Ui/DeferredShadingDialog.h" #include "Ui/WorldDialog.h" #include "Ui/GlobalTimerDialog.h"...
void Gui::update() { updateImGui(); if (m_scene) { m_scene->update(static_cast<float>(glfwGetTime()) - m_startTime); if (auto window = m_window.lock()) { if (m_scene->mustQuit()) { glfwSetWindowShouldClose(window->glfw(), GL_TRUE); } } } } void Gui::updateImGui() { NewFrame(); ImVec4 clear_color...
g>("Timers", GlobalTimer::GetInstance()); addDialogGroup<SceneDialog>("Scene:", m_scene); for (const auto& obj : m_scene->objects()) { DialogGroup group; group.title = " - " + obj->name; IBehaviorHolder::ConstBehaviorIterator it, end; for (it = obj->cbeginBehaviors(), end = obj->cendBehaviors(); it != ...
function_block-function_prefixed
[ { "content": "class DeferredShadingDialog : public Dialog {\n\npublic:\n\n\tvoid draw() override;\n\n\tvoid drawHandles(float x, float y, float w, float h) override;\n\n\tvoid setController(std::weak_ptr<GlDeferredShader> shading) { m_cont = shading; }\n\n\n\nprivate:\n\n\tstd::weak_ptr<GlDeferredShader> m_cont...
C++
main/main.cpp
jmautari/playsound
5885c693d486c5a417a9ec1a96465d83f5492b1c
#include "shared/platform.h" #include <mmdeviceapi.h> #include <Endpointvolume.h> #include <audioclient.h> #include <atlbase.h> #include <Mmsystem.h> #include <string> #include <iostream> #include <filesystem> constexpr wchar_t kEventName[] = L"PlaySoundEvent"; constexpr wchar_t kOptRepeat[] = L"-r"; constexpr wchar_t...
#include "shared/platform.h" #include <mmdeviceapi.h> #include <Endpointvolume.h> #include <audioclient.h> #include <atlbase.h> #include <Mmsystem.h> #include <string> #include <iostream> #include <filesystem> constexpr wchar_t kEventName[] = L"PlaySoundEvent"; constexpr wchar_t kOptRepeat[] = L"-r"; constexpr wchar_t...
rue, muted); if (!reset_mic) { std::cout << "Couldn't get current mic volume. Not muting mic" << std::endl; } } } else if (time > 0) { flags |= SND_ASYNC; } PlaySoundW(filename.native().c_str(), nullptr, flags); if (event_handle != nullptr) { WaitForSingle...
s = false; do { if (!PickDevice(&endPoint)) { break; } hr = endPoint->Activate(__uuidof(IAudioClient), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&audioClient)); if (FAILED(hr)) { break; } hr = endPoint->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERV...
random
[ { "content": "# Playsound\n\n\n\nSimple utility program to play a wav file.\n\n\n\nPrimarily used by [Widgets][1]\n\n\n\n## Usage\n\n\n\n```\n\nplaysound [options] [path-to-file]\n\n```\n\n\n\nWhere `options` can be:\n\n\n\n`-r` repeat the sound until `playsound` is called again with `-s` option\n\n\n\n`-m` sam...
C++
CODE_S1_Wed_Friday/CODE_S1_Wed_Friday/theMainFunction.cpp
Freethetan/INFO3111-S21
b0526d641c5e744c38e6a48d1b66a47f0d8dd592
#include "globalStuff.h" #include <glm/glm.hpp> #include <glm/vec3.hpp> #include <glm/vec4.hpp> #include <glm/mat4x4.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> #include <stdlib.h> #include <stdio.h> #include <string> #include <iostream> #include <vector> #include <sstream> #in...
#include "globalStuff.h" #include <glm/glm.hpp> #include <glm/vec3.hpp> #include <glm/vec4.hpp> #include <glm/mat4x4.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> #include <stdlib.h> #include <stdio.h> #include <string> #include <iostream> #include <vector> #include <sstream> #in...
eX = glm::rotate(glm::mat4(1.0f), curMesh.orientation.x, glm::vec3(1.0f, 0.0, 0.0f)); float uniformScale = curMesh.scale; matScale = glm::scale(glm::mat4(1.0f), glm::vec3(uniformScale, uniformScale, uniformScale)); matTranslate = glm::tra...
break; } glfwSetWindowTitle(window, ssTitle.str().c_str()); glfwSwapBuffers(window); glfwPollEvents(); doKeyboardMouseStuffAsync(window); } delete pShaderManager; delete pVAOMan; glfwDestroyWindow(window); glfwTerminate(...
random
[]
C++
tools/trainers/retargetTrainer/src/RetargetArguments.cpp
kernhanda/ELL
370c0de4e4c190ca0cb43654b4246b3686bca464
#include "RetargetArguments.h" namespace ell { void ParsedRetargetArguments::AddArgs(utilities::CommandLineParser& parser) { using namespace common; parser.AddOption(inputModelFilename, "inputModelFilename", "imf", "Name of the pre-trained ELL model file (...
#include "RetargetArguments.h" namespace ell { void ParsedRetargetArguments::AddArgs(utilities::CommandLineParser& parser) { using namespace common; parser.AddOption(inputModelFilename, "inputModelFilename", "imf", "Name of the pre-trained ELL model file (...
}
recision", "de", "The desired duality gap at which to stop optimizing", 1.0e-5); parser.AddOption(maxEpochs, "maxEpochs", "me", "The maximum number of optimization epochs to run", 1000); parser.AddOption(permute, ...
function_block-function_prefixed
[ { "content": "class NeuralNetworkPredictorNode : public model::Node\n\n{\n\npublic:\n\n /// @name Input and Output Ports\n\n /// @{\n\n const model::InputPort<ValueType>& input = _input;\n\n const model::OutputPort<ValueType>& output = _output;\n\n /// @}\n\n\n\n using PredictorType = typename...
C++
src/Titon/Io/Node.hh
ciklon-z/framework
cbf44729173d3a83b91a2b0a217c6b3827512e44
<?hh namespace Titon\Io; use Titon\Io\Exception\MissingFileException; use Titon\Io\Exception\ExistingFileException; use Titon\Utility\Path; abstract class Node { const int OVERWRITE = 0; const int MERGE = 1; const int SKIP = 2; protected ?Folder $parent; protected string $path = '';...
<?hh namespace Titon\Io; use Titon\Io\Exception\MissingFileException; use Titon\Io\Exception\ExistingFileException; use Titon\Utility\Path; abstract class Node { const int OVERWRITE = 0; const int MERGE = 1; const int SKIP = 2; protected ?Folder $parent; protected string $path = '';...
public function modifyTime(): int { if ($this->exists()) { return filemtime($this->path()); } return 0; } public function move(string $target, bool $overwrite = true): bool { if (!$this->exists()) { return false; } i...
->path(), $mode); } public function chown(int $user, bool $recursive = false): bool { if (!$this->exists()) { return false; } $path = $this->path(); $this->reset(); if (is_link($path)) { return lchown($path, $user); } retu...
random
[ { "content": " public function copy(string $target, int $process = self::MERGE, int $mode = 0755): ?Node {\n\n if (!$this->exists()) {\n\n return null;\n\n }\n\n\n\n // Delete the target folder if overwrite is true\n\n if ($process === self::OVERWRITE && file_exists($ta...
C++
net/instaweb/rewriter/webp_optimizer.cc
dimitrilongo/mod_pagespeed
d0d3bc51aa4feddf010b7085872c64cc46b5aae0
#include "net/instaweb/rewriter/public/webp_optimizer.h" #include <csetjmp> #include <cstddef> #include "base/logging.h" #include "pagespeed/kernel/base/basictypes.h" #include "pagespeed/kernel/base/string.h" #include "pagespeed/kernel/image/jpeg_reader.h" #include "pagespeed/kernel/image/jpeg_utils.h" extern "C" ...
#include "net/instaweb/rewriter/public/webp_optimizer.h" #include <csetjmp> #include <cstddef> #include "base/logging.h" #include "pagespeed/kernel/base/basictypes.h" #include "pagespeed/kernel/base/string.h" #include "pagespeed/kernel/image/jpeg_reader.h" #include "pagespeed/kernel/image/jpeg_utils.h" extern "C" ...
class WebpOptimizer { public: explicit WebpOptimizer(MessageHandler* handler); ~WebpOptimizer(); bool CreateOptimizedWebp(const GoogleString& original_jpeg, int configured_quality, WebpProgressHook progress_hook, void* prog...
int GoogleStringWebpWriter(const uint8_t* data, size_t data_size, const WebPPicture* const picture) { GoogleString* compressed_webp = static_cast<GoogleString*>(picture->custom_ptr); compressed_webp->append(reinterpret_cast<const char*>(data), data_size); return 1; }
function_block-full_function
[ { "content": "// Bool that is auto-initialized to false\n\nclass Bool {\n\n public:\n\n Bool() : value_(false) {}\n\n Bool(bool value) : value_(value) {} // Copy constructor // NOLINT\n\n const bool Test() const { return value_; }\n\n\n\n private:\n\n bool value_;\n\n};\n\n\n", "file_path": "pagespeed/...
C++
lite/tnn/cv/tnn_rvm.cpp
azuredsky/lite.ai
2751a7f0cf0970c1ab94b865b96c2f53ee28d545
#include "tnn_rvm.h" using tnncv::TNNRobustVideoMatting; TNNRobustVideoMatting::TNNRobustVideoMatting( const std::string &_proto_path, const std::string &_model_path, unsigned int _num_threads ) : proto_path(_proto_path.data()), model_path(_model_path.data()), log_id(_proto_path.data()), num...
#include "tnn_rvm.h" using tnncv::TNNRobustVideoMatting; TNNRobustVideoMatting::TNNRobustVideoMatting( const std::string &_proto_path, const std::string &_model_path, unsigned int _num_threads ) : proto_path(_proto_path.data()), model_path(_model_path.data()), log_id(_proto_path.data()), num...
int TNNRobustVideoMatting::value_size_of(tnn::DimsVector &shape) { if (shape.empty()) return 0; int _size = 1; for (auto &s: shape) _size *= s; return _size; } void TNNRobustVideoMatting::print_debug_string() { std::cout << "LITETNN_DEBUG LogId: " << log_id << "\n"; std::cout << "=============== Input-Di...
else { #ifdef LITETNN_DEBUG std::cout << "src input only support NCHW and NHWC " "input_data_format, but found others.\n"; #endif return; } src_size = 1 * 3 * input_height * input_width; for (auto &name: output_names) output_shapes[name] = BasicTNNHandler::get_output_shape(instan...
function_block-function_prefixed
[ { "content": "enum Dimensionformat { NHWC, NC4HW4, NCHW };\n", "file_path": "MNN/expr/Expr.hpp", "rank": 0, "score": 159329.26997513027 }, { "content": "function should be prototyped as void Foo(int,void\\*); , where the first parameter is the trackbar\n\nposition and the second parameter is...
C++
stlio.hpp
legokangpalla/FileSTL
675b2cc1364e8d70be43ec09423dbc45b7b574b0
#pragma once #include <vector> #include <type_traits> #include <utility> #include <fstream> #include <boost/config/warning_disable.hpp> #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_operator.hpp> #include <boost/spirit/include/phoenix_...
#pragma once #include <vector> #include <type_traits> #include <utility> #include <fstream> #include <boost/config/warning_disable.hpp> #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_operator.hpp> #include <boost/spirit/include/phoenix_...
const size_t num_triangles{ s.normals.size() }; s.attributes.resize(num_triangles); out.write(reinterpret_cast<const char*>(&num_triangles), 4); out << num_triangles; for (size_t i = 0; i < num_triangles; ++i) { d...
inline std::pair< solid, bool > read(IterT begin, IterT end) { return read<float>(begin, end); } template<typename T> inline bool read(basic_solid<T>& out, const std::string& fileName) { std::ifstream f(fileName, std::ios::binary); ...
random
[ { "content": "#define BOOST_TEST_MODULE STL_IO\n\n\n\n#include <boost/test/included/unit_test.hpp>\n\n#include <boost/mpl/list.hpp>\n\n\n\n#include <sstream>\n\n\n\n#include \"../stlio.hpp\"\n\n\n\nusing test_types = boost::mpl::list<float, double>;\n\n\n\nusing namespace tyti;\n\n\n\nBOOST_AUTO_TEST_CASE_TEMPL...
C++
mxflib/vbi.cpp
Jamaika1/mxflib
7eefe6da1f76f7de4f2de48322311533369f8ba5
#include <mxflib/mxflib.h> using namespace mxflib; int ANCVBISource::Field2Offset(void) { if(F2Offset >= 0) return F2Offset; MDObjectPtr Descriptor = MasterSource->GetDescriptor(); if(!Descriptor) { error("EssenceDescriptor not defined for master source of ANCVBISource before calling Field2Offset()\n"); F2...
#include <mxflib/mxflib.h> using namespace mxflib; int ANCVBISource::Field2Offset(void) { if(F2Offset >= 0) return F2Offset; MDObjectPtr Descriptor = MasterSource->GetDescriptor(); if(!Descriptor) { error("EssenceDescriptor not defined for master source of ANCVBISource before calling Field2Offset()\n"); F2...
); LS_it++; } if(Lines.empty()) { DataChunkPtr Ret = new DataChunk(2); PutU16(0, Ret->Data); return Ret; } VBILineMap::iterator it = Lines.begin(); size_t BufferSize = ((*it).second->GetFullDataSize() * Lines.size()) + 2; DataChunkPtr Ret = new DataChunk(BufferSize); UInt8 *pBuf...
ANCLineMap::value_type( LineNumber, new ANCLine(LineNumber, (*LS_it)->GetWrappingType(), (*LS_it)->GetSampleCoding(), (*LS_it)->GetLineData(), (*LS_it)->GetDID(), (*LS_it)->GetSDID()))
call_expression
[ { "content": "namespace mxflib {}\n", "file_path": "mxflib/mxflib.h", "rank": 0, "score": 89973.22926212748 }, { "content": "namespace mxflib\n\n{\n\n\n\n\t//! Load classes and types from a Metadictionary object\n\n\t/*! At the point where this function is called, you need to have all the co...
C++
include/ftk/mesh/lattice_partitioner.hh
hguo/FTT
f1d5387d6353cf2bd165c51fc717eb5d6b2675ef
#ifndef _FTK_LATTICE_PARTITIONER_HH #define _FTK_LATTICE_PARTITIONER_HH #include <ftk/mesh/lattice.hh> namespace ftk { struct lattice_partitioner { lattice_partitioner(const lattice& l_) : l(l_) {} friend std::ostream& operator<<(std::ostream& os, const lattice_partitioner&); size_t nd() const {return l.nd...
#ifndef _FTK_LATTICE_PARTITIONER_HH #define _FTK_LATTICE_PARTITIONER_HH #include <ftk/mesh/lattice.hh> namespace ftk { struct lattice_partitioner { lattice_partitioner(const lattice& l_) : l(l_) {} friend std::ostream& operator<<(std::ostream& os, const lattice_partitioner&); size_t nd() const {return l.nd...
(curr + 1) % ndim; } } partition(prime_factors_dims); if (cores.size() == 0) return; for(const auto& core : cores) { #if 0 auto starts = core.starts(), sizes = core.sizes(); for(int d = 0; d < ndim; ++d) { { size_t offset = starts[d] - l.start(d); if...
return factors; } inline bool is_vector_zero(const std::vector<size_t> vec) { if(vec.size() == 0 || (vec.size() == 1 && vec[0] == 0)) { return true; } return false; } inline void lattice_partitioner::partition(size_t np) { std::vector<size_t> vector_zero(0, nd()); partition(np, vector_zero, vector...
random
[ { "content": "struct formatter<void*, Char> : formatter<const void*, Char> {\n\n template <typename FormatContext>\n\n auto format(void* val, FormatContext& ctx) -> decltype(ctx.out()) {\n\n return formatter<const void*, Char>::format(val, ctx);\n\n }\n\n};\n\n\n\ntemplate <typename Char, size_t N>\n", ...
C++
src/menu.cpp
WMXZ-EU/basicSoundRecorder
3ff2fd5aad50dcd8c29580a05a9247f079a28cc3
#include "config.h" #include "filing.h" #include "utils.h" #include "mTime.h" #include "menu.h" #define CONFIG_FILE "/Config.txt" #define LOCK_FILE "/cVAS.lock" extern SDClass sdx[]; uint16_t store[16]; extern int t_acq; void storeConfig(uint16_t *store, int ns) { File configFile; char text[32]; ...
#include "config.h" #include "filing.h" #include "utils.h" #include "mTime.h" #include "menu.h" #define CONFIG_FILE "/Config.txt" #define LOCK_FILE "/cVAS.lock" extern SDClass sdx[]; uint16_t store[16]; extern int t_acq; void storeConfig(uint16_t *store, int ns) { File configFile; char text[32]; ...
e()) ; ch=Serial.read(); if(ch=='s') { Serial.print("\n"); Serial.print("start"); return +1;} else if(ch=='e') { Serial.print("\n"); Serial.print("stop"); return -1;} else if(ch=='h') { printMenu(); return 0;} else if(ch=='w') { saveParameters(); return 0;} else if(ch=='l') { listDisks(); re...
function_block-function_prefixed
[ { "content": "void resetMTP(void) ;\n", "file_path": "src/menu.h", "rank": 0, "score": 67831.51723899825 }, { "content": "void listDisks(void);\n", "file_path": "src/menu.h", "rank": 1, "score": 67804.58596994064 }, { "content": " void listDisks(void);\n", "file_pa...
C++
alljoyn_c/samples/about/about_service.cc
liuxiang88/core-alljoyn
549c966482d9b89da84aa528117584e7049916cb
#include <alljoyn_c/AboutData.h> #include <alljoyn_c/AboutListener.h> #include <alljoyn_c/AboutObj.h> #include <alljoyn_c/AboutObjectDescription.h> #include <alljoyn_c/AboutProxy.h> #include <alljoyn_c/BusAttachment.h> #include <alljoyn_c/Init.h> #include <alljoyn/BusAttachment.h> #include <alljoyn/BusListener.h> #i...
#include <alljoyn_c/AboutData.h> #include <alljoyn_c/AboutListener.h> #include <alljoyn_c/AboutObj.h> #include <alljoyn_c/AboutObjectDescription.h> #include <alljoyn_c/AboutProxy.h> #include <alljoyn_c/BusAttachment.h> #include <alljoyn_c/Init.h> #include <alljoyn/BusAttachment.h> #include <alljoyn/BusListener.h> #i...
256] = { 0 }; #if defined(QCC_OS_GROUP_WINDOWS) _snprintf( #else snprintf( #endif interface, ArraySize(interface), "<node>" \ "<interface name='%s'>" \ " <method name='Echo'>" \ " <arg name='out_...
function_block-function_prefixed
[ { "content": "class BasicService: NSObject, AJNBusListener, AJNSessionPortListener, AJNSessionListener {\n\n\n\n weak var delegate: BasicServiceDelegate?\n\n\n\n private var bus: AJNBusAttachment?\n\n private var basicObject: BasicObject?\n\n\n\n func startServiceAsync() {\n\n DispatchQueue.g...
C++
src/Sound/AttenuationShapes.cpp
SparkyStudios/AmplitudeSDK
bcfb9d9c2fcea8ecd3a540576508f062fb3d5e21
#include <Sound/AttenuationShapes.h> #include <SparkyStudios/Audio/Amplitude/Core/Engine.h> #include <SparkyStudios/Audio/Amplitude/Core/Log.h> #include <Core/EngineInternalState.h> namespace SparkyStudios::Audio::Amplitude { AttenuationShape::AttenuationShape() : m_maxAttenuationFactor(1.0f) {} ...
#include <Sound/AttenuationShapes.h> #include <SparkyStudios/Audio/Amplitude/Core/Engine.h> #include <SparkyStudios/Audio/Amplitude/Core/Log.h> #include <Core/EngineInternalState.h> namespace SparkyStudios::Audio::Amplitude { AttenuationShape::AttenuationShape() : m_maxAttenuationFactor(1.0f) {} ...
const float outerHalfHeight = _outerHalfHeight - _outerRadius; hmm_vec3 iA, iB, oA, oB; switch (amEngine->GetState()->up_axis) { default: case GameEngineUpAxis_Y: iA = AM_Multiply(lookAt, AM_Vec4(0.0f, innerHalfHeight, 0.0f, 1.0f)).XYZ; iB = AM_Multipl...
lookAt); const hmm_vec3& x = listener->GetLocation(); const float distanceToOrigin = AM_Length(x - soundLocation); const float innerHalfHeight = _innerHalfHeight - _innerRadius;
random
[ { "content": " class AttenuationShape\n\n {\n\n public:\n\n /**\n\n * @brief Returns the attenuation factor.\n\n *\n\n * This method is used only for position based sound sources.\n\n *\n\n * @param attenuation The Attenuator object to use for distance att...
C++
LargeBarrelAnalysis/tests/TimeWindowCreatorToolsTest.cpp
kdulski/j-pet-framework-examples
ab2592a2c6cf8f901f5732f8878b750b9a7b6a49
#define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE TimeWindowCreatorToolsTest #include "../TimeWindowCreatorTools.h" #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_SUITE(TimeWindowCreatorToolsTestSuite) BOOST_AUTO_TEST_CASE(sortByValue_test) { JPetPM pm1(1, "first"); JPetSigCh sigCh1(JPetSigCh::Leadin...
#define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE TimeWindowCreatorToolsTest #include "../TimeWindowCreatorTools.h" #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_SUITE(TimeWindowCreatorToolsTestSuite) BOOST_AUTO_TEST_CASE(sortByValue_test) { JPetPM pm1(1, "first"); JPetSigCh sigCh1(JPetSigCh::Leadin...
BOOST_AUTO_TEST_CASE(flagSigChs_test) { JPetSigCh sigCh00(JPetSigCh::Leading, 10.0); JPetSigCh sigCh01(JPetSigCh::Trailing, 11.0); JPetSigCh sigCh02(JPetSigCh::Leading, 12.0); JPetSigCh sigCh03(JPetSigCh::Leading, 13.0); JPetSigCh sigCh04(JPetSigCh::Trailing, 14.0); JPetSigCh sigCh05(JPetSigCh::Leading,...
ling, true); auto epsilon = 0.0001; BOOST_REQUIRE_EQUAL(sigCh.getType(), JPetSigCh::Trailing); BOOST_REQUIRE_EQUAL(sigCh.getPM().getID(), 23); BOOST_REQUIRE_EQUAL(sigCh.getFEB().getID(), 1); BOOST_REQUIRE_EQUAL(sigCh.getTRB().getID(), 2); BOOST_REQUIRE_EQUAL(sigCh.getDAQch(), 123); BOOST_REQUIRE_EQ...
function_block-function_prefixed
[ { "content": "Description of available parameters in TimeCalibration example.\n\nNote that configuration/calibration filed can be obtained from PetWiki:\n\nhttp://koza.if.uj.edu.pl/petwiki/index.php/Default_settings_and_parameters_used_in_the_analyses\n\n--------\n\n\n\nSave_Control_Histograms_bool\n\n--- Commo...
C++
UnitTests/Physics/HeightFieldShapeTests.cpp
All8Up/JoltPhysics
751d13891f5bd8850863ad236eaa3c340e90de9a
#include "UnitTestFramework.h" #include "PhysicsTestContext.h" #include <Physics/Collision/RayCast.h> #include <Physics/Collision/CastResult.h> #include <Physics/Collision/Shape/HeightFieldShape.h> #include <Physics/Collision/PhysicsMaterialSimple.h> TEST_SUITE("HeightFieldShapeTests") { static void sRandomizeMater...
#include "UnitTestFramework.h" #include "PhysicsTestContext.h" #include <Physics/Collision/RayCast.h> #include <Physics/Collision/CastResult.h> #include <Physics/Collision/Shape/HeightFieldShape.h> #include <Physics/Collision/PhysicsMaterialSimple.h> TEST_SUITE("HeightFieldShapeTests") { static void sRandomizeMater...
TEST_CASE("TestPlane") { HeightFieldShapeSettings settings; settings.mOffset = Vec3(3, 5, 7); settings.mScale = Vec3(9, 13, 17); settings.mSampleCount = 32; settings.mBitsPerSample = 1; settings.mBlockSize = 4; settings.mHeightSamples.resize(Square(settings.mSampleCount)); for (float &h : setting...
else if (!inSettings.mMaterials.empty()) m1 = inSettings.mMaterials.front(); const PhysicsMaterial *m2 = shape->GetMaterial(x, y); CHECK(m1 == m2); } if (x > 0 && y > 0 && x < inSettings.mSampleCount - 1 && y < inSettings.mSampleCount - 1) { Vec3 hit_pos = ray.mOri...
function_block-function_prefix_line
[ { "content": "/// A height field shape. Cannot be used as a dynamic object.\n\nclass HeightFieldShape final : public Shape\n\n{\n\npublic:\n\n\t/// Constructor\n\n\t\t\t\t\t\t\t\t\tHeightFieldShape() : Shape(EShapeType::HeightField, EShapeSubType::HeightField) { }\n\n\t\t\t\t\t\t\t\t\tHeightFieldShape(const Hei...
C++
include/sharpen/MemoryTable.hpp
TalexDreamSoul/Sharpen
9167c4080438a1f150232d733c4da878639d6f66
#pragma once #ifndef _SHARPEN_MEMORYTABLE_HPP #define _SHARPEN_MEMORYTABLE_HPP #include <stdexcept> #include <map> #include <cassert> #include "ByteBuffer.hpp" #include "CompressedPair.hpp" #include "MemoryTableConcepts.hpp" #include "Noncopyable.hpp" #include "Optional.hpp" namespace sharpen { class MemoryTa...
#pragma once #ifndef _SHARPEN_MEMORYTABLE_HPP #define _SHARPEN_MEMORYTABLE_HPP #include <stdexcept> #include <map> #include <cassert> #include "ByteBuffer.hpp" #include "CompressedPair.hpp" #include "MemoryTableConcepts.hpp" #include "Noncopyable.hpp" #include "Optional.hpp" namespace sharpen { class MemoryTa...
key_,begin->value_); } else { this->InternalDelete(begin->key_); } } } public: enum class ExistStatus { Exist, Deleted, NotFound }; templa...
++begin) { if (begin->type_ == sharpen::WriteBatch::ActionType::Put) { this->InternalPut(begin->
function_block-random_span
[]
C++
Code/Components/swcorrelator/current/swcorrelator/BasicMonitor.cc
rtobar/askapsoft
6bae06071d7d24f41abe3f2b7f9ee06cb0a9445e
#include <askap_swcorrelator.h> #include <swcorrelator/BasicMonitor.h> #include <askap/AskapLogging.h> #include <askap/AskapError.h> #include <askap/AskapUtil.h> #include <utils/DelayEstimator.h> #include <fstream> ASKAP_LOGGER(logger, ".basicmonitor"); namespace askap { namespace swcorrelator { BasicMonitor::Ba...
#include <askap_swcorrelator.h> #include <swcorrelator/BasicMonitor.h> #include <askap/AskapLogging.h> #include <askap/AskapError.h> #include <askap/AskapUtil.h> #include <utils/DelayEstimator.h> #include <fstream> ASKAP_LOGGER(logger, ".basicmonitor"); namespace askap { namespace swcorrelator { BasicMonitor::Ba...
} }
casa::Vector<casa::Float> BasicMonitor::estimateDelays(const casa::Matrix<casa::Complex> &vis) { casa::Vector<casa::Float> result(vis.nrow(),0.); if (vis.ncolumn() >= 2) { scimath::DelayEstimator de(1e6); for (casa::uInt row = 0; row < vis.nrow(); ++row) { result[row] = float(de.getDelay(vis...
function_block-full_function
[ { "content": "namespace askap {\n\n\n\nnamespace swcorrelator {\n\n\n\n/// @brief a collection of data monitors\n\n/// @details This class is just a container of data monitors. It implements basic calls\n\n/// of the IMonitor interface and translates them to each monitor held in the container.\n\n/// @ingroup s...
C++
src/core/net/netif.cpp
jjzhang166/openthread
e68e38b8e85fe4eeb3810727cd3583b5f87a4e70
#include <common/code_utils.hpp> #include <common/debug.hpp> #include <common/message.hpp> #include <net/netif.hpp> namespace Thread { namespace Ip6 { Netif *Netif::sNetifListHead = NULL; int Netif::sNextInterfaceId = 1; Netif::Netif() : mUnicastChangedTask(&HandleUnicastChangedTask, this) { mHandlers = NU...
#include <common/code_utils.hpp> #include <common/debug.hpp> #include <common/message.hpp> #include <net/netif.hpp> namespace Thread { namespace Ip6 { Netif *Netif::sNetifListHead = NULL; int Netif::sNextInterfaceId = 1; Netif::Netif() : mUnicastChangedTask(&HandleUnicastChangedTask, this) { mHandlers = NU...
int Netif::GetOnLinkNetif(const Address &aAddress) { int rval = -1; for (Netif *netif = sNetifListHead; netif; netif = netif->mNext) { for (NetifUnicastAddress *cur = netif->mUnicastAddresses; cur; cur = cur->GetNext()) { if (cur->GetAddress().PrefixMatch(aAddress) >= cur->mPr...
GetAddress().GetScope() < destination->GetScope()) { rvalAddr = addr; rvalIface = candidateId; } } else if (addr->mPreferredLifetime != 0 && rvalAddr->mPreferredLifetime == 0) { r...
function_block-function_prefixed
[ { "content": "class ThreadNetif: public Ip6::Netif\n\n{\n\npublic:\n\n /**\n\n * This constructor initializes the Thread network interface.\n\n *\n\n */\n\n ThreadNetif(void);\n\n\n\n /**\n\n * This method enables the Thread network interface.\n\n *\n\n */\n\n ThreadError Up(...
C++
MUON/MUONgraphics/AliMUONPCBPainter.cxx
AllaMaevskaya/AliRoot
c53712645bf1c7d5f565b0d3228e3a6b9b09011a
#include "AliMUONPCBPainter.h" #include "AliMUONManuPainter.h" #include "AliMUONContour.h" #include "AliMUONPainterHelper.h" #include "AliMUONVCalibParam.h" #include "AliMUONVTrackerData.h" #include "AliMpDEManager.h" #include "AliMpMotifPosition.h" #include "AliMpPCB.h" #include "AliMpPlaneType.h" #include "AliMpSl...
#include "AliMUONPCBPainter.h" #include "AliMUONManuPainter.h" #include "AliMUONContour.h" #include "AliMUONPainterHelper.h" #include "AliMUONVCalibParam.h" #include "AliMUONVTrackerData.h" #include "AliMpDEManager.h" #include "AliMpMotifPosition.h" #include "AliMpPCB.h" #include "AliMpPlaneType.h" #include "AliMpSl...
; if (!contour) { contour = h->MergeContours(contourArray,ContourName()); } SetContour(contour); } AliMUONPCBPainter::~AliMUONPCBPainter() { } AliMUONPCBPainter::AliMUONPCBPainter(const AliMUONPCBPainter& rhs) : AliMUONVPainter(rhs), fDetElemId(-1), fPCBIndex(-1) { rhs.Copy(*this); }...
h->Local2Global(fDetElemId, pcb->X()-slat->GetPositionX(), pcb->Y()-slat->GetPositionY(), 0.0, x,y,z)
call_expression
[ { "content": "class AliMpPCB;\n\n\n", "file_path": "MUON/MUONmpgraphics/AliMpPCBPainter.h", "rank": 0, "score": 278175.9464289656 }, { "content": "class AliMpSlat;\n\n\n", "file_path": "MUON/MUONmpgraphics/AliMpSlatPainter.h", "rank": 1, "score": 278174.1546947528 }, { "c...