本文整理汇总了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;
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例6: main
int main()
{
Receiver *rec = new Receiver();
Command *cmd = new ConcreteCommand(rec);
Invoker *inv = new Invoker();
inv->SetCommand(cmd);
inv->RunCommand();
}
示例7: main
int main()
{
Invoker a;
ConcreteCommand b, c, d;
a.store(&b);
a.store(&c);
a.store(&d);
a.execute();
return EXIT_SUCCESS;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
}