8 #ifndef _LISTOBJECTSTOCK_H_
9 #define _LISTOBJECTSTOCK_H_
17 #include "../../src_cpp/ListDataStock.h"
18 #include "../CommonXAxis.h"
45 ListObjectStock (
unsigned int size, std::string name_contained = std::string(),
bool ref0 =
false );
49 virtual void Resize(
unsigned int new_size );
52 virtual void GetExtrema(
double & min,
double & max )
const;
57 virtual void SetValues( UInt_t bin, std::vector<type_value_data>
values,
58 Double_t xmin, Double_t xmax, time_t date, UInt_t opt_value = 0 );
66 virtual int DistancetoPoint(
int px,
int py,
double &yvalue,
int bin = -1)
const;
74 virtual void Paint(
const Option_t* =
"");
87 std::cout <<
"Entry default Constructor ListObjectStock" << std::endl;
97 std::cout <<
"Entry Constructor ListObjectStock size " << size << std::endl;
98 std::cout <<
"name_contained " << name_contained << std::endl;
100 std::cout <<
"ref0 " << ref0 << std::endl;
103 for (
unsigned int i=0; i < size; i++ ) {
111 #ifdef DEBUG_OBJSTOCK
112 std::cout <<
"Destructor ListObjectStock" << std::endl;
123 #ifdef DEBUG_OBJSTOCK
124 std::cout <<
"size vec_object " << vec_object.size() << std::endl;
139 #ifdef DEBUG_OBJSTOCK
140 std::cout <<
"Entry ListObjectStock::GetExtrema " << std::endl;
153 for (
unsigned int i = 0; i < vec_object.size(); i++ ) {
156 if ( vec_object[i].ToPaint() ) {
157 vec_object[i].GetExtrema( lmin, lmax );
158 if ( lmin < tmin ) tmin = lmin;
159 if ( lmax > tmax ) tmax = lmax;
165 #ifdef DEBUG_OBJSTOCK
166 std::cout <<
"will return extrema min/max " << min <<
" " << max << std::endl;
174 #ifdef DEBUG_OBJSTOCK
175 std::cout <<
" Entry ListObjectStock::ClearObjectStock(), clear all object size " << vec_object.size() << std::endl;
178 for (
unsigned int i = 0; i < vec_object.size(); i++ ) {
180 vec_object[i].ClearObjectStock();
188 #ifdef DEBUG_OBJSTOCK
189 std::cout <<
"ListObjectStock::Resize new_size " << new_size << std::endl;
193 for (
unsigned int i = 0; i < new_size; ++i ) {
201 #ifdef DEBUG_OBJSTOCK
202 std::cout <<
"Entry ListObjectStock::DistancetoPrimitive " << std::endl;
203 std::cout <<
"broadcast the function to all elements " << std::endl;
211 for (
unsigned int i = 0; i < vec_object.size(); ++i ) {
215 if ( dist_objstock <= dist ) {
216 dist = dist_objstock;
217 *obj = &(vec_object[i]);
228 #ifdef DEBUG_OBJSTOCK
229 std::cout <<
"Entry ListObjectStock::DistancetoPoint get bin_entry " << bin << std::endl;
234 int bin_entry = vec_object.size() - bin;
237 dist = (vec_object[ bin_entry ]).DistancetoPoint( px, py, yvalue );
250 Double_t xmin, Double_t xmax, time_t date, UInt_t opt_value )
257 vec_object[bin].SetValues( bin, values, xmin, xmax, date, opt_value );
260 vec_object[bin].SetToPaint(
true );
271 #ifdef DEBUG_OBJSTOCK
272 std::cout <<
"Entry ListObjectStock::Paint" << std::endl;
275 for (
unsigned int i = 0; i < vec_object.size(); i++ ) {
277 if ( vec_object[i].ToPaint() )
278 vec_object[i].Paint( option );
301 std::vector<type_value_data>
values;
304 unsigned int xfirst, xlast;
306 unsigned int size_data = ldata->
GetSize();
308 ComputeBinRange( ldata, fcommon_xaxis_th, Hparam_stock, xfirst, xlast, shift_left );
311 for (
unsigned int bin = xlast; bin >= xfirst; bin -- ) {
318 xmin = fcommon_xaxis_th->
GetXAxis()->GetBinLowEdge(bin);
319 xmax = fcommon_xaxis_th->
GetXAxis()->GetBinUpEdge(bin);
324 xmin += (xmax-xmin)*0.1;
325 xmax -= (xmax-xmin)*0.1;
328 SetValues ( size_data - bin + shift_left, values, xmin, xmax,
virtual int DistancetoPrimitive(int px, int py, AbstractObjectStock **obj)
neeed for selection broadcast to the contained objects
virtual ~ListObjectStock()
virtual int DistancetoPoint(int px, int py, double &yvalue, int bin=-1) const
needed for anchoring, broadcast to the contained objects
virtual void SetValues(UInt_t bin, std::vector< type_value_data > values, Double_t xmin, Double_t xmax, time_t date, UInt_t opt_value=0)
called by SetObjectStock.
virtual void AddToVecObject(T *obj)
Define concrete classes for ObjectStock.
Hparam_stock_t Hparam_stock
Define a base class for drawing indicator only, they are sorted in ListDataStock object.
virtual Int_t DistancetoPrimitive(int, int, AbstractObjectStock **)=0
used for selection of object, for const need attention to the pointer
virtual void Resize(unsigned int new_size)
virtual void ClearObjectStock()
general function called when drawing
virtual std::vector< type_value_data > GetValues() const =0
Return the value(s) in a vector.
virtual void Paint(const Option_t *="")
Simply paint the objects, if needed .
std::vector< type_obj > vec_object
virtual UInt_t GetSize() const
virtual void GetExtrema(double &min, double &max) const
overid base class
virtual void SetObjectStock(ListDataStockBase *ldata, CommonXAxis *fcommon_xaxis_th, Hparam_stock_t &Hparam_stock)
Set the values of the objects .
Define a vector for all identical Object ( Candle, Bar...)
virtual unsigned int GetSize() const =0
Return the size of the vector.
ListObjectStock(std::string name)
Abstract base class for the ListDataStock, for storing base pointers in vectors.
time_t GetDate() const
Get the date data member.
virtual const DataStock & NoChronologicAt(const unsigned int offset) const =0
Get nth element in a non chronological order.
Define an abstract base class for all objects to be painted in a THStock.