当前位置: 首页>>代码示例>>C++>>正文


C++ NodeFactory类代码示例

本文整理汇总了C++中NodeFactory的典型用法代码示例。如果您正苦于以下问题:C++ NodeFactory类的具体用法?C++ NodeFactory怎么用?C++ NodeFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了NodeFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LB_TS_THREAD

void Pipe::_releaseViews()
{
    LB_TS_THREAD( _pipeThread );
    for( bool changed = true; changed; )
    {
        changed = false;
        for( ViewHashIter i =_impl->views.begin(); i !=_impl->views.end(); ++i )
        {
            View* view = i->second;
            view->commit();
            if( view->getVersion() + 20 > view->getHeadVersion( ))
                continue;

            // release unused view to avoid memory leaks due to deltas piling up
            view->_pipe = 0;

            ClientPtr client = getClient();
            client->unmapObject( view );
            _impl->views.erase( i );

            NodeFactory* nodeFactory = Global::getNodeFactory();
            nodeFactory->releaseView( view );

            changed = true;
            break;
        }
    }
}
开发者ID:niujunpenghn,项目名称:Equalizer,代码行数:28,代码来源:pipe.cpp

示例2: getArgs

	Node getArgs() const {
		Node args = this->lhs->getChild( 1 );
		if ( args->hasName( SEQ ) ) return args;
		NodeFactory b;
		b.start( SEQ );
		b.add( args );
		b.end();
		return b.build();
	}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例3: predicate

static void predicate( TokType sense, NodeFactory & ifunless, Node pred ) {
	if ( sense == tokty_if ) {
		ifunless.add( pred );
	} else {
		//	TODO: This is a bug?
		ifunless.start( "sysval" );
		ifunless.put( "name", "not" );
		ifunless.add( pred );
		ifunless.end();
	}
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例4: readCompoundCore

Node ReadStateClass::readCompoundCore() {
	if ( this->cstyle_mode ) {
		NodeFactory stmnts;
		stmnts.start( SEQ );
		while ( this->tryPeekToken( tokty_semi ) || not this->tryPeekCloser() ) {
			Node n = this->readSingleStmnt();
			stmnts.add( n );
		}
		stmnts.end();
		return stmnts.build();
	} else {
		return this->readStmnts();
	}
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例5: check_create

bool check_create()
{
    NodeFactory factory;
    internals::loadInternals(factory);
    Node::ptr metro0 = factory.create("base.metro");
    Node::ptr print0 = factory.create("base.print");
    Node::ptr counter0 = factory.create("base.counter");
    if (metro0.get() == 0)
    {
        std::cout << "Metro ptr is null" << std::endl;
        return false;
    }
    return true;
}
开发者ID:aalex,项目名称:ubuntu-tempi,代码行数:14,代码来源:check_base.cpp

示例6: switch

Node ReadStateClass::readSingleStmnt( const bool top_level ) {
	if ( this->cstyle_mode ) {
		Item it = this->item_factory->read();
		//cerr << "SINGLE " << tok_type_name( it->tok_type ) << endl;
		switch ( it->tok_type ) {
			case tokty_obrace: 
				return this->readCompoundCoreCheck( tokty_cbrace );
			case tokty_function: 
				if ( this->cstyle_mode && this->item_factory->peek()->tok_type == tokty_oparen ) {
					return this->readLambda();
				} else {
					return this->readDefinition();
				}
			case tokty_if: 
				return this->readIf( tokty_if, tokty_endif );
			case tokty_for: 
				return this->readFor();
			case tokty_switch: 
				return this->readSwitch();
			case tokty_recordclass:
				return this->readRecordClass();
			case tokty_dsemi:
			case tokty_semi: 
				return makeEmpty();
			default: 
				this->item_factory->unread();
				// --- Fall-through --- //
		}
	}
	
	//	Fall thru!
	Node n = this->readOptEmptyExpr();
	if ( this->tryToken( tokty_dsemi ) ) {
		NodeFactory f;
		f.start( ERASE );
		f.add( n );
		f.end();
		return f.build();
	} else if ( this->tryToken( tokty_semi ) ) {
		return n;
	} else {
		if ( this->item_factory->peek()->role.IsCloser() && not top_level ) {
			return n;	
		} else {
			throw CompileTimeError( "Missing semi-colon?" ).culprit( "Token", this->item_factory->peek()->nameString() );
		}
	}
}
开发者ID:,项目名称:,代码行数:48,代码来源:

示例7: createNode

std::pair<std::shared_ptr<Node>, boost::optional<Status>>
createNode(const Status& originalStatus, Point p, Point d,
        const std::shared_ptr<Node>& base, NodeFactory& nodeFactory,
        const HeurCalculator& heurCalculator, const Checker& checker,
        Dumper* dumper)
{
    Point pd = p+d, pmd = p-d;
    if (originalStatus.value(pd) != FieldType::floor ||
            !originalStatus.reachable(pmd)) {
        return {};
    }

    Status status(originalStatus);
    status.currentPos(p);
    if (heurCalculator.calculateStone(status, pd) < 0 ||
            !status.moveStone(p, pd)) {
        return {};
    }

    auto doCreateNode =
            [&]() {
                return nodeFactory.createNode(
                        status, MoveDescriptor(p, d), base);
            };
    if (pd != status.table().destination()) {
        if (!checker.check(status, pd)) {
            if (dumper) {
                dumper->reject(doCreateNode(), checker.errorMessage());
            }
            return {};
        }
    }

    return {doCreateNode(), std::move(status)};
}
开发者ID:petersohn,项目名称:sokoban,代码行数:35,代码来源:ExpandHelper.hpp

示例8: readSwitchStmnts

Node ReadStateClass::readSwitchStmnts() {
	NodeFactory st;
	st.start( SEQ );
	while (
		not ( 
			this->tryPeekToken( tokty_cbrace ) ||
			this->tryPeekToken( tokty_case ) ||
			this->tryPeekToken( tokty_default )
		) 
	) {
		Node x = this->readSingleStmnt();
		st.add( x );
	}
	st.end();
	return st.build();
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例9: readEnvVar

Node ReadStateClass::readEnvVar() {
	this->checkToken( tokty_obrace );
	NodeFactory envvar;
	envvar.start( SYSAPP );
	envvar.put( "name", "sysGetEnv" );
	envvar.start( "constant" );
	envvar.put( "type", "string" );
	envvar.put( "value", this->item_factory->read()->nameString() );
	envvar.end();		
	this->checkToken( tokty_cbrace );
	envvar.end();
	return envvar.build();
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例10: command

bool Pipe::_cmdDetachView( co::ICommand& cmd )
{
    co::ObjectICommand command( cmd );

    LB_TS_THREAD( _pipeThread );

    ViewHash::iterator i = _impl->views.find( command.get< uint128_t >( ));
    if( i != _impl->views.end( ))
    {
        View* view = i->second;
        _impl->views.erase( i );

        NodeFactory* nodeFactory = Global::getNodeFactory();
        nodeFactory->releaseView( view );
    }
    return true;
}
开发者ID:niujunpenghn,项目名称:Equalizer,代码行数:17,代码来源:pipe.cpp

示例11: readImport

Node ReadStateClass::readImport() {
	NodeFactory imp;
	imp.start( "import" );
	bool pervasive, qualified;
	
	readImportQualifiers( *this, pervasive, qualified );
	imp.put( "pervasive", pervasive ? "true" : "false" );
	imp.put( "qualified", qualified ? "true" : "false" );
	
	readImportMatch( *this, imp );
	
	this->checkToken( tokty_from );
	string url = this->readPkgName();
	imp.put( "from", url );

	if ( this->tryName( "alias" ) ) {
		imp.put( "alias", this->readIdName() );
	}
	
	if ( this->tryName( "into" ) ) {
		readImportInto( *this, imp );
	}
	
	imp.end();
	return imp.build();
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例12: readAnon

Node ReadStateClass::readAnon( const std::string name ) {
	NodeFactory anon;
	if ( this->pattern_mode ) {
		anon.start( VAR );
	} else {
		anon.start( CONSTANT );
		anon.put( CONSTANT_TYPE, "absent" );
		anon.put( CONSTANT_VALUE, "absent" );
		anon.put( CONSTANT_WAS_ANON, name );
	}
	anon.put( COMMENT, name );
	anon.end();
	return anon.build();
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例13: readQueryPrec

Node ReadStateClass::readQueryPrec( const int prec ) {
	Node e = this->readExprPrec( prec );
	const std::string name = e->name();
	if ( 
		name == BIND 	||
		name == IN 		||
		name == FROM 	||
		name == WHERE 	||
		name == WHILE   ||
		name == ZIP 	||
		name == CROSS 	||
		name == OK 		||
		name == FINALLY ||
		name == DO
	) {
		return e;
	} else {
		NodeFactory where;
		where.start( WHERE );
		where.start( OK );
		where.end();
		where.add( e );
		where.end();
		return where.build();
	}
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例14: squash

	void squash( NodeFactory acc, Node rhs ) {
		const std::string 
		name = rhs->name();
		if ( name == SEQ ) {
			int n = rhs->size();
			for ( int i = 0; i < n; i++ ) {
				squash( acc, rhs->getChild( i ) );
			}
		} else {
			acc.add( rhs );
		}
	}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例15: readTags

static void readTags( ReadStateClass & r, NodeFactory & imp, const char * prefix, const bool add_default ) {
	if ( r.tryToken( tokty_oparen ) ) {
		ItemFactory ifact = r.item_factory;
		if ( ifact->peek()->tok_type != tokty_cparen ) {
			for ( int i = 0; true; i++ ) {
				Item item = ifact->read();
				ostringstream s;
				s << prefix << i;
				imp.put( s.str(), item->nameString() );
				
				item = ifact->read();
				if ( item->tok_type != tokty_comma ) {
					if ( item->tok_type != tokty_cparen ) throw CompileTimeError( "Expecting close parenthesis" );
					break;
				}
			}	
		}
	} else if ( add_default ) {
		imp.put( prefix, "public" );
	}
}
开发者ID:,项目名称:,代码行数:21,代码来源:


注:本文中的NodeFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。