Import the Application Delta Profile (ADP), of the named application. The current ADP for any application using the HadronZoo Database Suite (HDB), will be in the standard location "/home/deltasvr/appname/appname.adp".
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdbADP::ImportADP | (hzString&,) |
Declared in file: hzDatabase.h
Defined in file : hdbADP.cpp
Function Logic:
Function body:
hzEcode hdbADP::ImportADP (hzString& appName)
{
// Import the Application Delta Profile (ADP), of the named application.
//
// The current ADP for any application using the HadronZoo Database Suite (HDB), will be in the standard location "/home/deltasvr/appname/appname.adp".
_hzfunc("hdbADP::Import") ;
hzArray <hzString> ar ; // Enum values
ifstream is ; // Input stream for previous ADP if applicable
hzDocXml docADP ; // XML document
hzChain Z ; // For building the ADP
hzChain Y ; // Previous ADP
hzXmlNode* pRoot ; // Document root node
hzXmlNode* pN ; // First level node
hzAttrset ai ; // Attribute iterator
hdbEnum* pEnum ; // Data enum
hzString fname ; // Filename
hzString bkfile ; // Filename
hzString cname ; // Class name
hzString str_id ; // Member id
hzString str_uid ; // Member uid
hzString str_min ; // Member minPop
hzString str_max ; // Member minPop
hzString str_typ ; // Member data type
hzString str_sub ; // Member sub class
hzString str_nam ; // Member name
hzString S ; // Temp string (enum values)
uint32_t n ; // Enum value iterator
hzEcode rc = E_OK ; // Return code
fname = "/home/deltasvr/" + appName + "/" + appName + ".adp" ;
if (TestFile(*fname) == E_OK)
{
is.open(*fname) ;
Y << is ;
is.close() ;
}
rc = docADP.Load(*fname) ;
if (rc != E_OK)
{
threadLog("Could not load ADP document (%s)\n", *fname) ;
threadLog(docADP.Error()) ;
return rc ;
}
pRoot = docADP.GetRoot() ;
if (!pRoot)
{
threadLog("ADP document (%s) has no route\n", *fname) ;
return E_NOINIT ;
}
for (pN = pRoot->GetFirstChild() ; pN ; pN = pN->Sibling())
{
if (pN->NameEQ("enum"))
{
for (ai = pN ; ai.Valid() ; ai.Advance())
{
if (ai.NameEQ("name"))
str_nam = ai.Value() ;
else
{ rc = E_CONFIG ; threadLog("Line %d: <enum> bad param %s=%s\n", pN->Line(), ai.Name(), ai.Value()) ; break ; }
}
pEnum = new hdbEnum() ;
pEnum->SetTypename(str_nam) ;
// Add to data types
m_mapDatatypes.Insert(str_nam, pEnum) ;
m_mapEnums.Insert(str_nam, pEnum) ;
SplitCSV(ar, pN->m_fixContent) ;
for (n = 0; n < ar.Count() ; n++)
{
S = ar[n] ;
// if (S.Length() > pEnum->m_nMax)
// pEnum->m_nMax = S.Length() ;
// pEnum->m_Numbers.Add(strNo) ;
pEnum->AddItem(S) ;
}
}
else if (pN->NameEQ("class"))
{
rc = _rdClass(pN) ;
if (rc != E_OK)
break ;
}
}
return rc ;
}