本文整理汇总了C++中ps函数的典型用法代码示例。如果您正苦于以下问题:C++ ps函数的具体用法?C++ ps怎么用?C++ ps使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ps函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ch
std::vector<Vendor> VendorDAOMySQL::findVendorByName(const std::string &name)
{
MySQLManager::ConnectionHolder ch(MySQLManager::getInstance());
std::unique_ptr<sql::PreparedStatement> ps(ch.conn->prepareStatement(FIND_VENDOR_BY_NAME));
ps->setString(1, "%" + name + "%");
std::unique_ptr<sql::ResultSet> res(ps->executeQuery());
std::vector<Vendor> vendors;
while(res->next())
{
vendors.push_back(Vendor(res->getInt(1), res->getString(2)));
}
return vendors;
}
示例2: w_validate_buffer
void w_validate_buffer(window* pw, int view_w, int view_h)
{
if(pw->dirty_area.is_valid())
{
WINDOW_ON_PAINT_PARAMS p;
paint_graphics ps(pw->buffer, pw->dirty_area.x1, pw->dirty_area.y1, pw->dirty_area.x2, pw->dirty_area.y2 );
p.clip_x = pw->dirty_area.x1;
p.clip_y = pw->dirty_area.y1;
p.clip_w = pw->dirty_area.x2 - pw->dirty_area.x1;
p.clip_h = pw->dirty_area.y2 - pw->dirty_area.y1;
p.view_w = view_w;
p.view_h = view_h;
p.surface = &ps;
pw->notify(WINDOW_ON_PAINT, &p);
pw->dirty_area = agg::rect_i(1,1,0,0);
}
}
示例3: ps
void Network::handlePluckerMessage(const osc::ReceivedMessage& m,
const IpEndpointName& remoteEndpoint)
{
// Utility data structures
char buffer[1024];
osc::OutboundPacketStream ps(buffer, 1024);
// Parse OSC message
osc::Symbol uuid;
m.ArgumentStream() >> uuid >> osc::EndMessage;
std::cerr << uuid << std::endl;
WidgetMap* widgets = Widget::getAll();
WidgetMap::iterator wit = widgets->find(std::string(uuid));
if (wit != widgets->end() && dynamic_cast<Track*>(wit->second))
((Track*)wit->second)->addPlucker();
}
示例4: ps
void Function::Compile( sqlite3_context* ctx )
{
Parser ps( mVM, mText );
if( ps.mErr.size() )
{
mCompiled = false;
vector<char> buf;
ConvertToUTF8( ps.mErr, buf );
sqlite3_result_error( ctx, &buf[ 0 ], buf.size() - 1 );
}
else
{
mCompiled = true;
}
}
示例5: ch
std::vector<Inventory> InventoryDAOMySQL::searchInventoryByGtin(const int &userId, const std::string >in)
{
MySQLManager::ConnectionHolder ch(MySQLManager::getInstance());
std::unique_ptr<sql::PreparedStatement> ps(ch.conn->prepareStatement(INVENTORIES_SEARCH_GTIN));
ps->setInt(1, userId);
ps->setString(2, "%" + gtin + "%");
std::unique_ptr<sql::ResultSet> res(ps->executeQuery());
std::vector<Inventory> inventories;
while(res->next())
{
inventories.push_back(Inventory(res->getInt(1), res->getInt(2), res->getInt(3), res->getString(4)));
}
return inventories;
}
示例6: ps
void MergeGraphOp::setParams(const std::string params)
{
ParamSet ps(params);
ps("color_is_vector", _color_is_vector);
ps("secondary_color_is_vector", _secondary_color_is_vector);
ps("texcoord_is_vector", _texcoord0_is_vector);
ps("texcoord0_is_vector", _texcoord0_is_vector);
ps("texcoord1_is_vector", _texcoord1_is_vector);
ps("texcoord2_is_vector", _texcoord2_is_vector);
ps("texcoord3_is_vector", _texcoord3_is_vector);
std::string out = ps.getUnusedParams();
if(out.length())
{
FWARNING(("MergeGraphOp doesn't have parameters '%s'.\n",
out.c_str()));
}
}
示例7: CheckPointer
HRESULT CFGFilterLAV::PropertyPageCallback(IBaseFilter* pBF)
{
CheckPointer(pBF, E_POINTER);
CComPropertySheet ps(ResStr(IDS_PROPSHEET_PROPERTIES), AfxGetMyApp()->GetMainWnd());
// Find out which internal filter we are opening the property page for
CFGFilterLAV::LAVFILTER_TYPE LAVFilterType = CFGFilterLAV::INVALID;
if (!CFGFilterLAV::IsInternalInstance(pBF, &LAVFilterType)) {
return E_UNEXPECTED;
}
HRESULT hr = E_FAIL;
if (CComQIPtr<ISpecifyPropertyPages> pSPP = pBF) {
ps.AddPages(pSPP, (LAVFilterType != CFGFilterLAV::AUDIO_DECODER) ? 1 : 2);
}
CComPtr<IPropertyPage> pPP = DEBUG_NEW CInternalPropertyPageTempl<CPinInfoWnd>(nullptr, &hr);
ps.AddPage(pPP, pBF);
if (ps.GetPageCount() > 1) {
ps.DoModal();
if (CComQIPtr<ILAVFSettings> pLAVFSettings = pBF) {
CFGFilterLAVSplitterBase::Settings settings;
if (settings.GetSettings(pLAVFSettings)) { // Get current settings from LAVSplitter
settings.SaveSettings(); // Save them to the registry/ini
}
} else if (CComQIPtr<ILAVVideoSettings> pLAVVideoSettings = pBF) {
CFGFilterLAVVideo::Settings settings;
if (settings.GetSettings(pLAVVideoSettings)) { // Get current settings from LAVVideo
settings.SaveSettings(); // Save them to the registry/ini
}
} else if (CComQIPtr<ILAVAudioSettings> pLAVAudioSettings = pBF) {
CFGFilterLAVAudio::Settings settings;
if (settings.GetSettings(pLAVAudioSettings)) { // Get current settings from LAVAudio
settings.SaveSettings(); // Save them to the registry/ini
}
}
hr = S_OK;
}
return hr;
}
示例8: ps
void CXGraphBitmap::Draw(CDCEx *pDC)
{
if (!m_bVisible)
return;
CDCEx dc;
BITMAP bmp;
CRect bmpRect = m_clRect;
if (m_bBorder)
{
CPenSelector ps(0, 1, pDC);
pDC->Rectangle(m_clRect);
bmpRect.DeflateRect (1,1,1,1);
}
if (pDC->m_bPrinting)
pDC->AdjustRatio (bmpRect);
m_pBitmap->GetBitmap(&bmp);
dc.CreateCompatibleDC (pDC);
CGdiObject* pOldObject = dc.SelectObject (m_pBitmap);
pDC->StretchBlt(bmpRect.left, bmpRect.top, bmpRect.Width(), bmpRect.Height(), &dc, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
dc.SelectObject (pOldObject);
if (m_bSizing)
{
if (pDC->m_bPrinting)
{
CRect rect = m_Tracker.m_rect;
pDC->AdjustRatio (m_Tracker.m_rect);
m_Tracker.Draw (pDC);
m_Tracker.m_rect = rect;
}
else
m_Tracker.Draw (pDC);
}
}
示例9: main
int main(int argc,char* argv[])
{
LidarProcessOctree lpo(argv[1],512*1024*1024);
#if 1
Misc::Timer t;
{
// BinaryPointSaver bps(argv[2]);
PointCounter pc;
lpo.processPoints(pc);
std::cout<<pc.getNumPoints()<<std::endl;
}
t.elapse();
std::cout<<"Done in "<<t.getTime()*1000.0<<" ms"<<std::endl;
#elif 0
PointSaver ps(argv[2]);
Box box=Box::full;
for(int i=0;i<2;++i)
{
box.min[i]=atof(argv[3+i]);
box.max[i]=atof(argv[5+i]);
}
lpo.processPointsInBox(box,ps);
#else
PointCounter pc;
Scalar radius=Scalar(0.1);
PointDensityCalculator pdc(lpo,radius,4);
#if 0
Box box;
box.min=Point(930,530,0);
box.max=Point(970,570,100);
lpo.processPointsInBox(box,pdc);
#else
// lpo.processPoints(pdc);
lpo.processNodesPostfix(pdc);
#endif
std::cout<<"Number of processed points: "<<pdc.numPoints<<std::endl;
std::cout<<"Total number of found neighbors: "<<pdc.totalNumNeighbors<<std::endl;
std::cout<<"Total number of loaded octree nodes: "<<lpo.getNumSubdivideCalls()<<", "<<lpo.getNumLoadedNodes()<<std::endl;
std::cout<<"Average point density in 1/m^3: "<<pdc.totalNumNeighbors/(pdc.numPoints*4.0/3.0*3.141592654*radius*radius*radius)<<std::endl;
#endif
return 0;
}
示例10: MINILOG
Eigen::MatrixXf
powerspectrum::from_pcm(const Eigen::VectorXf& pcm_samples)
{
MINILOG(logTRACE) << "Powerspectrum computation. input samples="
<< pcm_samples.size();
// check if inputs are sane
if ((pcm_samples.size() < win_size) || (hop_size > win_size)) {
return Eigen::MatrixXf(0, 0);
}
size_t frames = (pcm_samples.size() - (win_size-hop_size)) / hop_size;
size_t freq_bins = win_size/2 + 1;
// initialize power spectrum
Eigen::MatrixXf ps(freq_bins, frames);
// peak normalization value
float pcm_scale = std::max(fabs(pcm_samples.minCoeff()),
fabs(pcm_samples.maxCoeff()));
// scale signal to 96db (16bit)
pcm_scale = std::pow(10.0f, 96.0f/20.0f) / pcm_scale;
// compute the power spectrum
for (size_t i = 0; i < frames; i++) {
// fill pcm
for (int j = 0; j < win_size; j++) {
kiss_pcm[j] = pcm_samples(i*hop_size+j) * pcm_scale * win_funct(j);
}
// fft
kiss_fftr(kiss_status, kiss_pcm, kiss_freq);
// save powerspectrum frame
Eigen::MatrixXf::ColXpr psc(ps.col(i));
for (int j = 0; j < win_size/2+1; j++) {
psc(j) =
std::pow(kiss_freq[j].r, 2) + std::pow(kiss_freq[j].i, 2);
}
}
MINILOG(logTRACE) << "Powerspectrum finished. size=" << ps.rows() << "x"
<< ps.cols();
return ps;
}
示例11: ps
void MapgenV7P::generateCaves(s16 max_stone_y, s16 large_cave_depth)
{
if (max_stone_y < node_min.Y)
return;
PseudoRandom ps(blockseed + 21343);
PseudoRandom ps2(blockseed + 1032);
u32 large_caves_count = (node_max.Y <= large_cave_depth) ? ps.range(0, 2) : 0;
for (u32 i = 0; i < small_caves_count + large_caves_count; i++) {
CavesV6 cave(ndef, &gennotify, water_level, c_water_source, c_lava_source);
bool large_cave = (i >= small_caves_count);
cave.makeCave(vm, node_min, node_max, &ps, &ps2,
large_cave, max_stone_y, heightmap);
}
}
示例12: main
using namespace cluster
int main(int argc, char* argv[])
{
ClusterId num_clusters = 30;
PointId num_points = 3000;
Dimensions num_dimensions = 10;
PointsSpace ps(num_points, num_dimensions);
//std::cout << "PointSpace" << ps;
Clusters clusters(num_clusters, ps);
clusters.k_means();
std::cout << clusters;
}
示例13: ps
void plLayerAnimation::Read(hsStream* s, hsResMgr* mgr)
{
plLayerAnimationBase::Read(s, mgr);
fTimeConvert.Read(s, mgr);
if (!(fTimeConvert.IsStopped()))
{
plSynchEnabler ps(true); // enable dirty tracking so that we send state about
// the anim resetting to start now.
fTimeConvert.SetCurrentAnimTime(0, true);
}
Eval(hsTimer::GetSysSeconds(),0,0);
// add sdl modifier
delete fLayerSDLMod;
fLayerSDLMod = new plLayerSDLModifier;
fLayerSDLMod->SetLayerAnimation(this);
}
示例14: ProcessStmt
bool BuildAstTreeDepGraph ::
ProcessStmt( AstInterface &fa, const AstNodePtr& s)
{
GraphAccessInterface::Node *n = graph->CreateNodeImpl(s, GetStmtDomain(s));
StmtNodeInfo info(n,s);
stmtNodes.PushFirst(info);
for (StmtStackType::Iterator ps(stmtNodes); !ps.ReachEnd(); ++ps) {
ComputeStmtDep((*ps), info, DEPTYPE_DATA | DEPTYPE_IO);
}
for ( StmtStackType::Iterator p(ctrlNodes); !p.ReachEnd(); ++p) {
ComputeCtrlDep((*p), info);
}
for (StmtStackType::Iterator pg(gotoNodes); !pg.ReachEnd(); ++pg) {
ComputeCtrlDep((*pg), info);
}
return ProcessAstTree::ProcessStmt(fa, s);
}
示例15: test_file
int test_file(const std::string & test_data_filepath,
const std::string & label_prefix) {
int fails = 0;
std::vector<pstrudel::TreeShape> trees;
pstrudel::treeio::read_from_filepath(trees, test_data_filepath, "nexus");
unsigned long tree_idx = 0;
for (auto & tree : trees) {
std::string label = label_prefix + ":" + std::to_string(tree_idx + 1);
pstrudel::LineageThroughTimeProfileCalculator ltt_calc(tree);
auto profiles = ltt_calc.build_lineage_splitting_time_profile();
auto lst_profile = profiles.first;
auto scaled_lst_profile = profiles.second;
std::ostringstream o;
TREE_WRITER.write(o, tree);
o << "\n";
assert(lst_profile.data_size() == scaled_lst_profile.data_size());
auto rds = lst_profile.data_size();
for (unsigned long idx = 0; idx < rds; ++idx) {
o << std::fixed << std::setprecision(22) << lst_profile.raw_data(idx);
o << "\t" << std::fixed << std::setprecision(22) << scaled_lst_profile.raw_data(idx);
o << "\n";
}
colugo::Subprocess ps({"python", CHECK_SCRIPT, "-f", "newick", "-l", label});
try {
auto result = ps.communicate(o.str());
if (ps.returncode() != 0) {
std::cerr << "(test '" << label << "' returned error: " << ps.returncode() << ")\n";
// TREE_WRITER.write(std::cerr, tree);
// std::cerr << std::endl;
std::cerr << result.first;
std::cerr << result.second;
fails += 1;
// } else {
// std::cerr << result.second;
}
} catch (const colugo::SubprocessTimeOutException & e) {
std::cerr << "(test '" << label << "' timed out)\n";
exit(1);
}
++tree_idx;
}
return fails;
}