class QPanda::CExprFactory¶
Overview¶
classical expr class factory More…
#include <CExprFactory.h> class CExprFactory { public: // typedefs typedef std::function<CExpr*(CBit*)> cbit_constructor_t; typedef std::map<std::string, cbit_constructor_t> cbit_constructor_map_t; typedef std::function<CExpr*(cbit_size_t)> value_constructor_t; typedef std::map<std::string, value_constructor_t> value_constructor_map_t; typedef std::function<CExpr*(CExpr*, CExpr*, int)> operator_constructor_t; typedef std::map<std::string, operator_constructor_t> operator_constructor_map_t; // fields cbit_constructor_map_t _CExpr_CBit_Constructor; value_constructor_map_t _CExpr_Value_Constructor; operator_constructor_map_t _CExpr_Operator_Constructor; // methods static CExprFactory& GetFactoryInstance(); CExpr* GetCExprByCBit(CBit* cbit); void registerclass_CBit_(std::string& name, cbit_constructor_t constructor); CExpr* GetCExprByValue(cbit_size_t value); void registerclass_Value_(std::string&, value_constructor_t); CExpr* GetCExprByOperation(CExpr* left_cexpr, CExpr* right_cexpr, int operat); void registerclass_operator_ (std::string&, operator_constructor_t); };
Detailed Documentation¶
classical expr class factory
Typedefs¶
typedef std::function<CExpr*(CBit*)> cbit_constructor_t
We typedef the cbit_constructor_t is a constructor that use cbit create cexpr.
typedef std::map<std::string, cbit_constructor_t> cbit_constructor_map_t
We typedef the cbit_constructor_map_t is a collection of constructors that use cbit create cexpr.
typedef std::function<CExpr*(cbit_size_t)> value_constructor_t
We typedef the value_constructor_t is a constructor that use value create cexpr.
typedef std::map<std::string, value_constructor_t> value_constructor_map_t
We typedef the value_constructor_map_t is a collection of constructors that use value create cexpr.
typedef std::function<CExpr*(CExpr*, CExpr*, int)> operator_constructor_t
We typedef the operator_constructor_t is a constructor that use operator create cexpr.
typedef std::map<std::string, operator_constructor_t> operator_constructor_map_t
We typedef the operator_constructor_map_t is a collection of constructors that use operator create cexpr.
Fields¶
cbit_constructor_map_t _CExpr_CBit_Constructor
A collection of constructors that use cbit create cexpr.
value_constructor_map_t _CExpr_Value_Constructor
A collection of constructors that use value create cexpr.
operator_constructor_map_t _CExpr_Operator_Constructor
A collection of constructors that use operator create cexpr.
Methods¶
static CExprFactory& GetFactoryInstance()
Get the Factory Instance object.
Returns:
CExpr* GetCExprByCBit(CBit* cbit)
Get cexpr by cbit.
Parameters:
cbit |
target cbit |
Returns:
CExpr*
void registerclass_CBit_(std::string& name, cbit_constructor_t constructor)
Registration function This function can be used to register constructors that inherit subclasses of the CExpr class.
Parameters:
std::string |
name subclass name |
cbit_constructor_t |
constructor subclass constructor |
CExpr* GetCExprByValue(cbit_size_t value)
Get cexpr by value.
Parameters:
cbit_size_t |
target value |
Returns:
CExpr*
void registerclass_Value_(std::string&, value_constructor_t)
Registration function This function can be used to register constructors that inherit subclasses of the CExpr class.
Parameters:
std::string |
subclass name |
value_constructor_t |
subclass constructor |
CExpr* GetCExprByOperation(CExpr* left_cexpr, CExpr* right_cexpr, int operat)
Get cexpr by Operation.
Parameters:
CExpr* |
left CExpr |
CExpr* |
right CExpr |
int |
target operator |
Returns:
CExpr*
void registerclass_operator_ (std::string&, operator_constructor_t)
Registration function This function can be used to register constructors that inherit subclasses of the CExpr class.
Parameters:
std::string |
subclass name |
operator_constructor_t |
subclass constructor |