Ignore:
Timestamp:
May 8, 2017, 1:51:22 PM (8 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
ForceAnnealing_goodresults, ForceAnnealing_tocheck
Children:
1e6fb7
Parents:
01a018
git-author:
Frederik Heber <heber@…> (03/30/17 14:37:42)
git-committer:
Frederik Heber <frederik.heber@…> (05/08/17 13:51:22)
Message:

Removed Vector and Vectors from boost preprocessor magic.

  • this is preparatory for allowing to change the class Dialog::Query<Vector> by specialization and have the Vector stored as string and not directly as Vector.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Dialog.hpp

    r01a018 r2315f3  
    158158  virtual void queryEmpty(const std::string ="", const std::string = "")=0;
    159159
     160  virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = "")=0;
     161  virtual void queryVectors(Parameter< std::vector<Vector> > &, const std::string ="", const std::string = "")=0;
     162
    160163  /** With the following boost::preprocessor code we generate virtual function
    161164   * definitions for all desired query types in the abstract class Dialog.
     
    250253  };
    251254
    252 
    253255  template<class T>
    254256  class TQuery : public Query {
     
    282284};
    283285
     286// we have specialization of Vector to allow internal storing as string
     287template <>
     288void Dialog::query<Vector>(Parameter<Vector> &, const std::string, const std::string);
     289template <>
     290void Dialog::query< std::vector<Vector> >(Parameter< std::vector<Vector> > &, const std::string, const std::string);
     291
     292/** Template specialization for Query<Vector> to allow internal storing of a
     293 * string instead of a Vector.
     294 *
     295 * Because we need to evaluate the string as a possible GeometryRegistry key
     296 * and we may do this only when the Action (whose options we are querying)
     297 * is executed, not before.
     298 */
     299template <>
     300class Dialog::TQuery<Vector> : public Query {
     301public:
     302  TQuery(Parameter<Vector> &_param, const std::string title, const std::string _description = "") :
     303    Query(title, _description), param(_param) {}
     304  virtual ~TQuery(){}
     305  virtual bool handle()=0;
     306  virtual bool isValid(){ return param.isValid(temp);  }
     307  virtual void setResult(){ param.set(temp);  }
     308protected:
     309  Vector temp;
     310  Parameter<Vector> &param;
     311};
     312
     313template <>
     314class Dialog::TQuery< std::vector<Vector> > : public Query {
     315public:
     316  TQuery(Parameter< std::vector<Vector> > &_param, const std::string title, const std::string _description = "") :
     317    Query(title, _description), param(_param) {}
     318  virtual ~TQuery(){}
     319  virtual bool handle()=0;
     320  virtual bool isValid(){ return param.isValid(temp);  }
     321  virtual void setResult(){ param.set(temp);  }
     322protected:
     323  std::vector<Vector> temp;
     324  Parameter< std::vector<Vector> > &param;
     325};
     326
     327
    284328#endif /* DIALOG_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.