So in C++ once you have a transform node (through checking if the object that you're iterating over is an MFn:kTransform), you can get it's shape using
extendToShape. If that returns a null then it is most likely a group node. BUT, there isn't a true and full way to tell.
There are operations in Maya that can create empty transform nodes, like splitting mesh into it's separate components. This will return in the example I give above and, depending on your use case, then likely be an error to you.