📄 classdbtimeseriesblock.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>FastDB: TemplatedbTimeSeriesBlock< T > class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.5 --><div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a></div><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><tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="dbTimeSeriesBlocka0" doxytag="dbTimeSeriesBlock::TYPE_DESCRIPTOR" ></a> </td><td class="memItemRight" valign=bottom><b>TYPE_DESCRIPTOR</b> ((KEY(blockId, INDEXED), FIELD(used), FIELD(elements)))</td></tr><tr><td colspan=2><br><h2>Public Attributes</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="dbTimeSeriesBlocko0" doxytag="dbTimeSeriesBlock::blockId" ></a>db_int8 </td><td class="memItemRight" valign=bottom><b>blockId</b></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="dbTimeSeriesBlocko1" doxytag="dbTimeSeriesBlock::used" ></a>db_int4 </td><td class="memItemRight" valign=bottom><b>used</b></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="dbTimeSeriesBlocko2" doxytag="dbTimeSeriesBlock::elements" ></a><a class="el" href="classdbArray.html">dbArray</a>< T > </td><td class="memItemRight" valign=bottom><b>elements</b></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><div> class Stock { public: char const* name; TYPE_DESCRIPTOR((KEY(name, INDEXED))); };</pre></div><p><pre><div> class Quote { public: int4 tickerDate; real4 bid; int4 bidSize; real4 ask; int4 askSize;</pre></div><p><pre><div> time_t time() const { return tickerDate; } // this method should be defined</pre></div><p><pre><div> TYPE_DESCRIPTOR((FIELD(tickerDate), FIELD(bid), FIELD(bidSize), FIELD(ask), FIELD(askSize))); }; typedef dbTimeSeriesBlock<Daily> DailyBlock; REGISTER(DailyBlock); </pre></div> <em>Now you can work with time series objects in the followin way:</em> <pre><div> <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</pre></div><p><pre><div> 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\n", quoteBuf[i].bid, quoteBuf[i].ask); } } </pre></div> <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 size="1"><address style="align: right;"><small>Generated on Thu Feb 12 13:04:49 2004 for FastDB by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.5 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -