本文整理汇总了C++中Parm::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ Parm::Init方法的具体用法?C++ Parm::Init怎么用?C++ Parm::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parm
的用法示例。
在下文中一共展示了Parm::Init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddParm
//==== Add User Defined Parm ====//
string UserParmContainer::AddParm(int type, const string & name, const string & group )
{
Parm* p = ParmMgr.CreateParm( type );
if ( p )
{
p->Init( name, group, this, 0.0, -1.0e6, 1.0e6, true );
p->SetDescript( "User Parm Descript" );
m_UserParmVec.push_back( p );
return p->GetID();
}
return string();
}
示例2: DecodeXml
//==== Decode Data From XML Data Struct ====//
xmlNodePtr UserParmContainer::DecodeXml( xmlNodePtr & node )
{
int num_curr_custom = m_UserParmVec.size() - m_NumPredefined;
xmlNodePtr child_node = XmlUtil::GetNode( node, "UserParmContainer", 0 );
if ( child_node )
{
int num_user = XmlUtil::FindInt( child_node, "NumUserParms", 0 );
//==== Decode All User Parms ====//
if ( num_curr_custom == 0 )
{
Renew( num_user );
for ( int i = 0; i < static_cast<int>( m_UserParmVec.size() ); i++ )
{
xmlNodePtr pnode = XmlUtil::GetNode( child_node, "UserParm", i );
if ( pnode && m_UserParmVec[i] )
{
m_UserParmVec[i]->DecodeXml( pnode, true );
}
}
}
else
{
//==== Decode Predefined ====//
for ( int i = 0; i < m_NumPredefined ; i++ )
{
xmlNodePtr pnode = XmlUtil::GetNode( child_node, "UserParm", i );
if ( pnode && m_UserParmVec[i] )
{
m_UserParmVec[i]->DecodeXml( pnode, true );
}
}
//==== Append New Custom ====//
int num_new_custom = num_user - m_NumPredefined;
for ( int i = 0 ; i < num_new_custom ; i++ )
{
xmlNodePtr pnode = XmlUtil::GetNode( child_node, "UserParm", i + m_NumPredefined );
Parm* p = new Parm();
p->Init( "Temp", "User_Group", this, 0.0, -1.0e12, 1.0e12 );
p->DecodeXml( pnode, true );
m_UserParmVec.push_back( p );
}
}
}
return child_node;
}