Hi Ed,
As correctly reported by CINT, there are no functions like TMap::Getvalue(const
char*)
There is a function
TObject *GetValue(const TObject *key) const;
In your case, to get a pointer to the key object, do
TObject *key = MyCutMap->FindObject("R2")
TObject *value = MyCutMap->GetValue(key)
Rene Brun
Edward Chen wrote:
>
> Hi - I'm using ROOT 3.04/02. I'd like not to have to migrate to 3.05/07
> if necessary.
>
> First - when I search on TPair on the ROOT website, nothing pops up,
> either using the Quick Search or the search of the reference guide.
>
> Second, I've created a TMap, and I'm having problems accessing an object
> in it:
>
> {
>
> TObjString * myR2Name = new TObjString("R2");
> edCut2D * myR2Cut = new edCut2D(kTRUE,kFALSE,kFALSE,-1000,
> 0.268724,kTRUE);
>
> TMap * myCutMap = new TMap();
> myCutMap.Add(myR2Name,myR2Cut);
>
> }
>
> root [0] myCutMap->Print()
> Key: TObjString = R2
> Value: OBJ: edCut2D edCut2D
>
> Now - I've tried the following:
>
> root [1] edCut2D *myCut2 = (edCut2D *)myCutMap->GetValue("R2")
> Error: Can't call TMap::GetValue("R2") in current scope
> FILE:/tmp/GNJ4rU_cint LINE:1
> Possible candidates are...
> filename line:size busy function type and name (in TMap)
> (compiled) 0:0 0 public: TObject* GetValue(const TObject* key)
> const;
> filename line:size busy function type and name (in TCollection)
> filename line:size busy function type and name (in TObject)
> Error: Symbol myCutMap is not defined in current scope
> FILE:/tmp/GNJ4rU_cint LINE:1
> Error: Failed to evaluate myCutMap->GetValue("R2")Possible candidates
> are...
> filename line:size busy function type and name
> *** Interpreter error recovered ***
>
> However, I can do the following successfully:
>
> root [2] TObject *myObject = myCutMap->FindObject("R2")
>
> but I'm not sure how to get the value out.
>
> Is this possible with 3.04/02?
>
> Thanks for any help.
>
> -Ed
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET