Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

gdcm::CommandManager Class Reference

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

#include <gdcmCommandManager.h>

Inheritance diagram for gdcm::CommandManager:

Inheritance graph
[legend]
Collaboration diagram for gdcm::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::CommandManager::~CommandManager  ) 
 

Canonical destructor.

Definition at line 40 of file gdcmCommandManager.cxx.

References GetInstance(), and InClearCommand().

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

gdcm::CommandManager::CommandManager  )  [protected]
 

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

Definition at line 32 of file gdcmCommandManager.cxx.

00033 {
00034 }


Member Function Documentation

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

Definition at line 58 of file gdcmCommandManager.cxx.

References InExecuteCommand(), and Instance.

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

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

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

Definition at line 63 of file gdcmCommandManager.cxx.

References InExecuteCommandConst(), and Instance.

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

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

gdcm::CommandManager::gdcmTypeMacro CommandManager   )  [private]
 

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

Definition at line 53 of file gdcmCommandManager.cxx.

References InGetCommand(), and Instance.

Referenced by InExecuteCommand(), and InExecuteCommandConst().

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

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

Definition at line 68 of file gdcmCommandManager.cxx.

References Instance.

Referenced by ~CommandManager().

00069 {
00070    return &Instance;
00071 }

int gdcm::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::CommandManager::InClearCommand void   )  [protected]
 

Definition at line 75 of file gdcmCommandManager.cxx.

References CommandList.

Referenced by ~CommandManager().

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

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

Definition at line 116 of file gdcmCommandManager.cxx.

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

Referenced by ExecuteCommand().

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

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

Definition at line 130 of file gdcmCommandManager.cxx.

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

Referenced by ExecuteCommandConst().

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

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

Definition at line 103 of file gdcmCommandManager.cxx.

References CommandList.

Referenced by GetCommand().

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

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

Definition at line 85 of file gdcmCommandManager.cxx.

References CommandList, gdcm::RefCounter::Register(), and gdcm::RefCounter::Unregister().

Referenced by SetCommand().

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

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

Printer.

Reimplemented from gdcm::Base.

Definition at line 149 of file gdcmCommandManager.cxx.

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

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

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

Definition at line 48 of file gdcmCommandManager.cxx.

References InSetCommand(), and Instance.

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

void gdcm::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::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print().

00047 { PrintLevel = level; }


Member Data Documentation

CommandHT gdcm::CommandManager::CommandList [private]
 

Definition at line 69 of file gdcmCommandManager.h.

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

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

Definition at line 68 of file gdcmCommandManager.h.

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

int gdcm::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::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), gdcm::DocEntry::Print(), gdcm::DictEntry::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDir::Print(), and gdcm::DataEntry::Print().


The documentation for this class was generated from the following files:
Generated on Fri Jan 20 10:14:31 2006 for gdcm by  doxygen 1.4.4