change dag to C++ structure