本文整理汇总了C++中rs函数的典型用法代码示例。如果您正苦于以下问题:C++ rs函数的具体用法?C++ rs怎么用?C++ rs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rs
STDMETHODIMP CDocProvider::CanDiagnose(LONG lError, VARIANT_BOOL *pbDiagnose)
{
CResourceSwapper rs(_Module.m_hInstResource);
return CWSErrorInfo::CanDiagnose(lError, pbDiagnose);
}
示例2: main
int main(int argc, char **argv)
{
ros::init(argc, argv, "publish_warehouse_data", ros::init_options::AnonymousName);
// time to wait in between publishing messages
double delay = 0.001;
boost::program_options::options_description desc;
desc.add_options()
("help", "Show help message")
("host", boost::program_options::value<std::string>(), "Host for the MongoDB.")
("port", boost::program_options::value<std::size_t>(), "Port for the MongoDB.")
("scene", boost::program_options::value<std::string>(), "Name of scene to publish.")
("planning_requests", "Also publish the planning requests that correspond to the scene")
("planning_results", "Also publish the planning results that correspond to the scene")
("constraint", boost::program_options::value<std::string>(), "Name of constraint to publish.")
("state", boost::program_options::value<std::string>(), "Name of the robot state to publish.")
("delay", boost::program_options::value<double>()->default_value(delay), "Time to wait in between publishing messages (s)");
boost::program_options::variables_map vm;
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
boost::program_options::notify(vm);
if (vm.count("help") || (!vm.count("scene") && !vm.count("constraint") && !vm.count("state")))
{
std::cout << desc << std::endl;
return 1;
}
try
{
delay = vm["delay"].as<double>();
}
catch(...)
{
std::cout << desc << std::endl;
return 2;
}
ros::AsyncSpinner spinner(1);
spinner.start();
ros::NodeHandle nh;
ros::Publisher pub_scene, pub_req, pub_res, pub_constr, pub_state;
ros::Duration wait_time(delay);
// publish the scene
if (vm.count("scene"))
{
pub_scene = nh.advertise<moveit_msgs::PlanningScene>(PLANNING_SCENE_TOPIC, 10);
bool req = vm.count("planning_requests");
bool res = vm.count("planning_results");
if (req)
pub_req = nh.advertise<moveit_msgs::MotionPlanRequest>(PLANNING_REQUEST_TOPIC, 100);
if (res)
pub_res = nh.advertise<moveit_msgs::RobotTrajectory>(PLANNING_RESULTS_TOPIC, 100);
moveit_warehouse::PlanningSceneStorage pss(vm.count("host") ? vm["host"].as<std::string>() : "",
vm.count("port") ? vm["port"].as<std::size_t>() : 0);
ros::spinOnce();
std::vector<std::string> scene_names;
pss.getPlanningSceneNames(vm["scene"].as<std::string>(), scene_names);
for (std::size_t i = 0 ; i < scene_names.size() ; ++i)
{
moveit_warehouse::PlanningSceneWithMetadata pswm;
if (pss.getPlanningScene(pswm, scene_names[i]))
{
ROS_INFO("Publishing scene '%s'", pswm->lookupString(moveit_warehouse::PlanningSceneStorage::PLANNING_SCENE_ID_NAME).c_str());
pub_scene.publish(static_cast<const moveit_msgs::PlanningScene&>(*pswm));
ros::spinOnce();
// publish optional data associated to the scene
if (req || res)
{
std::vector<moveit_warehouse::MotionPlanRequestWithMetadata> planning_queries;
std::vector<std::string> query_names;
pss.getPlanningQueries(planning_queries, query_names, pswm->name);
ROS_INFO("There are %d planning queries associated to the scene", (int)planning_queries.size());
ros::WallDuration(0.5).sleep();
for (std::size_t i = 0 ; i < planning_queries.size() ; ++i)
{
if (req)
{
ROS_INFO("Publishing query '%s'", query_names[i].c_str());
pub_req.publish(static_cast<const moveit_msgs::MotionPlanRequest&>(*planning_queries[i]));
ros::spinOnce();
}
if (res)
{
std::vector<moveit_warehouse::RobotTrajectoryWithMetadata> planning_results;
pss.getPlanningResults(planning_results, query_names[i], pswm->name);
for (std::size_t j = 0 ; j < planning_results.size() ; ++j)
{
pub_res.publish(static_cast<const moveit_msgs::RobotTrajectory&>(*planning_results[j]));
ros::spinOnce();
}
}
}
}
//.........这里部分代码省略.........
示例3: AfxGetMainWnd
void CTMTreatmentActivitybyDept::ExportHoatdongdieutri(CString szFromDate, CString szToDate, CString szDoctor)
{
CHMSMainFrame *pMF = (CHMSMainFrame*) AfxGetMainWnd();
CRecord rs(&pMF->m_db);
CString szSQL, tmpStr, tmpStr1, szFromDateLabel, szToDateLabel, szWhere,szAmount, szOutpatient, m_szStatus;
CString szDate, szSysDate;
szSysDate = pMF->GetSysDate();
CReport rpt;
szSQL = GetQueryString();
BeginWaitCursor();
_fmsg(_T("%s"), szSQL);
rs.ExecSQL(szSQL);
if (rs.IsEOF())
{
AfxMessageBox(_T("No Data"));
return;
}
CExcel xls;
xls.CreateSheet(1);
xls.SetWorksheet(0);
xls.SetColumnWidth(1, 40);
xls.SetCellMergedColumns(0, 1, 2);
xls.SetCellMergedColumns(0, 2, 2);
xls.SetCellText(0, 1, pMF->m_CompanyInfo.sc_pname,4098,true,12,0);
xls.SetCellText(0, 2, pMF->m_CompanyInfo.sc_name,4098,true,12,0);
xls.SetCellMergedColumns(0,4,14);
xls.SetCellText(0, 4, _T("\x42\xC1O \x43\xC1O HO\x1EA0T \x110\x1ED8NG TH\x45O L\x1AF\x1EE2T \x110I\x1EC0U TR\x1ECA"),4098,true,16,0);
xls.SetCellMergedColumns(0,5,12);
tmpStr.Format(_T("T\x1EEB ng\xE0y %s \x111\x1EBFn ng\xE0y %s"), CDate::Convert(m_szFromDate, yyyymmdd, ddmmyyyy), CDate::Convert(m_szToDate, yyyymmdd, ddmmyyyy));
xls.SetCellText(0, 5, tmpStr,4098,true,12,0);
int nRow = 7, age=0;
xls.SetCellText(0, nRow, _T("STT"), 528386,true);
TranslateString(_T("Dept"), tmpStr);
xls.SetCellText(1, nRow, tmpStr, 528386,true);
TranslateString(_T("Bed"), tmpStr);
xls.SetCellText(2, nRow, tmpStr, 528386,true);
TranslateString(_T("\x110\x1EA7u k\x1EF3"), tmpStr);
xls.SetCellText(3, nRow, tmpStr, 528386,true);
TranslateString(_T("Total"), tmpStr);
xls.SetCellText(4, nRow, tmpStr, 528386,true);
TranslateString(_T("Children < 6 Age"), tmpStr);
xls.SetCellText(5, nRow, tmpStr, 528386,true);
TranslateString(_T("Tr\x1EBB < 24 ng\xE0y"), tmpStr);
xls.SetCellText(6, nRow, tmpStr, 528386,true);
TranslateString(_T("Emergency"), tmpStr);
xls.SetCellText(7, nRow, tmpStr, 528386,true);
TranslateString(_T("Ng\xE0y DT"), tmpStr);
xls.SetCellText(8, nRow, tmpStr, 528386,true);
TranslateString(_T("T\x1ED5ng s\x1ED1 t\x1EED vong"), tmpStr);
xls.SetCellText(9, nRow, tmpStr, 528386,true);
TranslateString(_T("Tr\x1EBB < 6 tu\x1ED5i t\x1EED vong"), tmpStr);
xls.SetCellText(10, nRow, tmpStr, 528386,true);
TranslateString(_T("T\x1EED vong 24 ng\xE0y"), tmpStr);
xls.SetCellText(11, nRow, tmpStr, 528386,true);
TranslateString(_T("T\x1EED vong tr\x1B0\x1EDB\x63 24 gi\x1EDD"), tmpStr);
xls.SetCellText(12, nRow, tmpStr, 528386,true);
TranslateString(_T("T\x1EED vong s\x61u 24 gi\x1EDD"), tmpStr);
xls.SetCellText(13, nRow, tmpStr, 528386,true);
TranslateString(_T("BHYT"), tmpStr);
xls.SetCellText(14, nRow, tmpStr, 528386,true);
TranslateString(_T("Hospital Transfer"), tmpStr);
xls.SetCellText(15, nRow, tmpStr, 528386,true);
TranslateString(_T("T\x1ED3n \x63u\x1ED1i k\x1EF3"), tmpStr);
xls.SetCellText(16, nRow, tmpStr, 528386,true);
int nIndex = 1, SongayDT=0;
int i=0,nTotal[17];
for (i=0;i<=16;i++)
{
nTotal[i]=0;
}
while(!rs.IsEOF())
{
nRow++;
tmpStr.Format(_T("%d"), nIndex++);
xls.SetCellText(0, nRow, tmpStr, FMT_INTEGER);
rs.GetValue(_T("Deptname"), tmpStr);
xls.SetCellText(1, nRow, tmpStr, FMT_TEXT);
rs.GetValue(_T("Totalbed"), tmpStr);
nTotal[2] += ToInt(tmpStr);
xls.SetCellText(2, nRow, tmpStr, FMT_NUMBER1);
rs.GetValue(_T("oldpatient"), tmpStr);
nTotal[3] += ToInt(tmpStr);
xls.SetCellText(3, nRow, tmpStr, FMT_NUMBER1);
rs.GetValue(_T("Admission"), tmpStr);
nTotal[4] += ToInt(tmpStr);
xls.SetCellText(4, nRow, tmpStr, FMT_NUMBER1);
rs.GetValue(_T("tre15"), tmpStr);
nTotal[5] += ToInt(tmpStr);
//.........这里部分代码省略.........
示例4: flags
MeshVisualizer::MeshVisualizer(const Flags flags): flags(flags), transformationProjectionMatrixUniform(0), viewportSizeUniform(1), colorUniform(2), wireframeColorUniform(3), wireframeWidthUniform(4), smoothnessUniform(5) {
#ifndef MAGNUM_TARGET_GLES2
if(flags & Flag::Wireframe && !(flags & Flag::NoGeometryShader)) {
#ifndef MAGNUM_TARGET_GLES
MAGNUM_ASSERT_VERSION_SUPPORTED(Version::GL320);
MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::ARB::geometry_shader4);
#elif !defined(MAGNUM_TARGET_WEBGL)
MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::EXT::geometry_shader);
#endif
}
#else
if(flags & Flag::Wireframe)
MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::OES::standard_derivatives);
#endif
#ifdef MAGNUM_BUILD_STATIC
/* Import resources on static build, if not already */
if(!Utility::Resource::hasGroup("MagnumShaders"))
importShaderResources();
#endif
Utility::Resource rs("MagnumShaders");
#ifndef MAGNUM_TARGET_GLES
const Version version = Context::current().supportedVersion({Version::GL320, Version::GL310, Version::GL300, Version::GL210});
CORRADE_INTERNAL_ASSERT(!flags || flags & Flag::NoGeometryShader || version >= Version::GL320);
#elif !defined(MAGNUM_TARGET_WEBGL)
const Version version = Context::current().supportedVersion({Version::GLES310, Version::GLES300, Version::GLES200});
CORRADE_INTERNAL_ASSERT(!flags || flags & Flag::NoGeometryShader || version >= Version::GLES310);
#else
const Version version = Context::current().supportedVersion({Version::GLES300, Version::GLES200});
#endif
Shader vert = Implementation::createCompatibilityShader(rs, version, Shader::Type::Vertex);
Shader frag = Implementation::createCompatibilityShader(rs, version, Shader::Type::Fragment);
vert.addSource(flags & Flag::Wireframe ? "#define WIREFRAME_RENDERING\n" : "")
.addSource(flags & Flag::NoGeometryShader ? "#define NO_GEOMETRY_SHADER\n" : "")
#ifdef MAGNUM_TARGET_WEBGL
.addSource("#define SUBSCRIPTING_WORKAROUND\n")
#elif defined(MAGNUM_TARGET_GLES2)
.addSource(Context::current().detectedDriver() & Context::DetectedDriver::ProbablyAngle ?
"#define SUBSCRIPTING_WORKAROUND\n" : "")
#endif
.addSource(rs.get("generic.glsl"))
.addSource(rs.get("MeshVisualizer.vert"));
frag.addSource(flags & Flag::Wireframe ? "#define WIREFRAME_RENDERING\n" : "")
.addSource(flags & Flag::NoGeometryShader ? "#define NO_GEOMETRY_SHADER\n" : "")
.addSource(rs.get("MeshVisualizer.frag"));
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
std::optional<Shader> geom;
if(flags & Flag::Wireframe && !(flags & Flag::NoGeometryShader)) {
geom = Implementation::createCompatibilityShader(rs, version, Shader::Type::Geometry);
geom->addSource(rs.get("MeshVisualizer.geom"));
}
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(geom) CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({vert, *geom, frag}));
else
#endif
CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({vert, frag}));
attachShaders({vert, frag});
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(geom) attachShader(*geom);
#endif
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>(version))
#else
if(!Context::current().isVersionSupported(Version::GLES300))
#endif
{
bindAttributeLocation(Position::Location, "position");
#if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2)
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isVersionSupported(Version::GL310))
#endif
{
bindAttributeLocation(VertexIndex::Location, "vertexIndex");
}
#endif
}
CORRADE_INTERNAL_ASSERT_OUTPUT(link());
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::explicit_uniform_location>(version))
#endif
{
transformationProjectionMatrixUniform = uniformLocation("transformationProjectionMatrix");
colorUniform = uniformLocation("color");
if(flags & Flag::Wireframe) {
wireframeColorUniform = uniformLocation("wireframeColor");
wireframeWidthUniform = uniformLocation("wireframeWidth");
smoothnessUniform = uniformLocation("smoothness");
if(!(flags & Flag::NoGeometryShader))
viewportSizeUniform = uniformLocation("viewportSize");
//.........这里部分代码省略.........
示例5: update
inline void update(int p){dmin[p]=Min(dmin[ls(p)]+prev[ls(p)],dmin[rs(p)]+prev[rs(p)]);}
示例6: _debug
void CEMQtyAtExam::OnExportSelect(){
_debug(_T("%s"), CString(typeid(this).name()));
CHMSMainFrame *pMF = (CHMSMainFrame*) AfxGetMainWnd();
UpdateData(true);
CRecord rs(&pMF->m_db);
CString szSQL, szTemp, tmpStr;
CExcel xls;
BeginWaitCursor();
szSQL = GetQueryString();
rs.ExecSQL(szSQL);
_fmsg(_T("%s"), szSQL);
xls.CreateSheet(1);
xls.SetWorksheet(0);
xls.SetColumnWidth(0, 7);
xls.SetColumnWidth(1, 30);
xls.SetColumnWidth(2, 15 );
xls.SetColumnWidth(3, 15);
xls.SetColumnWidth(4, 15);
xls.SetColumnWidth(5, 15);
int nRow = 0, nCol = 0;
xls.SetCellMergedColumns(nCol, nRow, 4);
xls.SetCellMergedColumns(nCol, nRow + 1, 4);
xls.SetCellText(nCol, nRow, pMF->m_CompanyInfo.sc_pname, FMT_TEXT | FMT_CENTER, true, 10);
xls.SetCellText(nCol, nRow + 1, pMF->m_CompanyInfo.sc_name, FMT_TEXT | FMT_CENTER, true, 10);
xls.SetCellMergedColumns(nCol, nRow + 2, 4);
xls.SetCellMergedColumns(nCol, nRow + 3, 4);
xls.SetCellText(nCol, nRow + 2, _T("KH\xC1M T\x1EA0I \x43\xC1\x43 PH\xD2NG TH\x45O \x42\xC1\x43 S\x1EF8"), FMT_TEXT | FMT_CENTER, true, 13);
tmpStr.Format(_T("T\x1EEB ng\xE0y: %s \x110\x1EBFn ng\xE0y: %s"),
CDateTime::Convert(m_szFromDate, yyyymmdd|hhmmss, ddmmyyyy|hhmmss),
CDateTime::Convert(m_szToDate, yyyymmdd|hhmmss, ddmmyyyy|hhmmss));
xls.SetCellText(nCol, nRow + 3, tmpStr, FMT_TEXT | FMT_CENTER, true, 11);
xls.SetCellText(nCol, nRow + 4, _T("STT"), FMT_TEXT | FMT_CENTER, true, 11);
xls.SetCellText(nCol + 1, nRow + 4, _T("\x42\xE1\x63 s\x1EF9"), FMT_TEXT | FMT_CENTER, true, 11);
xls.SetCellText(nCol + 2, nRow + 4, _T("Ph\xF2ng kh\xE1m"), FMT_TEXT | FMT_CENTER, true, 11);
xls.SetCellText(nCol + 3, nRow + 4, _T("Qu\xE2n"), FMT_TEXT | FMT_CENTER, true, 11);
xls.SetCellText(nCol + 4, nRow + 4, _T("H\x1B0u"), FMT_TEXT | FMT_CENTER, true, 11);
xls.SetCellText(nCol + 5, nRow + 4, _T("T\x1ED5ng"), FMT_TEXT | FMT_CENTER, true, 11);
nRow += 5;
int nIndex = 1;
int nTotal1 = 0,nTotal2 = 0, nTotal3 = 0 ;
while (!rs.IsEOF())
{
szTemp.Format(_T("%d"), nIndex);
xls.SetCellText(nCol, nRow, szTemp, FMT_INTEGER);
szTemp = rs.GetValue(_T("doctorname"));
xls.SetCellText(nCol + 1, nRow, szTemp, FMT_TEXT);
szTemp = rs.GetValue(_T("bhquan"));
nTotal1 += ToInt(szTemp);
xls.SetCellText(nCol + 3, nRow, szTemp, FMT_NUMBER1);
szTemp = rs.GetValue(_T("bhhuu"));
nTotal2 += ToInt(szTemp);
xls.SetCellText(nCol + 4, nRow, szTemp, FMT_NUMBER1);
szTemp = rs.GetValue(_T("tongso"));
nTotal3 += ToInt(szTemp);
xls.SetCellText(nCol + 5, nRow, szTemp, FMT_NUMBER1);
nIndex++;
nRow++;
rs.MoveNext();
}
xls.SetCellMergedColumns(nCol, nRow, 2);
xls.SetCellText(nCol, nRow, _T("T\x1ED5ng \x63\x1ED9ng"), FMT_TEXT | FMT_CENTER, true, 12);
xls.SetCellText(nCol + 3, nRow, int2str(nTotal1), FMT_NUMBER1, true, 12 );
xls.SetCellText(nCol + 4, nRow, int2str(nTotal2), FMT_NUMBER1, true, 12 );
xls.SetCellText(nCol + 5, nRow, int2str(nTotal3), FMT_NUMBER1, true, 12 );
EndWaitCursor();
xls.Save(_T("Exports\\Tinh hinh kham benh theo bac sy.xls"));
}
示例7: rs
bool NetMgr::start()
{
auto connecters = ServerConfig::getRef().getConfigConnect(LogicServer);
for (auto con : connecters)
{
SessionID cID = SessionManager::getRef().addConnecter(con._remoteIP, con._remotePort);
SessionManager::getRef().getConnecterOptions(cID)._onSessionLinked = std::bind(&NetMgr::event_onLinked, this, _1);
SessionManager::getRef().getConnecterOptions(cID)._onSessionClosed = std::bind(&NetMgr::event_onClosed, this, _1);
SessionManager::getRef().getConnecterOptions(cID)._onBlockDispatch = [](TcpSessionPtr session, const char * begin, unsigned int len)
{
ReadStream rs(begin, len);
MessageDispatcher::getRef().dispatch(session, rs.getProtoID(), rs);
};
if (cID == InvalidSessionID)
{
LOGE("addConnecter error.");
return false;
}
if (!SessionManager::getRef().openConnecter(cID))
{
LOGE("openConnecter error.");
return false;
}
}
_innerAID = SessionManager::getRef().addAccepter(ServerConfig::getRef().getConfigListen(LogicServer)._ip, ServerConfig::getRef().getConfigListen(LogicServer)._port);
if (_innerAID == InvalidAccepterID)
{
LOGE("addAccepter error");
return false;
}
SessionManager::getRef().getAccepterOptions(_innerAID)._whitelistIP = ServerConfig::getRef().getConfigListen(LogicServer)._whiteList;
SessionManager::getRef().getAccepterOptions(_innerAID)._sessionOptions._onSessionLinked = std::bind(&NetMgr::event_onLinked, this, _1);
SessionManager::getRef().getAccepterOptions(_innerAID)._sessionOptions._onSessionClosed = std::bind(&NetMgr::event_onClosed, this, _1);
SessionManager::getRef().getAccepterOptions(_innerAID)._sessionOptions._onSessionPulse = std::bind(&NetMgr::event_onSessionPulse, this, _1);
SessionManager::getRef().getAccepterOptions(_innerAID)._sessionOptions._onBlockDispatch = DispatchFunction;
if (!SessionManager::getRef().openAccepter(_innerAID))
{
LOGE("openAccepter error");
return false;
}
else
{
LOGI("openAccepter seccuss.");
}
if (ServerConfig::getRef().getConfigListen(LogicServer)._port != 0)
{
_wAID = SessionManager::getRef().addAccepter(ServerConfig::getRef().getConfigListen(LogicServer)._wip, ServerConfig::getRef().getConfigListen(LogicServer)._wport);
if (_wAID != InvalidAccepterID)
{
SessionManager::getRef().getAccepterOptions(_wAID)._sessionOptions._onSessionLinked = std::bind(&NetMgr::event_onLinked, this, _1);
SessionManager::getRef().getAccepterOptions(_wAID)._sessionOptions._onSessionClosed = std::bind(&NetMgr::event_onClosed, this, _1);
SessionManager::getRef().getAccepterOptions(_wAID)._sessionOptions._onSessionPulse = std::bind(&NetMgr::event_onSessionPulse, this, _1);
SessionManager::getRef().getAccepterOptions(_wAID)._sessionOptions._onBlockDispatch = DispatchFunction;
SessionManager::getRef().openAccepter(_wAID);
}
}
return true;
}
示例8: rs
BOOL CFoulerDoc::OpenXLS(CString sFile)
{
int i;
double dData;
CDatabase db;
CString sSql;
CString sItem;
CString sDsn;
CODBCFieldInfo fieldinfo;
CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd();
if( pFrame->m_strExcelDriver.IsEmpty() ) return FALSE;
sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",pFrame->m_strExcelDriver,sFile);
TRY
{
db.Open(NULL,FALSE,TRUE,sDsn);// Open the db using the former created pseudo DSN
CRecordset rs( &db );// Allocate the recordset
sSql = "SELECT * FROM Data";// Build the SQL string
rs.Open(CRecordset::forwardOnly,sSql,CRecordset::readOnly);// Execute that query (implicitly by opening the recordset)
CFieldSelect dlg(&rs);
if( dlg.DoModal() == IDCANCEL )
{
rs.Close();
db.Close();
return FALSE;
}
BeginWaitCursor();
while( !rs.IsEOF() ) rs.MoveNext();
int iRecCount = (int)(rs.GetRecordCount());
rs.Close();
rs.Open(CRecordset::forwardOnly,sSql,CRecordset::readOnly);
CProgressBar* pBar = new CProgressBar();
ClearData();
InsertData( iRecCount );
for( i=0 ; i<iRecCount ; i++ )
{
rs.GetFieldValue(dlg.m_sField0,sItem);
dData = atof(sItem)+dlg.m_dCo0;
if( dlg.m_sField1 >= 0 && dlg.m_dCo1 != 0)
{
rs.GetFieldValue(dlg.m_sField1,sItem);
dData += atof(sItem)*dlg.m_dCo1;
}
if( dlg.m_sField2 >= 0 && dlg.m_dCo2 != 0)
{
rs.GetFieldValue(dlg.m_sField2,sItem);
dData += atof(sItem)*dlg.m_dCo2;
}
if( dlg.m_sField3 >= 0 && dlg.m_dCo3 != 0)
{
rs.GetFieldValue(dlg.m_sField3,sItem);
dData += atof(sItem)*dlg.m_dCo3;
}
m_pOrgData[i]->SetItem( dData );
m_iSubGroupIndex++;
if( m_iSubGroupIndex >= m_iSubGroupSize )
{
m_iSubGroupIndex = 0;
dData = 0;
for( int j=i+1-m_iSubGroupSize ; j<i+1 ; j++ )
{
dData += m_pOrgData[j]->GetItem();
}
m_pData[i/m_iSubGroupSize]->SetItem(dData/m_iSubGroupSize);
}
rs.MoveNext();
pBar->SetPos( (i<<8)/iRecCount );
}
delete pBar;
rs.Close();
db.Close();
EndWaitCursor();
return TRUE;
}
CATCH(CDBException, e)
{
return FALSE;// A db exception occured. Pop out the details...
}
END_CATCH;
}
示例9: analop_esil
//.........这里部分代码省略.........
case H8300_MOV_4BIT_2: /*TODO*/
case H8300_MOV_4BIT_3: /*TODO*/
case H8300_MOV_4BIT: /*TODO*/
return 0;
default:
break;
};
switch (opcode) {
case H8300_NOP:
r_strbuf_set (&op->esil, ",");
return 0;
case H8300_SLEEP: /* TODO */
return 0;
case H8300_STC:
r_strbuf_appendf(&op->esil, "ccr,r%u%c,=", rdB(1));
return 0;
case H8300_LDC:
r_strbuf_appendf(&op->esil, "r%u%c,ccr,=", rdB(1));
return 0;
case H8300_ORC:
r_strbuf_appendf(&op->esil, "0x%02x,ccr,|=", imm);
return 0;
case H8300_XORC:
r_strbuf_appendf(&op->esil, "0x%02x,ccr,^=", imm);
return 0;
case H8300_ANDC:
r_strbuf_appendf(&op->esil, "0x%02x,ccr,&=", imm);
return 0;
case H8300_LDC_2:
r_strbuf_appendf(&op->esil, "0x%02x,ccr,=", imm);
return 0;
case H8300_ADDB_DIRECT:
r_strbuf_appendf(&op->esil, "r%u%c,r%u%c,+=", rsB(), rdB(1));
setH_B;
setV("%o");
setC_B ;
setN;
//setZ;
maskB(1);
setZ;
return 0;
case H8300_ADDW_DIRECT:
r_strbuf_appendf (&op->esil, "r%u,r%u,+=", rs(), rd());
setH_W;
setV("%o");
setC_W;
setN;
mask();
setZ;
return 0;
case H8300_INC:
r_strbuf_appendf(&op->esil, "1,r%u%c,+=", rdB(1));
//setZ
setV("%o") ;
setN;
maskB(1);
setZ;
return 0;
case H8300_ADDS:
r_strbuf_appendf (&op->esil, "%d,r%u,+=",
((buf[1] & 0xf0) == 0x80) ? 2 : 1, rd());
return 0;
case H8300_MOV_1:
/*TODO check if flags are set internally or not*/
r_strbuf_appendf (&op->esil, "r%u%c,r%u%c,=", rsB(), rdB(1));
示例10: flags
MeshVisualizer::MeshVisualizer(const Flags flags): flags(flags), transformationProjectionMatrixUniform(0), viewportSizeUniform(1), colorUniform(2), wireframeColorUniform(3), wireframeWidthUniform(4), smoothnessUniform(5) {
#ifndef MAGNUM_TARGET_GLES
if(flags & Flag::Wireframe && !(flags & Flag::NoGeometryShader)) {
MAGNUM_ASSERT_VERSION_SUPPORTED(Version::GL320);
MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::ARB::geometry_shader4);
}
#elif defined(MAGNUM_TARGET_GLES2)
if(flags & Flag::Wireframe)
MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::OES::standard_derivatives);
#endif
Utility::Resource rs("MagnumShaders");
#ifndef MAGNUM_TARGET_GLES
const Version version = Context::current()->supportedVersion({Version::GL320, Version::GL310, Version::GL300, Version::GL210});
CORRADE_INTERNAL_ASSERT_OUTPUT(flags & Flag::NoGeometryShader || version >= Version::GL320);
#else
const Version version = Context::current()->supportedVersion({Version::GLES300, Version::GLES200});
#endif
Shader vert(version, Shader::Type::Vertex);
vert.addSource(flags & Flag::Wireframe ? "#define WIREFRAME_RENDERING\n" : "")
.addSource(flags & Flag::NoGeometryShader ? "#define NO_GEOMETRY_SHADER\n" : "")
.addSource(rs.get("compatibility.glsl"))
.addSource(rs.get("MeshVisualizer.vert"));
CORRADE_INTERNAL_ASSERT_OUTPUT(vert.compile());
vert.compile();
attachShader(vert);
#ifndef MAGNUM_TARGET_GLES
if(flags & Flag::Wireframe && !(flags & Flag::NoGeometryShader)) {
Shader geom(version, Shader::Type::Geometry);
geom.addSource(rs.get("compatibility.glsl"))
.addSource(rs.get("MeshVisualizer.geom"));
CORRADE_INTERNAL_ASSERT_OUTPUT(geom.compile());
geom.compile();
attachShader(geom);
}
#endif
Shader frag(version, Shader::Type::Fragment);
frag.addSource(flags & Flag::Wireframe ? "#define WIREFRAME_RENDERING\n" : "")
.addSource(flags & Flag::NoGeometryShader ? "#define NO_GEOMETRY_SHADER\n" : "")
.addSource(rs.get("compatibility.glsl"))
.addSource(rs.get("MeshVisualizer.frag"));
CORRADE_INTERNAL_ASSERT_OUTPUT(frag.compile());
frag.compile();
attachShader(frag);
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>(version))
#else
if(!Context::current()->isVersionSupported(Version::GLES300))
#endif
{
bindAttributeLocation(Position::Location, "position");
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isVersionSupported(Version::GL310))
#endif
{
bindAttributeLocation(VertexIndex::Location, "vertexIndex");
}
}
CORRADE_INTERNAL_ASSERT_OUTPUT(link());
link();
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_uniform_location>(version))
#endif
{
transformationProjectionMatrixUniform = uniformLocation("transformationProjectionMatrix");
colorUniform = uniformLocation("color");
if(flags & Flag::Wireframe) {
wireframeColorUniform = uniformLocation("wireframeColor");
wireframeWidthUniform = uniformLocation("wireframeWidth");
smoothnessUniform = uniformLocation("smoothness");
if(!(flags & Flag::NoGeometryShader))
viewportSizeUniform = uniformLocation("viewportSize");
}
}
/* Set defaults in OpenGL ES (for desktop they are set in shader code itself) */
#ifdef MAGNUM_TARGET_GLES
setColor(Color3(1.0f));
if(flags & Flag::Wireframe) {
setWireframeColor(Color3(0.0f));
setWireframeWidth(1.0f);
setSmoothness(2.0f);
}
#endif
}
示例11: cr
/*
* Product information screen
*/
void cr(void)
{
char *temp;
temp = calloc(81, sizeof(char));
if (utf8)
chartran_init((char *)"CP437", (char *)"UTF-8", 'B');
strncpy(pstr, clear_str(), 255);
strncat(pstr, colour_str(DARKGRAY, BLACK), 255);
/* Print top row */
strncat(pstr, (char *)"\xDA", 255);
strncat(pstr, hLine_str(76), 255);
strncat(pstr, (char *)"\xBF\r\n", 255);
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
ls();
snprintf(temp, 80, "FTND Bulletin Board System %s (%s-%s)", VERSION, OsName(), OsCPU());
strncat(pstr, pout_str(YELLOW, BLACK, padleft(temp, 76, ' ')), 255);
rs();
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
ls();
snprintf(temp, 81, "%s", COPYRIGHT);
strncat(pstr, pout_str(LIGHTCYAN, BLACK, padleft(temp, 76, ' ')), 255);
rs();
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
ls();
snprintf(temp, 81, "Compiled on %s at %s", __DATE__, __TIME__);
strncat(pstr, pout_str(LIGHTRED, BLACK, padleft(temp, 76, ' ')), 255);
rs();
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTCYAN, BLACK, (char *)"FTNd and ftnbbs was originally derived from MBSE BBS."), 255);
rs();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTCYAN, BLACK, (char *)"MBSE was written and designed by Michiel Broek. Many others gave "), 255);
rs();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTCYAN, BLACK, (char *)"valuable time in the form of new ideas and suggestions on how to make MBSE "), 255);
rs();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTCYAN, BLACK, (char *)"BBS a better BBS, which has also extended to the FTNd development "), 255);
rs();
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(WHITE, BLACK, (char *)"Available from https://ftn.rocasa.net or 1:120/544 "), 255);
rs();
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTRED, BLACK, (char *)"JAM(mbp) - Copyright 1993 Joaquim Homrighausen, Andrew Milner, "),
255);
rs();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTRED, BLACK, (char *)" Mats Birch, Mats Wallin. "), 255);
rs();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTRED, BLACK, (char *)" ALL RIGHTS RESERVED. "), 255);
rs();
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
//.........这里部分代码省略.........
示例12: sql
void Database::Execute(const ValueList& args, KValueRef result)
{
args.VerifyException("execute", "s");
if (!session)
throw ValueException::FromString("Tried to call execute, but database was closed.");
std::string sql(args.GetString(0));
GetLogger()->Debug("Execute called with %s", sql.c_str());
Statement select(*this->session);
try
{
ValueBinding binding;
select << sql;
if (args.size()>1)
{
for (size_t c=1;c<args.size();c++)
{
KValueRef anarg = args.at(c);
if (anarg->IsList())
{
KListRef list = anarg->ToList();
for (size_t a=0;a<list->Size();a++)
{
KValueRef arg = list->At(a);
binding.convert(select,arg);
}
}
else
{
binding.convert(select,anarg);
}
}
}
Poco::UInt32 count = select.execute();
GetLogger()->Debug("sql returned: %d rows for result",count);
this->SetInt("rowsAffected",count);
// get the row insert id
Statement ss(*this->session);
ss << "select last_insert_rowid()", now;
RecordSet rr(ss);
Poco::DynamicAny value = rr.value(0);
int i;
value.convert(i);
this->SetInt("lastInsertRowId",i);
if (count > 0)
{
RecordSet rs(select);
KObjectRef r = new ResultSet(rs);
result->SetObject(r);
}
else
{
KObjectRef r = new ResultSet();
result->SetObject(r);
}
}
catch (Poco::Data::DataException &e)
{
GetLogger()->Error("Exception executing: %s, Error was: %s", sql.c_str(),
e.what());
throw ValueException::FromString(e.what());
}
}
示例13: on_draw
virtual void on_draw()
{
typedef agg::renderer_base<pixfmt> renderer_base;
typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_solid;
pixfmt pixf(rbuf_window());
renderer_base rb(pixf);
renderer_solid rs(rb);
rb.clear(agg::rgba(1.0, 1.0, 1.0));
agg::rasterizer_scanline_aa<> ras;
agg::scanline_p8 sl;
double x_start = 125.0;
double x_end = initial_width() - 15.0;
double y_start = 10.0;
double y_end = initial_height() - 10.0;
double x_center = (x_start + x_end) / 2;
unsigned i;
agg::path_storage p;
agg::conv_stroke<agg::path_storage> pl(p);
agg::conv_transform<agg::conv_stroke<agg::path_storage> > tr(pl, trans_affine_resizing());
for(i = 0; i <= 16; i++)
{
double x = x_start + (x_end - x_start) * i / 16.0;
p.remove_all();
p.move_to(x+0.5, y_start);
p.line_to(x+0.5, y_end);
ras.add_path(tr);
rs.color(agg::rgba8(0, 0, 0, i == 8 ? 255 : 100));
agg::render_scanlines(ras, sl, rs);
}
double ys = y_start + (y_end - y_start) / 6.0;
p.remove_all();
p.move_to(x_start, ys);
p.line_to(x_end, ys);
ras.add_path(tr);
rs.color(agg::rgba8(0, 0, 0));
agg::render_scanlines(ras, sl, rs);
pl.width(1.0);
for(i = 0; i < m_num_filters; i++)
{
if(m_filters[i]->status())
{
m_filter_func[i]->set_radius(m_radius.value());
unsigned j;
double radius = m_filter_func[i]->radius();
unsigned n = unsigned(radius * 256 * 2);
double dy = y_end - ys;
double xs = (x_end + x_start)/2.0 - (radius * (x_end - x_start) / 16.0);
double dx = (x_end - x_start) * radius / 8.0;
p.remove_all();
p.move_to(xs+0.5, ys + dy * m_filter_func[i]->calc_weight(-radius));
for(j = 1; j < n; j++)
{
p.line_to(xs + dx * j / n + 0.5,
ys + dy * m_filter_func[i]->calc_weight(j / 256.0 - radius));
}
ras.add_path(tr);
rs.color(agg::rgba8(100, 0, 0));
agg::render_scanlines(ras, sl, rs);
p.remove_all();
unsigned xint;
int ir = int(ceil(radius) + 0.1);
for(xint = 0; xint < 256; xint++)
{
int xfract;
double sum = 0;
for(xfract = -ir; xfract < ir; xfract++)
{
double xf = xint/256.0 + xfract;
if(xf >= -radius || xf <= radius)
{
sum += m_filter_func[i]->calc_weight(xf);
}
}
double x = x_center + ((-128.0 + xint) / 128.0) * radius * (x_end - x_start) / 16.0;
double y = ys + sum * 256 - 256;
if(xint == 0) p.move_to(x, y);
else p.line_to(x, y);
}
ras.add_path(tr);
rs.color(agg::rgba8(0, 100, 0));
agg::render_scanlines(ras, sl, rs);
//.........这里部分代码省略.........
示例14: verity_read
/* reads `count' bytes from `offset', corrects possible errors with
erasure detection, and verifies the integrity of read data using
verity hash tree; returns the number of corrections in `errors' */
static ssize_t verity_read(fec_handle *f, uint8_t *dest, size_t count,
uint64_t offset, size_t *errors)
{
check(f);
check(dest);
check(offset < f->data_size);
check(offset + count <= f->data_size);
check(f->verity.hash);
check(errors);
debug("[%" PRIu64 ", %" PRIu64 ")", offset, offset + count);
rs_unique_ptr rs(NULL, free_rs_char);
std::unique_ptr<uint8_t[]> ecc_data;
if (f->ecc.start && ecc_init(f, rs, ecc_data) == -1) {
return -1;
}
uint64_t curr = offset / FEC_BLOCKSIZE;
size_t coff = (size_t)(offset - curr * FEC_BLOCKSIZE);
size_t left = count;
uint8_t data[FEC_BLOCKSIZE];
uint64_t max_hash_block = (f->verity.hash_data_blocks * FEC_BLOCKSIZE -
SHA256_DIGEST_LENGTH) / SHA256_DIGEST_LENGTH;
while (left > 0) {
check(curr <= max_hash_block);
uint8_t *hash = &f->verity.hash[curr * SHA256_DIGEST_LENGTH];
uint64_t curr_offset = curr * FEC_BLOCKSIZE;
bool expect_zeros = is_zero(f, curr_offset);
/* if we are in read-only mode and expect to read a zero block,
skip reading and just return zeros */
if (f->mode & O_RDONLY && expect_zeros) {
memset(data, 0, FEC_BLOCKSIZE);
goto valid;
}
/* copy raw data without error correction */
if (!raw_pread(f, data, FEC_BLOCKSIZE, curr_offset)) {
error("failed to read: %s", strerror(errno));
return -1;
}
if (likely(verity_check_block(f, hash, data))) {
goto valid;
}
/* we know the block is supposed to contain zeros, so return zeros
instead of trying to correct it */
if (expect_zeros) {
memset(data, 0, FEC_BLOCKSIZE);
goto corrected;
}
if (!f->ecc.start) {
/* fatal error without ecc */
error("[%" PRIu64 ", %" PRIu64 "): corrupted block %" PRIu64,
offset, offset + count, curr);
return -1;
} else {
debug("[%" PRIu64 ", %" PRIu64 "): corrupted block %" PRIu64,
offset, offset + count, curr);
}
/* try to correct without erasures first, because checking for
erasure locations is slower */
if (__ecc_read(f, rs.get(), data, curr_offset, false, ecc_data.get(),
errors) == FEC_BLOCKSIZE &&
verity_check_block(f, hash, data)) {
goto corrected;
}
/* try to correct with erasures */
if (__ecc_read(f, rs.get(), data, curr_offset, true, ecc_data.get(),
errors) == FEC_BLOCKSIZE &&
verity_check_block(f, hash, data)) {
goto corrected;
}
error("[%" PRIu64 ", %" PRIu64 "): corrupted block %" PRIu64
" (offset %" PRIu64 ") cannot be recovered",
offset, offset + count, curr, curr_offset);
dump("decoded block", curr, data, FEC_BLOCKSIZE);
errno = EIO;
return -1;
corrected:
/* update the corrected block to the file if we are in r/w mode */
if (f->mode & O_RDWR &&
!raw_pwrite(f, data, FEC_BLOCKSIZE, curr_offset)) {
error("failed to write: %s", strerror(errno));
//.........这里部分代码省略.........
示例15: rs
bool CollisionModel3DImpl::collision(CollisionModel3D* other,
int AccuracyDepth,
int MaxProcessingTime,
float* other_transform)
{
m_ColType=Models;
CollisionModel3DImpl* o=static_cast<CollisionModel3DImpl*>(other);
if (!m_Final) throw Inconsistency();
if (!o->m_Final) throw Inconsistency();
Matrix3D t=( other_transform==NULL ? o->m_Transform : *((Matrix3D*)other_transform) );
if (m_Static) t *= m_InvTransform;
else t *= m_Transform.Inverse();
RotationState rs(t);
if (AccuracyDepth<0) AccuracyDepth=0xFFFFFF;
if (MaxProcessingTime==0) MaxProcessingTime=0xFFFFFF;
DWORD EndTime,BeginTime = GetTickCount();
int num=Max(m_Triangles.size(),o->m_Triangles.size());
int Allocated=Max(64,(num>>4));
std::vector<Check> checks(Allocated);
int queue_idx=1;
Check& c=checks[0];
c.m_first=&m_Root;
c.depth=0;
c.m_second=&o->m_Root;
while (queue_idx>0)
{
if (queue_idx>(Allocated/2)) // enlarge the queue.
{
Check c;
checks.insert(checks.end(),Allocated,c);
Allocated*=2;
}
EndTime=GetTickCount();
if (EndTime >= (BeginTime+MaxProcessingTime)) throw TimeoutExpired();
// @@@ add depth check
//Check c=checks.back();
Check& c=checks[--queue_idx];
BoxTreeNode* first=c.m_first;
BoxTreeNode* second=c.m_second;
assert(first!=NULL);
assert(second!=NULL);
if (first->intersect(*second,rs))
{
int tnum1=first->getTrianglesNumber();
int tnum2=second->getTrianglesNumber();
if (tnum1>0 && tnum2>0)
{
{
for(int i=0;i<tnum2;i++)
{
BoxedTriangle* bt2=second->getTriangle(i);
Triangle tt(Transform(bt2->v1,rs.t),Transform(bt2->v2,rs.t),Transform(bt2->v3,rs.t));
for(int j=0;j<tnum1;j++)
{
BoxedTriangle* bt1=first->getTriangle(j);
if (tt.intersect(*bt1))
{
m_ColTri1=*bt1;
m_iColTri1=getTriangleIndex(bt1);
m_ColTri2=tt;
m_iColTri2=o->getTriangleIndex(bt2);
return true;
}
}
}
}
}
else
if (first->getSonsNumber()==0)
{
BoxTreeNode* s1=second->getSon(0);
BoxTreeNode* s2=second->getSon(1);
assert(s1!=NULL);
assert(s2!=NULL);
Check& c1=checks[queue_idx++];
c1.m_first=first;
c1.m_second=s1;
Check& c2=checks[queue_idx++];
c2.m_first=first;
c2.m_second=s2;
}
else
if (second->getSonsNumber()==0)
{
BoxTreeNode* f1=first->getSon(0);
BoxTreeNode* f2=first->getSon(1);
assert(f1!=NULL);
assert(f2!=NULL);
Check& c1=checks[queue_idx++];
c1.m_first=f1;
c1.m_second=second;
Check& c2=checks[queue_idx++];
//.........这里部分代码省略.........