How to express if-else (indicator) constraints in cvx?

see

by the way, the function f you posted is concave to X, it can be expressd by f=(-abs(x)+x)/2+a; in cvx.