本文整理汇总了C++中set1函数的典型用法代码示例。如果您正苦于以下问题:C++ set1函数的具体用法?C++ set1怎么用?C++ set1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addRecursive
bool addRecursive(CuckooMap* map, uint64_t key, uint64_t value, int depth)
{
if(depth > MAX_LOOP)
{
return false;
}
//if its empty in the first table, add it there
if(getKey1(map, key) == NONE)
{
set1(map, key, value);
}
//if its empty in the second table, add it there
else if(getKey2(map, key) == NONE)
{
set2(map, key, value);
}
//if both are occupied, randomly displace one and re-add the displaced one
else if((xorshf96() & 1) == 0)
{
uint64_t pushedKey = getKey1(map, key);
uint64_t pushedValue = getValue1(map, key);
set1(map, key, value);
return addRecursive(map, pushedKey, pushedValue, depth + 1);
}
else
{
uint64_t pushedKey = getKey2(map, key);
uint64_t pushedValue = getValue2(map, key);
set2(map, key, value);
return addRecursive(map, pushedKey, pushedValue, depth + 1);
}
return true;
}
示例2: handle
void handle(event me[2])
{ if(is1(flag,0)&&is1(me[1].b,0))
{ if(me[1].x>=x&&me[1].x<(x+w)&&me[1].y>=y&&me[1].y<(y+h))
set1(flag,1);
else
set0(flag,1);
}
if(is1(flag,1))
{if(me[1].key==1)
{
if(me[1].ch==8){if(no>0){no--;st[no]=0;}}
else if(me[1].ch==13){set1(flag,2);}
else if(no<num&&isalnum(me[1].ch))
{st[no]=me[1].ch;
no++;
st[no]=0;
}
}
if(me[1].key==2)
{if(me[1].ch==72)set1(flag,3);
else if(me[1].ch==80)set1(flag,4);
}
setfillstyle(SOLID_FILL,ACOL);
bar(x,y-2,x+w+1,y+h+2);
}
setfillstyle(SOLID_FILL,8);
bar(x+w1,y,x+w,y+h);
setcolor(color);
outtextxy(x+1,y+3,str);
setcolor(15);
outtextxy(x+1+w1,y+3,st);
}
示例3: dvmDdmGenerateThreadStats
/*
* Generate the contents of a THST chunk. The data encompasses all known
* threads.
*
* Response has:
* (1b) header len
* (1b) bytes per entry
* (2b) thread count
* Then, for each thread:
* (4b) threadId
* (1b) thread status
* (4b) tid
* (4b) utime
* (4b) stime
* (1b) is daemon?
*
* The length fields exist in anticipation of adding additional fields
* without wanting to break ddms or bump the full protocol version. I don't
* think it warrants full versioning. They might be extraneous and could
* be removed from a future version.
*
* Returns a new byte[] with the data inside, or NULL on failure. The
* caller must call dvmReleaseTrackedAlloc() on the array.
*/
ArrayObject* dvmDdmGenerateThreadStats(void)
{
const int kHeaderLen = 4;
const int kBytesPerEntry = 18;
dvmLockThreadList(NULL);
Thread* thread;
int threadCount = 0;
for (thread = gDvm.threadList; thread != NULL; thread = thread->next)
threadCount++;
/*
* Create a temporary buffer. We can't perform heap allocation with
* the thread list lock held (could cause a GC). The output is small
* enough to sit on the stack.
*/
int bufLen = kHeaderLen + threadCount * kBytesPerEntry;
u1 tmpBuf[bufLen];
u1* buf = tmpBuf;
set1(buf+0, kHeaderLen);
set1(buf+1, kBytesPerEntry);
set2BE(buf+2, (u2) threadCount);
buf += kHeaderLen;
pid_t pid = getpid();
for (thread = gDvm.threadList; thread != NULL; thread = thread->next) {
unsigned long utime, stime;
bool isDaemon;
if (!getThreadStats(pid, thread->systemTid, &utime, &stime)) {
// failed; drop in empty values
utime = stime = 0;
}
isDaemon = dvmGetFieldBoolean(thread->threadObj,
gDvm.offJavaLangThread_daemon);
set4BE(buf+0, thread->threadId);
set1(buf+4, thread->status);
set4BE(buf+5, thread->systemTid);
set4BE(buf+9, utime);
set4BE(buf+13, stime);
set1(buf+17, isDaemon);
buf += kBytesPerEntry;
}
dvmUnlockThreadList();
/*
* Create a byte array to hold the data.
*/
ArrayObject* arrayObj = dvmAllocPrimitiveArray('B', bufLen, ALLOC_DEFAULT);
if (arrayObj != NULL)
memcpy(arrayObj->contents, tmpBuf, bufLen);
return arrayObj;
}
示例4: eventFinish
/*
* Write the header into the buffer and send the packet off to the debugger.
*
* Takes ownership of "pReq" (currently discards it).
*/
static void eventFinish(JdwpState* state, ExpandBuf* pReq)
{
u1* buf = expandBufGetBuffer(pReq);
set4BE(buf, expandBufGetLength(pReq));
set4BE(buf+4, dvmJdwpNextRequestSerial(state));
set1(buf+8, 0); /* flags */
set1(buf+9, kJdwpEventCommandSet);
set1(buf+10, kJdwpCompositeCommand);
dvmJdwpSendRequest(state, pReq);
expandBufFree(pReq);
}
示例5: docomplete
/*ARGSUSED*/
void
docomplete(Char **v, struct command *t)
{
struct varent *vp;
Char *p;
Char **pp;
USE(t);
v++;
p = *v++;
if (p == 0)
tw_prlist(&completions);
else if (*v == 0) {
vp = adrof1(strip(p), &completions);
if (vp && vp->vec)
tw_pr(vp->vec), xputchar('\n');
else
{
#ifdef TDEBUG
xprintf("tw_find(%s) \n", short2str(strip(p)));
#endif /* TDEBUG */
pp = tw_find(strip(p), &completions, FALSE);
if (pp)
tw_pr(pp), xputchar('\n');
}
}
else
set1(strip(p), saveblk(v), &completions, VAR_READWRITE);
} /* end docomplete */
示例6: main
int
main (int argc, char** argv)
{
static bitfield a;
bitfield b = bfi1 (a);
bitfield c = bfi2 (b);
bitfield d = movk (c);
if (d.eight != 3)
abort ();
if (d.five != 7)
abort ();
if (d.sixteen != 7531)
abort ();
d = set1 (d);
if (d.five != 0x1f)
abort ();
d = set0 (d);
if (d.five != 0)
abort ();
return 0;
}
示例8: button
button(int x1,int y1)
{x=x1;y=y1;flag=0;
h=charheight+4;w=639-x1-2;
w1=textwidth(" PLAY : ");
w2=textwidth(" PAUSE : ");
set1(flag,1);
}
示例9: QToolBar
Tools_toolbar::Tools_toolbar(CGAL::Qt_widget *w, QMainWindow *mw) :
QToolBar(mw, "NT")
{
//when it is created, the toolbar has 0 buttons
nr_of_buttons = 0;
//set the widget
widget = w;
widget->attach(&getpolybut);
getpolybut.deactivate();
QIconSet set0(QPixmap( (const char**)arrow_small_xpm ),
QPixmap( (const char**)arrow_xpm ));
QIconSet set1(QPixmap( (const char**)polygon_small_xpm ),
QPixmap( (const char**)polygon_xpm ));
but[0] = new QToolButton(this, "deactivate layer");
but[0]->setIconSet(set0);
but[0]->setTextLabel("Deactivate Layer");
but[1] = new QToolButton(this, "polygon");
but[1]->setIconSet(set1);
but[1]->setTextLabel("Input Polygon");
button_group = new QButtonGroup(0, "exclusive_group");
button_group->insert(but[0]);
button_group->insert(but[1]);
button_group->setExclusive(true);
but[0]->setToggleButton(true);
but[1]->setToggleButton(true);
connect(but[1], SIGNAL(stateChanged(int)),
&getpolybut, SLOT(stateChanged(int)));
nr_of_buttons = 2;
}
示例10: TEST
TEST(TSet, compare_two_sets_of_non_equal_sizes)
{
const int size1 = 4, size2 = 6;
TSet set1(size1), set2(size2);
EXPECT_EQ(1, set1 != set2);
}
示例11: main
int main(int argc, char *argv[])
{
/* sets to be used for testing */
char s[5] = {'1','2','3','4','\0'};
char t[4] = {'1','2','3','\0'};
char u[1] = {'\0'};
char v[4] = {'x','y','z','\0'};
/* sets to contain results */
char a[SIZE];
char b[SIZE];
char c[SIZE];
char d[SIZE];
/* SetTypes for testing */
SetType set1(s);
SetType set2(t);
SetType set3(u);
/* test of is_empty. Should output "Set is empty" followed by "Set is not
empty */
set3.is_empty() ? cout << "Set is empty\n" : cout << "Set is not empty\n";
set1.is_empty() ? cout << "Set is empty\n" : cout << "Set is not empty\n";
/* test of is_equal. Should output "s is equal" followed by "t is not equal"
*/
set1.is_equal(s) ? cout << "s is equal\n" : cout << "s is not equal\n";
set1.is_equal(t) ? cout << "t is equal\n" : cout << "t is not equal\n";
/* test of is_member. Should output "4 is a member" followed by "8 is not a
member */
set1.is_member('4') ? cout << "4 is a member\n" : cout << "4 is not a member\n";
set1.is_member('8') ? cout << "8 is a member\n" : cout << "8 is not a member\n";
/* test of is_subset. Should output "t is a subset" followed by "v is not a
subset */
set1.is_subset(t) ? cout << "t is a subset\n" : cout << "t is not a subset\n";
set1.is_subset(v) ? cout << "v is a subset\n" : cout << "v is not a subset\n";
/* test of setunion. Should output all elements from s and v. Implicitly
tests the write function. */
set1.setunion(v, a);
SetType set4(a);
set4.write();
/* test of intersection. Should output all elements in both t and s. */
set1.intersection(t, b);
SetType set5(b);
set5.write();
/* test of difference. Should output all elements only in t or only in s */
set1.difference(t, d);
SetType set7(d);
set7.write();
/* return success */
return 0;
}
示例12: set1
void parser_imp::code_with_callbacks(std::function<void()> && f) {
m_script_state->apply([&](lua_State * L) {
set_io_state set1(L, m_io_state);
set_environment set2(L, m_env);
m_script_state->exec_unprotected([&]() {
f();
});
});
}
示例13: set
/*
* The caller is responsible for putting value in a safe place
*/
void
set(Char *var, Char *val)
{
Char **vec = xreallocarray(NULL, 2, sizeof(Char **));
vec[0] = val;
vec[1] = 0;
set1(var, vec, &shvhed);
}
示例14: GUI
GUI():t1(" Application on ",450,10,0),
t2("Gravitation b/w 2 mass",450,12+charheight+8,0),
e1("Mass 1 : ",450,12+3*(charheight+8),15,COL1),
e2("Mass 2 : ",450,12+4*(charheight+8),15,COL2),
e3(" X1 : ",450,12+5*(charheight+8),15,COL1),
e4(" Y1 : ",450,12+6*(charheight+8),15,COL1),
e5(" X2 : ",450,12+7*(charheight+8),15,COL2),
e6(" Y2 : ",450,12+8*(charheight+8),15,COL2),
b(450,15+17*(charheight+8)),
rb1("Motion in Monitor's ","reference frame",450,12+10*(charheight+8)),
rb2("Motion in reference","frame of C.M.",450,12+12*(charheight+8)),
scrbar(450,12+15.5*(charheight+8)),
t3("Press ESC to exit",450,12+19*(charheight+8),0)
{set1(e1.flag,0);
set1(e2.flag,0);
set1(e1.flag,1);
set1(rb1.flag,1);
set1(scrbar.flag,0);
}
示例15: SqlStatement
SqlInsert::operator SqlStatement() const {
String s = "insert into " + table.Quoted();
if(!set1.IsEmpty()) {
s << set1();
if(sel.IsValid())
s << ' ' << SqlStatement(sel).GetText();
else if(!set2.IsEmpty())
s << " values " << set2();
}
return SqlStatement(s);
}