Added some constant modifier and casting for C++ compliant.