Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / examples / APG / Naming / Graphable_Element.h
blob505e1e0a112855770abb7e9484b0213ade1abe1e
1 /* -*- C++ -*- */
2 #ifndef GRAPHABLE_ELEMENT_H
3 #define GRAPHABLE_ELEMENT_H
5 #include "Name_Binding.h"
6 #include <list>
8 // A helper class that knows how to sort two ACE_Name_Binding objects
9 // which contain temperature metrics. The value stored in the binding
10 // is expected to be of the format "time|temp".
12 // Listing 1 code/ch21
13 class Graphable_Element : public Name_Binding
15 public:
16 Graphable_Element (ACE_Name_Binding *entry)
17 : Name_Binding(entry)
19 sscanf (this->value (), "%d|%f", &this->when_, &this->temp_);
21 // Listing 1
23 // Listing 2 code/ch21
24 inline int when () const
26 return this->when_;
29 inline float temp ()
31 return this->temp_;
33 // Listing 2
35 // Listing 3 code/ch21
36 inline bool operator< (const Graphable_Element &other) const
38 return this->when () < other.when ();
40 // Listing 3
42 // Listing 4 code/ch21
43 private:
44 int when_;
45 float temp_;
48 typedef std::list<Graphable_Element> Graphable_Element_List;
49 // Listing 4
51 #endif /* GRAPHABLE_ELEMENT_H */