GreenCloud Simulator
Public Member Functions | Protected Attributes | List of all members
ProviderOutAgent Class Reference

#include <provideroutagent.h>

Inheritance diagram for ProviderOutAgent:
Inheritance graph
[legend]
Collaboration diagram for ProviderOutAgent:
Collaboration graph
[legend]

Public Member Functions

 ProviderOutAgent ()
 
virtual ~ProviderOutAgent ()
 
int updateAgentDataBytes ()
 
double updateTime ()
 
void sendmsg (int nbytes, void *pointer)
 
void tryToSend ()
 

Protected Attributes

int lastTrackedBytes_
 
double lastTrackedTime_
 
PoaBufList poabuf_
 

Detailed Description

Definition at line 50 of file provideroutagent.h.

Constructor & Destructor Documentation

ProviderOutAgent::ProviderOutAgent ( )

Definition at line 19 of file provideroutagent.cc.

20 
21  lastTrackedTime_ = Scheduler::instance().clock();
22 // lastTrackedBytes = this->getNdatabytes();
23 }
ProviderOutAgent::~ProviderOutAgent ( )
virtual

Definition at line 25 of file provideroutagent.cc.

25  {
26  PoaBuf* tmp;
27  while(true){
28  tmp = poabuf_.detach();
29  if(tmp!=NULL){
30  delete tmp;
31  } else {
32  break;}
33  }
34 }
PoaBuf * detach()

Member Function Documentation

void ProviderOutAgent::sendmsg ( int  nbytes,
void *  pointer 
)

Definition at line 48 of file provideroutagent.cc.

48  {
49  poabuf_.insert(new PoaBuf( pointer,nbytes));
50  tryToSend();
51 }
void insert(PoaBuf *poabuf)
void ProviderOutAgent::tryToSend ( )

Definition at line 53 of file provideroutagent.cc.

53  {
54  if(current_pointer_==NULL){
55  PoaBuf* cb = poabuf_.detach();
56  if(cb!=NULL){
57  TcpAgent::sendmsg(cb->bytes(),(void*) cb->pointer());
58  delete cb;
59  }
60  }
61 }
void * pointer()
PoaBuf * detach()
int bytes()
int ProviderOutAgent::updateAgentDataBytes ( )

Definition at line 36 of file provideroutagent.cc.

36  {
37  int result = getNdatabytes() - lastTrackedBytes_;
38  lastTrackedBytes_ = getNdatabytes();
39  return result;
40 }
double ProviderOutAgent::updateTime ( )

Definition at line 42 of file provideroutagent.cc.

42  {
43  double result = lastTrackedTime_;
44  lastTrackedTime_ = Scheduler::instance().clock();
45  return result;
46 }

Member Data Documentation

int ProviderOutAgent::lastTrackedBytes_
protected

Definition at line 59 of file provideroutagent.h.

double ProviderOutAgent::lastTrackedTime_
protected

Definition at line 60 of file provideroutagent.h.

PoaBufList ProviderOutAgent::poabuf_
protected

Definition at line 61 of file provideroutagent.h.


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