クラス Onikiri::ParamDB

#include <ParamDB.h>

Onikiri::ParamDBのコラボレーション図

Collaboration graph
[凡例]
すべてのメンバ一覧

Public メソッド

void AddParameter (const String &paramExp)
void AddUserDefaultParam (const String &xmlString)
String DumpResultXML (const String &level, const String &filter)
void Finalize ()
template<class T>
bool Get (const ParamXMLPath &path, T *val, const Binding< T > *bindings, int bindingsSize, bool required=true)
template<class T>
bool Get (const ParamXMLPath &path, std::vector< T > *val, bool required=true)
template<class T, int N>
bool Get (const ParamXMLPath &path, T(*val)[N], bool required=true)
template<class T>
bool Get (const ParamXMLPath &path, T *val, bool required=true)
bool Get (const ParamXMLPath &path, String *val, bool required=true)
size_t GetElementCount (const ParamXMLPath &path)
bool GetSourceXMLFile (const ParamXMLPath &parameterPath, String &sourceFile)
const std::vector< ParamXMLTree::InputInfo > & GetXMLFileNames ()
ParamXMLTreeGetXMLTree ()
bool Initialize (const String &initialPath)
void LoadParameters (const std::vector< String > &)
void LoadXMLFile (const String &)
 ParamDB ()
template<class T>
void Set (const ParamXMLPath &path, const T &param, const Binding< T > *bindings, int bindingsSize)
template<class T>
void Set (const ParamXMLPath &path, const std::vector< T > &val)
template<class T, int N>
void Set (const ParamXMLPath &path, const T(&val)[N])
template<class T>
void Set (const ParamXMLPath &path, const T &param)
void Set (const ParamXMLPath &path, const String &)
 ~ParamDB ()

Protected 型

typedef ParamXMLTree::AttributeMap XMLAttributeMap
typedef ParamXMLTree::ChildMap XMLChildMap
typedef ParamXMLTree::Node XMLNode
typedef ParamXMLTree::NodeArray XMLNodeArray
typedef ParamXMLTree::NodePtr XMLNodePtr

Protected メソッド

void AddExternalParameterToList (const String &name, const String &value)
void CheckResultXML (const String &path, XMLNodePtr node, int *warningCount)
String CompletePath (const String &target, const String &basePath)
bool FilterResultXML (const String &path, XMLNodePtr node, const std::vector< String > &filterList)
bool MatchFilterList (const String &str, const std::vector< String > &filterList) const
String RemoveFileName (const String &path)
void ToParam (std::string *dst, const ParamXMLPath &path, const String &str)
void ToParam (String *dst, const ParamXMLPath &path, const String &str)
void ToParam (bool *dst, const ParamXMLPath &path, const String &str)
template<class T>
void ToParam (T *dst, const ParamXMLPath &path, const String &str)
template<class T>
void ToParamRaw (T *dst, const ParamXMLPath &path, const String &str)
template<class T>
String ToString (const ParamXMLPath &path, const T &param)

Protected 変数

bool m_initialized
String m_initialPath
bool m_isLoaded
ParamXMLTree m_tree
bool m_userParamPassed

構成

struct  Binding

説明

ParamDB.h44 行で定義されています。


型定義

typedef ParamXMLTree::AttributeMap Onikiri::ParamDB::XMLAttributeMap [protected]

ParamDB.h51 行で定義されています。

typedef ParamXMLTree::ChildMap Onikiri::ParamDB::XMLChildMap [protected]

ParamDB.h50 行で定義されています。

typedef ParamXMLTree::Node Onikiri::ParamDB::XMLNode [protected]

ParamDB.h47 行で定義されています。

typedef ParamXMLTree::NodeArray Onikiri::ParamDB::XMLNodeArray [protected]

ParamDB.h49 行で定義されています。

typedef ParamXMLTree::NodePtr Onikiri::ParamDB::XMLNodePtr [protected]

ParamDB.h48 行で定義されています。


コンストラクタとデストラクタ

ParamDB::ParamDB (  ) 

ParamDB.cpp53 行で定義されています。

参照先 m_initializedm_userParamPassed.

00054 {
00055     m_initialized = false;
00056     m_userParamPassed = false;
00057 }

ParamDB::~ParamDB (  ) 

ParamDB.cpp59 行で定義されています。

00060 {
00061     
00062 }


関数

void ParamDB::AddExternalParameterToList ( const String name,
const String value 
) [protected]

ParamDB.cpp185 行で定義されています。

参照先 Onikiri::ParamXMLTree::CreateNewNode()Onikiri::ParamXMLTree::GetNodeArray()m_treename.

参照元 AddParameter()LoadXMLFile().

00186 {
00187     ParamXMLTree::NodeArray* inputList = 
00188         m_tree.GetNodeArray( "/Session/InputList/Input", true );
00189 
00190     ParamXMLTree::NodePtr node = m_tree.CreateNewNode( "Input" );
00191     inputList->push_back( node );
00192 
00193     ParamXMLTree::NodePtr attr = m_tree.CreateNewNode( name );
00194     attr->value = value;
00195     attr->accessed = true;
00196     node->attributes[name] = attr;
00197 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void ParamDB::AddParameter ( const String paramExp  ) 

ParamDB.cpp200 行で定義されています。

参照先 AddExternalParameterToList()Onikiri::ParamXMLTree::Get()Onikiri::ParamXMLTree::LoadValue()m_treem_userParamPassedOnikiri::String::split()THROW_RUNTIME_ERROROnikiri::ParamXMLPath::ToString().

参照元 LoadParameters().

00201 {
00202     const vector<String>& exp = paramExp.split("=");
00203     if(exp.size() != 2 || exp[0].size() == 0){
00204         THROW_RUNTIME_ERROR( 
00205             "'%s' is invalid expressoion.", 
00206             paramExp.c_str() );
00207     }
00208 
00209     // Expand the XML path
00210     String strPath;
00211     if(exp[0].at(0) == '/')
00212         strPath = exp[0];
00213     else
00214         strPath = String("/Session/") + exp[0];
00215     
00216     for( int i = 0; i < g_pathReductionMapSize; i++ ){
00217         String reductionPath = g_pathReductionMap[i].reductionPath;
00218         size_t pos =  strPath.find( reductionPath );
00219         if( pos == 0 ){
00220             strPath.replace( 
00221                 pos, reductionPath.length() , 
00222                 g_pathReductionMap[i].fullPath
00223             );
00224         }
00225     }
00226 
00227     ParamXMLPath path = strPath;
00228     
00229     String value;
00230     if( !m_tree.Get( path, &value ) ){
00231         THROW_RUNTIME_ERROR(
00232             "Parameter passed by command line argument is not valid.\n"
00233             "'%s' is not found in default parameter.\n",
00234             path.ToString().c_str() 
00235         );
00236     }
00237 
00238     m_tree.LoadValue( path, exp[1] );
00239 
00240     AddExternalParameterToList( "Expression", paramExp );
00241     m_userParamPassed = true;
00242 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void ParamDB::AddUserDefaultParam ( const String xmlString  ) 

ParamDB.cpp245 行で定義されています。

参照先 Onikiri::ParamXMLTree::LoadString()m_treem_userParamPassedTHROW_RUNTIME_ERROR.

参照元 Onikiri::Environment::Initialize().

00246 {
00247     if( m_userParamPassed ){
00248         THROW_RUNTIME_ERROR(
00249             "Added the user defined default parameter after loading user parameters."
00250             "All user defined default parameter must be added before loading user parameters."
00251         );
00252     }
00253 
00254     m_tree.LoadString( xmlString, true, "User" );
00255 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void ParamDB::CheckResultXML ( const String path,
XMLNodePtr  node,
int *  warningCount 
) [protected]

ParamDB.cpp268 行で定義されています。

参照先 Onikiri::IsInException()RUNTIME_WARNING.

参照元 DumpResultXML().

00269 {
00270     static const int MAX_WARNING_NUM = 8;
00271     if( (*warningCount) > MAX_WARNING_NUM ){
00272         return;
00273     }
00274 
00275     for( XMLChildMap::iterator children = node->children.begin();
00276          children != node->children.end();
00277          ++children
00278      ){
00279          
00280          // Get siblings, which are elements with same name.
00281          XMLNodeArray& siblings = children->second;
00282          for( size_t index = 0; index < siblings.size(); index++ ){
00283 
00284             XMLNodePtr sibling = siblings[ index ];
00285 
00286             // Set the attributes
00287             XMLAttributeMap &attr = sibling->attributes;
00288             for( XMLAttributeMap::iterator i = attr.begin();
00289                  i != attr.end();
00290                  ++i
00291              ){
00292                  if( !i->second->accessed && !IsInException() ){
00293                     (*warningCount)++;
00294                     RUNTIME_WARNING(
00295                          "The attribute '%s' have never been accessed. "
00296                          "The attribute name may be wrong.", 
00297                          (path + sibling->name + "/@"+ i->second->name).c_str()
00298                     );
00299 
00300                     if( (*warningCount) > MAX_WARNING_NUM ){
00301                         RUNTIME_WARNING( "Too many warnings. Omit subsequent warnings...");
00302 
00303                         return;
00304                     }
00305                  }
00306             }
00307 
00308             CheckResultXML( path + sibling->name + "/", sibling, warningCount );
00309          }
00310 
00311     }
00312 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

String ParamDB::CompletePath ( const String target,
const String basePath 
) [protected]

ParamDB.cpp86 行で定義されています。

参照元 LoadXMLFile().

00087 {
00088     using namespace filesystem;
00089     return
00090         absolute( 
00091             path( (const string&)target   ), 
00092             path( (const string&)basePath )
00093         ).string();
00094 }

Here is the caller graph for this function:

String ParamDB::DumpResultXML ( const String level,
const String filter 
)

ParamDB.cpp371 行で定義されています。

参照先 CheckResultXML()FilterResultXML()Onikiri::ParamXMLTree::GetNode()m_treeOnikiri::String::split()THROW_RUNTIME_ERROROnikiri::ParamXMLTree::ToXMLString().

00372 {
00373     XMLNodePtr session = m_tree.GetNode( "/Session" );
00374 
00375     // Remove configuration nodes other than the current configuration.
00376     String currentConfigName = 
00377         m_tree.GetNode( "/Session/Simulator/@Configuration" )->value;
00378     XMLNodePtr configNode = 
00379         m_tree.GetNode( "/Session/Simulator/Configurations" );
00380     for( XMLChildMap::iterator child = configNode->children.begin();
00381          child != configNode->children.end();
00382     ){
00383         if( child->first == currentConfigName ){
00384             ++child;
00385         }
00386         else{
00387             child = configNode->children.erase( child );
00388         }
00389     }
00390     
00391     // Check untouched nodes.
00392     int warningCount = 0;
00393     CheckResultXML( "/Session/", session, &warningCount );
00394 
00395     // Apply the filter to the result XML.
00396     vector<String> filterList = filter.split( "," );
00397     if( filterList.size() > 0 ){
00398         FilterResultXML( "/Session/", session, filterList );
00399     }
00400 
00401     if( level == "Minimum" ){
00402         XMLNodePtr session = m_tree.GetNode( "/Session" );
00403         session->children.erase( "Simulator" );
00404         session->children.erase( "Emulator" );
00405         session->children.erase( "Environment" );
00406         session->children.erase( "Import" );
00407 
00408         ParamXMLTree::NodePtr result = m_tree.GetNode( "/Session/Result" );
00409         if( result ){
00410             result->children.erase( "Resource" );
00411         }
00412 
00413         return m_tree.ToXMLString();
00414     }
00415     else if( level == "BasicResult" ){
00416         ParamXMLTree::NodePtr session = m_tree.GetNode( "/Session" );
00417         session->children.erase( "Simulator" );
00418         session->children.erase( "Emulator" );
00419         session->children.erase( "Environment" );
00420         session->children.erase( "Import" );
00421 
00422         ParamXMLTree::NodePtr res = m_tree.GetNode( "/Session/Result/Resource" );
00423         if( res ){
00424             res->children.erase( "PipelinedExecUnit" );
00425             res->children.erase( "ExecUnit" );
00426             res->children.erase( "MemExecUnit" );
00427             res->children.erase( "Core" );
00428             res->children.erase( "CheckpointMaster" );
00429             res->children.erase( "ExecLatencyInfo" );
00430             res->children.erase( "Thread" );
00431             res->children.erase( "PHT" );
00432             res->children.erase( "Scheduler" );
00433             res->children.erase( "GlobalHistory" );
00434             res->children.erase( "GlobalClock" );
00435             res->children.erase( "RAS" );
00436         }
00437     
00438         return m_tree.ToXMLString();
00439     }
00440     else if( level == "Result" ){
00441         ParamXMLTree::NodePtr session = m_tree.GetNode( "/Session" );
00442         session->children.erase( "Simulator" );
00443         session->children.erase( "Emulator" );
00444         session->children.erase( "Environment" );
00445         session->children.erase( "Import" );
00446         return m_tree.ToXMLString();
00447     }
00448     else if( level == "Detail"){
00449         return m_tree.ToXMLString();
00450     }
00451     else{
00452         THROW_RUNTIME_ERROR(
00453             "An unknown ouput level '%s' is specified in the"
00454             "'/Session/Environment/OutputXML/@Level'\n"
00455             "This parameter must be one of the following strings : \n"
00456             "[Detail, BasicResult, Result, Minimum]",
00457             level.c_str()
00458         );
00459         return m_tree.ToXMLString();
00460     }
00461 }

関数の呼び出しグラフ:

bool ParamDB::FilterResultXML ( const String path,
XMLNodePtr  node,
const std::vector< String > &  filterList 
) [protected]

ParamDB.cpp316 行で定義されています。

参照先 MatchFilterList().

参照元 DumpResultXML().

00317 {
00318     if( MatchFilterList( path + node->name, filterList ) ){
00319         return true;
00320     }
00321 
00322     bool validNode = false;
00323     for( XMLChildMap::iterator children = node->children.begin();
00324          children != node->children.end();
00325      ){
00326          
00327          // Get siblings, which are elements with same name.
00328          XMLNodeArray& siblings = children->second;
00329          bool validChild = false;
00330          for( size_t index = 0; index < siblings.size(); index++ ){
00331 
00332             XMLNodePtr sibling = siblings[ index ];
00333             if( MatchFilterList( path + sibling->name, filterList ) ){
00334                 validChild = true;
00335                 continue;
00336             }
00337             
00338             // Set the attributes
00339             XMLAttributeMap &attr = sibling->attributes;
00340             for( XMLAttributeMap::iterator i = attr.begin();
00341                  i != attr.end();
00342              ){
00343                  if( MatchFilterList( path + i->second->name, filterList ) ){
00344                      ++i;
00345                  }
00346                  else{
00347                      i = attr.erase( i );
00348                  }
00349             }
00350 
00351             bool validChildren = FilterResultXML( path + sibling->name + "/", sibling, filterList );
00352             if( validChildren || attr.size() > 0 ){
00353                 validChild = true;
00354             }
00355          }
00356 
00357          if( validChild ){
00358              validNode = true;
00359              ++children;
00360          }
00361          else{
00362             // printf("%s\n", children->second[0]->name.c_str() );
00363              children = node->children.erase( children );
00364          }
00365     }
00366 
00367     return validNode;
00368 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void ParamDB::Finalize (  ) 

ParamDB.cpp76 行で定義されています。

参照元 Onikiri::Environment::Finalize().

00077 {
00078 }

Here is the caller graph for this function:

template<class T>
bool Onikiri::ParamDB::Get ( const ParamXMLPath path,
T *  val,
const Binding< T > *  bindings,
int  bindingsSize,
bool  required = true 
) [inline]

ParamDB.h314 行で定義されています。

参照先 Get()strTHROW_RUNTIME_ERROROnikiri::ParamXMLPath::ToString().

00315         {
00316             String str;
00317             if( Get(path, &str, required) ){
00318                 bool converted = false;
00319                 for( int i = 0; i < bindingsSize; i++ ){
00320                     if( str == bindings[i].str ){
00321                         *val = bindings[i].value;
00322                         converted = true;
00323                     }
00324                 }
00325                 if( !converted ){
00326                     String msg = "[";
00327                     for( int i = 0; i < bindingsSize; i++ ){
00328                         msg += bindings[i].str;
00329                         if( i < bindingsSize - 1 ){
00330                             msg += ", ";
00331                         }
00332                     }
00333                     msg += "]";         
00334 
00335                     THROW_RUNTIME_ERROR(
00336                         "'%s' is not a valid parameter. '%s' must be one of the following strings: %s",
00337                         str.c_str(),
00338                         path.ToString().c_str(),
00339                         msg.c_str()
00340                     );
00341                 }
00342                 return true;
00343             }
00344             else{
00345                 return false;
00346             }
00347         }

関数の呼び出しグラフ:

template<class T>
bool Onikiri::ParamDB::Get ( const ParamXMLPath path,
std::vector< T > *  val,
bool  required = true 
) [inline]

ParamDB.h296 行で定義されています。

参照先 Get()strToParam().

00297         {
00298             String str;
00299             if( Get( path, &str, required ) ){
00300                 std::vector<String> valList = str.split(", \n\t");
00301                 val->resize( valList.size() );
00302                 for(size_t i = 0; i < valList.size(); i++){
00303                     ToParam( &(*val)[i], path, valList[i] );
00304                 }
00305                 return true;
00306             }
00307             else{
00308                 return false;
00309             }
00310         }

関数の呼び出しグラフ:

template<class T, int N>
bool Onikiri::ParamDB::Get ( const ParamXMLPath path,
T *  val[N],
bool  required = true 
) [inline]

ParamDB.h272 行で定義されています。

参照先 Get()strTHROW_RUNTIME_ERROROnikiri::ParamXMLPath::ToString().

00273         {
00274             String str;
00275             if( Get(path, &str, required) ){
00276                 std::vector<String> valStrList = str.split(", \n\t");
00277                 for(size_t i = 0; i < valStrList.size(); i++){
00278                     if(i >= N){
00279                         THROW_RUNTIME_ERROR(
00280                             "ParamDB parameter conversion failed.\n"
00281                             "'%s' is out of range.",
00282                             path.ToString().c_str() 
00283                         );
00284                     }
00285                     ToParam<T>( &val[i], path, valStrList[i] );
00286                 }
00287                 return true;
00288             }
00289             else{
00290                 return false;
00291             }
00292         }

関数の呼び出しグラフ:

template<class T>
bool Onikiri::ParamDB::Get ( const ParamXMLPath path,
T *  val,
bool  required = true 
) [inline]

ParamDB.h258 行で定義されています。

参照先 Get()strToParam().

00259         {
00260             String str;
00261             if( Get( path, &str, required ) ){
00262                 ToParam( val, path, str );
00263                 return true;
00264             }
00265             else{
00266                 return false;
00267             }
00268         }

関数の呼び出しグラフ:

bool ParamDB::Get ( const ParamXMLPath path,
String val,
bool  required = true 
)

ParamDB.cpp478 行で定義されています。

参照先 Onikiri::ParamXMLTree::Get()m_treeOnikiri::ParamXMLTree::NodeStatus::stRequireDefaultTHROW_RUNTIME_ERROROnikiri::ParamXMLPath::ToString().

参照元 Get()Onikiri::ResourceBuilder::GetConfigurationPath()Onikiri::SystemManager::InitializeEmulator()Onikiri::ResourceBuilder::LoadParameterSection()Onikiri::ParamExchangeBase::ParamBindingEntry()Onikiri::ParamExchangeBase::ParamEntry()Set().

00479 {
00480     ParamXMLTree::NodeStatus status;
00481     bool ret = m_tree.Get( path, value, &status );
00482 
00483     if( !ret && required && status.stRequireDefault ){
00484         THROW_RUNTIME_ERROR(
00485             "error: %s is not found in the default parameters.",
00486             path.ToString().c_str() 
00487         );
00488     }
00489 
00490     return ret;
00491 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

size_t ParamDB::GetElementCount ( const ParamXMLPath path  ) 

ParamDB.cpp493 行で定義されています。

参照先 Onikiri::ParamXMLTree::GetNodeArray()m_tree.

参照元 Onikiri::ParamExchangeBase::ChainParamMap().

00494 {
00495     ParamXMLTree::NodeArray* nodeArray =
00496         m_tree.GetNodeArray( path );
00497     if( !nodeArray )
00498         return 0;
00499 
00500     return nodeArray->size();
00501 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

bool ParamDB::GetSourceXMLFile ( const ParamXMLPath parameterPath,
String sourceFile 
)

ParamDB.cpp464 行で定義されています。

参照先 Onikiri::ParamXMLTree::GetSourceXMLFile()m_isLoadedm_tree.

参照元 Onikiri::EmulatorUtility::ProcessCreateParam::GetTargetBasePath().

00465 {
00466     if(m_isLoaded){
00467         return m_tree.GetSourceXMLFile( parameterPath, sourceFile );
00468     }
00469 
00470     return false;
00471 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

const vector< ParamXMLTree::InputInfo > & ParamDB::GetXMLFileNames (  ) 

ParamDB.cpp81 行で定義されています。

参照先 Onikiri::ParamXMLTree::GetInputList()m_tree.

00082 {
00083     return m_tree.GetInputList();
00084 }

関数の呼び出しグラフ:

ParamXMLTree & ParamDB::GetXMLTree (  ) 

ParamDB.cpp504 行で定義されています。

参照先 m_tree.

参照元 Onikiri::ResourceBuilder::GetConfigurationPath()Onikiri::ResourceBuilder::LoadConstantSection()Onikiri::ResourceBuilder::LoadParameterSection()Onikiri::ResourceBuilder::LoadStructureSection().

00505 {
00506     return m_tree;
00507 }

Here is the caller graph for this function:

bool ParamDB::Initialize ( const String initialPath  ) 

ParamDB.cpp64 行で定義されています。

参照先 Onikiri::ParamXMLTree::LoadString()m_initializedm_initialPathm_treeTHROW_RUNTIME_ERROR.

参照元 Onikiri::Environment::Initialize().

00065 {
00066     if(m_initialized){
00067         THROW_RUNTIME_ERROR( "Initialize() is called more than once." );
00068     }
00069 
00070     m_initialPath = initialPath;
00071     m_tree.LoadString( g_defaultParam, true, "DefaultParam" );
00072     m_initialized = true;
00073     return true;
00074 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void ParamDB::LoadParameters ( const std::vector< String > &   ) 

ParamDB.cpp163 行で定義されています。

参照先 AddParameter()LoadXMLFile()m_userParamPassedTHROW_RUNTIME_ERROR.

参照元 Onikiri::Environment::Initialize().

00164 {
00165     for( vector<String>::const_iterator i = argList.begin() + 1;
00166          i != argList.end(); 
00167          ++i 
00168     ){
00169         const String& arg = *i;
00170 
00171         if( arg.rfind(".xml") == arg.size() - 4 ){
00172             LoadXMLFile( arg );
00173         }
00174         else if( arg.find("-x") == 0 ){
00175             ++i;
00176             if(i == argList.end())
00177                 THROW_RUNTIME_ERROR("'-x' option requires parameter expression.");
00178             AddParameter( *i );
00179         }
00180     }
00181     m_userParamPassed = true;
00182 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void ParamDB::LoadXMLFile ( const String  ) 

ParamDB.cpp111 行で定義されています。

参照先 Onikiri::ParamXMLPath::AddArray()AddExternalParameterToList()CompletePath()Onikiri::ParamXMLTree::Get()Onikiri::ParamXMLTree::LoadXMLFile()m_initialPathm_isLoadedm_treem_userParamPassedRemoveFileName().

参照元 LoadParameters().

00112 {
00113     const String& fileFullPathName = 
00114         CompletePath( fileName, m_initialPath );
00115 
00116     // Import temporary tree
00117     ParamXMLTree curTree;
00118     curTree.LoadXMLFile( fileFullPathName, false );
00119 
00120     // The fileBasePath is always full path.
00121     String fileBasePath = RemoveFileName( fileFullPathName );
00122     ParamXMLPath xmlBasePath( "/Session/Import/" );
00123 
00124     vector<ParamXMLPath> importedPathList;
00125 
00126     for(int i = 0; ;i++){
00127         ParamXMLPath path = xmlBasePath;
00128         path.AddArray( "File", i );
00129         path.AddAttribute( "Path" );
00130         
00131         String importFileName;
00132         bool hit = curTree.Get( path, &importFileName );
00133         if( !hit )
00134             break;
00135 
00136         importedPathList.push_back( path );
00137 
00138         const String& importFullPath = 
00139             CompletePath( importFileName, fileBasePath );
00140         LoadXMLFile( importFullPath );
00141     }
00142 
00143     AddExternalParameterToList( "FileName", fileName );
00144 
00145     // Body
00146     // The file path passed to the m_tree must be full path, 
00147     // because the return value of the m_tree.GetSourceXMLFile() 
00148     // is made from this file path.
00149     m_tree.LoadXMLFile( fileFullPathName, false );
00150     m_isLoaded = true;
00151 
00152     // Touch an attribute for an access footprint
00153     // (XMLNode::accessed
00154     for( size_t i = 0; i < importedPathList.size(); i++ ){
00155         String tmpString;
00156         m_tree.Get( importedPathList[i], &tmpString );
00157     }
00158 
00159     m_userParamPassed = true;
00160 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

bool ParamDB::MatchFilterList ( const String str,
const std::vector< String > &  filterList 
) const [protected]

ParamDB.cpp258 行で定義されています。

参照先 str.

参照元 FilterResultXML().

00259 {
00260     for( size_t i = 0; i < filterList.size(); i++ ){
00261         if( str.find( filterList[i] ) != String::npos )
00262             return true;
00263     }
00264 
00265     return false;
00266 }

Here is the caller graph for this function:

String ParamDB::RemoveFileName ( const String path  )  [protected]

ParamDB.cpp97 行で定義されています。

参照元 LoadXMLFile().

00098 {
00099     String ret;
00100     int indexBs = (int)path.rfind( "\\" );
00101     int indexSl = (int)path.rfind( "/" );
00102     int indexPath = indexSl > indexBs ? indexSl : indexBs;
00103     if(indexPath == -1)
00104         ret = "./";
00105     else
00106         ret.assign(path.begin(), path.begin() + indexPath + 1);
00107     return ret;
00108 }

Here is the caller graph for this function:

template<class T>
void Onikiri::ParamDB::Set ( const ParamXMLPath path,
const T &  param,
const Binding< T > *  bindings,
int  bindingsSize 
) [inline]

ParamDB.h238 行で定義されています。

参照先 Set()str.

00239         {
00240             String str;
00241             for( int i = 0; i < bindingsSize; i++ ){
00242                 if( param == bindings[i].value ){
00243                     str = bindings[i].str;
00244                 }
00245             }
00246             Set( path, str );
00247         }

関数の呼び出しグラフ:

template<class T>
void Onikiri::ParamDB::Set ( const ParamXMLPath path,
const std::vector< T > &  val 
) [inline]

ParamDB.h226 行で定義されています。

参照先 Set()strToString().

00227         {
00228             String str;
00229             for(size_t i = 0; i < val.size(); i++){
00230                 if(i != 0) str += ",";
00231                 str += ToString(path, val[i]);
00232             }
00233             Set( path, str );
00234         }

関数の呼び出しグラフ:

template<class T, int N>
void Onikiri::ParamDB::Set ( const ParamXMLPath path,
const T &  val[N] 
) [inline]

ParamDB.h214 行で定義されています。

参照先 Set()strToString().

00215         {
00216             String str;
00217             for(int i = 0; i < N; i++){
00218                 if(i != 0) str += ",";
00219                 str += ToString(path, val[i]);
00220             }
00221             Set( path, str );
00222         }

関数の呼び出しグラフ:

template<class T>
void Onikiri::ParamDB::Set ( const ParamXMLPath path,
const T &  param 
) [inline]

ParamDB.h201 行で定義されています。

参照先 Get()Set()ToString().

00202         {
00203             T orgParam = T();
00204             if( !Get( path, &orgParam ) || orgParam != param ){
00205                 // Check the parameter is changed in this point,
00206                 // because an internal expression in the XML tree and a value (T) are not equal
00207                 // when the parameter has a special suffix (ex. 1K/1M)
00208                 Set( path, ToString( path, param ) );
00209             }
00210         }

関数の呼び出しグラフ:

void ParamDB::Set ( const ParamXMLPath path,
const String  
)

ParamDB.cpp473 行で定義されています。

参照先 m_treeOnikiri::ParamXMLTree::Set().

参照元 Onikiri::ParamExchangeBase::ParamBindingEntry()Onikiri::ParamExchangeBase::ParamEntry()Onikiri::ParamExchangeBase::ResultEntry()Onikiri::ParamExchangeBase::ResultRateEntry()Set().

00474 {
00475     m_tree.Set( path, val );
00476 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void ParamDB::ToParam ( std::string *  dst,
const ParamXMLPath path,
const String str 
) [protected]

ParamDB.cpp525 行で定義されています。

参照先 strToParamRaw().

00526 {
00527     ToParamRaw( dst, path, str );
00528 }

関数の呼び出しグラフ:

void ParamDB::ToParam ( String dst,
const ParamXMLPath path,
const String str 
) [protected]

ParamDB.cpp520 行で定義されています。

参照先 strToParamRaw().

00521 {
00522     ToParamRaw( dst, path, str );
00523 }

関数の呼び出しグラフ:

void ParamDB::ToParam ( bool *  dst,
const ParamXMLPath path,
const String str 
) [protected]

ParamDB.cpp515 行で定義されています。

参照先 strToParamRaw().

00516 {
00517     ToParamRaw( dst, path, str );
00518 }

関数の呼び出しグラフ:

template<class T>
void Onikiri::ParamDB::ToParam ( T *  dst,
const ParamXMLPath path,
const String str 
) [inline, protected]

ParamDB.h86 行で定義されています。

参照先 strTHROW_RUNTIME_ERROROnikiri::ParamXMLPath::ToString().

参照元 Get().

00087         {
00088             boost::bad_lexical_cast orgExc;
00089             try{
00090                 *dst = boost::lexical_cast<T>(str);
00091                 return;
00092             }
00093             catch(boost::bad_lexical_cast& e){
00094                 orgExc = e;
00095             }
00096 
00097             try{
00098                 if(str.length() < 2){
00099                     throw orgExc;
00100                 }
00101 
00102                 char suffix = str.at(str.length() - 1);
00103                 T base = 
00104                     boost::lexical_cast<T>( 
00105                         str.substr(0, str.length() - 1) );
00106 
00107                 switch(suffix){
00108                 case 'k': case 'K':
00109                     *dst = base*1000;
00110                     break;
00111                 case 'm': case 'M':
00112                     *dst = base*1000000;
00113                     break;
00114                 case 'g': case 'G':
00115                     *dst = base*1000000000;
00116                     break;
00117                 default:
00118                     throw orgExc;
00119                     break;
00120                 }
00121 
00122             }
00123             catch(boost::bad_lexical_cast&){
00124                 THROW_RUNTIME_ERROR(
00125                     "ParamDB parameter conversion failed.\n"
00126                     "Could not convert '%s' to user defined value.\n%s",
00127                     path.ToString().c_str(), orgExc.what()
00128                 );
00129             }
00130             
00131         };

関数の呼び出しグラフ:

Here is the caller graph for this function:

template<class T>
void Onikiri::ParamDB::ToParamRaw ( T *  dst,
const ParamXMLPath path,
const String str 
) [inline, protected]

ParamDB.h71 行で定義されています。

参照先 strTHROW_RUNTIME_ERROROnikiri::ParamXMLPath::ToString().

参照元 ToParam().

00072         {
00073             try{
00074                 *dst = boost::lexical_cast<T>(str);
00075             }
00076             catch(boost::bad_lexical_cast& e){
00077                 THROW_RUNTIME_ERROR(
00078                     "ParamDB parameter conversion failed.\n"
00079                     "Could not convert '%s' to user defined value.\n%s",
00080                     path.ToString().c_str(), e.what() 
00081                 );
00082             }
00083         }

関数の呼び出しグラフ:

Here is the caller graph for this function:

template<class T>
String Onikiri::ParamDB::ToString ( const ParamXMLPath path,
const T &  param 
) [inline, protected]

ParamDB.h65 行で定義されています。

参照元 Set().

00066         {
00067             return boost::lexical_cast<std::string>(param);
00068         };

Here is the caller graph for this function:


変数

bool Onikiri::ParamDB::m_initialized [protected]

ParamDB.h56 行で定義されています。

参照元 Initialize()ParamDB().

String Onikiri::ParamDB::m_initialPath [protected]

ParamDB.h53 行で定義されています。

参照元 Initialize()LoadXMLFile().

bool Onikiri::ParamDB::m_isLoaded [protected]

ParamDB.h55 行で定義されています。

参照元 GetSourceXMLFile()LoadXMLFile().

ParamXMLTree Onikiri::ParamDB::m_tree [protected]

ParamDB.h54 行で定義されています。

参照元 AddExternalParameterToList()AddParameter()AddUserDefaultParam()DumpResultXML()Get()GetElementCount()GetSourceXMLFile()GetXMLFileNames()GetXMLTree()Initialize()LoadXMLFile()Set().

bool Onikiri::ParamDB::m_userParamPassed [protected]

ParamDB.h57 行で定義されています。

参照元 AddParameter()AddUserDefaultParam()LoadParameters()LoadXMLFile()ParamDB().


このクラスの説明は次のファイルから生成されました:
Onikiri2に対してTue Jun 18 15:10:47 2013に生成されました。  doxygen 1.4.7