GreenCloud Simulator
provideroutagent.h
Go to the documentation of this file.
1 /*
2  * provideroutagent.h
3  *
4  * @date Nov 12, 2013
5  * @author Guzek:Mateusz
6  */
7 
8 #ifndef PROVIDEROUTAGENT_H_
9 #define PROVIDEROUTAGENT_H_
10 #include <tcpapp.h>
11 #include "agent.h"
12 #include "tcp.h"
13 #include <stdlib.h>
14 #include <iostream>
15 
16 /*Buffered list based on the CBuf from TcpApp*/
17 class PoaBuf {
18 public:
19  PoaBuf(void *c, int nbytes);
20  ~PoaBuf() {
21  }
22  void* pointer() { return pointer_; }
23  int bytes() { return nbytes_; }
24 
25 
26 protected:
27  friend class PoaBufList;
28  void *pointer_;
29  int nbytes_;
31 
32 };
33 
34 // A FIFO queue
35 class PoaBufList {
36 public:
37 
38  PoaBufList() : head_(NULL), tail_(NULL) {}
39  ~PoaBufList();
40 
41  void insert(PoaBuf *poabuf);
42  PoaBuf* detach();
43 
44 protected:
47 
48 };
49 
50 class ProviderOutAgent : public TcpAgent {
51 public:
53  virtual ~ProviderOutAgent();
54  int updateAgentDataBytes();
55  double updateTime();
56  void sendmsg(int nbytes, void* pointer);
57  void tryToSend();
58 protected:
62 };
63 
64 #endif /* PROVIDEROUTAGENT_H_ */
void * pointer()
PoaBuf * tail_
void * pointer_
PoaBuf * head_
PoaBuf * next_
PoaBuf(void *c, int nbytes)
int bytes()