Menu

subclassing Factory

Developers
2006-07-28
2013-04-08
  • Roland Pabel

    Roland Pabel - 2006-07-28

    Hi,
    I had been using the Code from Alexandrescu's book and now use loki-0.1.5 . Nice improvements, but one problem :
    I subclass Factory to implement an easier Register() function and other stuff, but this won't compile because the typedef's (ProductCreator and IdToProductMap along with the ParmX list) are private in class Factory. (They are not in Functor.)
    I'd also like to see
    IdToProductMap associations_;
    declared protected so it would be possible to access it, e.g. I implement in my subclass
    bool Contains(const IdentifierType& id) {
      return( dep::associations_.find( id ) != dep::associations_.end() );
    }
    If you think this would be a good change, I can send a patch.
    thanks,
    Roland

     
    • Peter Kuemmel

      Peter Kuemmel - 2006-07-30

      Hi Roland,
      I could imagine initially Andrei didn't thought that someone would like to subclass Factory. But I don't see a reason why we should forbid it. So I think we could change this.

      And I think we could add "Contains" to loki's factory. Do you then still need associations_ as protected? I'm only no 100% about the name Contains.

      Peter

       
    • Roland Pabel

      Roland Pabel - 2006-07-31

      Hi Peter,
      If we would add the method to Factory then I wouldn't need associations_ to be protected.
      Maybe better names are "HasId" or "IdRegistered" ( IdRegistered might be confused with std::vector<...> RegisteredIds() ).
      cu
      Roland

       

Log in to post a comment.