X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestCommand.cxx;h=642d5c0c72bfac99f9118029648620f2ea3c010e;hb=bd7bec4c367d671a9da358584e98a8ec29bb641e;hp=84de4307369854d52e27069ef8a842c5d52d28e0;hpb=46afb30d2d016a9b1581c7ee4ca96d614a35203c;p=gdcm.git diff --git a/Testing/TestCommand.cxx b/Testing/TestCommand.cxx index 84de4307..642d5c0c 100644 --- a/Testing/TestCommand.cxx +++ b/Testing/TestCommand.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCommand.cxx,v $ Language: C++ - Date: $Date: 2005/11/28 15:20:29 $ - Version: $Revision: 1.1 $ + Date: $Date: 2007/05/23 14:18:06 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -20,9 +20,9 @@ #include "gdcmCommandManager.h" #include -#include +#include -class CommandTest : public gdcm::Command +class CommandTest : public GDCM_NAME_SPACE::Command { gdcmTypeMacro(CommandTest); gdcmNewMacro(CommandTest); @@ -46,7 +46,7 @@ private: }; static bool fctExecuted = false; -void CallbackTest(gdcm::CallbackCommand *cmd) +void CallbackTest(GDCM_NAME_SPACE::CallbackCommand *cmd) { std::cout << "Test class command... for " << typeid(cmd->GetObject()).name() @@ -56,37 +56,35 @@ void CallbackTest(gdcm::CallbackCommand *cmd) fctExecuted = true; } -int TestCommand(int argc, char *argv[]) +int TestCommand(int , char *[]) { int error=0; - gdcm::CommandManager *mgr = gdcm::CommandManager::New(); - CommandTest *cmd = CommandTest::New(); - gdcm::CallbackCommand *cbk = gdcm::CallbackCommand::New(); + GDCM_NAME_SPACE::CallbackCommand *cbk = GDCM_NAME_SPACE::CallbackCommand::New(); cbk->SetCallback(CallbackTest); - - mgr->SetCommand(2,cmd); - mgr->SetCommand(1,cbk); - + GDCM_NAME_SPACE::CommandManager::SetCommand(NULL,1,cbk); cbk->Delete(); + + CommandTest *cmd = CommandTest::New(); + GDCM_NAME_SPACE::CommandManager::SetCommand(NULL,2,cmd); cmd->Delete(); std::cout << "Test on callback function execution\n"; - mgr->ExecuteCommand(1,"Test on callback function"); + GDCM_NAME_SPACE::CommandManager::ExecuteCommand(NULL,1,"Test on callback function"); if(!fctExecuted) std::cout<<"... Failed\n"; error+=!fctExecuted; std::cout << std::endl; std::cout << "Test on command class execution\n"; - mgr->ExecuteCommand(2,"Test on command class"); + GDCM_NAME_SPACE::CommandManager::ExecuteCommand(NULL,2,"Test on command class"); if(!cmd->IsExecuted()) std::cout<<"... Failed\n"; error+=!cmd->IsExecuted(); std::cout << std::endl; std::cout << "Test on unset command execution\n"; - mgr->ExecuteCommand(3,"Test on callback function"); + GDCM_NAME_SPACE::CommandManager::ExecuteCommand(NULL,3,"Test on callback function"); std::cout << std::endl; return error;