PolyBoRi
VariableFactory.h
Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //*****************************************************************************
00015 //*****************************************************************************
00016 
00017 #ifndef polybori_factories_VariableFactory_h_
00018 #define polybori_factories_VariableFactory_h_
00019 
00020 // include basic definitions
00021 #include <polybori/pbori_defs.h>
00022 #include <polybori/factories/CFactoryBase.h>
00023 #include <polybori/BooleVariable.h>
00024 
00025 BEGIN_NAMESPACE_PBORI
00026 
00033 class VariableFactory:
00034   public CFactoryBase {
00036   typedef VariableFactory self;
00037 
00039   typedef CFactoryBase base;
00040 
00041 public:
00043   typedef base::parent_type parent_type;
00044 
00046   typedef BooleVariable value_type;
00047 
00049   VariableFactory(const parent_type& ring): base(ring) {}
00050 
00052   VariableFactory(const self& rhs): base(rhs)  {}
00053 
00055   ~VariableFactory() {}
00056 
00058   value_type operator()() const {
00059     return value_type(0, parent());
00060   }
00061 
00063   value_type operator()(const value_type& rhs) const {
00064     return rhs;
00065   }
00066 
00068   value_type operator()(const value_type::ring_type& ring) const {
00069     return value_type(0, ring);
00070   }
00071 
00073   value_type operator()(value_type::idx_type idx,
00074                         const value_type::ring_type& ring) const {
00075     return value_type(idx, ring);
00076   }
00078   value_type operator()(value_type::idx_type idx) const {
00079     return value_type(idx, parent());
00080   }
00081 };
00082 
00083 END_NAMESPACE_PBORI
00084 
00085 #endif /* polybori_factories_VariableFactory_h_ */