本文整理汇总了C++中Dummy类的典型用法代码示例。如果您正苦于以下问题:C++ Dummy类的具体用法?C++ Dummy怎么用?C++ Dummy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dummy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testFollowSymbols
void testFollowSymbols()
{
//using namespace test;
Dummy dummy;
Dummy::sfunc();
Dummy::ONE;
Dummy::PI;
dummy.bla(fi);
dummy.bla("bla");
dummy.one = "one";
Dummy::Internal internal;
internal.one = "one";
Dummy::INT i;
Dummy::Values V;
Dummy::v1;
freefunc1();
freefunc2(10);
freefunc2("s");
freefunc3(dummy);
freefunc3(dummy, 10);
freefunc3(10, 10);
freefunc3(1.0);
afunc();
i;
V;
}
示例2: buildVector
void
buildVector()
{
CHECK (0 == Dummy::checksum());
{
typedef typename Table<HO>::Type Vect;
Vect table(50);
CHECK (0 == Dummy::checksum());
for (uint i=0; i<10; ++i)
create_contained_object (table[i]);
CHECK (0 < Dummy::checksum());
CHECK ( table[9]);
CHECK (!table[10]);
Dummy *rawP = table[5].get();
CHECK (rawP);
CHECK (table[5]);
CHECK (rawP == &(*table[5]));
CHECK (rawP->acc(-555) == table[5]->acc(-555));
}
CHECK (0 == Dummy::checksum());
}
示例3: checkAllocation
void
checkAllocation()
{
CHECK (0 == Dummy::checksum());
{
HO holder;
CHECK (!holder);
CHECK (0 == Dummy::checksum());
create_contained_object (holder);
CHECK (holder);
CHECK (false != bool(holder));
CHECK (bool(holder) != false);
CHECK (0 < Dummy::checksum());
CHECK ( &(*holder));
CHECK (holder->acc(2) == 2 + Dummy::checksum());
Dummy *rawP = holder.get();
CHECK (rawP);
CHECK (holder);
CHECK (rawP == &(*holder));
CHECK (rawP->acc(-5) == holder->acc(-5));
TRACE (test, "holder at %p", &holder);
TRACE (test, "object at %p", holder.get() );
TRACE (test, "size(object) = %zu", sizeof(*holder));
TRACE (test, "size(holder) = %zu", sizeof(holder));
}
CHECK (0 == Dummy::checksum());
}
示例4: main
int main () {
Dummy a;
Dummy* b = &a;
if ( b->isitme(a) )
cout << "yes, &a is b\n";
return 0;
}
示例5: main1
int main1()
{
Dummy a;
Dummy* b = &a;
if ( b->isitme(a) )
cout << "yes, it's me, silly\n";
return 0;
}
示例6: main
int main()
{
Dummy dummy, dumbo;
Dummy* pdummy = &dummy;
printf("%s\n", pdummy->isitme(dummy) ? "true" : "false");
printf("%s\n", pdummy->isitme(dumbo) ? "true" : "false");
}
示例7: Dummy
Element* Dummy::_compare(Element*& _ele, std::vector< std::pair< Unknown*, Element* > >& unknwons)
{
Function* appl = _ele->cast< Function > ();
if (appl) {
ForAll* forAll = _type->cast< ForAll > ();
if (forAll) {
Element *applVar = appl->getVar();
Element *allVar = forAll->getVar();
Element *allVar2 = allVar->compare(applVar, unknwons);
allVar->remove();
for (std::vector< std::pair< Unknown*, Element* > >::iterator it = unknwons.begin(); it != unknwons.end(); ++it) {
Element* t = it->second->step(0);
it->second->remove();
it->second = t;
}
Element *applTerm = appl->getTerm();
Element *allTerm = forAll->getTerm();
Element *allTermDummy = new Dummy (allTerm);
allTermDummy->copy();
Element *allTermDummy2 = allTermDummy->compare(applTerm, unknwons);
allTermDummy->remove();
Element *error = new NamedVar<Error>(Error());
error->copy();
for (std::vector< std::pair< Unknown*, Element* > >::iterator it = unknwons.begin(); it != unknwons.end(); ++it) {
Element* t = it->second->replace(error, 0);
it->second->remove();;
it->second = t;
}
error->remove();
if (!(allTermDummy2 && allVar2))
return 0;
Element *allTermDummy2Type = allTermDummy2->cast<Dummy>()->type();
Element* result = (new Dummy ((new ForAll (allVar2, allTermDummy2Type))->copy()))->copy();
_ele = new Function (applVar, applTerm);
_ele = _ele->copy();
return result->copy();
}
}
else {
Element* _ele_type = _ele->type();
Element* _type2 = _type->compare(_ele_type, unknwons);
if (!_type2)
return 0;
for (std::vector< std::pair< Unknown*, Element* > >::iterator it = unknwons.begin(); it != unknwons.end(); ++it) {
_ele = _ele->replaceNamed(it->second, Unknown::REPLACE_ELEMENT, it->first);
}
Dummy* result = new Dummy(_type2);
return result->copy();
}
}
示例8: ifs
DataSet::DataSet(bool classAtStart, string file, double ratio)
{
name = file;
uniqueClasses=0;
//int classC=0;
classes = new vector<string>;
data = new vector< vector<double>* >;
ifstream ifs(file.c_str());
if(!ifs.good())
return;
char buf[4096];
string strBuf;
string * tmpStr;
while(!ifs.eof()){
ifs.getline(buf,sizeof buf);
strBuf = buf;
if(strBuf.length()==0)
break;
if(classAtStart){
if(!isIn(classes,*getNext(strBuf)))
uniqueClasses++;
classes->push_back(*getNext(strBuf));
strBuf = getRest(strBuf);
}else{
if(!isIn(classes,*getLast(strBuf)))
uniqueClasses++;
classes->push_back(*getLast(strBuf));
strBuf = getRestEnd(strBuf);
}
vector<double> * intvector = new vector<double>;
while((tmpStr = getNext(strBuf)) != 0){
intvector->push_back(atof(tmpStr->c_str()));
strBuf = getRest(strBuf);
}
data->push_back(intvector);
}
ifs.close();
cerr << "read "<<data->size()<<" datapoints, with "<<data->at(0)->size()<<" paramaters classes: "<<classes->size()<<" unique:"<<uniqueClasses<<"\n";
tests = (int)(data->size()*ratio);
trainings = data->size()-tests;
Dummy myDummy;
int ** tmpCoord = myDummy.randomCoords(data->size(),0);
trainCoords = new int [trainings];
testCoords = new int [tests];
int c = 0;
for(;c<tests;c++)
testCoords[c] = tmpCoord[c][0];
for(;c<(tests+trainings);c++)
trainCoords[(c-tests)] = tmpCoord[c][0];
cerr << "tests: "<<tests<<" trainings: "<<trainings<<endl;
}
示例9: main
int main ()
{
Dummy master;
printf("\nMaster before load :\n");
master.print();
printf("--------------------\n");
load("load_test.bundle", "init", master);
printf("Master after load \n");
master.print();
printf("--------------------\n");
}
示例10: Dummy_addSomething
/** float dummy::Dummy::addSomething(float value)
* include/dummy/dummy.h:64
*/
static int Dummy_addSomething(lua_State *L) {
try {
Dummy *self = *((Dummy **)dub_checksdata(L, 1, "dummy.Dummy"));
float value = dub_checknumber(L, 2);
lua_pushnumber(L, self->addSomething(value));
return 1;
} catch (std::exception &e) {
lua_pushfstring(L, "addSomething: %s", e.what());
} catch (...) {
lua_pushfstring(L, "addSomething: Unknown exception");
}
return dub_error(L);
}
示例11: Dummy_callback
/** float dummy::Dummy::callback(const char *func, float value)
* include/dummy/dummy.h:47
*/
static int Dummy_callback(lua_State *L) {
try {
Dummy *self = *((Dummy **)dub_checksdata(L, 1, "dummy.Dummy"));
const char *func = dub_checkstring(L, 2);
float value = dub_checknumber(L, 3);
lua_pushnumber(L, self->callback(func, value));
return 1;
} catch (std::exception &e) {
lua_pushfstring(L, "callback: %s", e.what());
} catch (...) {
lua_pushfstring(L, "callback: Unknown exception");
}
return dub_error(L);
}
示例12: main
int main()
{
Dumbo dumbo(0);
Dumbo dumby = dumbo; // this produces a segfault at the end of main, because delete gets called twice on the same address
dumby.set(100);
printf("dumbo.get() returns %d\n", dumbo.get());
printf("dumby.get() returns %d\n", dumby.get());
Dummy dummy(0);
Dummy dumpy = dummy; // this produces a segfault at the end of main, because delete gets called twice on the same address
dumpy.set(100);
printf("dummy.get() returns %d\n", dummy.get());
printf("dumpy.get() returns %d\n", dumpy.get());
}
示例13: DirectionShow
void Unit::DirectionShow() const
{
float power = m_MovePower.Length();
Vec2 dir = m_MovePower / power;
Vec2 temp = m_Pos;
static Dummy dummy;
auto length = static_cast<size_t>(power * m_Speed / m_MovePowerFrict / m_MovePowerLimit);
for (size_t i = 0; i < length; ++i)
{
temp += dir;
dummy.SetPos(temp);
dummy.Render();
}
}
示例14: main
int main()
{
Dummy *d = new Dummy;
Bucket *b = new Bucket();
d->next = b;
b->prev = d;
for(int i = 2; i < 100; i++)
{
d->process(i);
}
delete d;
return 0;
}
示例15: START_SECTION
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
Dummy* ptr = 0;
Dummy* nullPointer = 0;
START_SECTION((PersistentObject()))
ptr = new Dummy();
TEST_NOT_EQUAL(ptr, nullPointer)
END_SECTION
START_SECTION((~PersistentObject()))
delete ptr;
END_SECTION
START_SECTION((const UID& getPersistenceId() const))
Dummy tmp;
TEST_EQUAL(tmp.getPersistenceId(),0)
END_SECTION
START_SECTION((void setPersistenceId(const UID& persistence_id)))
Dummy tmp;
tmp.setPersistenceId(4711);
TEST_EQUAL(tmp.getPersistenceId(),4711)
END_SECTION
START_SECTION((void clearId(bool deep = true)))
Dummy tmp;
tmp.setPersistenceId(4711);
tmp.clearId(false);
TEST_EQUAL(tmp.getPersistenceId(),0)
TEST_EQUAL(tmp.subobjectsClear(),false)