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


C++ Invoker类代码示例

本文整理汇总了C++中Invoker的典型用法代码示例。如果您正苦于以下问题:C++ Invoker类的具体用法?C++ Invoker怎么用?C++ Invoker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Invoker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Wait

void InvocationManager::Run()
{
    for (;;) {
        Wait();
        OpenHome::Net::Invocation* invocation = NULL;
        try {
            invocation = iWaitingInvocations.Read();
            if (invocation->Interrupt()) {
                // the service associated with this invocation is being deleted
                // complete it with an error immediately and process the next waiting
                invocation->SetError(Error::eAsync,
                                     Error::eCodeInterrupted,
                                     Error::kDescriptionAsyncInterrupted);
                invocation->SignalCompleted();
            }
            else {
                Invoker* invoker = iFreeInvokers.Read();
                invoker->Invoke(invocation);
            }
        }
        catch (FifoReadError&) {
            if (invocation != NULL) {
                invocation->SetError(Error::eAsync,
                                     Error::eCodeShutdown,
                                     Error::kDescriptionAsyncShutdown);
                invocation->SignalCompleted();
            }
            break;
        }
    }
}
开发者ID:Montellese,项目名称:ohNet,代码行数:31,代码来源:CpiService.cpp

示例2: main

int main()
{
	//invoker
	Invoker invoker;

	//command receiver--->the real object to execute command
	Light *light = new Light();
	TV *tv = new TV();

	//command
	LightCommand *lightCom = new LightCommand();
	TVCommand *tvCom = new TVCommand();

	lightCom->setReceiver(light);
	tvCom->setReceiver(tv);

	invoker.addCommand(lightCom);
	invoker.addCommand(tvCom);

	invoker.execute();

	invoker.undo();

	return 0;
}
开发者ID:iaccepted,项目名称:design-pattern,代码行数:25,代码来源:main.cpp

示例3: pClient

int LUAClient::Item(lua_State *pState) {
	// 1 => clients table
	// 2 => parameter
	if (!lua_isstring(pState, 2))
		return 0;
	Invoker* pInvoker = Script::GetCollector<Invoker>(pState,1);
	if (!pInvoker)
		return 0;
	Client* pClient(NULL);
	UInt32 size = lua_objlen(pState, 2);
	const char* id = lua_tostring(pState, 2);
	if (size == ID_SIZE)
		pClient = pInvoker->clients(id);
	else if (size == (ID_SIZE * 2))
		pClient = pInvoker->clients(Util::UnformatHex((UInt8*)id, size));
	if (!pClient) {
		string name(id, size);
		pClient = pInvoker->clients(name); // try by name!
	}
	SCRIPT_BEGIN(pState)
		if (pClient)
			SCRIPT_ADD_OBJECT(Client, LUAClient,*pClient)
	SCRIPT_END
	return pClient ? 1 : 0;
}
开发者ID:jaejungkim,项目名称:MonaServer,代码行数:25,代码来源:LUAClient.cpp

示例4: main

int main(int argc, char *argv[])
{
	Receiver *pRev = new Receiver();
	Command *pCom = new ConcreteCommand(pRev);
	Invoker* pInv = new Invoker(pCom);
	pInv->Invoke();
    return 0;
}
开发者ID:dsqiu,项目名称:qzystudy,代码行数:8,代码来源:main.cpp

示例5: main

int main(int argc, char* argv[])
{
	Reciever* rev = new Reciever();
	Command* cmd = new ConcreteCommand(rev);
	Invoker* inv = new Invoker(cmd);
	inv->Invoke();
	//printf("Hello World!\n");
	return 0;
}
开发者ID:ircc,项目名称:test-code-backup,代码行数:9,代码来源:Command_exam.cpp

示例6: main

int main()
{
    Receiver *rec = new Receiver();
    Command *cmd = new ConcreteCommand(rec);
    
    Invoker *inv = new Invoker();
    inv->SetCommand(cmd);
    
    inv->RunCommand();
}
开发者ID:lj8175,项目名称:practice,代码行数:10,代码来源:client.cpp

示例7: main

int main()
{
  Invoker a;
  ConcreteCommand b, c, d;
  a.store(&b);
  a.store(&c);
  a.store(&d);
  a.execute();
  return EXIT_SUCCESS;
}
开发者ID:MoriokaReimen,项目名称:DesignPattern,代码行数:10,代码来源:Command.cpp

示例8: test_command

void test_command()
{
	Receiver* rev = new Receiver();
	ConcreteCommand* concmd = new ConcreteCommand(rev);
	Invoker* inv = new Invoker(concmd);
	inv->Invoke();

	delete rev;
	delete concmd;
	delete inv;
}
开发者ID:lvpingjie,项目名称:design_pattern,代码行数:11,代码来源:test.cpp

示例9: lua_getmetatable

void LUAPublication::Delete(lua_State* pState, Publication& publication) {
	if (!publication.running())
		return;
	lua_getmetatable(pState, -1);
	lua_getfield(pState, -1, "|invoker");
	lua_replace(pState, -2);
	Invoker* pInvoker = (Invoker*)lua_touserdata(pState, -1);
	if (pInvoker)
		pInvoker->unpublish(publication.name());
	lua_pop(pState, 1);
}
开发者ID:fxlt,项目名称:MonaServer,代码行数:11,代码来源:LUAPublication.cpp

示例10: main

int main(int argc, char* argv[])
{
    Receiver* pReceiver = new Receiver();
    ConcreteCommand* pCommand = new ConcreteCommand(pReceiver);
    Invoker* pInvoker = new Invoker(pCommand);
    pInvoker->call();

    delete pReceiver;
    delete pCommand;
    delete pInvoker;
    return 0;
}
开发者ID:jasonblog,项目名称:design_patterns,代码行数:12,代码来源:main.cpp

示例11: main

int main(){
    Receiver *pReceiver = new Receiver();
    Command *pCommand = new ConcreteCommand(pReceiver);
    Invoker *pInvoker = new Invoker(pCommand);

    pInvoker->Invoke();

    SAFE_DELETE(pInvoker);
    SAFE_DELETE(pCommand);
    SAFE_DELETE(pReceiver);

    return 0;
}
开发者ID:evely211,项目名称:Norman,代码行数:13,代码来源:main.cpp

示例12: main

int main()
{
	Receiver* pReceiver = new Receiver();
	Command*  pCommand  = new ConcreateComand(pReceiver);
	Invoker*  pInvoker  = new Invoker(pCommand);

	pInvoker->Invoke();

	delete pInvoker;

	system("pause");

	return 0;
}
开发者ID:JustFFunny,项目名称:WorkSpace,代码行数:14,代码来源:Main.cpp

示例13: main

int main()
{

	Receiver *receiver = new Receiver();
	ConcreteCommand *command = new ConcreteCommand(receiver);

	Invoker* invoker =new Invoker();
	invoker->SetCommand(command);
	invoker->Notify();

	delete receiver;
	delete command;
	delete invoker;

//	system("pause");
	return 0;
}
开发者ID:xmuliushuo,项目名称:learn,代码行数:17,代码来源:Command.cpp

示例14: Flow

FlowStream::FlowStream(UInt64 id,const string& signature,Peer& peer,Invoker& invoker,BandWriter& band) : Flow(id,signature,_Name,peer,invoker,band),_pPublication(NULL),_state(IDLE),_numberLostFragments(0),_pListener(NULL) {
	PacketReader reader((const UInt8*)signature.c_str(),signature.length());
	reader.next(4);
	_index = reader.read7BitValue();
	Publications::Iterator it = invoker.publications(_index);
	if(it!=invoker.publications.end())
		_pPublication = it->second;
}
开发者ID:Windslash,项目名称:Cumulus,代码行数:8,代码来源:FlowStream.cpp

示例15: SCRIPT_CALLBACK

int LUAPublication::Close(lua_State *pState) {
	SCRIPT_CALLBACK(Publication, publication)
		lua_getmetatable(pState, 1);
		lua_getfield(pState, -1, "|invoker");
		lua_replace(pState, -2);

		Script::DetachDestructor(pState,1);

		Invoker* pInvoker = (Invoker*)lua_touserdata(pState, -1);
		if (!pInvoker) {
			SCRIPT_BEGIN(pState)
				SCRIPT_ERROR("You have not the handle on publication ", publication.name(), ", you can't close it")
			SCRIPT_END
		} else if (publication.running())
			pInvoker->unpublish(publication.name()); // call LUAPublication::Clear (because no destructor)

		lua_pop(pState, 1);
	SCRIPT_CALLBACK_RETURN
}
开发者ID:fxlt,项目名称:MonaServer,代码行数:19,代码来源:LUAPublication.cpp


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