本文整理汇总了C++中ObjectArray::end方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectArray::end方法的具体用法?C++ ObjectArray::end怎么用?C++ ObjectArray::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectArray
的用法示例。
在下文中一共展示了ObjectArray::end方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}
示例2: collect
void ImmixGC::collect(GCData& data) {
Object* tmp;
gc_.clear_lines();
int via_handles_ = 0;
int via_roots = 0;
int via_stack = 0;
int callframes = 0;
for(Roots::Iterator i(data.roots()); i.more(); i.advance()) {
tmp = i->get();
if(tmp->reference_p()) saw_object(tmp);
via_roots++;
}
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()) {
ri->set(saw_object(ri->get()));
}
}
}
for(capi::Handles::Iterator i(*data.handles()); i.more(); i.advance()) {
if(i->in_use_p() && !i->weak_p()) {
saw_object(i->object());
via_handles_++;
}
}
for(capi::Handles::Iterator i(*data.cached_handles()); i.more(); i.advance()) {
if(i->in_use_p() && !i->weak_p()) {
saw_object(i->object());
via_handles_++;
}
}
std::list<capi::Handle**>* gh = data.global_handle_locations();
if(gh) {
for(std::list<capi::Handle**>::iterator i = gh->begin();
i != gh->end();
i++) {
capi::Handle** loc = *i;
if(capi::Handle* hdl = *loc) {
if(!CAPI_REFERENCE_P(hdl)) continue;
if(hdl->valid_p()) {
Object* obj = hdl->object();
if(obj && obj->reference_p()) {
saw_object(obj);
via_handles_++;
}
} else {
std::cerr << "Detected bad handle checking global capi handles\n";
}
}
}
}
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;
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.
//.........这里部分代码省略.........
示例3: SetTankFromSpacecraft
//------------------------------------------------------------------------------
// 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;
}
示例4: 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);
}
}
示例5: 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;
}