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


C++ ObjectArray类代码示例

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


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

示例1: QueryArchives

int SevenZipPlugin::QueryArchives(
		const unsigned char* pBuffer, 
		DWORD dwBufferSize, 
		const TCHAR* lpFileName, 
		Array<ArchiveQueryResult*>& result
		)
{
	ObjectArray<FormatPosition*> formats;

	FindFormats(pBuffer, dwBufferSize, lpFileName, formats);

	formats.sort((void*)SortFormats, NULL);

	for (unsigned int i = 0; i < formats.count(); i++)
	{
		ArchiveQueryResult* pResult = new ArchiveQueryResult;

		pResult->uidPlugin = m_uid;
		pResult->uidFormat = *formats[i]->puid;

		result.add(pResult);
	}

	return formats.count(); //badbad, return added only!!!
}
开发者ID:CyberShadow,项目名称:FAR,代码行数:25,代码来源:7z.Plugin.cpp

示例2: throw

UGenArray::UGenArray(ObjectArray<UGen> const& array) throw()
:	internal((array.length() <= 0) ? 0 : new Internal(array.length()))
{
	if(internal != 0)
	{
		for(int i = 0; i < internal->size(); i++)
		{
			internal->getArray()[i] = array[i];
		}
	}
}
开发者ID:kazu2012,项目名称:ofxUGen,代码行数:11,代码来源:ugen_UGenArray.cpp

示例3: SetPropagationProperties

//------------------------------------------------------------------------------
void RunSimulator::SetPropagationProperties(PropagationStateManager *psm)
{
   ObjectArray pObjects;
   psm->GetStateObjects(pObjects, Gmat::UNKNOWN_OBJECT);

   for (ObjectArray::iterator p = pObjects.begin(); p != pObjects.end(); ++p)
   {
      if ((*p)->IsOfType(Gmat::SPACEOBJECT))
      {
         if (includeSTMPropagation)
            psm->SetProperty("STM", *p);
      }
   }
}
开发者ID:ddj116,项目名称:gmat,代码行数:15,代码来源:RunSimulator.cpp

示例4: add_weak_ref

    /**
     * Adds a weak reference to the specified object.
     *
     * A weak reference provides a way to hold a reference to an object without
     * that reference being sufficient to keep the object alive. If no other
     * reference to the weak-referenced object exists, it can be collected by
     * the garbage collector, with the weak-reference subsequently returning
     * null.
     */
    void add_weak_ref(Object* obj) {
      if(!weak_refs_) {
        weak_refs_ = new ObjectArray;
      }

      weak_refs_->push_back(obj);
    }
开发者ID:teleological,项目名称:rubinius,代码行数:16,代码来源:gc.hpp

示例5: throw

TextArray::TextArray (ObjectArray<RowType> const& other) throw()
:	Base (other.size())
{
    const int rows = this->size();
    
    for (int row = 0; row < rows; ++row)
        this->put (row, Text (other[row]));
}
开发者ID:benavrhm,项目名称:pl-nk,代码行数:8,代码来源:plonk_TextArray.cpp

示例6: create

bool SphereObjectFactory::create(
    const char*            name,
    const ParamArray&      params,
    const SearchPaths&     search_paths,
    const bool             omit_loading_assets,
    ObjectArray&           objects) const
{
    objects.push_back(create(name, params).release());
    return true;
}
开发者ID:appleseedhq,项目名称:appleseed,代码行数:10,代码来源:sphereobject.cpp

示例7: dumpTree

void dumpTree(std::ostream& result, Node node, std::string indent)
{
    while (node) {
        result << indent << node << '\n';
        Element element = interface_cast<Element>(node);
        if (element.getNodeType() == Node::ELEMENT_NODE) {
            ObjectArray<Attr> attrArray = element.getAttributes();
            assert(attrArray);
            for (unsigned int i = 0; i < attrArray.getLength(); ++i) {
                Attr attr = attrArray.getElement(i);
                assert(attr);
                result << indent << "  " << attr.getName() << "=\"" << attr.getValue() << "\"\n";
            }
        }
        if (node.hasChildNodes())
            dumpTree(result, node.getFirstChild(), indent + ((node.getNodeType() == Node::DOCUMENT_NODE) ? "| " : "  "));
        node = node.getNextSibling();
    }
}
开发者ID:josejamilena,项目名称:es-operating-system,代码行数:19,代码来源:Test.util.cpp

示例8: Locate

//------------------------------------------------------------------------------
Real EstimationRootFinder::Locate(ObjectArray &whichOnes)
{
   #ifdef DEBUG_ROOT_SEARCH
      MessageInterface::ShowMessage("EstimationRootFinder::Locate called with %d "
            "events\n", whichOnes.size());
   #endif
   Real rootEpoch = -1.0;

   events = (std::vector<Event*>*)(&whichOnes);

   for (UnsignedInt i = 0; i < whichOnes.size(); ++i)
   {
      Real foundEpoch = FindRoot(i);
      if (foundEpoch > 0.0)
      {
         rootEpoch = (rootEpoch == -1.0 ? foundEpoch :
                      (rootEpoch > foundEpoch ? foundEpoch : rootEpoch));
      }
   }

   return rootEpoch;
}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:23,代码来源:EstimationRootFinder.cpp

示例9: FindRoot

//-----------------------------------------------------------------------------
Real EventManager::FindRoot(Integer whichOne)
{
   #ifdef DEBUG_EVENTMAN_FINDROOT
      MessageInterface::ShowMessage("EventManager::FindRoot looking for "
            "root %d out of %d known events\n", whichOne, events.size());
   #endif
   Real rootTime = -1.0;

   ObjectArray eventList;
   eventList.clear();

   // For now, just find one root in this call
   if ((whichOne >= 0) && (whichOne < (Integer)events.size()))
   {
      #ifdef DEBUG_EVENTMAN_FINDROOT
         MessageInterface::ShowMessage("   Placing %s on the stack\n",
               events[whichOne]->GetName().c_str());
      #endif

      eventList.push_back(events[whichOne]);
      #ifdef DEBUG_EVENTMAN_FINDROOT
         MessageInterface::ShowMessage("   Calling RootFinder to check the "
               "current event list\n");
      #endif
      rootTime = locater.Locate(eventList);

      ((Event*)events[whichOne])->Evaluate();
      // Now calculate the next time step estimate based on propagated states
      ((Event*)events[whichOne])->EstimateTimestep();

      #ifdef DEBUG_EVENTMAN_FINDROOT
         MessageInterface::ShowMessage("   Evaluated event function; status is "
               "now %d\n", ((Event*)events[whichOne])->CheckStatus());
      #endif
   }

   return rootTime;
}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:39,代码来源:EventManager.cpp

示例10: saw_object


//.........这里部分代码省略.........
        via_stack++;
        if(tmp->reference_p() && tmp->young_object_p()) {
          saw_object(tmp);
        }
      }
    }

    // Walk all the call frames
    for(CallFrameLocationList::const_iterator i = data.call_frames().begin();
        i != data.call_frames().end();
        i++) {
      callframes++;
      CallFrame** loc = *i;
      walk_call_frame(*loc);
    }

    gc_.process_mark_stack(allocator_);

    // We've now finished marking the entire object graph.

    check_finalize();

    // Finalize can cause more things to continue to live, so we must
    // check the mark_stack again.
    gc_.process_mark_stack(allocator_);

    // Sweep up the garbage
    gc_.sweep_blocks();

    // This resets the allocator state to sync it up with the BlockAllocator
    // properly.
    allocator_.get_new_block();

    ObjectArray *current_rs = object_memory_->remember_set();

    int cleared = 0;

    for(ObjectArray::iterator oi = current_rs->begin();
        oi != current_rs->end();
        oi++) {
      tmp = *oi;
      // unremember_object throws a NULL in to remove an object
      // so we don't have to compact the set in unremember
      if(tmp) {
        assert(tmp->zone() == MatureObjectZone);
        assert(!tmp->forwarded_p());

        if(!tmp->marked_p(object_memory_->mark())) {
          cleared++;
          *oi = NULL;
        }
      }
    }

    for(std::list<gc::WriteBarrier*>::iterator wbi = object_memory_->aux_barriers().begin();
        wbi != object_memory_->aux_barriers().end();
        wbi++) {
      gc::WriteBarrier* wb = *wbi;
      ObjectArray* rs = wb->remember_set();
      for(ObjectArray::iterator oi = rs->begin();
          oi != rs->end();
          oi++) {
        tmp = *oi;

        if(tmp) {
          assert(tmp->zone() == MatureObjectZone);
开发者ID:mutle,项目名称:rubinius,代码行数:67,代码来源:immix.cpp

示例11: VerifyAddHardware

//-------------------------------------------------------------------------
// This function is used to verify GroundStation's added hardware.
//
// return true if there is no error, false otherwise.
//-------------------------------------------------------------------------
// made changes by Tuan Nguyen
bool GroundStation::VerifyAddHardware()
{
   Gmat::ObjectType type;
   std::string subTypeName;
   GmatBase* obj;

   // 1. Verify all hardware in hardwareList are not NULL:
   for(ObjectArray::iterator i= hardwareList.begin(); i != hardwareList.end(); ++i)
   {
	   obj = (*i);
	   if (obj == NULL)
	   {
		   MessageInterface::ShowMessage("***Error***:One element of hardwareList = NULL\n");
		   return false;
	   }
   }

   // 2. Verify primary antenna to be in hardwareList:
   // 2.1. Create antenna list from hardwareList for searching:
   // extract all antenna from hardwareList and store to antennaList
   ObjectArray antennaList;
   for(ObjectArray::iterator i= hardwareList.begin(); i != hardwareList.end(); ++i)
   {
	  obj = (*i);
      subTypeName = obj->GetTypeName();
	  if (subTypeName == "Antenna")
		 antennaList.push_back(obj);
   }

   // 2.2. Verify primary antenna of Receiver, Transmitter, and Transponder:
   GmatBase* antenna;
   GmatBase* primaryAntenna;
   std::string primaryAntennaName;
   bool verify = true;
   for(ObjectArray::iterator i= hardwareList.begin(); i != hardwareList.end(); ++i)
   {
	  obj = (*i);
	  type = obj->GetType();
	  if (type == Gmat::HARDWARE)
	  {
         subTypeName = obj->GetTypeName();
         if ((subTypeName == "Transmitter")||
        	 (subTypeName == "Receiver")||
        	 (subTypeName == "Transponder"))
         {
    		 // Get primary antenna:
    		 primaryAntennaName = obj->GetRefObjectName(Gmat::HARDWARE);
    		 primaryAntenna = obj->GetRefObject(Gmat::HARDWARE,primaryAntennaName);

    		 bool check;
    		 if (primaryAntenna == NULL)
    		 {
    			 MessageInterface::ShowMessage
					 ("***Error***:primary antenna of %s in %s's AddHardware list is NULL \n",
					  obj->GetName().c_str(), this->GetName().c_str());
    			 check = false;
    		 }
    		 else
    		 {
    			 // Check primary antenna of transmitter, receiver, or transponder is in antenna list:
    			 check = false;
    			 for(ObjectArray::iterator j= antennaList.begin(); j != antennaList.end(); ++j)
    			 {
    				 antenna = (*j);
    				 if (antenna == primaryAntenna)
    				 {
    					 check = true;
    					 break;
    				 }
    				 else if (antenna->GetName() == primaryAntenna->GetName())
    				 {
    					 MessageInterface::ShowMessage
							 ("Primary antenna %s of %s is a clone of an antenna in %s's AddHardware\n",
							  primaryAntenna->GetName().c_str(), obj->GetName().c_str(), this->GetName().c_str());
    				 }
    			 }
            	 if (check == false)
            	 {
            		 // Display error message:
            		 MessageInterface::ShowMessage
							 ("***Error***:primary antenna of %s is not in %s's AddHardware\n",
							  obj->GetName().c_str(), this->GetName().c_str());
            	 }

        	 }

        	 verify = verify && check;
         }
	  }
   }

   return verify;
}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:99,代码来源:GroundStation.cpp

示例12: writeChartContents

/*****************************************************
**
**   BasicVedicChart   ---   writeChartContents
**
******************************************************/
void BasicVedicChart::writeChartContents( const int &chart_id, const bool applyFilter )
{
	ObjectId planet;
	uint f;
	wxString lname, sname, symbol, av;
	bool retro, avmode;
	SymbolProvider sp;
	SheetFormatter fmt;

	if ( chart_id == 0 && ! h1set ) printf( "WARN BasicVedicChart::writeChartContents no chart set for id 0\n" );
	if ( chart_id == 1 && ! h2set ) printf( "WARN BasicVedicChart::writeChartContents no chart set for id 1\n" );

	ObjectArray o = applyFilter ? chartprops->getVedicPlanetList( chartprops->getObjectFilter()) : obs;
	for ( uint i = 0; i < o.size(); i++ )
	{
		planet = o[i];

		// do not paint ascendant in north indian chart
		if ( field_count == 12 && chart_id == 0 && planet == OASCENDANT && chartprops->getVedicChartDisplayConfig().indianChartType == VCT_NORTH ) continue;

		// do not paint ascendant in south indian chart if markup of AS is enabled
		if ( field_count == 12 && ! h2set && planet == OASCENDANT && chartprops->getVedicChartDisplayConfig().southIndianAscendantMarkup ) continue;

		f = a_red( getPlanetField( planet, chart_id ) - positionOffset, field_count );
		//printf( "positionOffset %d\n", positionOffset );
		assert( f < fields.size());

		ChartContents &cc = fields[f].getContents( chart_id );

		cc.planets.push_back( planet );

		lname = fmt.getObjectNamePlain( planet, TF_LONG, true );
		sname = fmt.getObjectNamePlain( planet, TF_MEDIUM, true );

		// retrogression
		retro = ( chartprops->getVedicChartDisplayConfig().showRetro ) && getPlanetRetro( planet, chart_id )
		        && planet != OMEANNODE && planet != OMEANDESCNODE;
		if ( retro )
		{
			//lname += wxT( " " );
			lname += wxT( "(R)" );
			sname += wxT( "R" );
		}

		// see if transit mode, varga, av and valid planet
		avmode = ( IS_AVPLANET( planet )
			&& charttype == CT_TRANSIT
			&& chart_id == 1
			&& field_count == 12
			&& chartprops->getVedicChartDisplayConfig().showAshtakavarga );

		if ( avmode )
		{
			av = wxString::Format( wxT( " %d" ), getAshtakavargaPoints( planet, f ));
			sname += av;
			lname += av;
		}

		// symbol
		symbol.Clear();
		if ( ! avmode && config->writer->planetSymbols && getVChartConfig()->useSymbols && planet <= MAX_EPHEM_OBJECTS ) symbol = sp.getPlanetCode( planet );
		if ( ! symbol.IsEmpty() )
		{
			cc.graphicitems.push_back( ChartGraphicItem( symbol, planet, retro ));
		}
		else
		{
			ChartTextItem item( lname, sname, retro );
			cc.textitems.push_back( item );
		}
	}
}
开发者ID:martin-pe,项目名称:maitreya8,代码行数:77,代码来源:BasicVedicChart.cpp

示例13: BurnException

//------------------------------------------------------------------------------
// bool SetTankFromSpacecraft()
//------------------------------------------------------------------------------
bool ImpulsiveBurn::SetTankFromSpacecraft()
{
   #ifdef DEBUG_IMPBURN_SET
   MessageInterface::ShowMessage
      ("ImpulsiveBurn::SetTankFromSpacecraft() entered, spacecraft=<%p>'%s'\n",
       spacecraft, spacecraft ? spacecraft->GetName().c_str() : "NULL");
   MessageInterface::ShowMessage("   tankNames.size()=%d\n", tankNames.size());
   #endif
   
   if (spacecraft == NULL)
      return false;
   
   if (tankNames.empty())
      throw BurnException("ImpulsiveBurn::Initialize() " + instanceName +
                          " has no associated tank");
   
   ObjectArray tankArray = spacecraft->GetRefObjectArray(Gmat::FUEL_TANK);
   
   #ifdef DEBUG_IMPBURN_SET
   MessageInterface::ShowMessage
      ("   spacecraft tankArray.size()=%d\n", tankArray.size());
   #endif
   
   if (!tankNames.empty() && !tankArray.empty())
   {
      ObjectArray::iterator scTank = tankArray.begin();
      
      // Find the tank on the spacecraft
      for (StringArray::iterator tankName = tankNames.begin();
           tankName != tankNames.end(); ++tankName)
      {
         while (scTank != tankArray.end())
         {
            #ifdef DEBUG_IMPBURN_SET
            MessageInterface::ShowMessage
               ("   The tank '%s' associated with spacecraft is <%p>'%s'\n",
                (*tankName).c_str(), (*scTank),
                (*scTank) ? (*scTank)->GetName().c_str() : "NULL");
            #endif
            
            // Just in case, check for NULL tank pointer
            if (*scTank == NULL)
               continue;
            
            // Assign the tank
            if ((*scTank)->GetName() == *tankName)
            {
               tankMap[*tankName] = (*scTank);
               #ifdef DEBUG_IMPBURN_SET
               MessageInterface::ShowMessage
                  ("   Assigned <%p>'%s' to tankMap\n", *scTank, (*tankName).c_str());
               #endif
            }
            ++scTank;
         }
      }
      if (tankNames.size() != tankMap.size())
         throw BurnException("The impulsive burn " + instanceName +
               " could not find the fuel tank needed to deplete mass; please "
               "attach the tank to the spacecraft " + spacecraft->GetName() +
               " or turn off mass depletion.");
   }
   
   #ifdef DEBUG_IMPBURN_SET
   MessageInterface::ShowMessage
      ("ImpulsiveBurn::SetTankFromSpacecraft() returning true\n");
   #endif
   
   return true;
}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:73,代码来源:ImpulsiveBurn.cpp

示例14: BuildResidualPlot

//------------------------------------------------------------------------------
void BatchEstimator::CompleteInitialization()
{
   #ifdef WALK_STATE_MACHINE
      MessageInterface::ShowMessage("BatchEstimator state is INITIALIZING\n");
   #endif

   if (showAllResiduals)
   {
      StringArray plotMeasurements;
      for (UnsignedInt i = 0; i < measurementNames.size(); ++i)
      {
         plotMeasurements.clear();
         plotMeasurements.push_back(measurementNames[i]);
         std::string plotName = instanceName + "_" + measurementNames[i] +
               "_Residuals";
         BuildResidualPlot(plotName, plotMeasurements);
      }
   }

   if (advanceToEstimationEpoch == false)
   {
      PropagationStateManager *psm = propagator->GetPropStateManager();
      GmatState               *gs  = psm->GetState();
      estimationState              = esm.GetState();
      stateSize = estimationState->GetSize();

      Estimator::CompleteInitialization();

      // If estimation epoch not set, use the epoch from the prop state
      if ((estEpochFormat == "FromParticipants") || (estimationEpoch <= 0.0))
      {
         ObjectArray participants;
         esm.GetStateObjects(participants, Gmat::SPACEOBJECT);
         for (UnsignedInt i = 0; i < participants.size(); ++i)
            estimationEpoch   = ((SpaceObject *)(participants[i]))->GetEpoch();
      }
      currentEpoch         = gs->GetEpoch();

      // Tell the measManager to complete its initialization
      bool measOK = measManager.Initialize();
      if (!measOK)
         throw SolverException(
               "BatchEstimator::CompleteInitialization - error initializing "
               "MeasurementManager.\n");

      // Now load up the observations
      measManager.PrepareForProcessing();
      measManager.LoadObservations();

      if (!GmatMathUtil::IsEqual(currentEpoch, estimationEpoch))
      {
         advanceToEstimationEpoch = true;
         nextMeasurementEpoch = estimationEpoch;
         currentState = PROPAGATING;
         return;
      }
   }

   advanceToEstimationEpoch = false;

   // First measurement epoch is the epoch of the first measurement.  Duh.
   nextMeasurementEpoch = measManager.GetEpoch();

   #ifdef DEBUG_INITIALIZATION
      MessageInterface::ShowMessage(
            "Init complete!\n   STM = %s\n   Covariance = %s\n",
            stm->ToString().c_str(), covariance->ToString().c_str());
   #endif

   hAccum.clear();
   if (useApriori)
   {
      information = stateCovariance->GetCovariance()->Inverse();
   }
   else
   {
      information.SetSize(stateSize, stateSize);
      for (UnsignedInt i = 0; i <  stateSize; ++i)
         for (UnsignedInt j = 0; j <  stateSize; ++j)
            information(i,j) = 0.0;
   }

   residuals.SetSize(stateSize);
   x0bar.SetSize(stateSize);

   measurementResiduals.clear();
   measurementEpochs.clear();

   for (Integer i = 0; i < information.GetNumRows(); ++i)
   {
      residuals[i] = 0.0;
      if (useApriori)
         x0bar[i] = (*estimationState)[i];
      else
         x0bar[i] = 0.0;
   }

   if (useApriori)
      for (Integer i = 0; i < information.GetNumRows(); ++i)
//.........这里部分代码省略.........
开发者ID:ddj116,项目名称:gmat,代码行数:101,代码来源:BatchEstimator.cpp

示例15: seed

  void ObjectWalker::seed(GCData& data) {
    Object* tmp;
    ObjectArray *current_rs = object_memory_->remember_set();

    for(ObjectArray::iterator oi = current_rs->begin();
        oi != current_rs->end();
        ++oi) {
      tmp = *oi;
      // unremember_object throws a NULL in to remove an object
      // so we don't have to compact the set in unremember
      if(tmp) saw_object(tmp);
    }

    for(std::list<gc::WriteBarrier*>::iterator wbi = object_memory_->aux_barriers().begin();
        wbi != object_memory_->aux_barriers().end();
        ++wbi) {
      gc::WriteBarrier* wb = *wbi;
      ObjectArray* rs = wb->remember_set();
      for(ObjectArray::iterator oi = rs->begin();
          oi != rs->end();
          ++oi) {
        tmp = *oi;

        if(tmp) saw_object(tmp);
      }
    }

    for(Roots::Iterator i(data.roots()); i.more(); i.advance()) {
      saw_object(i->get());
    }

    if(data.threads()) {
      for(std::list<ManagedThread*>::iterator i = data.threads()->begin();
          i != data.threads()->end();
          ++i) {
        for(Roots::Iterator ri((*i)->roots()); ri.more(); ri.advance()) {
          saw_object(ri->get());
        }
      }
    }

    for(capi::Handles::Iterator i(*data.handles()); i.more(); i.advance()) {
      saw_object(i->object());
    }

    for(capi::Handles::Iterator i(*data.cached_handles()); i.more(); i.advance()) {
      saw_object(i->object());
    }

    for(VariableRootBuffers::Iterator i(data.variable_buffers());
        i.more(); i.advance()) {
      Object*** buffer = i->buffer();
      for(int idx = 0; idx < i->size(); idx++) {
        Object** var = buffer[idx];
        Object* tmp = *var;

        saw_object(tmp);
      }
    }

    RootBuffers* rb = data.root_buffers();
    if(rb) {
      for(RootBuffers::Iterator i(*rb);
          i.more();
          i.advance())
      {
        Object** buffer = i->buffer();
        for(int idx = 0; idx < i->size(); idx++) {
          saw_object(buffer[idx]);
        }
      }
    }

    // Walk all the call frames
    for(CallFrameLocationList::iterator i = data.call_frames().begin();
        i != data.call_frames().end();
        ++i) {
      CallFrame** loc = *i;
      walk_call_frame(*loc);
    }
  }
开发者ID:Twisol,项目名称:rubinius,代码行数:81,代码来源:walker.cpp


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