High-speed-Charting-Control/ChartDemo/Doc/html/_chart_points_array_8h-sour...

113 lines
12 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartPointsArray.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
</ul>
</div>
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartPointsArray.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * ChartPointsArray.h</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
<a name="l00013"></a>00013 <span class="comment"> * </span>
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
<a name="l00016"></a>00016 <span class="comment"> *</span>
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
<a name="l00018"></a>00018 <span class="comment"> *</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> */</span>
<a name="l00021"></a>00021
<a name="l00022"></a>00022 <span class="preprocessor">#pragma once</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00024"></a>00024 <span class="preprocessor">#include "PointsOrdering.h"</span>
<a name="l00025"></a>00025
<a name="l00027"></a>00027
<a name="l00041"></a>00041 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00042"></a><a class="code" href="class_c_chart_points_array.html">00042</a> <span class="keyword">class </span><a class="code" href="class_c_chart_points_array.html" title="Manages an array of points which supports fast resizing.">CChartPointsArray</a>
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044 <span class="keyword">public</span>:
<a name="l00046"></a>00046
<a name="l00050"></a>00050 <a class="code" href="class_c_chart_points_array.html#306219833d94da1fc1c916337ac7aa64" title="Constructor.">CChartPointsArray</a>(<span class="keywordtype">unsigned</span> iResize = 1000);
<a name="l00052"></a>00052 <a class="code" href="class_c_chart_points_array.html#76a2073ae326557e19dc20c32f03b2b3" title="Destructor.">~CChartPointsArray</a>();
<a name="l00053"></a>00053
<a name="l00055"></a><a class="code" href="class_c_chart_points_array.html#14e51004533e2a11a5439ddacf45c4df">00055</a> <span class="keywordtype">unsigned</span> <a class="code" href="class_c_chart_points_array.html#14e51004533e2a11a5439ddacf45c4df" title="Returns the number of points currently stored.">GetPointsCount</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_iCurrentPoints; }
<a name="l00057"></a><a class="code" href="class_c_chart_points_array.html#99b172d588b8f52a9d92a5e172c3b3ea">00057</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#99b172d588b8f52a9d92a5e172c3b3ea" title="Sets the size by which the internal buffer is increased when reallocation occurs...">SetResize</a>(<span class="keywordtype">int</span> iResize) { m_iResize = iResize; }
<a name="l00058"></a>00058
<a name="l00060"></a>00060
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#2436ef788bdddea716368bf9fd53b137" title="Adds a new point in the array.">AddPoint</a>(<span class="keyword">const</span> T&amp; newPoint);
<a name="l00066"></a>00066
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#31bf9b006fc415dc24825f4ac3e37fdb" title="Adds multiple points in the array.">AddPoints</a>(T* pPoints, <span class="keywordtype">unsigned</span> uCount);
<a name="l00075"></a>00075
<a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#618bd5da7808d72f2be49426c7d4a1cf" title="Sets multiple points in the array.">SetPoints</a>(T* pPoints, <span class="keywordtype">unsigned</span> uCount);
<a name="l00085"></a>00085 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#dd96443d7ca79ec5814bb407989b192e" title="Removes all the points from the array.">Clear</a>();
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#3e079eead0d0591cb9b45f8b8fae81bc" title="Removes a certain amount of points from the begining of the series.">RemovePointsFromBegin</a>(<span class="keywordtype">unsigned</span> Count);
<a name="l00089"></a>00089 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#89b388ad9dd6c2ae6dde667d28922487" title="Removes a certain amount of points from the end of the series.">RemovePointsFromEnd</a>(<span class="keywordtype">unsigned</span> Count);
<a name="l00091"></a>00091 T&amp; <a class="code" href="class_c_chart_points_array.html#10599fee74f8498a04937904e01268dc" title="Retrieves the points at the specified index.">operator[]</a>(<span class="keywordtype">unsigned</span> Index);
<a name="l00093"></a>00093 <span class="keyword">const</span> T&amp; <a class="code" href="class_c_chart_points_array.html#10599fee74f8498a04937904e01268dc" title="Retrieves the points at the specified index.">operator[]</a>(<span class="keywordtype">unsigned</span> Index) <span class="keyword">const</span>;
<a name="l00094"></a>00094
<a name="l00096"></a>00096 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_points_array.html#1138bafdd91a2c6ef305207a1a6b598d" title="Retrieves the minimum and maximum X values of the points stored in the array.">GetSerieXMinMax</a>(<span class="keywordtype">double</span>&amp; Min, <span class="keywordtype">double</span>&amp; Max) <span class="keyword">const</span>;
<a name="l00098"></a>00098 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_points_array.html#6ed3dbce7b7751bd39a82edd661a0f39" title="Retrieves the minimum and maximum Y values of the points stored in the array.">GetSerieYMinMax</a>(<span class="keywordtype">double</span>&amp; Min, <span class="keywordtype">double</span>&amp; Max) <span class="keyword">const</span>;
<a name="l00099"></a>00099
<a name="l00101"></a>00101
<a name="l00108"></a>00108 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#ccfcfe146bb30456165bf541d0ade059" title="Specifies how the points should be ordered in the array.">SetOrdering</a>(PointsOrdering newOrdering);
<a name="l00110"></a><a class="code" href="class_c_chart_points_array.html#e59a67f001aa8d514f8c689b717930de">00110</a> PointsOrdering <a class="code" href="class_c_chart_points_array.html#e59a67f001aa8d514f8c689b717930de" title="Retrieves the ordering of the points in the array.">GetOrdering</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Ordering; }
<a name="l00112"></a>00112 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#e1cb8f6fddef4ad34dec4b6e4cd73069" title="Refreshes the point ordering.">ReorderPoints</a>();
<a name="l00113"></a>00113
<a name="l00115"></a>00115
<a name="l00128"></a>00128 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_points_array.html#2b4e7aa01948425b27cd91775dfba900" title="Retrieves the index of the points which are between two given values.">GetVisiblePoints</a>(<span class="keywordtype">double</span> dAxisMin, <span class="keywordtype">double</span> dAxisMax,
<a name="l00129"></a>00129 <span class="keywordtype">unsigned</span>&amp; uFirstPt, <span class="keywordtype">unsigned</span>&amp; uLastPt) <span class="keyword">const</span>;
<a name="l00130"></a>00130
<a name="l00131"></a>00131
<a name="l00133"></a><a class="code" href="class_c_chart_points_array.html#c73536ce52d2d4b8eddd4604aa5bde30">00133</a> T* <a class="code" href="class_c_chart_points_array.html#c73536ce52d2d4b8eddd4604aa5bde30" title="Returns the internal buffer of the array.">GetInternalBuffer</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pPoints; }
<a name="l00134"></a>00134
<a name="l00135"></a>00135 <span class="keyword">private</span>:
<a name="l00137"></a>00137 <span class="keywordtype">double</span> m_dXMinVal;
<a name="l00139"></a>00139 <span class="keywordtype">double</span> m_dXMaxVal;
<a name="l00141"></a>00141 <span class="keywordtype">double</span> m_dYMinVal;
<a name="l00143"></a>00143 <span class="keywordtype">double</span> m_dYMaxVal;
<a name="l00144"></a>00144
<a name="l00146"></a>00146 <span class="keywordtype">void</span> RefreshMinMax();
<a name="l00148"></a>00148 <span class="keywordtype">void</span> InsertNewPoint(<span class="keyword">const</span> T&amp; newPoint);
<a name="l00150"></a>00150 <span class="keywordtype">void</span> InsertPointAtPos(<span class="keyword">const</span> T&amp; newPoint, <span class="keywordtype">int</span> iPos);
<a name="l00152"></a>00152 <span class="keyword">static</span> <span class="keywordtype">int</span> ComparePointsOnX(<span class="keywordtype">void</span> <span class="keyword">const</span>* pA, <span class="keywordtype">void</span> <span class="keyword">const</span>* pB);
<a name="l00154"></a>00154 <span class="keyword">static</span> <span class="keywordtype">int</span> ComparePointsOnY(<span class="keywordtype">void</span> <span class="keyword">const</span>* pA, <span class="keywordtype">void</span> <span class="keyword">const</span>* pB);
<a name="l00156"></a>00156 <span class="keywordtype">int</span> BinarySearch(<span class="keywordtype">unsigned</span> uLeft, <span class="keywordtype">unsigned</span> uRight, <span class="keywordtype">double</span> dFind) <span class="keyword">const</span>;
<a name="l00157"></a>00157
<a name="l00159"></a>00159 T* m_pPoints;
<a name="l00161"></a>00161 <span class="keywordtype">unsigned</span> m_iMaxPoints;
<a name="l00163"></a>00163 <span class="keywordtype">unsigned</span> m_iCurrentPoints;
<a name="l00165"></a>00165 <span class="keywordtype">unsigned</span> m_iResize;
<a name="l00167"></a>00167 PointsOrdering m_Ordering;
<a name="l00168"></a>00168 };
<a name="l00169"></a>00169
<a name="l00170"></a>00170 <span class="preprocessor">#include "ChartPointsArray.inl"</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>