graphable_element.h
来自「最新的版本ACE-5.6.8,刚从外文网上搬下,与大家分享.」· C头文件 代码 · 共 54 行
H
54 行
/* -*- C++ -*- */
// $Id: Graphable_Element.h 80826 2008-03-04 14:51:23Z wotte $
#ifndef GRAPHABLE_ELEMENT_H
#define GRAPHABLE_ELEMENT_H
#include "Name_Binding.h"
#include <list>
// A helper class that knows how to sort two ACE_Name_Binding objects
// which contain temperature metrics. The value stored in the binding
// is expected to be of the format "time|temp".
//
// Listing 1 code/ch21
class Graphable_Element : public Name_Binding
{
public:
Graphable_Element (ACE_Name_Binding *entry)
: Name_Binding(entry)
{
sscanf (this->value (), "%d|%f", &this->when_, &this->temp_);
}
// Listing 1
// Listing 2 code/ch21
inline int when (void) const
{
return this->when_;
}
inline float temp (void)
{
return this->temp_;
}
// Listing 2
// Listing 3 code/ch21
inline bool operator< (const Graphable_Element &other) const
{
return this->when () < other.when ();
}
// Listing 3
// Listing 4 code/ch21
private:
int when_;
float temp_;
};
typedef std::list<Graphable_Element> Graphable_Element_List;
// Listing 4
#endif /* GRAPHABLE_ELEMENT_H */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?