00001 //------------------------------------------------------------------------- 00002 // Copyright Notice 00003 // 00004 // Copyright (c) 2000, Sandia Corporation, Albuquerque, NM. 00005 //------------------------------------------------------------------------- 00006 00007 //------------------------------------------------------------------------- 00008 // Filename : $Zoltan_QueryContainer.C$ 00009 // 00010 // Purpose : Static Container object to allow Static (C-style) 00011 // functions to access methods of dynamic objects. 00012 // 00013 // Special Notes : 00014 // 00015 // Creator : Robert J. Hoekstra 00016 // 00017 // Creation Date : 08/04/2000 00018 // 00019 // Revision Information: 00020 // --------------------- 00021 // 00022 // Revision Number: $$ 00023 // 00024 // Revision Date : $$ 00025 // 00026 // Current Owner : $$ 00027 //------------------------------------------------------------------------- 00028 00029 #include <Zoltan_QueryContainer.h> 00030 00031 #include <Zoltan_QueryObject.h> 00032 00033 00034 int Zoltan::QueryContainer::CurrentObject = 0; 00035 00036 std::map< int, Zoltan::QueryObject * > Zoltan::QueryContainer::StaticMap; 00037 00038 void Zoltan::QueryContainer::setQueryID( const int & id ) 00039 { 00040 CurrentObject = id; 00041 } 00042 00043 const int & Zoltan::QueryContainer::getQueryID() 00044 { 00045 return CurrentObject; 00046 } 00047 00048 bool Zoltan::QueryContainer::registerQueryObject( const int & id, 00049 Zoltan::QueryObject * obj_ptr ) 00050 { 00051 if( StaticMap.find( id ) == StaticMap.end() ) 00052 { 00053 StaticMap[ id ] = obj_ptr; 00054 return true; 00055 } 00056 else 00057 { 00058 // Redundant id 00059 return false; 00060 } 00061 } 00062 00063 Zoltan::QueryObject * Zoltan::QueryContainer::getQueryObject( 00064 const int & id ) 00065 { 00066 if( StaticMap.find( id ) != StaticMap.end() ) 00067 { 00068 return StaticMap[ id ]; 00069 } 00070 else 00071 { 00072 // Not found 00073 return 0; 00074 } 00075 } 00076
1.3.9.1