INET Framework for OMNeT++/OMNEST
inet::httptools::rdObjectFactory Class Reference

A factory class used to construct random distribution objects based on XML elements. More...

#include <HttpRandom.h>

Public Member Functions

rdObjectcreate (cXMLAttributeMap attributes)
 

Detailed Description

A factory class used to construct random distribution objects based on XML elements.

The type name is used to instantiate the appropriate rdObject-derived class.

Member Function Documentation

rdObject * inet::httptools::rdObjectFactory::create ( cXMLAttributeMap  attributes)

Referenced by inet::httptools::HttpServerBase::initialize(), inet::httptools::HttpController::initialize(), and inet::httptools::HttpBrowserBase::initialize().

322 {
323  std::string typeName = attributes["type"];
324  DISTR_TYPE dt;
325  if (typeName == "normal")
326  dt = dt_normal;
327  else if (typeName == "uniform")
328  dt = dt_uniform;
329  else if (typeName == "exponential")
330  dt = dt_exponential;
331  else if (typeName == "histogram")
332  dt = dt_histogram;
333  else if (typeName == "constant")
334  dt = dt_constant;
335  else if (typeName == "zipf")
336  dt = dt_zipf;
337  else
338  return nullptr;
339 
340  switch (dt) {
341  case dt_normal:
342  return new rdNormal(attributes);
343 
344  case dt_uniform:
345  return new rdUniform(attributes);
346 
347  case dt_exponential:
348  return new rdExponential(attributes);
349 
350  case dt_histogram:
351  return new rdHistogram(attributes);
352 
353  case dt_constant:
354  return new rdConstant(attributes);
355 
356  case dt_zipf:
357  return new rdZipf(attributes);
358 
359  default:
360  return nullptr;
361  }
362 }
Definition: HttpRandom.h:33
DISTR_TYPE
Definition: HttpRandom.h:33
Definition: HttpRandom.h:33
Definition: HttpRandom.h:33
Definition: HttpRandom.h:33
Definition: HttpRandom.h:33
Definition: HttpRandom.h:33

The documentation for this class was generated from the following files: