📄 classdbtimeseriesblock.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title> TemplatedbTimeSeriesBlock< T > class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.18 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> </center>
<hr><h1>dbTimeSeriesBlock< T > Class Template Reference</h1><code>#include <<a class="el" href="timeseries_8h-source.html">timeseries.h</a>></code>
<p>
<a href="classdbTimeSeriesBlock-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template<class T><br>
class dbTimeSeriesBlock< T ></h3>
Time series block contaning array of elements. Grouping several elements in one block (record) reduce space overhead and increase processing speed.<br>
<b>Attention!</b> This class is not serialized, so it is can be accessed only by one thread
<p>
<em>You are defining your own time series class, for example:</em> <pre>
class Stock {
public:
char const* name;
TYPE_DESCRIPTOR((KEY(name, INDEXED)));
};
class Quote {
public:
int4 tickerDate;
real4 bid;
int4 bidSize;
real4 ask;
int4 askSize;
time_t time() const { return tickerDate; } // this method should be defined
TYPE_DESCRIPTOR((FIELD(tickerDate), FIELD(bid), FIELD(bidSize), FIELD(ask), FIELD(askSize)));
};
typedef dbTimeSeriesBlock<Quote> DailyBlock;
REGISTER(DailyBlock);
</pre> <em>Now you can work with time series objects in the followin way:</em> <pre>
<a class="el" href="classdbDatabase.html">dbDatabase</a> db;
if (db.open("mydatabase.dbs")) {
<a class="el" href="classdbTimeSeriesProcessor.html">dbTimeSeriesProcessor</a><Quote> proc(db, MIN_ELEMENTS_IN_BLOCK,MAX_ELEMENTS_IN_BLOCK);
Quote quote;
// initialize quote
Stock stock;
stock.name = "AAD";
oid_t stockId = insert(oid).getOid();
proc.add(stockId, quote); // add new element in time series
Quote quoteBuf[MAX_QUOTES];
// select quotes for the specified interval
int n = proc.getInterval(stockId, fromDate, tillDate, quoteBuf, MAX_QUOTES);
for (int i = 0; i < n; i++) {
printf("bid=d ask=d<br>
", quoteBuf[i].bid, quoteBuf[i].ask);
}
}
</pre>
<p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="timeseries_8h-source.html">timeseries.h</a></ul>
<hr><address style="align: right;"><small>Generated on Thu Feb 14 12:42:31 2008 for FastDB by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.18 </small></address>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -