void
FieldInstructionStaticTemplateRef::finalize(TemplateRegistry & templateRegistry)
{
  TemplatePtr target;
  if(!templateRegistry.findNamedTemplate(templateName_, templateNamespace_, target))
  {
    std::stringstream exception;
    exception << "[ERR D9] Unknown template name for static templateref." << identity_->name();
    throw QuickFAST::TemplateDefinitionError(exception.str());
  }
  target->finalize(templateRegistry);
  // subtract one for the template ID
  presenceMapBitsUsed_ = target->presenceMapBitCount() - 1;
  fieldCount_ = target->fieldCount();
  isFinalized_ = true;
}
void
TemplateRegistry::addTemplate(TemplatePtr value)
{
  template_id_t id = value->getId();
  if(id != 0)
  {
    templates_[id] = value;
  }
  std::string name;
  value->qualifyName(name);
  if(!name.empty())
  {
    namedTemplates_[name] = value;
  }
  mutableTemplates_.push_back(value);
  // TODO: resolve templateRefs before calculating presence map bits.
  //       but that must be deferred to "finalize"
  size_t bits = value->presenceMapBitCount();
  if(bits > presenceMapBits_)
  {
    presenceMapBits_ = bits;
  }
}
Exemple #3
0
 inline Template * GetTemplate() {return m_pTemplate.get();}