00001 // ---------------------------------------------------------------------------- 00002 // CVS $Id: SIO_block.cc,v 1.2 2004/04/05 13:33:11 gaede Exp $ 00003 // ---------------------------------------------------------------------------- 00004 // => Base class for real I/O blocks. 00005 // ---------------------------------------------------------------------------- 00006 // 00007 // General Description: 00008 // 00009 // SIO_block is a base class from which real I/O blocks are derived. 00010 // 00011 // ---------------------------------------------------------------------------- 00012 00013 #ifdef _MSC_VER 00014 # pragma warning(disable:4786) // >255 characters in debug information 00015 #endif 00016 00017 #include "SIO_blockManager.h" 00018 #include "SIO_block.h" 00019 00020 // ---------------------------------------------------------------------------- 00021 // Constructor 00022 // ---------------------------------------------------------------------------- 00023 SIO_block::SIO_block 00024 ( 00025 const char* i_name 00026 ) 00027 : name( i_name ) 00028 { 00029 //FG 05042004: register all blocks automatically with block manager : 00030 SIO_blockManager::add( this ) ; 00031 } 00032 00033 // ---------------------------------------------------------------------------- 00034 // Destructor 00035 // ---------------------------------------------------------------------------- 00036 SIO_block::~SIO_block() 00037 { 00038 00039 // 00040 // This is tricky. Before the block can be deleted, ensure that it does not 00041 // appear in the list managed by block manager. The only way to find out if 00042 // this block is under the control of the block manager is to ask the block 00043 // manager to find this block's name in its list and return a pointer to it. 00044 // I told you this was tricky! 00045 // 00046 if( (SIO_blockManager::get( getName()->c_str() )) != NULL ) 00047 SIO_blockManager::remove( this ); 00048 00049 return; 00050 } 00051 00052 // ---------------------------------------------------------------------------- 00053 // Return block name. 00054 // ---------------------------------------------------------------------------- 00055 std::string* SIO_block::getName() { return( &name ); } 00056 00057 00058