亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? timeseries.h

?? FastDb是高效的內存數據庫系統
?? H
?? 第 1 頁 / 共 2 頁
字號:
//-< TIMESERIES.H >--------------------------------------------------*--------*// FastDB                    Version 1.0         (c) 1999  GARRET    *     ?  *// (Post Relational Database Management System)                      *   /\|  *//                                                                   *  /  \  *//                          Created:     22-Nov-2002  K.A. Knizhnik  * / [] \ *//                          Last update: 22-Nov-2002  K.A. Knizhnik  * GARRET *//-------------------------------------------------------------------*--------*// Container for time serires data//-------------------------------------------------------------------*--------*#ifndef __TIMESERIES_H__#define __TIMESERIES_H__#include "fastdb.h"BEGIN_FASTDB_NAMESPACE#define INFINITE_TIME 0x7fffffff/** * 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> * <I>You are defining your own time series class, for example:</I> * <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<Daily>  DailyBlock; * REGISTER(DailyBlock); * </PRE>     * <I>Now you can work with time series objects in the followin way:</I> * <PRE> * dbDatabase db; * if (db.open("mydatabase.dbs")) { *     dbTimeSeriesProcessor&lt;Quote&gt; 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\n", quoteBuf[i].bid, quoteBuf[i].ask); *     } * }   * </PRE> */template<class T>class dbTimeSeriesBlock {   public:    db_int8 blockId;    db_int4 used;    dbArray<T> elements;      TYPE_DESCRIPTOR((KEY(blockId, INDEXED), FIELD(used), FIELD(elements)));};/** * Time series processor.<BR> * Element of time series can be arbitrary type with declared TYPE_DESCRIPTOR and defined * <code>time_t time()</code> method */template<class T>class dbTimeSeriesProcessor {     struct Interval {         db_int8 from;        db_int8 till;    };  public:    /**     * Virtual method for processing elements, Should be redefinedin derived class.     * @param data reference to the processed data element     */    virtual void process(T const&) {}        /**     * Add new element     * @param oid time series identifer (OID of the object associated with this time series)     * @param data reference to the inserted element     */    void add(oid_t oid, T const& data)     {         Interval interval;        interval.from = generateBlockId(oid, data.time() - maxBlockTimeInterval);        interval.till = generateBlockId(oid, data.time());        dbCursor< dbTimeSeriesBlock<T> > blocks;        blocks.select(selectBlock, dbCursorForUpdate, &interval);        if (blocks.last()) {             insertInBlock(oid, blocks, data);        } else {             addNewBlock(oid, data);        }    }    /**     * Process elements in the block belonging to the specified range     * @param oid time series identifer (OID of the object associated with this time series)     * @param from inclusive low bound for element timestamp (set 0 to disable this criteria)     * @param till inclusive high bound for element timestamp (set INFINITE_TIME to disable this criteria)     */    void select(oid_t oid, time_t from, time_t till)     {         Interval interval;        interval.from = generateBlockId(oid, from - maxBlockTimeInterval);        interval.till = generateBlockId(oid, till);        dbCursor< dbTimeSeriesBlock<T> > blocks;        if (blocks.select(selectBlock, dbCursorViewOnly, &interval)) {             do {                 int n = blocks->used;                T const* e =  blocks->elements.get();                int l = 0, r = n;                while (l < r)  {                    int i = (l+r) >> 1;                    if (from > e[i].time()) {                         l = i+1;                    } else {                         r = i;                    }                }                assert(l == r && (l == n || e[l].time() >= from));                 while (l < n && e[l].time() <= till) {                    process(e[l++]);                }            } while (blocks.next());        }    }        /**     * Get the time of the first element in time series     * @param oid time series identifer (OID of the object associated with this time series)     * @return earliest time in times series or -1 if there are no elements in time series     */    time_t getFirstTime(oid_t oid)     {        Interval interval;        interval.from = generateBlockId(oid, 0);        interval.till = generateBlockId(oid, INFINITE_TIME);        dbCursor< dbTimeSeriesBlock<T> > blocks;        blocks.setSelectionLimit(1);        if (blocks.select(selectBlock, dbCursorViewOnly, &interval)) {             return blocks->elements[0].time();        }        return (time_t)-1;    }        /**     * Get the time of the last element in time series     * @param oid time series identifer (OID of the object associated with this time series)     * @return latest time in times series or -1 if there are no elements in time series     */    time_t getLastTime(oid_t oid)     {        Interval interval;        interval.from = generateBlockId(oid, 0);        interval.till = generateBlockId(oid, INFINITE_TIME);        dbCursor< dbTimeSeriesBlock<T> > blocks;        blocks.setSelectionLimit(1);        if (blocks.select(selectBlockReverse, dbCursorViewOnly, &interval)) {             return blocks->elements[blocks->used-1].time();        }        return (time_t)-1;    }        /**     * Get number of elements in time series.     * @param oid time series identifer (OID of the object associated with this time series)     * @return number of elements in time series.     */    size_t getNumberOfElements(oid_t oid)     {        Interval interval;        interval.from = generateBlockId(oid, 0);        interval.till = generateBlockId(oid, INFINITE_TIME);        dbCursor< dbTimeSeriesBlock<T> > blocks;        int n = 0;        if (blocks.select(selectBlock, dbCursorViewOnly, &interval)) {            do {                 n += blocks->used;            } while (blocks.next());        }        return n;    }            /**     * Select elements belonging to the specified interval     * @param oid time series identifer (OID of the object associated with this time series)     * @param from inclusive low bound for element timestamp (set 0 to disable this criteria)     * @param till inclusive high bound for element timestamp (set INFINITE_TIME to disable this criteria)     * @param buf destination buffer for selected elements     * @param bufSize size of buffer: up to bufSize elements will be placed in buffer     * @return number of elements belonging to the specified interval (can be greater than bufSize)     */    size_t getInterval(oid_t oid, time_t from, time_t till, T* buf, size_t bufSize)     {         Interval interval;        interval.from = generateBlockId(oid, from == 0 ? 0 : from - maxBlockTimeInterval);        interval.till = generateBlockId(oid, till);        dbCursor< dbTimeSeriesBlock<T> > blocks;        size_t nSelected = 0;        if (blocks.select(selectBlock, dbCursorViewOnly, &interval)) {             do {                 int n = blocks->used;                T const* e =  blocks->elements.get();                int l = 0, r = n;                while (l < r)  {                    int i = (l+r) >> 1;                    if (from > e[i].time()) {                         l = i+1;                    } else {                         r = i;                    }                }                assert(l == r && (l == n || e[l].time() >= from));                 while (l < n && e[l].time() <= till) {                    if (nSelected < bufSize) {                         buf[nSelected] = e[l];                    }                    l += 1;                    nSelected += 1;                }            } while (blocks.next());        }        return nSelected;    }                    /**     * Get time series element with specified time     * @param oid time series identifer (OID of the object associated with this time series)     * @param elem reference to the extracted element      * @param t timestamp of extracted element     * @return <code>true</code> if element with specifed times exists in time series     */    bool getElement(oid_t oid, T& elem, time_t t)     {         return getInterval(oid, t, t, &elem, 1) == 1;    }                    /**     * Select first N elements of times series with timestamp less than or equal to specified     * @param oid time series identifer (OID of the object associated with this time series)     * @param till inclusive high bound for element timestamp (set INFINITE_TIME to disable this criteria)      * @param buf destination buffer for selected elements     * @param bufSize size of buffer: up to bufSize elements will be placed in buffer     * @return number of selected elements (can be less than bufSize if there are less elements in time series     * with timestamp less or equal than specified, but can not be greater than bufSize)     */    size_t getFirstInterval(oid_t oid, time_t till, T* buf, size_t bufSize)     {        if (bufSize == 0) {             return 0;        }        Interval interval;        interval.from = generateBlockId(oid, 0);        interval.till = generateBlockId(oid, till);        dbCursor< dbTimeSeriesBlock<T> > blocks;        size_t nSelected = 0;        if (blocks.select(selectBlock, dbCursorViewOnly, &interval)) {             do {                 int n = blocks->used;                T const* e =  blocks->elements.get();                for (int i = 0; i < n && e[i].time() <= till; i++) {                     buf[nSelected++] = e[i];                    if (nSelected == bufSize) {                         return nSelected;                    }                }            } while (blocks.next());        }        return nSelected;    }            /**     * Select last N elements of times series with timestamp greater than or equal to specified     * @param oid time series identifer (OID of the object associated with this time series)     * @param from inclusive low bound for element timestamp (set 0 to disable this criteria)     * @param buf destination buffer for selected elements     * @param bufSize size of buffer: up to bufSize elements will be placed in buffer     * @return number of selected elements (can be less than bufSize if there are less elements in time series     * with timestamp greater or equal than specified, but can not be greater than bufSize)     */    size_t getLastInterval(oid_t oid, time_t from, T* buf, size_t bufSize)     {        if (bufSize == 0) {             return 0;        }        Interval interval;        interval.from = generateBlockId(oid, from == 0 ? 0 : from - maxBlockTimeInterval);        interval.till = generateBlockId(oid, INFINITE_TIME);        dbCursor< dbTimeSeriesBlock<T> > blocks;        size_t nSelected = 0;        blocks.select(selectBlock, dbCursorViewOnly, &interval);        if (blocks.last()) {             do {                 int n = blocks->used;                T const* e =  blocks->elements.get();                for (int i = n; --i >= 0 && e[i].time() >= from;) {                     buf[nSelected++] = e[i];                    if (nSelected == bufSize) {                         return nSelected;                    }                }            } while (blocks.prev());        }        return nSelected;    }            /**     * Check if there is element for specified data in time series     * @param oid time series identifer (OID of the object associated with this time series)     * @param t timestamp of checked element     * @return <code>true</code> if element with specifed times exists in time series     */    bool hasElement(oid_t oid, time_t t)     {         T dummy;        return getElement(oid, dummy, t);    }            /**     * TimeSeries processor constructor     * @param database reference to the database     * @param minElementsInBlock preallocated number of the elements in the block:      * array with specified number of elements will be allocated for new block     * @param maxElementsInBlock maximal number of the elements in the block: block will be splitten if it has maxElementsInBlock     * elements and new is added to the block     * @param maxBlockTimeInterval maximal interval between first and last element in the block, new block will be created if      * adding new element to the block cause violation of this assumption. If maxBlockTimeInterval is 0, then it is assigned

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美成人精品福利| 国产99久久久久久免费看农村| 欧美一区二区精美| 国产一区二区三区高清播放| 日韩一级高清毛片| 国产成人亚洲综合a∨婷婷图片| 国产精品美日韩| 欧美日本精品一区二区三区| 激情另类小说区图片区视频区| 亚洲一区在线观看网站| 日韩久久久精品| 91理论电影在线观看| 日本vs亚洲vs韩国一区三区 | 不卡影院免费观看| 国产高清精品网站| 91国内精品野花午夜精品| 综合婷婷亚洲小说| 日韩欧美一区二区免费| 欧美综合亚洲图片综合区| 欧美午夜片在线看| 国产精品美女久久久久久2018| 99久久综合狠狠综合久久| 久久99热狠狠色一区二区| 色综合久久中文综合久久97| 精品一区二区三区久久| 一区二区三区四区在线| 在线观看亚洲成人| 色综合视频在线观看| a在线播放不卡| 国产伦精品一区二区三区免费| 蜜臀av一级做a爰片久久| 青娱乐精品在线视频| 日韩精品一区二区三区视频在线观看 | 日本aⅴ亚洲精品中文乱码| 韩国av一区二区三区在线观看| 一二三区精品视频| 欧美男人的天堂一二区| 国产 欧美在线| 美女在线视频一区| 国产美女在线精品| 欧美国产激情二区三区 | 日韩国产精品大片| 国产精品久久久久久久岛一牛影视| 91精品国产91久久久久久一区二区 | 国产精品一区在线观看你懂的| 亚洲sss视频在线视频| 亚洲日本韩国一区| 中文字幕欧美一| 欧美国产日韩亚洲一区| 久久久电影一区二区三区| 日韩欧美国产电影| 日韩视频123| 日韩欧美亚洲国产另类| 日本精品一级二级| 欧美二区乱c少妇| 欧美日韩一区二区三区不卡| 91久久线看在观草草青青| zzijzzij亚洲日本少妇熟睡| 成人免费视频免费观看| 国产精选一区二区三区| 国产盗摄女厕一区二区三区| 国产剧情av麻豆香蕉精品| 国产精品一卡二卡| 成人一区二区三区中文字幕| 粉嫩蜜臀av国产精品网站| 国产一区在线看| 成人av在线播放网址| 99re热视频精品| 91美女视频网站| 欧美羞羞免费网站| 91精品一区二区三区在线观看| 精品少妇一区二区三区免费观看 | 欧美日韩激情一区| 欧美日韩精品免费观看视频| 欧美一二三四区在线| 久久久电影一区二区三区| 中文字幕日韩一区| 五月婷婷综合在线| 精品一二三四区| 91香蕉国产在线观看软件| 欧美日韩精品一区二区| 久久免费偷拍视频| 一级中文字幕一区二区| 久草中文综合在线| 91同城在线观看| 日韩欧美在线一区二区三区| 国产精品五月天| 青青草国产精品亚洲专区无| 成人午夜视频网站| 欧美老肥妇做.爰bbww视频| 2023国产精品视频| 亚洲永久免费视频| 国产成人精品www牛牛影视| 欧美日韩一级片在线观看| 久久久亚洲精品一区二区三区| 一区二区三区欧美在线观看| 国产一区二区在线影院| 欧美调教femdomvk| 中文字幕乱码久久午夜不卡| 日韩黄色免费网站| 一本一道综合狠狠老| 久久亚洲二区三区| 日韩不卡手机在线v区| 色哟哟亚洲精品| 中文字幕成人av| 久久er99热精品一区二区| 欧美性猛片xxxx免费看久爱| 国产欧美日韩卡一| 九色综合狠狠综合久久| 欧美精品粉嫩高潮一区二区| 亚洲欧美一区二区三区孕妇| 国产成人欧美日韩在线电影| 欧美一区二区啪啪| 亚洲大片精品永久免费| av一二三不卡影片| 国产日韩欧美综合在线| 麻豆精品视频在线观看| 欧美性大战久久| 亚洲精品日日夜夜| 一本久道中文字幕精品亚洲嫩| 国产亚洲欧美一级| 久久91精品久久久久久秒播| 欧美一区二区日韩| 日韩电影免费在线观看网站| 欧美又粗又大又爽| 中文字幕亚洲在| 99re这里只有精品6| 国产精品动漫网站| 不卡的av网站| 中文字幕中文字幕中文字幕亚洲无线| 国产一区啦啦啦在线观看| 久久新电视剧免费观看| 国内精品写真在线观看| 日韩精品在线看片z| 美女视频一区在线观看| 欧美一区二区久久| 久久精品国产亚洲a| 精品国产免费人成电影在线观看四季 | 99久久精品免费观看| 亚洲国产精品成人综合 | 欧美精品少妇一区二区三区| 一区二区三区蜜桃网| 欧美日韩视频第一区| 午夜久久久久久久久久一区二区| 欧美三级电影网站| 亚洲成人免费观看| 91精品国产91热久久久做人人| 麻豆精品视频在线| 久久精子c满五个校花| 国产精品亚洲а∨天堂免在线| 中文字幕乱码亚洲精品一区 | 日韩欧美三级在线| 国产一区二区三区综合| 国产色91在线| 91麻豆精品在线观看| 亚洲一区二区偷拍精品| 欧美丰满一区二区免费视频| 另类小说图片综合网| 久久精品一区蜜桃臀影院| 高清不卡一区二区| 亚洲免费电影在线| 欧美精品第1页| 国产激情视频一区二区三区欧美 | 国产九九视频一区二区三区| 国产日产精品1区| 色综合视频一区二区三区高清| 亚洲香蕉伊在人在线观| 欧美成人三级在线| 成人一级片网址| 亚洲精品国产高清久久伦理二区| 欧美日韩成人一区| 麻豆精品视频在线观看| 国产精品久久毛片a| 在线不卡免费av| 岛国精品在线播放| 亚洲图片欧美视频| 精品国产亚洲在线| 一本色道久久综合亚洲aⅴ蜜桃 | 一区二区三区美女视频| 91.com在线观看| 成人免费观看视频| 婷婷国产在线综合| 国产日韩欧美不卡| 欧美日韩一区成人| 成人动漫av在线| 日韩精品一卡二卡三卡四卡无卡| 久久精品一区四区| 欧美撒尿777hd撒尿| 成人精品视频网站| 日本在线不卡视频| 日韩理论片一区二区| 精品国产一区二区三区不卡| 日本久久精品电影| 国产成人日日夜夜| 免费观看日韩av| 一区二区三区四区在线| 日本一区二区免费在线观看视频| 日韩一区二区三区免费观看| www.av精品| 国产成人av在线影院|