예제 #1
0
LayerAndroid::LayerAndroid(const LayerAndroid& layer) : Layer(layer),
    m_uniqueId(layer.m_uniqueId),
    m_haveClip(layer.m_haveClip),
    m_backfaceVisibility(layer.m_backfaceVisibility),
    m_visible(layer.m_visible),
    m_backgroundColor(layer.m_backgroundColor),
    m_preserves3D(layer.m_preserves3D),
    m_anchorPointZ(layer.m_anchorPointZ),
    m_isPositionAbsolute(layer.m_isPositionAbsolute),
    m_fixedPosition(0),
    m_zValue(layer.m_zValue),
    m_content(layer.m_content),
    m_imageCRC(layer.m_imageCRC),
    m_scale(layer.m_scale),
    m_lastComputeTextureSize(0),
    m_owningLayer(layer.m_owningLayer),
    m_type(LayerAndroid::UILayer),
    m_intrinsicallyComposited(layer.m_intrinsicallyComposited),
    m_surface(0),
    m_replicatedLayer(0),
    m_originalLayer(0),
    m_maskLayer(0)
{
    if (m_imageCRC)
        ImagesManager::instance()->retainImage(m_imageCRC);

    SkSafeRef(m_content);

    if (layer.m_fixedPosition) {
        m_fixedPosition = layer.m_fixedPosition->copy(this);
        Layer::setShouldInheritFromRootTransform(true);
    }

    m_transform = layer.m_transform;
    m_drawTransform = layer.m_drawTransform;
    m_drawTransformUnfudged = layer.m_drawTransformUnfudged;
    m_childrenTransform = layer.m_childrenTransform;
    m_dirtyRegion = layer.m_dirtyRegion;

    m_replicatedLayerPosition = layer.m_replicatedLayerPosition;

#ifdef ABSOLUTE_POSITION
    // If we have absolute elements, we may need to reorder them if they
    // are followed by another layer that is not also absolutely positioned.
    // (as absolutely positioned elements are out of the normal flow)
    bool hasAbsoluteChildren = false;
    bool hasOnlyAbsoluteFollowers = true;

    for (int i = 0; i < layer.countChildren(); i++) {
        if (layer.getChild(i)->isPositionAbsolute()) {
            hasAbsoluteChildren = true;
            continue;
        }
        if (hasAbsoluteChildren
            && !layer.getChild(i)->isPositionAbsolute()) {
            hasOnlyAbsoluteFollowers = false;
            break;
        }
    }

    if (hasAbsoluteChildren && !hasOnlyAbsoluteFollowers) {
        Vector<LayerAndroid*> normalLayers;
        Vector<LayerAndroid*> absoluteLayers;
        for (int i = 0; i < layer.countChildren(); i++) {
            LayerAndroid* child = layer.getChild(i);
            if (child->isPositionAbsolute()
                || child->isPositionFixed())
                absoluteLayers.append(child);
            else
                normalLayers.append(child);
        }
        for (unsigned int i = 0; i < normalLayers.size(); i++)
            addChild(normalLayers[i]->copy())->unref();
        for (unsigned int i = 0; i < absoluteLayers.size(); i++)
            addChild(absoluteLayers[i]->copy())->unref();
    } else {
        for (int i = 0; i < layer.countChildren(); i++)
            addChild(layer.getChild(i)->copy())->unref();
    }
#else
    for (int i = 0; i < layer.countChildren(); i++)
        addChild(layer.getChild(i)->copy())->unref();
#endif

    KeyframesMap::const_iterator end = layer.m_animations.end();
    for (KeyframesMap::const_iterator it = layer.m_animations.begin(); it != end; ++it) {
        m_animations.add(it->first, it->second);
    }

    if (layer.m_replicatedLayer) {
        // The replicated layer is always the first child
        m_replicatedLayer = getChild(0);
        m_replicatedLayer->setOriginalLayer(this);
    }

    if (layer.m_maskLayer)
        m_maskLayer = layer.m_maskLayer->copy();

#ifdef DEBUG_COUNT
    ClassTracker::instance()->increment("LayerAndroid - recopy (UI)");
    ClassTracker::instance()->add(this);
#endif
}
예제 #2
0
  std::istream& OcTreeNodePCL::readBinary(std::istream &s) {

    char child1to4_char;
    char child5to8_char;
    s.read((char*)&child1to4_char, sizeof(char));
    s.read((char*)&child5to8_char, sizeof(char));

    std::bitset<8> child1to4 ((unsigned long) child1to4_char);
    std::bitset<8> child5to8 ((unsigned long) child5to8_char);

    //     std::cout << "read:  "
    // 	      << child1to4.to_string<char,std::char_traits<char>,std::allocator<char> >() << " "
    // 	      << child5to8.to_string<char,std::char_traits<char>,std::allocator<char> >() << std::endl;


    // inner nodes default to occupied
    this->setLogOdds(CLAMPING_THRES_MAX);

    for (unsigned int i=0; i<4; i++) {
      if ((child1to4[i*2] == 1) && (child1to4[i*2+1] == 0)) {
        // child is free leaf
        createChild(i);
        getChild(i)->setLogOdds(CLAMPING_THRES_MIN);
      }
      else if ((child1to4[i*2] == 0) && (child1to4[i*2+1] == 1)) {
        // child is occupied leaf
        createChild(i);
        getChild(i)->setLogOdds(CLAMPING_THRES_MAX);
      }
      else if ((child1to4[i*2] == 1) && (child1to4[i*2+1] == 1)) {
        // child has children
        createChild(i);
        getChild(i)->setLogOdds(-200.); // child is unkown, we leave it uninitialized
      }
    }
    for (unsigned int i=0; i<4; i++) {
      if ((child5to8[i*2] == 1) && (child5to8[i*2+1] == 0)) {
        // child is free leaf
        createChild(i+4);
        getChild(i+4)->setLogOdds(CLAMPING_THRES_MIN);
      }
      else if ((child5to8[i*2] == 0) && (child5to8[i*2+1] == 1)) {
        // child is occupied leaf
        createChild(i+4);
        getChild(i+4)->setLogOdds(CLAMPING_THRES_MAX);
      }
      else if ((child5to8[i*2] == 1) && (child5to8[i*2+1] == 1)) {
        // child has children
        createChild(i+4);
        getChild(i+4)->setLogOdds(-200.); // set occupancy when all children have been read
      }
      // child is unkown, we leave it uninitialized
    }

    // read children's children and set the label
    for (unsigned int i=0; i<8; i++) {
      if (this->childExists(i)) {
        OcTreeNodePCL* child = this->getChild(i);
        if (fabs(child->getLogOdds()+200.)<1e-3) {
          child->readBinary(s);
          child->setLogOdds(child->getMaxChildLogOdds());
        }
      } // end if child exists
    } // end for children

    return s;
  }
예제 #3
0
파일: halGenome.cpp 프로젝트: dayin1989/hal
void Genome::copyBottomSegments(Genome *dest) const
{
  assert(getNumBottomSegments() == dest->getNumBottomSegments());
  hal_size_t inNc = getNumChildren();
  hal_size_t outNc = dest->getNumChildren();
  // The child indices aren't consistent across files--make sure each bottom
  // segment points to the correct children
  vector<string> inChildNames;
  vector<string> outChildNames;
  for (hal_size_t inChild = 0; inChild < inNc; ++inChild)
  {
    inChildNames.push_back(getChild(inChild)->getName());
  }
  for (hal_size_t outChild = 0; outChild < outNc; ++outChild)
  {
    outChildNames.push_back(dest->getChild(outChild)->getName());
  }
  map<hal_size_t, hal_size_t> inChildToOutChild;
  for (hal_size_t inChild = 0; inChild < inNc; inChild++)
  {
    hal_size_t outChild;
    for (outChild = 0; outChild < outNc; outChild++)
    {
      if (inChildNames[inChild] == outChildNames[outChild])
      {
        inChildToOutChild[inChild] = outChild;
        break;
      }
    }
    if (outChild == outNc)
    {
      inChildToOutChild[inChild] = outNc;
    }
  }

  // Go through each sequence in this genome, find the matching
  // sequence in the dest genome, then copy over the segments for each
  // sequence.
  SequenceIteratorConstPtr seqIt = getSequenceIterator();
  SequenceIteratorConstPtr seqEndIt = getSequenceEndIterator();

  for (; seqIt != seqEndIt; seqIt->toNext())
  {
    const Sequence *inSeq = seqIt->getSequence();
    const Sequence *outSeq = dest->getSequence(inSeq->getName());
    BottomSegmentIteratorPtr inBot = inSeq->getBottomSegmentIterator();
    BottomSegmentIteratorPtr outBot = outSeq->getBottomSegmentIterator();

    cout << "DEBUG: inSeq name: " << inSeq->getName() << ", outSeq name: " << outSeq->getName() << endl;

    if (inSeq->getName() != outSeq->getName()) {
      // This check is important enough that it can't be an assert.
      stringstream ss;
      ss << "When copying bottom segments: segment #" << inBot->getArrayIndex() << " of source genome is from sequence " << inBot->getSequence()->getName() << ", but segment #" << outBot->getArrayIndex() << " is from sequence " << outBot->getSequence()->getName();
      throw hal_exception(ss.str());
    }

    if (inSeq->getNumBottomSegments() != outSeq->getNumBottomSegments()) {
      stringstream ss;
      ss << "When copying bottom segments: sequence " << inSeq->getName() << " has " << inSeq->getNumBottomSegments() << " in genome " << getName() << ", while it has " << outSeq->getNumBottomSegments() << " in genome " << dest->getName();
      throw hal_exception(ss.str());      
    }

    hal_index_t inSegmentEnd = inSeq->getBottomSegmentArrayIndex() + inSeq->getNumBottomSegments();
    cout << "DEBUG: inSegmentStart: " << inSeq->getBottomSegmentArrayIndex() << " inSegmentEnd: " << inSegmentEnd << " num bottom segments: " << inSeq->getNumBottomSegments() << endl;
    for (; inBot->getArrayIndex() < inSegmentEnd; inBot->toRight(),
           outBot->toRight())
    {
      hal_index_t outStartPosition = inBot->getStartPosition() - inSeq->getStartPosition() + outSeq->getStartPosition();

      cout << "Decided on outStartPosition " << outStartPosition << " for seg index " << outBot->getArrayIndex() << " (src index " << inBot->getArrayIndex() << ")" << endl;

      if (dest->getSequenceBySite(outStartPosition) != outSeq) {
        stringstream ss;
        ss << "When copying bottom segments from " << getName() << " to " << dest->getName() << ": expected destination sequence " << outSeq->getName() << " for segment # " << inBot->getArrayIndex() << " but got " << dest->getSequenceBySite(outStartPosition)->getName();
        throw hal_exception(ss.str());
      }
      outBot->setCoordinates(outStartPosition, inBot->getLength());
      for(hal_size_t inChild = 0; inChild < inNc; inChild++) {
        hal_size_t outChild = inChildToOutChild[inChild];
        if (outChild != outNc) {
          outBot->setChildIndex(outChild, inBot->getChildIndex(inChild));
          cout << "genome " << getName() << ": Set child index " << inChild << " to " << inBot->getChildIndex(inChild) << endl;
          outBot->setChildReversed(outChild, inBot->getChildReversed(inChild));
        }
      }
      outBot->setTopParseIndex(inBot->getTopParseIndex());
    }
  }
}
void Graph::topSort() {
	// Sorting Magic happens here
	
    int nThreads;
    #pragma omp parallel
    {
        nThreads = omp_get_num_threads();
    } 
    // Indicator vector true if node is a current node (aka frontier node)
    std::vector<char> isCurrentNode(N_, false); //std::vector<bool> is not thread-safe
	// Spawn OMP threads
	#pragma omp parallel
	{
		// Declare Thread Private Variables
		const int threadID = omp_get_thread_num();
		type_nodelist currentnodes_local;
		type_nodelist solution_local;

		// Distribute Root Nodes among Threads
        #pragma omp for
		for(unsigned i=0; i<N_; ++i) {
			if(nodes_[i]->getValue()==1)
                isCurrentNode[i] = true;
		}
            
        #pragma omp for schedule(dynamic, 1024)
        for(size_t i = 0; i < N_; ++i){
            if(!isCurrentNode[i])
                continue;
            
            // Each thread on its own
            currentnodes_local.push_back(nodes_[i]);
            while(!currentnodes_local.empty()) {
                
                A_.incrementProcessedNodes(threadID);
                
                auto parent = currentnodes_local.front();

                A_.starttiming(analysis::SOLUTIONPUSHBACK);
                #pragma omp critical
                solution_.push_back(parent); // put node in solution
                A_.stoptiming(threadID, analysis::SOLUTIONPUSHBACK);
                currentnodes_local.pop_front(); // remove current node - already visited

                auto childcount = parent->getChildCount();
                A_.incrementProcessedEdges(threadID, childcount);
                for(type_size c=0; c<childcount; ++c) {
                    auto child = parent->getChild(c);

                    // Checking if last parent trying to update
                    A_.starttiming(analysis::REQUESTVALUEUPDATE);
                    auto flag = child->requestValueUpdate(); // IMPORTANT: control atomicity using OPTIMISTIC flag
                    A_.stoptiming(threadID,analysis::REQUESTVALUEUPDATE);
                    
                    if(flag) { // last parent checking child
                        currentnodes_local.push_back(child); // add child node at end of queue
                    } 
            
                }
            }
        }
	} // end of OMP parallel
}
예제 #5
0
파일: Token.cpp 프로젝트: js422/PERL
// ---------------------------------------------------------------------------
//  Token: Helper mthods
// ---------------------------------------------------------------------------
int Token::analyzeFirstCharacter(RangeToken* const rangeTok,
								 const int options,
                                 TokenFactory* const tokFactory)
{
	switch(fTokenType) {
	case T_CONCAT:
		{
			int ret = FC_CONTINUE;
			for (int i=0; i<size(); i++) {

				Token* tok = getChild(i);
				if (tok
					&& (ret=tok->analyzeFirstCharacter(rangeTok,
                                    options, tokFactory))!= FC_CONTINUE)
					break;
			}
			return ret;
		}
	case T_UNION:
		{
			unsigned int childSize = size();
            if (childSize == 0)
                return FC_CONTINUE;

            int ret = FC_CONTINUE;
			bool hasEmpty = false;

			for (unsigned int i=0; i < childSize; i++) {

                ret = getChild(i)->analyzeFirstCharacter(rangeTok, options, tokFactory);

				if (ret == FC_ANY)
					break;
				else
					hasEmpty = true;
			}
			return hasEmpty ? FC_CONTINUE : ret;
		}
	case T_CONDITION:
		{
            int ret1 = getChild(0)->analyzeFirstCharacter(rangeTok, options, tokFactory);

            if (size() == 1)
                return FC_CONTINUE;

			int ret2;
			if (ret1 != FC_ANY) {
			    ret2 = getChild(1)->analyzeFirstCharacter(rangeTok, options, tokFactory);
			}

			if (ret1 == FC_ANY || ret2 == FC_ANY)
				return FC_ANY;

			if (ret1 == FC_CONTINUE || ret2 == FC_CONTINUE)
				return FC_CONTINUE;

			return FC_TERMINAL;
		}
	case T_CLOSURE:
	case T_NONGREEDYCLOSURE:
		{
			Token* tok = getChild(0);
			if (tok)
				tok->analyzeFirstCharacter(rangeTok, options, tokFactory);
			return FC_CONTINUE;
		}
	case T_DOT:
    return FC_ANY;
	case T_EMPTY:
	case T_ANCHOR:
		return FC_CONTINUE;
	case T_CHAR:
		{
            XMLInt32 ch = getChar();
			rangeTok->addRange(ch, ch);
			if (ch < 0x1000 && isSet(options,RegularExpression::IGNORE_CASE)) {
				//REVISIT
			}
		}
		return FC_TERMINAL;
	case T_RANGE:
		{
			if (isSet(options, RegularExpression::IGNORE_CASE)) {
                rangeTok->mergeRanges(((RangeToken*)
                                         this)->getCaseInsensitiveToken(tokFactory));
			}
			else {
				rangeTok->mergeRanges(this);
			}
			return FC_TERMINAL;
		}
	case T_NRANGE:
		{
			if (isSet(options, RegularExpression::IGNORE_CASE)) {

				RangeToken* caseITok = (((RangeToken*)
					                       this)->getCaseInsensitiveToken(tokFactory));
				rangeTok->mergeRanges(RangeToken::complementRanges(caseITok, tokFactory, fMemoryManager));
			}
			else {
				rangeTok->mergeRanges(
					RangeToken::complementRanges((RangeToken*) this, tokFactory, fMemoryManager));
			}
		}
	case T_INDEPENDENT:
	case T_PAREN:
		{
			Token* tok = getChild(0);
			if (tok)
				return tok->analyzeFirstCharacter(rangeTok,options, tokFactory);
		}
	case T_MODIFIERGROUP:
	case T_BACKREFERENCE:
		rangeTok->addRange(0, UTF16_MAX);
		return FC_ANY;
	case T_STRING:
		{
			const XMLCh* str = getString();
            XMLInt32 ch = str[0];

			if (RegxUtil::isHighSurrogate((XMLCh) ch)) {
			}

		    rangeTok->addRange(ch, ch);
		    if (ch<0x10000 && isSet(options,RegularExpression::IGNORE_CASE)) {
                //REVISIT
            }
		}
		return FC_TERMINAL;
	case T_LOOKAHEAD:
	case T_NEGATIVELOOKAHEAD:
	case T_LOOKBEHIND:
	case T_NEGATIVELOOKBEHIND:
		return FC_CONTINUE;
//	default:
//		throw;
	}

	return 0;
}
예제 #6
0
QString cElement::value() const
{
	QString Value = text_;

	for ( unsigned int i = 0; i < childCount(); ++i )
	{
		const cElement* childTag = getChild( i );
		// <random />
		if ( childTag->name() == "random" )
		{
			// <random min="" max="" />
			if ( childTag->hasAttribute( "min" ) && childTag->hasAttribute( "max" ) )
			{
				QString min = childTag->getAttribute( "min" );
				QString max = childTag->getAttribute( "max" );

				if ( min.contains( "." ) || max.contains( "." ) )
					Value += QString::number( RandomNum( ( int ) min.toFloat(), ( int ) max.toFloat() ) );
				else
					Value += QString::number( RandomNum( min.toInt(), max.toInt() ) );
			}
			// <random valuelist="value1,value2,value3" />
			else if ( childTag->hasAttribute( "valuelist" ) )
			{
				QStringList RandValues = childTag->getAttribute( "valuelist" ).split( "," );
				Value += RandValues[RandomNum( 0, RandValues.size() - 1 )];
			}
			// <random list="listname" />
			else if ( childTag->hasAttribute( "list" ) )
			{
				Value += Definitions::instance()->getRandomListEntry( childTag->getAttribute( "list" ) );
			}
			// <random randomlist="listname1,listname2,listname3" />
			else if ( childTag->hasAttribute( "randomlist" ) )
			{
				QStringList RandValues = childTag->getAttribute( "randomlist" ).split( "," );
				Value += Definitions::instance()->getRandomListEntry( RandValues[RandomNum( 0, RandValues.size() - 1 )] );
			}
			// <random dice="1d6+2" />
			else if ( childTag->hasAttribute( "dice" ) )
			{
				Value += QString::number( rollDice( childTag->getAttribute( "dice" ) ) );
			}
			// <random value="10-20" />
			else if ( childTag->hasAttribute( "value" ) )
			{
				QStringList parts = childTag->getAttribute( "value", "0-0" ).split( "-" );

				if ( parts.count() >= 2 )
				{
					QString min = parts[0];
					QString max = parts[1];

					if ( max.contains( "." ) || min.contains( "." ) )
						Value += QString::number( RandomNum( ( int ) min.toFloat(), ( int ) max.toFloat() ) );
					else
						Value += QString::number( RandomNum( min.toInt(), max.toInt() ) );
				}
			}
			else
				Value += QString( "0" );
		}
	}

	return hex2dec( Value );
}
예제 #7
0
파일: ExampleApp.cpp 프로젝트: abrad/pocode
ExampleApp::~ExampleApp() {
	// record the final rotation of the shape
	poCommon::get()->setFloat("rotation", getChild(0)->rotation);
}
예제 #8
0
//----------------------------------------------------------------------------//
void GridLayoutContainer::swapChildren(Window* wnd1, const String& wnd2)
{
    swapChildren(wnd1, getChild(wnd2));
}
예제 #9
0
//----------------------------------------------------------------------------//
void GridLayoutContainer::swapChildren(const String& wnd1, Window* wnd2)
{
    swapChildren(getChild(wnd1), wnd2);
}
예제 #10
0
bool CSMFilter::NotNode::test (const CSMWorld::IdTableBase& table, int row,
    const std::map<int, int>& columns) const
{
    return !getChild().test (table, row, columns);
}
Boolean UNIX_CollectionInSystem::getChild(CIMProperty &p) const
{
	p = CIMProperty(PROPERTY_CHILD, getChild());
	return true;
}
예제 #12
0
bool ASTTransform::isConstant() const
{
  return getChild()->isConstant();
}
예제 #13
0
GPStreamADF::GPStreamADF(const GPMultiLayerTree* opttree)
{
    GPASSERT(NULL!=opttree);
    auto layers = opttree->layers();
    std::map<const GPFunctionTreePoint*, GPPtr<Point>> maplists;
    GPASSERT(layers.size()>=1);
    /*Create All CP*/
    for (auto iter : layers)
    {
        for (auto p : iter.second->display())
        {
            auto pp = (GPFunctionTreePoint*)p;
            if (GPFunctionTreePoint::FUNCTION == pp->type())
            {
                GPPtr<Point> cp = new CP(new GPComputePoint(pp->data().pFunc));
                mFunctions.push_back((CP*)(cp.get()));
                maplists.insert(std::make_pair(pp, cp));
            }
        }
    }
    /*Connect Already Exists CP*/
    for (auto cpiter : maplists)
    {
        auto tree = cpiter.first;
        auto output = cpiter.second;
        size_t n = tree->getChildrenNumber();
        for (int i=0; i<n; ++i)
        {
            auto _p = GPCONVERT(const GPFunctionTreePoint, tree->getChild(i));
            if (maplists.find(_p)!=maplists.end())
            {
                auto input = maplists.find(_p)->second;
                input->connectOutput(output, 0);
                output->connectInput(input.get(), i);
            }
        }
    }
    /*Create All Inputs*/
    std::map<int, std::vector<std::pair<const GPFunctionTreePoint*, int>>> inputLists;
    for (auto iter : maplists)
    {
        auto p = iter.first;
        size_t n = p->getChildrenNumber();
        for (int i=0; i<n; ++i)
        {
            auto _p = GPCONVERT(const GPFunctionTreePoint, p->getChild(i));
            if (GPFunctionTreePoint::INPUT == _p->type())
            {
                int pos = _p->data().iInput;
                if (inputLists.find(pos) == inputLists.end())
                {
                    std::vector<std::pair<const GPFunctionTreePoint*, int>> t;
                    inputLists.insert(std::make_pair(pos, t));
                }
                inputLists.find(pos)->second.push_back(std::make_pair(p, i));
            }
        }
    }
    /*Replace inputpos from layers*/
    for (auto iter : layers)
    {
        if (iter.first >= 0)
        {
            auto replacePos = iter.first;
            auto outputPoints = inputLists.find(replacePos)->second;
            GPPtr<Point> transform = new TP((int)outputPoints.size());
            mTPS.push_back((TP*)transform.get());
            GPPtr<Point> inputPoint = maplists.find(iter.second.get())->second;
            inputPoint->connectOutput(transform, 0);
            transform->connectInput(inputPoint.get(), 0);
            for (int j=0; j<outputPoints.size(); ++j)
            {
                GPPtr<Point> transform_node = new TP(1);
                mTPS.push_back((TP*)transform_node.get());
                transform->connectOutput(transform_node, j);
                transform_node->connectInput(transform.get(), 0);
                auto o_tree = outputPoints[j];
                auto o = maplists.find(o_tree.first)->second;
                o->connectInput(transform_node.get(), o_tree.second);
                transform_node->connectOutput(o, 0);
            }
            inputLists.erase(replacePos);
        }
    }
    /*Create SP*/
    GPASSERT(inputLists.size()>0);
    for (auto iter : inputLists)
    {
        for (auto v : iter.second)
        {
            auto tree = v.first;
            GPASSERT(GPFunctionTreePoint::FUNCTION == tree->type());
            auto pos = v.second;
            auto point = maplists.find(tree)->second;
            GPPtr<Point> source_point = new SP(tree->data().pFunc->inputType[pos]);
            source_point->connectOutput(point, 0);
            point->connectInput(source_point.get(), pos);
            mSources.push_back(source_point);
            mInputPos.push_back(iter.first);
        }
    }
    
    /*Create DP*/
    for (auto iter : opttree->layers())
    {
        if(iter.first < 0)
        {
            GPPtr<Point> input = maplists.find(iter.second.get())->second;
            for (size_t i=0; i<iter.second->data().pFunc->outputType.size(); ++i)
            {
                GPPtr<Point> dst = new DP(iter.second->data().pFunc->outputType[i]);
                mDest.push_back(dst);
                dst->connectInput(input.get(), 0);
                input->connectOutput(dst, 0);
            }
        }
    }
}
예제 #14
0
void LayerAndroid::assignSurfaces(LayerMergeState* mergeState)
{
    // recurse through layers in draw order, and merge layers when able

    bool needNewSurface = !mergeState->currentSurface
        || mergeState->nonMergeNestedLevel > 0
        || !canJoinSurface(mergeState->currentSurface);

    if (needNewSurface) {
        mergeState->currentSurface = new Surface();
        mergeState->surfaceList->append(mergeState->currentSurface);
    }

#ifdef LAYER_MERGING_DEBUG
    ALOGD("%*slayer %p(%d) rl %p %s surface %p lvl: %d, fixed %d, anim %d, intCom %d, haveClip %d scroll %d hasText (layer: %d surface: %d) hasContent %d size %.2f x %.2f",
          4*mergeState->depth, "", this, m_uniqueId, m_owningLayer,
          needNewSurface ? "NEW" : "joins", mergeState->currentSurface,
          mergeState->nonMergeNestedLevel,
          isPositionFixed(), m_animations.size() != 0,
          m_intrinsicallyComposited,
          m_haveClip,
          contentIsScrollable(), m_content ? m_content->hasText() : -1,
          mergeState->currentSurface ? mergeState->currentSurface->hasText() : -1,
          needsTexture(), getWidth(), getHeight());
#endif

    mergeState->currentSurface->addLayer(this, m_drawTransform);
    m_surface = mergeState->currentSurface;

    if (hasDynamicTransform()) {
        // disable layer merging within the children of these layer types
        mergeState->nonMergeNestedLevel++;
    }

    // pass the surface through children in drawing order, so that they may
    // attach themselves (and paint on it) if possible, or ignore it and create
    // a new one if not
    int count = this->countChildren();
    if (count > 0) {
        mergeState->depth++;
        Vector <LayerAndroid*> sublayers;
        for (int i = 0; i < count; i++)
            sublayers.append(getChild(i));

        // sort for the transparency
        std::stable_sort(sublayers.begin(), sublayers.end(), compareLayerZ);
        for (int i = 0; i < count; i++)
            sublayers[i]->assignSurfaces(mergeState);
        mergeState->depth--;
    }

    if (hasDynamicTransform()) {
        // re-enable joining
        mergeState->nonMergeNestedLevel--;

        // disallow layers painting after to join with this surface
        mergeState->currentSurface = 0;
    }

    if (needsIsolatedSurface())
        mergeState->currentSurface = 0;

}
예제 #15
0
void Data::OsgNode::setResidence( osg::Node* residence )
{
	auto at = getChild( INDEX_RESIDENCE )->asTransform()->asPositionAttitudeTransform();
	at->removeChildren( 0, at->getNumChildren() );
	at->addChild( residence );
}
예제 #16
0
//----------------------------------------------------------------------------//
void GridLayoutContainer::moveChildToPosition(const String& wnd,
                                                    size_t gridX, size_t gridY)
{
    moveChildToPosition(getChild(wnd), gridX, gridY);
}
예제 #17
0
void TabbedPane::display(void) {
   static Kernel *kernel = Kernel::getInstance();
   static Scissor *scissor = Scissor::getInstance();
   static FontTahoma *font = FontTahoma::getInstance();
   static ColorScheme *scheme = ColorScheme::getInstance();

   if (_cTexture == NULL || _isVisible == false) return;

   Scissor::getInstance()->pushScissor(Scissor::Info(getAbsolutePosition().x, Kernel::getInstance()->getHeight() - (getHeight() + getAbsolutePosition().y), getWidth(), getHeight() - s_barHeight));
   if (getCurrTabIndex() != -1) {
      configPanel();
      getChild(getCurrTabIndex())->display();
   }
   Scissor::getInstance()->popScissor();

   Point currPosition = getAbsolutePosition();
 
   scissor->pushScissor(getScissor());

   _cTexture->enable();

   // background
   scheme->applyColor(ColorScheme::MENUBAR);
   _cTexture->display(currPosition.x, currPosition.y, 0, getWidth(), s_barHeight);

   glColor3f(0.f,0.f,0.f);
   // vertical
   _cTexture->display(currPosition.x, currPosition.y + s_barHeight, 4, 1, getHeight() - s_barHeight);
   _cTexture->display(currPosition.x + getWidth() - 1, currPosition.y + s_barHeight, 4, 1, getHeight() - s_barHeight);

   // horizontal
   _cTexture->display(currPosition.x, currPosition.y + getHeight() - 1, 4, getWidth(), 1);

   // line bottom
   _cTexture->display(currPosition.x, currPosition.y + s_barHeight, 4, getWidth(), 1);

   if (getCurrTabIndex() != -1) {
      int size = _index[getCurrTabIndex() + 1] - _index[getCurrTabIndex()];

      scheme->applyColor(ColorScheme::PANEL);
      _cTexture->display(currPosition.x + _index[getCurrTabIndex()] + 1, currPosition.y + 2, 4, size - 2, 1);
      _cTexture->display(currPosition.x + _index[getCurrTabIndex()] + 0, currPosition.y + 3, 4, size, s_barHeight - 2);

      glColor3f(0.f,0.f,0.f);
      _cTexture->display(currPosition.x + _index[getCurrTabIndex()] + 2, currPosition.y + 1, 4, size - 4, 1);

      _cTexture->display(currPosition.x + _index[getCurrTabIndex()] + 1, currPosition.y + 2, 4, 1, 1);
      _cTexture->display(currPosition.x + _index[getCurrTabIndex() + 1] - 2, currPosition.y + 2, 4, 1, 1);

      _cTexture->display(currPosition.x + _index[getCurrTabIndex()], currPosition.y + 3, 4, 1, s_barHeight-3);
      _cTexture->display(currPosition.x + _index[getCurrTabIndex() + 1] - 1, currPosition.y + 3, 4, 1, s_barHeight-3);

      scheme->applyDefaultModulate();
   }

   if (_currecOverTab != -1) {

      int size = _index[_currecOverTab + 1] - _index[_currecOverTab];

      scheme->applyColor(ColorScheme::OVERCOMPONENTS);

      //vertical
      _cTexture->display(currPosition.x + _index[_currecOverTab] + size - 2, currPosition.y + 3, 2, 1, s_barHeight - 6);
      _cTexture->display(currPosition.x + _index[_currecOverTab] + 1       , currPosition.y + 3, 2, 1, s_barHeight - 6);
      //horizontal
      _cTexture->display(currPosition.x + _index[_currecOverTab] + 3       , currPosition.y  +1             , 2, size - 6, 1);
      _cTexture->display(currPosition.x + _index[_currecOverTab] + 3       , currPosition.y + s_barHeight -2, 2, size - 6, 1);

      // pixel border
      _cTexture->display(currPosition.x + _index[_currecOverTab] + 1       , currPosition.y + 1              , 3,  2,  2);
      _cTexture->display(currPosition.x + _index[_currecOverTab] + 1       , currPosition.y + s_barHeight - 1, 3,  2, -2);
      _cTexture->display(currPosition.x + _index[_currecOverTab] + size - 1, currPosition.y + 1              , 3, -2,  2);
      _cTexture->display(currPosition.x + _index[_currecOverTab] + size - 1, currPosition.y + s_barHeight - 1, 3, -2, -2);

      // center select
      _cTexture->display(currPosition.x + _index[_currecOverTab] + 3, currPosition.y + 3, 1, size - 6, s_barHeight - 6);

      scheme->applyDefaultModulate();
   }
   _cTexture->disable();

   for (int i = 0; i < _labels.size(); i++) {
      if (i == getCurrTabIndex()) {
         StaticLabel::display(currPosition.x + s_tabSpacing + _index[i], currPosition.y + 4, _labels[i], scheme->getColor(ColorScheme::CONTEXTMENUFONT));
      } else {
         StaticLabel::display(currPosition.x + s_tabSpacing + _index[i], currPosition.y + 4, _labels[i]);
      }
   }

   scissor->popScissor();

}
예제 #18
0
파일: DAGNode.cpp 프로젝트: mhdsedighi/SOFA
/// Generic object access, given a path from the current context
///
/// Note that the template wrapper method should generally be used to have the correct return type,
void* DAGNode::getObject(const sofa::core::objectmodel::ClassInfo& class_info, const std::string& path) const
{
    if (path.empty())
    {
        // local object
        return Node::getObject(class_info, Local);
    }
    else if (path[0] == '/')
    {
        // absolute path; let's start from root
        Parents parents = getParents();
        if (parents.empty()) return getObject(class_info,std::string(path,1));
        else return getRootContext()->getObject(class_info,path);
    }
    else if (std::string(path,0,2)==std::string("./"))
    {
        std::string newpath = std::string(path, 2);
        while (!newpath.empty() && path[0] == '/')
            newpath.erase(0);
        return getObject(class_info,newpath);
    }
    else if (std::string(path,0,3)==std::string("../"))
    {
        // tricky case:
        // let's test EACH parent and return the first object found (if any)
        std::string newpath = std::string(path, 3);
        while (!newpath.empty() && path[0] == '/')
            newpath.erase(0);
        Parents parents = getParents();
        if (!parents.empty())
        {
            for (Parents::iterator it = parents.begin(); it!=parents.end(); it++)
            {
                void* obj = dynamic_cast<Node*>(*it)->getObject(class_info,newpath);
                if (obj) return obj;
            }
            return 0;   // not found in any parent node at all
        }
        else return getObject(class_info,newpath);
    }
    else
    {
        std::string::size_type pend = path.find('/');
        if (pend == std::string::npos) pend = path.length();
        std::string name ( path, 0, pend );
        Node* child = getChild(name);
        if (child)
        {
            while (pend < path.length() && path[pend] == '/')
                ++pend;
            return child->getObject(class_info, std::string(path, pend));
        }
        else if (pend < path.length())
        {
            //std::cerr << "ERROR: child node "<<name<<" not found in "<<getPathName()<<std::endl;
            return NULL;
        }
        else
        {
            core::objectmodel::BaseObject* obj = simulation::Node::getObject(name);
            if (obj == NULL)
            {
                //std::cerr << "ERROR: object "<<name<<" not found in "<<getPathName()<<std::endl;
                return NULL;
            }
            else
            {
                void* result = class_info.dynamicCast(obj);
                if (result == NULL)
                {
                    std::cerr << "ERROR: object "<<name<<" in "<<getPathName()<<" does not implement class "<<class_info.name()<<std::endl;
                    return NULL;
                }
                else
                {
                    return result;
                }
            }
        }
    }
}
예제 #19
0
GPMultiLayerTree::GPMultiLayerTree(const GPFunctionTree* tree)
{
    auto _root = tree->root();
    /*Find Origin Inputs*/
    int maxInputNumber = -1;
    if (GPFunctionTreePoint::OUTPUT != _root->type())
    {
        GPPtr<GPFunctionTreePoint> root = GPFunctionTree::copy(tree->root());
        mLayers.insert(std::make_pair(-1, root));
        maxInputNumber = root->maxInputPos();
    }
    else
    {
        for (int i=0; i<_root->getChildrenNumber(); ++i)
        {
            GPPtr<GPFunctionTreePoint> subRoot = GPFunctionTree::copy(GPCONVERT(const GPFunctionTreePoint, _root->getChild(i)));
            int _maxI = subRoot->maxInputPos();
            if (_maxI > maxInputNumber)
            {
                maxInputNumber = _maxI;
            }
            mLayers.insert(std::make_pair(-i-1, subRoot));
        }
    }
    int subtree_inputpos = maxInputNumber+1;
    std::vector<GPFunctionTreePoint*> workLists;
    while (true)
    {
        /*Generate Next workLists*/
        workLists.clear();
        for (auto iter :mLayers)
        {
            auto childrens = iter.second->display();
            for (auto p : childrens)
            {
                auto pp = GPCONVERT(const GPFunctionTreePoint, p);
                if (GPFunctionTreePoint::FUNCTION == pp->type())
                {
                    workLists.push_back((GPFunctionTreePoint*)pp);
                }
            }
        }
        
        /*Find same subtree*/
        std::map<GPFunctionTreePoint*, std::vector<GPFunctionTreePoint*>> equallist;
        for (size_t i=0; i<workLists.size(); ++i)
        {
            auto forcompare = workLists[i];
            bool valid = true;
            for (auto iter : equallist)
            {
                if (forcompare->isChildOf(iter.first))
                {
                    valid = false;
                }
                for (auto p : iter.second)
                {
                    if (forcompare->isChildOf(p))
                    {
                        valid = false;
                        break;
                    }
                }
                if (!valid)
                {
                    break;
                }
            }
            if (!valid)
            {
                continue;
            }
            std::vector<GPFunctionTreePoint*> equalpairs;
            for (size_t j=i+1; j<workLists.size(); ++j)
            {
                if (workLists[j]->equal(forcompare))
                {
                    equalpairs.push_back(workLists[j]);
                }
            }
            /*Valid Point, Added to equallist*/
            if (!equalpairs.empty())
            {
                std::map<GPFunctionTreePoint*, std::vector<GPFunctionTreePoint*>> filtered_equallist;
                for (auto iter : equallist)
                {
                    bool valid = true;
                    if (iter.first->isChildOf(forcompare))
                    {
                        continue;
                    }
                    for (auto p : iter.second)
                    {
                        if (p->isChildOf(forcompare))
                        {
                            valid = false;
                            break;
                        }
                    }
                    if (valid)
                    {
                        filtered_equallist.insert(std::make_pair(iter.first, iter.second));
                    }
                }
                equallist = filtered_equallist;
                equallist.insert(std::make_pair(forcompare, equalpairs));
            }
        }
        
        /*Generate New Points*/
        for (auto iter : equallist)
        {
            GPFunctionTreePoint* inputpoints = NULL;
            int inputCur = -1;
            /*Find iter.first in previous layer*/
            for (auto l : mLayers)
            {
                if (iter.first->equal(l.second.get()))
                {
                    inputpoints = new GPFunctionTreePoint(GPFunctionTreePoint::INPUT, l.first);
                    inputCur = l.first;
                    break;
                }
            }
            /*Not find exists tree, create a new one*/
            if (NULL == inputpoints)
            {
                /*replace will decRef the iter.first, addRef to avoid free*/
                iter.first->addRef();
                inputpoints = new GPFunctionTreePoint(GPFunctionTreePoint::INPUT, subtree_inputpos);
                GPPtr<GPFunctionTreePoint> match = (GPFunctionTreePoint*)iter.first;
                mLayers.insert(std::make_pair(subtree_inputpos, match));
                inputCur = subtree_inputpos;
                subtree_inputpos++;
            }
            for (auto root_iter : mLayers)
            {
                if (root_iter.first!=inputCur)
                {
                    root_iter.second->replace((GPFunctionTreePoint*)iter.first, inputpoints);
                    for (auto p : iter.second)
                    {
                        root_iter.second->replace((GPFunctionTreePoint*)p, inputpoints);
                    }
                }
            }
            inputpoints->decRef();
        }
        if (equallist.empty())
        {
            break;
        }
    }
}
예제 #20
0
//========================================================
// Name   : GetChildValue
// Desc   : Find child with name and return child's value
// Return : NULL return if no child.
//========================================================
const char*	_tagXMLNode::getChildValue( const char* name )
{
	LPXNode node = getChild( name );
	return (node != NULL)? node->value.c_str() : NULL;
}
예제 #21
0
파일: ExampleApp.cpp 프로젝트: abrad/pocode
void ExampleApp::eventHandler(poEvent *event) {
	// handle key events
	if(event->type == PO_KEY_DOWN_EVENT) {
		// return key
		if(event->keyCode == PO_RETURN_KEY) {
			// toggle fullscreen the window
			poWindow *window = applicationCurrentWindow();
			applicationMakeWindowFullscreen(window, !window->isFullscreen());
		}
	}
	
	// re-center the image
	else if(event->type == PO_WINDOW_RESIZED_EVENT) {
		getChild(0)->position = getWindowCenter();
	}
	
	// turn on image border
	else if(event->type == PO_MOUSE_ENTER_EVENT) {
		poShape2D *shape = static_cast<poShape2D*>(event->source);
		shape->strokeColor = poColor::orange;
		shape->generateStroke(20);
	}
	
	// turn off image border
	else if(event->type == PO_MOUSE_LEAVE_EVENT) {
		poShape2D *shape = static_cast<poShape2D*>(event->source);
		shape->generateStroke(0);
	}
	
	// start masking the image
	else if(event->type == PO_MOUSE_DOWN_INSIDE_EVENT) {
		mask = new poOvalShape(100,100,50);
		mask->position = event->local_position;
		event->source->addModifier(new poGeometryMask(mask));
	}
	
	// stop masking the image
	else if(event->type == PO_MOUSE_UP_EVERYWHERE_EVENT) {
		event->source->removeModifier(0, true);
		mask = NULL;
	}
	
	// we're dragging the mask around!
	else if(event->type == PO_MOUSE_DRAG_EVENT) {
		mask->position = event->local_position;
	}
	
	// display the mouse coordinates
	else if(event->type == PO_MOUSE_MOVE_EVENT) {
		getChildAs<poTextBox>(1)->text((text_fmt % event->position.x % event->position.y).str())->layout();
	}

	// toggle image rotation
	else if(event->type == PO_MOUSE_DOWN_OUTSIDE_EVENT) {
		bool running = event->source->rotation_tween.isRunning();
		if(running)	event->source->rotation_tween.stop();
		else		event->source->rotation_tween.set(event->source->rotation + 360).start();
			
	}
	
}
예제 #22
0
LPXAttr _tagXMLNode::getChildAttr( const char* name, const char* attrname )
{
	LPXNode node = getChild(name);
	return node ? node->getAttr(attrname) : NULL;
}
예제 #23
0
파일: Token.cpp 프로젝트: js422/PERL
int Token::getMaxLength() const {

	switch (fTokenType) {

	case T_CONCAT:
        {
            int sum = 0;
            unsigned int childSize = size();

            for (unsigned int i=0; i<childSize; i++) {

                int val = getChild(i)->getMaxLength();

				if (val < 0){
					return -1;
				}
                sum += val;
            }
            return sum;
        }
    case T_CONDITION:
    case T_UNION:
        {
            unsigned int childSize = size();

			if (childSize == 0)
                return 0;

            int ret = getChild(0)->getMaxLength();

            for (unsigned i = 1; ret > 0 && i < childSize; i++) {

                int max = getChild(i)->getMaxLength();

                if (max < 0) {

                    ret = -1;
                    break;
                }

                if (max > ret)
                    ret = max;
            }
			return ret;
        }
    case T_CLOSURE:
    case T_NONGREEDYCLOSURE:
        if (getMax() >= 0) {
            return getMax() * getChild(0)->getMaxLength();
		}
		return -1;
    case T_EMPTY:
    case T_ANCHOR:
        return 0;
    case T_CHAR:
        return 1;
    case T_DOT:
    case T_RANGE:
    case T_NRANGE:
        return 2;
    case T_INDEPENDENT:
    case T_PAREN:
    case T_MODIFIERGROUP:
        return getChild(0)->getMaxLength();
    case T_BACKREFERENCE:
		return -1; // REVISIT
    case T_STRING:
        return XMLString::stringLen(getString());
    case T_LOOKAHEAD:
    case T_NEGATIVELOOKAHEAD:
    case T_LOOKBEHIND:
    case T_NEGATIVELOOKBEHIND:
		return 0; // REVISIT
//    default:
//		throw; //ThrowXML(RuntimeException, ...)
    } // end switch

	return -1;
}
예제 #24
0
//----------------------------------------------------------------------------//
Scrollbar* ScrollablePane::getHorzScrollbar() const
{
    return static_cast<Scrollbar*>(getChild(HorzScrollbarName));
}
예제 #25
0
파일: Token.cpp 프로젝트: js422/PERL
// ---------------------------------------------------------------------------
//  Token: Getter mthods
// ---------------------------------------------------------------------------
int Token::getMinLength() const {

	switch (fTokenType) {

	case T_CONCAT:
        {
            int sum = 0;
            unsigned int childSize = size();

            for (unsigned int i=0; i<childSize; i++) {
                sum += getChild(i)->getMinLength();
            }
            return sum;
        }
	case T_CONDITION:
	case T_UNION:
        {
			unsigned int childSize = size();

            if (childSize == 0) {
                return 0;
            }
			int ret = getChild(0)->getMinLength();

            for (unsigned int i=1; i < childSize; i++) {

                int min = getChild(i)->getMinLength();
                if (min < ret)
                    ret = min;
            }
			return ret;
        }
	case T_CLOSURE:
	case T_NONGREEDYCLOSURE:
        if (getMin() >= 0)
            return getMin() * getChild(0)->getMinLength();

		return 0;
	case T_EMPTY:
	case T_ANCHOR:
		return 0;
	case T_DOT:
	case T_CHAR:
	case T_RANGE:
	case T_NRANGE:
		return 1;
	case T_INDEPENDENT:
	case T_PAREN:
	case T_MODIFIERGROUP:
		return getChild(0)->getMinLength();
	case T_BACKREFERENCE:
		return 0; // *****  - REVISIT
	case T_STRING:
		return XMLString::stringLen(getString());
	case T_LOOKAHEAD:
	case T_NEGATIVELOOKAHEAD:
	case T_LOOKBEHIND:
	case T_NEGATIVELOOKBEHIND:
		return 0; // *****  - REVIST
//	default:
//		throw;
	}

	// We should not get here, but we have it to make some compilers happy
	return -1;
}
예제 #26
0
//----------------------------------------------------------------------------//
ScrolledContainer* ScrollablePane::getScrolledContainer() const
{
    return static_cast<ScrolledContainer*>(getChild(ScrolledContainerName));
}
예제 #27
0
bool CSubsystem::mapSubsystemElements(string& strError)
{
    // Default mapping context
    _contextStack.push(CMappingContext(_contextMappingKeyArray.size()));

    // Map all instantiated subelements in subsystem
    uint32_t uiNbChildren = getNbChildren();
    uint32_t uiChild;

    for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {

        CInstanceConfigurableElement* pInstanceConfigurableChildElement = static_cast<CInstanceConfigurableElement*>(getChild(uiChild));

        if (!pInstanceConfigurableChildElement->map(*this, strError)) {

            return false;
        }
    }
    return true;
}
예제 #28
0
/// Generic object access, given a path from the current context
///
/// Note that the template wrapper method should generally be used to have the correct return type,
void* GNode::getObject(const sofa::core::objectmodel::ClassInfo& class_info, const std::string& path) const
{
    if (path.empty())
    {
        return Node::getObject(class_info, Local);
    }
    else if (path[0] == '/')
    {
        if (parent()) return parent()->getObject(class_info, path);
        else return getObject(class_info,std::string(path,1));
    }
    else if (std::string(path,0,2)==std::string("./"))
    {
        std::string newpath = std::string(path, 2);
        while (!newpath.empty() && path[0] == '/')
            newpath.erase(0);
        return getObject(class_info,newpath);
    }
    else if (std::string(path,0,3)==std::string("../"))
    {
        std::string newpath = std::string(path, 3);
        while (!newpath.empty() && path[0] == '/')
            newpath.erase(0);
        if (parent()) return parent()->getObject(class_info,newpath);
        else return getObject(class_info,newpath);
    }
    else
    {
        std::string::size_type pend = path.find('/');
        if (pend == std::string::npos) pend = path.length();
        std::string name ( path, 0, pend );
        Node* child = getChild(name);
        if (child)
        {
            while (pend < path.length() && path[pend] == '/')
                ++pend;
            return child->getObject(class_info, std::string(path, pend));
        }
        else if (pend < path.length())
        {
            //std::cerr << "ERROR: child node "<<name<<" not found in "<<getPathName()<<std::endl;
            return NULL;
        }
        else
        {
            core::objectmodel::BaseObject* obj = simulation::Node::getObject(name);
            if (obj == NULL)
            {
                //std::cerr << "ERROR: object "<<name<<" not found in "<<getPathName()<<std::endl;
                return NULL;
            }
            else
            {
                void* result = class_info.dynamicCast(obj);
                if (result == NULL)
                {
                    std::cerr << "ERROR: object "<<name<<" in "<<getPathName()<<" does not implement class "<<class_info.name()<<std::endl;
                    return NULL;
                }
                else
                {
                    return result;
                }
            }
        }
    }
}
예제 #29
0
void DivNode::removeChild(unsigned i, bool bKill)
{
    NodePtr pChild = getChild(i);
    removeChild(pChild, bKill);
}
예제 #30
0
/* Affichage d'une expression unaire */
void pprintTree1(TreeP tree, char *op) {
  printf("(%s(", op); /* on parenthese explicitement l'unique operande */
  pprint(getChild(tree, 0));
  printf("))");
}