FACT++  1.0
Markus.cxx
Go to the documentation of this file.
1 #include <iostream>
2 #include <dic.hxx>
3 using namespace std;
4 
5 class DnsInfo;
6 
7 class FloatInfo : public virtual DimInfoHandler
8 {
10  float no_link, *data;
12 
13 protected:
14  friend class DnsInfo;
15  void addHandler()
16  {
17  if(!fInfo)
18  fInfo = new DimInfo("SIMPLE_SERVICE", (void *)&no_link,
19  sizeof(no_link), this);
20  }
22  {
23  if(fInfo)
24  {
25  delete fInfo;
26  fInfo = 0;
27  }
28  }
29 public :
31  {
32  fInfo = 0;
33  no_link = -1;
34  };
35  void initialize();
36  void infoHandler()
37  {
38  data = (float *)getInfo()->getData();
39  cout << "Received : " << *data << endl;
40  }
41 };
42 
43 class DnsInfo : public DimInfo
44 {
45 
46  char *data;
48 
49  void infoHandler()
50  {
51  data = getString();
52  cout << "Received : " << data << endl;
53  if(data[0] == '+')
54  {
55  fInfo.addHandler();
56  }
57  else if (data[0] == '-')
58  {
59  fInfo.removeHandler();
60  }
61  }
62 public :
63  DnsInfo(FloatInfo &f) : DimInfo("DIS_DNS/SERVER_LIST","DEAD"),
64  fInfo(f) {}
65  virtual ~DnsInfo() {}
66 };
67 
69 {
70  m_dns = new DnsInfo(*this);
71 }
72 
74 {
75  FloatInfo *fInfo;
76 
77  fInfo = new FloatInfo();
78  fInfo->initialize();
79 
80  while(1)
81  pause();
82 }
DnsInfo(FloatInfo &f)
Definition: Markus.cxx:63
void infoHandler()
Definition: Markus.cxx:49
virtual ~DnsInfo()
Definition: Markus.cxx:65
main()
Definition: Markus.cxx:73
STL namespace.
Definition: dic.hxx:31
void addHandler()
Definition: Markus.cxx:15
DimInfo()
Definition: dic.hxx:36
FloatInfo & fInfo
Definition: Markus.cxx:47
void removeHandler()
Definition: Markus.cxx:21
float no_link
Definition: Markus.cxx:10
void initialize()
Definition: feeserver.c:385
void * getData()
Definition: diccpp.cxx:213
DimInfo * fInfo
Definition: Markus.cxx:9
void infoHandler()
Definition: Markus.cxx:36
float data[4 *1440]
FloatInfo()
Definition: Markus.cxx:30
char * data
Definition: Markus.cxx:46
DimInfo * getInfo()
Definition: dic.hxx:26
void initialize()
Definition: Markus.cxx:68
DnsInfo * m_dns
Definition: Markus.cxx:11