本文整理汇总了C++中Parm::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Parm::get方法的具体用法?C++ Parm::get怎么用?C++ Parm::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parm
的用法示例。
在下文中一共展示了Parm::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WritePHolderListXDDM
void PHolderListMgr::WritePHolderListXDDM( char *newfile )
{
xmlDocPtr doc = xmlNewDoc((const xmlChar *)"1.0");
xmlNodePtr model_node = xmlNewNode(NULL,(const xmlChar *)"Model");
xmlDocSetRootElement(doc, model_node);
xmlSetProp( model_node, (const xmlChar *)"ID", (const xmlChar *)aircraftPtr->getFileName().get_char_star() );
xmlSetProp( model_node, (const xmlChar *)"Modeler", (const xmlChar *)"OpenVSP" );
xmlSetProp( model_node, (const xmlChar *)"Wrapper", (const xmlChar *)"wrap_vsp.csh" );
for ( int i = 0 ; i < (int)m_PHolderVec.size() ; i++ )
{
Parm* p = m_PHolderVec[i]->getParm();
xmlNodePtr var_node;
if( m_PHolderVec[i]->getDesType() == XDDM_VAR )
var_node = xmlNewChild( model_node, NULL, (const xmlChar *)"Variable", NULL );
else
var_node = xmlNewChild( model_node, NULL, (const xmlChar *)"Constant", NULL );
char varname[255];
sprintf( varname, "%d:%s:%s:%s", ((Geom*)p->get_geom_base())->getPtrID(), p->get_geom_base()->getName().get_char_star(), p->get_group_name().get_char_star(), p->get_name().get_char_star() );
xmlSetProp( var_node, (const xmlChar *)"ID", (const xmlChar *)varname );
xmlSetDoubleProp( var_node, "Value", p->get() );
xmlSetDoubleProp( var_node, "Min", p->get_lower() );
xmlSetDoubleProp( var_node, "Max", p->get_upper() );
xmlSetProp( var_node, (const xmlChar *)"VSPVarName", (const xmlChar *)varname );
}
//===== Save XML Tree and Free Doc =====//
xmlSaveFormatFile((const char *)newfile, doc, 1);
xmlFreeDoc( doc );
}
示例2: ReadPHolderListXDDM
void PHolderListMgr::ReadPHolderListXDDM( char *newfile )
{
pHolderListMgrPtr->DelAllPHolders();
//==== Read Xml File ====//
xmlDocPtr doc;
xmlNodePtr node;
LIBXML_TEST_VERSION
xmlKeepBlanksDefault(0);
//==== Build an XML tree from a the file ====//
doc = xmlParseFile(newfile);
// if (doc == NULL) return 0;
xmlNodePtr root = xmlDocGetRootElement(doc);
if (root == NULL)
{
fprintf(stderr,"empty document\n");
xmlFreeDoc(doc);
// return 0;
}
vector< Geom* > gVec = aircraftPtr->getGeomVec();
gVec.push_back( aircraftPtr->getUserGeom() );
vector< xmlNodePtr > vlist;
int num_v = xmlGetNumNames( root, "Variable" );
for ( int i = 0 ; i < num_v ; i++ )
{
xmlNodePtr var_node = xmlGetNode( root, "Variable", i );
vlist.push_back( var_node );
}
int num_c = xmlGetNumNames( root, "Constant" );
for ( int i = 0 ; i < num_c ; i++ )
{
xmlNodePtr cst_node = xmlGetNode( root, "Constant", i );
vlist.push_back( cst_node );
}
int num_tot = num_v + num_c;
for ( int i = 0 ; i < num_tot ; i++ )
{
xmlNodePtr var_node = vlist[i];
if ( var_node )
{
Stringc varname = Stringc( xmlFindPropString( var_node, "VSPVarName", " " ) );
int istart = 0;
int iend = varname.search_for_substring(':');
int id = varname.get_range( istart, iend-1 ).convert_to_integer();
istart = iend + 1;
iend = varname.search_for_substring( istart, ':' );
istart = iend + 1;
iend = varname.search_for_substring( istart, ':' );
Stringc group = varname.get_range( istart, iend-1 );
istart = iend + 1;
iend = varname.get_length();
Stringc parm = varname.get_range( istart, iend-1 );
Parm* p = parmMgrPtr->FindParm( gVec, id, group, parm );
if ( p )
{
double val = xmlFindPropDouble( var_node, "Value", p->get() );
p->set_from_link( val );
p->get_geom()->parm_changed( p );
ParmHolder* ph = new ParmHolder();
ph->setParm( p );
const xmlChar* varstr = (xmlChar*) "Variable";
if( !xmlStrcmp(var_node->name, varstr ) )
ph->setDesType( XDDM_VAR );
else
ph->setDesType( XDDM_CONST );
m_PHolderVec.push_back( ph );
m_CurrPHolderIndex = (int)m_PHolderVec.size() - 1;
}
}
}
//===== Free Doc =====//
xmlFreeDoc( doc );
// return 1;
}
示例3: WritePHolderListDES
void PHolderListMgr::WritePHolderListDES( char *newfile )
{
FILE *fp;
fp = fopen( newfile, "w" );
fprintf( fp, "%d\n", (int)m_PHolderVec.size() );
for ( int i = 0 ; i < (int)m_PHolderVec.size() ; i++ )
{
Parm *p = m_PHolderVec[i]->getParm();
fprintf( fp, "%d:%s:%s:%s: %g\n", ((Geom*)p->get_geom_base())->getPtrID(), p->get_geom_base()->getName().get_char_star(), p->get_group_name().get_char_star(), p->get_name().get_char_star(), p->get() );
}
fclose( fp );
}