GDCM_NAME_SPACE::CommandManager Class Reference

CommandManager base class to react on a gdcm event. More...

#include <gdcmCommandManager.h>

Inheritance diagram for GDCM_NAME_SPACE::CommandManager:

Inheritance graph
[legend]
Collaboration diagram for GDCM_NAME_SPACE::CommandManager:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void Print (std::ostream &os=std::cout, std::string const &indent="")
 Printer.
 ~CommandManager ()
 Canonical destructor.
void SetPrintLevel (int level)
 Sets the print level for the Dicom Header Elements.
int GetPrintLevel ()
 Gets the print level for the Dicom Entries.

Static Public Member Functions

static void SetCommand (const Base *object, unsigned int type, Command *command)
static CommandGetCommand (const Base *object, unsigned int type)
static bool ExecuteCommand (Base *object, unsigned int type, std::string text="")
static bool ExecuteCommandConst (const Base *object, unsigned int type, std::string text="")
static const CommandManagerGetInstance ()

Protected Member Functions

 CommandManager ()
 Constructor used when we want to generate dicom files from scratch.
void InClearCommand (void)
void InSetCommand (const Base *object, unsigned int type, Command *command)
CommandInGetCommand (const Base *object, unsigned int type)
bool InExecuteCommand (Base *object, unsigned int type, std::string text="")
bool InExecuteCommandConst (const Base *object, unsigned int type, std::string text="")

Protected Attributes

int PrintLevel
 Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.

Private Member Functions

 gdcmTypeMacro (CommandManager)

Private Attributes

CommandHT CommandList

Static Private Attributes

static CommandManager Instance

Detailed Description

CommandManager base class to react on a gdcm event.

Remarks:
The execution parameter depends on the

Definition at line 40 of file gdcmCommandManager.h.


Constructor & Destructor Documentation

GDCM_NAME_SPACE::CommandManager::~CommandManager  ) 
 

Canonical destructor.

Definition at line 41 of file gdcmCommandManager.cxx.

References GetInstance(), and InClearCommand().

00042 {
00043    if( this == GetInstance() )
00044       InClearCommand();
00045 }

GDCM_NAME_SPACE::CommandManager::CommandManager  )  [protected]
 

Constructor used when we want to generate dicom files from scratch.

Definition at line 33 of file gdcmCommandManager.cxx.

00034 {
00035 }


Member Function Documentation

bool GDCM_NAME_SPACE::CommandManager::ExecuteCommand Base object,
unsigned int  type,
std::string  text = ""
[static]
 

Definition at line 59 of file gdcmCommandManager.cxx.

References InExecuteCommand(), and Instance.

Referenced by GDCM_NAME_SPACE::PixelReadConvert::CallEndMethod(), GDCM_NAME_SPACE::FileHelper::CallEndMethod(), GDCM_NAME_SPACE::Document::CallEndMethod(), GDCM_NAME_SPACE::PixelReadConvert::CallProgressMethod(), GDCM_NAME_SPACE::FileHelper::CallProgressMethod(), GDCM_NAME_SPACE::Document::CallProgressMethod(), GDCM_NAME_SPACE::PixelReadConvert::CallStartMethod(), GDCM_NAME_SPACE::FileHelper::CallStartMethod(), and GDCM_NAME_SPACE::Document::CallStartMethod().

00060 {
00061    return(Instance.InExecuteCommand(object, type, text));
00062 }

bool GDCM_NAME_SPACE::CommandManager::ExecuteCommandConst const Base object,
unsigned int  type,
std::string  text = ""
[static]
 

Definition at line 64 of file gdcmCommandManager.cxx.

References InExecuteCommandConst(), and Instance.

Referenced by GDCM_NAME_SPACE::Debug::SendToOutput().

00065 {
00066    return(Instance.InExecuteCommandConst(object,type,text));
00067 }

GDCM_NAME_SPACE::CommandManager::gdcmTypeMacro CommandManager   )  [private]
 

Command * GDCM_NAME_SPACE::CommandManager::GetCommand const Base object,
unsigned int  type
[static]
 

Definition at line 54 of file gdcmCommandManager.cxx.

References InGetCommand(), and Instance.

Referenced by InExecuteCommand(), and InExecuteCommandConst().

00055 {
00056    return(Instance.InGetCommand(object, type));
00057 }

const CommandManager * GDCM_NAME_SPACE::CommandManager::GetInstance  )  [static]
 

Definition at line 69 of file gdcmCommandManager.cxx.

References Instance.

Referenced by ~CommandManager().

00070 {
00071    return &Instance;
00072 }

int GDCM_NAME_SPACE::Base::GetPrintLevel  )  [inline, inherited]
 

Gets the print level for the Dicom Entries.

Definition at line 50 of file gdcmBase.h.

00050 { return PrintLevel; }

void GDCM_NAME_SPACE::CommandManager::InClearCommand void   )  [protected]
 

Definition at line 76 of file gdcmCommandManager.cxx.

References CommandList.

Referenced by ~CommandManager().

00077 {
00078    CommandHT::iterator it;
00079    for(it=CommandList.begin(); it != CommandList.end(); ++it)
00080    {
00081       if( it->second )
00082          it->second->Delete();
00083    }
00084 }

bool GDCM_NAME_SPACE::CommandManager::InExecuteCommand Base object,
unsigned int  type,
std::string  text = ""
[protected]
 

Definition at line 117 of file gdcmCommandManager.cxx.

References GDCM_NAME_SPACE::Command::Execute(), GetCommand(), GDCM_NAME_SPACE::Command::SetObject(), GDCM_NAME_SPACE::Command::SetText(), and GDCM_NAME_SPACE::Command::SetType().

Referenced by ExecuteCommand().

00118 {
00119    Command *cmd = GetCommand(object,type);
00120    if( cmd )
00121    {
00122       cmd->SetText(text);
00123       cmd->SetObject(object);
00124       cmd->SetType(type);
00125       cmd->Execute();
00126       return true;
00127    }
00128    return false;
00129 }

bool GDCM_NAME_SPACE::CommandManager::InExecuteCommandConst const Base object,
unsigned int  type,
std::string  text = ""
[protected]
 

Definition at line 131 of file gdcmCommandManager.cxx.

References GDCM_NAME_SPACE::Command::Execute(), GetCommand(), GDCM_NAME_SPACE::Command::SetConstObject(), GDCM_NAME_SPACE::Command::SetText(), and GDCM_NAME_SPACE::Command::SetType().

Referenced by ExecuteCommandConst().

00132 {
00133    Command *cmd = GetCommand(object,type);
00134    if( cmd )
00135    {
00136       cmd->SetText(text);
00137       cmd->SetConstObject(object);
00138       cmd->SetType(type);
00139       cmd->Execute();
00140       return true;
00141    }
00142    return false;
00143 }

Command * GDCM_NAME_SPACE::CommandManager::InGetCommand const Base object,
unsigned int  type
[protected]
 

Definition at line 104 of file gdcmCommandManager.cxx.

References CommandList.

Referenced by GetCommand().

00105 {
00106    CommandKey key = CommandKey(object,type);
00107    try
00108    {
00109       return CommandList[key];
00110    }
00111    catch(...)
00112    {
00113       return NULL;
00114    }
00115 }

void GDCM_NAME_SPACE::CommandManager::InSetCommand const Base object,
unsigned int  type,
Command command
[protected]
 

Definition at line 86 of file gdcmCommandManager.cxx.

References CommandList, and GDCM_NAME_SPACE::RefCounter::Register().

Referenced by SetCommand().

00087 {
00088    CommandKey key = CommandKey(object, type);
00089    Command *cmd = CommandList[key];
00090    if( cmd != command )
00091    {
00092       if( cmd )
00093          cmd->Unregister();
00094       if( command )
00095       {
00096          CommandList[key] = command;
00097          command->Register();
00098       }
00099       else
00100          CommandList.erase(key);
00101    }
00102 }

void GDCM_NAME_SPACE::CommandManager::Print std::ostream &  os = std::cout,
std::string const &  indent = ""
[virtual]
 

Printer.

Reimplemented from GDCM_NAME_SPACE::Base.

Definition at line 150 of file gdcmCommandManager.cxx.

References CommandList, and GDCM_NAME_SPACE::Command::GetCommandAsString().

00151 {
00152    os<<indent<<"Command list : \n";
00153    CommandHT::iterator it;
00154    for(it=CommandList.begin();it!=CommandList.end();++it)
00155    {
00156       os<<indent<<"   "<<typeid(it->first.first).name()<<" ("<<it->first.first<<") - "
00157         <<Command::GetCommandAsString(it->first.second)
00158         <<" : "<<typeid(it->second).name()<<" ("<<it->second<<")"
00159         <<std::endl;
00160    }
00161 }

void GDCM_NAME_SPACE::CommandManager::SetCommand const Base object,
unsigned int  type,
Command command
[static]
 

Definition at line 49 of file gdcmCommandManager.cxx.

References InSetCommand(), and Instance.

00050 {
00051    Instance.InSetCommand(object, type, command);
00052 }

void GDCM_NAME_SPACE::Base::SetPrintLevel int  level  )  [inline, inherited]
 

Sets the print level for the Dicom Header Elements.

Note:
0 for Light Print; 1 for 'medium' Print, 2 for Heavy Print

Definition at line 47 of file gdcmBase.h.

Referenced by GDCM_NAME_SPACE::FileHelper::Print(), and GDCM_NAME_SPACE::DicomDir::Print().

00047 { PrintLevel = level; }


Member Data Documentation

CommandHT GDCM_NAME_SPACE::CommandManager::CommandList [private]
 

Definition at line 69 of file gdcmCommandManager.h.

Referenced by InClearCommand(), InGetCommand(), InSetCommand(), and Print().

CommandManager GDCM_NAME_SPACE::CommandManager::Instance [static, private]
 

Definition at line 68 of file gdcmCommandManager.h.

Referenced by ExecuteCommand(), ExecuteCommandConst(), GetCommand(), GetInstance(), and SetCommand().

int GDCM_NAME_SPACE::Base::PrintLevel [protected, inherited]
 

Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.

Definition at line 55 of file gdcmBase.h.

Referenced by GDCM_NAME_SPACE::SeqEntry::Print(), GDCM_NAME_SPACE::FileHelper::Print(), GDCM_NAME_SPACE::ElementSet::Print(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::DictEntry::Print(), GDCM_NAME_SPACE::DicomDirStudy::Print(), GDCM_NAME_SPACE::DicomDirSerie::Print(), GDCM_NAME_SPACE::DicomDirPatient::Print(), GDCM_NAME_SPACE::DicomDirMeta::Print(), GDCM_NAME_SPACE::DicomDir::Print(), and GDCM_NAME_SPACE::DataEntry::Print().


The documentation for this class was generated from the following files:
Generated on Fri Aug 24 12:56:26 2007 for gdcm by  doxygen 1.4.6