< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate-users] Why push mChain.size and mAddress in?


Hi,
    I am working on repro example,these two lines in the function addProcessor of class ProcessorChain confused me (in file ProcessorChain.cxx,line 55):
 
void
repro::ProcessorChain::addProcessor(auto_ptr<Processor> rp)
{
   DebugLog(<< "Adding new " << mName << " to chain: " << *(rp.get()));
   rp->pushAddress((short)mChain.size());
   rp->pushAddress(mAddress);
   rp->setChainType(mType);
   mChain.push_back(rp.release());
}

    So why rp(class Processor) put a vector size (mChai.size) and a vector (mAddress) in it's vector (mAddress),mAddress is defined in class Processor (in file Processor.hxx,line 49):

   protected:
      std::vector<short> mAddress;

and the two functions pushAddress are (in file Processor.cxx,line 23):

void
Processor::pushAddress(const std::vector<short>& address)
{
   for(std::vector<short>::const_iterator i=address.begin();i!=address.end();++i)
   {
      mAddress.push_back(*i);
   }
}

void
Processor::pushAddress(const short address)
{
   mAddress.push_back(address);
}

Thanks.