source: trunk/MagicSoft/Mars/mbase/MParContainer.cc@ 5832

Last change on this file since 5832 was 5713, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 23.1 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2005
21!
22!
23\* ======================================================================== */
24
25//////////////////////////////////////////////////////////////////////////////
26//
27// MParContainer
28//
29// The MParContainer class is the base class for all MARS parameter
30// containers. At the moment it is almost the same than ROOT's TNamed.
31// A TNamed contains the essential elements (name, title)
32// to identify a derived object in lists like our MParList or MTaskList.
33// The main difference is that the name and title isn't stored and read
34// to and from root files ("//!")
35//
36// MParContainer has several enhancements compared to TNamed:
37// - GetDescriptor(): returns name and class type
38// - GetUniqueName(): returns a unique name (used in StreamPrimitive)
39// - SetLogStream(MLog *lg): Set a logging stream to which loggingis stored
40// - Reset(): Reset content of class in an eventloop
41// - IsReadyToSave(): The contents are ready to be saved to a file
42// - IsSavedAsPrimitive(): A unique name for this instance is already
43// existing
44// - SetVariables(): Can be overloaded if the containers stores
45// coefficients (to be used in fits)
46// - SetDisplay(): Set a display for redirecting graphical output
47// - GetNames(): Get Name/Title from instance and store it in
48// a TObjArray (used to store the names of the
49// conteiners in a file
50// - SetNames(): vice versa
51// - ReadEnv(), WriteEnv(): Function which is used for automatical setup
52// IsEnvDefined() from a TEnv file
53//
54//////////////////////////////////////////////////////////////////////////////
55#include "MParContainer.h"
56
57#include <ctype.h> // isdigit
58#include <fstream> // ofstream
59
60#include <TEnv.h> // Env::Lookup
61#include <TClass.h> // IsA
62#include <TObjArray.h> // TObjArray
63#include <TBaseClass.h> // GetClassPointer
64#include <TMethodCall.h> // TMethodCall, AsciiWrite
65#include <TDataMember.h> // TDataMember, AsciiWrite
66#include <TVirtualPad.h> // gPad
67
68#include "MString.h"
69
70#include "MLog.h"
71#include "MLogManip.h"
72
73TList *gListOfPrimitives; // forard declaration in MParContainer.h
74
75#undef DEBUG
76//#define DEBUG
77
78ClassImp(MParContainer);
79
80using namespace std;
81
82MParContainer::MParContainer(const char *name, const char *title) :
83 fName(name), fTitle(title), fLog(&gLog), fDisplay(NULL), fReadyToSave(kFALSE)
84{
85}
86
87MParContainer::MParContainer(const TString &name, const TString &title) :
88 fName(name), fTitle(title), fLog(&gLog), fDisplay(NULL), fReadyToSave(kFALSE)
89{
90}
91
92// --------------------------------------------------------------------------
93//
94// MParContainer copy ctor
95//
96MParContainer::MParContainer(const MParContainer &named)
97{
98 fName = named.fName;
99 fTitle = named.fTitle;
100
101 fLog = named.fLog;
102
103 fReadyToSave = named.fReadyToSave;
104
105 fDisplay = named.fDisplay;
106}
107
108MParContainer::~MParContainer()
109{
110#ifdef DEBUG
111 if (fName.IsNull() || fName==(TString)"MTime")
112 return;
113
114 *fLog << all << "Deleting " << GetDescriptor() << endl;
115 if (TestBit(kMustCleanup) && gROOT && gROOT->MustClean())
116 {
117 *fLog << "Recursive Remove..." << flush;
118 if (TestBit(kCanDelete))
119 *fLog << "kCanDelete..." << flush;
120 TIter Next(gROOT->GetListOfCleanups());
121 TObject *o=0;
122 while ((o=Next()))
123 *fLog << dbg << o->GetName() << " [" << o->ClassName() << "]" << endl;
124 *fLog << dbg << "Removing..." << flush;
125 gROOT->GetListOfCleanups()->RecursiveRemove(this);
126 *fLog << "Removed." << endl;
127 }
128#endif
129}
130
131// --------------------------------------------------------------------------
132//
133// MParContainer assignment operator.
134//
135MParContainer& MParContainer::operator=(const MParContainer& rhs)
136{
137 if (this == &rhs)
138 return *this;
139
140 TObject::operator=(rhs);
141
142 fName = rhs.fName;
143 fTitle = rhs.fTitle;
144
145 fLog = rhs.fLog;
146 fReadyToSave = rhs.fReadyToSave;
147
148 return *this;
149}
150
151// --------------------------------------------------------------------------
152//
153// Make a clone of an object using the Streamer facility.
154// If newname is specified, this will be the name of the new object
155//
156TObject *MParContainer::Clone(const char *newname) const
157{
158
159 MParContainer *named = (MParContainer*)TObject::Clone();
160 if (newname && strlen(newname)) named->SetName(newname);
161 return named;
162}
163
164// --------------------------------------------------------------------------
165//
166// Compare two MParContainer objects. Returns 0 when equal, -1 when this is
167// smaller and +1 when bigger (like strcmp).
168//
169Int_t MParContainer::Compare(const TObject *obj) const
170{
171 if (this == obj) return 0;
172 return fName.CompareTo(obj->GetName());
173}
174
175// --------------------------------------------------------------------------
176//
177// Copy this to obj.
178//
179void MParContainer::Copy(TObject &obj)
180#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
181const
182#endif
183{
184 MParContainer &cont = (MParContainer&)obj;
185
186 TObject::Copy(obj);
187
188 cont.fName = fName;
189 cont.fTitle = fTitle;
190
191 cont.fLog = fLog;
192 cont.fReadyToSave = fReadyToSave;
193}
194
195// --------------------------------------------------------------------------
196//
197// Encode MParContainer into output buffer.
198//
199void MParContainer::FillBuffer(char *&buffer)
200{
201 fName.FillBuffer(buffer);
202 fTitle.FillBuffer(buffer);
203}
204
205// --------------------------------------------------------------------------
206//
207// Returns the name of the object. If the name of the object is not the
208// class name it returns the object name and in []-brackets the class name.
209//
210const TString MParContainer::GetDescriptor() const
211{
212 return GetDescriptor(*this);
213}
214
215// --------------------------------------------------------------------------
216//
217// Returns the name of the object. If the name of the object is not the
218// class name it returns the object name and in []-brackets the class name.
219//
220const TString MParContainer::GetDescriptor(const TObject &o)
221{
222 //
223 // Because it returns a (const char*) we cannot return a casted
224 // local TString. The pointer would - immediatly after return -
225 // point to a random memory segment, because the TString has gone.
226 //
227 MString desc;
228 desc.Print("%s [%s]", o.GetName(), o.ClassName());
229 return (TString)o.GetName()==o.ClassName() ? o.ClassName() : desc;
230}
231
232// --------------------------------------------------------------------------
233//
234// Return a unique name for this container. It is created from
235// the container name and the unique Id. (This is mostly used
236// in the StreamPrimitive member functions)
237//
238const TString MParContainer::GetUniqueName() const
239{
240 TString ret = ToLower(fName);
241
242 if (isdigit(ret[ret.Length()-1]))
243 ret+="_";
244
245 ret+=GetUniqueID();
246
247 return ret;
248}
249
250// --------------------------------------------------------------------------
251//
252// List MParContainer name and title.
253//
254void MParContainer::ls(Option_t *) const
255{
256 TROOT::IndentLevel();
257 *fLog << all << GetDescriptor() << " " << GetTitle() << ": kCanDelete=";
258 *fLog << Int_t(TestBit(kCanDelete)) << endl;
259}
260
261// --------------------------------------------------------------------------
262//
263// Print MParContainer name and title.
264//
265void MParContainer::Print(Option_t *) const
266{
267 *fLog << all << GetDescriptor() << " " << GetTitle() << endl;
268}
269
270// --------------------------------------------------------------------------
271//
272// Change (i.e. set) the name of the MParContainer.
273// WARNING !!
274// If the object is a member of a THashTable, THashList container
275// The HashTable must be Rehashed after SetName
276// For example the list of objects in the current directory is a THashList
277//
278void MParContainer::SetName(const char *name)
279{
280 fName = name;
281 ResetBit(kIsSavedAsPrimitive);
282 if (gPad && TestBit(kMustCleanup)) gPad->Modified();
283}
284
285// --------------------------------------------------------------------------
286//
287// Change (i.e. set) all the MParContainer parameters (name and title).
288// See also WARNING in SetName
289//
290void MParContainer::SetObject(const char *name, const char *title)
291{
292 fName = name;
293 fTitle = title;
294 ResetBit(kIsSavedAsPrimitive);
295 if (gPad && TestBit(kMustCleanup)) gPad->Modified();
296}
297
298// --------------------------------------------------------------------------
299//
300// Change (i.e. set) the title of the MParContainer.
301//
302void MParContainer::SetTitle(const char *title)
303{
304 fTitle = title;
305 ResetBit(kIsSavedAsPrimitive);
306 if (gPad && TestBit(kMustCleanup)) gPad->Modified();
307}
308
309// --------------------------------------------------------------------------
310//
311// Return size of the MParContainer part of the TObject.
312//
313Int_t MParContainer::Sizeof() const
314{
315 Int_t nbytes = fName.Sizeof() + fTitle.Sizeof();
316 return nbytes;
317}
318
319// --------------------------------------------------------------------------
320//
321// If you want to use Ascii-Input/-Output (eg. MWriteAsciiFile) of a
322// container, overload this function.
323//
324void MParContainer::AsciiRead(istream &fin)
325{
326 *fLog << warn << "To use the the ascii input of " << GetName();
327 *fLog << " you have to overload " << ClassName() << "::AsciiRead." << endl;
328}
329
330// --------------------------------------------------------------------------
331//
332// Write out a data member given as a TDataMember object to an output stream.
333//
334Bool_t MParContainer::WriteDataMember(ostream &out, const TDataMember *member, Double_t scale) const
335{
336 if (!member)
337 return kFALSE;
338
339 if (!member->IsPersistent() || member->Property()&kIsStatic)
340 return kFALSE;
341
342 /*const*/ TMethodCall *call = ((TDataMember*)member)->GetterMethod(); //FIXME: Root
343 if (!call)
344 {
345 *fLog << warn << "Sorry, no getter method found for " << member->GetName() << endl;
346 return kFALSE;
347 }
348
349 // For debugging: out << member->GetName() << ":";
350
351 switch (call->ReturnType())
352 {
353 case TMethodCall::kLong:
354 Long_t l;
355 call->Execute((void*)this, l); // FIXME: const, root
356 out << l << " ";
357 return kTRUE;
358
359 case TMethodCall::kDouble:
360 Double_t d;
361 call->Execute((void*)this, d); // FIXME: const, root
362 out << (scale*d) << " ";
363 return kTRUE;
364
365 default:
366 //case TMethodCall::kString:
367 //case TMethodCall::kOther:
368 /* someone may want to enhance this? */
369 return kFALSE;
370 }
371}
372
373// --------------------------------------------------------------------------
374//
375// Write out a data member given by name to an output stream.
376//
377Bool_t MParContainer::WriteDataMember(ostream &out, const char *member, Double_t scale) const
378{
379 /*const*/ TClass *cls = IsA()->GetBaseDataMember(member);
380 if (!cls)
381 return kFALSE;
382
383 return WriteDataMember(out, cls->GetDataMember(member), scale);
384}
385
386// --------------------------------------------------------------------------
387//
388// Write out a data member from a given TList of TDataMembers.
389// returns kTRUE when at least one member was successfully written
390//
391Bool_t MParContainer::WriteDataMember(ostream &out, const TList *list) const
392{
393 Bool_t rc = kFALSE;
394
395 TDataMember *data = NULL;
396
397 TIter Next(list);
398 while ((data=(TDataMember*)Next()))
399 rc |= WriteDataMember(out, data);
400
401 return rc;
402}
403
404// --------------------------------------------------------------------------
405//
406// If you want to use Ascii-Input/-Output (eg. MWriteAsciiFile) of a
407// container, you may overload this function. If you don't overload it
408// the data member of a class are written to the file in the order of
409// appearance in the class header (be more specfic: root dictionary)
410// Only data members which are of integer (Bool_t, Int_t, ...) or
411// floating point (Float_t, Double_t, ...) type are written.
412// returns kTRUE when at least one member was successfully written
413//
414Bool_t MParContainer::AsciiWrite(ostream &out) const
415{
416 // *fLog << warn << "To use the the ascii output of " << GetName();
417 // *fLog << " you have to overload " << ClassName() << "::AsciiWrite." << endl;
418
419 Bool_t rc = WriteDataMember(out, IsA()->GetListOfDataMembers());
420
421 TIter NextBaseClass(IsA()->GetListOfBases());
422 TBaseClass *base;
423 while ((base = (TBaseClass*) NextBaseClass()))
424 {
425 /*const*/ TClass *cls = base->GetClassPointer();
426
427 if (!cls)
428 continue;
429
430 if (cls->GetClassVersion())
431 rc |= WriteDataMember(out, cls->GetListOfDataMembers());
432 }
433
434 return rc;
435}
436
437TMethodCall *MParContainer::GetterMethod(const char *name) const
438{
439 const TString n(name);
440 const Int_t pos1 = n.First('.');
441
442 const TString part1 = pos1<0 ? n : n(0, pos1);
443 const TString part2 = pos1<0 ? TString("") : n(pos1+1, n.Length());
444
445 TClass *cls = IsA()->GetBaseDataMember(part1);
446 if (cls)
447 {
448 TDataMember *member = cls->GetDataMember(part1);
449 if (!member)
450 {
451 *fLog << err << "Datamember '" << part1 << "' not in " << GetDescriptor() << endl;
452 return NULL;
453 }
454
455 // This handles returning references of contained objects, eg
456 // class X { TObject fO; TObject &GetO() { return fO; } };
457 if (!member->IsBasic() && !part2.IsNull())
458 {
459 cls = gROOT->GetClass(member->GetTypeName());
460 if (!cls)
461 {
462 *fLog << err << "Datamember " << part1 << " [";
463 *fLog << member->GetTypeName() << "] not in dictionary." << endl;
464 return NULL;
465 }
466 if (!cls->InheritsFrom(MParContainer::Class()))
467 {
468 *fLog << err << "Datamember " << part1 << " [";
469 *fLog << member->GetTypeName() << "] does not inherit from ";
470 *fLog << "MParContainer." << endl;
471 return NULL;
472 }
473
474 const MParContainer *sub = (MParContainer*)((ULong_t)this+member->GetOffset());
475 return sub->GetterMethod(part2);
476 }
477
478 if (member->IsaPointer())
479 {
480 *fLog << warn << "Data-member " << part1 << " is a pointer..." << endl;
481 *fLog << dbginf << "Not yet implemented!" << endl;
482 //TClass *test = gROOT->GetClass(member->GetTypeName());
483 return 0;
484 }
485
486 TMethodCall *call = member->GetterMethod();
487 if (call)
488 return call;
489 }
490
491 *fLog << warn << "No standard access for '" << part1 << "' in ";
492 *fLog << GetDescriptor() << " or one of its base classes." << endl;
493
494 TMethodCall *call = NULL;
495
496 *fLog << warn << "Trying to find MethodCall '" << ClassName();
497 *fLog << "::Get" << part1 << "' instead <LEAKS MEMORY>" << endl;
498 call = new TMethodCall(IsA(), (TString)"Get"+part1, "");
499 if (call->GetMethod())
500 return call;
501
502 delete call;
503
504 *fLog << warn << "Trying to find MethodCall '" << ClassName();
505 *fLog << "::" << part1 << "' instead <LEAKS MEMORY>" << endl;
506 call = new TMethodCall(IsA(), part1, "");
507 if (call->GetMethod())
508 return call;
509
510 delete call;
511
512 *fLog << err << "Sorry, no getter method found for " << part1 << endl;
513 return NULL;
514}
515
516// --------------------------------------------------------------------------
517//
518// Implementation of SavePrimitive. Used to write the call to a constructor
519// to a macro. In the original root implementation it is used to write
520// gui elements to a macro-file.
521//
522void MParContainer::SavePrimitive(ofstream &out, Option_t *o)
523{
524 static UInt_t uid = 0;
525
526 if (IsSavedAsPrimitive())
527 return;
528
529 SetUniqueID(uid++);
530 SetBit(kIsSavedAsPrimitive);
531
532 if (gListOfPrimitives && !gListOfPrimitives->FindObject(this))
533 gListOfPrimitives->Add(this);
534
535 StreamPrimitive(out);
536}
537
538// --------------------------------------------------------------------------
539//
540// Creates the string written by SavePrimitive and returns it.
541//
542void MParContainer::StreamPrimitive(ofstream &out) const
543{
544 out << " // Using MParContainer::StreamPrimitive" << endl;
545 out << " " << ClassName() << " " << GetUniqueName() << "(\"";
546 out << fName << "\", \"" << fTitle << "\");" << endl;
547}
548
549void MParContainer::GetNames(TObjArray &arr) const
550{
551 arr.AddLast(new TNamed(fName, fTitle));
552}
553
554void MParContainer::SetNames(TObjArray &arr)
555{
556 TNamed *name = (TNamed*)arr.First();
557
558 fName = name->GetName();
559 fTitle = name->GetTitle();
560
561 delete arr.Remove(name);
562 arr.Compress();
563}
564
565// --------------------------------------------------------------------------
566//
567// Creates a new instance of this class. The idea is to create a clone of
568// this class in its initial state.
569//
570MParContainer *MParContainer::New() const
571{
572 return (MParContainer*)IsA()->New();
573}
574
575// --------------------------------------------------------------------------
576//
577// Read the contents/setup of a parameter container/task from a TEnv
578// instance (steering card/setup file).
579// The key to search for in the file should be of the syntax:
580// prefix.vname
581// While vname is a name which is specific for a single setup date
582// (variable) of this container and prefix is something like:
583// evtloopname.name
584// While name is the name of the containers/tasks in the parlist/tasklist
585//
586// eg. Job4.MImgCleanStd.CleaningLevel1: 3.0
587// Job4.MImgCleanStd.CleaningLevel2: 2.5
588//
589// If this cannot be found the next step is to search for
590// MImgCleanStd.CleaningLevel1: 3.0
591// And if this doesn't exist, too, we should search for:
592// CleaningLevel1: 3.0
593//
594// Warning: The programmer is responsible for the names to be unique in
595// all Mars classes.
596//
597// Return values:
598// kTRUE: Environment string found
599// kFALSE: Environment string not found
600// kERROR: Error occured, eg. environment invalid
601//
602// Overload this if you don't want to control the level of setup-string. In
603// this case ReadEnv gets called with the different possibilities, see TestEnv.
604//
605Int_t MParContainer::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
606{
607 if (!IsEnvDefined(env, prefix, "", print))
608 return kFALSE;
609
610 *fLog << warn << "WARNING - Resource " << prefix+fName << " found, but no " << ClassName() << "::ReadEnv." << endl;
611 return kTRUE;
612}
613
614// --------------------------------------------------------------------------
615//
616// Write the contents/setup of a parameter container/task to a TEnv
617// instance (steering card/setup file).
618// The key to search for in the file should be of the syntax:
619// prefix.vname
620// While vname is a name which is specific for a single setup date
621// (variable) of this container and prefix is something like:
622// evtloopname.name
623// While name is the name of the containers/tasks in the parlist/tasklist
624//
625// eg. Job4.MImgCleanStd.CleaningLevel1: 3.0
626// Job4.MImgCleanStd.CleaningLevel2: 2.5
627//
628// If this cannot be found the next step is to search for
629// MImgCleanStd.CleaningLevel1: 3.0
630// And if this doesn't exist, too, we should search for:
631// CleaningLevel1: 3.0
632//
633// Warning: The programmer is responsible for the names to be unique in
634// all Mars classes.
635//
636Bool_t MParContainer::WriteEnv(TEnv &env, TString prefix, Bool_t print) const
637{
638 if (!IsEnvDefined(env, prefix, "", print))
639 return kFALSE;
640
641 *fLog << warn << "WARNING - Resource " << prefix+fName << " found, but " << ClassName() << "::WriteEnv not overloaded." << endl;
642 return kTRUE;
643}
644
645// --------------------------------------------------------------------------
646//
647// Take the prefix and call ReadEnv for:
648// prefix.containername
649// prefix.classname
650// containername
651// classname
652//
653// The existance of an environment variable is done in this order. If
654// ReadEnv return kTRUE the existance of the container setup is assumed and
655// the other tests are skipped. If kFALSE is assumed the sequence is
656// continued. In case of kERROR failing of the setup from a file is assumed.
657//
658// Overload this if you want to control the handling of level of setup-string
659// mentioned above. In this case ReadEnv gets never called if you don't call
660// it explicitly.
661//
662Int_t MParContainer::TestEnv(const TEnv &env, TString prefix, Bool_t print)
663{
664 if (print)
665 *fLog << all << "Testing Prefix+ContName: " << prefix+GetName() << endl;
666 Int_t rc = ReadEnv(env, prefix+GetName(), print);
667 if (rc==kERROR || rc==kTRUE)
668 return rc;
669
670 // Check For: Job4.MClassName.Varname
671 if (print)
672 *fLog << all << "Testing Prefix+ClasName: " << prefix+ClassName() << endl;
673 rc = ReadEnv(env, prefix+ClassName(), print);
674 if (rc==kERROR || rc==kTRUE)
675 return rc;
676
677 // Check For: ContainerName.Varname
678 if (print)
679 *fLog << all << "Testing ContName: " << GetName() << endl;
680 rc = ReadEnv(env, GetName(), print);
681 if (rc==kERROR || rc==kTRUE)
682 return rc;
683
684 // Check For: MClassName.Varname
685 if (print)
686 *fLog << all << "Testing ClassName: " << ClassName() << endl;
687 rc = ReadEnv(env, ClassName(), print);
688 if (rc==kERROR || rc==kTRUE)
689 return rc;
690
691 // Not found
692 return kFALSE;
693}
694
695Bool_t MParContainer::IsEnvDefined(const TEnv &env, TString prefix, TString postfix, Bool_t print) const
696{
697 if (!postfix.IsNull())
698 postfix.Insert(0, ".");
699
700 return IsEnvDefined(env, prefix+postfix, print);
701}
702
703Bool_t MParContainer::IsEnvDefined(const TEnv &env, TString name, Bool_t print) const
704{
705 if (print)
706 *fLog << all << GetDescriptor() << " - " << name << "... " << flush;
707
708 if (!((TEnv&)env).Defined(name))
709 {
710 if (print)
711 *fLog << "not found." << endl;
712 return kFALSE;
713 }
714
715 if (print)
716 *fLog << "found." << endl;
717
718 return kTRUE;
719}
720
721Int_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, Int_t dflt) const
722{
723 return GetEnvValue(env, prefix+"."+postfix, dflt);
724}
725
726Double_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, Double_t dflt) const
727{
728 return GetEnvValue(env, prefix+"."+postfix, dflt);
729}
730
731const char *MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, const char *dflt) const
732{
733 return GetEnvValue(env, prefix+"."+postfix, dflt);
734}
735
736Int_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, Int_t dflt) const
737{
738 return ((TEnv&)env).GetValue(prefix, dflt);
739}
740
741Double_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, Double_t dflt) const
742{
743 return ((TEnv&)env).GetValue(prefix, dflt);
744}
745
746const char *MParContainer::GetEnvValue(const TEnv &env, TString prefix, const char *dflt) const
747{
748 return ((TEnv&)env).GetValue(prefix, dflt);
749}
Note: See TracBrowser for help on using the repository browser.