Example #1
0
Protocol* ProtocolFactory::Create(int type) {
  if (type <= 0 || type >= (int)protocol_.size()) {
    return NULL;
  }

  Protocol* protocol = protocol_.at(type);
  if (!protocol) {
    return NULL;
  }

  return protocol->Clone();
}