Series RTTI

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
jhhd
Newbie
Newbie
Posts: 17
Joined: Tue Mar 09, 2004 5:00 am

Series RTTI

Post by jhhd » Tue May 27, 2008 2:49 pm

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) { ... }

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Jun 02, 2008 10:20 am

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;

Post Reply