How to compute a functional in C++?

Hi all, I just started working with fenics and I couldn’t find any Information of how to compute a functional in C++. For example how do I compute for a given function u
J(u)= \int_\Omega u^2 dx .
I am not looking for the L2-Norm, but for the evaluation of any functional.