Ignore:
Timestamp:
02/21/02 12:08:03 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r1211 r1218  
    214214// --------------------------------------------------------------------------
    215215//
     216//  Write out a data member given as a TDataMember object to an output stream.
     217//
     218Bool_t MParContainer::WriteDataMember(ostream &out, TDataMember *member) const
     219{
     220    if (!member)
     221        return kFALSE;
     222
     223    if (!member->IsPersistent())
     224        return kFALSE;
     225
     226    /*const*/ TMethodCall *call = member->GetterMethod(); //FIXME: Root
     227    if (!call)
     228        return kFALSE;
     229
     230    switch (call->ReturnType())
     231    {
     232    case TMethodCall::kLong:
     233        Long_t l;
     234        call->Execute((void*)this, l); // FIXME: const, root
     235        out << l << " ";
     236        return kTRUE;
     237
     238    case TMethodCall::kDouble:
     239        Double_t d;
     240        call->Execute((void*)this, d); // FIXME: const, root
     241        out << d << " ";
     242        return kTRUE;
     243
     244    case TMethodCall::kOther:
     245        /* someone may want to enhance this? */
     246        return kFALSE;
     247    }
     248
     249    return kFALSE;
     250}
     251
     252// --------------------------------------------------------------------------
     253//
     254//  Write out a data member given by name to an output stream.
     255//
     256Bool_t MParContainer::WriteDataMember(ostream &out, const char *member) const
     257{
     258    return WriteDataMember(out, IsA()->GetDataMember(member));
     259}
     260
     261// --------------------------------------------------------------------------
     262//
    216263//  If you want to use Ascii-Input/-Output (eg. MWriteAsciiFile) of a
    217264//  container, you may overload this function. If you don't overload it
     
    221268//  floating point (Float_t, Double_t, ...) type are written.
    222269//
    223 void MParContainer::AsciiWrite(ofstream &fout) const
     270void MParContainer::AsciiWrite(ostream &out) const
    224271{
    225272    // *fLog << warn << "To use the the ascii output of " << GetName();
     
    230277    TIter Next(IsA()->GetListOfDataMembers());
    231278    while ((data=(TDataMember*)Next()))
    232     {
    233         if (!data->IsPersistent())
    234             continue;
    235 
    236         /*const*/ TMethodCall *call = data->GetterMethod(); //FIXME: Root
    237         if (!call)
    238             continue;
    239 
    240         switch (call->ReturnType())
    241         {
    242         case TMethodCall::kLong:
    243             Long_t l;
    244             call->Execute((void*)this, l); // FIXME: const, root
    245             fout << l << " ";
    246             continue;
    247 
    248         case TMethodCall::kDouble:
    249             Double_t d;
    250             call->Execute((void*)this, d); // FIXME: const, root
    251             fout << d << " ";
    252             continue;
    253 
    254         case TMethodCall::kOther:
    255             /* someone may want to enhance this? */
    256             continue;
    257         }
    258     }
    259 }
     279        WriteDataMember(out, data);
     280}
Note: See TracChangeset for help on using the changeset viewer.