本文整理汇总了C++中Row函数的典型用法代码示例。如果您正苦于以下问题:C++ Row函数的具体用法?C++ Row怎么用?C++ Row使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool PatternTable::read(const char *filename) {
ifstream ifs;
ifs.open(filename);
if ( !ifs.is_open() ) return false;
string line;
while ( getline(ifs, line) ) {
Core::trim(line);
if ( line.empty() ) continue;
if ( line[0] == '#' ) continue;
vector<string> cols;
Core::split(cols, line.c_str(), " ");
if ( cols.size() == 4 )
_rows.push_back(Row(Key(cols[0], cols[1]), Value(cols[2], cols[3])));
else if ( cols.size() == 3 )
_rows.push_back(Row(Key(cols[0], cols[1]), Value(cols[2], "")));
}
return true;
}
示例2: FldToStr
std::string FldToStr(FLD f)
{
if (f == NF)
return "-";
char buf[3];
buf[0] = static_cast<char>('a' + Col(f));
buf[1] = static_cast<char>('8' - Row(f));
buf[2] = 0;
return std::string(buf);
}
示例3: exit
double Matrix::Trace() const {
if (!IsSquare()) {
throw "Exception : Not a square matrixe.\n";
exit(EXIT_FAILURE);
}
double f = 0.0;
for (int i = 0; i < Row(); i++) {
f += (*this)(i, i);
}
return f;
}
示例4: Render
void Render(double time)
{
gl.Clear().ColorBuffer().DepthBuffer();
auto cameraMatrix = CamMatrixf::Orbiting(
Vec3f(0.0f, 3.0f, 0.0f),
8.0f,
FullCircles(time / 12.0),
Degrees(SineWave(time / 20.0) * 80)
);
plane.Bind();
plane_prog.Use();
Uniform<Mat4f>(plane_prog, "CameraMatrix").Set(cameraMatrix);
gl.DrawArrays(PrimitiveType::TriangleStrip, 0, 4);
gl.Enable(Capability::Blend);
volume.Bind();
volume_prog.Use();
Uniform<Mat4f>(volume_prog, "CameraMatrix").Set(cameraMatrix);
Uniform<Vec3f>(volume_prog, "ViewX").Set(
cameraMatrix.Row(0).xyz()
);
Uniform<Vec3f>(volume_prog, "ViewY").Set(
cameraMatrix.Row(1).xyz()
);
Uniform<Vec3f>(volume_prog, "ViewZ").Set(
cameraMatrix.Row(2).xyz()
);
gl.DrawArraysInstanced(
PrimitiveType::Points,
0, 1,
samples
);
gl.Disable(Capability::Blend);
}
示例5: findObject
mtp::u32 MtpObjectsModel::createDirectory(const QString &name, mtp::AssociationType type)
{
QModelIndex existingDir = findObject(name);
if (existingDir.isValid())
return _rows.at(existingDir.row()).ObjectId;
mtp::u32 storageId = _storageId != mtp::Session::AllStorages? _storageId: mtp::Session::Device;
mtp::Session::NewObjectInfo noi = _session->CreateDirectory(toUtf8(name), _parentObjectId, storageId, type);
beginInsertRows(QModelIndex(), _rows.size(), _rows.size());
_rows.push_back(Row(noi.ObjectId));
endInsertRows();
return noi.ObjectId;
}
示例6: assert
void
RowFormWidget::Add(Row::Type type, Window *window)
{
assert(IsDefined());
#ifndef USE_GDI
assert(window->GetParent() == GetWindow());
#endif
assert(window->IsVisible());
/* cannot append rows after a REMAINING row */
assert(rows.empty() || rows.back().type != Row::Type::REMAINING);
rows.push_back(Row(type, window));
}
示例7: Render
void Render(double time)
{
gl.Clear().ColorBuffer().DepthBuffer();
auto lightPos = light_path.Position(time * 0.05);
auto cameraMatrix = CamMatrixf::Orbiting(
Vec3f(),
4.5f,
Degrees(0),
Degrees(SineWave(time / 20.0) * 80)
);
light.Bind();
light_prog.Use();
Uniform<Vec3f>(light_prog, "LightPos").Set(lightPos);
Uniform<Mat4f>(light_prog, "CameraMatrix").Set(cameraMatrix);
sphere_instr.Draw(sphere_indices);
clouds.Bind();
cloud_prog.Use();
Uniform<Vec3f>(cloud_prog, "LightPos").Set(lightPos);
Uniform<Mat4f>(cloud_prog, "CameraMatrix").Set(cameraMatrix);
Uniform<Vec4f>(cloud_prog, "ViewX").Set(cameraMatrix.Row(0));
Uniform<Vec4f>(cloud_prog, "ViewY").Set(cameraMatrix.Row(1));
Uniform<Vec4f>(cloud_prog, "ViewZ").Set(cameraMatrix.Row(2));
for(std::size_t i=0, n=positions.size(); i!=n; ++i)
{
cloud_tex[i].Bind(Texture::Target::_3D);
gl.DrawArraysInstanced(
PrimitiveType::Points,
i, 1,
samples
);
}
}
示例8: Row
WgTableHook * WgTableHook::PrevInRow() const
{
WgTableRow* pRow = Row();
int col = ColumnNb()-1;
while( col >= 0 )
{
if( pRow->m_pCells[col].Widget() )
return &pRow->m_pCells[col];
col--;
}
return 0;
}
示例9: ChangeToRow
void EditCoursesMenu::Down()
{
if( m_bInSongMenu )
{
m_SongMenu.Down();
return;
}
if( CanGoDown() )
{
ChangeToRow( Row(m_SelectedRow+1) );
m_soundChangeRow.Play();
}
}
示例10: log_debug
Row Result::getRow(size_type tup_num) const
{
log_debug("mysql_data_seek(" << tup_num << ')');
::mysql_data_seek(result, tup_num);
log_debug("mysql_fetch_row");
MYSQL_ROW row = ::mysql_fetch_row(result);
if (row == 0)
throw MysqlError("mysql_fetch_row", mysql);
const IResult* resc = this;
IResult* res = const_cast<IResult*>(resc);
return Row(new ResultRow(tntdb::Result(res), result, row));
}
示例11: loadRow
void F4Res::makeMatrix()
{
auto& myframe = mFrame.level(mThisLevel);
long r = 0;
long comp = 0;
for (auto it = myframe.begin(); it != myframe.end(); ++it)
{
if (it->mDegree == mThisDegree)
{
mSPairs.push_back(Row());
mSPairComponents.push_back(comp);
Row& row = mSPairs[r];
r++;
row.mLeadTerm = it->mMonom;
loadRow(row);
if (M2_gbTrace >= 4)
if (r % 5000 == 0)
std::cout << "makeMatrix sp: " << r << " #rows = " << mColumns.size() << std::endl;
}
comp++;
}
// Now we process all monomials in the columns array
while (mNextReducerToProcess < mColumns.size())
{
// Warning: mReducers is being appended to during 'loadRow', and
// since we act on the Row directly, it might get moved on us!
// (actually, it did get moved, which prompted this fix)
Row thisrow;
std::swap(mReducers[mNextReducerToProcess], thisrow);
loadRow(thisrow);
std::swap(mReducers[mNextReducerToProcess], thisrow);
mNextReducerToProcess++;
if (M2_gbTrace >= 4)
if (mNextReducerToProcess % 5000 == 0)
std::cout << "makeMatrix red: " << mNextReducerToProcess << " #rows = " << mReducers.size() << std::endl;
}
#if 0
std :: cout << "-- reducer matrix --" << std::endl;
debugOutputMatrix(mReducers);
debugOutputMatrixSparse(mReducers);
std :: cout << "-- spair matrix --" << std::endl;
debugOutputMatrix(mSPairs);
debugOutputMatrixSparse(mSPairs);
#endif
reorderColumns();
}
示例12: src_rect
void SimpleSurface::BlitTo (const RenderTarget &outDest, const Rect &inSrcRect, int inPosX, int inPosY, BlendMode inBlend, const BitmapCache *inMask, uint32 inTint) const {
if (!mBase)
return;
// Translate inSrcRect src_rect to dest ...
Rect src_rect (inPosX, inPosY, inSrcRect.w, inSrcRect.h);
// clip ...
src_rect = src_rect.Intersect (outDest.mRect);
if (inMask)
src_rect = src_rect.Intersect (inMask->GetRect ());
// translate back to source-coordinates ...
src_rect.Translate (inSrcRect.x-inPosX, inSrcRect.y - inPosY);
// clip to origial rect...
src_rect = src_rect.Intersect (inSrcRect);
if (src_rect.HasPixels ()) {
bool src_alpha = (mPixelFormat == pfAlpha);
bool dest_alpha = (outDest.mPixelFormat == pfAlpha);
int dx = inPosX + src_rect.x - inSrcRect.x;
int dy = inPosY + src_rect.y - inSrcRect.y;
// Check for overlap....
if (src_alpha == dest_alpha) {
int size_shift = (!src_alpha ? 2 : 0); //fix for IDX8
int d_base = (outDest.mSoftPtr - mBase);
int y_off = d_base / mStride;
int x_off = (d_base - y_off * mStride) >> size_shift;
Rect dr (dx + x_off, dy + y_off, src_rect.w, src_rect.h);
if (src_rect.Intersect (dr).HasPixels ()) {
SimpleSurface sub (src_rect.w, src_rect.h, mPixelFormat);
Rect sub_dest (0, 0, src_rect.w, src_rect.h);
for (int y = 0; y < src_rect.h; y++)
memcpy ((void *)sub.Row (y), Row (src_rect.y + y) + (src_rect.x << size_shift), src_rect.w << size_shift);
sub.BlitTo (outDest, sub_dest, dx, dy, inBlend, 0, inTint);
return;
}
}
示例13: NextInRow
WgTableHook * WgTableHook::NextInTable() const
{
WgTableHook * p = NextInRow();
if( !p )
{
WgTableRow* pRow = Row()->Next();
while( pRow && !p )
{
p = pRow->FirstHook();
pRow = pRow->Next();
}
}
return p;
}
示例14: DoMove
POSITION DoMove (POSITION position, MOVE move)
{
char board[BOARD_SIZE];
int current_player = generic_hash_turn(position);
int move_position = Unhasher_Index(move);
int row = Row (move_position);
int col = Column (move_position);
int direction = Unhasher_Direction(move);
int new_position = Index(row + dir_increments[direction][0], \
col + dir_increments[direction][1]);
generic_hash_unhash (position, board);
board[new_position] = board[move_position];
board[move_position] = (char) EMPTY_PIECE;
return generic_hash_hash(board, (current_player == PLAYER1_TURN ? PLAYER2_TURN : PLAYER1_TURN));
}
示例15: row
Matrix::Matrix(int row, int column, double initValue) : row(row), column(column) {
if (Row() < 1 || Column() < 1) {
throw "Exception : Invailed matrix size.\n";
exit(EXIT_FAILURE);
}
this->values = new double[Size()];
if (!Values()) {
throw "Exception : Can not allocate memory.\n";
exit(EXIT_FAILURE);
}
for (long i = 0; i < Size(); i++) {
(*this)(i) = initValue;
}
}