本文整理汇总了C++中MyObject类的典型用法代码示例。如果您正苦于以下问题:C++ MyObject类的具体用法?C++ MyObject怎么用?C++ MyObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MyObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activateCallback
static void activateCallback(CoreAPI *This, Header *header, UserData userData)
{
This->activateCallback(This, header);
MyObject* m = (MyObject*)userData;
volatile unsigned short ack_data;
if (header->length - EXC_DATA_SIZE <= 2)
{
memcpy((unsigned char *)&ack_data, ((unsigned char *)header) + sizeof(Header),
(header->length - EXC_DATA_SIZE));
if (ack_data == ACK_ACTIVE_NEW_DEVICE)
{
printf("New Device");
}
else
{
if (ack_data == ACK_ACTIVE_SUCCESS)
{
m->setControl(true);
printf("active Success\n");
}
else
{
printf("Error");
}
}
}
else
{
printf("Decode Error");
}
}
示例2: setControlCallBack
static void setControlCallBack(CoreAPI *This, Header *header, UserData userData){
This->setControlCallback(This, header);
MyObject *m = (MyObject *)userData;
unsigned short ack_data = ACK_COMMON_NO_RESPONSE;
if (header->length - EXC_DATA_SIZE <= 2)
{
memcpy((unsigned char *)&ack_data, ((unsigned char *)header) + sizeof(Header),
(header->length - EXC_DATA_SIZE));
}
else
{
printf("ACK is exception,seesion id %d,sequence %d\n",
header->sessionID, header->sequenceNumber);
}
switch (ack_data)
{
case ACK_SETCONTROL_RELEASE_SUCCESS:
printf("relese control success\n");
break;
case ACK_SETCONTROL_OBTAIN_SUCCESS:
printf("obtain control sucess\n");
m->takeoff();
break;
default:
printf("fail to setControl\n");
}
}
示例3: main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
MyObject* m = new MyObject();
m->active();
return a.exec(); // Start Event Loop(这是一个死循环)
}
示例4: main
int main(int argc, char* argv[])
{
QCoreApplication app(argc, argv);
MyObject myObject;
myObject.startWorkInAThread();
return app.exec();
}
示例5: main
int main(int argc, char** argv)
{
MyObject obj;
Handle handle1(&obj);
Handle handle2 = handle1;
cout << "ref object reference count: " << obj.ReferenceCount() << endl;
}
示例6: getInstance
MyObject* MyObject::getInstance(CCPoint point ,const char * spriteName,b2World *pMyworld,ObjectType type)
{
MyObject* mySpriteNode = MyObject::create();
mySpriteNode->m_pMyworld = pMyworld;
mySpriteNode->initWithFile(spriteName);
mySpriteNode->setAnchorPoint(ccp(0.5,0.5));
mySpriteNode->setPosition(point);
switch(type)
{
case WOOD:
mySpriteNode->initPhySpriteWood();
break;
case IRON_V:
mySpriteNode->initPhySpriteIronV();
break;
case IRON_H:
mySpriteNode->initPhySpriteIronH();
break;
case TRIANGLE:
mySpriteNode->initTriangle();
break;
case CIRCLE:
mySpriteNode->initCircle();
break;
default: break;
}
return mySpriteNode;
}
示例7: ofBackground
//--------------------------------------------------------------
void testApp::setup(){
ofBackground(255, 255, 255);
MyObject *tempData = new MyObject(20, 70, 100, 500);
for(int i=0; i < NUM_USERS; i++) {
user[i].setData(tempData); // users' internal pointer points to the same data, and retains it
user[i].index = i+1; // just arbitrary unique data per user for display
}
tempData->release(); // data is released from tempData, but is still in memory because its being used by the users
}
示例8: landCallBack
static void landCallBack(CoreAPI* This, Header* header, UserData userData){
Flight::taskCallback(This, header, userData);
MyObject* m = (MyObject*)userData;
unsigned short ack_data;
if (header->length - EXC_DATA_SIZE <= 2)
{
memcpy((unsigned char *)&ack_data, ((unsigned char *)header) + sizeof(Header),
(header->length - EXC_DATA_SIZE));
m->setControl(false);
}
}
示例9: NAN_METHOD
static NAN_METHOD(New) {
if (info.IsConstructCall()) {
double value = info[0]->IsUndefined() ? 0 : info[0]->NumberValue();
MyObject *obj = new MyObject(value);
obj->Wrap(info.This());
info.GetReturnValue().Set(info.This());
} else {
const int argc = 1;
v8::Local<v8::Value> argv[argc] = {info[0]};
v8::Local<v8::Function> cons = Nan::New(constructor);
info.GetReturnValue().Set(cons->NewInstance(argc, argv));
}
}
示例10: main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QThread cThread; //creat a thread
MyObject cObject; //creat an instance of MyObject
cObject.doSetup(cThread); //pass the thread to the MyObject setup
cObject.moveToThread(&cThread); // take the object and move it to the thread
cThread.start(); //start the thread
return a.exec();
}
示例11: testMemoryProfilerTcpServer
void testMemoryProfilerTcpServer()
{
MemoryProfiler& memoryProfiler = MemoryProfiler::singleton();
memoryProfiler.setEnable(true);
ProfilerServer server;
server.listern();
MyObject obj;
Timer timer;
LoopRunnable runnable1, runnable2, runnable3;
Thread thread1(runnable1, false);
thread1.setPriority(Thread::NormalPriority);
Thread thread2(runnable2, false);
thread2.setPriority(Thread::LowPriority);
// Thread thread3(runnable3, false);
// thread3.setPriority(Thread::LowPriority);
while(true) {
obj.functionA();
// Inform the profiler we move to the next iteration
memoryProfiler.nextFrame();
server.accept();
Profiler::mSleep(1);
// Refresh and display the profiling result every 1 second
if(timer.get().asSecond() > 1)
{
{ MemoryProfiler::Scope s("system(\"cls\")");
::system("cls");
}
std::string s = makeReport(memoryProfiler);
server.update(s + "\n\n");
if(!server.connected)
std::cout << "Waiting for connection on port 5000\n";
std::cout << "Press any key to quit...\n\n";
std::cout << s << std::endl;
memoryProfiler.reset();
timer.reset();
if(_kbhit())
return;
}
}
}
示例12: NAN_METHOD
static NAN_METHOD(New) {
if (info.IsConstructCall()) {
double value = info[0]->IsNumber() ? To<double>(info[0]).FromJust() : 0;
MyObject * obj = new MyObject(value);
obj->Wrap(info.This());
info.GetReturnValue().Set(info.This());
} else {
const int argc = 1;
v8::Local<v8::Value> argv[argc] = {info[0]};
v8::Local<v8::Function> cons = Nan::New(constructor());
info.GetReturnValue().Set(
Nan::NewInstance(cons, argc, argv).ToLocalChecked());
}
}
示例13: NAN_METHOD
static NAN_METHOD(New) {
NanScope();
if (args.IsConstructCall()) {
double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue();
MyObject *obj = new MyObject(value);
obj->Wrap(args.This());
NanReturnThis();
} else {
const int argc = 1;
v8::Local<v8::Value> argv[argc] = {args[0]};
v8::Local<v8::Function> cons = NanNew(constructor);
NanReturnValue(cons->NewInstance(argc, argv));
}
}
示例14: scope
void MyObject::New(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
if (args.IsConstructCall()) {
// Invoked as constructor: `new MyObject(...)`
double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue();
MyObject* obj = new MyObject(value);
obj->Wrap(args.This());
args.GetReturnValue().Set(args.This());
} else {
// Invoked as plain function `MyObject(...)`, turn into construct call.
const int argc = 1;
Local<Value> argv[argc] = { args[0] };
Local<Function> cons = Local<Function>::New(isolate, constructor);
args.GetReturnValue().Set(cons->NewInstance(argc, argv));
}
}
示例15: generateStraightShape
void PicDisp::generateStraightShape(const DisplayConf& dpc, MyObject& obj) const
{
// needed anyway. used by the basic object
g_smoothAllocator.clear();
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 3; ++j)
{
placeSidePolygon(obj, -1, true, 1 + i, 1 + j);
}
}
for (int b = 0; b < 16; ++b)
{
bool is1 = uncub(build[b].pnt.x, build[b].pnt.y); // the face number in this slot
placeSidePolygon(obj, b, is1, build[b].pnt.x, build[b].pnt.y);
}
obj.vectorify();
obj.clacNormals(dpc.bVtxNormals);
}