本文整理汇总了C++中pg函数的典型用法代码示例。如果您正苦于以下问题:C++ pg函数的具体用法?C++ pg怎么用?C++ pg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveFileForSearch
JBoolean
CBSearchTextDialog::BuildSearchFileList
(
JPtrArray<JString>* fileList,
JPtrArray<JString>* nameList
)
const
{
(JXGetApplication())->DisplayBusyCursor();
fileList->SetCleanUpAction(JPtrArrayT::kDeleteAll);
fileList->SetCompareFunction(JCompareStringsCaseSensitive);
nameList->SetCleanUpAction(JPtrArrayT::kDeleteAll);
nameList->SetCompareFunction(JCompareStringsCaseSensitive);
if (itsMultifileCB->IsChecked())
{
const JPtrArray<JString>& fullNameList = itsFileList->GetFullNameList();
const JSize count = fullNameList.GetElementCount();
for (JIndex i=1; i<=count; i++)
{
SaveFileForSearch(*(fullNameList.NthElement(i)), fileList, nameList);
}
}
JBoolean ok = kJTrue;
JString path, fileFilter, pathFilter;
if (GetSearchDirectory(&path, &fileFilter, &pathFilter))
{
JRegex* fileRegex = NULL;
JString regexStr;
if (JDirInfo::BuildRegexFromWildcardFilter(fileFilter, ®exStr))
{
fileRegex = jnew JRegex(regexStr);
assert( fileRegex != NULL );
fileRegex->SetCaseSensitive(kJFalse);
}
JRegex* pathRegex = NULL;
if (JDirInfo::BuildRegexFromWildcardFilter(pathFilter, ®exStr))
{
pathRegex = jnew JRegex(regexStr);
assert( pathRegex != NULL );
pathRegex->SetCaseSensitive(kJFalse);
}
JLatentPG pg(100);
pg.VariableLengthProcessBeginning("Collecting files...", kJTrue, kJFalse);
ok = SearchDirectory(path, fileRegex, pathRegex, fileList, nameList, pg);
pg.ProcessFinished();
jdelete fileRegex;
jdelete pathRegex;
}
return JI2B( ok && !fileList->IsEmpty() );
}
示例2: cVillage
cVillage(
int a_Seed,
int a_GridX, int a_GridZ,
int a_OriginX, int a_OriginZ,
int a_MaxRoadDepth,
int a_MaxSize,
int a_Density,
cVillagePiecePool & a_Prefabs,
cTerrainHeightGenPtr a_HeightGen
) :
super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Seed(a_Seed),
m_Noise(a_Seed),
m_MaxSize(a_MaxSize),
m_Density(a_Density),
m_Borders(a_OriginX - a_MaxSize, 0, a_OriginZ - a_MaxSize, a_OriginX + a_MaxSize, cChunkDef::Height - 1, a_OriginZ + a_MaxSize),
m_Prefabs(a_Prefabs),
m_HeightGen(a_HeightGen)
{
// Generate the pieces for this village; don't care about the Y coord:
cBFSPieceGenerator pg(*this, a_Seed);
pg.PlacePieces(a_OriginX, a_OriginZ, a_MaxRoadDepth + 1, m_Pieces);
if (m_Pieces.empty())
{
return;
}
}
示例3: convert
void
MainWindow::on_actionInsertRandomPoints_triggered()
{
QRectF rect = CGAL::Qt::viewportsBbox(&m_scene);
CGAL::Qt::Converter<Kernel> convert;
Iso_rectangle_2 isor = convert(rect);
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
0,
(std::numeric_limits<int>::max)(),
1,
&ok);
if(!ok) {
return;
}
// wait cursor
QApplication::setOverrideCursor(Qt::WaitCursor);
for(int i = 0; i < number_of_points; ++i){
m_sites.push_back(*pg++);
}
calculate_envelope();
// default cursor
QApplication::restoreOverrideCursor();
emit(changed());
}
示例4: pg
void Test_PG_Output::testGet_JSON_vertex_ids_first() {
ProductGraph pg(f,s);
pg.setProductGraph(p);
std::string result = PG_Output::get_JSON_vertex_ids_first(pg, clique);
std::string check = "[\n\t10,\n\t20,\n\t30,\n\t40\n]";
CPPUNIT_ASSERT(result == check);
}
示例5: pg
Vector<Real, STATE_NF> State::scalar_y_flux(const _3Vec& X) const {
Vector<Real, STATE_NF> flux = 0.0;
#ifdef USE_LZ
flux[sx_index] = pg(X);
#endif
return flux;
}
示例6: pg
DH::DH(RandomNumberGenerator &rng, unsigned int pbits)
{
PrimeAndGenerator pg(1, rng, pbits);
p = pg.Prime();
g = pg.Generator();
gpc.Precompute(p, g, ExponentBitLength(), 1);
}
示例7: convert
void
MainWindow::on_actionInsertRandomPoints_triggered()
{
QRectF rect = CGAL::Qt::viewportsBbox(&scene);
CGAL::Qt::Converter<K> convert;
Iso_rectangle_2 isor = convert(rect);
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg(isor.min(), isor.max());
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
0,
std::numeric_limits<int>::max(),
1,
&ok);
if(!ok) {
return;
}
// wait cursor
QApplication::setOverrideCursor(Qt::WaitCursor);
std::vector<Point_2> points;
points.reserve(number_of_points);
for(int i = 0; i < number_of_points; ++i){
points.push_back(*pg++);
}
dt.insert(points.begin(), points.end());
// default cursor
QApplication::restoreOverrideCursor();
emit(changed());
}
示例8: pg
void VirtualKeyboardContainer::showVirtualKeyboard(QWidget *w)
{
if ( w )
{
QPoint pg(w->mapToGlobal( QPoint( 0, 0 ) ) );
QPoint pd(parent->mapFromGlobal( pg ) );
int origin = pd.y();
int keyboardWidth = parent->width() - 10;
int keyboardHeight = std::min(vk.heightForWidth( keyboardWidth ), parent->height() - w->height() - 5);
QRect kRect;
if ( origin + w->height() + keyboardHeight <= parent->height() )
{
// keyboard can be placed below the widget
kRect = QRect( 0, origin + w->height(), keyboardWidth, keyboardHeight );
}
else
if ( origin - keyboardHeight >= 0 )
{
// keyboard can be placed above the widget
kRect = QRect( 0, origin - keyboardHeight, keyboardWidth, keyboardHeight );
}
else
{
// we need to resize the dialog to place the keyboard below the widget
int remainHeight = parent->height() - origin - w->height();
extraSize = keyboardHeight - remainHeight;
QPoint p(parent->pos());
parent->move( p.x(), p.y() - extraSize );
QSize s(parent->size());
parent->resize( s.width(), s.height() + extraSize );
kRect = QRect( 0, origin + w->height(), keyboardWidth, keyboardHeight );
}
if ( kRect.isValid() )
{
vk.setGeometry( kRect );
vk.raise();
vk.show();
}
else
{
vk.hide();
}
}
else
{
if ( extraSize > 0 )
{
QPoint p(parent->pos());
parent->move( p.x(), p.y() + extraSize );
QSize s(parent->size());
parent->resize( s.width(), s.height() - extraSize );
extraSize = 0;
}
vk.hide();
}
vk.setBuddy(w);
}
示例9: pc
ompl::geometric::PathGeometric ompl::control::PathControl::asGeometric(void) const
{
PathControl pc(*this);
pc.interpolate();
geometric::PathGeometric pg(si_);
pg.getStates().swap(pc.states_);
return pg;
}
示例10: pg
ElGamalDecryptor::ElGamalDecryptor(RandomNumberGenerator &rng, unsigned int pbits)
{
PrimeAndGenerator pg(1, rng, pbits);
m_p = pg.Prime();
m_g = pg.Generator();
m_x.Randomize(rng, ExponentBitLength());
m_gpc.SetModulusAndBase(m_p, m_g);
m_y = m_gpc.Exponentiate(m_x);
m_ypc.SetModulusAndBase(m_p, m_y);
}
示例11: pg
marathon_group::ptr_t mesos_state_t::add_group(const Json::Value& group, marathon_group::ptr_t to_group, const std::string& framework_id)
{
Json::Value group_id = group["id"];
if(!group_id.isNull())
{
std::string id = group_id.asString();
std::ostringstream os;
os << "Adding Marathon group [" + id + ']';
if(to_group)
{
os << " to group [" + to_group->get_id() << ']';
}
g_logger.log(os.str(), sinsp_logger::SEV_INFO);
marathon_group::ptr_t pg(new marathon_group(id));
marathon_group::ptr_t p_group = add_or_replace_group(pg, to_group);
if(!framework_id.empty())
{
Json::Value apps = group["apps"];
if(!apps.isNull())
{
for(const auto& app : apps)
{
Json::Value app_id = app["id"];
if(!app_id.isNull())
{
marathon_app::ptr_t p_app = get_app(app_id.asString());
if(!p_app)
{
p_app = add_app(app, framework_id);
}
if(p_app)
{
p_group->add_or_replace_app(p_app);
for(const auto& task : get_tasks(framework_id))
{
if(task.second->get_marathon_app_id() == app_id.asString())
{
add_task_to_app(p_app, task.first);
}
}
}
else
{
g_logger.log("An error occured adding app [" + app_id.asString() +
"] to group [" + id + ']', sinsp_logger::SEV_ERROR);
}
}
}
}
}
return p_group;
}
return 0;
}
示例12: pg
NRDigestSigner::NRDigestSigner(RandomNumberGenerator &rng, unsigned int pbits)
{
PrimeAndGenerator pg(1, rng, pbits, 2*DiscreteLogWorkFactor(pbits));
m_p = pg.Prime();
m_q = pg.SubPrime();
m_g = pg.Generator();
m_x.Randomize(rng, 1, m_q-1, Integer::ANY);
m_gpc.SetModulusAndBase(m_p, m_g);
m_y = m_gpc.Exponentiate(m_x);
m_ypc.SetModulusAndBase(m_p, m_y);
}
示例13: pg
int KQtTester::testPathgradientFillRectPath()
{
QPainterPath path;
path.addRect(0, 0, 500, 500);
QPathGradient pg(path);
pg.setColorAt(0, Qt::red);
pg.setColorAt(0.5, Qt::green);
pg.setColorAt(1.0, Qt::blue);
return testFillRectPath(QBrush(pg));
}
示例14: NdbMutex_Destroy
MultiNdbWakeupHandler::~MultiNdbWakeupHandler()
{
if (localWakeupMutexPtr)
{
NdbMutex_Destroy(localWakeupMutexPtr);
localWakeupMutexPtr = NULL;
}
PollGuard pg(* wakeNdb->theImpl);
bool rc = wakeNdb->theImpl->m_transporter_facade->
unregisterForWakeup(wakeNdb->theImpl);
require(rc);
}
示例15: platform_cpu_get_interrupt
int platform_cpu_get_interrupt( elua_int_id id, elua_int_resnum resnum )
{
elua_int_p_get_status pg;
if( id < ELUA_INT_FIRST_ID || id > INT_ELUA_LAST )
return PLATFORM_INT_INVALID;
if( ( pg = elua_int_table[ id - ELUA_INT_FIRST_ID ].int_get_status ) == NULL )
return PLATFORM_INT_NOT_HANDLED;
if( id == INT_TMR_MATCH )
return cmn_tmr_int_get_status( resnum );
return pg( resnum );
}