void TreeCommon::SplitNodeOnce(int node_id) {
    CNode* node = this->GetNode(node_id);
    if (node == NULL || node->type() != CNode::BRANCH) {
        cout << "Error Split Node: " << node_id << endl;
        return;
    }
    CBranch* branch = (CBranch*)node;

	bool is_children_all_leaf = true;
	for (int i = 0; i < branch->linked_nodes.size(); ++i)
		if (branch->linked_nodes[i]->type() != CNode::LEAF) {
			is_children_all_leaf = false;
			break;
		}
    if (is_children_all_leaf && branch->linked_nodes.size() > 2) {
        SplitNode(branch);

        vector<vector<float>> center_pos;
        for (int i = 0; i < branch->linked_nodes.size(); ++i)
            center_pos.push_back(branch->linked_nodes[i]->center_pos);
        branch->average_dis = Utility::GetAverageDistance(center_pos);

        if (branch->level() + 1 > this->max_level_) this->max_level_ = branch->level() + 1;

        for (int i = 0; i < branch->linked_nodes.size(); ++i) {
            id_node_map_.insert(map<int, CNode*>::value_type(branch->linked_nodes[i]->id(), branch->linked_nodes[i]));
        }
    }
}
Example #2
0
void MyApplication::useSimpleArray()
{
    const SceneManagerPtr& scene = BaseApplication::getSceneManager();
    scene->clear();

    for (s32 col = -2; col < 3; ++col)
    {
        for (s32 row = -2; row < 3; ++row)
        {
            for (s32 width = 0; width < 1; ++width)
            {
                CShape* model = scene->addCube(0, Vector3D((f32)row, (f32)col, -5));
                if (model)
                {
                    model->setName("cube_" + std::to_string(col) + "_" + std::to_string(row));
                    model->setScale(Vector3D(0.5f));
                    model->setRenderTechnique("shaders/default.xml");
                    model->getMaterial()->setTexture(0, "textures/box.jpg");
                }
            }
        }
    }

    CNode* fpsCamera = scene->addFPSCamera(0, Vector3D(0, 0, 0), Vector3D(0.7f, 0, 0.7f));
    fpsCamera->setName("fpsCamera");
    CNode* camera = scene->addCamera(0, Vector3D(0, 0, 0), Vector3D(0.0f, 0, -5.0f));
    camera->setName("camera");

    scene->init();
}
CFormulaNode* CFormulaNode::getFormulaDeepFormulaChild( long frame_idx, long child_idx )
{
	CNode *ret = getFormulaDeepChild( frame_idx, child_idx );
	if( !ret || ret->GetType() != NODE_FORMULA )
		return NULL;
	return (CFormulaNode*) ret;
}
Example #4
0
HydraIRCPlugin::~HydraIRCPlugin( void )
{
#ifdef DEBUG
  OutputDebugString("HydraIRCPlugin::~HydraIRCPlugin() Called for ");
  OutputDebugString(m_Name ? m_Name : "Uninitialised Plugin");
  OutputDebugString("\n");
#endif

  CNode *pNode;
  APIDescriptor_t *APID;

  while (!m_APIList.IsEmpty())
  {
    pNode = m_APIList.GetFirst();
    APID = (APIDescriptor_t *)pNode->m_Data;

    if (APID->m_Type == PLUGIN_PROVIDES && APID->m_pTable) 
      free(APID->m_pTable);

    free(APID);
    pNode->Remove();
    delete pNode;
  }  

  m_Name = NULL;
}
Example #5
0
void DeleteRecord(CList&TelList)
{
 CNode *pLook;
 char szName[20];
        cout<<"请输入您需要删除的姓名(输入0退出,并进入系统菜单)"<<endl;
 cin.getline(szName,20);
 while(strcmp(szName,"0"))
 {
  CTelRecord tel(szName,"0");
  pLook=TelList.LookUp(tel);
  if (pLook)
  {
   cout<<"在电话簿中找到"<<szName<<",内容是:"<<endl;
               pLook->ShowNode();
   cout<<"请确定是否删除此记录(Y/N)【确定删除请输入Y或y,取消删除请输入N或n】:"<<endl;
   char ok;
   cin>>ok;
                        cin.ignore();
   if (ok=='Y'||ok=='y')
   {
       TelList.DeleteNode(pLook);
       cout<<szName<<"的资料删除成功!"<<endl;
       delete pLook;
       count--;
   }
   else if(ok=='N'||ok=='n')
    cout<<szName<<"的资料删除失败"<<endl;
  }
  else
    cout<<"在电话簿中找不到"<<szName<<","<<endl;
  cout<<"请输入您需要删除的姓名(输入0退出,并进入系统菜单)"<<endl;
        cin.getline(szName,20);
 }
Example #6
0
//---------------------------------------------------------------------------
//	@function:
//		CTreeMapTest::EresUnittest_Unrank
//
//	@doc:
//		Rehydrate all trees encoded in the map
//
//---------------------------------------------------------------------------
GPOS_RESULT
CTreeMapTest::EresUnittest_Unrank()
{
	CAutoMemoryPool amp;
	IMemoryPool *pmp = amp.Pmp();
	
	TestMap *ptmap = PtmapLoad(pmp);	
	
	// debug print
	CWStringDynamic str(pmp);
	COstreamString oss(&str);
	
	ULLONG ullCount = ptmap->UllCount();
	
	for (ULONG ulRank = 0; ulRank < ullCount; ulRank++)
	{
		oss << "=== tree rank: " << ulRank << " ===" << std::endl;
		BOOL fFlag = true;
		CNode *pnd = ptmap->PrUnrank(pmp, &fFlag, ulRank);
		(void) pnd->OsPrint(oss);
		
		pnd->Release();
	}
	
	GPOS_TRACE(str.Wsz());
	GPOS_DELETE(ptmap);

	return GPOS_OK;
}
Example #7
0
//=============================================================================
void CGraph::EdgeAddDirected (INode * start, INode * end)
{
    CNode * nodeStart = CNode::From(start);
    CNode * nodeEnd = CNode::From(end);

    nodeStart->AddNeighbor(nodeEnd);
}
Example #8
0
//***********************************************************************************************
CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filenameWithFullPath)  throw( NLMISC::EStream)
{	
	nlassert(_OV);				
	// Check that file is not already inserted 	
	std::string fileName = NLMISC::CFile::getFilename(filenameWithFullPath);
	for(uint k = 0; k < _Nodes.size(); ++k)
	{
		if (NLMISC::nlstricmp(_Nodes[k]->getFilename(), fileName) == 0) return NULL;		
	}	
	char resultPath[MAX_PATH];
	std::string dosPath = NLMISC::CPath::standardizeDosPath(getPath());
	std::string relativePath;
	if (!PathRelativePathTo(resultPath, dosPath.c_str(), FILE_ATTRIBUTE_DIRECTORY, filenameWithFullPath.c_str(), 0))
	{
		relativePath = filenameWithFullPath; 
	}
	else
	{
		relativePath = resultPath;
	}
	if (relativePath.size() >= 2)
	{
		if (relativePath[0] == '\\' && relativePath[1] != '\\')
		{
			relativePath = relativePath.substr(1);
		}
	}
	CNode *newNode = new CNode;
	newNode->init(this);
	newNode->setRelativePath(relativePath);
	_Nodes.push_back(newNode);
	setModifiedFlag(true);
	return newNode;	
}
Example #9
0
void MyApplication::useInstancedObject()
{
    const SceneManagerPtr& scene = BaseApplication::getSceneManager();
    scene->clear();

    CShape* model = scene->addCube(0, Vector3D(0, 0, -5));
    if (model)
    {
        model->setName("cube");
        model->setScale(Vector3D(0.5f));
        model->setRenderTechnique("shaders/default_instancing.xml");
        model->getMaterial()->setTexture(0, "textures/box.jpg");
        const RenderPassPtr& pass = model->getRenderTechique()->getRenderPass(0);
        u32 index = 0;
        for (s32 col = -2; col < 3; ++col)
        {
            for (s32 row = -2; row < 3; ++row)
            {
                for (s32 width = 0; width < 1; ++width)
                {
                    pass->getUserShaderData()->setUniform("offsets[" + std::to_string(index) + "]", Vector3D((f32)col, (f32)row, f32(- 5 - width)));
                    ++index;
                }
            }
        }
        
    }

    CNode* fpsCamera = scene->addFPSCamera(0, Vector3D(0, 0, 0), Vector3D(0.7f, 0, 0.7f));
    fpsCamera->setName("fpsCamera");
    CNode* camera = scene->addCamera(0, Vector3D(0, 0, 0), Vector3D(0.0f, 0, -5.0f));
    camera->setName("camera");

    scene->init();
}
CNode* CMigrationInfo::FindNodeWithFreeMem(CNode* i_sourceNode, CProcess* i_process)
{
	i_sourceNode->WriteLog("MIGRATION - MEM ISSUES - Searching for destination node to establish migration");
	CNode* returnValue = NULL;
	bool found = false;
	double maxFreeMem = 0;
	uint32_t maxIndex = 0;
	// find out which is the process with the greatest free mem that we can migrate to:
	if (i_sourceNode->GetAvailableBandwidth() > 0)
	{
		for (uint32_t i = 0; i < CMasterSingleton::GetInstance()->GetNodeCount(); ++i)
		{
			CNode* currentNode = CMasterSingleton::GetInstance()->GetNode(i);
			double freeMem = currentNode->GetFreeMem();
			if (maxFreeMem < freeMem && i_sourceNode->GetId() != currentNode->GetId() && CanBeDestination(currentNode, i_process))
			{
				maxFreeMem = freeMem;
				maxIndex = i;
				found = true;
			}
		}

		// if found is false, we will return a null pointer meaning that the migration should not happen
		if (found)
			returnValue = CMasterSingleton::GetInstance()->GetNode(maxIndex);
	}

	return returnValue;
}
Example #11
0
void CControl::Initialize()
{
    super::Initialize();
    m_bUninitialize = false;
    if ( strcmp( m_strName.c_str(), DEFAULT_CONTROL_NAME ) == 0)
    {
        SetName( GetDefaultName() );
    }
    else
    {
        CWindowManager::GetInstance()->RegisterControl( this );
    }
    CalcInheritColor();
    CRenderTarget* pMainRenderTarget = CRenderManager::GetInstance()->GetCurrentRenderTarget();
    BEATS_ASSERT( pMainRenderTarget );
    CNode* pParentNode = GetParentNode();
    if ( nullptr == pParentNode)
    {
        CWindowManager::GetInstance()->AddToRoot( this );
    }
    if (nullptr == pParentNode || pParentNode->GetType() != eNT_NodeGUI )
    {
        //update control vertex by render target
        OnParentSizeChange( (float)pMainRenderTarget->GetWidth(), (float)pMainRenderTarget->GetHeight());
    }
}
void CNet::locktree (void)
{
  CNode *node;


  for (node = rtree; node != NULL; node = node->data.rtree) node->lock ();
}
CNode* CMigrationInfo::FindNodeWithFreeCpu(CNode* i_sourceNode, CProcess* i_process)
{
	i_sourceNode->WriteLog("MIGRATION - CPU ISSUES - Searching for destination node to establish migration");
	CNode* returnValue = NULL;
	bool found = false;
	uint32_t minIndex = 0;
	double minCpu = 1;
	if (i_sourceNode->GetAvailableBandwidth() > 0)
	{
		for (uint32_t i = 0; i < CMasterSingleton::GetInstance()->GetNodeCount(); ++i)
		{
			CNode* currentNode = CMasterSingleton::GetInstance()->GetNode(i);
			double cpuUsage = currentNode->GetCpuUsage();
			if (minCpu > cpuUsage && i_sourceNode->GetId() != currentNode->GetId() && CanBeDestination(currentNode, i_process))
			{
				minCpu = cpuUsage;
				minIndex = i;
				found = true;
			}
		}

		// if found is false, we will return a null pointer meaning that the migration should not happen
		if (found)
			returnValue = CMasterSingleton::GetInstance()->GetNode(minIndex);
	}

	return returnValue;
}
Example #14
0
void CParentNode::RemoveOrCopyChildren( QVector<CNode*> &children, long nFrom, long nTo, int fRemove )
{
	if( nTo == -1 ) nTo = (long) m_children.size();
	Q_ASSERT( nTo <= (long) m_children.size() );
	Q_ASSERT( nTo >= nFrom );
	children.resize( nTo - nFrom );
	if( children.size() )
	{
		for( long i = 0; i < (long) children.size(); i++ )
		{
			children[ i ] = (fRemove ? m_children[ nFrom + i ] : CreateCopy( m_children[ nFrom + i ] ) );
			children[ i ]->SetParent( NULL );
		}

		children[ 0 ]->SetPrev( NULL );
		children[ children.size() - 1 ]->SetNext( NULL );
		if( fRemove )
		{
			m_children.remove( nFrom, nTo - nFrom );
			CNode *pPrev = (nFrom - 1 > -1 && nFrom - 1 < (long) m_children.size()) ? m_children[ nFrom - 1 ] : NULL;
			CNode *pNext = (nFrom > -1 && nFrom < (long) m_children.size()) ? m_children[ nFrom ] : NULL;
			if( pPrev ) pPrev->SetNext( pNext );
			if( pNext ) pNext->SetPrev( pPrev );
		}
	}
}
Example #15
0
// execute
void	CGenericXmlMsgHeaderManager::execute(CBitMemStream &strm)
{
	// check root
	if (_Root == NULL)
	{
		nlwarning("Can't execute message , Root not properly initialized.");
		return;
	}

	CNode	*node = _Root->select(strm);

	// check node
	if (node == NULL)
	{
		nlwarning("Can't execute stream, no valid sequence found");
	}
	// check callback
	else if (node->Callback == NULL)
	{
		nlwarning("Can't execute msg '%s', no callback set", node->Name.c_str());
	}
	// execute callback
	else
	{
		node->Callback(strm);
	}
}
Example #16
0
CFormulaNode* CFormulaNode::getSemanticsOrCTokenNodeWrapped()
{
	for( CNode *curNode = this; curNode != 0; curNode = curNode->GetParent() )
	{
		if( curNode->GetType() == NODE_FORMULA && curNode->to_mathml_data.is_content != 0 )
		{
			if( !xml_strcmp( curNode->to_mathml_data.name, FBL_TAG_semantics ) || 
				!xml_strcmp( curNode->to_mathml_data.name, FBL_TAG_annotation ) || 
				::mml_is_cm_token( curNode->to_mathml_data.name ) )
				return (CFormulaNode*)curNode;
			else if( curNode->to_mathml_data.name == FBL_TAG_annotation_xml )
			{
				QString attrValue = _T("");
				struct HMathMLAttr mml_attr_by_this_node( getMathMLAttr() );
				if( mml_attr_by_this_node.getFilteredAttr( FBL_ATTR_encoding, attrValue ) == 0 &&
					attrValue == FBL_VAL_MathML_Content )
				{
					continue;
				}
				return (CFormulaNode*)curNode;
			}
		}
	}
	return 0;
}
bool MessageParser::parse(CNode& post)
{
    // parse author
    CSelection author = post.find("span.name > strong");
    if (author.nodeNum() < 1)
        return false;
    rawMessage.author=author.nodeAt(0).text();

    // parse message
    CSelection message = post.find(".postbody > div");
    if (message.nodeNum() < 1)
        return false;
    rawMessage.content = message.nodeAt(0).text();

    // parse date
    // TODO(arthur)
    CSelection  date= post.find(".postdetails");
    if (date.nodeNum() >= 2)
    if (date.nodeAt(1).childNum() >= 4)
    {
        rawMessage.date.fromString(
            date.nodeAt(1).childAt(3).text());
    }

    return true;
}
void CLineNode::InsertMML_CM_apply__read_op( 
	AST_TXML_Tag *_item_node, QString _item_str, int readonly, long form )
{
	if( _item_node )
	{
		CLineNode *lbuf = new CLineNode();
		lbuf->read_mathml( _item_node );
		if( readonly )
			lbuf->iterateNodeTree( setRecursiveReadOnly_n_IgnoreContent, 0 );
		else if( form == __APPLY_RENDER_FORM_OP )
		{
			CNode *pNode = lbuf->GetFirstChild();
			while( pNode )
			{
				pNode->to_mathml_data.is_content = 
					CONTENT_MATHML_CONVERTION2__APPLY_OPERATOR_RECURSIVE_TREE;
				pNode = pNode->GetNext();
			}
		}
		PumpLine2Line( lbuf );
		delete lbuf;
	}
	else if( _item_str.length() )
		InsertMML_CM_create_markup_rigid_token( FBL_TAG_mo, _item_str );
}
Example #19
0
/**
 * Performs some local preprocessing of the given @a trace which is required
 * to provide the full trace-access functionality. This has to be done as the
 * last step in setting up the data structures, i.e., after calling
 * PEARL_verify_calltree() and PEARL_mpi_unify_calltree().
 *
 * @note This function is intended to be used in single-threaded PEARL
 *       programs, i.e., serial or pure MPI.
 *
 * @param defs  Global definitions object
 * @param trace Local trace data object
 *
 * @see PEARL_omp_preprocess_trace(), PEARL_verify_calltree(),
 *      PEARL_mpi_unify_calltree()
 */
void pearl::PEARL_preprocess_trace(const GlobalDefs& defs,
                                   const LocalTrace& trace)
{
  // Precompute CNODE pointers
  Calltree* ctree   = defs.get_calltree();
  CNode*    current = NULL;
  Event     event   = trace.begin();
  while (event != trace.end()) {
    // Enter event
    if (event->is_typeof(ENTER))
    {
      Enter_rep* enter = dynamic_cast<Enter_rep*>(event.operator->());

      current = ctree->add_cnode(enter->get_regionEntered(),
                                 enter->get_callsite(),
                                 current, enter->get_time());

      enter->set_cnode(current);
    }

    // Exit event
    else if (event->is_typeof(EXIT))
    {
      current = current->get_parent();
    }

    ++event;
  }
}
CFormulaNode* CLineNode::InsertMMLFormulaNode_OTHERS( FXmlBtn *ptrFXmlBtn, AST_TXML_Compound *node, int is_hidden )
{
	CFormulaNode *new_node = 0;
	CFrameNode *pFrameNode = 0;
	CNode *pCurNode = 0;

	if( !ptrFXmlBtn )
		return NULL; // error: Internal error

	if( ptrFXmlBtn->getNodeType() == NODE_FORMULA )
	{
		new_node = CreateFormulaNode( *ptrFXmlBtn );
		if( !new_node ) return NULL; // error: Internal error

		pFrameNode = (CFrameNode *)GetFrameNode();
		if( pFrameNode ) new_node->SetLevel( pFrameNode->GetLevel() );
		AddChild( new_node );

		if( node )
		{
			pCurNode = new_node->GetFirstChild();
			if( pCurNode && pCurNode->GetType() == NODE_FRAME )
			{
				if( ((CFrameNode*)pCurNode)->GetFirstChild() )
					((CFrameNode*)pCurNode)->DeleteChild( ((CFrameNode*)pCurNode)->GetFirstChild() );
				pCurNode->read_mathml( node );
			}
		}
	}
	if( new_node && is_hidden )
		new_node->setHidden();
	return new_node;
}
Example #21
0
CNode* DepthFirstStrategy::GetNextNode()
{
    if(nodeStack.empty())
        return NULL;

    if(last == NULL)
    {
        last = nodeStack.back();
        return nodeStack.back();
    }
    else
    {
        nodeStack.pop_back();

        for(unsigned int i=0; i<last->children.size(); i++)
        {
            CNode* child = last->children[i];
            if(child->IsNodeInteresting())
            {
                nodeStack.push_back(child);
            }
        }

        if(nodeStack.empty())
            return NULL;

        last = nodeStack.back();
        return nodeStack.back();
    }
}
Example #22
0
bool CDoubleLinkedList::addNode( CNodeObject * pObject )
{
  int nsearchResult = 0;
  CNode * pNode = m_pHead;
    
  if ( m_nSort == SORT_NONE ) {
    // No sorting just add as last element
    addNodeTail( pObject );
    
    return true;
  }
  
  if ( ( m_nSort == SORT_STRING ) && ( NULL == pObject->m_pstrSortKey )  ) {
    return false;
  }
  
  if ( ( m_nSort == SORT_NUMERIC ) && ( NULL == pObject->m_pKey )  ) {
    return false;
  }
  
  if ( NULL != pNode ) {
    
    while (pNode != NULL ) {
      if ( ( m_nSort == SORT_STRING ) && ( NULL != pObject->m_pstrSortKey ) ) {
    nsearchResult =  strcmp( pNode->getObject()->m_pstrSortKey,
                 pObject->m_pstrSortKey );
      }
      else if ( ( m_nSort == SORT_NUMERIC ) ) {
    if ( *pObject->m_pKey == *pNode->getObject()->m_pKey ) {
      nsearchResult = 0;
    }
    else if ( *pObject->m_pKey > *pNode->getObject()->m_pKey ) {
      nsearchResult = 2;
    }
    else {
      nsearchResult = -1;
    }
      }
      
      if ( 0 == nsearchResult ) {
    // Entry already in table - Not allowed
    return false;
      }
      else if ( nsearchResult > 0 ) {
    // Add before current item
    addNodeBefore( pNode, pObject );
    return true;
      }
        
      pNode = pNode->getNextNode();
    }
  }
  else {	
    // Add to tail - last id
    addNodeTail( pObject );
  }
  
  return true;
}
Example #23
0
//=============================================================================
void CGraph::EdgeAddSymetric (INode * a, INode * b)
{
    CNode * nodeA = CNode::From(a);
    CNode * nodeB = CNode::From(b);

    nodeA->AddNeighbor(nodeB);
    nodeB->AddNeighbor(nodeA);
}
//check node value is float
void CTagCn::nodeIsReal(const CNode& node)const
{
	size_t pos = 0;
	string num = deleteSpaces(node.text().as_string());
	double d = stod(num, &pos);
	if (pos != num.length() || !num.length())
		throwException(node, node.offset_debug(), INCORRECT_VALUE);
}
void CanonicalizeVisitor::VisitNextCNode(CNode* s) {
  CNode* next = s->GetNextCNode();
  if (next) {
    next->Accept(*this);
  } else {
    FinishBB();
  }
}
Example #26
0
void test_escape() {
    std::string page = "<html><div><span id=\"that's\">1\n</span>2\n</div></html>";
    CDocument doc;
    doc.parse(page.c_str());
    CNode pNode = doc.find("span[id=\"that's\"]").nodeAt(0);
    std::string content = page.substr(pNode.startPos(), pNode.endPos() - pNode.startPos());
    printf("Node: #%s#\n", content.c_str());
}
Example #27
0
unsigned int __stdcall CDeviceView::RefreshThread(void *Param)
{
    RefreshThreadData *ThreadData = (RefreshThreadData *)Param;
    CDeviceView *This = ThreadData->This;

    // Get a copy of the currently selected node
    CNode *LastSelectedNode = This->GetSelectedNode();
    if (LastSelectedNode == nullptr || (LastSelectedNode->GetNodeType() == RootNode))
    {
        LastSelectedNode = new CRootNode(*This->m_RootNode);
    }
    else if (LastSelectedNode->GetNodeType() == ClassNode)
    {
        LastSelectedNode = new CClassNode(*dynamic_cast<CClassNode *>(LastSelectedNode));
    }
    else if (LastSelectedNode->GetNodeType() == DeviceNode)
    {
        LastSelectedNode = new CDeviceNode(*dynamic_cast<CDeviceNode *>(LastSelectedNode));
    }

    // Empty the treeview
    This->EmptyDeviceView();

    // Re-add the root node to the tree
    if (This->AddRootDevice() == false)
        return 0;

    // Refresh the devices only if requested
    if (ThreadData->ScanForChanges)
    {
        This->RefreshDeviceList();
    }

    // display the type of view the user wants
    switch (This->m_ViewType)
    {
        case DevicesByType:
            (void)This->ListDevicesByType();
            break;

        case DevicesByConnection:
            (VOID)This->ListDevicesByConnection();
            break;

        case ResourcesByType:
            break;

        case ResourcesByConnection:
            break;
    }


    This->SelectNode(LastSelectedNode);

    delete ThreadData;

    return 0;
}
void EDGAR_FilingFile::FindEDGAR_Tables(RunMode run_mode)
{
    // always start fresh

    EDGAR_filing_tables_.clear();

    CDocument the_filing;
    the_filing.parse(EDGAR_filing_content_.c_str());
    CSelection c = the_filing.find("table");

    // ConvertMarkupToText is a time consuming function -- it actually calls out to
    // an external process right now -- so let's do some async'ing !!

    // keep track of our async processes here.

    std::vector<std::future<std::string>> tasks;

    for (int indx = 0 ; indx < c.nodeNum(); ++indx)
    {
        CNode pNode = c.nodeAt(indx);

        // use the 'Outer' functions to include the table tags in the extracted content.

        std::string content = EDGAR_filing_content_.substr(pNode.startPosOuter(), pNode.endPosOuter() - pNode.startPosOuter());
		if (TableHasMarkup(content))
		{
            if (run_mode == RunMode::do_sync)
            {
    			std::string plain_table = ConvertMarkupToText(content);
                EDGAR_filing_tables_.push_back(plain_table);
            }
            else
                tasks.push_back(std::async(&EDGAR_FilingFile::ConvertMarkupToText, this, content));
		}
        else
            EDGAR_filing_tables_.push_back(content);
    }

    // now, let's go look for our output...

    for (int count = tasks.size(); count; --count)
    {
        int i = wait_for_any(tasks, std::chrono::microseconds{100});
        std::string converted_text;
        try
        {
            converted_text = tasks[i].get();
        }
        catch (...)
        {
            // any problems, let's just ignore them.
            poco_error(the_logger_, "Some problem with an async process");
            continue;
        }
        if (! converted_text.empty())
            EDGAR_filing_tables_.push_back(converted_text);
    }
}        // -----  end of method EDGAR_FilingFile::FindEDGAR_Tables  -----
void CTagQualifiers::operator()( const CNode& node, CTreeNode& tree_node )
{
    (*this)(node);
    auto arg = node.first_child();
    CTag& argTag = CTagContainer::getTag( arg.name() );
    int argType = argTag.getType();
    argTag(arg, tree_node.Step(node.name()));
    arg = argTag.checkSignature(arg);
}
Example #30
0
void CControl::WorldToLocal(float &x, float &y)
{
    CNode* pParent = GetParentNode();
    if( pParent && pParent->GetType() == eNT_NodeGUI )
    {
       down_cast<CControl*>(pParent)->WorldToLocal(x, y);
    }
    ParentToLocal(x, y);
}