INET Framework for OMNeT++/OMNEST
custom Class Reference

#include <App_custum.h>

Inheritance diagram for custom:
ITrafGenApplication

List of all members.

Public Member Functions

 custom ()
virtual bool loadConfig (const cXMLElement &appConfig)
virtual int getDefaultPort ()
virtual double getNextPacketTime ()
virtual int getPacketSize ()
virtual int anotherEncapsulationOverhead ()

Private Attributes

double pps
int size
std::string tDistr
std::string sDistr

Detailed Description

Definition at line 26 of file App_custum.h.


Constructor & Destructor Documentation

custom::custom ( ) [inline]

Definition at line 35 of file App_custum.h.

{pps = 0.0; size = 0; tDistr = "constant"; sDistr = "constant";}

Member Function Documentation

Implements ITrafGenApplication.

Definition at line 75 of file App_custum.cc.

{
  return 0;
}
int custom::getDefaultPort ( ) [virtual]

Implements ITrafGenApplication.

Definition at line 64 of file App_custum.cc.

{
  return 1024;
}
double custom::getNextPacketTime ( ) [virtual]

Implements ITrafGenApplication.

Definition at line 86 of file App_custum.cc.

{
  if(tDistr == "normal")
  {
    return normal(1.0/pps, 1.0/(pps*10));
  }
  else if (tDistr == "exponential")
  {
    return exponential(1.0/pps);
  }
  else
  {
    return 1.0/pps; 
  }
} 
int custom::getPacketSize ( ) [virtual]

Implements ITrafGenApplication.

Definition at line 107 of file App_custum.cc.

{
  if(tDistr == "normal")
  {
    return (int) normal(size, size/10);
  }
  else if (tDistr == "exponential")
  {
    return (int) exponential(size);
  }
  else
  {
    return size; 
  }
}
bool custom::loadConfig ( const cXMLElement &  appConfig) [virtual]

Implements ITrafGenApplication.

Definition at line 32 of file App_custum.cc.

{
  
  cXMLElement* element;

  element = appConfig.getFirstChildWithTag("packets_per_second");
  if(element != NULL)
    pps = atof(element->getNodeValue());
    
  element = appConfig.getFirstChildWithTag("packet_size");
  if(element != NULL)
    size = atoi(element->getNodeValue());
    
  element = appConfig.getFirstChildWithTag("time_distribution");
  if(element != NULL)
    tDistr = element->getNodeValue();
    
  element = appConfig.getFirstChildWithTag("size_distribution");
  if(element != NULL)
    sDistr = element->getNodeValue();
  
  if(pps == 0.0 || size == 0)
    return false; // chyba nacitania
  
  return true;
}

Member Data Documentation

double custom::pps [private]

Definition at line 29 of file App_custum.h.

Referenced by getNextPacketTime(), and loadConfig().

std::string custom::sDistr [private]

Definition at line 32 of file App_custum.h.

Referenced by loadConfig().

int custom::size [private]

Definition at line 30 of file App_custum.h.

Referenced by getPacketSize(), and loadConfig().

std::string custom::tDistr [private]

Definition at line 31 of file App_custum.h.

Referenced by getNextPacketTime(), getPacketSize(), and loadConfig().


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