当前位置: 首页>>代码示例>>C++>>正文


C++ MyObject类代码示例

本文整理汇总了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");
        }
    }
开发者ID:tempflying,项目名称:dji,代码行数:32,代码来源:main.cpp

示例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");
        }
    }
开发者ID:tempflying,项目名称:dji,代码行数:31,代码来源:main.cpp

示例3: main

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    MyObject* m = new MyObject();
    m->active();
    return a.exec();                // Start Event Loop(这是一个死循环)
}
开发者ID:tempflying,项目名称:dji,代码行数:8,代码来源:main.cpp

示例4: main

int main(int argc, char* argv[])
{
    QCoreApplication app(argc, argv);

    MyObject myObject;
    myObject.startWorkInAThread();

    return app.exec();
}
开发者ID:BartVandewoestyne,项目名称:Qt,代码行数:9,代码来源:main.cpp

示例5: main

int main(int argc, char** argv)
{
    MyObject obj;

    Handle handle1(&obj);

    Handle handle2 = handle1;

    cout << "ref object reference count: " << obj.ReferenceCount() << endl;
}
开发者ID:thuang136,项目名称:algorithm,代码行数:10,代码来源:bridge.cpp

示例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;

}
开发者ID:joyfish,项目名称:bombZombie,代码行数:32,代码来源:MyObject.cpp

示例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
}
开发者ID:6301158,项目名称:ofx-dev,代码行数:12,代码来源:testApp.cpp

示例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);
        }
    }
开发者ID:tempflying,项目名称:dji,代码行数:13,代码来源:main.cpp

示例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));
   }
 }
开发者ID:noahjs,项目名称:nan,代码行数:13,代码来源:objectwraphandle.cpp

示例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();
}
开发者ID:WACodeAcademy,项目名称:GUI-dev,代码行数:14,代码来源:main.cpp

示例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;
		}
	}
}
开发者ID:itana,项目名称:KIMP,代码行数:50,代码来源:TestMemoryProfilerTcpServer.cpp

示例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());
   }
 }
开发者ID:LadiesChris,项目名称:nan,代码行数:14,代码来源:wrappedobjectfactory.cpp

示例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));
    }
  }
开发者ID:az7arul,项目名称:nan,代码行数:15,代码来源:objectwraphandle.cpp

示例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));
  }
}
开发者ID:kordiak,项目名称:raspberry,代码行数:18,代码来源:myobject.cpp

示例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);
}
开发者ID:shooshx,项目名称:happysolver,代码行数:23,代码来源:PicPainter.cpp


注:本文中的MyObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。