PNL_USING

static void SaveNodeType(pnlString *pStr, const CNodeType &ntype, bool bLast)
{
    *pStr << ntype.IsDiscrete() << ":" << ntype.GetNodeSize();
    if(ntype.GetNodeState())
    {
	*pStr << ":" << ntype.GetNodeState();
    }
    if(!bLast)
    {
	*pStr << ',';
    }
}
PNL_BEGIN

void
CPersistNodeType::Save(CPNLBase *pObj, CContextSave *pContext)
{
    CNodeType *pNodeType = dynamic_cast<CNodeType*>(pObj);

    pContext->AddAttribute("NodeSize", pNodeType->GetNodeSize());
    pContext->AddAttribute("IsDiscrete", pNodeType->IsDiscrete());
    if(pNodeType->GetNodeState())
    {
        // if nodeState is absent, it loaded as 0
        pContext->AddAttribute("NodeState", (int)pNodeType->GetNodeState());
    }
}