本文整理汇总了C++中obj类的典型用法代码示例。如果您正苦于以下问题:C++ obj类的具体用法?C++ obj怎么用?C++ obj使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了obj类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: bfs
int bfs()
{
queue <obj> saf;
add.put_value(1,0,-1);
saf.push(add);
obj node;
while(!saf.empty())
{
node = saf.front();
saf.pop();
if(node.num == n)
{
return node.dist;
}
for(int i = 1;i<=n;i++)
{
for(int c = 1;c<=3;c++)
{
if(mark[i][c])
continue;
if(m[node.num][i][c])
{
if(c == node.color)
continue;
add.put_value(i,node.dist + 1,c);
saf.push(add);
mark[i][c] = true;
}
}
}//for e 1 to n
}//while saf khali nist
return -1;
}//int bfs
开发者ID:jovechiang,项目名称:solSGU,代码行数:34,代码来源:226.cpp
示例2: getExecutionLevel
int getExecutionLevel(obj o,bool setIt){
int l=0;
if(o.isInstanceOf(classAggregate)){
Aggregate a=(Aggregate)o.w;
for(int i=0;i<a.elements();i++) l=MAX(l,getExecutionLevel((a[i])));
if(setIt) o.executionLevel(l);
}else{
l=o.executionLevel();
}
return l;
}
开发者ID:gkourtis,项目名称:napl22,代码行数:11,代码来源:execute.cpp
示例3: type_err
/** op -.
* @throw type_err
*/
set operator - (const obj& o)const
{
PyObject* r = PyNumber_Subtract(_p, o.p());
if(r)
return r;
throw type_err("op - failed");
}
开发者ID:LenxWei,项目名称:py11,代码行数:10,代码来源:_set.hpp
示例4: index
/** tuple index.
* @return index if found
* @throw index_err if not found
* @throw type_err
*/
long index(const obj& o)const
{
long r = PySequence_Index(_p, o.p());
if(r == -1)
throw index_err("index failed");
return r;
}
开发者ID:LenxWei,项目名称:py11,代码行数:12,代码来源:_tuple.hpp
示例5: has
/** 'in' as 'has'.
* @throw type_err
*/
bool has(const obj& x)const
{
int r = PySequence_Contains(_p, x.p());
if(r != -1)
return r;
throw type_err("has failed");
}
开发者ID:LenxWei,项目名称:py11,代码行数:10,代码来源:_tuple.hpp
示例6: remove
/** remove an element if present
* @throw index_err if not present
* @throw err
*/
void remove(const obj& o)
{
int r = PySet_Discard(_p, o.p());
if(r == -1)
throw err("set remove failed");
else if(r == 0)
throw index_err("set remove failed");
}
开发者ID:LenxWei,项目名称:py11,代码行数:12,代码来源:_set.hpp
示例7: add
/** add an element.
* @throw val_err
*/
void add(const obj& o)
{
if(_p){
int r = PySet_Add(_p, o.p());
if(r != -1)
return;
}
throw val_err("set add failed");
}
开发者ID:LenxWei,项目名称:py11,代码行数:12,代码来源:_set.hpp
示例8: _setListener
/*
***** _Public functions.
*/
static Boolean _setListener( iOFBack inst, obj listenerObj, const fback_listener listenerFun ) {
iOFBackData data = Data(inst);
data->listenerObj = listenerObj;
data->listenerFun = listenerFun;
if( listenerObj != NULL ) {
TraceOp.trc( name, TRCLEVEL_DEBUG, __LINE__, 9999, "%s listener set for %s",
FBackOp.getId( inst ),
listenerObj->toString(listenerObj) );
}
return True;
}
开发者ID:TheMRod,项目名称:Rocrail,代码行数:14,代码来源:fback.c
示例9: init
void init()
{
glClearColor(0.4,0.8,0.9,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45,640.0/480.0,1.0,500.0);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_DEPTH_TEST);
object.load("test.obj");//load it
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
float col[]={1.0,1.0,1.0,1.0};
glLightfv(GL_LIGHT0,GL_DIFFUSE,col);
}
开发者ID:ComradeKeys,项目名称:kc_lib,代码行数:14,代码来源:main.cpp
示例10: display
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
float pos[]={-1.0,1.0,-2.0,1.0};
glLightfv(GL_LIGHT0,GL_POSITION,pos);
/* How to move 3d elements independently off each other
glPushMatrix();
glTranslatef(-6.0,0, -15.0);
glRotatef(0.0,-1.0,1.0,-1.0);
secondObject.draw();
glPopMatrix(); */
glTranslatef(-1.0,-1, -30.0);
glRotatef(angle,-1.0,1.0,-1.0);
object.draw();
}
开发者ID:ComradeKeys,项目名称:kc_lib,代码行数:18,代码来源:main.cpp
示例11: arma_extra_debug_sigprint
inline
void
op_repelem::apply_noalias(Mat<typename obj::elem_type>& out, const obj& X, const uword copies_per_row, const uword copies_per_col)
{
arma_extra_debug_sigprint();
typedef typename obj::elem_type eT;
const uword X_n_rows = obj::is_row ? uword(1) : X.n_rows;
const uword X_n_cols = obj::is_col ? uword(1) : X.n_cols;
out.set_size(X_n_rows * copies_per_row, X_n_cols * copies_per_col);
if(out.n_elem == 0) { return; }
for(uword col=0; col < X_n_cols; ++col)
{
const uword out_col_offset = col * copies_per_col;
eT* out_colptr_first = out.colptr(out_col_offset);
for(uword row=0; row < X_n_rows; ++row)
{
const uword out_row_offset = row * copies_per_row;
const eT copy_value = X.at(row, col);
for(uword row_copy=0; row_copy < copies_per_row; ++row_copy)
{
out_colptr_first[out_row_offset + row_copy] = copy_value;
}
if(copies_per_col != 1)
{
for(uword col_copy=1; col_copy < copies_per_col; ++col_copy)
{
eT* out_colptr = out.colptr(out_col_offset + col_copy);
arrayops::copy(&out_colptr[out_row_offset], &out_colptr_first[out_row_offset], copies_per_row);
}
}
}
}
}
开发者ID:RcppCore,项目名称:RcppArmadillo,代码行数:44,代码来源:op_repelem_meat.hpp
示例12: _addListener
static Boolean _addListener( iOFBack inst, obj listener ) {
iOFBackData data = Data(inst);
obj l_listener = ListOp.first( data->listeners );
while( l_listener != NULL ) {
if( l_listener == listener ) {
TraceOp.trc( name, TRCLEVEL_USER1, __LINE__, 9999, "%s: listener [%s] already registered", FBackOp.getId( inst ), listener->toString(listener) );
return True;
}
l_listener = ListOp.next( data->listeners );
};
TraceOp.trc( name, TRCLEVEL_USER1, __LINE__, 9999, "%s listener added for %s", FBackOp.getId( inst ), listener->toString(listener) );
ListOp.add( data->listeners, listener );
return True;
}
开发者ID:moritzmhmk,项目名称:Rocrail,代码行数:15,代码来源:fback.c
示例13: arma_extra_debug_sigprint
inline
void
op_repmat::apply_noalias(Mat<typename obj::elem_type>& out, const obj& X, const uword copies_per_row, const uword copies_per_col)
{
arma_extra_debug_sigprint();
typedef typename obj::elem_type eT;
const uword X_n_rows = obj::is_row ? uword(1) : X.n_rows;
const uword X_n_cols = obj::is_col ? uword(1) : X.n_cols;
out.set_size(X_n_rows * copies_per_row, X_n_cols * copies_per_col);
const uword out_n_rows = out.n_rows;
const uword out_n_cols = out.n_cols;
// if( (out_n_rows > 0) && (out_n_cols > 0) )
// {
// for(uword col = 0; col < out_n_cols; col += X_n_cols)
// for(uword row = 0; row < out_n_rows; row += X_n_rows)
// {
// out.submat(row, col, row+X_n_rows-1, col+X_n_cols-1) = X;
// }
// }
if( (out_n_rows > 0) && (out_n_cols > 0) )
{
if(copies_per_row != 1)
{
for(uword col_copy=0; col_copy < copies_per_col; ++col_copy)
{
const uword out_col_offset = X_n_cols * col_copy;
for(uword col=0; col < X_n_cols; ++col)
{
eT* out_colptr = out.colptr(col + out_col_offset);
const eT* X_colptr = X.colptr(col);
for(uword row_copy=0; row_copy < copies_per_row; ++row_copy)
{
const uword out_row_offset = X_n_rows * row_copy;
arrayops::copy( &out_colptr[out_row_offset], X_colptr, X_n_rows );
}
}
}
}
else
{
for(uword col_copy=0; col_copy < copies_per_col; ++col_copy)
{
const uword out_col_offset = X_n_cols * col_copy;
for(uword col=0; col < X_n_cols; ++col)
{
eT* out_colptr = out.colptr(col + out_col_offset);
const eT* X_colptr = X.colptr(col);
arrayops::copy( out_colptr, X_colptr, X_n_rows );
}
}
}
}
}
开发者ID:PsycoTodd,项目名称:Armadillo_OpenCV_XCode_Framework,代码行数:65,代码来源:op_repmat_meat.hpp
示例14: insert
/** insert.
*/
void insert(Py_ssize_t index, const obj& o)
{
int r = PyList_Insert(_p, index, o.p());
if(r == -1)
throw err("insert failed");
}
开发者ID:LenxWei,项目名称:py11,代码行数:8,代码来源:_list.hpp
示例15: set
set(const obj& o)
{
type_check(o);
enter(o.p());
}
开发者ID:LenxWei,项目名称:py11,代码行数:5,代码来源:_set.hpp
示例16: deserializer
deserializer(const obj& o)
: first_(reinterpret_cast<ptr_t>(&*o.begin()))
, last_(reinterpret_cast<ptr_t>(&*o.end()))
, cursor_(first_)
{
}
开发者ID:Nocte-,项目名称:hexahedra,代码行数:6,代码来源:serialize.hpp
示例17: find
/** tuple find a item.
* @return index if found, -1 otherwise
* @throw type_err
*/
long find(const obj& o)const
{
long r = PySequence_Index(_p, o.p());
return r;
}
开发者ID:LenxWei,项目名称:py11,代码行数:9,代码来源:_tuple.hpp
示例18: discard
/** discard an element if present
* @throw err
*/
void discard(const obj& o)
{
int r = PySet_Discard(_p, o.p());
if(r == -1)
throw err("set discard failed");
}
开发者ID:LenxWei,项目名称:py11,代码行数:9,代码来源:_set.hpp
示例19: tuple
tuple(const obj& o)noexcept(!PY11_ENFORCE)
{
type_check(o);
enter(o.p());
}
开发者ID:LenxWei,项目名称:py11,代码行数:5,代码来源:_tuple.hpp
示例20: oout
String oout(obj o){
return o.isInt()
? concatenateStrings(NAPL([0x),Int2String(o.w,8,16),NAPL(]))
: toString(o,false);
}
开发者ID:gkourtis,项目名称:napl3,代码行数:5,代码来源:show.cpp
注:本文中的obj类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论