本文整理汇总了C++中xT函数的典型用法代码示例。如果您正苦于以下问题:C++ xT函数的具体用法?C++ xT怎么用?C++ xT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xT函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xUNUSED
//-------------------------------------------------------------------------------------------------
Console::ModalResult
Console::msgBox(
std::ctstring_t &a_text,
std::ctstring_t &a_title,
cuint_t &a_type
) const
{
xUNUSED(a_type);
ModalResult mrRv;
std::csize_t width = 100;
ctchar_t cmdAbort = xT('a');
ctchar_t cmdIgnore = xT('i');
ctchar_t cmdRetry = xT('r');
std::tstring_t title;
{
title = _msgBoxLine(a_title, width) + Const::nl();
}
std::tstring_t multiText;
{
std::vec_tstring_t text;
String::split(a_text, Const::nl(), &text);
xFOR_EACH_CONST(std::vec_tstring_t, it, text) {
multiText += _msgBoxLine(*it, width) + Const::nl();
}
}
示例2: onInfo
xNO_INLINE static void_t
onInfo(int_t a_signal, siginfo_t *a_info, void_t *a_context)
{
xTEST_EQ(a_signal, a_info->si_signo);
xUNUSED((ucontext_t *)a_context);
xTRACE_FUNC;
Trace() << Signal::infoDescription(*a_info) << "\n";
Trace() << Signal::decription(0) << "\n";
FileLog log(FileLog::lsDefaultMb);
log.setFilePath(xT("crash.log"));
std::ctstring_t msg = Format::str(
xT("Crash info:\n\n")
xT("Signal:\n{}\n\n")
xT("StackTrace:\n{}"),
Signal::infoDescription(*a_info),
StackTrace().toString());
log.write(xT("%s\n"), msg.c_str());
std::tcout << StackTrace().toString() << std::endl;
Application::exit(EXIT_FAILURE);
}
示例3: xTEST_DIFF
//-------------------------------------------------------------------------------------------------
void_t
Signal::connectInfo(
const std::vector<int_t> &a_signalNums, ///<
const on_info_t a_onInfo ///<
) const
{
/**
* FAQ: set handlers
*
* https://gist.github.com/jvranish/4441299
*/
int_t iRv = 0;
struct sigaction action;
{
// Block other terminal-generated signals while handler runs
sigset_t blockMask;
{
iRv = ::sigemptyset(&blockMask);
xTEST_DIFF(iRv, - 1);
xFOR_EACH_CONST(std::vector<int_t>, it, a_signalNums) {
if (*it == SIGKILL || *it == SIGSTOP) {
continue;
}
iRv = ::sigaddset(&blockMask, *it);
xTEST_DIFF(iRv, - 1);
}
}
action.sa_sigaction = a_onInfo;
action.sa_mask = blockMask;
action.sa_flags = SA_RESTART | SA_SIGINFO;
}
xFOR_EACH_CONST(std::vector<int_t>, it, a_signalNums) {
switch (*it) {
case SIGKILL:
Trace() << Format::str(xT("xLib: Signal {} ({}) cannot be caught or ignored"),
xLEX_TO_STR(SIGKILL), SIGKILL);
continue;
case SIGSTOP:
Trace() << Format::str(xT("xLib: Signal {} ({}) cannot be caught or ignored"),
xLEX_TO_STR(SIGSTOP), SIGSTOP);
continue;
break;
default:
break;
}
iRv = ::sigaction(*it, &action, xPTR_NULL);
xTEST_DIFF_MSG(iRv, - 1, Format::str(xT("Signal: {}"), decription(*it)));
}
}
示例4: formatGeoBounds
std::string formatGeoBounds(double l, double r, double t, double b)
#endif
{
#if defined(_UNICODE) || defined(UNICODE)
std::wostringstream oStream;
#else
std::ostringstream oStream;
#endif
oStream << xT("(left top - right bottom) : ") << l << xT(", ") << t << xT(" NE - ") << r << xT(", ") << b << xT(" NE");
return oStream.str();
}
示例5: assert
void BtCircleTrain::train2DGaussian(BFImage& bfImage, BFImage& bfHist, const BFCircle& circle, BfGaussian2DPixelClassifier& classifier) {
assert(bfImage.getColorMode() == BF_LAB);
std::vector<BFCoordinate<int> > innerPoints;
BFCircle::getInnerPoints(circle, innerPoints);
int nPoints = innerPoints.size();
Eigen::MatrixXd xT(nPoints,2);
cv::Mat histImg = cv::Mat::zeros(histSize,histSize,CV_8U);
for(int i=0; i<nPoints; i++) {
BFCoordinate<unsigned int> intPoint(static_cast<int>(innerPoints[i].getX()), static_cast<int>(innerPoints[i].getY()));
BFColor color = bfImage.getColor(intPoint);
int aValue = color.getChannel(1);
int bValue = color.getChannel(2);
assert(aValue+abRange >= 0 && aValue+abRange < 2*abRange);
assert(bValue+abRange >= 0 && bValue+abRange < 2*abRange);
histImg.datastart[(bValue+abRange)*histSize + aValue+abRange]++;
xT(i,0) = static_cast<double>(aValue);
xT(i,1) = static_cast<double>(bValue);
}
double meanA = xT.col(0).mean();
double meanB = xT.col(1).mean();
Eigen::VectorXd meanVecA;
Eigen::VectorXd meanVecB;
meanVecA.setConstant(nPoints, meanA);
meanVecB.setConstant(nPoints, meanB);
xT.col(0) -= meanVecA;
xT.col(1) -= meanVecB;
Eigen::Matrix2d C = xT.transpose()*xT/static_cast<double>(nPoints-1);
Eigen::Vector2d mu;
mu << meanA, meanB;
bfHist.setColorMode(BF_GRAYSCALE);
cv::Mat& histNorm = bfHist.getImageMat();
// just for visualization
cv::normalize(histImg,histNorm,255.0,0.0,cv::NORM_INF,-1);
classifier.setC(C);
classifier.setMu(mu);
classifier.calculateEllipse();
}
示例6: sRv
//-------------------------------------------------------------------------------------------------
std::ctstring_t &
Const::strUnknown()
{
static std::ctstring_t sRv(xT("[unknown]"));
return sRv;
}