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
#include "gdcmCommandManager.h"
#include <iostream>
-#include <typeinfo.h>
+#include <typeinfo>
-class CommandTest : public gdcm::Command
+class CommandTest : public GDCM_NAME_SPACE::Command
{
gdcmTypeMacro(CommandTest);
gdcmNewMacro(CommandTest);
};
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()
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;