Page 1 of 1

Series RTTI

Posted: Tue May 27, 2008 2:49 pm
by 9231211
I had the aim of storing a number of series in a vector of TChartSeries*, and then when reading them out of the vector, checking their type with typeid(). I ran into the following problem, however, and was wondering if you knew of a reason, and or fix:

Code: Select all

TChartSeries* p = new TLineSeries(0);
std::string str1 = typeid(*p).name();
std::string str2 = typeid(TLineSeries).name();
 
// str1 = "TLineSeries"
// str2 = "Series::TLineSeries"
Obviously this is meaning that I can't do

Code: Select all

if (typeid(*p) == typeid(TLineSeries) { ... }

Posted: Mon Jun 02, 2008 10:20 am
by Pep
Hi,

have you tried to check the series type by using classid :
__classid(TLineSeries)

Once you know the Series type you can do the cast by using code similar to :

dynamic_cast<TLineSeries*>(Chart1->Series)-> Pointer ->Visible = true;